Hello, I am getting a lot of errors in logs like this:
Warning: To meet brokerage precision requirements, order LimitPrice was rounded to 2786.00 from 2785.89
Reason is because price is not rounded to tick size for the contract I am trading. Is there a way in QuantConnect to get the tick size, so I could properly round my limit price and not flood the logs with these errors?
I know that I can download symbols database from LEAN source and get it from there, but this seem a bit of an overkill to me. Maybe there is a built-in method for that, but I couldn't find it…
Also, same question I have for a contract multiplier.
Mia Alissi
Yes, you can get the tick size and contract multiplier in QuantConnect. They are part of the
SymbolProperties
object. Here is how you can access them:In this code, replace
"YourSymbol"
with the symbol you are trading. Thetick_size
variable will hold the minimum price variation (tick size) for the security, and thecontract_multiplier
variable will hold the contract multiplier for the security.You can then use these values to round your limit price to the nearest tick size and adjust for the contract multiplier.
Source: QuantConnect Documentation
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.
Yuri Lopukhov
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!