eshan6704 commited on
Commit
5754ff1
·
verified ·
1 Parent(s): 200c4cb

Update stock.py

Browse files
Files changed (1) hide show
  1. stock.py +6 -6
stock.py CHANGED
@@ -69,7 +69,7 @@ def fetch_intraday(symbol, indicators=None):
69
 
70
  if isinstance(df.columns, pd.MultiIndex):
71
  df.columns = df.columns.get_level_values(0)
72
- file_name = f"intraday/{symbol}_{date_str.replace('-', '_')}.csv"
73
  upload_file("eshanhf",file_name,df)
74
  #chart_html = build_chart(df, indicators=indicators)
75
  table_html = make_table(df.tail(50))
@@ -89,7 +89,7 @@ def fetch_daily(symbol, source="yfinance", max_rows=200):
89
 
90
  if isinstance(df.columns, pd.MultiIndex):
91
  df.columns = df.columns.get_level_values(0)
92
- file_name = f"daily/{symbol}_{date_str.replace('-', '_')}.csv"
93
  upload_file("eshanhf",file_name,df)
94
  df_disp = df.head(max_rows)
95
  combined_df = talib_df(df_disp)
@@ -117,7 +117,7 @@ def fetch_qresult(symbol):
117
  df = qresult(symbol)
118
  if df.empty:
119
  return wrap_html(f"<h1>No quarterly results for {symbol}</h1>")
120
- file_name = f"qresult/{symbol}_{date_str.replace('-', '_')}.csv"
121
  upload_file("eshanhf",file_name,df)
122
  df_fmt = df.copy()
123
  for col in df_fmt.columns:
@@ -140,7 +140,7 @@ def fetch_result(symbol):
140
  df = result(symbol)
141
  if df.empty:
142
  return wrap_html(f"<h1>No annual results for {symbol}</h1>")
143
- file_name = f"result/{symbol}_{date_str.replace('-', '_')}.csv"
144
  upload_file("eshanhf",file_name,df)
145
  df_fmt = df.copy()
146
  for col in df_fmt.columns:
@@ -163,7 +163,7 @@ def fetch_balance(symbol):
163
  df = balance(symbol)
164
  if df.empty:
165
  return wrap_html(f"<h1>No balance sheet for {symbol}</h1>")
166
- file_name = f"balance/{symbol}_{date_str.replace('-', '_')}.csv"
167
  upload_file("eshanhf",file_name,df)
168
  df_fmt = df.copy()
169
  for col in df_fmt.columns:
@@ -186,7 +186,7 @@ def fetch_cashflow(symbol):
186
  df = cashflow(symbol)
187
  if df.empty:
188
  return wrap_html(f"<h1>No cashflow for {symbol}</h1>")
189
- file_name = f"cashflow/{symbol}_{date_str.replace('-', '_')}.csv"
190
  upload_file("eshanhf",file_name,df)
191
  df_fmt = df.copy()
192
  for col in df_fmt.columns:
 
69
 
70
  if isinstance(df.columns, pd.MultiIndex):
71
  df.columns = df.columns.get_level_values(0)
72
+ file_name = f"intraday/{symbol}.csv"
73
  upload_file("eshanhf",file_name,df)
74
  #chart_html = build_chart(df, indicators=indicators)
75
  table_html = make_table(df.tail(50))
 
89
 
90
  if isinstance(df.columns, pd.MultiIndex):
91
  df.columns = df.columns.get_level_values(0)
92
+ file_name = f"daily/{symbol}.csv"
93
  upload_file("eshanhf",file_name,df)
94
  df_disp = df.head(max_rows)
95
  combined_df = talib_df(df_disp)
 
117
  df = qresult(symbol)
118
  if df.empty:
119
  return wrap_html(f"<h1>No quarterly results for {symbol}</h1>")
120
+ file_name = f"qresult/{symbol}.csv"
121
  upload_file("eshanhf",file_name,df)
122
  df_fmt = df.copy()
123
  for col in df_fmt.columns:
 
140
  df = result(symbol)
141
  if df.empty:
142
  return wrap_html(f"<h1>No annual results for {symbol}</h1>")
143
+ file_name = f"result/{symbol}.csv"
144
  upload_file("eshanhf",file_name,df)
145
  df_fmt = df.copy()
146
  for col in df_fmt.columns:
 
163
  df = balance(symbol)
164
  if df.empty:
165
  return wrap_html(f"<h1>No balance sheet for {symbol}</h1>")
166
+ file_name = f"balance/{symbol}.csv"
167
  upload_file("eshanhf",file_name,df)
168
  df_fmt = df.copy()
169
  for col in df_fmt.columns:
 
186
  df = cashflow(symbol)
187
  if df.empty:
188
  return wrap_html(f"<h1>No cashflow for {symbol}</h1>")
189
+ file_name = f"cashflow/{symbol}.csv"
190
  upload_file("eshanhf",file_name,df)
191
  df_fmt = df.copy()
192
  for col in df_fmt.columns: