diff --git a/Elaborated_Data/eps_comparison.csv b/Elaborated_Data/eps_comparison.csv new file mode 100644 index 0000000..0773054 --- /dev/null +++ b/Elaborated_Data/eps_comparison.csv @@ -0,0 +1,361 @@ +,Ticker,quarter,epsDifferential +0,AAPL,2022-06-30,3.448275862068969 +1,AAPL,2022-09-30,1.5748031496063006 +2,AAPL,2022-12-31,-3.092783505154642 +3,AAPL,2023-03-31,6.2937062937062995 +4,ABBV,2022-06-30,1.8126888217522674 +5,ABBV,2022-09-30,2.5210084033613533 +6,ABBV,2022-12-31,1.1235955056179785 +7,ABBV,2023-03-31,0.0 +8,ABT,2022-06-30,26.54867256637169 +9,ABT,2022-09-30,22.34042553191489 +10,ABT,2022-12-31,11.956521739130432 +11,ABT,2023-03-31,4.040404040404044 +12,ACN,2022-05-31,-2.1052631578947385 +13,ACN,2022-08-31,1.1673151750972859 +14,ACN,2022-11-30,5.841924398625427 +15,ACN,2023-02-28,7.599999999999999 +16,ADBE,2022-05-31,1.2084592145015116 +17,ADBE,2022-08-31,2.1021021021020974 +18,ADBE,2022-11-30,2.85714285714286 +19,ADBE,2023-02-28,3.2608695652173822 +20,AMAT,2022-07-31,8.379888268156419 +21,AMAT,2022-10-31,17.341040462427735 +22,AMAT,2023-01-31,5.181347150259061 +23,AMAT,2023-04-30,8.69565217391304 +24,AMGN,2022-06-30,5.681818181818182 +25,AMGN,2022-09-30,5.855855855855851 +26,AMGN,2022-12-31,0.0 +27,AMGN,2023-03-31,3.3766233766233738 +28,AMZN,2022-06-30,-242.85714285714283 +29,AMZN,2022-09-30,33.33333333333336 +30,AMZN,2022-12-31,-82.3529411764706 +31,AMZN,2023-03-31,47.61904761904762 +32,APD,2022-06-30,0.3831417624521162 +33,APD,2022-09-30,4.710144927536245 +34,APD,2022-12-31,-2.222222222222224 +35,APD,2023-03-31,3.7878787878787907 +36,AVGO,2022-04-30,4.252873563218403 +37,AVGO,2022-07-31,1.7782426778242668 +38,AVGO,2022-10-31,1.653696498054474 +39,AVGO,2023-01-31,2.2772277227722815 +40,BA,2022-06-30,164.28571428571425 +41,BA,2022-09-30,-8928.571428571428 +42,BA,2022-12-31,-773.076923076923 +43,BA,2023-03-31,18.691588785046722 +44,BAC,2022-06-30,-2.6666666666666687 +45,BAC,2022-09-30,5.194805194805199 +46,BAC,2022-12-31,10.389610389610384 +47,BAC,2023-03-31,14.634146341463413 +48,BDX,2022-06-30,6.400000000000006 +49,BDX,2022-09-30,0.3649635036496272 +50,BDX,2022-12-31,11.194029850746261 +51,BDX,2023-03-31,4.379562043795607 +52,BIDU,2022-06-30,51.38888888888891 +53,BIDU,2022-09-30,10.176991150442499 +54,BIDU,2022-12-31,12.060301507537687 +55,BIDU,2023-03-31,29.213483146067404 +56,BMY,2022-06-30,7.8212290502793245 +57,BMY,2022-09-30,8.7431693989071 +58,BMY,2022-12-31,5.813953488372099 +59,BMY,2023-03-31,4.060913705583748 +60,CAT,2022-06-30,5.647840531561474 +61,CAT,2022-09-30,25.0 +62,CAT,2022-12-31,6.218905472636817 +63,CAT,2023-03-31,29.894179894179906 +64,CCI,2022-06-30,1.0416666666666676 +65,CCI,2022-09-30,0.0 +66,CCI,2022-12-31,-3.061224489795921 +67,CCI,2023-03-31,6.593406593406587 +68,CHTR,2022-06-30,27.721335268505097 +69,CHTR,2022-09-30,-10.328068043742412 +70,CHTR,2022-12-31,-12.514220705346974 +71,CHTR,2023-03-31,-11.096256684491978 +72,CMCSA,2022-06-30,10.989010989010985 +73,CMCSA,2022-09-30,6.66666666666666 +74,CMCSA,2022-12-31,6.493506493506485 +75,CMCSA,2023-03-31,12.195121951219525 +76,CME,2022-06-30,2.072538860103629 +77,CME,2022-09-30,2.061855670103095 +78,CME,2022-12-31,2.1276595744680873 +79,CME,2023-03-31,2.1097046413502034 +80,COST,2022-05-31,0.3300330033003377 +81,COST,2022-08-31,0.9615384615384623 +82,COST,2022-11-30,-1.2861736334405156 +83,COST,2023-02-28,2.8037383177570048 +84,CRM,2022-04-30,4.255319148936175 +85,CRM,2022-07-31,16.66666666666666 +86,CRM,2022-10-31,15.70247933884297 +87,CRM,2023-01-31,23.52941176470587 +88,CSCO,2022-07-31,1.2195121951219523 +89,CSCO,2022-10-31,2.380952380952383 +90,CSCO,2023-01-31,3.529411764705886 +91,CSCO,2023-04-30,3.092783505154642 +92,CSX,2022-06-30,6.382978723404261 +93,CSX,2022-09-30,4.081632653061228 +94,CSX,2022-12-31,2.1739130434782505 +95,CSX,2023-03-31,11.627906976744184 +96,CVS,2022-06-30,10.599078341013826 +97,CVS,2022-09-30,5.025125628140697 +98,CVS,2022-12-31,3.645833333333337 +99,CVS,2023-03-31,5.263157894736858 +100,CVX,2022-06-30,14.117647058823543 +101,CVX,2022-09-30,15.592515592515593 +102,CVX,2022-12-31,-6.621004566210047 +103,CVX,2023-03-31,4.1055718475073215 +104,D,2022-06-30,1.3157894736842117 +105,D,2022-09-30,2.77777777777778 +106,D,2022-12-31,1.9230769230769247 +107,D,2023-03-31,2.061855670103095 +108,DE,2022-07-31,-7.922272047832589 +109,DE,2022-10-31,4.641350210970465 +110,DE,2023-01-31,17.80575539568346 +111,DE,2023-04-30,12.339930151338772 +112,DHR,2022-06-30,17.446808510638284 +113,DHR,2022-09-30,13.274336283185853 +114,DHR,2022-12-31,12.99212598425197 +115,DHR,2023-03-31,4.888888888888884 +116,DIS,2022-06-30,13.54166666666668 +117,DIS,2022-09-30,-45.45454545454546 +118,DIS,2022-12-31,26.923076923076916 +119,DIS,2023-03-31,0.0 +120,DUK,2022-06-30,6.542056074766339 +121,DUK,2022-09-30,-3.260869565217394 +122,DUK,2022-12-31,3.738317757009349 +123,DUK,2023-03-31,-4.761904761904765 +124,EXC,2022-06-30,-4.347826086956525 +125,EXC,2022-09-30,7.1428571428571495 +126,EXC,2022-12-31,0.0 +127,EXC,2023-03-31,6.060606060606049 +128,FDX,2022-05-31,0.14577259475218346 +129,FDX,2022-08-31,-33.07392996108949 +130,FDX,2022-11-30,12.765957446808523 +131,FDX,2023-02-28,24.908424908424916 +132,FIS,2022-06-30,1.1695906432748548 +133,FIS,2022-09-30,-0.571428571428572 +134,FIS,2022-12-31,0.5882352941176475 +135,FIS,2023-03-31,7.500000000000007 +136,GE,2022-06-30,110.8108108108108 +137,GE,2022-09-30,-23.913043478260878 +138,GE,2022-12-31,9.734513274336292 +139,GE,2023-03-31,92.85714285714285 +140,GILD,2022-06-30,3.947368421052635 +141,GILD,2022-09-30,32.86713286713287 +142,GILD,2022-12-31,12.080536912751674 +143,GILD,2023-03-31,-11.038961038961034 +144,GOOGL,2022-06-30,-5.468750000000004 +145,GOOGL,2022-09-30,-15.199999999999998 +146,GOOGL,2022-12-31,-11.016949152542365 +147,GOOGL,2023-03-31,9.345794392523352 +148,GS,2022-06-30,17.47720364741642 +149,GS,2022-09-30,7.282184655396613 +150,GS,2022-12-31,-39.41605839416059 +151,GS,2023-03-31,8.518518518518512 +152,HD,2022-07-31,2.2267206477732677 +153,HD,2022-10-31,2.9126213592233037 +154,HD,2023-01-31,0.6097560975609762 +155,HD,2023-04-30,0.5263157894736847 +156,HON,2022-06-30,3.44827586206898 +157,HON,2022-09-30,4.16666666666666 +158,HON,2022-12-31,0.3984063745020013 +159,HON,2023-03-31,7.25388601036269 +160,IBM,2022-06-30,1.7621145374449354 +161,IBM,2022-09-30,2.25988700564972 +162,IBM,2022-12-31,0.0 +163,IBM,2023-03-31,7.936507936507943 +164,INTC,2022-06-30,-58.57142857142858 +165,INTC,2022-09-30,84.37499999999999 +166,INTC,2022-12-31,-50.0 +167,INTC,2023-03-31,-73.33333333333333 +168,ISRG,2022-06-30,-4.201680672268911 +169,ISRG,2022-09-30,6.249999999999986 +170,ISRG,2022-12-31,-1.6000000000000014 +171,ISRG,2023-03-31,2.500000000000002 +172,JNJ,2022-06-30,2.371541501976287 +173,JNJ,2022-09-30,3.2388663967611184 +174,JNJ,2022-12-31,5.381165919282516 +175,JNJ,2023-03-31,7.200000000000006 +176,JPM,2022-06-30,-4.1666666666666705 +177,JPM,2022-09-30,8.333333333333341 +178,JPM,2022-12-31,16.33986928104575 +179,JPM,2023-03-31,20.234604105571833 +180,KO,2022-06-30,4.477611940298495 +181,KO,2022-09-30,7.812499999999989 +182,KO,2022-12-31,0.0 +183,KO,2023-03-31,6.250000000000005 +184,LIN,2022-06-30,58.163265306122454 +185,LIN,2022-09-30,15.476190476190482 +186,LIN,2022-12-31,17.91044776119403 +187,LIN,2023-03-31,62.051282051282065 +188,LLY,2022-06-30,-26.035502958579883 +189,LLY,2022-09-30,3.1250000000000027 +190,LLY,2022-12-31,17.415730337078642 +191,LLY,2023-03-31,-6.3583815028901665 +192,LMT,2022-06-30,-32.94797687861272 +193,LMT,2022-09-30,0.750750750750748 +194,LMT,2022-12-31,0.13531799729364918 +195,LMT,2023-03-31,9.075907590759089 +196,LOW,2022-04-30,9.00621118012421 +197,LOW,2022-07-31,1.9650655021834031 +198,LOW,2022-10-31,5.483870967741932 +199,LOW,2023-01-31,3.1674208144796308 +200,LRCX,2022-06-30,20.628415300546443 +201,LRCX,2022-09-30,9.338929695697804 +202,LRCX,2022-12-31,7.53012048192771 +203,LRCX,2023-03-31,6.880733944954132 +204,MA,2022-06-30,8.474576271186448 +205,MA,2022-09-30,4.687500000000004 +206,MA,2022-12-31,2.713178294573637 +207,MA,2023-03-31,2.9411764705882213 +208,MCD,2022-06-30,3.2388663967611184 +209,MCD,2022-09-30,3.8759689922480653 +210,MCD,2022-12-31,5.714285714285701 +211,MCD,2023-03-31,12.875536480686685 +212,MCO,2022-06-30,-3.4782608695652013 +213,MCO,2022-09-30,-10.194174757281552 +214,MCO,2022-12-31,11.111111111111121 +215,MCO,2023-03-31,35.90909090909091 +216,MDT,2022-04-30,-2.5641025641025665 +217,MDT,2022-07-31,0.8928571428571237 +218,MDT,2022-10-31,1.5625000000000013 +219,MDT,2023-01-31,2.362204724409451 +220,MMC,2022-06-30,1.612903225806441 +221,MMC,2022-09-30,3.5087719298245648 +222,MMC,2022-12-31,4.255319148936175 +223,MMC,2023-03-31,2.429149797570834 +224,MMM,2022-06-30,2.4793388429752086 +225,MMM,2022-09-30,3.4615384615384563 +226,MMM,2022-12-31,-3.3898305084745797 +227,MMM,2023-03-31,24.68354430379746 +228,MO,2022-06-30,0.8000000000000007 +229,MO,2022-09-30,-1.5384615384615397 +230,MO,2022-12-31,0.8547008547008554 +231,MO,2023-03-31,0.0 +232,MRK,2022-06-30,10.000000000000009 +233,MRK,2022-09-30,8.187134502923984 +234,MRK,2022-12-31,5.194805194805199 +235,MRK,2023-03-31,6.060606060606049 +236,MSFT,2022-06-30,-2.6200873362445436 +237,MSFT,2022-09-30,2.1739130434782727 +238,MSFT,2022-12-31,1.3100436681222623 +239,MSFT,2023-03-31,9.865470852017946 +240,NEE,2022-06-30,10.958904109589051 +241,NEE,2022-09-30,6.249999999999992 +242,NEE,2022-12-31,4.081632653061228 +243,NEE,2023-03-31,16.666666666666664 +244,NFLX,2022-06-30,8.843537414965995 +245,NFLX,2022-09-30,45.5399061032864 +246,NFLX,2022-12-31,-73.33333333333334 +247,NFLX,2023-03-31,0.6993006993007 +248,NKE,2022-05-31,12.499999999999996 +249,NKE,2022-08-31,1.0869565217391313 +250,NKE,2022-11-30,32.81249999999999 +251,NKE,2023-02-28,43.636363636363626 +252,NSC,2022-06-30,-0.5763688760806921 +253,NSC,2022-09-30,12.637362637362623 +254,NSC,2022-12-31,-0.5813953488372098 +255,NSC,2023-03-31,6.410256410256402 +256,NVDA,2022-04-30,5.426356589147292 +257,NVDA,2022-07-31,-59.199999999999996 +258,NVDA,2022-10-31,-15.942028985507244 +259,NVDA,2023-01-31,8.64197530864197 +260,ORCL,2022-05-31,12.408759124087585 +261,ORCL,2022-08-31,-3.738317757009349 +262,ORCL,2022-11-30,2.5423728813559343 +263,ORCL,2023-02-28,1.6666666666666683 +264,PEP,2022-06-30,6.896551724137938 +265,PEP,2022-09-30,7.0652173913043415 +266,PEP,2022-12-31,1.2121212121212133 +267,PEP,2023-03-31,7.913669064748209 +268,PFE,2022-06-30,14.606741573033707 +269,PFE,2022-09-30,28.057553956834543 +270,PFE,2022-12-31,8.571428571428557 +271,PFE,2023-03-31,25.510204081632654 +272,PG,2022-06-30,-0.8196721311475417 +273,PG,2022-09-30,1.9480519480519498 +274,PG,2022-12-31,0.0 +275,PG,2023-03-31,3.7878787878787907 +276,PM,2022-06-30,4.761904761904765 +277,PM,2022-09-30,-2.2058823529411784 +278,PM,2022-12-31,12.09677419354838 +279,PM,2023-03-31,2.9850746268656576 +280,PYPL,2022-06-30,8.139534883720938 +281,PYPL,2022-09-30,12.50000000000001 +282,PYPL,2022-12-31,3.3333333333333366 +283,PYPL,2023-03-31,6.363636363636349 +284,SCHW,2022-06-30,6.593406593406587 +285,SCHW,2022-09-30,4.761904761904765 +286,SCHW,2022-12-31,0.0 +287,SCHW,2023-03-31,3.333333333333336 +288,SO,2022-06-30,27.380952380952394 +289,SO,2022-09-30,-1.5037593984962419 +290,SO,2022-12-31,8.333333333333341 +291,SO,2023-03-31,11.267605633802827 +292,SPG,2022-06-30,5.5944055944056 +293,SPG,2022-09-30,14.583333333333332 +294,SPG,2022-12-31,21.1764705882353 +295,SPG,2023-03-31,-0.7194244604316554 +296,SPGI,2022-06-30,-4.095563139931744 +297,SPGI,2022-09-30,5.01792114695341 +298,SPGI,2022-12-31,2.4193548387096793 +299,SPGI,2023-03-31,8.247422680412363 +300,T,2022-06-30,6.557377049180333 +301,T,2022-09-30,11.475409836065584 +302,T,2022-12-31,7.0175438596491295 +303,T,2023-03-31,3.448275862068969 +304,TGT,2022-07-31,-45.83333333333333 +305,TGT,2022-10-31,-27.69953051643192 +306,TGT,2023-01-31,35.0 +307,TGT,2023-04-30,16.477272727272716 +308,TMO,2022-06-30,10.420841683366724 +309,TMO,2022-09-30,5.613305613305624 +310,TMO,2022-12-31,3.8461538461538494 +311,TMO,2023-03-31,0.0 +312,TMUS,2022-06-30,-136.0 +313,TMUS,2022-09-30,900.0 +314,TMUS,2022-12-31,7.272727272727258 +315,TMUS,2023-03-31,6.756756756756762 +316,TSLA,2022-06-30,26.66666666666667 +317,TSLA,2022-09-30,6.060606060606066 +318,TSLA,2022-12-31,5.309734513274342 +319,TSLA,2023-03-31,0.0 +320,TXN,2022-06-30,15.566037735849058 +321,TXN,2022-09-30,3.347280334728036 +322,TXN,2022-12-31,7.575757575757572 +323,TXN,2023-03-31,3.9325842696629247 +324,UNH,2022-06-30,7.115384615384618 +325,UNH,2022-09-30,6.826568265682659 +326,UNH,2022-12-31,3.2882011605415844 +327,UNH,2023-03-31,2.1207177814029348 +328,UNP,2022-06-30,2.4475524475524577 +329,UNP,2022-09-30,4.248366013071892 +330,UNP,2022-12-31,-3.610108303249101 +331,UNP,2023-03-31,3.48837209302325 +332,UPS,2022-06-30,4.113924050632908 +333,UPS,2022-09-30,5.281690140845083 +334,UPS,2022-12-31,0.8356545961002856 +335,UPS,2023-03-31,-0.4524886877827958 +336,USB,2022-06-30,1.8691588785046744 +337,USB,2022-09-30,0.8547008547008554 +338,USB,2022-12-31,2.5641025641025665 +339,USB,2023-03-31,3.5714285714285547 +340,V,2022-06-30,13.142857142857142 +341,V,2022-09-30,3.763440860215045 +342,V,2022-12-31,8.45771144278609 +343,V,2023-03-31,5.025125628140697 +344,VZ,2022-06-30,-0.7575757575757582 +345,VZ,2022-09-30,2.325581395348839 +346,VZ,2022-12-31,0.0 +347,VZ,2023-03-31,0.0 +348,WFC,2022-06-30,-7.500000000000007 +349,WFC,2022-09-30,-22.018348623853218 +350,WFC,2022-12-31,-7.5757575757575815 +351,WFC,2023-03-31,8.849557522123902 +352,WMT,2022-07-31,9.259259259259252 +353,WMT,2022-10-31,13.63636363636363 +354,WMT,2023-01-31,13.24503311258278 +355,WMT,2023-04-30,11.363636363636356 +356,XOM,2022-06-30,10.695187165775385 +357,XOM,2022-09-30,17.414248021108182 +358,XOM,2022-12-31,3.3434650455927013 +359,XOM,2023-03-31,9.266409266409276 diff --git a/backend/api/past_performance.py b/backend/api/past_performance.py new file mode 100644 index 0000000..75b5c47 --- /dev/null +++ b/backend/api/past_performance.py @@ -0,0 +1,17 @@ +import os +import pandas as pd +import numpy as np +from scraper.top100_extractor import programming_crime_list +from typing import Optional + +DF_EPS_PATH: str = os.path.join(os.path.dirname(__file__), '..', '..', 'Elaborated_Data', 'eps_comparison.csv') + + +def get_eps_comp(tickers: list[str]) -> list[dict]: + df = pd.read_csv(DF_EPS_PATH) + ticker_series = pd.Series(tickers) + df = df.loc[df['Ticker'].isin(ticker_series), :] \ + .rename(columns={"epsDifferential": "quarterlyDifferential", "Ticker": "ticker"}) \ + .reset_index(drop=True) + df = df.pivot(index='quarter', columns='ticker', values='quarterlyDifferential').reset_index(drop=False) + return df.replace({ np.nan: None }).to_dict('records') \ No newline at end of file diff --git a/indexer/comparison_indexer.py b/indexer/comparison_indexer.py index 642127a..4de70bb 100644 --- a/indexer/comparison_indexer.py +++ b/indexer/comparison_indexer.py @@ -37,6 +37,23 @@ def concatenate_eps(): eps_df.to_csv('Elaborated_Data/eps_quarterly_bar_chart.csv') +def eps_comparison(): + # Read earnings csv + eps_comp_df = pd.DataFrame() + + for ticker in programming_crime_list: + earnings = pd.read_csv(f'Companies_Data/{ticker}_Data/{ticker}earnings.csv') + earnings = earnings[['symbol', 'epsActual', 'epsEstimate', 'quarter']] + earnings['epsDifferential'] = ((earnings['epsActual'] - earnings['epsEstimate']) / earnings['epsEstimate']) * 100 + earnings = earnings.drop(columns=['epsActual', 'epsEstimate']) + earnings = earnings.rename(columns={'symbol': 'Ticker'}) + eps_comp_df = pd.concat([eps_comp_df, earnings], ignore_index=True, axis=0) + + # Save the earnings df to Elaborated_Data + eps_comp_df.to_csv(f'Elaborated_Data/eps_comparison.csv') + + return earnings if __name__ == '__main__': concatenate_price_history() - concatenate_eps() \ No newline at end of file + concatenate_eps() + eps_comparison() \ No newline at end of file diff --git a/stockingly-frontend/src/api/index.ts b/stockingly-frontend/src/api/index.ts index 364cad3..14452d8 100644 --- a/stockingly-frontend/src/api/index.ts +++ b/stockingly-frontend/src/api/index.ts @@ -44,6 +44,11 @@ export interface Eps { } +export interface EpsComp { + [ticker: string]: string | number; // really just number + quarter: string; +} + export const getCompanies = (tickers?: string[]): Promise => fetch(BACKEND_URL + '/companies' + (tickers ? ('/' + tickers.join('/')) : '')) .then(r => r.json()) @@ -61,6 +66,8 @@ export const getPriceHistory = (tickers: string[]): Promise => export const getBalanceSheet = (tickers: string[]): Promise => fetch(BACKEND_URL + '/assets_debts/' + tickers.join('/')).then(r=>r.json()) - export const getEps = (tickers: string[]): Promise => - fetch(BACKEND_URL + '/eps/' + tickers.join('/').toUpperCase()).then(r => r.json()) \ No newline at end of file + fetch(BACKEND_URL + '/eps/' + tickers.join('/').toUpperCase()).then(r => r.json()) + +export const getEpsComp = (tickers: string[]): Promise => + fetch(BACKEND_URL + '/eps_comp/' + tickers.join('/').toUpperCase()).then(r => r.json()) \ No newline at end of file diff --git a/stockingly-frontend/src/components/EpsComparisonChart.vue b/stockingly-frontend/src/components/EpsComparisonChart.vue new file mode 100644 index 0000000..9606368 --- /dev/null +++ b/stockingly-frontend/src/components/EpsComparisonChart.vue @@ -0,0 +1,112 @@ + + + \ No newline at end of file diff --git a/stockingly-frontend/src/views/Comparison.vue b/stockingly-frontend/src/views/Comparison.vue index c40fe30..569cb07 100644 --- a/stockingly-frontend/src/views/Comparison.vue +++ b/stockingly-frontend/src/views/Comparison.vue @@ -36,6 +36,9 @@ + + + @@ -66,6 +69,7 @@ import EmployeesChart from '@/components/EmployeesChart.vue'; import BalanceSheet from '@/components/BalanceSheet.vue'; import EpsChart from '@/components/EpsChart.vue'; import StockPrice from '@/components/StockPrice.vue'; +import EpsComparisonChart from '@/components/EpsComparisonChart.vue'; const route = useRoute(); const router = useRouter(); @@ -84,4 +88,4 @@ tickers.value = route.params.tickers.toString().split(','); onMounted(() => { companies.load(); }); - \ No newline at end of file + diff --git a/stockingly.py b/stockingly.py index 500f6ce..bc756fe 100644 --- a/stockingly.py +++ b/stockingly.py @@ -10,6 +10,7 @@ import sys import subprocess from typing import Optional from backend.api.eps import get_eps +from backend.api.past_performance import get_eps_comp ROOT_DIR: str = os.path.dirname(__file__) @@ -63,6 +64,11 @@ def eps(tickers: Optional[str]) -> object: return jsonify(get_eps(tickers.split('/'))) +@app.route('/eps_comp/', methods=['GET']) +def eps_comp(tickers: Optional[str]) -> object: + return jsonify(get_eps_comp(tickers.split('/'))) + + if __name__ == '__main__': if len(sys.argv) < 2 or sys.argv[1] != 'no-frontend': build_frontend()