Hi, is there a way to set a minimum order size per security (or globally)? When I execute SetHoldings("SPY", signal), I'd like to only go to the market if the new position results in an order of at least, say 10 lots or say $1000 of value.
I am trading crypto and I get the following messages at some point, not sure why. Maybe I have run out of money due to losses and my account doesn't have enough money for an order of at least 0.01. What check can I perform to avoid getting these messages?
20171129 17:12:02.428 ERROR:: OrderID: 12148 Warning - Code: NotSupported - The minimum order quantity is 0.01
20171129 17:12:02.428 ERROR:: OrderID: 12157 Warning - Code: NotSupported - The minimum order quantity is 0.01
20171129 17:12:02.428 ERROR:: OrderID: 12160 Warning - Code: NotSupported - The minimum order quantity is 0.01
20171129 17:12:02.428 ERROR:: OrderID: 12167 Warning - Code: NotSupported - The minimum order quantity is 0.01
Jared Broad
Thanks Alpha; it might make more sense for SetHoldings to not submit orders lesss than the lot size. We'll add this to the todo list.
GDAX minimum order quantity is 0.01 of a coin. So for now you can check:
if (Portfolio.TotalPortfolioValue < (0.01 * Securities["BTCUSD"].Price))
Edit: +1 for Alex's solution below
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
Are those warnings from an order placement made by SetHoldings?
An alternative to Jared's suggestion would be using CalculateOrderQuantity to evaluate the quantity that SetHoldings would use and place a MarketOrder (this operation is made by SetHoldings):
var quantity = CalculateOrderQuantity("SPY", signal); if (Math.Abs(quantity) > 10) { MarketOrder("SPY", quantity); }
Alpha
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!