I'd like to set the Tag of a sell order after the order has been placed because there some info I just don' t know until after the order has been filled.
Since the Tag property is readonly, it looks like the only way to do this is to ApplyUpdateOrderRequest:
OrderTicket orderTicket = this.Order(symbol, -100, false);
Order order = this.Transactions.GetOrderById(orderTicket.OrderId);
order.ApplyUpdateOrderRequest(new UpdateOrderRequest(Time, orderTicket.OrderId, new UpdateOrderFields { Tag = "updated tag!!" }));
This sets the tag on the order just fine. However, the Tag is not showing on the OrderTicket itself and also is not showing on the reports.
It looks like the OrderTicket retains a priate copy of the original order for which the Tag is being drawn from so it looks to be impossible at this point. It appears the order you get from Transactions.GetOrderById is a seperate instance of the order attached to the OrderTicket.
Is there another way I can set the tag perhaps?
Jared Broad
Good question! You're correct currently LEAN blocks updating the tags on orders which have already been filled.
The best way to be able to do this would be to file a request in Github.com/QuantConnect/Lean/Issues detailing your issue with an example algorithm. Perhaps we can make this behaviour overridable so you could override it for this use specific case.
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.
Derek Melchin
Hi Gmamuze,
UpdateOrderFields is the only way to update the order tag. These tag updates are still blocked after an order has been filled. Refer to Jared's comment above on filing a request to have this functionality added to LEAN.
Best,
Derek Melchin
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.
Levitikon
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!