While paper testing with QC today I recevied a few of these warnings:
Warning: To meet brokerage precision requirements, order LimitPrice was rounded to 30.17 from 30.1703
The price with 4 decimal points is because that I have been trying to simulate a model where my orders become market making by adding a percentage to the current close price.
I could round the prices in my own code to avoid this warning but was just wondering what the precision requirements are. Is it that it should have two decimal points?
Thanks
Patrick Star
Here is the LEAN code. I am using Interactive Brokers.
Jared Broad
We believe they are set correctly; if you can find a way to execute manual orders through IB at a sub-penny please let us know and file a bug on github issues list.
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.
Alexandre Catarino
Some brokerages don't accept orders when the price precision is not right.
For instance, if we place an order at $30.1703 and precision is $0.01, it would come back as an invalid order.
If the algorithm does rounding, great. If not, the engine does it and warns the trader.
Patrick Star
Alex, so that's exactly my question. Does IB require a two decimals precision? or maybe 3 decimals? if I know their requirements I can do it myself to avoid warnings.
Which part of the code tells me about each broker's requirements?
Thanks.
Dean Pignon
I have a strategy that trades different security types and had the same problem, as the precision varies by security as well. In the LEAN code I found what I think you're also looking for:
inc = security.PriceVariationModel.GetMinimumPriceVariation(security)
Then you adjust your price as follows:
price = Math.Round(price / inc) * inc
Alexandre Catarino
According to the EquityPriceVariationModel, the default MinimumPriceVariation is $0.01. If it's price is below $1, then the MinimumPriceVariation is $0.0001.
For other securities, please check out the symbol properties database.
Patrick Star
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!