Directly passing pandas data into zipline

260 Views Asked by At

I am currently looking for a way to directly pass in a pandas dataframe or csv file to zipline for simple backtesting WITHOUT having to ingest a data bundle. The reason is that I am planning to generate new data outside of the existing bundle during a backtest and it seems very inefficient to ingest a new bundle for every handle_data call.

I have been looking for this everywhere, including the source codes of zipline. I found that an older version of zipline has a 'data' param in the run_algo function call where you could pass in a df directly, but I can't find that old version at the moment. Is anyone attempting the same thing? Is there any way other than ingesting data bundles in the command line everytime?

1

There are 1 best solutions below

0
Shayan Shahrestani On

I'm using zipline 1.3.0 and it actually does have a data param. This comment is from run_algo.py file of zipline:

data : pd.DataFrame, pd.Panel, or DataPortal, optional
    The ohlcv data to run the backtest with.
    This argument is mutually exclusive with:
    ``bundle``
    ``bundle_timestamp``

Hope it helped