Indexer finished with the last index, on monday we will discuss the implementation of the main dashboard with these indexes

This commit is contained in:
Pietro Rodolfo Masera 2023-05-13 16:52:31 +02:00
parent e9135a6d8c
commit c666126661

View file

@ -1,7 +1,6 @@
import pandas as pd
def get_peg(ticker: str):
# Read current ratios .csv
current_ratios = pd.read_csv(f'Companies_Data/{ticker}_Data/{ticker}_current_ratios.csv', index_col=[0])
@ -20,7 +19,6 @@ def get_peg(ticker: str):
return peg_ratio.values[0]
def get_financial_health(ticker: str):
# Read balance sheet .csv
balance_sheet = pd.read_csv(f'Companies_Data/{ticker}_Data/{ticker}_balance_sheet_4Y+4Q.csv', index_col=[0])
@ -42,14 +40,23 @@ def get_financial_health(ticker: str):
return financial_health.values[0]
def estimated_growth(ticker: str):
# Read 5 years growth estimates
growth_estimated = pd.read_csv(f'Companies_Data/{ticker}_Data/{ticker}5YGrowthEstimates.csv', index_col=[0])['5Y Growth estimate'].values[0]
return growth_estimated
if __name__ == '__main__':
print(get_peg('MCD')) # < 1 (GREEN); > 1 (RED); = 1 (ORANGE)
print(get_financial_health('MCD')) # < 1 (GREEN); > 1 (RED); = 1 (ORANGE)
print(estimated_growth('MCD')) # < 0 (RED); 0 < x < 8% (ORANGE); < 8 % (GREEN)
def past_performance_earnings(ticker: str):
# Read earnings csv
earnings = pd.read_csv(f'Companies_Data/{ticker}_Data/{ticker}earnings.csv', index_col=[0])
# Performance
performance_index = round((earnings['epsActual'].sum() - earnings['epsEstimate'].sum()) / earnings['epsEstimate'].sum() * 100, 2)
return performance_index
if __name__ == '__main__':
print(get_peg('GOOGL')) # < 1 (GREEN); > 1 (RED); = 1 (ORANGE)
print(get_financial_health('GOOGL')) # < 1 (GREEN); > 1 (RED); = 1 (ORANGE)
print(estimated_growth('GOOGL')) # < 0 (RED); 0 < x < 8% (ORANGE); < 8 % (GREEN)
print(past_performance_earnings('GOOGL'), "%") # -100 < x < 0 (RED); = 0 (ORANGE); 0 < x < 100 (GREEN)