From e68a6eeb3645245822321a8d8aa0da6b72a5cddb Mon Sep 17 00:00:00 2001 From: Tommaso Verzegnassi Date: Mon, 29 May 2023 13:38:02 +0200 Subject: [PATCH] things occurred --- backend/api/eps.py | 17 ++++ .../src/components/EpsChart.vue | 88 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 backend/api/eps.py create mode 100644 stockingly-frontend/src/components/EpsChart.vue diff --git a/backend/api/eps.py b/backend/api/eps.py new file mode 100644 index 0000000..702272c --- /dev/null +++ b/backend/api/eps.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_quarterly_bar_chart.csv') + + +def get_eps(tickers: list[str]) -> list[dict]: + df = pd.read_csv(DF_EPS_PATH) + ticker_series = pd.Series(tickers) + df = df.loc[df.symbol.isin(ticker_series), :] \ + .rename(columns={"epsActual": "quarterlyEps", "symbol": "ticker"}) \ + .reset_index(drop=True) + df = df.pivot(index='quarter', columns='ticker', values='quarterlyEps').reset_index(drop=False) + return df.replace({ np.nan: None }).to_dict('records') \ No newline at end of file diff --git a/stockingly-frontend/src/components/EpsChart.vue b/stockingly-frontend/src/components/EpsChart.vue new file mode 100644 index 0000000..0f84ff1 --- /dev/null +++ b/stockingly-frontend/src/components/EpsChart.vue @@ -0,0 +1,88 @@ + + + \ No newline at end of file