diff --git a/Datasets/CAC40.csv b/Datasets/CAC40.csv new file mode 100644 index 0000000..564204b --- /dev/null +++ b/Datasets/CAC40.csv @@ -0,0 +1 @@ +Symbol ML.PA CAP.PA ORA.PA SGO.PA CA.PA KER.PA WLN.PA ACA.PA MC.PA ATO.PA RI.PA VIE.PA UG.PA AIR.PA BN.PA ENGI.PA FP.PA AC.PA VIV.PA DG.PA SAN.PA SW.PA GLE.PA EN.PA LR.PA SU.PA BNP.PA OR.PA HO.PA \ No newline at end of file diff --git a/Datasets/FTSE100.csv b/Datasets/FTSE100.csv new file mode 100644 index 0000000..0c269b6 --- /dev/null +++ b/Datasets/FTSE100.csv @@ -0,0 +1,1291 @@ +Symbol +AV.L +AHT.L +AZN.L +AGL.L +PETS.L +LAS.L +AXS.L +AAL.L +SMA.L +RMP.L +FSJ.L +CAMB.L +BBA.L +BATS.L +AVV.L +ASH.L +AHCG.L +ABF.L +ABC.L +BARC.L +LLOY.L +RBS.L +LRE.L +BRBY.L +BP.L +BOE.L +BLND.L +BA.L +BKG.L +MAB.L +GKP.L +BVS.L +BVIC.L +BOK.L +BAB.L +PEBI.L +BRW.L +BMY.L +BGO.L +BGEO.L +BDEV.L +OCN.L +MAIL.L +HSX.L +GFM.L +RDSB.L +DEB.L +DCG.L +LWDB.L +DOM.L +DCC.L +JDW.L +DRX.L +DLAR.L +SMDS.L +RMG.L +DVO.L +DPP.L +DNLM.L +DKL.L +DJAN.L +DDDD.L +BFA.L +SPD.L +PDL.L +GEMD.L +EDP.L +DRV.L +DPH.L +DPA.L +DGB.L +DFIB.L +DEMG.L +DCD.L +DC.L +C4XD.L +STEL.L +SEPL.L +MCON.L +KMK.L +HZD.L +GDL.L +FDI.L +FDEV.L +EKF.L +EXPN.L +ECM.L +KWE.L +CNE.L +RKH.L +NEX.L +LSE.L +EVR.L +ESUR.L +EBQ.L +GEC.L +EZJ.L +EXI.L +ETO.L +ELM.L +UVEL.L +ULE.L +TRIN.L +TOM.L +PCGE.L +OPHR.L +MYT.L +MTL.L +JEL.L +IAG.L +GWI.L +ESG.L +ERGO.L +EPWN.L +EME.L +EDR.L +BVA.L +BKY.L +ZHEH.L +PFG.L +IPF.L +FGP.L +FRES.L +JUP.L +FPM.L +COD.L +TTA.L +NFC.L +MCRO.L +JD.L +IOG.L +HFG.L +GLIF.L +FXPO.L +FOXT.L +FOUR.L +FLYB.L +FDSA.L +FBT.L +FAN.L +CARD.L +TPF.L +TIR.L +NG.L +GLEN.L +VOD.L +SRP.L +HSBA.L +STAN.L +GSK.L +CPG.L +CCL.L +SIA.L +RR.L +OML.L +IMG.L +III.L +CNA.L +WEIR.L +TCG.L +RNK.L +RIO.L +PFC.L +LMI.L +LGEN.L +ISAT.L +GOG.L +COB.L +WTB.L +WG.L +VCT.L +ULVR.L +TLW.L +SNR.L +SHB.L +SDY.L +SDR.L +QRT.L +NANO.L +MRW.L +MGGT.L +JMAT.L +ITV.L +GNS.L +GNC.L +CLLN.L +WMH.L +UKOG.L +TRS.L +TEP.L +TATE.L +SLI.L +SGE.L +SBRY.L +RTO.L +RTN.L +RSA.L +RRS.L +PSON.L +PNN.L +NOG.L +LRM.L +KIE.L +KGF.L +KAZ.L +JLT.L +IMI.L +IGG.L +HSTN.L +HOC.L +GKN.L +GFRD.L +CWK.L +CLDN.L +WEB.L +VER.L +UANC.L +TSCO.L +TPK.L +TCM.L +SXS.L +SSPG.L +SMP.L +SAGA.L +ROL.L +REL.L +RE.L +PZC.L +PUB.L +PRV.L +PML.L +PDG.L +PAY.L +PAG.L +OXIG.L +OVG.L +OCDO.L +MTW.L +MTPH.L +MONY.L +MERC.L +MCGN.L +MARS.L +LSL.L +KLR.L +INF.L +INCH.L +ICP.L +HVN.L +HMSO.L +HL.L +HGM.L +HEAD.L +HAS.L +GRI.L +GLE.L +GFS.L +CBG.L +BYG.L +BWY.L +BQE.L +WKP.L +WHI.L +VTC.L +TW.L +TRX.L +TRK.L +TON.L +TIDE.L +TALK.L +SVT.L +SVE.L +SVCA.L +SUH.L +STJ.L +STHR.L +STB.L +STAF.L +SRB.L +SPO.L +SPI.L +SOLG.L +SNT.L +SN.L +SML.L +SMJ.L +SIV.L +SHRE.L +SHI.L +SGRO.L +SDRC.L +SDL.L +RTC.L +RSW.L +RPS.L +RPC.L +ROR.L +RNWH.L +RMM.L +RGP.L +RAT.L +QTX.L +QQ.L +QP.L +PTCM.L +PSN.L +PRU.L +POS.L +PMG.L +PHNX.L +PGH.L +OSB.L +OMG.L +OBT.L +NXT.L +NWT.L +NSCI.L +NRR.L +NCC.L +NBB.L +NASA.L +MWG.L +MUBL.L +MSYS.L +MSMN.L +MRO.L +MOGP.L +MNDI.L +MLC.L +MKS.L +MCKS.L +LSR.L +LRD.L +LND.L +RYA.L +HON.L +NHY.L +IHG.L +HTG.L +HSV.L +HSS.L +HSP.L +HLMA.L +HFD.L +HAYD.L +GHH.L +ALY.L +VENN.L +TXH.L +TEF.L +SPHR.L +SHP.L +WPP.L +3IN.L +POLY.L +RICO.L +MBO.L +JPR.L +JKX.L +CREI.L +CHOO.L +BOOM.L +BEZ.L +UBM.L +TYT.L +STAR.L +SCHO.L +ROSN.L +MNOD.L +MCLS.L +LTHM.L +LKOH.L +KNM.L +JLP.L +JIM.L +JIL.L +JDG.L +GRL.L +GENL.L +CSFG.L +CRPR.L +CIR.L +CEY.L +BMTO.L +BMT.L +AKRN.L +MYSL.L +CMCL.L +JHD.L +UJO.L +LXB.L +MMK.L +SSA.L +CIU.L +TPFZ.L +OGZD.L +MASA.L +VTBR.L +BZM.L +KIBO.L +KMR.L +KGP.L +KENV.L +KEFI.L +KCOM.L +IKK.L +AGK.L +TILS.L +TET.L +SKG.L +PLP.L +PEL.L +LEAF.L +KSK.L +KOOV.L +KOD.L +KLN.L +KBT.L +KAKU.L +KHTC.L +GNK.L +FRR.L +FLK.L +FCRM.L +EYE.L +CLST.L +URU.L +PLAZ.L +GRPH.L +BWNG.L +YNGN.L +ULS.L +NYO.L +NUM.L +NTQ.L +NTG.L +NMD.L +NLMK.L +NIPT.L +NICL.L +SBER.L +CDI.L +SOLO.L +SAUD.L +SCIN.L +RCP.L +PMO.L +PHI.L +ORCP.L +OPPP.L +OCT.L +FOG.L +ELA.L +CLIG.L +CHAR.L +BAF.L +ATST.L +OEX.L +OTMT.L +CZA.L +EOG.L +PTEC.L +RDI.L +CRH.L +ZMNO.L +QXT.L +QFI.L +CROS.L +MAB1.L +ENTU.L +GAMA.L +AERO.L +SQS.L +RRL.L +INDV.L +CAL.L +XTR.L +URA.L +SRT.L +SRES.L +SGZ.L +SZCD.L +TYRU.L +UU.L +UTG.L +UCG.L +TYR.L +SPSY.L +SOM.L +MHM.L +LLD1.L +GFTU.L +GEEC.L +DUPD.L +BXP.L +BC94.L +CCC.L +ATMA.L +WAFM.L +VTU.L +VSVS.L +VRP.L +VP.L +VLE.L +VIS.L +VIP.L +VGAS.L +VEC.L +VCP.L +VAL.L +PREM.L +MIL.L +LIV.L +BME.L +AMC.L +AGR.L +AGQ.L +AGP.L +AAA.L +VLX.L +0N2Z.L +NCCL.L +NWIG.L +FLX.L +OTC.L +VRS.L +WTI.L +WSG.L +WSBN.L +WLFE.L +WINK.L +WIN.L +WIL.L +TLA.L +SPX.L +SMWH.L +SLE.L +MWE.L +GAW.L +AFS.L +WSL.L +GWMO.L +WYN.L +XPP.L +XAR.L +XLM.L +XSG.L +IHC.L +AVCT.L +YOU.L +YNGA.L +TLY.L +RRR.L +RGM.L +PHP.L +PFP.L +CTP.L +YOLO.L +SCH.L +DLG.L +NXR.L +DTC.L +BWO.L +0QP2.L +ZZZ.L +SHOE.L +AST.L +ZIOC.L +ZOL.L +ZAM.L +ZYT.L +ZTF.L +ZBO.L +ZOO.L +WATR.L +CHZN.L +AAU.L +AAZ.L +ABZA.L +ABDP.L +ABBY.L +ACL.L +ACID.L +ACC.L +AEG.L +BVC.L +ADT.L +ADM.L +AMS.L +AFN.L +0QNM.L +AEX.L +SPRP.L +AEP.L +AFRB.L +AFC.L +PAF.L +AFHP.L +AFID.L +PMEA.L +CZB.L +AGY.L +AGRO.L +AGM.L +0QMG.L +0P6O.L +0P6S.L +0QP5.L +0QJS.L +0P6N.L +AGTA.L +0QO3.L +0QKI.L +AMPH.L +0QLR.L +AIEA.L +0P6M.L +AKR.L +BPKD.L +ALM.L +APH.L +ANR.L +ALT.L +AXM.L +ALU.L +ALPH.L +ARGP.L +ALBA.L +AMP.L +AMER.L +AMBR.L +AMO.L +0OGQ.L +ANTO.L +SCL.L +EAH.L +ANP.L +ANCR.L +DMGT.L +HNL.L +APF.L +HSM.L +RIV.L +ASY.L +RKMD.L +AYM.L +AOMD.L +AOR.L +APC.L +ARW.L +ARL.L +ARGO.L +ARBB.L +ARG.L +ARDN.L +ARO.L +ARTA.L +ASTO.L +ASHM.L +LIO.L +ASC.L +ASCD.L +IPX.L +0Q8M.L +0P0T.L +ASBE.L +CAML.L +ASPL.L +ATQT.L +ATAD.L +SEE.L +MNC.L +FCR.L +BSE.L +AUG.L +AVN.L +AVM.L +AVG.L +AVON.L +AVAP.L +BCN.L +BAG.L +TIBD.L +HLCL.L +BLEY.L +BKM.L +BBY.L +TGBD.L +SBID.L +GRTB.L +BBOX.L +BCRE.L +BLV.L +RB.L +BMK.L +BEM.L +BEG.L +NTBR.L +BZT.L +TCS.L +SNGR.L +BLT.L +GMR.L +BIOM.L +BILN.L +BISI.L +BILL.L +OXB.L +LNTA.L +BLVN.L +BLUR.L +BLBD.L +BRD.L +BLU.L +CTI.L +CAPD.L +RQIH.L +SLP.L +BMN.L +RLD.L +SRO.L +PURE.L +BMS.L +BMR.L +BNZL.L +BNC.L +BOR.L +LWB.L +BOY.L +BON.L +BOD.L +BOO.L +SIS.L +BPC.L +BPM.L +KWS.L +BRK.L +HVT.L +BRY.L +MOSB.L +MBH.L +LKOD.L +HYDR.L +BYOT.L +GAL.L +CDFF.L +CAU.L +CAR.L +CAPC.L +CAD.L +SGR.L +POLR.L +PLA.L +COG.L +CMX.L +CAY.L +CAM.L +CAKE.L +CFYN.L +CMBN.L +CBQS.L +CBKD.L +CCP.L +CCT.L +CCR.L +CNIC.L +OPM.L +CLL.L +FETD.L +CEPS.L +C21.L +CWR.L +CRND.L +GOAL.L +CNKS.L +STCM.L +CLTV.L +CFX.L +CFHS.L +CGS.L +CGH.L +CGVD.L +CTG.L +CHRT.L +CTR.L +CSN.L +CHH.L +CHA.L +CNSD.L +0QR4.L +58GZ.L +CIC.L +CINE.L +CIN.L +CKN.L +CLNR.L +CLI.L +CLG.L +IXI.L +CLIN.L +CTO.L +CMS.L +CMH.L +CML.L +CNC.L +CNR.L +CNN.L +CNMI.L +CNEL.L +CPP.L +CPI.L +CPX.L +CPS.L +CPR.L +CRL.L +CSSG.L +CRW.L +CRAW.L +CRU.L +PVCS.L +WCW.L +CTH.L +CVSG.L +CVR.L +CWD.L +CYAN.L +UEN.L +DTG.L +RDT.L +DAL.L +DALR.L +DLN.L +DGE.L +DPLM.L +DIA.L +KDR.L +HDIV.L +ODX.L +GMD.L +DSG.L +SDI.L +DIGS.L +0MGD.L +DOTD.L +DODS.L +GDG.L +DRG.L +FEVR.L +DWHA.L +DWHT.L +MERL.L +EZH.L +EPO.L +LME.L +ECK.L +ELLA.L +EDL.L +EDEN.L +EFGD.L +EGS.L +EGMD.L +EIH.L +EKT.L +TTG.L +ELCO.L +MEL.L +SMSD.L +TRE.L +EMG.L +EMAN.L +EMIS.L +ESP.L +EMR.L +SOU.L +SEY.L +PHE.L +INSE.L +IGAS.L +HAWK.L +GOOD.L +ENQ.L +INSP.L +PAL.L +ERM.L +GPOR.L +ESCH.L +TDE.L +MTVW.L +SRE.L +MOLD.L +0P2N.L +0HIT.L +ETX.L +ETLN.L +0N4Y.L +EUSP.L +EUA.L +0HZC.L +0QE2.L +HVE.L +EVG.L +MPE.L +KMG.L +FFX.L +FJET.L +FRP.L +FBDU.L +FBH.L +FCCN.L +FDM.L +FDL.L +FDP.L +FDBK.L +FENR.L +FEN.L +PCF.L +LFI.L +FKE.L +FIF.L +0QFC.L +MFX.L +FLO.L +RGD.L +PFD.L +FOX.L +0P4F.L +TUNE.L +VLG.L +FPO.L +0MGU.L +FSTA.L +FTC.L +FUM.L +FUL.L +FUTR.L +GRIO.L +INDI.L +GAID.L +NTOG.L +HDY.L +STR.L +VOG.L +GLR.L +LOGP.L +ITRK.L +IPO.L +IME.L +GRG.L +TYM.L +TSTL.L +TSG.L +TRIC.L +TRI.L +TPT.L +TNI.L +TFW.L +TCN.L +TAN.L +SXX.L +SVS.L +SUS.L +SUN.L +SULA.L +STY.L +STI.L +STCK.L +SRSP.L +SPT.L +SPH.L +SPE.L +SNG.L +SND.L +SMS.L +SMIN.L +SGI.L +SGC.L +SFR.L +SAVP.L +SAL.L +RPT.L +RHL.L +RENE.L +RCN.L +RBN.L +PTY.L +PTD.L +PRM.L +PRES.L +PPS.L +POG.L +PNS.L +PIM.L +PHTM.L +PHO.L +PEN.L +PANR.L +MUR.L +MUL.L +MTO.L +MTC.L +MSLH.L +MSG.L +MOS.L +MONI.L +MLIN.L +MKLW.L +MGNS.L +MER.L +MDZ.L +MBT.L +MAI.L +MACF.L +LTG.L +LSC.L +LPA.L +LOOK.L +LOK.L +LMP.L +LGT.L +LEG.L +LDSG.L +LAND.L +ITQ.L +ITE.L +IOM.L +INVP.L +INL.L +IMTK.L +IMO.L +IGR.L +IGP.L +IGE.L +HZM.L +HYNS.L +HUM.L +HRG.L +HMLH.L +HILS.L +HCFT.L +GPX.L +GHE.L +GGP.L +GDWN.L +GDP.L +TRCS.L +SOG.L +IDH.L +RCDO.L +MCB.L +MAGP.L +GTC.L +TRAF.L +SAG.L +WGB.L +SLN.L +7DIG.L +NBI.L +GCM.L +GFIN.L +SSTY.L +SSE.L +PAA.L +HUW.L +STVG.L +PXS.L +STE.L +SHG.L +HYR.L +LAM.L +SCPA.L +PEG.L +IVO.L +MIN.L +TRP.L +TEK.L +HAT.L +RMV.L +SERV.L +LID.L +UTW.L +RWS.L +PGD.L +UNG.L +IDOX.L +SMTG.L +PPH.L +IBPO.L +SIGB.L +GHT.L +GINV.L +888.L +NKTN.L +0QPS.L +GLPR.L +GLB.L +GBP.L +HSD.L +GLTR.L +GMS.L +GOLD.L +GSR.L +SFE.L +STM.L +GVC.L +HDD.L +HHPD.L +HALO.L +HAIK.L +HSBK.L +HAL.L +HCM.L +HDT.L +THRL.L +UDG.L +PHC.L +NMC.L +HER.L +HVTA.L +HIK.L +HNT.L +HRN.L +HUR.L +JLH.L +HYUD.L +MANX.L +HYUO.L +HYDG.L +IBM.L +IDEA.L +TOT.L +INM.L +CON.L +PVR.L +MIO.L +NSH.L +IEH.L +IFP.L +ORM.L +PTR.L +PET.L +OGN.L +KYGA.L +IIT.L +IKA.L +PLUS.L +SIM.L +MTMY.L +BAGR.L +MATD.L +IPEL.L +OPG.L +IMM.L +OPP.L +IOF.L +OMIP.L +IQE.L +IRV.L +RIII.L +ITM.L +0QE8.L +WAND.L +TMT.L +KCEL.L +MGNT.L +NVTK.L +MNZS.L +JSG.L +SGGD.L +MFON.L +MAW.L +KKB.L +RM.L +KEM.L +LWRF.L +LEK.L +0QKY.L +LTOD.L +LCG.L +LNTR.L +RLH.L +TTST.L +RIGD.L +MAVD.L +LLD5.L +TAVI.L +0QNO.L +LSRG.L +RM2.L +REDD.L +MMC.L +MHID.L +MDC.L +MDMG.L +MHPC.L +OMI.L +MORT.L +MRS.L +MSI.L +NAH.L +NAR.L +NET.L +WOR.L +NTLG.L +AUCT.L +0QCO.L +0INB.L +NVA.L +NWF.L +PHOR.L +OKEY.L +ONL.L +TPOP.L +OTPD.L +SVST.L +TMKS.L +PKG.L +SNP.L +PRP.L +PHD.L +PHSC.L +PIP.L +PIL.L +SDM.L +SYM.L +SCLP.L +COST.L +SLNG.L +PMP.L +POL.L +PPC.L +RUS.L +RBD.L +RDW.L +RIFS.L +RNO.L +RWA.L +SNG1.L +RUR.L +SSY.L +SCE.L +SGP.L +0QMI.L +SGM.L +SIXH.L +SIHL.L +SPSC.L +SQZ.L +STOB.L +58HA.L +STL.L +SUMM.L +SWL.L +TND.L +TAST.L +TRT.L +THAL.L +TJI.L +TMMG.L +TUNG.L +UBI.L +UKR.L +VED.L +WALG.L +WTE.L +WSP.L +WYG.L +BRH.L +MAC.L +RED.L +COS.L +FRUT.L +GBG.L +IND.L +INFA.L +INS.L +MED.L +THR.L +MIRA.L +MYXR.L +SAR.L +SAA.L +REC.L +SAFE.L +TRD.L +SAV.L +TRAK.L +SAF.L +0QAX.L +SEV.L +TRB.L \ No newline at end of file diff --git a/Datasets/SP500.csv b/Datasets/SP500.csv index 8a8693c..62b86f0 100644 --- a/Datasets/SP500.csv +++ b/Datasets/SP500.csv @@ -348,6 +348,7 @@ ODFL,Old Dominion Freight Line,Industrials OMC,Omnicom Group,Communication Services OKE,Oneok,Energy ORCL,Oracle Corp.,Information Technology +ORP.PA,Orpea SA,Healthcare OTIS,Otis Worldwide,Industrials PCAR,Paccar,Industrials PKG,Packaging Corporation of America,Materials diff --git a/Media/AAPL_preproc.csv b/Media/AAPL_preproc.csv new file mode 100644 index 0000000..5e132d2 --- /dev/null +++ b/Media/AAPL_preproc.csv @@ -0,0 +1,126 @@ +"date" "anger" "anticipation" "disgust" "fear" "joy" "negative" "positive" "sadness" "surprise" "trust" "volume" "prix" "High" "Low" "Close" "VolumeB" "Adjusted" "prixj1" "liss_veille" "accr" +2022-03-21 118 178 73 147 141 267 400 107 93 217 10277 163.509995 166.350006 163.009995 165.380005 95811400 164.90831 165.509995 163.509995 2 +2022-03-22 140 190 92 181 151 331 479 137 110 239 10269 165.509995 169.419998 164.910004 168.820007 81532000 168.338501 167.990005 165.509995 2.48000999999999 +2022-03-23 137 182 95 169 140 317 473 127 98 258 7875 167.990005 172.639999 167.649994 170.210007 98062700 169.724533 171.059998 167.990005 3.06999300000001 +2022-03-24 135 207 87 163 163 318 500 123 105 267 7878 171.059998 174.139999 170.210007 174.070007 90131400 173.573532 173.880005 171.059998 2.820007 +2022-03-25 130 191 81 157 135 296 466 123 99 248 9414 173.880005 175.279999 172.75 174.720001 80546200 174.221664 NA 173.880005 0 +2022-03-26 144 193 79 172 151 324 484 121 112 247 7951 NA NA NA NA NA NA NA 173.880005 0 +2022-03-27 124 183 75 152 135 291 423 122 87 223 6755 NA NA NA NA NA NA 172.169998 173.880005 -1.71000700000002 +2022-03-28 112 152 77 131 128 253 392 111 87 207 5942 172.169998 175.729996 172 175.600006 90371900 175.099167 176.690002 172.169998 4.520004 +2022-03-29 127 204 83 160 158 301 488 121 95 252 6651 176.690002 179.009995 176.339996 178.960007 100589400 178.44957 178.550003 176.690002 1.86000100000001 +2022-03-30 130 196 76 154 153 284 453 119 111 236 7609 178.550003 179.610001 176.699997 177.770004 92633200 177.26297 177.839996 178.550003 -0.71000699999999 +2022-03-31 140 196 83 177 160 315 480 111 98 259 6871 177.839996 178.029999 174.399994 174.610001 103049300 174.111984 174.029999 177.839996 -3.80999700000001 +2022-04-01 145 190 85 177 146 332 470 130 106 248 10879 174.029999 174.880005 171.940002 174.309998 78751300 173.812836 NA 174.029999 0 +2022-04-02 141 201 75 175 153 309 468 123 113 238 9779 NA NA NA NA NA NA NA 174.029999 0 +2022-04-03 130 166 80 142 139 277 433 113 87 229 6695 NA NA NA NA NA NA 174.570007 174.029999 0.540008 +2022-04-04 107 153 75 142 121 264 373 103 84 195 6785 174.570007 178.490005 174.440002 178.440002 76468400 177.931061 177.5 174.570007 2.929993 +2022-04-05 131 183 79 159 137 284 436 115 94 227 7924 177.5 178.300003 174.419998 175.059998 73401800 174.560699 172.360001 177.5 -5.13999899999999 +2022-04-06 128 183 76 153 153 289 446 111 103 243 10367 172.360001 173.630005 170.130005 171.830002 89058800 171.33992 171.160004 172.360001 -1.19999700000002 +2022-04-07 134 202 94 170 159 319 497 131 100 273 7536 171.160004 173.360001 169.850006 172.139999 77594700 171.649017 171.779999 171.160004 0.619995000000017 +2022-04-08 141 210 72 173 160 312 495 135 111 265 7775 171.779999 171.779999 169.199997 170.089996 76575500 169.604874 NA 171.779999 0 +2022-04-09 127 204 77 164 158 308 486 130 102 243 7062 NA NA NA NA NA NA NA 171.779999 0 +2022-04-10 124 183 84 158 143 288 435 117 92 229 6938 NA NA NA NA NA NA 168.710007 171.779999 -3.06999200000001 +2022-04-11 115 176 66 139 145 256 430 109 82 227 13754 168.710007 169.029999 165.5 165.75 72246700 165.277252 168.020004 168.710007 -0.69000299999999 +2022-04-12 141 195 85 172 160 307 491 126 111 262 9521 168.020004 169.869995 166.639999 167.660004 79265200 167.181808 167.389999 168.020004 -0.630005000000011 +2022-04-13 142 209 84 178 171 319 531 131 109 277 7779 167.389999 171.039993 166.770004 170.399994 70618900 169.913986 170.619995 167.389999 3.229996 +2022-04-14 142 201 97 166 161 334 475 133 112 251 7141 170.619995 171.270004 165.039993 165.289993 75329400 164.818558 NA 170.619995 0 +2022-04-15 117 185 74 136 152 275 451 111 103 234 6164 NA NA NA NA NA NA NA 170.619995 0 +2022-04-16 124 208 79 155 164 279 481 117 105 250 6293 NA NA NA NA NA NA NA 170.619995 0 +2022-04-17 121 169 70 146 129 267 402 93 87 213 5135 NA NA NA NA NA NA 163.919998 170.619995 -6.699997 +2022-04-18 109 159 68 131 138 256 408 105 83 201 5236 163.919998 166.600006 163.570007 165.070007 69023900 164.599197 165.020004 163.919998 1.10000600000001 +2022-04-19 119 190 84 148 150 270 445 113 103 227 5968 165.020004 167.820007 163.910004 167.399994 67723800 166.922531 168.759995 165.020004 3.739991 +2022-04-20 137 189 91 160 156 297 476 121 105 243 6167 168.759995 168.880005 166.100006 167.229996 67929800 166.753021 168.910004 168.759995 0.150008999999983 +2022-04-21 123 201 83 159 158 301 478 116 105 251 6390 168.910004 171.529999 165.910004 166.419998 87227800 165.945328 166.460007 168.910004 -2.449997 +2022-04-22 135 205 86 192 150 295 470 133 98 249 6853 166.460007 167.869995 161.5 161.789993 84882400 161.328537 NA 166.460007 0 +2022-04-23 130 205 80 159 159 294 494 121 100 268 6186 NA NA NA NA NA NA NA 166.460007 0 +2022-04-24 99 167 59 124 125 232 362 81 80 197 5942 NA NA NA NA NA NA 161.119995 166.460007 -5.340012 +2022-04-25 107 163 62 137 132 228 391 92 89 208 5166 161.119995 163.169998 158.460007 162.880005 96046400 162.415436 162.25 161.119995 1.13000500000001 +2022-04-26 134 197 86 168 145 287 457 119 104 234 6940 162.25 162.339996 156.720001 156.800003 95623200 156.352783 155.910004 162.25 -6.33999600000001 +2022-04-27 138 200 82 173 146 294 477 126 97 252 6729 155.910004 159.789993 155.380005 156.570007 88063200 156.123444 159.25 155.910004 3.33999600000001 +2022-04-28 139 201 75 166 162 306 483 123 102 264 7360 159.25 164.520004 158.929993 163.639999 130216800 163.173264 161.839996 159.25 2.58999600000001 +2022-04-29 154 196 92 175 152 338 479 135 92 239 7678 161.839996 166.199997 157.25 157.649994 131747600 157.200348 NA 161.839996 0 +2022-04-30 153 205 95 186 165 362 480 144 111 254 7595 NA NA NA NA NA NA NA 161.839996 0 +2022-05-01 114 163 74 149 143 269 430 114 90 226 5550 NA NA NA NA NA NA 156.710007 161.839996 -5.12998900000002 +2022-05-02 116 166 70 144 131 277 395 116 89 207 4944 156.710007 158.229996 153.270004 157.960007 123055300 157.50946 158.149994 156.710007 1.439987 +2022-05-03 145 196 93 182 146 336 456 142 93 246 7818 158.149994 160.710007 156.320007 159.479996 88966500 159.025131 159.669998 158.149994 1.520004 +2022-05-04 154 216 96 185 158 324 496 141 102 264 7274 159.669998 166.479996 159.259995 166.020004 108256500 165.546494 163.850006 159.669998 4.18000800000002 +2022-05-05 153 206 93 181 152 337 489 135 99 263 6613 163.850006 164.080002 154.949997 156.770004 130525300 156.322876 156.009995 163.850006 -7.840011 +2022-05-06 134 197 83 165 151 305 484 119 97 265 5893 156.009995 159.440002 154.179993 157.279999 116124600 157.061829 NA 156.009995 0 +2022-05-07 150 205 92 189 163 334 491 136 118 269 8955 NA NA NA NA NA NA NA 156.009995 0 +2022-05-08 148 181 92 176 147 301 463 130 97 247 6052 NA NA NA NA NA NA 154.929993 156.009995 -1.08000200000001 +2022-05-09 127 153 81 158 117 283 383 129 87 199 5925 154.929993 155.830002 151.490005 152.059998 131577900 151.849075 155.520004 154.929993 0.590011000000004 +2022-05-10 148 195 91 175 162 329 494 145 112 265 6743 155.520004 156.740005 152.929993 154.509995 115366700 154.29567 153.5 155.520004 -2.020004 +2022-05-11 154 229 100 193 175 354 522 149 124 289 11240 153.5 155.449997 145.809998 146.5 142689800 146.296783 142.770004 153.5 -10.729996 +2022-05-12 150 212 98 200 174 356 544 159 121 296 13069 142.770004 146.199997 138.800003 142.559998 182602000 142.362244 144.589996 142.770004 1.81999200000001 +2022-05-13 154 210 94 194 155 361 505 154 111 261 7476 144.589996 148.100006 143.110001 147.110001 113990900 146.905945 NA 144.589996 0 +2022-05-14 172 197 110 204 161 363 528 157 109 271 6334 NA NA NA NA NA NA NA 144.589996 0 +2022-05-15 115 174 86 138 144 264 447 110 91 221 5422 NA NA NA NA NA NA 145.550003 144.589996 0.96000699999999 +2022-05-16 99 154 63 130 128 226 407 95 87 215 4756 145.550003 147.520004 144.179993 145.539993 86643800 145.33812 148.860001 145.550003 3.30999800000001 +2022-05-17 128 191 76 176 154 286 470 117 100 246 5830 148.860001 149.770004 146.679993 149.240005 78336300 149.03299 146.850006 148.860001 -2.009995 +2022-05-18 140 210 86 192 175 344 534 144 114 285 9742 146.850006 147.360001 139.899994 140.820007 109742900 140.62468 139.880005 146.850006 -6.970001 +2022-05-19 175 191 98 195 145 359 496 148 104 273 8077 139.880005 141.660004 136.600006 137.350006 136095600 137.159485 139.089996 139.880005 -0.790008999999998 +2022-05-20 149 195 82 184 148 316 479 132 97 265 6577 139.089996 140.699997 132.610001 137.589996 137426100 137.399139 NA 139.089996 0 +2022-05-21 129 201 92 166 151 306 468 132 105 236 6078 NA NA NA NA NA NA NA 139.089996 0 +2022-05-22 122 184 76 147 132 264 423 113 87 210 4931 NA NA NA NA NA NA 137.789993 139.089996 -1.300003 +2022-05-23 106 163 65 134 123 226 367 103 93 196 5831 137.789993 143.259995 137.649994 143.110001 117726300 142.911484 140.809998 137.789993 3.020005 +2022-05-24 132 183 82 161 143 284 452 114 104 247 6712 140.809998 141.970001 137.330002 140.360001 104132700 140.165298 138.429993 140.809998 -2.38000500000001 +2022-05-25 141 210 87 173 146 317 459 130 108 255 7566 138.429993 141.789993 138.339996 140.520004 92482700 140.325089 137.389999 138.429993 -1.03999400000001 +2022-05-26 148 200 95 194 149 350 495 148 100 256 7422 137.389999 144.339996 137.139999 143.779999 90601500 143.580551 145.389999 137.389999 8 +2022-05-27 145 197 87 177 148 319 492 130 101 264 11540 145.389999 149.679993 145.259995 149.639999 90978500 149.432434 NA 145.389999 0 +2022-05-28 139 184 85 175 157 323 484 122 94 264 8762 NA NA NA NA NA NA NA 145.389999 0 +2022-05-29 132 172 79 174 133 296 409 124 98 218 6543 NA NA NA NA NA NA NA 145.389999 0 +2022-05-30 103 169 58 132 132 233 394 104 87 203 6866 NA NA NA NA NA NA 149.070007 145.389999 3.68000800000002 +2022-05-31 127 190 67 155 144 272 446 110 90 227 8023 149.070007 150.660004 146.839996 148.839996 103718400 148.633545 149.899994 149.070007 0.829986999999988 +2022-06-01 127 195 83 170 147 303 481 128 95 250 7340 149.899994 151.740005 147.679993 148.710007 74286600 148.503723 147.830002 149.899994 -2.06999199999998 +2022-06-02 143 203 96 177 140 320 464 130 98 249 7841 147.830002 151.270004 146.860001 151.210007 72348100 151.000259 146.899994 147.830002 -0.930008000000015 +2022-06-03 128 178 76 151 138 266 449 119 97 245 8261 146.899994 147.970001 144.460007 145.380005 88570300 145.178345 NA 146.899994 0 +2022-06-04 119 184 75 164 142 284 470 129 90 237 6093 NA NA NA NA NA NA NA 146.899994 0 +2022-06-05 128 171 68 153 132 274 420 115 84 214 5982 NA NA NA NA NA NA 147.029999 146.899994 0.130005000000011 +2022-06-06 117 152 75 143 112 242 367 111 86 176 6136 147.029999 148.570007 144.899994 146.139999 71598400 145.937286 144.350006 147.029999 -2.679993 +2022-06-07 210 274 147 251 215 485 659 197 146 343 20655 144.350006 149 144.100006 148.710007 67808200 148.503723 148.580002 144.350006 4.229996 +2022-06-08 204 258 130 263 195 498 635 190 141 347 22607 148.580002 149.869995 147.460007 147.960007 53950200 147.754776 147.080002 148.580002 -1.5 +2022-06-09 166 220 114 214 182 414 563 162 120 312 11541 147.080002 147.949997 142.529999 142.639999 69473000 142.442139 140.279999 147.080002 -6.800003 +2022-06-10 141 218 89 174 154 341 522 140 101 287 8995 140.279999 140.759995 137.059998 137.130005 91437900 136.939789 NA 140.279999 0 +2022-06-11 149 215 85 192 161 339 506 140 115 276 9903 NA NA NA NA NA NA NA 140.279999 0 +2022-06-12 145 171 76 162 133 303 441 136 100 242 7741 NA NA NA NA NA NA 132.869995 140.279999 -7.41000400000001 +2022-06-13 112 169 85 144 128 247 403 110 86 212 6062 132.869995 135.199997 131.440002 131.880005 122207100 131.697067 133.130005 132.869995 0.260010000000023 +2022-06-14 137 183 76 167 145 291 462 123 96 249 6729 133.130005 133.889999 131.479996 132.759995 84784300 132.575836 134.289993 133.130005 1.159988 +2022-06-15 132 174 70 161 135 309 431 130 100 224 8549 134.289993 137.339996 132.160004 135.429993 91533000 135.242142 132.080002 134.289993 -2.209991 +2022-06-16 134 187 80 162 137 295 422 131 91 221 6642 132.080002 132.389999 129.039993 130.059998 108123900 129.879593 130.070007 132.080002 -2.009995 +2022-06-17 143 201 89 171 144 306 474 124 99 245 9669 130.070007 133.080002 129.809998 131.559998 134520300 131.377502 NA 130.070007 0 +2022-06-18 142 188 87 177 151 332 496 132 106 268 7913 NA NA NA NA NA NA NA 130.070007 0 +2022-06-19 131 179 83 165 138 282 449 121 99 239 7696 NA NA NA NA NA NA NA 130.070007 0 +2022-06-20 123 174 79 166 136 291 435 125 89 239 6824 NA NA NA NA NA NA 133.419998 130.070007 3.34999099999999 +2022-06-21 168 191 91 195 143 350 493 144 106 257 7814 133.419998 137.059998 133.320007 135.869995 81000500 135.681534 134.789993 133.419998 1.36999500000002 +2022-06-22 145 193 87 184 153 316 484 137 100 261 6320 134.789993 137.759995 133.910004 135.350006 73409200 135.162262 136.820007 134.789993 2.03001399999999 +2022-06-23 142 203 86 182 158 326 489 133 111 270 13259 136.820007 138.589996 135.630005 138.270004 72433800 138.078201 139.899994 136.820007 3.07998699999999 +2022-06-24 123 202 82 180 154 309 495 131 92 257 8726 139.899994 141.910004 139.770004 141.660004 89116800 141.463501 NA 139.899994 0 +2022-06-25 133 203 82 173 157 295 501 128 94 271 7107 NA NA NA NA NA NA NA 139.899994 0 +2022-06-26 109 183 69 136 146 246 442 104 95 226 5409 NA NA NA NA NA NA 142.699997 139.899994 2.800003 +2022-06-27 114 187 69 153 147 254 419 115 89 237 7655 142.699997 143.490005 140.970001 141.660004 70207900 141.463501 142.130005 142.699997 -0.569991999999985 +2022-06-28 141 208 84 183 157 315 494 134 103 261 9386 142.130005 143.419998 137.320007 137.440002 67083400 137.249359 137.460007 142.130005 -4.66999800000002 +2022-06-29 144 206 81 171 152 313 495 121 114 265 7863 137.460007 140.669998 136.669998 139.229996 66242400 139.036865 137.25 137.460007 -0.21000699999999 +2022-06-30 147 205 82 170 164 316 483 134 102 255 8530 137.25 138.369995 133.770004 136.720001 98964500 136.53035 136.039993 137.25 -1.21000699999999 +2022-07-01 130 211 80 170 154 318 490 117 105 270 10510 136.039993 139.039993 135.660004 138.929993 71051600 138.737274 NA 136.039993 0 +2022-07-02 140 215 76 173 157 311 491 134 101 265 9328 NA NA NA NA NA NA NA 136.039993 0 +2022-07-03 126 178 71 153 135 258 409 111 92 227 6330 NA NA NA NA NA NA NA 136.039993 0 +2022-07-04 115 152 74 138 111 231 361 113 81 193 4955 NA NA NA NA NA NA 137.770004 136.039993 1.73001099999999 +2022-07-05 119 161 79 159 132 265 385 105 86 203 5855 137.770004 141.610001 136.929993 141.559998 73353800 141.363632 141.350006 137.770004 3.58000200000001 +2022-07-06 115 175 79 169 123 284 438 118 90 242 6049 141.350006 144.119995 141.080002 142.919998 74064300 142.721756 143.289993 141.350006 1.939987 +2022-07-07 141 206 85 179 156 302 483 123 110 258 7064 143.289993 146.550003 143.279999 146.350006 66253700 146.147003 145.259995 143.289993 1.97000199999999 +2022-07-08 136 191 84 174 150 297 474 128 108 265 6548 145.259995 147.550003 145 147.039993 64547800 146.836029 NA 145.259995 0 +2022-07-09 128 201 83 171 160 305 500 129 106 276 7295 NA NA NA NA NA NA NA 145.259995 0 +2022-07-10 120 178 72 144 141 260 416 117 87 224 6026 NA NA NA NA NA NA 145.669998 145.259995 0.410002999999989 +2022-07-11 101 163 62 136 136 218 393 92 82 210 5372 145.669998 146.639999 143.779999 144.869995 63141600 144.669037 145.759995 145.669998 0.089997000000011 +2022-07-12 136 178 75 172 142 292 455 117 98 236 8635 145.759995 148.449997 145.050003 145.860001 77588800 145.657669 142.990005 145.759995 -2.76999000000001 +2022-07-13 128 203 80 165 148 292 481 126 109 267 8065 142.990005 146.449997 142.119995 145.490005 71185600 145.288193 144.080002 142.990005 1.08999700000001 +2022-07-14 136 199 81 182 164 314 489 142 111 268 7556 144.080002 148.949997 143.25 148.470001 78140700 148.264053 149.779999 144.080002 5.699997 +2022-07-15 127 187 79 168 132 305 457 125 91 270 7300 149.779999 150.860001 148.199997 150.169998 76259900 149.9617 NA 149.779999 0 +2022-07-16 127 181 72 168 143 298 448 119 104 252 6136 NA NA NA NA NA NA NA 149.779999 0 +2022-07-17 119 165 74 153 137 260 408 112 86 213 5367 NA NA NA NA NA NA 150.740005 149.779999 0.960005999999993 +2022-07-18 124 171 74 157 123 257 383 108 87 216 5005 150.740005 151.570007 146.699997 147.070007 81420900 146.865997 147.919998 150.740005 -2.820007 +2022-07-19 143 204 97 193 151 339 511 138 107 272 6126 147.919998 151.229996 146.910004 151 82982400 150.790543 151.119995 147.919998 3.199997 +2022-07-20 144 208 98 195 153 327 501 133 105 269 6847 151.119995 153.720001 150.369995 153.039993 64823400 152.827713 154.5 151.119995 3.38000500000001 +2022-07-21 133 202 92 180 144 321 501 135 101 279 6999 154.5 155.570007 151.940002 155.350006 65086600 155.134521 155.389999 154.5 0.889998999999989 +2022-07-22 148 197 95 175 144 313 485 126 100 253 6606 155.389999 156.279999 153.410004 154.089996 66675400 153.876251 NA 155.389999 0 +2022-07-23 130 185 93 182 147 312 475 128 104 256 6213 NA NA NA NA NA NA NA 155.389999 0 diff --git a/Media/Readme.MD b/Media/Readme.MD new file mode 100644 index 0000000..e38cbbb --- /dev/null +++ b/Media/Readme.MD @@ -0,0 +1 @@ +Media Datasets diff --git a/README.md b/README.md new file mode 100644 index 0000000..168109d --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Trading +RivacubeScreener +This App is a BETA version for a Dashboard in Streamlit regrouping all types of Analysis of S&P500 Stocks. +It uses Yahoo Finance API and Finviz diff --git a/StockScreenDemo.py b/StockScreenDemo.py index 673e1cc..ac7a84d 100644 --- a/StockScreenDemo.py +++ b/StockScreenDemo.py @@ -2,301 +2,821 @@ """ Created on Sat Feb 20 17:45:01 2021 -@author: Teo Bee Guan +Credits to Original @author: Teo Bee Guan """ import pandas as pd +import datetime +from pandas_datareader import data as pdr +import investpy +import yaml import yfinance as yf import streamlit as st +import base64 +import os +os.system('sudo pip install scikit-learn') +import streamlit.components.v1 as components import datetime as dt +import streamlit_authenticator as stauth +import numpy as np +import matplotlib.pyplot as plt import plotly.graph_objects as go from plotly.subplots import make_subplots +from keras.models import load_model +#from sklearn.preprocessing import MinMaxScalar +from urllib.request import urlopen, Request +from bs4 import BeautifulSoup +from random import randint +import plotly.express as px +import json # for graph plotting in website +# NLTK VADER for sentiment analysis +import nltk +nltk.downloader.download('vader_lexicon') +from nltk.sentiment.vader import SentimentIntensityAnalyzer +import plotly.express as px +from prophet import Prophet +from prophet.plot import add_changepoints_to_plot +from plotly import graph_objs as go +from prophet.plot import plot_plotly -snp500 = pd.read_csv("Datasets/SP500.csv") -symbols = snp500['Symbol'].sort_values().tolist() -ticker = st.sidebar.selectbox( - 'Choose a S&P 500 Stock', - symbols) -infoType = st.sidebar.radio( - "Choose an info type", - ('Fundamental', 'Technical') - ) +st.sidebar.image("https://slm-sa.com/wp-content/uploads/2020/01/LogoSLM-IF-1.png") +st.sidebar.write(""" +# RIVALIGHT +## AI Powered Solution for Finance +*By SLM for Rivaldi Project* -stock = yf.Ticker(ticker) +""") -if(infoType == 'Fundamental'): - stock = yf.Ticker(ticker) - info = stock.info - st.title('Company Profile') - st.subheader(info['longName']) - st.markdown('** Sector **: ' + info['sector']) - st.markdown('** Industry **: ' + info['industry']) - st.markdown('** Phone **: ' + info['phone']) - st.markdown('** Address **: ' + info['address1'] + ', ' + info['city'] + ', ' + info['zip'] + ', ' + info['country']) - st.markdown('** Website **: ' + info['website']) - st.markdown('** Business Summary **') - st.info(info['longBusinessSummary']) - - fundInfo = { - 'Enterprise Value (USD)': info['enterpriseValue'], - 'Enterprise To Revenue Ratio': info['enterpriseToRevenue'], - 'Enterprise To Ebitda Ratio': info['enterpriseToEbitda'], - 'Net Income (USD)': info['netIncomeToCommon'], - 'Profit Margin Ratio': info['profitMargins'], - 'Forward PE Ratio': info['forwardPE'], - 'PEG Ratio': info['pegRatio'], - 'Price to Book Ratio': info['priceToBook'], - 'Forward EPS (USD)': info['forwardEps'], - 'Beta ': info['beta'], - 'Book Value (USD)': info['bookValue'], - 'Dividend Rate (%)': info['dividendRate'], - 'Dividend Yield (%)': info['dividendYield'], - 'Five year Avg Dividend Yield (%)': info['fiveYearAvgDividendYield'], - 'Payout Ratio': info['payoutRatio'] - } - - fundDF = pd.DataFrame.from_dict(fundInfo, orient='index') - fundDF = fundDF.rename(columns={0: 'Value'}) - st.subheader('Fundamental Info') - st.table(fundDF) - - st.subheader('General Stock Info') - st.markdown('** Market **: ' + info['market']) - st.markdown('** Exchange **: ' + info['exchange']) - st.markdown('** Quote Type **: ' + info['quoteType']) - - start = dt.datetime.today()-dt.timedelta(2 * 365) - end = dt.datetime.today() - df = yf.download(ticker,start,end) - df = df.reset_index() - fig = go.Figure( - data=go.Scatter(x=df['Date'], y=df['Adj Close']) +#---User--Autenthification +def check_password(): + """Returns `True` if the user had a correct password.""" + + def password_entered(): + """Checks whether a password entered by the user is correct.""" + if ( + st.session_state["username"] in st.secrets["passwords"] + and st.session_state["password"] + == st.secrets["passwords"][st.session_state["username"]] + ): + st.session_state["password_correct"] = True + del st.session_state["password"] # don't store username + password + del st.session_state["username"] + else: + st.session_state["password_correct"] = False + + if "password_correct" not in st.session_state: + # First run, show inputs for username + password. + st.text_input("Username", on_change=password_entered, key="username") + st.text_input( + "Password", type="password", on_change=password_entered, key="password" ) - fig.update_layout( - title={ - 'text': "Stock Prices Over Past Two Years", - 'y':0.9, - 'x':0.5, - 'xanchor': 'center', - 'yanchor': 'top'}) - st.plotly_chart(fig, use_container_width=True) - - marketInfo = { - "Volume": info['volume'], - "Average Volume": info['averageVolume'], - "Market Cap": info["marketCap"], - "Float Shares": info['floatShares'], - "Regular Market Price (USD)": info['regularMarketPrice'], - 'Bid Size': info['bidSize'], - 'Ask Size': info['askSize'], - "Share Short": info['sharesShort'], - 'Short Ratio': info['shortRatio'], - 'Share Outstanding': info['sharesOutstanding'] - - } - - marketDF = pd.DataFrame(data=marketInfo, index=[0]) - st.table(marketDF) -else: - def calcMovingAverage(data, size): - df = data.copy() - df['sma'] = df['Adj Close'].rolling(size).mean() - df['ema'] = df['Adj Close'].ewm(span=size, min_periods=size).mean() - df.dropna(inplace=True) - return df - - def calc_macd(data): - df = data.copy() - df['ema12'] = df['Adj Close'].ewm(span=12, min_periods=12).mean() - df['ema26'] = df['Adj Close'].ewm(span=26, min_periods=26).mean() - df['macd'] = df['ema12'] - df['ema26'] - df['signal'] = df['macd'].ewm(span=9, min_periods=9).mean() - df.dropna(inplace=True) - return df - - def calcBollinger(data, size): - df = data.copy() - df["sma"] = df['Adj Close'].rolling(size).mean() - df["bolu"] = df["sma"] + 2*df['Adj Close'].rolling(size).std(ddof=0) - df["bold"] = df["sma"] - 2*df['Adj Close'].rolling(size).std(ddof=0) - df["width"] = df["bolu"] - df["bold"] - df.dropna(inplace=True) - return df - - st.title('Technical Indicators') - st.subheader('Moving Average') - - coMA1, coMA2 = st.beta_columns(2) - - with coMA1: - numYearMA = st.number_input('Insert period (Year): ', min_value=1, max_value=10, value=2, key=0) + return False + elif not st.session_state["password_correct"]: + # Password not correct, show input + error. + st.text_input("Username", on_change=password_entered, key="username") + st.text_input( + "Password", type="password", on_change=password_entered, key="password" + ) + st.error("😕 User not known or password incorrect") + return False + else: + # Password correct. + return True + +if check_password(): + st.write("Welcome to your Rivalight Solution") - with coMA2: - windowSizeMA = st.number_input('Window Size (Day): ', min_value=5, max_value=500, value=20, key=1) + + snp500 = pd.read_csv("Datasets/SP500.csv") + cac40 = pd.read_csv("Datasets/CAC40.csv") + ftse100 = pd.read_csv("Datasets/FTSE100.csv") + symbols = snp500['Symbol'].sort_values().tolist() + symbolsCAC40 = cac40['Symbol'].sort_values().tolist() + symbolsFTSE100 = ftse100['Symbol'].sort_values().tolist() + # for extracting data from finviz + finviz_url = 'https://finviz.com/quote.ashx?t=' + + Universe = st.sidebar.radio( + "Select your Universe of Stock", + ('S&P 500', 'CAC 40', 'FTSE 100')) + + if Universe == 'S&P 500': + ticker = st.sidebar.selectbox('Choose a S&P 500 Stock',symbols) + elif Universe == 'CAC 40': + ticker = st.sidebar.selectbox('Choose a CAC 40 Stock',symbolsCAC40) + elif Universe == 'FTSE 100': + ticker = st.sidebar.selectbox('Choose a FTSE 100 Stock',symbolsFTSE100) + #Error()?traday = pdr.DataReader(ticker, data_source="yahoo") + + + + infoType = st.sidebar.radio( + "Choose an analysis type", + ('Fundamental', 'Technical', 'Intraday', 'Keras Prediction', 'Prophet Prediction', 'Sentiment', 'Media', 'ESG') + ) + + stock = yf.Ticker(ticker) + + if(infoType == 'Fundamental'): + stock = yf.Ticker(ticker) + info = stock.info + st.title('Company Profile') + st.subheader(info['longName']) + st.markdown('** Sector **: ' + info['sector']) + st.markdown('** Industry **: ' + info['industry']) + st.markdown('** Phone **: ' + info['phone']) + st.markdown('** Address **: ' + info['address1'] + ', ' + info['city'] + ', ' + info['zip'] + ', ' + info['country']) + st.markdown('** Website **: ' + info['website']) + st.markdown('** Business Summary **') + st.info(info['longBusinessSummary']) + + fundInfo = { + 'Enterprise Value (USD)': info['enterpriseValue'], + 'Enterprise To Revenue Ratio': info['enterpriseToRevenue'], + 'Enterprise To Ebitda Ratio': info['enterpriseToEbitda'], + 'Net Income (USD)': info['netIncomeToCommon'], + 'Profit Margin Ratio': info['profitMargins'], + 'Forward PE Ratio': info['forwardPE'], + 'PEG Ratio': info['pegRatio'], + 'Price to Book Ratio': info['priceToBook'], + 'Forward EPS (USD)': info['forwardEps'], + 'Beta ': info['beta'], + 'Book Value (USD)': info['bookValue'], + 'Dividend Rate (%)': info['dividendRate'], + 'Dividend Yield (%)': info['dividendYield'], + 'Five year Avg Dividend Yield (%)': info['fiveYearAvgDividendYield'], + 'Payout Ratio': info['payoutRatio'], + } + + fundDF = pd.DataFrame.from_dict(fundInfo, orient='index') + fundDF = fundDF.rename(columns={0: 'Value'}) + st.subheader('Fundamental Info') + st.table(fundDF) + + st.subheader('General Stock Info') + st.markdown('** Market **: ' + info['market']) + st.markdown('** Exchange **: ' + info['exchange']) + st.markdown('** Quote Type **: ' + info['quoteType']) + + start = dt.datetime.today()-dt.timedelta(2 * 365) + end = dt.datetime.today() + df = yf.download(ticker,start,end) + df = df.reset_index() + fig = go.Figure( + data=go.Scatter(x=df['Date'], y=df['Adj Close']) + ) + fig.update_layout( + title={ + 'text': "Stock Prices Over Past Two Years", + 'y':0.9, + 'x':0.5, + 'xanchor': 'center', + 'yanchor': 'top'}) + st.plotly_chart(fig, use_container_width=True) + marketInfo = { + "Volume": info['volume'], + "Average Volume": info['averageVolume'], + "Market Cap": info["marketCap"], + "Float Shares": info['floatShares'], + "Regular Market Price (USD)": info['regularMarketPrice'], + 'Bid Size': info['bidSize'], + 'Ask Size': info['askSize'], + "Share Short": info['sharesShort'], + 'Short Ratio': info['shortRatio'], + 'Share Outstanding': info['sharesOutstanding'] + + } + + marketDF = pd.DataFrame(data=marketInfo, index=[0]) + st.table(marketDF) + if(infoType == 'Technical'): + def calcMovingAverage(data, size): + df = data.copy() + df['sma'] = df['Adj Close'].rolling(size).mean() + df['ema'] = df['Adj Close'].ewm(span=size, min_periods=size).mean() + df.dropna(inplace=True) + return df + + def calc_macd(data): + df = data.copy() + df['ema12'] = df['Adj Close'].ewm(span=12, min_periods=12).mean() + df['ema26'] = df['Adj Close'].ewm(span=26, min_periods=26).mean() + df['macd'] = df['ema12'] - df['ema26'] + df['signal'] = df['macd'].ewm(span=9, min_periods=9).mean() + df.dropna(inplace=True) + return df - start = dt.datetime.today()-dt.timedelta(numYearMA * 365) - end = dt.datetime.today() - dataMA = yf.download(ticker,start,end) - df_ma = calcMovingAverage(dataMA, windowSizeMA) - df_ma = df_ma.reset_index() + def calcBollinger(data, size): + df = data.copy() + df["sma"] = df['Adj Close'].rolling(size).mean() + df["bolu"] = df["sma"] + 2*df['Adj Close'].rolling(size).std(ddof=0) + df["bold"] = df["sma"] - 2*df['Adj Close'].rolling(size).std(ddof=0) + df["width"] = df["bolu"] - df["bold"] + df.dropna(inplace=True) + return df + + st.title('Technical Indicators') + st.subheader('Moving Average') - figMA = go.Figure() - - figMA.add_trace( - go.Scatter( - x = df_ma['Date'], - y = df_ma['Adj Close'], - name = "Prices Over Last " + str(numYearMA) + " Year(s)" - ) - ) - - figMA.add_trace( + coMA1, coMA2 = st.columns(2) + + with coMA1: + numYearMA = st.number_input('Insert period (Year): ', min_value=1, max_value=10, value=2, key=0) + + with coMA2: + windowSizeMA = st.number_input('Window Size (Day): ', min_value=5, max_value=500, value=20, key=1) + + + start = dt.datetime.today()-dt.timedelta(numYearMA * 365) + end = dt.datetime.today() + dataMA = yf.download(ticker,start,end) + df_ma = calcMovingAverage(dataMA, windowSizeMA) + df_ma = df_ma.reset_index() + + figMA = go.Figure() + + figMA.add_trace( go.Scatter( x = df_ma['Date'], - y = df_ma['sma'], - name = "SMA" + str(windowSizeMA) + " Over Last " + str(numYearMA) + " Year(s)" + y = df_ma['Adj Close'], + name = "Prices Over Last " + str(numYearMA) + " Year(s)" ) ) - - figMA.add_trace( + + figMA.add_trace( + go.Scatter( + x = df_ma['Date'], + y = df_ma['sma'], + name = "SMA" + str(windowSizeMA) + " Over Last " + str(numYearMA) + " Year(s)" + ) + ) + + figMA.add_trace( + go.Scatter( + x = df_ma['Date'], + y = df_ma['ema'], + name = "EMA" + str(windowSizeMA) + " Over Last " + str(numYearMA) + " Year(s)" + ) + ) + + figMA.update_layout(legend=dict( + yanchor="top", + y=0.99, + xanchor="left", + x=0.01 + )) + + figMA.update_layout(legend_title_text='Trend') + figMA.update_yaxes(tickprefix="$") + + st.plotly_chart(figMA, use_container_width=True) + + st.subheader('Moving Average Convergence Divergence (MACD)') + numYearMACD = st.number_input('Insert period (Year): ', min_value=1, max_value=10, value=2, key=2) + + startMACD = dt.datetime.today()-dt.timedelta(numYearMACD * 365) + endMACD = dt.datetime.today() + dataMACD = yf.download(ticker,startMACD,endMACD) + df_macd = calc_macd(dataMACD) + df_macd = df_macd.reset_index() + + figMACD = make_subplots(rows=2, cols=1, + shared_xaxes=True, + vertical_spacing=0.01) + + figMACD.add_trace( go.Scatter( - x = df_ma['Date'], - y = df_ma['ema'], - name = "EMA" + str(windowSizeMA) + " Over Last " + str(numYearMA) + " Year(s)" - ) + x = df_macd['Date'], + y = df_macd['Adj Close'], + name = "Prices Over Last " + str(numYearMACD) + " Year(s)" + ), + row=1, col=1 ) - - figMA.update_layout(legend=dict( - yanchor="top", - y=0.99, - xanchor="left", - x=0.01 - )) - - figMA.update_layout(legend_title_text='Trend') - figMA.update_yaxes(tickprefix="$") - - st.plotly_chart(figMA, use_container_width=True) - - st.subheader('Moving Average Convergence Divergence (MACD)') - numYearMACD = st.number_input('Insert period (Year): ', min_value=1, max_value=10, value=2, key=2) - - startMACD = dt.datetime.today()-dt.timedelta(numYearMACD * 365) - endMACD = dt.datetime.today() - dataMACD = yf.download(ticker,startMACD,endMACD) - df_macd = calc_macd(dataMACD) - df_macd = df_macd.reset_index() - - figMACD = make_subplots(rows=2, cols=1, - shared_xaxes=True, - vertical_spacing=0.01) - - figMACD.add_trace( - go.Scatter( - x = df_macd['Date'], - y = df_macd['Adj Close'], - name = "Prices Over Last " + str(numYearMACD) + " Year(s)" - ), - row=1, col=1 - ) - - figMACD.add_trace( - go.Scatter( - x = df_macd['Date'], - y = df_macd['ema12'], - name = "EMA 12 Over Last " + str(numYearMACD) + " Year(s)" - ), - row=1, col=1 - ) - - figMACD.add_trace( - go.Scatter( - x = df_macd['Date'], - y = df_macd['ema26'], - name = "EMA 26 Over Last " + str(numYearMACD) + " Year(s)" - ), - row=1, col=1 - ) - - figMACD.add_trace( - go.Scatter( - x = df_macd['Date'], - y = df_macd['macd'], - name = "MACD Line" - ), - row=2, col=1 - ) - - figMACD.add_trace( - go.Scatter( - x = df_macd['Date'], - y = df_macd['signal'], - name = "Signal Line" - ), - row=2, col=1 - ) - - figMACD.update_layout(legend=dict( - orientation="h", - yanchor="bottom", - y=1, - xanchor="left", - x=0 - )) - - figMACD.update_yaxes(tickprefix="$") - st.plotly_chart(figMACD, use_container_width=True) - - st.subheader('Bollinger Band') - coBoll1, coBoll2 = st.beta_columns(2) - with coBoll1: - numYearBoll = st.number_input('Insert period (Year): ', min_value=1, max_value=10, value=2, key=6) - with coBoll2: - windowSizeBoll = st.number_input('Window Size (Day): ', min_value=5, max_value=500, value=20, key=7) - - startBoll= dt.datetime.today()-dt.timedelta(numYearBoll * 365) - endBoll = dt.datetime.today() - dataBoll = yf.download(ticker,startBoll,endBoll) - df_boll = calcBollinger(dataBoll, windowSizeBoll) - df_boll = df_boll.reset_index() - figBoll = go.Figure() - figBoll.add_trace( - go.Scatter( - x = df_boll['Date'], - y = df_boll['bolu'], - name = "Upper Band" - ) - ) - - - figBoll.add_trace( + figMACD.add_trace( go.Scatter( - x = df_boll['Date'], - y = df_boll['sma'], - name = "SMA" + str(windowSizeBoll) + " Over Last " + str(numYearBoll) + " Year(s)" - ) + x = df_macd['Date'], + y = df_macd['ema12'], + name = "EMA 12 Over Last " + str(numYearMACD) + " Year(s)" + ), + row=1, col=1 ) - - - figBoll.add_trace( + + figMACD.add_trace( + go.Scatter( + x = df_macd['Date'], + y = df_macd['ema26'], + name = "EMA 26 Over Last " + str(numYearMACD) + " Year(s)" + ), + row=1, col=1 + ) + + figMACD.add_trace( + go.Scatter( + x = df_macd['Date'], + y = df_macd['macd'], + name = "MACD Line" + ), + row=2, col=1 + ) + + figMACD.add_trace( + go.Scatter( + x = df_macd['Date'], + y = df_macd['signal'], + name = "Signal Line" + ), + row=2, col=1 + ) + + figMACD.update_layout(legend=dict( + orientation="h", + yanchor="bottom", + y=1, + xanchor="left", + x=0 + )) + + figMACD.update_yaxes(tickprefix="$") + st.plotly_chart(figMACD, use_container_width=True) + + st.subheader('Bollinger Band') + coBoll1, coBoll2 = st.columns(2) + with coBoll1: + numYearBoll = st.number_input('Insert period (Year): ', min_value=1, max_value=10, value=2, key=6) + + with coBoll2: + windowSizeBoll = st.number_input('Window Size (Day): ', min_value=5, max_value=500, value=20, key=7) + + startBoll= dt.datetime.today()-dt.timedelta(numYearBoll * 365) + endBoll = dt.datetime.today() + dataBoll = yf.download(ticker,startBoll,endBoll) + df_boll = calcBollinger(dataBoll, windowSizeBoll) + df_boll = df_boll.reset_index() + figBoll = go.Figure() + figBoll.add_trace( go.Scatter( x = df_boll['Date'], - y = df_boll['bold'], - name = "Lower Band" + y = df_boll['bolu'], + name = "Upper Band" ) ) - - figBoll.update_layout(legend=dict( - orientation="h", - yanchor="bottom", - y=1, - xanchor="left", - x=0 - )) - - figBoll.update_yaxes(tickprefix="$") - st.plotly_chart(figBoll, use_container_width=True) + + + figBoll.add_trace( + go.Scatter( + x = df_boll['Date'], + y = df_boll['sma'], + name = "SMA" + str(windowSizeBoll) + " Over Last " + str(numYearBoll) + " Year(s)" + ) + ) + + + figBoll.add_trace( + go.Scatter( + x = df_boll['Date'], + y = df_boll['bold'], + name = "Lower Band" + ) + ) + + figBoll.update_layout(legend=dict( + orientation="h", + yanchor="bottom", + y=1, + xanchor="left", + x=0 + )) + + figBoll.update_yaxes(tickprefix="$") + st.plotly_chart(figBoll, use_container_width=True) + if(infoType == 'Intraday'): + st.title('Intradays overview') + + + st.subheader('Intraday with interval') + inter=st.selectbox("Choose the interval",["1m","2m","5m","15m","30m","60m","90m","1d"]) + d1 = st.date_input( + "Choose the beginning date", + datetime.date.today()) + st.write('From:', d1) + d2 = st.date_input( + "Choose the end date", + datetime.date.today()) + st.write('To:', d2) + + stock = yf.Ticker(ticker) + + + Interaday = stock.history(interval=inter,start=d1,end=d2) + st.table(Interaday) + def convert_df(df): + return df.to_csv().encode('utf-8') + + + csv = convert_df(Interaday) + st.download_button( + "Press to Download", + csv, + "file.csv", + "text/csv", + key='download-csv' + ) + + st.subheader('Intraday per dates') + Intraday = pdr.DataReader(ticker, data_source="yahoo",start=d1,end=d2) + + st.table(Intraday) + def convert_df(df): + return df.to_csv().encode('utf-8') + + csv = convert_df(Intraday) + st.download_button( + "Press to Download", + csv, + "file.csv", + "text/csv", + key='download2-csv' + ) + + if(infoType == 'Keras Prediction'): + d11 = st.date_input( + "Choose the beginning date of training set", + datetime.date(1999, 1, 1)) + st.write('From:', d11) + d22 = st.date_input( + "Choose the end date of training set", + datetime.date.today()) + st.write('To:', d22) + + st.title("stock prediction") + user_input=ticker + df=pdr.DataReader(ticker, data_source="yahoo",start=d11,end=d22) + + st.subheader("data from the defined time period") + st.write(df.describe()) + + st.subheader("CLOSING PRICE VS TIME CHART") + fig=plt.figure(figsize=(12,6)) + plt.plot(df.Close) + st.pyplot(fig) + + st.subheader("CLOSING PRICE VS TIME CHART & 100MA") + ma100=df.Close.rolling(100).mean() + fig=plt.figure(figsize=(12,6)) + plt.plot(ma100, label='Mean 100') + plt.plot(df.Close) + plt.legend() + st.pyplot(fig) + + st.subheader("CLOSING PRICE VS TIME CHART & 100MA and 200MA") + ma100=df.Close.rolling(100).mean() + ma200=df.Close.rolling(200).mean() + fig=plt.figure(figsize=(12,6)) + plt.plot(ma100, label='Mean 100') + plt.plot(ma200,label='Mean 200') + plt.plot(df.Close) + plt.legend() + st.pyplot(fig) + + + #splittng data into data frame + data_train=pd.DataFrame(df['Close'][0:int(len(df)*0.70)]) + data_test=pd.DataFrame(df['Close'][int(len(df)*0.70):int(len(df))]) + + + scaler=MinMaxScaler(feature_range=(0,1)) + + data_train_array=scaler.fit_transform(data_train) + + x_train=[] + y_train=[] + + #splitting data into xtrain and ytrain + for i in range(100, data_train_array.shape[0]): + x_train.append(data_train_array[i-100:i]) + y_train.append(data_train_array[i,0]) + x_train=np.array(x_train) + y_train=np.array(y_train) + + #load model + model=load_model('keras_model.h5') + past_100_days=data_train.tail(100) + final_df=past_100_days.append(data_test, ignore_index=True) + input_data=scaler.fit_transform(final_df) + + #testing + x_test=[] + y_test=[] + + for i in range(100, input_data.shape[0]): + x_test.append(input_data[i-100:i]) + y_test.append(input_data[i,0]) + x_test,y_test= np.array(x_test),np.array(y_test) + y_predicted=model.predict(x_test) + + scaler=scaler.scale_ + scaler_factor=1/scaler[0] + y_predicted=y_predicted*scaler_factor + y_test=y_test*scaler_factor + + # showing + st.subheader("PREDICTION VS TIME ORIGINAL PRICE") + fig2=plt.figure(figsize=(12,6)) + plt.plot(y_test,'b', label='Original Price') + plt.plot(y_predicted,'r',label='Predicted Price') + plt.xlabel('Time') + plt.ylabel('Price') + plt.legend() + config={ + 'modeBarButtonsToAdd': ['drawline'] + } + st.plotly_chart(fig2, config=config) + st.subheader("Comparing last five predicted and real prices") + predf1=y_test[-5:] + predf2=y_predicted[-5:] + + if(infoType == 'Prophet Prediction'): + + tickerSymbol = ticker + tickerData = yf.Ticker(tickerSymbol) + alpha2,gamma2 = st.columns(2) + starting = alpha2.date_input('Pick a starting Date') + ending = gamma2.date_input('Pick an ending date') + + + rhs, rh, rhs1 = st.columns((2.5,3,2)) + st.subheader("Let's have a look at some raw data") + #period = st.radio('Choose the Duration of Schemantics',('1d','1mo','1y')) + + def load_data(ticker): + data = yf.download(ticker, starting, ending) + data.reset_index(inplace=True) + return data + data = load_data(tickerSymbol) + rds, rd, rds1 = st.columns((1,5,1)) + rd.write(data) + + tickerDF=tickerData.history(period='1d', start=starting, end=ending) + + + graphs1, graphs3 = st.columns(2) + graphs1.markdown("""### Opening Price """) + graphs1.line_chart(tickerDF.Open) + graphs3.markdown("""### Volume Price """) + graphs3.line_chart(tickerDF.Volume) + graphs1.markdown("""### Closing Price """) + graphs1.line_chart(tickerDF.Close) + graphs3.markdown("""### Highest Price """) + graphs3.line_chart(tickerDF.High) + graphs1.markdown("""### Lowest Price""") + graphs1.line_chart(tickerDF.Low) + graphs3.markdown("""### Adjusted Closing Price """) + graphs3.line_chart(data['Adj Close']) + + + START = starting + TODAY = ending + + @st.cache + def load_data1(ticker): + data1 = yf.download(ticker, START, TODAY) + data1.reset_index(inplace=True) + return data1 + + data1 = load_data1(tickerSymbol) + #st.write(data1) + + df_train = data1[['Date','Close']] + df_train = df_train.rename(columns = {'Date':'ds','Close':'y'}) + df_train["ds"] = pd.to_datetime(df_train['ds'], format='%d-%M-%Y').dt.strftime('%d-%m-%Y') + #st.write(df_train) + + predictor = Prophet() + predictor.fit(df_train) + + st.markdown("""## Please Select the number of years for the predicted trends""") + + n_years = st.slider('Years of prediction:', 1, 4) + period = n_years * 365 + future = predictor.make_future_dataframe(periods = period) + forecast = predictor.predict(future) + + fcs2 , afc, fcs3 = st.columns(3) + # Show and plot forecast + afc.title('Forecast data') + #st.write(forecast.tail()) + + afc.markdown(f'Forecast plot for {n_years} following years') + fig1 = plot_plotly(predictor, forecast) + st.plotly_chart(fig1) + #a = add_changepoints_to_plot(fig1.gca(), predictor, forecast) + + + fcs,fch,fcs1 = st.columns(3) + fch.markdown("""## Forecasted Components""") + fig2 = predictor.plot_components(forecast) + st.write(fig2) + + st.caption('Made with Rivaldi') + + + if(infoType == 'Sentiment'): + + def get_news(ticker): + url = finviz_url + ticker + req = Request(url=url,headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0'}) + response = urlopen(req) + # Read the contents of the file into 'html' + html = BeautifulSoup(response) + # Find 'news-table' in the Soup and load it into 'news_table' + news_table = html.find(id="news-table") + return news_table + # parse news into dataframe + parsed_news = [] + parsed_news_df = pd.DataFrame(parsed_news) + def parse_news(news_table): + parsed_news = [] + parsed_news_df = pd.DataFrame(parsed_news) + for x in news_table.findAll('tr'): + # read the text from each tr tag into text + # get text from a only + text = x.get_text() + # splite text in the td tag into a list + date_scrape = x.td.text.split() + # if the length of 'date_scrape' is 1, load 'time' as the only element + + if len(date_scrape) == 1: + time = date_scrape[0] + + # else load 'date' as the 1st element and 'time' as the second + else: + date = date_scrape[0] + time = date_scrape[1] + + # Append ticker, date, time and headline as a list to the 'parsed_news' list + parsed_news.append([date, time, text]) + #Set column names + columns = ['date', 'time', 'headline'] + parsed_news_df = pd.DataFrame(parsed_news,columns=columns) + + # Create a pandas datetime object from the strings in 'date' and 'time' column + parsed_news_df['datetime'] = pd.to_datetime(parsed_news_df['date'] + ' ' + parsed_news_df['time']) + + + + return parsed_news_df + + + + + def score_news(parsed_news_df): + # Instantiate the sentiment intensity analyzer + vader = SentimentIntensityAnalyzer() + + # Iterate through the headlines and get the polarity scores using vader + scores = parsed_news_df['headline'].apply(vader.polarity_scores).tolist() + + # Convert the 'scores' list of dicts into a DataFrame + scores_df = pd.DataFrame(scores) + + # Join the DataFrames of the news and the list of dicts + parsed_and_scored_news = parsed_news_df.join(scores_df, rsuffix='_right') + + + parsed_and_scored_news = parsed_and_scored_news.set_index('datetime') + + parsed_and_scored_news = parsed_and_scored_news.drop(['date', 'time'], 1) + + parsed_and_scored_news = parsed_and_scored_news.rename(columns={"compound": "sentiment_score"}) + + return parsed_and_scored_news + + def plot_hourly_sentiment(parsed_and_scored_news, ticker): + + # Group by date and ticker columns from scored_news and calculate the mean + mean_scores = parsed_and_scored_news.resample('H').mean() + + # Plot a bar chart with plotly + fig = px.bar(mean_scores, x=mean_scores.index, y='sentiment_score', title = ticker + ' Hourly Sentiment Scores') + return fig # instead of using fig.show(), we return fig and turn it into a graphjson object for displaying in web page later + + def plot_daily_sentiment(parsed_and_scored_news, ticker): + + # Group by date and ticker columns from scored_news and calculate the mean + mean_scores = parsed_and_scored_news.resample('D').mean() + + # Plot a bar chart with plotly + fig = px.bar(mean_scores, x=mean_scores.index, y='sentiment_score', title = ticker + ' Daily Sentiment Scores') + return fig # instead of using fig.show(), we return fig and turn it into a graphjson object for displaying in web page later + def convert_df(df): + return df.to_csv().encode('utf-8') + + st.header("Stocks Sentiment based on news from FinViz") + st.subheader("Hourly and Daily Sentiment of {} Stock".format(ticker)) + description = ''' + The news headlines for the sentiment score are obtained from the FinViz website. + The following charts averages the sentiment scores of {} stock hourly and daily. + While the table below gives the most recent headlines of the stock with the negative, neutral, positive and an aggregated sentiment score. + '''.format(ticker) + news_table = get_news(ticker) + parsed_news_df2 = parse_news(news_table) + parsed_and_scored_news = score_news(parsed_news_df2) + fig_hourly = plot_hourly_sentiment(parsed_and_scored_news, ticker) + fig_daily = plot_daily_sentiment(parsed_and_scored_news, ticker) + st.plotly_chart(fig_hourly) + st.plotly_chart(fig_daily) + + + st.write(description) + st.table(parsed_and_scored_news) + csv = convert_df(parsed_and_scored_news) + st.download_button( + "Press to Download", + csv, + "file.csv", + "text/csv", + key='download-csv' + ) + if(infoType == 'ESG'): + + esg_data = pd.DataFrame() + stock_df = stock.sustainability.T + stock_df['symbol'] = ticker + esg_data = esg_data.append(stock_df) + new_esg_df = esg_data[['symbol', 'peerGroup', 'socialScore', 'governanceScore', 'totalEsg', 'environmentScore', 'esgPerformance']] + + def convert_df(df): + return df.to_csv().encode('utf-8') + st.header("ESG Stock Analysis") + Description2 = ''' + The ESG score is obtained from the Yahoo Finance website. + The following chart gives the overall three ESG score of {} stock + While the table gives the ESG Performance given from the website. + '''.format(ticker) + st.write(Description2) + st.subheader("ESG Score Table") + st.table(new_esg_df) + csv = convert_df(new_esg_df) + st.download_button( + "Press to Download", + csv, + "file.csv", + "text/csv", + key='download-csv' + ) + st.subheader("ESG Radar") + + + df_esg = pd.DataFrame(dict( + r=[new_esg_df.iloc[0,2], new_esg_df.iloc[0,3], new_esg_df.iloc[0,5]], + theta=['Social Score','Governance Score','Environment Score',])) + fig = px.line_polar(df_esg, r='r', theta='theta', line_close=True) + st.plotly_chart(fig) + + if(infoType == 'Media'): + + st.title('MediaDash Twitter') + Aaplproc = pd.read_csv("Media/AAPL_preproc.csv", sep=' ') + st.table(Aaplproc.head()) + dfAaplproc = pd.DataFrame(Aaplproc, columns=['date','volume']) + fig = px.bar(dfAaplproc, x='date', y='volume', title = ticker + ' Daily Volume tweet') + description = '''Il y a plusieurs groupes sur les réseaux sociaux (Twitter, Facebook, etc…) où des investisseurs individuels + échangent leurs avis et parviennent à créer des flux acheteurs ou vendeurs sur des titres. + Cette force defrappe va s’organiser progressivement et pourrait même pallier le manque d’informations sur plusieurssociétés. + De plus, l’impact des réseaux sociaux sur les décisions d’investissement est plus important lorsquele marché n’est pas efficient. + '''.format(ticker) + st.write(description) + st.header("Vue temporelle du flux de tweet") + st.subheader("Volume des tweets par jour du stock {}".format(ticker)) + st.plotly_chart(fig) + st.header("Vue des Sentiments des tweets") + st.subheader("Emotions qui ressortent le plus du stock {}".format(ticker)) + #fig3 = px.bar(dfAaplproc[1:10], x='index_sent', y='dfAaplproc[1:10].sum(axis=1)', color_continuous_scale=px.colors.sequential.Pinkyl, title='Sentiment volume') + fig2 = px.bar(dfAaplproc[1:10].sum(axis=1)) + st.plotly_chart(fig2) + url2 = "http://195.15.241.6:8000/accounts/login/?next=/" + st.write("For more information, please connect to the MediaDash page") + st.markdown("[Link to the Page](%s)" % url2) + + #st.plotly_chart(fig3) + #def displayPDF(file): + # ---Test with Display PDF Opening file from file path + #with open(file, "rb") as f: + #base64_pdf = base64.b64encode(f.read()).decode('utf-8') + + # Embedding PDF in HTML + #pdf_display = f'' + + # Displaying File + #return st.markdown(pdf_display, unsafe_allow_html=True) + + #displayPDF("Media/Twitter_ADOBE.pdf") + + + if(infoType == 'DataSeer'): + + st.title('Under Construction') diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..3f6d985 --- /dev/null +++ b/config.yaml @@ -0,0 +1,15 @@ + +cookie: + expiry_days: 30 + key: some_signature_key + name: some_cookie_name +credentials: + usernames: + dbaldwin: + email: SLM@SLM.com + name: SLM + password: Hello123 + +preauthorized: + emails: + - melsby@gmail.com diff --git a/keras_model.h5 b/keras_model.h5 new file mode 100644 index 0000000..b8784be Binary files /dev/null and b/keras_model.h5 differ diff --git a/requirements.txt b/requirements.txt index 4c61a49..2668d4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,22 @@ -yfinance==0.1.55 -streamlit==0.76.0 -pandas==1.2.1 -plotly==4.14.3 +yfinance +streamlit +streamlit-metrics +streamlit_authenticator +pandas +plotly +investpy +pandas_datareader +numpy +matplotlib +yahoo_fin +keras +tensorflow +sklearn +nltk +urllib3 +bs4 +prophet +PyJWT +bcrypt +PyYAML >= 5.3.1 +extra-streamlit-components diff --git a/secrets.toml b/secrets.toml new file mode 100644 index 0000000..2e7afcc --- /dev/null +++ b/secrets.toml @@ -0,0 +1,6 @@ +# .streamlit/secrets.toml + +[passwords] +# Follow the rule: username = "password" +SLM = "streamlit123" +ATM = "Ciao123" \ No newline at end of file