IB API Multiple Order Issue.

Discussion in 'Automated Trading' started by walterjennings, Feb 1, 2007.

  1. Hey guys. I had something very strange happen to me this morning. I am using IB's TWS C++ Socket API and attempted to place 12 orders at one time , within 1 second, (on my paper trading account). Looking at the audit report it seems only two of those trades arrived at TWS. I assume the audit record any incoming orders. Has anyone encountered any issues like that? Is there some limit to the # of orders that can be sent through the API or TWS in a second?

    Thanks.
     
  2. doli

    doli

    I don't know whether tws accepts
    multiple outstanding requests.
    If it can't, you'd have to queue the
    requests, sending the next after
    you got back some status/confirmation
    concerning the previous.

    Because tws was designed for humans,
    who cannot enter orders faster than
    tws can process them, it may not queue
    order requests. If that is the case, you
    have to queue them.
     
  3. There is a limit. I thought it was about 50 per second, but I could be wrong about the number. If you need more you need FIX.
     
  4. doli

    doli

    Even if tws doesn't queue the orders,
    there may be enough buffer space in
    its network layer to hold the incoming
    order messages until tws gets around to processing
    them. Are you sure the orders were sent?
    Did each order have a different id? Did tws
    send any messages back to you?

    Then, too, there may be a message limit
    between tws and IB.
     
  5. no messages were sent back from TWS. since they wernt on the audit report as place orders. i assume they were never arrived or tws ignored them? im not 100% sure my system sent the orders, i dont see any reason why my system would say its sending an order and it not go through though. anyone at IB know the limitations of TWS' API?
     
  6. doli

    doli

    If you play around with TestJavaClient, I
    think you'll see that tws does send back
    something when an order is submitted.
    It sends a message to the software
    running via the API. If I remember
    correctly, it sends status for a valid
    order and an error message for an
    invalid order. Of course it won't do
    that if it didn't receive an order.
    When and if the order is filled it also
    sends a message.
     
  7. Here's a suggestion for dealing with any type of communications issue. Download a copy of ethereal. It is a protocol analyzer, free and available for Windows, Linux and Unix systems. You can monitor the TCP connection between your application and TWS, watch the messages, see TCP resets and so on. It is a fabulous piece of software.

    When dealing with this type of problem is very useful to have an independent monitor of traffic over the connection rather than solely depending on what the logging code at either end thinks is going on.
     
  8. Bob111

    Bob111

    as been said above-50 messages per second is the limit. you must have some sort of log on your side,when you trade via API, to see what is going on.
    don't forget-it's paper account-there is plenty of glitches with orders,executions etc..could be something on your side too. you not round price correctly for example and you got 3 digits after decimal, instead of 2.
    plenty of room for all kind of issues.