bugfixing
This commit is contained in:
parent
535e609983
commit
a18a06e1fe
@ -1251,7 +1251,6 @@ async def get_stock_splits_calendar(con,symbols):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def get_economic_calendar():
|
async def get_economic_calendar():
|
||||||
ny_tz = pytz.timezone('America/New_York')
|
ny_tz = pytz.timezone('America/New_York')
|
||||||
today = datetime.now(ny_tz)
|
today = datetime.now(ny_tz)
|
||||||
@ -1283,15 +1282,17 @@ async def get_economic_calendar():
|
|||||||
impact = item.get('impact', None)
|
impact = item.get('impact', None)
|
||||||
importance = 3 if impact == 'High' else 2 if impact == 'Medium' else 1
|
importance = 3 if impact == 'High' else 2 if impact == 'Medium' else 1
|
||||||
|
|
||||||
# Convert to UTC
|
# Parse date as UTC (naive)
|
||||||
dt_ny = ny_tz.localize(datetime.strptime(item['date'], "%Y-%m-%d %H:%M:%S")) # Assume given time is NY time
|
dt_utc = datetime.strptime(item['date'], "%Y-%m-%d %H:%M:%S")
|
||||||
dt_utc = dt_ny.astimezone(pytz.UTC) # Convert to UTC
|
|
||||||
|
# Convert to New York time
|
||||||
|
dt_ny = dt_utc - timedelta(hours=5)
|
||||||
|
|
||||||
filtered_data.append({
|
filtered_data.append({
|
||||||
'countryCode': country_code,
|
'countryCode': country_code,
|
||||||
'country': country,
|
'country': country,
|
||||||
'time': dt_utc.strftime("%H:%M"), # UTC Time
|
'time': dt_ny.strftime("%H:%M"),
|
||||||
'date': dt_utc.strftime("%Y-%m-%d"), # UTC Date
|
'date': dt_ny.strftime("%Y-%m-%d"),
|
||||||
'prior': item['previous'],
|
'prior': item['previous'],
|
||||||
'consensus': item['estimate'],
|
'consensus': item['estimate'],
|
||||||
'actual': item['actual'],
|
'actual': item['actual'],
|
||||||
@ -1305,6 +1306,7 @@ async def get_economic_calendar():
|
|||||||
return filtered_data
|
return filtered_data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def replace_representative(office):
|
def replace_representative(office):
|
||||||
replacements = {
|
replacements = {
|
||||||
'Knott, Brad (Senator)': 'Brad Knott',
|
'Knott, Brad (Senator)': 'Brad Knott',
|
||||||
@ -1693,7 +1695,6 @@ async def save_json_files():
|
|||||||
ujson.dump(data, file)
|
ujson.dump(data, file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
con.close()
|
con.close()
|
||||||
etf_con.close()
|
etf_con.close()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user