bugfixing
This commit is contained in:
parent
282b4c530f
commit
7c18bb971e
@ -36,19 +36,27 @@ def safe_round(value):
|
||||
except (ValueError, TypeError):
|
||||
return value
|
||||
|
||||
# Function to convert and match timestamps
|
||||
def add_close_to_data(price_list, data):
|
||||
for entry in data:
|
||||
formatted_time = entry['time']
|
||||
# Match with price_list
|
||||
for price in price_list:
|
||||
if price['time'] == formatted_time:
|
||||
# Check if 'time' key exists; if not, try 'date'
|
||||
if 'time' in price:
|
||||
price_time = price['time']
|
||||
elif 'date' in price:
|
||||
price_time = price['date']
|
||||
else:
|
||||
continue # Skip if neither key is present
|
||||
|
||||
if price_time == formatted_time:
|
||||
entry['close'] = price['close']
|
||||
break # Match found, no need to continue searching
|
||||
return data
|
||||
|
||||
|
||||
|
||||
|
||||
async def get_stock_chart_data(ticker):
|
||||
start_date_1d, end_date_1d = GetStartEndDate().run()
|
||||
start_date = start_date_1d.strftime("%Y-%m-%d")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user