bugfixing
This commit is contained in:
parent
3a82ea490a
commit
ee69d1564b
@ -3,7 +3,7 @@ import pandas as pd
|
|||||||
import orjson
|
import orjson
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
import pytz
|
import pytz
|
||||||
import requests # Add missing import
|
import requests # Add missing import
|
||||||
from dateutil.parser import isoparse
|
from dateutil.parser import isoparse
|
||||||
@ -95,6 +95,8 @@ def main():
|
|||||||
data = get_data()
|
data = get_data()
|
||||||
|
|
||||||
res = []
|
res = []
|
||||||
|
today_date = datetime.now(timezone.utc).strftime('%Y-%m-%d')
|
||||||
|
|
||||||
for item in data:
|
for item in data:
|
||||||
symbol = item['ticker']
|
symbol = item['ticker']
|
||||||
if symbol.lower() == 'brk.b':
|
if symbol.lower() == 'brk.b':
|
||||||
@ -102,7 +104,8 @@ def main():
|
|||||||
if symbol.lower() == 'brk.a':
|
if symbol.lower() == 'brk.a':
|
||||||
item['ticker'] = 'BRK-A'
|
item['ticker'] = 'BRK-A'
|
||||||
try:
|
try:
|
||||||
if item['tracking_id'] not in existing_keys:
|
executed_date = item['executed_at'][:10] # Extract date in YYYY-MM-DD format
|
||||||
|
if item['tracking_id'] not in existing_keys and executed_date == today_date:
|
||||||
sector = stock_screener_data_dict.get(symbol, {}).get('sector', "")
|
sector = stock_screener_data_dict.get(symbol, {}).get('sector', "")
|
||||||
volume = float(item['volume'])
|
volume = float(item['volume'])
|
||||||
size = float(item['size'])
|
size = float(item['size'])
|
||||||
@ -127,9 +130,12 @@ def main():
|
|||||||
|
|
||||||
# Combine new data with existing data
|
# Combine new data with existing data
|
||||||
combined_data = existing_data + res
|
combined_data = existing_data + res
|
||||||
|
if combined_data:
|
||||||
# Save the combined data to a daily file
|
# Save the combined data to a daily file
|
||||||
save_to_daily_file(combined_data, historical_directory)
|
save_to_daily_file(combined_data, historical_directory)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user