diff options
author | loit <michael.foiani@gmail.com> | 2025-07-29 00:59:43 -0400 |
---|---|---|
committer | loit <michael.foiani@gmail.com> | 2025-07-29 00:59:43 -0400 |
commit | 0372b76ee22ea4421b70d6f7f8c2b29b2c7ac9dc (patch) | |
tree | 42dbf007e93e366550ea339fc9737d7718d67e46 /api.py | |
parent | 00d89073d7802983b11f9e5931f932444806defd (diff) |
add basic features to indicte if parameters are bad
Diffstat (limited to 'api.py')
-rw-r--r-- | api.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -28,6 +28,10 @@ def fetch_chart_data(ticker, period='1y', interval='1d'): data_obj = r.json() # get the specific data we want + if 'timestamp' not in data_obj['chart']['result'][0]: + last_data = pull_last_from_file() + last_data['error'] = True + return last_data timestamps = data_obj['chart']['result'][0]['timestamp'] close_prices = data_obj['chart']['result'][0]['indicators']['quote'][0]['close'] @@ -43,7 +47,6 @@ def fetch_chart_data(ticker, period='1y', interval='1d'): name = data_obj['chart']['result'][0]['meta']['longName'] data = {'timestamps': timestamps, 'prices': close_prices, 'name': name, 'error': False} - update_last_file(data) # save data to file in case necessary return data |