Back

[Update] New Order Types and Deprecating of "new Order()"

Hello All! We made some awesome new changes which will allow supporting all order types. Now orders are separated into dedicated classes e.g. MarketOrder, LimitOrder and StopMarketOrder. This way we can keep the code clean and build powerful custom functionality into each order type.

For 99.9% of you this doesn't change anything, especially if you're using the "Order(symbol, quantity)" helper method -- but there are a few of you who do complex order types. This change means you can no longer go "new Order(...)". Instead you need to go "new LimitOrder()" or "new MarketOrder()". This is because "new Order()" doesn't mean anything anymore - and its dangerous to allow as your order types wouldn't behave as you expect.

If you're just creating orders you can use the new helper methods -- "LimitOrder(symbol, quantity, price)", "StopMarketOrder(symbol, quantity, price)". To access the orders you pull them from the dictionary just like before in the TransactionManager.Orders collection. When you modify the order make sure you submit it to the OrdersQueue to be re-processed.

We've updated the LimitOrder example in the university. I'd recommend cloning this to get started. We put in a new helper method to get orders from the queue: Transactions.GetByOrderId(orderId);

In the coming days we'll make some helper methods so you don't need to manually do this -- e.g. UpdateLimitOrder(id, price) which will take care of the internal order object. At the moment we're mapping out the API to make sure its future friendly :)

If your algorithm broke with this change and you need a hand fixing, please let us know here, or privately in the system help (?) -- Happy Coding!
Update Backtest






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.



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