Hi everyone. I'm currently using custom forex data (with QuoteBar data type) to backtest my algorithm but until recently something weird started happening; everytime an order was filled a huge sharp spike appeared in the equity curve. After closer inspection I discovered that the hits in the equity were almost equal in size to the holding costs of their associated order. Is this intended behaviour? is there a way to disable it? In case it's a bug, any ideas on how to fix it?
Normal behaviour:
Current behaviour:
Mia Alissi
Hi Santiago,
The sharp spikes in your equity curve could be due to the spread costs incorporated into your simulated trade fills. In QuantConnect,
QuoteBar
objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic. This is intended behavior and is designed to provide a more accurate representation of live trading conditions.If you're using custom forex data, it's important to ensure that the data is accurate and correctly formatted. If there are any errors or anomalies in the data, this could potentially cause unexpected results in your backtests.
If you believe there's a bug or issue with the platform, I recommend submitting a support ticket so the QuantConnect team can investigate. You can also submit a data issue if you believe there's a problem with the data you're using.
Here's an example of how to handle
QuoteBar
data in Python:And here's how to iterate through the
QuoteBars
dictionary:Sources:
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.
Santiago Villalobos
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!