Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: execDetails(...)+commissionReport(...) Callback different behaviour when not opening trade history
I do not have the callback functions tradeReports(...) + tradeReportEnd(...) . When i make the request with reqExecutions(...), i receive the information through execDetails(...) and execDetailsEnd(...). How do i receive real-time reports ? Maybe i can use these functions in a java application? I program in c++ and i didn't find these in the documentation page. ?
?
The software behaves like i explained no matter what time. In my case it does not matter if the exchange is open or not.?
?
Exactly. A reliable working "position monitor" is what i need (for stocks and for futures). In my case for a symbol i have several trading rules and each of them manages a certain part of the aggregated position. Sometimes it happens that the statistic that a trading rule "contains" is not valid anymore and then it wants to close its part of the position. So i need the executions, because only then i can assign the closed order to the corresponding rule. As far as i know the position(...)-callback only delivers the aggregated position ( if so, -> not applicable). ?
?
With ---> "By using the position(..) + positionEnd(...) ? In my case it sends the close again and basically opens the symbol in the other direction" <--- I meant that if i do not receive the message that says "there was a execution of selling/buying 60 apple stocks" my system sends the request again, so that (sometimes) there will be another execution that either increments the postion to an unwanted amount (here 120 apple stock) or closes it again that this leads to selling short position. This is a critical error. ?
?
As a side note: i configured the tws in such a way to receive the 7 days of executions and i like to make use of that fact that there is always "enough time" (repeated sending) to complete the position monitor as the callback should send this information repeatedly. ?
But i will have a look at the position(...) and positionEnd(...) callback functions. Maybe they can solve at least a part of my problem
?
regards
Simon |
Re: execDetails(...)+commissionReport(...) Callback different behaviour when not opening trade history
Just to confirm that you are talking about historical tradeReports right after the call to reqExecutions and before the tradeReportEnd clall back. You are not talking about real-time reports right after order fills, right? I can confirm this behavior for when the markets were closed over the weekend, and today at 16:30 US/Central during the CME/CBOT daily trading pause hour (my trade reports were for various futures). But just before 17:00 US/Central on Sunday and today and during trading hours, historical trade reports were delivered right after reqExecutions calls regardless of whether the Trade History window was open or not. This is probably a question for IBKR, but there are other request types with a disclaimer in the documentation that they only work when exchanges are open. But coming back to your other questions. If I understand you correctly, you are trying to create a reliable "position" monitor within your client application. Both getting the an initial correct state when the client starts as well timely updates in real time when your orders fill. For my taste, historical trade reports are not well suited to do that, considering that they generally are only available for the time since midnight (IBGW and TWS default) and only manual configuration of the TWS Trade History windows give you a longer historical view. Also, when you look at the (simplified) data model below, trade reports are pretty far removed from the notion of "Position" and subscriptions that get you updatePortcolio, position, pnl, and order status callbacks give you better data for position monitoring. I did not understand your comment about position updates when you say "By using the position(..) + positionEnd(...) ? In my case it sends the close again and basically opens the symbol in the other direction". You would:
´³¨¹°ù²µ±ð²Ô ? ? On Sun, Nov 17, 2024 at 09:07 AM, <simon.meier1987@...> wrote:
|
Re: keeping subscriptions
I second this and also have never seen periodical inactivity for an instrument cause real time market data subscriptions to stop working. Just to be sure:
When I checked up on "holes in the data" for an instrument in the past it was always caused by a quiet period for that instrument (unless my recorder client had failed). As a matter of practice I now subscribe to "5 second real time bars" for all instruments as a "second opinion" and data feed quality metric. For many instruments, those bars get sent for every 5 second period, even if no trades or ask/bid changes took place (16,560 or 17,280 bars per day). A 0 volume 0 count bar confirms quiet periods for the other feeds of that instrument. They also serve as data feed heart beat detectors. But then, data for instruments I subscribe come from big exchanges and are generally quite active. Feeds from smaller exchanges or infrequently traded instruments may behave differently. ´³¨¹°ù²µ±ð²Ô ?
?
On Mon, Nov 18, 2024 at 12:00 PM, bespalex wrote:
|
Re: fx about EUR.USD
IB never reported historical volume on Forex financial instruments. It was always reported as -1. This is by design.
If you want historical volume you need to request historical data for Forex futures/ETFs/options, etc... The trading hours' information for any financial instrument is available in TWS (mouse right-click over the instrument row). The exchange for EUR.USD is IDEALPRO (or IDEAL). Hope this helps. -- |
Re: keeping subscriptions
I am not sure streaming data inactivity cease is connected to general API inactivity in any way, as in my case, I keep recCurrentTime requesting as a beacon every second, also difference in local/TWS time works for me as an API disconnect monitor sensor.
So my loss of some streams is of some other nature, but occurrence is stable in about 10% of maintained streams, different 10% each time.?
And no apparent connection to any of the events, looks like IB just "forgets" and drops some of the active subscriptions on ETH session start at 4am EST. |
fx about EUR.USD
anyone know which exchange IB is trading for EUR.USD?
?
and for fx data, it is trading 24/5, so if i look at the daily data, what is the time point IB defines the Open and Close price?
?
i tried to use
mycontract = Contract()
mycontract.symbol = "EUR" mycontract.secType = "CASH" mycontract.exchange = "IDEALPRO" mycontract.currency = "USD" ?
whatToShow='BID'
?
but cannot find the volume data, do i need to pay? i am using simulation account.
?
thanks! |
Re: execDetails(...)+commissionReport(...) Callback different behaviour when not opening trade history
Hi,
in my application there is already the request for the executions as you hinted and of course i am aware of the time limitation ( it is set to 7 days in my case ). I think there's a misunderstanding here, as i wasn't saying something about some "unsolicited" behaviour.
?
I only need a robust way to determine when a position is closed and i am relying on the execDetails(...) + commisionReport(...) callbacks for that purpose. Unfortunately i am experiencing that not all executions / commissions are sent, maybe so under a certain set of circumstances (the example i gave was, that it depends on whether the "trade history" was opened or not).?
?
1. Are you experiencing the same, by executing m_pClient->reqExecutions(...) (and not opening the trade history). In that case do you receive the completed trading history from execDetails() ?
2. What is the most robust way to determine if a position is closed / opened ? By using the position(..) + positionEnd(...) ? In my case it sends the close again and basically opens the symbol in the other direction. Its very frustrating
?
regards,
Simon |
Re: anyone know where I can find the IB maintenance timetable
There is the page that indicates current issues and lists the regular maintenance windows for the various regions. There is also a short article on ?in case the issue is related to the network(s) between TWS/IBGW and IBKR. And from experience, additional (sometimes unannounced) maintenance periods may cause the inability to connect over the weekend. ´³¨¹°ù²µ±ð²Ô ? ?
On Fri, Nov 15, 2024 at 11:02 PM, comicpilsen wrote:
|
Re: execDetails(...)+commissionReport(...) Callback different behaviour when not opening trade history
Quick update:
The unsolicited sending of execution and commission reports during a client connects while TWS has the "Trade History" window open was likely a bug in 10.30.1p that now has been fixed in 10.30.1q. ´³¨¹°ù²µ±ð²Ô
?
On Fri, Nov 15, 2024 at 08:24 PM, ´³¨¹°ù²µ±ð²Ô Reinold wrote:
|
Re: keeping subscriptions
I recently discovered that some streaming market data subscriptions would randomly cease after 15-20 minutes if there were no activity over the API in any direction (such as before stock market open). I baked in regular dummy calls for TWS time (recCurrentTime I believe) as a way to pulse a keep-alive signal and had no problems since. §á§ä, 15 §ß§à§ñ§Ò. 2024?§Ô., 18:16 ashour92 via <ashour92=[email protected]>:
--
Best, DS |
Re: Trail price movement callbacks?
Excellent thanks Orionn & ´³¨¹°ù²µ±ð²Ô. Glad to know I'm not crazy thinking it should be in the status updates.
?
I'll have a closer look at the openOrder callbacks. Looking through the logs it didn't appear that it was firing often enough to be updated at the speed of price movements but it's worth a shot! Thanks! |
Re: anyone know where I can find the IB maintenance timetable
keep hitting the return key sorry. Anyway the script tries 10 times and same message. I tried to run in 5 times after 18:00 with the same results. The last time I tried was 22:30 cst. My bet is that this is a maintenance issue but I can't find the IB schedule for system tasks. Is it posted somewhere please? The script is fine and so is my connection to my TWS connection . thank you. |
anyone know where I can find the IB maintenance timetable
All this week I have had a cronjob running a script to get 3 years of daily trades from ib using reqHistoricalData . Nothing special, just running download speed tests for something else. The cronjob ran successfully at 18:00 cst monday through thursday but this friday 11/15/24 it failed consistantly and all I got was
|
Re: execDetails(...)+commissionReport(...) Callback different behaviour when not opening trade history
I can confirm that TWS 10.30.1p indeed sends unsolicited commission and execution reports upon client connection, if the "Trade History" window is open. But I cannot believe that this is intended behavior and I am not sure which other TWS versions show this behavior. The correct way to get commission and execution reports for recent orders is a call to If your client needs historical execution and commission reports, it should call reqExcutions. The only documented relationship between "Trade History" in TWS and calls is the time period for which trade details are available. The "" chapter says: Important: By default, only those executions occurring since midnight for that particular account will be delivered. If you want to request executions up to last 7 days, TWS's Trade Log setting "Show trades for ..." must be adjusted to your requirement. Please note, that IB Gateway would be unable to change the Trade Log's settings, thus limited to only executions since midnight to be delivered. ´³¨¹°ù²µ±ð²Ô PS. When my client called during startup while TWS had an open Trade History windows, all commission and execution reports as well as were received twice.
?
On Fri, Nov 15, 2024 at 04:37 PM, <simon.meier1987@...> wrote:
|
execDetails(...)+commissionReport(...) Callback different behaviour when not opening trade history
Hi all,
i noticed a difference in the behaviour of the execDetails(...)+commissionReport(...) Callback functions. When i start the tws and do not open the "trade history" dialog then all orders that are opened or closed from this point are only "returned" ONCE in the execDetails(...) + commissionReport(...). Furthermore i do not receive the previous trading history ( more precise all executions and commission reports that occured before the new start of tws). If i open the dialog shortly after the start of the tws i receive all the executions and it keeps sending them in a regular time intervall.
?
The reason why i am asking ( or created a topic), is that my trading system gets invalidated if i dont receive all the execution (i cant determined when a position is closed and the is no other way with this design). The problem is that the tws is restarting every day, so i get this set of conditions (after restart -> the dialog hasn't been opened, without intervening) and thus the callbacks are sending only once.?
?
Is it possible that a message is lost ( due to connection problems) ? If so, is there some mechanism to get the dialog open? automatically ? Or how can i enforce it that the callbacks are sending periodically ? How is this solved in the IB Gateway ?
?
regards,
Simon
?
? |