Keyboard Shortcuts
Likes
Search
Submitting many orders simultaneously
Hi. I am new here, so I apologize if this question has been covered already. Until recently I was trading on IBKR using the Client Portal API. Each day I would simultaneously place about 100 limit orders for various U.S. stocks, and I did this using the /orders REST endpoint. If one uses an array of orders as the payload of the post request, the orders are all submitted simultaneously. Sadly, on Sept 4 IBKR stopped allowed one to submit multiple orders this way. Only single orders are allowed now. But if I try to submit ~100 orders sequentially, it will take too long. I need to submit them all within a few seconds of each other. So, I am considering using the TWS API for this. My questions are:
Thanks very much for any guidance that anyone can give me. |
According to TWS API documentation,
?
I have not placed orders at this pace and I'm not sure if any more fine-grained pacing is implied from the above mentioned limitations (like not more than 1 order per 1/50th of a second). My C# app typically places about 15 orders in a timeframe of 1-3 seconds daily and I envision it will place about double that amount soon, but it computes orders on the go from incoming price and execution data which dictates exogenous pacing and makes benchmarking of "pure" order placement throughput unfeasible. So maybe others will share their experience in this regard. I'm sure if your code is streamlined and snappy enough (including managing your own order ids instead of wasting message bandwidth on respective requests from TWS), there should be no problem placing a hundred orders in just a few seconds.
?
--
Best, DS |
Thanks very much for that information. Does one really need to submit the orders sequentially? Is there no way to submit a batch of orders at one time? I would have thought that many IBKR users would need to do this (likewise with cancelling a batch of orders). I notice something called the One-Cancels All (OCA) order type: Is it possible somehow to use that to submit a batch of orders? |
There is no batch order submission message/request in TWS API.? Order management is described at Orders are submitted to TWS/IBGW one at a time through the request. That is true for single orders as well as multi-order constructs such as bracket orders or of Once-Cancels-All groups. You may be able to place your orders well ahead of when you want them to trigger if the available are powerful enough to implement your logic. Conditional orders are resting within the IBKR infrastructure and as such much closer to the exchange than your client or TWS/IBGW. 闯ü谤驳别苍 ?
?
On Sat, Sep 14, 2024 at 04:43 PM, Jesse Stone wrote:
|
开云体育Yes, you do need to submit the orders sequentially. No there is no ‘batch’ order submission facility. It’s simply not necessary: submitting the orders in a tight loop is no more difficult than building up some kind of a batch. You can bang the orders in as fast as you like and TWS will pace the input API messages in the same way as any other input so as not to exceed the limit. ? Why not just try it and see: it would be much quicker and more educational for you than trying to get feedback on speculation about whether there should be such a facility or whether many of us want to do it. ? OCA is not an order type. An OCA groups is a set of orders that are placed (sequentially), with the property that as soon as any one of those orders executes, all the others are cancelled (hence the name). It sounds like you need to spend a bit more time studying the API documentation and experimenting with it. The paper-trading system is very much your friend, as it lets you do experiments without any possibility of loss. There is no substitute for experience with this API. ? Richard ? |
I don't use REST API but read about it, so here are thoughts: I don't have idea of the time real TIME TROUGH for REST calls, generally theses kind of things are implemented atop existing infra and I won't be surprised that what is a batch for you is serialized by IBKR upon arrival. (I can even imagine this as a reason they stop supporting batch mode, it may even be processed out of sequence for good reasons but difficult to report) ? The API is quit fast and give you more control about what happens, so you should try and compare the API to any real info or guesstimate of REST TT of orders to the system. ? Alternative: IBKR FIX interface, theoretically it's the fastest way to order in. But I don't saw/see any simple way to benchmark it. It's tedious to setup, the complexity lies more in the "pipe" system as you need to setup a VPN and alike proxies related to authentication, from what I remember IBKR allows a local VPN for emul and FIX have debug flags. While still being a 'one man' mission level. I don't recommend trying FIX before you evaluate if the API is enough And before entering the FIX world you should consider the extra work it requires to be sure of the payback. My tests+pain did drove me back to API which is enough for me, as ds-avatar rightfully wrote it, you most likely have exogenous pacing reasons. But... it exist. ? ?
? |