I'm trying to figure out why running the same code offline creates different returns vs online.
In booth cases 6 trades get executed. Online ends with 12.886% and offline with 11.264% Compounding Annual Return.
For offline I'm using daily spy ticker data which were included in the github project. The online version uses daily spy ticker data from QuantConnect. Things tried so far:
- Added DataNormalizationMode.Raw but it didn't help.
- Added Debug(Time + " " + data["SPY"]); to OnData when doing trades to see if trades or ticker data are different which they aren't by much. Just small differences with volume and rounding offsets but not enough to create 1% difference from 6 trades.
Online: O: 267.86 H: 268.81 L: 267.4 C: 268.77 V: 60549562
Offline: O: 267.85 H: 268.81 L: 267.4 C: 268.79 V: 59232691 - All 6 trading dates match for offline & online.
- Did check the orders tab but only know how to do that online. It shows the fill is done next day as it's daily data but assuming they behave the same it shouldn't matter, just can't confirm.
Online:
2018-01-03 00:00:00 SPY Buy Market On Open Fill: $268.99 USD
expanded:
2018-01-03 00:00:00 SPY - Submitted
2018-01-04 00:00:00 SPY - Fill: $268.99 USD - I checked to make sure the booth data include the timespan used with the test which it does.
Not sure why there is a difference if they run with close to the same data according debug output on trade call.
Questions:
How does one get the actual order log in the offline version?
Any other possible reasons why the offline version creates different return results?
Derek Melchin
Hi Mike,
The attached notebook shows that the online and offline data is slightly different. We've created a GitHub Issue to have this resolved. Subscribe to our progress here.
To gather the trade log, we can use the API.
backtest = api.ReadBacktest(<projectID>, <backtestID>) trades = backtest.TotalPerformance.ClosedTrades for trade in trades: print(f"{trade.Symbol} {trade.Quantity}")
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mike999
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!