Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
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. |
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:
|
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 ?
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:
|
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:
|
Re: Submitting many orders simultaneously
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 |
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:
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:
|