Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Exercise in TA - puzzled by differing results when changing execution schedule?

HI QT participants - I'm doing SMA and MACD more or less on a liquid beta neutral-ish universe. Nothing special, only looking at previous days trading; not doing any analysis on the current day ( only look at days, no day-trading). I get drastically different results when comparing 2 test cases: rebalance... market_open() and rebalance... market_open(minutes=15). I could expect marginal differences do to market price at execution times, but I'm seeing completely different holdings over time. Why? please refer to tear-sheets below. Keep in mind this isn't within contest constraints (it's long only and doesn't implement optimize api for starters) but any criticisms regarding tear-sheet performance would be appreciated as well. Thanks, Merry Christmas and happy holidays!

7 responses

open market example

15 min after open example

Look at your "total holdings" graphs towards the end of the tear sheet. At no point in time do you ever hold more than 10 stocks total at a time. Plus there are numerous periods where your entire portfolio goes down to 0 total holdings. How many stocks are in the universe you defined?

Thanks Evan, I'm aware of that. I've limited the # of positions that I hold at once; so this is not an artifact of Universe pipeline selection (which is top 1000 marketcap and top 100 average dollar volume to answer your question)...are you hinting that this could be a reason holdings would be different when staggering scheduler 15 minutes??

Allow me to ask another way. Would you expect an algo that trades at most 1 time a day on previous day's TA, to have different holding when modulating scheduler by 15 minutes?

I think yes because are holding less than 1% of total stocks in your universe. My guess is that you are bottle necking the amount of stocks that are in your portfolio too hard. Ff you increase your stock limit to 200, you will likely see a smaller fluctuation that is proportional to the current limit you have right now.

You should check your SMA and MACD pipeline data outputs and see how close the top 10 values are if you are intent on keeping a limited number of positions. You might find that there are more than 10 values that are very very close together so that a 15 minute difference would impact both your SMA and MACD values enough to reshuffle these stocks around.

For example, ff your top 100 values are within 1.01 - 1.02, a less than 1% difference in price (caused by the 15 minute delay) would shift values around. This might be happening even if you have already taken measures to normalize your data given how large your universe is in proportion to max holdings.

Yes, I overlooked that! It must be data.current([stock], 'price') 15 minute difference changing my talib results in rebalance. Thanks Evan