quantopian / zipline

Zipline, a Pythonic Algorithmic Trading Library
https://www.zipline.io
Apache License 2.0
17.76k stars 4.74k forks source link

trouble after ingesting custom-csvdir-bundle #2592

Open speculati0n opened 4 years ago

speculati0n commented 4 years ago

Dear Zipline Maintainers,

Before I tell you about my issue, let me describe my environment:

Python 3.5 within Anaconda Navigator 1.9.7 All scripts are done within Spyder 3.3.1 OS: Windows 10

Now that you know a little about me, let me tell you about the issue I am having: My issue is that once I ingest a custom-csvdir-bundle and then implement it within my backtest I am getting all nan values for results.

start = datetime(2015, 1, 2, 8, 15, 12, 0, pytz.UTC) end = datetime(2019, 11, 29, 8, 15, 12, 0, pytz.UTC) perf = zipline.run_algorithm( start=start, end=end, initialize=initialize, analyze=analyze, capital_base=intial_portfolio, data_frequency = 'daily', bundle='custom-csvdir-bundle' )

results in this:

image

Here is how you can reproduce this issue on your machine:

Reproduction Steps

Step 1- using the extension.py file

After successfully ingesting a custom-csvdir-bundle using the following code (following the documentation here https://www.zipline.io/bundles.html): ` import pandas as pd

from zipline.data.bundles import register from zipline.data.bundles.csvdir import csvdir_equities

start_session = pd.Timestamp('2014-1-31', tz='utc') end_session = pd.Timestamp('2019-11-29', tz='utc')

register( 'custom-csvdir-bundle', csvdir_equities( ['daily'], r'C:\Users\Admin\Anaconda3\envs\zip35\Lib\site-packages\zipline\data\stocks', ), calendar_name='NYSE', # US equities start_session=start_session, end_session=end_session )`

here is a picture of the path where the data is stored: image

here is a picture of one of the csv files formatted properly as shown in the zipline documentation(date,open,high,low,close,volume,dividend,split):

image

Step 2- Running the "zipline ingest -b custom-csvdir-bundle" command in the terminal.

image image

  1. When I check the custom-csvdir-bundle folder to make sure the data has ingested succesfully there are only two BLP files (no clue what a BLP file is but assuming is where the issue is happening as there are only two BLP files in the path after ingesting when there should be the same number of files as number of stocks I ingested):

image

  1. ...

What steps have you taken to resolve this already?

I have tried to ingest via the Quandl WIKI database and was able to successfully do that and just as I mentioned above there were many BLP files created after ingestion. image

...

Anything else?

Any help would be so greatly appreciated. I have overcome many errors getting to this point but I am officially stuck. ...

Sincerely, Barry

colinalexander commented 4 years ago

Have you tried sorting your csv data files in ascending order on date? Not sure if it will make a difference, but that is how they are sorted in the documentation.

speculati0n commented 4 years ago

Have you tried sorting your csv data files in ascending order on date? Not sure if it will make a difference, but that is how they are sorted in the documentation.

I tried this but still same issue. thanks for trying to help.