Closed rudolf-bauer closed 7 years ago
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
Me too… perhaps the source data URL modified it’s format? -Justin
On Fri, May 26, 2017 at 6:34 AM, Peter Harrington notifications@github.com wrote:
+1
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/quantopian/zipline/issues/1817#issuecomment-304283841, or mute the thread https://github.com/notifications/unsubscribe-auth/AGPO3lDYPyKF5g17Wxr3Y7s4x_fQK7d8ks5r9tT_gaJpZM4NnCoj .
I've just merged #1818 and also ran get_treasury_data()
in master and didn't have any issues. If nobody else is seeing this I'll go ahead and close this issue 😃 (feel free to re-open if you're still seeing problems)
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!! Nicolás
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)
Any help about this?
Thanks!
IT still looks like it is an issue with the Treasury data as you have this line c:\users\nicolas\lib\site-packages\zipline\data\loader.py in ensure_treasury_data(symbol, first_date, last_date, now, environ)
in the traceback.
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. Is an issue with the treasury data yes, as the treasury_curves.csv file is empty, after I run the algorithm.
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): return pd.read_csv( "https://www.federalreserve.gov/datadownload/Output.aspx" "?rel=H15" "&series=bf17364827e38702b42a58cf8eaa3f78" "&lastObs=" "&from=" # An unbounded query is ~2x faster than specifying dates. "&to=" "&filetype=csv" "&label=omit" "&layout=seriescolumn" "&type=package", skiprows=1, # First row are useless headers. parse_dates=['Time Period'], na_values=['ND'], # Presumably this stands for "No Data". index_col=0, ).loc[ start_date:end_date ].dropna( how='all' ).rename( columns=parse_treasury_csv_column ).tz_localize('UTC') * 0.01 # Convert from 2.57% to 0.0257.
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 ? &label=omit"
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. Don't know what to do else. Any help would be greatly appreciated
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? Maybe the data should be cached elsewhere? Or a copy updated with zipline with each release? Don't be able to seem to run zipline backtesting at all if we can't download this file at least once.
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?
If I run the corresponding code manually, I get the same error. 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=packageI am curious if I am the only one having this problem. If not, how can we fix this problem permanently?
Sincerely,
Rudi