Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Performance difference between daily and minute backtest - Need help understanding why

The attached algorithm backtest is for a daily backtest run.
This uses a scheduled function to rebalance one a month at a specific offset from the beginning of the month and beginning of the trading day.

Since it is specifc as to when it trades.

I expected to see no difference between the daily and minutely backtests, since I trade at a specific offset to the month and offset to the trading start.

But I am seeing a difference. Can someone help me understand why?

The attached backtest is daily.
If you switch it to minutely the final return as well as profit/loss percentage logged at every rebalance is different.

6 responses

Here is the one with minutely backtest for the same exact period with no changes to the algo

Also
1. is the following affected by minte Vs daily
data[spy].price < data[spy].mavg(120)

I think 120 here is bars which could minute vs daily.

How can I write this to be daily independent of whether I run it daily or minutely.

  1. If I rebelance at a specific offset to the start of the month and offset to the start of the trading data. Does it enter the trades at the same time for daily and minutely backtests ?

Yes, I suspect that is the reason for most of the differences. You can use the history function to retrieve daily data, as you have in your calc_return, in your rebalance method as well.

However, "I expected to see no difference between the daily and minutely backtests, since I trade at a specific offset to the month and offset to the trading start." - is a dangerous assumption. Quoting Alisa from https://www.quantopian.com/posts/differences-between-minute-and-daily-backtests , "In backtests, orders are submitted in one bar and are filled in the next bar. In daily mode your algorithm receives data once per data at market close, so an order submitted on Monday at 4PM will get filled on Tuesday at 4PM. In minute mode, an order submitted at 10:00AM will get filled at 10:01AM, where there is much less movement in the price."
One is advised to use minute mode as it is a better simulation of live trading.

I have a thread about this issue, The issue is mainly due to the slippage model for example if the order is considered too big by the model it will split it into two bars which for one case will be 2 days and the other 2 mins. It limits the development since you need to develop using min backtesting which is too slow for real development.

But can't quantopian implement trade execution using minute bars even when back testing on daily bars?

That way trade execution will be consistent between the 2 options.
Why does trade execution "have" to be in daily bars as well

Daily mode placing orders at 3:59PM and attempt to fill at 4:00PM? Ok, can't imagine why not.

Lots of unfilled above, track_orders() might help.