Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Fetcher Newbie Question

Hello!
A few questions:

1) Would it be correct to assume that "fetch_csv" is not a part of the Zipline backtester?

2) If it is not, why?

3) If it is not, are there any suggested workarounds to duplicate it's functionality, so as to facilitate the transition back to Quantopian?

Thanks,
Andy

2 responses

Hi Andy,

Thanks for the questions. You are correct that fetcher is not (yet) part of Zipline. We are weighing the decision to add fetcher to zipline and open source it. The motivation to open fetcher is to make zipline/Quantopian transitions more seamless, just as you suggest. We've already started the process of putting scripting support from Quantopian into Zipline, which is a big step in the right direction.

thanks,
fawce

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hello John,
Thank you for the reply. Eddie also replied as follows (my on going problem further outlined below):

Hi, Andy:
We have been putting some effort to making the Quantopian script syntax work in Zipline. (The first step was just added to master today https://github.com/quantopian/zipline/commit/b69590a2f709c70dd14d817d1a6bee0b1bb0e7b0).
For minute data, unfortunately a good public source of minute data is something that is currently missing from the ecosystem.
Yahoo! et al. only provide daily data.
If you have access to minute data, you should be able to use the data if you:
- Create a DataFrame source using your data set
- set the data_frequency of your Zipline algorithm to 'minute'
Hope that helps!
- Eddie

Following Eddie's suggestion:
1) created a minute intraday file named "AAPL-2014-01-09 14-30-00+00-00-2014-01-10 21-00-00+00-00.csv"
2) located in ".....zipline\cache\"
3) containing as follows:
Date,Open,High,Low,Close,Volume,Adj Close
2014-01-08 00:00:00+0000,546.8,546.86,535.35,536.53,1000000,536.52
2014-01-09 14:30:00+0000,546.8,546.86,535.35,536.53,1000100,536.52
2014-01-09 14:31:00+0000,546.8,546.86,535.35,536.53,1000200,536.52
2014-01-09 14:32:00+0000,546.8,546.86,535.35,536.53,1000300,536.52
2014-01-09 14:33:00+0000,546.8,546.86,535.35,536.53,1000400,536.52
..... 2014-01-09 20:55:00+0000,546.8,546.86,535.35,536.53,1038600,536.52
2014-01-09 20:56:00+0000,546.8,546.86,535.35,536.53,1038700,536.52
2014-01-09 20:57:00+0000,546.8,546.86,535.35,536.53,1038800,536.52
2014-01-09 20:58:00+0000,546.8,546.86,535.35,536.53,1038900,536.52
2014-01-09 20:59:00+0000,546.8,546.86,535.35,536.53,1039000,536.52
2014-01-09 21:00:00+0000,546.8,546.86,535.35,536.53,1039000,536.52
2014-01-10 00:00:00+0000,539.83,540.8,531.11,532.95,1000000,532.94
2014-01-10 14:30:00+0000,539.83,540.8,531.11,532.95,1000100,532.94
2014-01-10 14:31:00+0000,539.83,540.8,531.11,532.95,1000200,532.94
2014-01-10 14:32:00+0000,539.83,540.8,531.11,532.95,1000300,532.94
2014-01-10 14:33:00+0000,539.83,540.8,531.11,532.95,1000400,532.94
2014-01-10 14:34:00+0000,539.83,540.8,531.11,532.95,1000500,532.94
2014-01-10 14:35:00+0000,539.83,540.8,531.11,532.95,1000600,532.94
.... 2014-01-10 20:55:00+0000,539.83,540.8,531.11,532.95,1038600,532.94
2014-01-10 20:56:00+0000,539.83,540.8,531.11,532.95,1038700,532.94
2014-01-10 20:57:00+0000,539.83,540.8,531.11,532.95,1038800,532.94
2014-01-10 20:58:00+0000,539.83,540.8,531.11,532.95,1038900,532.94
2014-01-10 20:59:00+0000,539.83,540.8,531.11,532.95,1039000,532.94
2014-01-10 21:00:00+0000,539.83,540.8,531.11,532.95,1039100,532.94

4) Received Error as follows (line #'s a little different due to included print statements):

Traceback (most recent call last):
File "C:\afc_working\0_zipline\zipline-master\zipline\examples\buyapple_minute.py", line 57, in
results = simple_algo.run(data)
File "C:\Python27\lib\site-packages\zipline-0.6.0-py2.7.egg\zipline\algorithm.py", line 333, in run
for perf in self.gen:
File "C:\Python27\lib\site-packages\zipline-0.6.0-py2.7.egg\zipline\gens\tradesimulation.py", line 156, in transform
self.process_event(event)
File "C:\Python27\lib\site-packages\zipline-0.6.0-py2.7.egg\zipline\gens\tradesimulation.py", line 96, in process_event
self.algo.perf_tracker.process_event(event)
File "C:\Python27\lib\site-packages\zipline-0.6.0-py2.7.egg\zipline\finance\performance\tracker.py", line 279, in process_event
self.all_benchmark_returns[midnight] = event.returns
File "C:\Python27\lib\site-packages\pandas\core\series.py", line 845, in setitem
raise KeyError('%s not in this series!' % str(key))
KeyError: '2014-01-09 00:00:00+00:00 not in this series!'

I have been researching this all the down into Pandas.tseries.index.DatetimeIndex, and still no additional insight.

Please HELP! :)

Thanks,
Andy