Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Source of the ticks timestamps
Hi all. This must be a very noob question... I was trying to track the delay of real time data I get. I use the ib_insync Python module which makes things much easier in Python. First of all, ping to? takes about 27ms. For real-time bars I take my current system timestamp and then subtract?the bar time minus 5 seconds (bar size). That gives me 500-1000ms. For market data ticks, I subscribe using?reqMktData and the difference between time in the ticker (including all ticks in it - they have the same timestamp) and system time when I get them is only about?0.2ms (that's it - 200 microseconds). Now, that makes me think that ticker timestamp produced through?reqMktData subscription is actually generated in TWS (or IB Gateway which is what I use) and not on IBRK servers. Right? Thus, there is no way to say when those ticks were really produced. Is there? I haven't looked at TickByTick yet but I see that it has a very low limit on simultaneous subscriptions (3) so won't be useful for as many contracts as I need. Also, could someone point me on how exactly IBRK samples or aggregates ticks for?reqMktData? Do I every time just get aggregated ticks by type and price since the last update? Thanks, Alex |
Downloading Large Amounts of Historical Data
My strategy requires access to large amounts of historical data - ~1000 symbols at 10 min bar resolution for 3 years that I save locally in csv.? I am pulling data through the reqHistoricalData method in 1 year batches and concatenating the resulting queries. Periodically I get "ERROR 1 322 Error processing request.-'bT' : cause - Duplicate ticker ID for API historical data query", because my script is moving to the next data request before the current one is complete.?
What approach can be taken to ensure the script waits until the current request is complete before moving to the next? app.reqHistoricalData(ticker_id, contract, query_end_iteration.strftime('%Y%m%d %H:%M:%S') + ' EST', query_period, |
C# Positions
Trying to get current position (#'s of contracts) into a textbox. Working in c#.
Added this to Form1.cs? "ibClient.ClientSocket.reqPositions();" Added this to EWrapperImpl.cs in the position method code "myform.AddTextBoxItemPosition(pos);" Added this to Form1.cs - public void AddTextBoxItem(double pos) ? ? ? ? {
? ? ? ? ? ? if (this.tbConNumber.InvokeRequired)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? SetTextCallback d = new SetTextCallback(AddTextBoxItem);
? ? ? ? ? ? ? ? this.Invoke(d, new object[] { pos });
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? ? ? Convert.ToInt32(pos);
? ? ? ? ? ? {
? ? ? ? ? ? ? ? this.tbConNumber.Text = pos;
? ? ? ? ? ? }
? ? ? ? }
?Obviously I don't know what I am doing, I have somehow managed to get a connection, data, place orders but without the "positions" I am stuck.Any help is appreciated. Thanks |
Re: trouble requesting trade data *and* quote data for three futures tickers
A simple yet effective rate limiter (if you end up needing here) would be to push requests into a FIFO queue and have a thread pull them out and send them rate limited by a Leaky Bucket Rate Limiter.? Very simple algo. On Sat, Feb 6, 2021 at 10:39 AM Dmitry Shevkoplyas <shevkoplyas@...> wrote:
|
Re: Fx data
I have not worked with FX instruments, but the reqHeadTimestamp() API call should give you an idea of the earliest data you can expect (according to the documentation).
But don't expect to get data all the way back to what reqHeadTimestamp() indicates. I always read it as the "you will never get data older than that" timestamp. Some instruments reach back that far and some don't. |
Re: Fx data
There probably isn't data available any further back,?at least not in a form that you can easily grab. For most things, IB only goes back to around then. You could also buy historical fx data and similar from several sources, but?probably won't get any earlier than around 2005, either.? Historical data for the particular symbol I'm most concerned with only goes back to 2008, although it's been traded a lot longer than that.? On Mon, Feb 15, 2021 at 8:48 AM <ghelie@...> wrote: Hi, |
Re: Long position in TSCO mysteriously shortened this morning
I may be mistaken as to the ticker so do double check this. I'm also very dubious about Yahoo finance's data, it's generally deadly to rely upon it. The prices they serve may or may not be the intended series even if the ticker is correct. If the stock is adjusted for split then that would explain the historic adjustment, you'd see different price series depending on whether you pulled the data before or after the adjusted price was flushed back. It could also be a quirk of the paper trading system failing to allocate the split, it's an under developed version of the live system, so it does fall short sometimes. That might be worth a chat with a support person, they could tell you how the paper accoutn handles splits. Best wishes, M On Mon, 15 Feb 2021 at 11:19, Graham Bygrave <graham@...> wrote: Thanks. -- +44 (0) 7528 551604? Gulfstream Software - Winner Risk Management Awards 2010 This message is subject to : |
Re: Long position in TSCO mysteriously shortened this morning
Thanks.
That'll likely be it. I can see the split clearly in Yahoo. Looking at Google, there's no indication of the split - the price always appears as diluted, which would just imply they'd back adjusted it, which is fine. However, in my record of prices from last week, I have OHLC for TSCO.L at 244.20125223614,245.00123372173,237.99176624583,238.76299288089. And it wouldn't have been adjusted at that point. So I'm struggling to understand Yahoo's figures. On Thursday last week, Yahoo had the OHLC at 246.10001,247.922,243.52499,244.5,244.5. If there's been a 15 -> 19 split and the previous price was at ~304 then all is well and IB have just failed to allocate me the additional stock, they've just diluted my holding, which is an error by my reckoning (otherwise I'd surely just be able to short pending splits and profit). But that doesn't explain why my price history doesn't show > 300 anywhere for last week. Cheers, G. On Mon, 15 Feb 2021 10:45:40 +0000 "mark collins" <mark.collins@...> wrote: A bit more grubbing around shows a 15:19 split... |
Understanding placeOrder and its relation with used client ID
After some struggling, I think I finally understood why my orders weren't being updated with placeOrder:
- If the order was initially created with a different software using a certain client id (e.g. 11), I will be able to modify it if I use a connection with the same client id. - If I use a different client id, the order is not modified at all. - If I use the master client id, same behavior: order not modified - If the order was created manually at TWS, a new order is created, and then updated in next iterations, but the manually created order persists without changes. So, these are my questions: - Is it impossible to modify or cancel an order manually created at TWS from the API? - Is it impossible to modify or cancel orders initially created through the API but with a different client ID? - Is it impossible to keep two different connections using the same client ID? (almost sure that this is not possible, but just checking) |
Re: Long position in TSCO mysteriously shortened this morning
A bit more grubbing around shows a 15:19 split... M On Mon, 15 Feb 2021 at 10:44, mark collins via <mark.collins=[email protected]> wrote:
-- +44 (0) 7528 551604? Gulfstream Software - Winner Risk Management Awards 2010 This message is subject to : |
Re: Long position in TSCO mysteriously shortened this morning
I attached a png of the series I thought you were speaking of. It closed on the 12th north of 300, opened far lower. I'm still not certain whether you are reporting position or P&L, what was the P&L on the trade? M On Mon, 15 Feb 2021 at 10:09, Graham Bygrave <graham@...> wrote: Hey, -- +44 (0) 7528 551604? Gulfstream Software - Winner Risk Management Awards 2010 This message is subject to : |
Re: Long position in TSCO mysteriously shortened this morning
Hey,
Not sure where you're seeing that fall. My price stream shows me the close on Friday being around 239.3/245.2 and the open today being around 243.15/243.53. In any case, I didn't trade, so the position shouldn't have changed. Why would the position change? I'm miles away from being called. Cheers, G. On Mon, 15 Feb 2021 09:59:15 +0000 "mark collins" <mark.collins@...> wrote: A quick Google showed a large fall over the weekend. Could it be that |
Re: Long position in TSCO mysteriously shortened this morning
A quick Google showed a large fall over the weekend. Could it be that you are seeing the p&l change? M On Mon, 15 Feb 2021, 09:01 Graham Bygrave, <graham@...> wrote: I held 2143 of TSCO.L last night (paper trading account) at the close. |
Re: Long position in TSCO mysteriously shortened this morning
Can you provide any more details? Best wishes, M On Mon, 15 Feb 2021, 09:01 Graham Bygrave, <graham@...> wrote: I held 2143 of TSCO.L last night (paper trading account) at the close. |
Re: bad volume numbers using in history
If you want to capture most historical data available from ibkr make sure you specify SMART for the exchange in the contract object in you request. If you need to specify the exchange as part of the intrinsic definition of the contract, use its primary exchange field additionally. §á§ß, 15 §æ§Ö§Ó§â. 2021 §Ô., 02:57 Hany Danial <shdtech@...>:
|
List of error codes not documented?
Hello,
This is the third error that I come across which is not documented in API documentation. Has anyone collected or listed these undocumented error codes somewhere? Following error code shows with three different descriptions. At least the first one makes sense to me but the second and third are still ambigous. Error Code: 10189, Msg: Failed to request tick-by-tick data:No historical market data for EUR/CASH@FXSUBPIP Last 0 Error Code: 10189, Msg: Failed to request tick-by-tick data.Trading TWS session is connected from a different IP address Error Code: 10189, Msg: Failed to request tick-by-tick data.No market data permissions for NYSE STK More undocumented codes from this group: Error Code 10187:?/g/twsapi/message/44164?p=,,,20,0,0,0::Created,,undocumented+error,20,2,0,6076358 Error Code 505:?/g/twsapi/topic/4040516#4368 Thanks, |
bad volume numbers using in history
i'm working TWS API, trying to get get historical data of a stock using:
example:
comparing the volume to yahoo chart, the volume in that day is more than 300k shares, it doesn't make any sense, even if i multiply it by 100. some dates will not return data for specified date by using TRADES, only if i used MIDPOINT. is there another api to use or am i using it incorrectly ? |