Lean.Brokerages.InteractiveBrokers icon indicating copy to clipboard operation
Lean.Brokerages.InteractiveBrokers copied to clipboard

Open Order Time Not Set

Open AlexCatarino opened this issue 1 year ago • 2 comments

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

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

AlexCatarino avatar Jun 25 '24 20:06 AlexCatarino

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

Martin-Molinero avatar Aug 15 '24 23:08 Martin-Molinero

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

MaxRepin avatar Oct 25 '24 13:10 MaxRepin