add 1 year historical data
This commit is contained in:
parent
cf324c849d
commit
e97cf5788d
@ -36,7 +36,7 @@ def options_bubble_data(chunk):
|
||||
try:
|
||||
company_tickers = ','.join(chunk)
|
||||
end_date = date.today()
|
||||
start_date = end_date - timedelta(90)
|
||||
start_date = end_date - timedelta(365) #look 1 year ago
|
||||
|
||||
end_date_str = end_date.strftime('%Y-%m-%d')
|
||||
start_date_str = start_date.strftime('%Y-%m-%d')
|
||||
@ -87,7 +87,7 @@ def options_bubble_data(chunk):
|
||||
for ticker in chunk:
|
||||
|
||||
bubble_data = {}
|
||||
for time_period, days in {'oneDay': 1, 'oneWeek': 7, 'oneMonth': 30, 'threeMonth': 90}.items():
|
||||
for time_period, days in {'oneDay': 1, 'oneWeek': 7, 'oneMonth': 30, 'threeMonth': 90, 'sixMonth': 180, 'oneYear': 252}.items():
|
||||
start_date = end_date - timedelta(days=days) #end_date is today
|
||||
|
||||
filtered_data = [item for item in res_filtered if start_date <= datetime.strptime(item['date'], '%Y-%m-%d').date() <= end_date]
|
||||
@ -114,7 +114,7 @@ def options_bubble_data(chunk):
|
||||
try:
|
||||
stock_con = sqlite3.connect('stocks.db')
|
||||
stock_cursor = stock_con.cursor()
|
||||
stock_cursor.execute("SELECT DISTINCT symbol FROM stocks")
|
||||
stock_cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE symbol NOT LIKE '%.%'")
|
||||
stock_symbols = [row[0] for row in stock_cursor.fetchall()]
|
||||
|
||||
etf_con = sqlite3.connect('etf.db')
|
||||
@ -128,7 +128,7 @@ try:
|
||||
total_symbols = stock_symbols + etf_symbols
|
||||
total_symbols = [item.replace("BRK-B", "BRK.B") for item in total_symbols]
|
||||
|
||||
chunk_size = len(total_symbols) // 20 # Divide the list into N chunks
|
||||
chunk_size = len(total_symbols) // 40 # Divide the list into N chunks
|
||||
chunks = [total_symbols[i:i + chunk_size] for i in range(0, len(total_symbols), chunk_size)]
|
||||
|
||||
for chunk in chunks:
|
||||
|
||||
@ -287,15 +287,19 @@ def run_executive():
|
||||
|
||||
def run_options_bubble_ticker():
|
||||
week = datetime.today().weekday()
|
||||
if week <= 4:
|
||||
current_time = datetime.now().time()
|
||||
start_time = datetime_time(15, 30)
|
||||
end_time = datetime_time(22, 30)
|
||||
if week <= 4 and start_time <= current_time < end_time:
|
||||
run_command(["python3", "cron_options_bubble.py"])
|
||||
|
||||
command = ["sudo", "rsync", "-avz", "-e", "ssh", "/root/backend/app/json/options-bubble/", f"root@{useast_ip_address}:/root/backend/app/json/options-bubble/"]
|
||||
command = ["sudo", "rsync", "-avz", "-e", "ssh", "/root/backend/app/json/options-bubble", f"root@{useast_ip_address}:/root/backend/app/json"]
|
||||
run_command(command)
|
||||
|
||||
command = ["sudo", "rsync", "-avz", "-e", "ssh", "/root/backend/app/json/options-flow/company/", f"root@{useast_ip_address}:/root/backend/app/json/options-flow/company/"]
|
||||
command = ["sudo", "rsync", "-avz", "-e", "ssh", "/root/backend/app/json/options-flow/company", f"root@{useast_ip_address}:/root/backend/app/json/options-flow"]
|
||||
run_command(command)
|
||||
|
||||
|
||||
def run_analyst_rating():
|
||||
run_command(["python3", "cron_analyst_insight.py"])
|
||||
run_command(["python3", "cron_analyst_db.py"])
|
||||
@ -525,6 +529,7 @@ schedule.every(15).minutes.do(run_threaded, run_cron_market_news).tag('market_ne
|
||||
schedule.every(10).minutes.do(run_threaded, run_one_day_price).tag('one_day_price_job')
|
||||
schedule.every(15).minutes.do(run_threaded, run_cron_heatmap).tag('heatmap_job')
|
||||
|
||||
|
||||
schedule.every(10).minutes.do(run_threaded, run_tracker).tag('tracker_job')
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user