Certain stocks have a min tick increment size of .05 rather than .01. So for example if I try to create a stop order at $12.03 for a .05 tick it will reject my order. How do I check for the minimum tick increment of a particular security? If I can't, then how do I identify that a stop order was just rejected because I didn't conform to the min tick increment?
I am trying out the code below but am not sure whether the status would be cancelled or invalid whenever the tick size issue happens.
if (fill.Status.ToString() == "Canceled" || fill.Status.ToString() == "Invalid" && Securities[fill.Symbol].Invested)
{
stopTickets.First(x => x.Symbol == fill.Symbol).Update(new UpdateOrderFields { StopPrice = Math.Round(calcStop(dir, fill.FillPrice) * 20) / 20 });
}
Alexandre Catarino
The information on the symbol properties can be found on the Security object:
var properties = Securities["SPY"].SymbolProperties; var lotSize = properties.LotSize; var minPriceVar = properties.MinimumPriceVariation; var multiplier = properties.ContractMultiplier;
Sofyan Saputra
Great this is exactly what I was looking for!
Jared Broad
Sorry Sofyan Saputra this is actually not modelled in LEAN. The value above will always be 0.01 as its using a symbol configuration file for LEAN which isn't historically adjusted.
The best setup we could offer right now is to use Raw price data which will not adjust the prices and you'll get the splits and dividends paid out directly. This way you'll get the real increments that are present in the data.
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.
Sofyan Saputra
Jared Broad Thanks for letting me know. I think I will get around the issue by submitting a stop limit at a .05 increment if the stock's last 10 bars or so of history only had prices of .05 increments. This should be accurate most of the time.
Aytac Asan
Hi Sofyan Saputra,
Was you solve your problem? If so please share me how you solved it. For example i need to access to TickSize of security.
Alexandre Catarino
Hi Aytac Asan ,
We have answered Sofyan's question in this thread:
var properties = Securities["SPY"].SymbolProperties; var lotSize = properties.LotSize; var minPriceVar = properties.MinimumPriceVariation; var multiplier = properties.ContractMultiplier;
By the way, let me add that the issue raised by Sofyan is not a problem in QuantConnect/Lean. The algorithm automatically rounds down the order price to meet the minimum price variation requirement.
Sofyan Saputra
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!