New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error retrieving H15 interest rates - ValueError: 'Time Period' is not in list #1817
Comments
I am having the same problem as you, I didn't change anything in the zipline code. |
Same issue here as well |
same here |
+1 |
* Added specific `from` and `to` parameters to FED request * Fixes ValueError: 'Time Period' is not in list * Fixes quantopian#1817 (quantopian/zipline) * See quantopian#1817
Me too… perhaps the source data URL modified it’s format?
-Justin
…On Fri, May 26, 2017 at 6:34 AM, Peter Harrington ***@***.***> wrote:
+1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1817 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGPO3lDYPyKF5g17Wxr3Y7s4x_fQK7d8ks5r9tT_gaJpZM4NnCoj>
.
|
Hi @freddiev4, thx a lot, this solves my problems. |
Im having the same problems but in the treasury script its already set to "label=include", what else can I do to resolve this issue? |
Hello, I'm having the same issue. While I run a backtest , I got the value error 'Time Period' is not in list. The code work before, but now have that trouble. Any clue to solve this? |
I just got this error and the treasury data did not get updated today. I copied the data from yesterday in the file ~/.zipline/data/treasury_curves.csv and it started working. (I made t-1's data exactly the same as t-2's) This isn't the best solution, but it isn't the worst thing in the world. Need to find the root cause. |
Thanks for the response pbharrin. Yes, it was surprising because few days ago I can run the strategy and have the desire output. But today, I got that error all times. I will try with your advice!! |
Just for curious: why the source of zipline(treasury function) has that data to retrieve(the h15 interest rate), in order to run the zipline strategy? |
The calculation of Sharpe ratio is (Your mean return - risk free rate)/std. So they use the treasury data to get the risk free rate. The risk free rate has been effectively 0 for so long that many calculations leave out the risk free rate. Many of the Zipline problems are caused by this and the SPY data which is only used to show a comparison of your algorithm to a benchmark, however SPY may not be the right benchmark. What if you are trading Japanese stocks, or small caps? If you are trading a long/short strategy than the SPY isn't a good benchmark as assumes long only. |
Hello pbharrin, thanks for the explanation. I suspect now, that I have problems with the SPY data. That is my sense after reading the trace of the error that I'm receiving now. The output error is: "IndexError: index 0 is out of bounds for axis 0 with size 0". It seems that the data of SPY is not load properly. The trace of the error is : IndexError Traceback (most recent call last) c:\users\nicolas\lib\site-packages\zipline\utils\run_algo.py in run_algorithm(start, end, initialize, capital_base, handle_data, before_trading_start, analyze, data_frequency, data, bundle, bundle_timestamp, trading_calendar, metrics_set, default_extension, extensions, strict_extensions, environ) c:\users\nicolas\lib\site-packages\zipline\utils\run_algo.py in _run(handle_data, initialize, before_trading_start, analyze, algofile, algotext, defines, data_frequency, capital_base, data, bundle, bundle_timestamp, start, end, output, trading_calendar, print_algo, metrics_set, local_namespace, environ) c:\users\nicolas\lib\site-packages\zipline\finance\trading.py in init(self, load, bm_symbol, exchange_tz, trading_calendar, asset_db_path, future_chain_predicates, environ) c:\users\nicolas\lib\site-packages\zipline\data\loader.py in load_market_data(trading_day, trading_days, bm_symbol, environ) c:\users\nicolas\lib\site-packages\zipline\data\loader.py in ensure_treasury_data(symbol, first_date, last_date, now, environ) c:\users\nicolas\lib\site-packages\zipline\data\loader.py in _load_cached_data(filename, first_date, last_date, now, resource_name, environ) c:\users\nicolas\lib\site-packages\zipline\data\loader.py in has_data_for_dates(series_or_df, first_date, last_date) c:\users\nicolas\lib\site-packages\pandas\tseries\base.py in getitem(self, key) IndexError: index 0 is out of bounds for axis 0 with size 0 |
Any help about this? Thanks! |
IT still looks like it is an issue with the Treasury data as you have this line Do you really need the treasury or SPY data? There are quick hacks that you can do to get rid of these errors. |
Also I heard that the latest Zipline build no longer uses treasury data. Are you using the latest build? |
My version of Zipline is 1.2 I think. Im not need the treasury_data, how I can get rid of this? |
Looks like fed changed request params and csv file again. def get_treasury_data(start_date, end_date): works with above request params as usual. |
Thanks kanatm287. Seems to work with me ! |
Thanks kanatm287 you are a hero to a generation. It looks like the param skiprows was changed from 5 to 1, did I miss anything else? |
@pbharrin label has been changed to omit again ? Just changed skiprows to 1 and label to omit, and it is still not working for me. Edit: actually, I just changed skiprows = 1 and kept label = include and it is still not working. |
Currently I'm getting this error, I think because the website isn't working properly right now. Shouldn't we be also catching the ValueError in the get_treasure_data() function in treasuries.py? The URL seems to be |
Same issue here... Does this happen periodically? |
Actually, this seems to be happening on another machine I have with custom CSV data where it was working before. I guess hopefully the fed site is fixed tomorrow, but it would be good to have a better solution for handling this problem in the future. Backtesting seems to work for the quandl dataset, but not for a custom csv dataset I have on a computer where zipline was installed and I ran the last backtest last october sometime. |
That's exactly what is going on for me too. I'm as well using my custom CSV file for the data bundle, and it worked just fine until yesterday. I hope this isn't a long term issue. And by the way, anybody knows if it's necessary to download data from the fed site? I'm using a dataset totally irrelevant to the US fed, so maybe I can somehow block the transaction with the site? I'm not so sure what kind of data the zipline code was trying to import from fed, since I haven't looked into it previously, but I'm wondering if there are any get arounds if possible. |
I have just this morning started getting this error also - not sure what started causing it since one minute it worked and the next it didn't. I'm using a custom data bundle and have no need to actually use the treasury data. Going to try and hack it out for now but having this fail more gracefully would be good. |
I am facing same issue. 'Time Period' is not in list |
Just a reminder the treasury data gives us the "risk free rate" which is used in the Sharpe calculation. |
Fix for the future times when the Fed's site is down: https://github.com/nateGeorge/treasury_data_backup |
Dear Zipline Maintainers,
Environment
Error retrieving H15 interest rates - ValueError: 'Time Period' is not in list
TradingEnvironment
, I get aValueError
. The code worked until yesterday and stopped some hours ago. I'm not sure whether on Th or Fr (CEST).What steps have you taken to resolve this already?
https://github.com/quantopian/zipline/blob/master/zipline/data/treasuries.py#L61
The request to the hard encoded link (to obtain the H15 interest rates) fails: "Unable to find the output file. Please contact administrator for assistance."
http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=bf17364827e38702b42a58cf8eaa3f78&lastObs=&from=&to=&filetype=csv&label=omit&layout=seriescolumn&type=package
I played around with the Data Download Program and compared the parameters of the generated request strings.
https://www.federalreserve.gov/releases/h15/
It seems as if
label=omit
is not accepted anymore. If I omit thelabel
parameter or set it toinclude
, it seems to work.http://www.federalreserve.gov/datadownload/Output.aspx?rel=H15&series=bf17364827e38702b42a58cf8eaa3f78&lastObs=&from=&to=&filetype=csv&label=include&layout=seriescolumn&type=package
I am curious if I am the only one having this problem. If not, how can we fix this problem permanently?
Sincerely,
Rudi
The text was updated successfully, but these errors were encountered: