Back to Community
How does Quantopian calculate portfolio turnover rate?

I have been very curious about how the new improved backtest model calculates the specific (rolling) turnover rate, as well as how a strategy's overall turnover rate (a specific number) on the old version 'Analyze Backtest' is calculated.

In my understanding, there are two ways to calculate daily turnover rate:

One is ticker-based, which means comparing the difference between today and yesterday's portfolio positions based on change of tickers (which can be tricky sometimes especially when only position's direction is changed, let's say, yesterday we have AAPL's long position and today we have AAPL's short position, i.e. ticker doesn't change but extra turnover definitely increased.

And another way to calculate turnover rate is value-based, meaning based on today's value bought/sold divided by previous day's portfolio value. Going back to the example above, if we have $1 mil as initial portfolio capital to trade, yesterday we started by entering $1 mil of AAPL's long positions, today we flipped to $ 1mil of AAPL's short positions. In this case, the turnover rate of today/yesterday I assume is supposed to be 2 mil / 1 mil = 200% (correct me if I am wrong).

So which method (or is it another method I haven't thought of) is what Quantopian has been using for the improved backtest model as well as for the old version of backtest results? Appreciate for the answers in advance!

1 response

Writing context.portfolio.turnover would help in contest entry development.

Flying a jet named Backtest without instruments in fog where we don't find out how we did until the flight is over each time.
If context.portfolio.turnover were creeping up, could auto-adjust while in the air.