passing a custom data bundle to TradingAlgorithm object in Ipython Notebook

365 visninger
Gå til det første ulæste opslag

Justin Lent

ulæst,
22. aug. 2016, 13.08.0322.08.2016
til Zipline Python Opensource Backtester
Hey Zipline crew,

I have a custom data bundle but cannot figure out how to tell my TradingAlgorithm object to use it when calling TradingAlgorithm.run() in my ipython notebook.  The work around I've used up until now is something like this:

zipline.run_algorithm(initialize=initialize, 
                            handle_data=handle_data, 
                            capital_base=1e6, 
                            bundle='my_custom_bundle' )

Obviously this works, but it would be nice to learn how to use TradingAlgorithm objects just for cleaner coding, etc, but in the short-term it's mostly to be able to use the parameter instant_fill=True which from what I can tell is only available as a parameter to TradingAlgorithm()

Any thoughts?



Joe Jevnik

ulæst,
22. aug. 2016, 13.25.1322.08.2016
til Justin Lent, Zipline Python Opensource Backtester
Hey Justin,

We are trying to move away from having users create trading algorithms directly because that made the API harder to change. I think the right fix here would be to add that argument to `run_algorithm`. To unblock you, you could reproduce what `run_algorithm` does with the bundle to unpack the needed data and manually pass that to the `TradingAlgorithm`:  https://github.com/quantopian/zipline/blob/master/zipline/utils/run_algo.py#L115

--
You received this message because you are subscribed to the Google Groups "Zipline Python Opensource Backtester" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Lent

ulæst,
22. aug. 2016, 15.15.3122.08.2016
til Zipline Python Opensource Backtester, justi...@gmail.com
Thanks Joe, that's a helpful explanation.  Rather than unpack the data and use TradingAlgorithm, I'll go the route of attempting to add the instant_fill=True argument to run_algorithm() since it sounds like that's a better long term solution.
-Justin
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+u...@googlegroups.com.

Amit Patil

ulæst,
21. sep. 2016, 22.27.3521.09.2016
til Zipline Python Opensource Backtester
Hello Joe and Justin,
I have csv files for each stock with ohlcv + some other custom columns. I can import few stocks and run algorithm. But if I try get say all stocks in s&p 500, it gives me memory error. so thought I need to create custom data source. I want to follow directions on zip line github wicki. But there is no data_source to "from zipline.sources.data_source import DataSource. What is current proper way to get data from 500 different files and run some algorithm or to convert these files to a data bundle.
I appreciate any help. Thank you.
Svar alle
Svar til forfatter
Videresend
0 nye opslag