quantopian / zipline

Zipline, a Pythonic Algorithmic Trading Library

Home Page:https://www.zipline.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zipline behavior with many stocks

WaldemarGrauberger opened this issue · comments

Dear Zipline Maintainers,

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

  • Operating System: Windows 10, Verision 20H2
  • Python Version: 3.6
  • How did you install Zipline: conda
  • Zipline version 1.4

Now that you know a little about me, let me tell you about the issue I am
having:

Description of Issue

Ingested my own price info of about 2000 stocks from 2000-01-01 to 2020-12-31. I have implemented a simple Donchian channel algorithm together with a momentum score from "Trading Evolved" whichs is used to pick the stocks to trade.
I tested the algorithm with different time windows 2000-04-01 through 2020-12-31 and 2000-04-01 through 2015-12-31. All other input was the same (I duplicated the script and simply changed the ending date).
The trading system shows completely different results for the two time frames, although I expecte them to be identical up to 2015-12-31. Already the first trading day shows different stocks to trade (momentum score sorting). Comparison of different algorithms is of course not possible this way.

Is there an issue with the number of stocks Zipline can handle? What is the maximum number of stocks I can savely use so that I can be sure that results can be comparable?

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

Reproduction Steps

  1. Ingest stock date for about 2000 stocks
  2. implement different time frames with the same beginning but different endings

...

What steps have you taken to resolve this already?

I have tried to understand the zipline handle_data function but could not really get a grasp of it.

Anything else?

...

Sincerely,
Waldemar

Hi Waldemar,

I've used Zipline with around 30,000 stocks on daily data back to 1970 - the ingest (on a SSD) takes around 15 minutes and I didn't run into any RAM-related issues (16GB RAM here).

You probably need to debug your system and figure out the day that the results start to diverge then track further into the code to figure out why. Perhaps you have too many orders (for your available capital) and they are just being filled in a different order from a particular day onwards...

Cheers,
Richard.