Skip to content

Commit 9ee1e7b

Browse files
committed
adjusted timeseries
1 parent 13a89cc commit 9ee1e7b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

backend/routers/lib/analysis.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

backend/routers/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ def initialize():
114114
database_count = database.companies_count()
115115
search_count = search.companies_stats().number_of_documents
116116

117-
cache.flush_all()
118-
119117
db_empty = True if database.companies_count() == 0 else False
120118
search_empty = True if search.companies_stats().number_of_documents <= 1 else False
121119
backup_path = "./static/backup"

0 commit comments

Comments
 (0)