IB API - Delayed order execution

Discussion in 'Order Execution' started by Robco, Jun 6, 2018.

  1. Robco



    does anybody had a problem with delayed order execution with IB Gateway API?

    I'm trading few second before NYSE is closed. My order is sent to IB Gateway immediately, but then it is stuck in IB GTW for couple of seconds (2-10) and then it is sent to IB Servers. I'm trying to investigate it with IB Support, but it is not moving forward.

    018-06-05 15:59:51.954 [QB] INFO [JTS-EServerSocket-75] - [2019957:104:104:1:0:0:0:DET] Start validating message:
    2018-06-05 15:59:51.954 [QB] INFO [JTS-EServerSocket-75] - [2019957:104:104:1:0:0:0:DET] Finished validating message:
    2018-06-05 15:59:51.954 [QB] INFO [JTS-EServerSocket-75] - [2019957:104:104:1:0:0:0:DET] Started processing message:
    2018-06-05 15:59:51.954 [QB] INFO [JTS-EServerSocket-75] - [2019957:104:104:1:0:0:0:INFO] Placing orderId - 4
    2018-06-05 15:59:51.954 [QB] INFO [JTS-EServerSocket-75] - [2019957:104:104:1:0:0:0:INFO] Processing of order {4} completed.
    2018-06-05 15:59:51.954 [QB] INFO [JTS-EServerSocket-75] - [2019957:104:104:1:0:0:0:DET] Finished processing message:
    2018-06-05 15:59:56.375 [QB] INFO [JTS-CCPDispatcherS2-35] - Updating base currency: accountSpec=U2019957., currency=USD
    2018-06-05 15:59:56.391 [QB] INFO [JTS-CCPDispatcherS2-35] - Updating base currency: accountSpec=U2019957., currency=USD
    2018-06-05 15:59:56.423 [QB] INFO [JTS-CCPDispatcherS2-35] - [2019957:104:104:1:0:5:34:INFO] Sending open order.
    2018-06-05 15:59:56.453 [QB] INFO [JTS-CCPDispatcherS2-35] -

    Any suggestions?

  2. If you create the same order manually in TWS does it have a delay?
    If so then the problem has nothing to with API or the Gateway.
  3. JSOP


    Well orders are sent instantly in TWS, IB can at least do that much to earn our commissions so the problem is definitely with IB gateway. It seemed to be stuck after "finished processing message" unless there were other processing messages that were missing from the log that was not shown here.
  4. Robco


    I did not modify the log, I just cut the beginning and end of the log file.
    Unfortunately trading soft is running in the cloud and I do not have tws app installed there, so I can’t compare it. I tested latency as well and it is 8ms so there is no issue as well.
  5. d08


    Probably due to the flood of orders coming in the last few seconds - busiest time of the day.
  6. JSOP


    ok then it's issues with IB gateway.
  7. Could be an issue with the cloud server eg. a configuration or hardware issue.

    I would run the same software setup locally to see if you can reproduce the issue.
    Last edited: Jun 6, 2018
  8. Robco


    Actually I move to the cloud as I observed very similar behavior on my local machine - at that time I thought that it is caused by higher latency or slow CPU. I'm just curious whether everybody has such problem or I'm the only one.
    @JSOP: I do not expect dependency on number of orders during the last few seconds, as the orders are stuck in IB Gateway, even tech guys in IB told me that the order is not send from my pc to theirs servers.
    I'm sending the order to the other broker as well via FIX protocol and there it is sent and executed in milliseconds. Unfortunately I cannot fit requirements to use FIX protocol in IB.
  9. JSOP


    So is there anyway that you can just use IB API and not Gateway? Looks to me that's an IB Gateway issue. Does this issue always happen at around market closing 15:59 PM EST or does it happen every time when you send orders via IB Gateway? It could be that at market closing time, IB's system is busy doing other calculations, recording closing price and etc. that it just delayed in getting your order. Our CPU in our PC is actually fast and powerful enough to do NASA calculations to send someone to the moon as I have read somewhere so it's definitely not your CPU; it's problem on IB's side.
  10. Robco


    Direct use of IB API would be a solution, but it can be used just with FIX protocol. My strategy trades 1 per day at market close, therefore I do not have a chance to test it during a day. :(
    #10     Jun 7, 2018