Hi,
I wanted to check the status of an order ie filled or not, using function
TradierOrderDetailed entryOrderDetails = GetOrder(..).
Am running into namespace issues when I try to call GetOrder.
Any suggestions?
Regards
VS
QUANTCONNECT COMMUNITY
Hi,
I wanted to check the status of an order ie filled or not, using function
TradierOrderDetailed entryOrderDetails = GetOrder(..).
Am running into namespace issues when I try to call GetOrder.
Any suggestions?
Regards
VS
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
The QuantConnect API has the Transactions helper for that effect.
Once an order is created, we can save its ID:
private int _orderId; // Creating an Order: var limitOrderTicket = LimitOrder("SPY", 100, 205); _orderId = limitOrderTicket.OrderId;
And use the helper to check its status latter:
// myOrder is limitOrderTicket var orderTicket = Transactions.GetOrderTicket(_orderId); var isFilled = orderTicket.Status == OrderStatus.Filled || orderTicket.Status == OrderStatus.PartiallyFilled;
Please checkout the docs under the Trading and Orders section. There is also an event handler that fires whenever a order status change, thus it is the ideal place to check an order status:
// Override the base class event handler for order events public override void OnOrderEvent(OrderEvent orderEvent) { var order = Transactions.GetOrderById(orderEvent.OrderId); Console.WriteLine("{0}: {1}: {2}", Time, order.Type, orderEvent); }
Alexandre Catarino
Let me add another information:
Tradier is deprecated for now (until they have streaming API), therefore we can not trade it with QuantConnect.com.
Paranjay Paresh Desai
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!