Why is my filter not working?
I have an extremely lengthy filter running that produces the filtered stocks and dates to a CSV.
I usually run a handful of tickers first to work out the bugs and then run around 3000 afterwards.
The trouble is that when I run the 3000 names some of the data points that were being produced in the smaller samples are not being produced in the large sample.
I am currently stripping away bits of code and running it to find out where exactly the bug might be but since it has to run through 3000 stocks, the process is taking a while.
I noticed this when my small sample was producing 9 different dates for NFLX over 3 years and then when I run all 3000 stocks I only get 2 dates for NFLX.
I would post the code, but its around 600 lines long and there are no error messages. I am using daily data from morning star as my data feed.
I put a print function in my next method and this is what was produced. On the left hand side are prints from when the sample of stocks is around 3000 and on the right are the prints when the sample of stocks are just two. As you can see something when I run 3000 stocks is causing a great number of days to be skipped in the next method.
Skipping Normal NFLX 2015-01-15 NFLX 2015-01-02 NFLX 2015-01-16 NFLX 2015-01-05 NFLX 2015-03-13 NFLX 2015-01-06 NFLX 2015-03-16 NFLX 2015-01-07 NFLX 2015-03-17 NFLX 2015-01-08 NFLX 2015-03-18 NFLX 2015-01-09 NFLX 2015-03-19 NFLX 2015-01-12 NFLX 2015-09-10 NFLX 2015-01-13 NFLX 2015-09-11 NFLX 2015-01-14 NFLX 2015-09-14 NFLX 2015-01-15 NFLX 2016-01-14 NFLX 2015-01-16 NFLX 2016-01-15 NFLX 2015-01-19 NFLX 2016-01-18 NFLX 2015-01-20 NFLX 2016-01-19 NFLX 2015-01-21
Anyone ever have an issue like this before?
@backtrader it ended up being that I was using the return function the wrong way in my logic. It seems that saying:
if x == y: return if x > y+5: "some other logic"
makes the script malfunction