mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-19 11:22:06 +08:00
BUG: Only localize benchmark index if it is naive.
Check for whether or not the index's timezone is UTC or not before attempting to localize, since an already localized index throws an error when tz_localize is called.
This commit is contained in:
@@ -162,10 +162,12 @@ 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)
|
||||
benchmark_returns = benchmark_returns.tz_localize('UTC')
|
||||
if benchmark_returns.index.tz.zone != 'UTC':
|
||||
benchmark_returns = benchmark_returns.tz_localize('UTC')
|
||||
else:
|
||||
benchmark_returns = saved_benchmarks
|
||||
benchmark_returns = benchmark_returns.tz_localize('UTC')
|
||||
if benchmark_returns.index.tz.zone != 'UTC':
|
||||
benchmark_returns = benchmark_returns.tz_localize('UTC')
|
||||
|
||||
try:
|
||||
fp_tr = get_datafile('treasury_curves.csv', "rb")
|
||||
|
||||
Reference in New Issue
Block a user