-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
30 lines (26 loc) · 1.65 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
if not (TICKERS := list(map(str.upper, sys.argv[1:]))):
raise ValueError('Informe ao menos um ticker')
import src.integrations.statusinvest.stocks as statusinvest_stocks
# import src.integrations.statusinvest.provents as statusinvest_provents
import src.integrations.investing.dividends as investing_dividends
import src.integrations.statusinvest.payouts as statusinvest_payouts
import src.integrations.statusinvest.balance_sheet as statusinvest_balance_sheet
import src.indicators.magic_formula as magic_formula
import src.indicators.highest_price as highest_price
import src.indicators.dividend_on_cost as dividend_on_cost
import src.output as output
df_stocks = statusinvest_stocks.get_df_all()
df_dividends = investing_dividends.get_df_average_by_period(TICKERS)
df_payouts = statusinvest_payouts.get_df_by_year(TICKERS)
df_balance_sheet = statusinvest_balance_sheet.get_df_last_year(TICKERS)
df_magic_formula = magic_formula.get_df_rank(df_stocks)
df_highest_price = highest_price.get_df_by_dy(TICKERS, df_dividends)
df_dividend_on_cost = dividend_on_cost.get_df_by_dy(TICKERS, df_stocks, df_dividends)
output.get_formatted_df(df_stocks.join(df_dividends.set_index('TICKER'), on='TICKER')
.join(df_payouts.set_index('TICKER'), on='TICKER')
.join(df_balance_sheet.set_index('TICKER'), on='TICKER')
.join(df_magic_formula.set_index('TICKER'), on='TICKER')
.join(df_highest_price.set_index('TICKER'), on='TICKER')
.join(df_dividend_on_cost.set_index('TICKER'), on='TICKER')).to_csv('output.csv')
sys.exit(0)