@@ -387,8 +387,10 @@ def analyze_timeseries(cik, local_stock, global_stock, filings):
387387 if not timeseries_global and ticker != "N/A" :
388388 update_timeseries = True
389389 try :
390- timeseries_response = api .ticker_request ("TIME_SERIES_MONTHLY" , ticker , cik )
391- timeseries_info = timeseries_response .get ("Monthly Time Series" )
390+ timeseries_response = api .ticker_request (
391+ "TIME_SERIES_MONTHLY_ADJUSTED" , ticker , cik
392+ )
393+ timeseries_info = timeseries_response .get ("Monthly Adjusted Time Series" )
392394 timeseries_info = (
393395 timeseries_response if not timeseries_info else timeseries_info
394396 )
@@ -403,14 +405,17 @@ def analyze_timeseries(cik, local_stock, global_stock, filings):
403405 price = {
404406 "time" : date ,
405407 "open" : float (info ["1. open" ]),
406- "close" : float (info ["4. close" ]),
408+ "close" : float (info ["5. adjusted close" ]),
409+ "raw" : float (info ["4. close" ]),
407410 "high" : float (info ["2. high" ]),
408411 "low" : float (info ["3. low" ]),
409- "volume" : float (info ["5. volume" ]),
412+ "volume" : float (info ["6. volume" ]),
413+ "dividend" : float (info ["7. dividend amount" ]),
410414 }
411415 timeseries_global .append (price )
412416
413417 except Exception as e :
418+ errors .report_error (f"{ cusip } ({ cik } )" , e )
414419 database .add_log (cik , f"Failed to Find Time Data \n { e } " , cusip )
415420 else :
416421 update_timeseries = False
0 commit comments