mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-01 12:35:15 +08:00
MAINT: Protect loader against Series saved with no tz.
Checking for tz.UTC is not sufficient, since it is possible for the index.tz value to be None.
This commit is contained in:
+10
-2
@@ -162,11 +162,19 @@ Fetching data from Yahoo Finance.
|
||||
# we have data,then we need to update
|
||||
if len(trading_days) - last_bm_date_offset > 1:
|
||||
benchmark_returns = update_benchmarks(bm_symbol, last_bm_date)
|
||||
if benchmark_returns.index.tz.zone != 'UTC':
|
||||
if (
|
||||
benchmark_returns.index.tz is None
|
||||
or
|
||||
benchmark_returns.index.zone != 'UTC'
|
||||
):
|
||||
benchmark_returns = benchmark_returns.tz_localize('UTC')
|
||||
else:
|
||||
benchmark_returns = saved_benchmarks
|
||||
if benchmark_returns.index.tz.zone != 'UTC':
|
||||
if (
|
||||
benchmark_returns.index.tz is None
|
||||
or
|
||||
benchmark_returns.index.zone != 'UTC'
|
||||
):
|
||||
benchmark_returns = benchmark_returns.tz_localize('UTC')
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user