QuantConnect / Lean.Brokerages.InteractiveBrokers

InteractiveBrokers Brokerage Plugin
Apache License 2.0
35 stars 22 forks source link

Open Order Time Not Set #117

Open AlexCatarino opened 4 months ago

AlexCatarino commented 4 months ago

Expected Behavior

When LEAN fetches an open order, we get the time is was recorded by IB.

Actual Behavior

The order timestamp is DateTime.MinValue.

Potential Solution

Reproducing the Problem

Open Limit Order for MES, for example. Deploy algorithm to IB.

Captura de ecrã 2024-06-25 210631

2024-06-24T22:10:23.8663356Z TRACE:: InteractiveBrokersBrokerage.HandleOpenOrder(): OrderId: -2, Contract: FUT MES USD CME, OrderStatus: Submitted
2024-06-24T22:10:23.8762989Z ERROR:: InteractiveBrokersBrokerage.HandleOpenOrder(): Unable to locate order with BrokerageID -2
2024-06-24T22:10:23.9069760Z TRACE:: InteractiveBrokersBrokerage.HandleOrderStatusUpdates(): OrderId: -2, Status: Submitted, Filled: 0, Remaining: 1, AverageFillPrice: 0, PermId: 2129007122, ParentId: 0, LastFillPrice: 0, ClientId: 0, WhyHeld: ,MktCapPrice: 0
2024-06-24T22:10:23.9070630Z ERROR:: InteractiveBrokersBrokerage.HandleOrderStatusUpdates(): Unable to locate order with BrokerageID -2

Checklist

Martin-Molinero commented 3 months ago

This is a limitation of the IB API, this information is currently not available

MaxRepin commented 3 weeks ago

Could you be more specific regarding the limitation? If I query endpoint /iserver/account/orders, it provides lastExecutionTime, which is much better than 0000-12-31 19:36:45. Reference: https://www.interactivebrokers.eu/campus/ibkr-api-page/webapi-doc/#monitoring-live-orders-33