开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: API/CTCI orders for canadian stocks are not allowed error message

 

Since you were able to trade the Canadian stocks using the API I called up the tech support one more time. He assured me that no Canadian product will be allowed to be traded through the API. He also told me that if you are currently able to trade then you won’t won’t eventually be able to trade. He also confirmed that this rule is applied to all Canadian products not just stocks . You can trade by hand but not using their API.


Re: API/CTCI orders for canadian stocks are not allowed error message

 

I called up their tech support and I was told that there has been a change made and one cannot trade Canadian securities using the IB API. Your paper trading likely works but I don’t think it will work on a real account?


How many reqHistoricalData requests with keepUpToDate=true can be run in parallel

 

Gents,
Is there a limit on how many historical data requests (reqHistoricalData call) with keepUpToDate=true can be run in parallel?
Also, if for the same security I request historical data (with keepUpToDate=true) of various bar sizes, does each bar size count to the limit, or only one "slot" is used?


Re: API/CTCI orders for canadian stocks are not allowed error message

 

Can you be more precise about what you think that will no longer be possible?

I usually do not work with instruments in Canada, but a few quick market BUY orders for ADN@TSE and ABRA@VENTRURE in a paper account worked just fine both SMART and direct routed. They properly show up as CAD positions in TWS.

If I am not mistaken, TSE and VENTURE are the two TSX exchanges. The two symbols were randomly picked from the top of the TSX listings.

闯ü谤驳别苍

?

?

On Thu, Sep 19, 2024 at 01:23 PM, nkulki wrote:

I called up the IBKR support staff and they state that IB will no longer allow us to trade Canadian stocks/futures using the API.


Re: API/CTCI orders for canadian stocks are not allowed error message

 

I called up the IBKR support staff and they state that IB will no longer allow us to trade Canadian stocks/futures using the API.


Re: C++ preventing EReader reading when socket is closed

 

A fix has been submitted a while ago and is now in the "latest" version of the API.


Error Code -> 366 w/ reqHistoricalData() in ib_insync for realtime stream

 

Hi,
?
Anyone else seeing this error start popping up today? Only started since about 3 P.M. The contract is valid and has been working since this morning. This is through ib_insync and is using callbacks with self.ib.run() following the call below catching event updates. Here is the following error:
?
reqHistoricalData: Timeout for Future(conId=563947733, symbol='NQ', lastTradeDateOrContractMonth='20241220', multiplier='20', exchange='CME', currency='USD', localSymbol='NQZ4', tradingClass='NQ')
Error 366, reqId 5: No historical data query found for ticker id:5, contract: Future(conId=563947733, symbol='NQ', lastTradeDateOrContractMonth='20241220', multiplier='20', exchange='CME', currency='USD', localSymbol='NQZ4', tradingClass='NQ')
?
Call:
bars = self.ib.reqHistoricalData(
self.contract,
endDateTime='',
durationStr='1 D',
barSizeSetting='5 mins',
whatToShow='Trades',
useRTH=False,
formatDate=1,
keepUpToDate=True
)
#event handler for updates to realtime historical OHLC data...
bars.updateEvent += self.OnBarUpdate
?


Re: How are built the Continuous future data retrieved with secType = CONTFUT ?

 

Thanks for your observation, if I investigate on my own I will publish the results. In any case, any other contribution is welcome.


Re: Submitting many orders simultaneously

 

Thanks everyone for the very helpful information. This will get me pointed in the right direction. I will try placing the orders sequentially with TWS API.


Re: How are built the Continuous future data retrieved with secType = CONTFUT ?

 

TL;DR Volume-based ratio adjustment
?
TWS shows the adjustment on the Chart. For example, let's take CME Crude Oil (CL). On 14 Aug there is a small marker "RA 101.63%" being shown on the TWS chart with CL CONTFUT. I guess RA = Ratio Adjustment. This is shown if you enable "Cash Dividend Indicator" in chart settings. Basically I think they simplified it and handle it exactly like for dividends - not that it makes it more clear as they also do not explain how it's calculated for dividends either. Coincidentally 14 Aug was the volume rollover day.


Re: Submitting many orders simultaneously

 

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.

?

?
?


Re: Submitting many orders simultaneously

 

开云体育

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

?


Re: Submitting many orders simultaneously

 

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:

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?


Re: Submitting many orders simultaneously

 

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?


Re: How are built the Continuous future data retrieved with secType = CONTFUT ?

 

Yes, you're right, I can try to deduce how the continuous is built, but I think it's very strange that IB doesn't state anywhere how it is officially constructed, and since it's an important aspect, I assume someone asked IB about it earlier, and so I asked here. We can infer, but IB official answer is its official answer.


Re: new IBKR desktop APP

 

开云体育

IBKR Desktop does not act as an API server, so it is by default out of the scope of this "TWS API" group I would think.

But I have looked at IBKR Desktop and it is in my opinion not for the serious investor or trader (which is traditionally the IBKR client base). It seems IBKR's attempt to have a more 'user-friendly modern looking' desktop client to better compete with retail brokerages (Robin Hood, TastyTrade etc) but a lot of functionality that is present in TWS is lacking.?
For instance there is no Portfolio Risk tool as in TWS (an absolute must in my opinion if you trade anything short) and no ability to do What-ifs to evaluate eg impact on margin for new positions. The fact that IBKR Desktop also does not support Advisor-type accounts at this time is also an inkling it is not targeted to any 'professional' user.
?
My opinion is that IBKR should have focused on bringing TWS in a modern UI (there are quite a few UI quirks in TWS) and introduce a Beginner mode to make it easier to use for novices, rather than starting from scratch the development of a new desktop client. They now have TWS, IOS-Mobile app, IBKR Desktop and their website that all look and feel different.?

rgds, Bart
On Sep 13, 2024 at 2:20?PM -0700, rwk via groups.io <rwk0434@...>, wrote:

I am a long time member of this group, but I have been away from it for awhile. Now I am re-evaluating my trading to better match my current interests and circumstances.
?
I have been working with the IBKR Desktop app, and I am wondering if anybody here is using or looking at it. I am thinking that multiple brains are better than one for working on this. If you're interested in wonky discussions, please speak up or contact me off-list at rwk0434[dot]com.
?
Thanks,
[Rich]


Re: Submitting many orders simultaneously

 

According to TWS API documentation,
?
Aside from the TWS API's inherent limitation of 50 messages per second implying a maximum of 50 orders per second being sent to the TWS, there are no further API-only limitations. Interactive Brokers however requires its users to monitor their Order Efficiency Ratio (OER) as detailed in the Considerations for Optimizing Order Efficiency IBKB article.
Additionally, please note IB allows up to 20 active orders per contract per side per account.
()
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


Re: new IBKR desktop APP

 

I am a long time member of this group, but I have been away from it for awhile. Now I am re-evaluating my trading to better match my current interests and circumstances.
?
I have been working with the IBKR Desktop app, and I am wondering if anybody here is using or looking at it. I am thinking that multiple brains are better than one for working on this. If you're interested in wonky discussions, please speak up or contact me off-list at rwk0434[dot]com.
?
Thanks,
[Rich]


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:

  1. Is it possible to simultaneously place ~100 limit orders using TWS API (with ib-async)? If yes, how?

  2. In case people here are familiar with the Client Portal API, does anyone know an alternative way to submit simultaneous orders with the Client Portal API? (I submitted this question to IBKR, but there is no reply.)

Thanks very much for any guidance that anyone can give me.


Re: API data not the same as TWS data?

 

You are probably looking for the list of available tick types that you can find at

There you will see that BID, BID_SIZE, ASK, and ASK_SIZE are not related to trades but to, well, the current Bid/Ask prices and sizes. Trades are reported through the LAST and LAST_SIZE ticks.

You should not see any differences between prices in TWS and data feeds you receive from TWS as long as you compare the same data sources (such as real time data feeds from reqMktData, reqTickByTickData, reqRealTimeBars, and reqMktDepth or historical data). Due to their different nature and purposes, prices from different feeds can be different.

闯ü谤驳别苍

?

?

?
?
On Fri, Sep 13, 2024 at 07:20 AM, Lalo F. wrote:

Hi there. I'm retrieving data from stocks using a Python script and the methods?tickPrice, tickSize and updateMktDepthL2
?
It looks like it is working, but checking the data I get from the API is not?similar at all to the data shown in TWS (or other apps). I'm wondering if I'm doing things right. I have been?reading about this on the internet and it happens to be a common?subject. I know I should count with some deviation, the bars I could build with fetched?data are not going to be exactly?the same as the TWS bars, but the samples I have checked are far away from being close.?
?
I'm trying to build?a system that takes data from the order book and trades (prices) to make a study, but with the provided?accuracy is impossible. I don't need a 100% accuracy, let's say a 98% will be fine.?
?
By the way, I haven't found any documentation about the retrieved data, is there someone who can give me a link or confirm my understanding is right:
?
05/09/2024 15:29:59.427 HBAN tickPrice reqId: 3 tickType: BID price: 14.85 attrib: CanAutoExecute: 1 PastLimit: 0 PreOpen: 0
05/09/2024 15:29:59.427 HBAN tickSize reqId: 3 tickType: BID_SIZE size: 2300
?
The first line means an order has been filled in the BID side at 14.85? ?
The second line means the order had a size of 2300
So the last crossed price will be 14.85?
The same is true for ASK side orders.
?
05/09/2024 15:30:00.275 HBAN tickPrice reqId: 3 tickType: LAST price: 14.85 attrib: CanAutoExecute: 0 PastLimit: 0 PreOpen: 0
05/09/2024 15:30:00.276 HBAN tickSize reqId: 3 tickType: LAST_SIZE size: 2300?
?
This is much more tricky, it could be: 1) a confirmation of the previous trade, so they are always redundant, 2) Market orders crossed with other market orders
Could anyone confirm?
?
Thank you,