Back

Brokerage precision requirements

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

Update Backtest








Here is the LEAN code. I am using Interactive Brokers.

https://github.com/QuantConnect/Lean/blob/master/Engine/TransactionHandlers/BrokerageTransactionHandler.cs
0

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.

0

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.


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.

0

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.


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.

0

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
1

Update Backtest





0

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.


Loading...

This discussion is closed