From c3372ac0733d8534a69b089d73d5665aaa8fb044 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 30 Mar 2021 11:31:06 -0700 Subject: [PATCH 1/4] Adding a unit test for the Seeking Alpha earnings calendar model --- .../discovery/seeking_alpha_model.py | 36 +- tests/data/discovery_seeking_alpha_model.yaml | 1553 +++++++++++++++++ tests/test_discovery_seeing_alpha_model.py | 31 + 3 files changed, 1611 insertions(+), 9 deletions(-) create mode 100755 tests/data/discovery_seeking_alpha_model.yaml create mode 100755 tests/test_discovery_seeing_alpha_model.py diff --git a/gamestonk_terminal/discovery/seeking_alpha_model.py b/gamestonk_terminal/discovery/seeking_alpha_model.py index 11ea8f8daa0..59f63e44ae6 100755 --- a/gamestonk_terminal/discovery/seeking_alpha_model.py +++ b/gamestonk_terminal/discovery/seeking_alpha_model.py @@ -9,6 +9,26 @@ from pandas.core.frame import DataFrame from gamestonk_terminal.helper_funcs import get_user_agent +def get_earnings_html(url_next_earnings: str) -> str: + """Wraps HTTP requests.get for testibility + + Parameters + ---------- + url_next_earnings : str + Next earnings URL + + Returns + ------- + str + HTML page of next earnings + """ + earnings_html = requests.get( + url_next_earnings, headers={"User-Agent": get_user_agent()} + ).text + + return earnings_html + + def get_next_earnings(pages: int) -> DataFrame: """Returns a DataFrame with upcoming earnings @@ -24,17 +44,11 @@ def get_next_earnings(pages: int) -> DataFrame: """ earnings = list() + url_next_earnings = "https://seekingalpha.com/earnings/earnings-calendar" + for idx in range(0, pages): - if idx == 0: - url_next_earnings = "https://seekingalpha.com/earnings/earnings-calendar" - else: - url_next_earnings = ( - f"https://seekingalpha.com/earnings/earnings-calendar/{idx+1}" - ) text_soup_earnings = BeautifulSoup( - requests.get( - url_next_earnings, headers={"User-Agent": get_user_agent()} - ).text, + get_earnings_html(url_next_earnings), "lxml", ) @@ -44,6 +58,10 @@ def get_next_earnings(pages: int) -> DataFrame: stocks.append(a_stock.text) earnings.append(stocks) + url_next_earnings = ( + f"https://seekingalpha.com/earnings/earnings-calendar/{idx+1}" + ) + df_earnings = pd.DataFrame(earnings, columns=["Ticker", "Name", "Date"]) df_earnings["Date"] = pd.to_datetime(df_earnings["Date"]) df_earnings = df_earnings.set_index("Date") diff --git a/tests/data/discovery_seeking_alpha_model.yaml b/tests/data/discovery_seeking_alpha_model.yaml new file mode 100755 index 00000000000..ce3ef34b4a2 --- /dev/null +++ b/tests/data/discovery_seeking_alpha_model.yaml @@ -0,0 +1,1553 @@ +test_get_next_earnings: + base_next_earnings: + pages: 3 + mock_next_earnings_rets: + - | + Upcoming Earnings | Seeking Alpha

Upcoming Earnings

SymbolNameRelease DateRelease TimeGet Email Alerts
GVAGranite Construction Incorporated03/30/2021Pre-Market
UndoOn
BOSCB.O.S. Better Online Solutions Ltd.03/30/2021Pre-Market
UndoOn
USIOUsio, Inc.03/30/2021Pre-Market
UndoOn
OEGOrbital Energy Group, Inc.03/30/2021Pre-Market
UndoOn
NGSNatural Gas Services Group, Inc.03/30/2021Pre-Market
UndoOn
PTEPolarityTE, Inc.03/30/2021Pre-Market
UndoOn
ANGOAngioDynamics, Inc.03/30/2021Pre-Market
UndoOn
CAASChina Automotive Systems, Inc.03/30/2021Pre-Market
UndoOn
KNDIKandi Technologies Group, Inc.03/30/2021Pre-Market
UndoOn
ASOAcademy Sports and Outdoors, Inc.03/30/2021Pre-Market
UndoOn
MASS908 Devices Inc.03/30/2021Pre-Market
UndoOn
THTarget Hospitality Corp.03/30/2021Pre-Market
UndoOn
APRApria, Inc.03/30/2021Post-Market
UndoOn
PVHPVH Corp.03/30/2021Post-Market
UndoOn
REEDReed's, Inc.03/30/2021Post-Market
UndoOn
RKDAArcadia Biosciences, Inc.03/30/2021Post-Market
UndoOn
BLCMBellicum Pharmaceuticals, Inc.03/30/2021Post-Market
UndoOn
PHRPhreesia, Inc.03/30/2021Post-Market
UndoOn
OBLGOblong Inc.03/30/2021Post-Market
UndoOn
TOMZTOMI Environmental Solutions, Inc.03/30/2021Post-Market
UndoOn
ELDNEledon Pharmaceuticals, Inc.03/30/2021Post-Market
UndoOn
CRMDCorMedix Inc.03/30/2021Post-Market
UndoOn
TLMDSOC Telemed, Inc.03/30/2021Post-Market
UndoOn
CWBRCohBar, Inc.03/30/2021Post-Market
UndoOn
OXBROxbridge Re Holdings Limited03/30/2021Post-Market
UndoOn
MDVLMedAvail Holdings, Inc03/30/2021Post-Market
UndoOn
CHWYChewy, Inc.03/30/2021Post-Market
UndoOn
HYFMHydrofarm Holdings Group, Inc.03/30/2021Post-Market
UndoOn
HYREHyreCar Inc.03/30/2021Post-Market
UndoOn
CAAPCorporación América Airports S.A.03/30/2021Post-Market
UndoOn
GBNHGreenbrook TMS Inc.03/30/2021Post-Market
UndoOn
OSMTOsmotica Pharmaceuticals plc03/30/2021Post-Market
UndoOn
VSTAVasta Platform Limited03/30/2021Post-Market
UndoOn
FDSFactSet Research Systems Inc.03/30/2021Estimated
UndoOn
SPPISpectrum Pharmaceuticals, Inc.03/30/2021Estimated
UndoOn
BBBlackBerry Limited03/30/2021Estimated
UndoOn
PLXProtalix BioTherapeutics, Inc.03/30/2021Estimated
UndoOn
DYAIDyadic International, Inc.03/30/2021Estimated
UndoOn
LULULululemon Athletica Inc.03/30/2021Estimated
UndoOn
BEEMBeam Global03/30/2021Estimated
UndoOn
FMTXForma Therapeutics Holdings, Inc.03/30/2021Estimated
UndoOn
IGMSIGM Biosciences, Inc.03/30/2021Estimated
UndoOn
WBAWalgreens Boots Alliance, Inc.03/31/2021Pre-Market
UndoOn
APYXApyx Medical Corporation03/31/2021Pre-Market
UndoOn
UNFUniFirst Corporation03/31/2021Pre-Market
UndoOn
CSUCapital Senior Living Corporation03/31/2021Pre-Market
UndoOn
WLMSWilliams Industrial Services Group Inc.03/31/2021Pre-Market
UndoOn
AYIAcuity Brands, Inc.03/31/2021Pre-Market
UndoOn
MICTMICT, Inc.03/31/2021Pre-Market
UndoOn
CONNConn's, Inc.03/31/2021Pre-Market
UndoOn
EVKEver-Glory International Group, Inc.03/31/2021Pre-Market
UndoOn
CRTDCreatd Inc.03/31/2021Pre-Market
UndoOn
AYROAyro, Inc.03/31/2021Pre-Market
UndoOn
CVVCVD Equipment Corporation03/31/2021Post-Market
UndoOn
GVPGSE Systems, Inc.03/31/2021Post-Market
UndoOn
NGNovaGold Resources Inc.03/31/2021Post-Market
UndoOn
VRNTVerint Systems Inc.03/31/2021Post-Market
UndoOn
SPWHSportsman's Warehouse Holdings, Inc.03/31/2021Post-Market
UndoOn
IDEXIdeanomics, Inc.03/31/2021Post-Market
UndoOn
XLXL Fleet Corp.03/31/2021Post-Market
UndoOn
XSPAXpresSpa Group, Inc.03/31/2021Post-Market
UndoOn
NCNOnCino, Inc.03/31/2021Post-Market
UndoOn
EASTEastside Distilling, Inc.03/31/2021Post-Market
UndoOn
ARCEArco Platform Limited03/31/2021Post-Market
UndoOn
AESEAllied Esports Entertainment Inc.03/31/2021Post-Market
UndoOn
VTRUVitru Limited03/31/2021Post-Market
UndoOn
ELLOEllomay Capital Ltd.03/31/2021Estimated
UndoOn
AIMAIM ImmunoTech Inc.03/31/2021Estimated
UndoOn
ACYAeroCentury Corp.03/31/2021Estimated
UndoOn
AMSAmerican Shared Hospital Services03/31/2021Estimated
UndoOn
CCLCarnival Corporation & Plc03/31/2021Estimated
UndoOn
CVRChicago Rivet & Machine Co.03/31/2021Estimated
UndoOn
ELSEElectro-Sensors, Inc.03/31/2021Estimated
UndoOn
MTRMesa Royalty Trust03/31/2021Estimated
UndoOn
MUMicron Technology, Inc.03/31/2021Estimated
UndoOn
SNFCASecurity National Financial Corporation03/31/2021Estimated
UndoOn
SJTSan Juan Basin Royalty Trust03/31/2021Estimated
UndoOn
TCITranscontinental Realty Investors, Inc.03/31/2021Estimated
UndoOn
CDORCondor Hospitality Trust, Inc.03/31/2021Estimated
UndoOn
GESGuess', Inc.03/31/2021Estimated
UndoOn
CASICASI Pharmaceuticals, Inc.03/31/2021Estimated
UndoOn
MLSSMilestone Scientific Inc.03/31/2021Estimated
UndoOn
PRPHProPhase Labs, Inc.03/31/2021Estimated
UndoOn
RMTIRockwell Medical, Inc.03/31/2021Estimated
UndoOn
NYMXNymox Pharmaceutical Corporation03/31/2021Estimated
UndoOn
LOANManhattan Bridge Capital, Inc.03/31/2021Estimated
UndoOn
DCTHDelcath Systems, Inc.03/31/2021Estimated
UndoOn
+ - | + Upcoming Earnings | Seeking Alpha

Upcoming Earnings

SymbolNameRelease DateRelease TimeGet Email Alerts
PLMPolyMet Mining Corp.03/31/2021Estimated
UndoOn
GALTGalectin Therapeutics, Inc.03/31/2021Estimated
UndoOn
CYTHCyclo Therapeutics, Inc.03/31/2021Estimated
UndoOn
HUSAHouston American Energy Corp.03/31/2021Estimated
UndoOn
EGIEntrée Resources Ltd.03/31/2021Estimated
UndoOn
BCOW1895 Bancorp of Wisconsin, Inc.03/31/2021Estimated
UndoOn
ATNMActinium Pharmaceuticals, Inc.03/31/2021Estimated
UndoOn
CGIXCancer Genetics, Inc.03/31/2021Estimated
UndoOn
DFFNDiffusion Pharmaceuticals Inc.03/31/2021Estimated
UndoOn
NETENet Element, Inc.03/31/2021Estimated
UndoOn
DGLYDigital Ally, Inc.03/31/2021Estimated
UndoOn
EURNEuronav NV03/31/2021Estimated
UndoOn
VISLVislink Technologies, Inc.03/31/2021Estimated
UndoOn
GBRNew Concept Energy, Inc.03/31/2021Estimated
UndoOn
CPHIChina Pharma Holdings, Inc.03/31/2021Estimated
UndoOn
WRNWestern Copper and Gold Corporation03/31/2021Estimated
UndoOn
MARKRemark Holdings, Inc.03/31/2021Estimated
UndoOn
GLBSGlobus Maritime Limited03/31/2021Estimated
UndoOn
ORLAOrla Mining Ltd.03/31/2021Estimated
UndoOn
STROSutro Biopharma, Inc.03/31/2021Estimated
UndoOn
EARSAuris Medical Holding Ltd.03/31/2021Estimated
UndoOn
FUVArcimoto, Inc.03/31/2021Estimated
UndoOn
PVLPermianville Royalty Trust03/31/2021Estimated
UndoOn
PRPOPrecipio, Inc.03/31/2021Estimated
UndoOn
MARAMarathon Digital Holdings03/31/2021Estimated
UndoOn
HTIAHealthcare Trust, Inc. 7.375% RED PFD A03/31/2021Estimated
UndoOn
GNPXGenprex, Inc.03/31/2021Estimated
UndoOn
FGFFG Financial Group, Inc.03/31/2021Estimated
UndoOn
VERBVerb Technology Company, Inc.03/31/2021Estimated
UndoOn
AZRXAzurRx BioPharma, Inc.03/31/2021Estimated
UndoOn
RVMDRevolution Medicines, Inc.03/31/2021Estimated
UndoOn
PFHDProfessional Holding Corp.03/31/2021Estimated
UndoOn
TCRRTCR2 Therapeutics Inc.03/31/2021Estimated
UndoOn
KODKodiak Sciences Inc.03/31/2021Estimated
UndoOn
AVROAVROBIO, Inc.03/31/2021Estimated
UndoOn
CSSEChicken Soup for the Soul Entertainment, Inc.03/31/2021Estimated
UndoOn
SEELSeelos Therapeutics, Inc.03/31/2021Estimated
UndoOn
PHGEBiomX Inc.03/31/2021Estimated
UndoOn
AGEAgeX Therapeutics, Inc.03/31/2021Estimated
UndoOn
BEAMBeam Therapeutics Inc.03/31/2021Estimated
UndoOn
AKROAkero Therapeutics, Inc.03/31/2021Estimated
UndoOn
ALACAlberton Acquisition Corporation03/31/2021Estimated
UndoOn
CABACabaletta Bio, Inc.03/31/2021Estimated
UndoOn
GXGXGX Acquisition Corp.03/31/2021Estimated
UndoOn
GNLNGreenlane Holdings, Inc.03/31/2021Estimated
UndoOn
+ - | + Upcoming Earnings | Seeking Alpha

Upcoming Earnings

SymbolNameRelease DateRelease TimeGet Email Alerts
GIXGigCapital2, Inc.03/31/2021Estimated
UndoOn
SCPESC Health Corporation03/31/2021Estimated
UndoOn
SSPKSilver Spike Acquisition Corp.03/31/2021Estimated
UndoOn
NRBONeuroBo Pharmaceuticals, Inc.03/31/2021Estimated
UndoOn
NPANew Providence Acquisition Corp.03/31/2021Estimated
UndoOn
GNRSGreenrose Acquisition Corp.03/31/2021Estimated
UndoOn
CHPMUCHP Merger Corp. Units03/31/2021Estimated
UndoOn
KMXCarMax, Inc.04/01/2021Pre-Market
UndoOn
FCFranklin Covey Co.04/01/2021Post-Market
UndoOn
PLAYDave & Buster's Entertainment, Inc.04/01/2021Post-Market
UndoOn
WINTWindtree Therapeutics, Inc.04/01/2021Estimated
UndoOn
SNGXSoligenix, Inc.04/01/2021Estimated
UndoOn
SWKHSWK Holdings Corporation04/01/2021Estimated
UndoOn
SPRTSupport.com, Inc.04/01/2021Estimated
UndoOn
TATTTAT Technologies Ltd.04/01/2021Estimated
UndoOn
AAMEAtlantic American Corporation04/01/2021Estimated
UndoOn
BSETBassett Furniture Industries, Incorporated04/01/2021Estimated
UndoOn
HMGHMG/Courtland Properties, Inc.04/01/2021Estimated
UndoOn
IORIncome Opportunity Realty Investors, Inc.04/01/2021Estimated
UndoOn
TAYDTaylor Devices, Inc.04/01/2021Estimated
UndoOn
UGUnited-Guardian, Inc.04/01/2021Estimated
UndoOn
USEGU.S. Energy Corp.04/01/2021Estimated
UndoOn
ELAEnvela Corporation04/01/2021Estimated
UndoOn
RELVReliv' International, Inc.04/01/2021Estimated
UndoOn
CPHCCanterbury Park Holding Corporation04/01/2021Estimated
UndoOn
TAITTaitron Components Incorporated04/01/2021Estimated
UndoOn
SIEBSiebert Financial Corp.04/01/2021Estimated
UndoOn
MTSLMer Telemanagement Solutions Ltd.04/01/2021Estimated
UndoOn
TENXTenax Therapeutics, Inc.04/01/2021Estimated
UndoOn
MTEXMannatech, Incorporated04/01/2021Estimated
UndoOn
SGRPSPAR Group, Inc.04/01/2021Estimated
UndoOn
CWCOConsolidated Water Co. Ltd.04/01/2021Estimated
UndoOn
DSSDocument Security Systems, Inc.04/01/2021Estimated
UndoOn
AEZSAeterna Zentaris Inc.04/01/2021Estimated
UndoOn
OBASOptibase Ltd.04/01/2021Estimated
UndoOn
AFMDAffimed N.V.04/01/2021Estimated
UndoOn
SMTISanara MedTech Inc.04/01/2021Estimated
UndoOn
ZNZion Oil & Gas, Inc.04/01/2021Estimated
UndoOn
FENCFennec Pharmaceuticals Inc.04/01/2021Estimated
UndoOn
RIOTRiot Blockchain, Inc.04/01/2021Estimated
UndoOn
SASeabridge Gold Inc.04/01/2021Estimated
UndoOn
CKXCKX Lands, Inc.04/01/2021Estimated
UndoOn
KIQKelso Technologies Inc.04/01/2021Estimated
UndoOn
ISARFIshares Canadian Dex Universe Bond Index Fund04/01/2021Estimated
UndoOn
PHASPhaseBio Pharmaceuticals, Inc.04/01/2021Estimated
UndoOn
AAUAlmaden Minerals Ltd.04/01/2021Estimated
UndoOn
OPHCOptimumBank Holdings, Inc.04/01/2021Estimated
UndoOn
HGENHumanigen, Inc.04/01/2021Estimated
UndoOn
IUSPFiShares S&P/TSX Capped REIT Index ETF04/01/2021Estimated
UndoOn
IUNTFIunits MSCI International Equity Index Rsp Fund04/01/2021Estimated
UndoOn
IRSHFiShares Core S&P/TSX Capped Composite Index ETF04/01/2021Estimated
UndoOn
AKERAkers Biosciences, Inc.04/01/2021Estimated
UndoOn
SNCASeneca Biopharma, Inc.04/01/2021Estimated
UndoOn
MAGMAG Silver Corp.04/01/2021Estimated
UndoOn
+ expected_result: | + Date,Ticker,Name + 2021-03-30,BOSC,B.O.S. Better Online Solutions Ltd. + 2021-03-30,USIO,"Usio, Inc." + 2021-03-30,OEG,"Orbital Energy Group, Inc." + 2021-03-30,PTE,"PolarityTE, Inc." + 2021-03-30,ANGO,"AngioDynamics, Inc." + 2021-03-30,CAAS,"China Automotive Systems, Inc." + 2021-03-30,KNDI,"Kandi Technologies Group, Inc." + 2021-03-30,ASO,"Academy Sports and Outdoors, Inc." + 2021-03-30,MASS,908 Devices Inc. + 2021-03-30,TH,Target Hospitality Corp. + 2021-03-30,APR,"Apria, Inc." + 2021-03-30,REED,"Reed's, Inc." + 2021-03-30,RKDA,"Arcadia Biosciences, Inc." + 2021-03-30,BLCM,"Bellicum Pharmaceuticals, Inc." + 2021-03-30,TOMZ,"TOMI Environmental Solutions, Inc." + 2021-03-30,ELDN,"Eledon Pharmaceuticals, Inc." + 2021-03-30,TLMD,"SOC Telemed, Inc." + 2021-03-30,CWBR,"CohBar, Inc." + 2021-03-30,OXBR,Oxbridge Re Holdings Limited + 2021-03-30,MDVL,"MedAvail Holdings, Inc" + 2021-03-30,HYFM,"Hydrofarm Holdings Group, Inc." + 2021-03-30,HYRE,HyreCar Inc. + 2021-03-30,GBNH,Greenbrook TMS Inc. + 2021-03-30,OSMT,Osmotica Pharmaceuticals plc + 2021-03-30,VSTA,Vasta Platform Limited + 2021-03-30,SPPI,"Spectrum Pharmaceuticals, Inc." + 2021-03-30,DYAI,"Dyadic International, Inc." + 2021-03-30,LULU,Lululemon Athletica Inc. + 2021-03-30,BEEM,Beam Global + 2021-03-30,FMTX,"Forma Therapeutics Holdings, Inc." + 2021-03-30,IGMS,"IGM Biosciences, Inc." + 2021-03-31,WBA,"Walgreens Boots Alliance, Inc." + 2021-03-31,APYX,Apyx Medical Corporation + 2021-03-31,MICT,"MICT, Inc." + 2021-03-31,CONN,"Conn's, Inc." + 2021-03-31,EVK,"Ever-Glory International Group, Inc." + 2021-03-31,CRTD,Creatd Inc. + 2021-03-31,AYRO,"Ayro, Inc." + 2021-03-31,CVV,CVD Equipment Corporation + 2021-03-31,GVP,"GSE Systems, Inc." + 2021-03-31,VRNT,Verint Systems Inc. + 2021-03-31,SPWH,"Sportsman's Warehouse Holdings, Inc." + 2021-03-31,IDEX,"Ideanomics, Inc." + 2021-03-31,XSPA,"XpresSpa Group, Inc." + 2021-03-31,NCNO,"nCino, Inc." + 2021-03-31,EAST,"Eastside Distilling, Inc." + 2021-03-31,ARCE,Arco Platform Limited + 2021-03-31,AESE,Allied Esports Entertainment Inc. + 2021-03-31,VTRU,Vitru Limited + 2021-03-31,ELSE,"Electro-Sensors, Inc." + 2021-03-31,MU,"Micron Technology, Inc." + 2021-03-31,SNFCA,Security National Financial Corporation + 2021-03-31,CASI,"CASI Pharmaceuticals, Inc." + 2021-03-31,PRPH,"ProPhase Labs, Inc." + 2021-03-31,RMTI,"Rockwell Medical, Inc." + 2021-03-31,NYMX,Nymox Pharmaceutical Corporation + 2021-03-31,LOAN,"Manhattan Bridge Capital, Inc." + 2021-03-31,DCTH,"Delcath Systems, Inc." + 2021-03-31,GALT,"Galectin Therapeutics, Inc." + 2021-03-31,CYTH,"Cyclo Therapeutics, Inc." + 2021-03-31,BCOW,"1895 Bancorp of Wisconsin, Inc." + 2021-03-31,CGIX,"Cancer Genetics, Inc." + 2021-03-31,DFFN,Diffusion Pharmaceuticals Inc. + 2021-03-31,NETE,"Net Element, Inc." + 2021-03-31,DGLY,"Digital Ally, Inc." + 2021-03-31,VISL,"Vislink Technologies, Inc." + 2021-03-31,MARK,"Remark Holdings, Inc." + 2021-03-31,GLBS,Globus Maritime Limited + 2021-03-31,STRO,"Sutro Biopharma, Inc." + 2021-03-31,EARS,Auris Medical Holding Ltd. + 2021-03-31,FUV,"Arcimoto, Inc." + 2021-03-31,PRPO,"Precipio, Inc." + 2021-03-31,MARA,Marathon Digital Holdings + 2021-03-31,HTIA,"Healthcare Trust, Inc. 7.375% RED PFD A" + 2021-03-31,GNPX,"Genprex, Inc." + 2021-03-31,FGF,"FG Financial Group, Inc." + 2021-03-31,VERB,"Verb Technology Company, Inc." + 2021-03-31,AZRX,"AzurRx BioPharma, Inc." + 2021-03-31,RVMD,"Revolution Medicines, Inc." + 2021-03-31,PFHD,Professional Holding Corp. + 2021-03-31,TCRR,TCR2 Therapeutics Inc. + 2021-03-31,KOD,Kodiak Sciences Inc. + 2021-03-31,AVRO,"AVROBIO, Inc." + 2021-03-31,CSSE,"Chicken Soup for the Soul Entertainment, Inc." + 2021-03-31,SEEL,"Seelos Therapeutics, Inc." + 2021-03-31,BEAM,Beam Therapeutics Inc. + 2021-03-31,AKRO,"Akero Therapeutics, Inc." + 2021-03-31,ALAC,Alberton Acquisition Corporation + 2021-03-31,CABA,"Cabaletta Bio, Inc." + 2021-03-31,GXGX,GX Acquisition Corp. + 2021-03-31,GNLN,"Greenlane Holdings, Inc." + 2021-03-31,SSPK,Silver Spike Acquisition Corp. + 2021-03-31,NRBO,"NeuroBo Pharmaceuticals, Inc." + 2021-03-31,NPA,New Providence Acquisition Corp. + 2021-03-31,GNRS,Greenrose Acquisition Corp. + 2021-03-31,CHPMU,CHP Merger Corp. Units + 2021-04-01,PLAY,"Dave & Buster's Entertainment, Inc." + 2021-04-01,WINT,"Windtree Therapeutics, Inc." + 2021-04-01,SNGX,"Soligenix, Inc." + 2021-04-01,SWKH,SWK Holdings Corporation + 2021-04-01,SPRT,"Support.com, Inc." + 2021-04-01,TATT,TAT Technologies Ltd. + 2021-04-01,AAME,Atlantic American Corporation + 2021-04-01,BSET,"Bassett Furniture Industries, Incorporated" + 2021-04-01,TAYD,"Taylor Devices, Inc." + 2021-04-01,UG,"United-Guardian, Inc." + 2021-04-01,USEG,U.S. Energy Corp. + 2021-04-01,RELV,"Reliv' International, Inc." + 2021-04-01,CPHC,Canterbury Park Holding Corporation + 2021-04-01,TAIT,Taitron Components Incorporated + 2021-04-01,SIEB,Siebert Financial Corp. + 2021-04-01,MTSL,Mer Telemanagement Solutions Ltd. + 2021-04-01,TENX,"Tenax Therapeutics, Inc." + 2021-04-01,MTEX,"Mannatech, Incorporated" + 2021-04-01,SGRP,"SPAR Group, Inc." + 2021-04-01,CWCO,Consolidated Water Co. Ltd. + 2021-04-01,AEZS,Aeterna Zentaris Inc. + 2021-04-01,OBAS,Optibase Ltd. + 2021-04-01,AFMD,Affimed N.V. + 2021-04-01,SMTI,Sanara MedTech Inc. + 2021-04-01,ZN,"Zion Oil & Gas, Inc." + 2021-04-01,FENC,Fennec Pharmaceuticals Inc. + 2021-04-01,RIOT,"Riot Blockchain, Inc." + 2021-04-01,PHAS,"PhaseBio Pharmaceuticals, Inc." + 2021-04-01,OPHC,"OptimumBank Holdings, Inc." + 2021-04-01,HGEN,"Humanigen, Inc." + 2021-04-01,AKER,"Akers Biosciences, Inc." + 2021-04-01,SNCA,"Seneca Biopharma, Inc." diff --git a/tests/test_discovery_seeing_alpha_model.py b/tests/test_discovery_seeing_alpha_model.py new file mode 100755 index 00000000000..3606ca2178d --- /dev/null +++ b/tests/test_discovery_seeing_alpha_model.py @@ -0,0 +1,31 @@ +""" discovery/seeking_alpha_model.py tests """ +import unittest +from unittest import mock + +# pylint: disable=unused-import +from gamestonk_terminal.test_helper import ( # noqa: F401 + parameterize_from_file, + pytest_generate_tests, +) + +from gamestonk_terminal.discovery.seeking_alpha_model import get_next_earnings + +assertions = unittest.TestCase("__init__") + + +class TestDiscoverySeekingAlphaModel: + @mock.patch("gamestonk_terminal.discovery.seeking_alpha_model.get_earnings_html") + @parameterize_from_file( + "test_get_next_earnings", + "../tests/data/discovery_seeking_alpha_model.yaml", + ) + # pylint: disable=unused-argument + def test_get_next_earnings( + self, mock_get_earnings_html, pages, mock_next_earnings_rets, expected_result + ): + mock_get_earnings_html.side_effect = mock_next_earnings_rets + ret = get_next_earnings(pages) + + assertions.assertEqual( + ret.to_csv().replace("\r\n", "\n"), expected_result.replace("\r\n", "\n") + ) From 43520a08cc7db54a33645ee12bd8909c6162a477 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 30 Mar 2021 11:58:56 -0700 Subject: [PATCH 2/4] Adding a unit test for the discovery Fidelity orders model --- tests/data/discovery_fidelity_model.yaml | 2466 ++++++++++++++++++++++ tests/test_discovery_fidelity_model.py | 44 + 2 files changed, 2510 insertions(+) create mode 100755 tests/data/discovery_fidelity_model.yaml create mode 100755 tests/test_discovery_fidelity_model.py diff --git a/tests/data/discovery_fidelity_model.yaml b/tests/data/discovery_fidelity_model.yaml new file mode 100755 index 00000000000..86396dc954e --- /dev/null +++ b/tests/data/discovery_fidelity_model.yaml @@ -0,0 +1,2466 @@ +test_get_orders: + base_orders: + mock_fidelity_orders_html: | + + + + + + + + + + + + + + + + + + + + + + Stock Research - Fidelity + + + + + + + + + + + + + + + + + + Top Orders By Fidelity Customers + + + + + + + +
+ + + + +
+ + +
+ + +
+
+ + + + + +
+ + + + + + + + + + +
+ +
+ + + + + +
+
+ +
+

+
+ + +
+
+
+
+
+ + +
+ +
+ + + +
+
+ + + + +
+ +
+ + + +
+ +
+ +
+ + +
+ + + + + + +
+ + + +
+ +
+
+ +
+ + + + + + + + +
+ + + + + + Close + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + expected_header: "As of market close 03/29/21" + expected_orders: | + ,Symbol,Buy / Sell Ratio,Price Change,Company,# Buy Orders,# Sell Orders,Latest News + 0,TSLA,"71% Buys, 29% Sells",+8.29 (+1.3561%),TESLA INC,"16,267","6,675",BRIEF-Tesla Building New Tesla Semi Production Line At New Building Near Its Gigafactory Nevada Plant - Electrek + 1,GME,"65% Buys, 35% Sells",+15.58 (+8.5935%),GAMESTOP CORP,"8,441","4,621",GameStop appoints Amazon executive as chief growth officer + 2,HGEN,"49% Buys, 51% Sells",+0.63 (+2.9153%),HUMANIGEN INC,"6,072","6,427",BRIEF-Humanigen Inc Says Drew Initial $25.0 Million Term Loan Pursuant To Its Loan And Security Agreement With Hercules Capital Inc + 3,VIAC,"71% Buys, 29% Sells",+0.92 (+2.044%),VIACOMCBS INC,"8,277","3,313",Credit Suisse in firing line after Archegos losses + 4,PLTR,"83% Buys, 17% Sells",-0.06 (-0.2761%),PALANTIR TECHNOLOGIES INC,"8,051","1,615",Aviation startup Lilium to float in US via $3.3 bln SPAC deal + 5,SEAC,"49% Buys, 51% Sells",-0.6459 (-31.0529%),SEACHANGE INTERNATIONAL INC,"4,412","4,630",BRIEF-Seachange International Prices $19.1 Million Underwritten Public Offering Of Common Stock + 6,AAPL,"55% Buys, 45% Sells",-1.795 (-1.4787%),APPLE INC,"4,905","4,070","Google, U.S. government tangle over pre-trial document production" + 7,NIO,"69% Buys, 31% Sells",+1.79 (+5.0408%),NIO INC,"6,103","2,780",Form 6-K NIO Inc. For: Mar 26 + 8,AMC,"67% Buys, 33% Sells",-0.125 (-1.2077%),AMC ENTERTAINMENT HOLDINGS INC,"4,736","2,345","National CineMedia, Inc. Appoints Mark Zoradi to Its Board of Directors" + 9,HOFV,"49% Buys, 51% Sells",-1.191 (-17.6444%),HALL OF FAME RESORT & ENTERTAINMENT CO,"3,179","3,364","Hall of Fame Resort & Entertainment Company Unveils Cities, Team Names and Logos for the Hall Of Fantasy League" + 10,BIDU,"62% Buys, 38% Sells",+10.7843 (+5.2683%),BAIDU INC,"3,442","2,144","Form 6-K Baidu, Inc. For: Mar 30" + 11,BA,"54% Buys, 46% Sells",+1.3479 (+0.538%),BOEING CO,"2,740","2,340",US STOCKS-Wall St drops as tech stocks hit by spike in yields + 12,TQQQ,"53% Buys, 47% Sells",-2.18 (-2.4605%),PROSHARES ULTRAPRO QQQ,"2,632","2,373",Traders chase sky-high returns in leveraged exchange traded products + 13,UPC,"53% Buys, 47% Sells",-1.12 (-19.9643%),UNIVERSE PHARMACEUTICALS INC,"2,611","2,346",Form 6-K Universe Pharmaceuticals For: Mar 25 + 14,CCIV,"80% Buys, 20% Sells",+1.38 (+6.4637%),CHURCHILL CAPITAL IV CORP,"3,896",944,BRIEF-Lucid Motors Says Michael Bell Joining As Senior Vice President Of Digital + 15,RKT,"41% Buys, 59% Sells",+0.035 (+0.1471%),ROCKET COMPANIES INC,"1,954","2,810","Form 10-K Rocket Companies, Inc. For: Dec 31" + 16,ARKK,"75% Buys, 25% Sells",+2.16 (+1.943%),ARK INNOVATION ETF,"3,384","1,149",Cathie Wood's Ark expects Tesla stock to reach $3000 by 2025 + 17,AMZN,"53% Buys, 47% Sells",-26.40 (-0.8583%),AMAZONCOM INC,"2,392","2,137",Arm Ltd debuts new chip technology aimed at overtaking data centers + 18,RIOT,"53% Buys, 47% Sells",+1.931 (+4.0322%),RIOT BLOCKCHAIN INC,"2,209","1,933",Web Based Education Solutions to Remain Vital Post-Pandemic + 19,DKNG,"76% Buys, 24% Sells",+2.13 (+3.6598%),DRAFTKINGS INC,"3,131","1,006","BRIEF-Draftkings Acquires Vsin, Multi-Platform Sports Betting Broadcast And Content Company" + 20,TME,"65% Buys, 35% Sells",+0.558 (+2.7434%),TENCENT MUSIC ENTERTAINMENT GROUP,"2,612","1,418",Credit Suisse in firing line after Archegos losses + 21,SPY,"67% Buys, 33% Sells",-1.545 (-0.3904%),SPDR S&P 500 ETF TRUST,"2,619","1,285",Analysis: Debacle at Archegos throws excessive risk-taking into spotlight + 22,SQ,"76% Buys, 24% Sells",+3.41 (+1.6459%),SQUARE INC,"2,881",888,"Form 4 Square, Inc. For: Mar 23 Filed by: Ahuja Amrita" + 23,HCMC,"81% Buys, 19% Sells",-0.0001 (-8.333333%),HEALTHIER CHOICES MANAGEMENT CORP,"3,046",723,Healthier Choices Management Corp. Announces Re-Launching of its Vitamins and Supplements Online Store at TheVitaminStore.com + 24,AMD,"60% Buys, 40% Sells",-1.425 (-1.8473%),ADVANCED MICRO DEVICES INC,"2,143","1,439",Arm Ltd debuts new chip technology aimed at overtaking data centers + 25,DISCA,"77% Buys, 23% Sells",+1.67 (+4.0504%),DISCOVERY INC,"2,712",830,Credit Suisse in firing line after Archegos losses + 26,FB,"52% Buys, 48% Sells",-1.23 (-0.4229%),FACEBOOK INC,"1,818","1,684",Facebook's chief revenue officer to leave later this year + 27,MSFT,"65% Buys, 35% Sells",-3.48 (-1.4793%),MICROSOFT CORP,"2,242","1,218","Google, U.S. government tangle over pre-trial document production" + 28,MRNA,"72% Buys, 28% Sells",-5.83 (-4.7237%),MODERNA INC,"2,477",957,U.S. administers 147.6 mln doses of COVID-19 vaccines - CDC + 29,QQQ,"64% Buys, 36% Sells",-2.63 (-0.8325%),INVESCO QQQ TRUST SERIES 1,"2,167","1,221","Form N-CEN INVESCO QQQ TRUST, SERIE For: Dec 31" diff --git a/tests/test_discovery_fidelity_model.py b/tests/test_discovery_fidelity_model.py new file mode 100755 index 00000000000..027617df3b6 --- /dev/null +++ b/tests/test_discovery_fidelity_model.py @@ -0,0 +1,44 @@ +""" discovery/fidelity_model.py tests """ +import unittest +from unittest import mock + +# pylint: disable=unused-import +from gamestonk_terminal.test_helper import ( # noqa: F401 + parameterize_from_file, + pytest_generate_tests, +) + +from gamestonk_terminal.discovery.fidelity_model import get_orders + +assertions = unittest.TestCase("__init__") + + +class TestDiscoveryFidelityModel: + @mock.patch("gamestonk_terminal.discovery.fidelity_model.requests") + @parameterize_from_file( + "test_get_orders", + "../tests/data/discovery_fidelity_model.yaml", + ) + # pylint: disable=unused-argument + def test_get_orders( + self, + mock_requests_get, + mock_fidelity_orders_html, + expected_header, + expected_orders, + ): + mock_requests_get.get().text = mock_fidelity_orders_html + header, ret = get_orders() + + print("") + print(ret.to_csv()) + print("") + print(header) + + assertions.assertEqual.__self__.maxDiff = None + assertions.assertEqual( + header.replace("\r\n", "\n"), expected_header.replace("\r\n", "\n") + ) + assertions.assertEqual( + ret.to_csv().replace("\r\n", "\n"), expected_orders.replace("\r\n", "\n") + ) From 19cd78311f1ad978cf878fc75559dd6b0f27eb26 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 30 Mar 2021 11:59:38 -0700 Subject: [PATCH 3/4] Updating file mods --- tests/data/discovery_fidelity_model.yaml | 0 tests/data/discovery_seeking_alpha_model.yaml | 0 tests/data/discovery_short_interest_model.yaml | 0 tests/test_discovery_fidelity_model.py | 0 tests/test_discovery_seeing_alpha_model.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tests/data/discovery_fidelity_model.yaml mode change 100755 => 100644 tests/data/discovery_seeking_alpha_model.yaml mode change 100755 => 100644 tests/data/discovery_short_interest_model.yaml mode change 100755 => 100644 tests/test_discovery_fidelity_model.py mode change 100755 => 100644 tests/test_discovery_seeing_alpha_model.py diff --git a/tests/data/discovery_fidelity_model.yaml b/tests/data/discovery_fidelity_model.yaml old mode 100755 new mode 100644 diff --git a/tests/data/discovery_seeking_alpha_model.yaml b/tests/data/discovery_seeking_alpha_model.yaml old mode 100755 new mode 100644 diff --git a/tests/data/discovery_short_interest_model.yaml b/tests/data/discovery_short_interest_model.yaml old mode 100755 new mode 100644 diff --git a/tests/test_discovery_fidelity_model.py b/tests/test_discovery_fidelity_model.py old mode 100755 new mode 100644 diff --git a/tests/test_discovery_seeing_alpha_model.py b/tests/test_discovery_seeing_alpha_model.py old mode 100755 new mode 100644 From 656d783f10e9f5872cf9d55f9f4a968bbac9a3cb Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Tue, 30 Mar 2021 12:00:12 -0700 Subject: [PATCH 4/4] Removing text output --- tests/test_discovery_fidelity_model.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/test_discovery_fidelity_model.py b/tests/test_discovery_fidelity_model.py index 027617df3b6..34feb5b5ec9 100644 --- a/tests/test_discovery_fidelity_model.py +++ b/tests/test_discovery_fidelity_model.py @@ -30,11 +30,6 @@ class TestDiscoveryFidelityModel: mock_requests_get.get().text = mock_fidelity_orders_html header, ret = get_orders() - print("") - print(ret.to_csv()) - print("") - print(header) - assertions.assertEqual.__self__.maxDiff = None assertions.assertEqual( header.replace("\r\n", "\n"), expected_header.replace("\r\n", "\n")