update
This commit is contained in:
parent
7fc71b947f
commit
7bddf19976
@ -38,31 +38,34 @@ async def run():
|
|||||||
total_symbols = stocks_symbols + etf_symbols + crypto_symbols
|
total_symbols = stocks_symbols + etf_symbols + crypto_symbols
|
||||||
|
|
||||||
for symbol in tqdm(total_symbols):
|
for symbol in tqdm(total_symbols):
|
||||||
table_name = None
|
|
||||||
if symbol in etf_symbols: # Fixed variable name from symbols to symbol
|
|
||||||
query_con = etf_con
|
|
||||||
elif symbol in crypto_symbols:
|
|
||||||
query_con = crypto_con
|
|
||||||
elif symbol in stocks_symbols:
|
|
||||||
query_con = con
|
|
||||||
|
|
||||||
query_template = """
|
|
||||||
SELECT
|
|
||||||
date, open, high, low, close, volume
|
|
||||||
FROM
|
|
||||||
"{symbol}"
|
|
||||||
WHERE
|
|
||||||
date BETWEEN ? AND ?
|
|
||||||
"""
|
|
||||||
query = query_template.format(symbol=symbol)
|
|
||||||
df = pd.read_sql_query(query,query_con, params=(start_date, end_date))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Assuming rating_model and save_quote_as_json are defined elsewhere
|
table_name = None
|
||||||
res_dict = rating_model(df).ta_rating()
|
if symbol in etf_symbols: # Fixed variable name from symbols to symbol
|
||||||
await save_ta_rating(symbol, res_dict)
|
query_con = etf_con
|
||||||
except Exception as e:
|
elif symbol in crypto_symbols:
|
||||||
print(e)
|
query_con = crypto_con
|
||||||
|
elif symbol in stocks_symbols:
|
||||||
|
query_con = con
|
||||||
|
|
||||||
|
query_template = """
|
||||||
|
SELECT
|
||||||
|
date, open, high, low, close, volume
|
||||||
|
FROM
|
||||||
|
"{symbol}"
|
||||||
|
WHERE
|
||||||
|
date BETWEEN ? AND ?
|
||||||
|
"""
|
||||||
|
query = query_template.format(symbol=symbol)
|
||||||
|
df = pd.read_sql_query(query,query_con, params=(start_date, end_date))
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Assuming rating_model and save_quote_as_json are defined elsewhere
|
||||||
|
res_dict = rating_model(df).ta_rating()
|
||||||
|
await save_ta_rating(symbol, res_dict)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
con.close()
|
con.close()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user