Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: paper account and live account on same machine but different user
Thank you for your inputs, I will try them because the answer from IB is this one: Thank you for contacting IBKR Client Services. To be able to have market in both live and paper account, you need to log in to these accounts on the same Windows user profile. If you use another Windows user, for the TWS it is like you're using a different device. Unfortunately, there is no way to change this. Thank you for your understanding! El mi¨¦, 1 mar 2023 a las 16:07, Hartmut Bischoff (<topofocus@...>) escribi¨®: the simplest solution: connect your client to both machines. One connection is used for data gathering, the other for ordering. |
Linde PLC, what am I doing wrong?
I'm pretty sure that there must be a simple explanation for this but I can't find it.
I am downloading historical data for Linde PLC daily from NYSE. IB symbol LIN, conid 338719530. Since the last few days does this result in an error message, saying that this instrument is unknown. The last time that this was successful was at the end of the February 27 trading day (OHLC data received). I looked in IB's contract database and there it is present: both the symbol and conid are correct. Checking the newspapers I found that Linde recently stopped their listing at the Frankfurt stock exchange, but that their listing at NYSE is unaffected. Instruments details provided: IB symbol LIN, conid 338719530, exchange NYSE, currency USD. "No contract found" is what I get back from the server. What am I doing wrong? Or, what has changed a few days ago? |
Re: paper account and live account on same machine but different user
the simplest solution: connect your client to both machines. One connection is used for data gathering, the other for ordering.
More complex, but easier to manage: connect your client to the production system and use it for data-processing. Generate orders, but transmit them via a remote-client to the paper-trading account. We are using rabbitMQ for data-transmission. Works like a charm. |
Re: paper account and live account on same machine but different user
Something that did work for me, from different machine (with different public IP),never tried on same machine. |
Re: paper account and live account on same machine but different user
¿ªÔÆÌåÓýI wouldn¡¯t waste your time bothering with a ticket. It won¡¯t get anywhere. This is not a bug, it¡¯s a result of their licensing deals with the data providers. If they allowed two different users to receive the data concurrently on the same physical or virtual computer, it would break the terms of that deal. ? And it¡¯s no good saying that although the two users are both logged in, only one session can be accessed at a time, because that¡¯s not true on Windows Server: I run two different sessions under different user most of the time, and those two sessions can be remotely accessed by two different people at the same time from different client computers. Besides, even on non-server Windows or Linux two sessions running under different users can both be running programs that use the data simultaneously. ? Richard ? ? From: [email protected] <[email protected]> On Behalf Of joanmarcel119
Sent: 01 March 2023 09:30 To: [email protected] Subject: Re: [TWS API] paper account and live account on same machine but different user ? Thank you ´³¨¹°ù²µ±ð²Ô, I've just opened a ticket to API on IB's Message center. If I get a solution then I will post it here. ? Best regards ? El mar, 28 feb 2023 a las 18:45, ´³¨¹°ù²µ±ð²Ô Reinold via (<TwsApiOnGroupsIo=[email protected]>) escribi¨®:
|
Re: paper account and live account on same machine but different user
Thank you ´³¨¹°ù²µ±ð²Ô, I've just opened a ticket to API on IB's Message center. If I get a solution then I will post it here. Best regards El mar, 28 feb 2023 a las 18:45, ´³¨¹°ù²µ±ð²Ô Reinold via (<TwsApiOnGroupsIo=[email protected]>) escribi¨®:
|
Re: paper account and live account on same machine but different user
The only documentation that I am aware of is and the second row of the "Case 1" table seems to describe your situation. However, they do not go into detail of how "location of device 1" is determined under Windows. It could very well be that two different Windows users on the same machine are considered two different locations. Probably a question directly to IBKR. ´³¨¹°ù²µ±ð²Ô |
paper account and live account on same machine but different user
Hi there, I've been searching for info about this but with?no luck.? I can use paper & live from the same machine and same user but I didn't know that changing the Windows user could run into?problems. After creating a new user on the same Windows laptop to run the TWS paper account from it and at the same time opening the TWS live account (different port) on the other user account I get the error?message : (10197) No market data during competing live session on the paper trading account?and I can't get to solve this?problem. Any?suggestions? Thank you! |
Re: Get option strategy type
Just add all con_id's of your bag, multiply it with -1 and use this? number as con_id for your bags.
You get well designed contracts in your own? database and? can even implement some sort of quality management, in case something happened to one leg-component. That's how its solved in ib-ruby. hartmut |
Re: Get option strategy type
¿ªÔÆÌåÓýAs you suspected, the API doesn¡¯t support it. You need to implement any option strategy detection on your client.?
On Feb 26, 2023 at 12:48 PM -0800, Simon Steiner via groups.io <steinersimon@...>, wrote: Hi, |
Get option strategy type
Hi,
I trade option strategies in TWS, and I make great use of the predefined strategies (Spreads, Butterfly, etc.) of the Strategy Builder: After executing a strategy, TWS shows the strategy name under 'Financial Instrument' in the portfolio app. If I open the instrument description, it also shows the strategy like this for example: When I pull information from the API I haven't seen this information anywhere (not in execDetails, openOrders, positions, etc.) Am I missing something, or is there simply no way to either extract the strategy type information from the executions, nor to alternatively request the information somehow through the API? When I manually create an option strategy through a combo contract and pass that contract to the reqContractDetails request, I get an error: "'BAG' isn't supported for contract data request. Please enter a valid security type".? Is the only way to assign a strategy type to my execution by creating some sort of reverse logic on the client side? For instance what I could extract every leg of a combo order and see if they match any pre-defined strategy. I had hoped I wouldn't have to implement that, but that the API makes this easier somehow. Curious what approach others may have, since this must be a common issue. Thanks, Simon |
Re: Historical Data Download : Compare Experiences
The error reported when making a reqHeadTimestamp() to VICI (or the other 3 stocks I mentioned from the SP500 - I am sure there are others as well) is interesting and gives some insight to the way the API command works internally. Clearly the code calls its own 'reqHistoricalData()-like' function to find the earliest date which then fails in exactly the same way that a call to reqHistoricalData() does with a period longer than available data. I suspect this internal call is the source of the eventual pacing problem that never responds.
Try calling reqHeadTimestamp() on 500+ symbols in a row with the 20ms gap (i.e. 50 API calls per second) and your code will eventually hang with no error reported. I agree with Richard that a call to reqHeadTimestamp() is useless since usually setting a duration that goes before the head timestamp will not cause any error. In the case it does, reqHeadTImestamp() doesn't help either due to the internal way it calls its own reqHistoricalData(). In case anyone is interested in the workaround I implemented, for those 4 stocks (AAL, LIN, MNST, VICI) I used the TWS Daily Chart to go back to the earliest date I could get and used this as my reference point for an exception table in my database. As long as you do not ask for data before that point in time then there will be no error in the call to reqHistoricalData(). It is interesting to note that the same error will appear on the top left of the TWS Chart if you try to get monthly bars that go back before this reference date so there is a clear bug in their data which goes beyond just the API. Thanks for everyone's input on this. I have finally found a way to automatically load a long history (25 years tested successfully) of any list of US stocks without failure. |
Re: Historical Data Download : Compare Experiences
¿ªÔÆÌåÓýContrary to what you say, reqHeadTimestamp for VICI does not ¡®never answer¡¯: it returns an error 162: ? ¡°Historical Market Data Service error message:No historical market data for VICI/STK@VALUE Last 0¡± ? Personally, I never use reqHeadTimestamp at all: I see no value in it. ? ? Richard |
Re: Problem retrieving option strings with TWS API
Sorry in last past I was too quick and slip on that. Try to use reqTickByTickData |
Re: Problem retrieving option strings with TWS API
maybe somebody more familiar with Python should help you ?>>tickSize(id,...), >>tickGeneric(id,...), >>tickPrice(id,...), >>marketDataType(id,...), >>tickSnapshotEnd(id) |
Re: Historical Data Download : Compare Experiences
Shared from my desk: ? |
Re: Problem retrieving option strings with TWS API
GUY
¿ªÔÆÌåÓýThank you very much Gordon, Attached, you have the python code Here is the result: ------- enregistrement des donn¨¦es ------- 0 -C 20230303 bidc 27.95 askc 28.35 strike 118.0 -P bidp 27.95 askp 28.35 1 -C 20230303 bidc 27.95 askc 28.35 strike 119.0 -P bidp 27.95 askp 28.35 2 -C 20230303 bidc 27.95 askc 28.35 strike 120.0 -P bidp 27.95 askp 28.35 3 -C 20230303 bidc 27.95 askc 28.35 strike 121.0 -P bidp 27.95 askp 28.35 4 -C 20230303 bidc 27.95 askc 28.35 strike 122.0 -P bidp 27.95 askp 28.35 5 -C 20230303 bidc 27.95 askc 28.35 strike 123.0 -P bidp 27.95 askp 28.35 6 -C 20230303 bidc 27.95 askc 28.35 strike 124.0 -P bidp 27.95 askp 28.35 7 -C 20230303 bidc 27.95 askc 28.35 strike 125.0 -P bidp 27.95 askp 28.35 8 -C 20230303 bidc 27.95 askc 28.35 strike 126.0 -P bidp 27.95 askp 28.35 For the first row (0), I get ask ,bid for strike 118 . the result is correct and compliant with the TWS platform. But for rows >0 , bid and ask are the same because MktData is not updated maybe it is necessary to send a parameter to reqMktData to force the update Thank you again for your help Cordially guy
|
Re: Connectivity issue.
I see the same issue on the IBGateway.? Not sure how long its been with us, but certainly since late Feb.?? For me most days, it does this once:? The first API program to connect, will be instantly disconnected from the IBGateway.? Mostly just once a day, but early on it was several times in a row.
Now the IBGateway comes with lots of internal logs to explore and I think it reveals the cause. Early in the IBGateway log we get these lines about the new client:
Note that 2 last line: ?? "Ignoring API request 'jextend.b6' since API is not accepted."?? Problem here is the API client never sends that text - it seems to be a left over string within the Gateway...i.e. an uninitialized buffer or string. Now, when it does connect successfully, that same line above will read: This time the IBGateway thinks the variable of? "cutoffVersion" has been set to null, which is likely a proper value here, and the connection proceeds as normal. So that I believe the cause of the fault of mysterious failure to connect:? an uninitialaized variable in the IBGateway and possibly the TWS code. Interactive Brokers... are you reading this? ? |
Error 10195 when placing FX hedge
Hi everyone, been running into a problem recently attempting to place a forex hedge () resulting in the following error:
Error: 10195. Error Msg: Invalid order parameters supplied when trying to set "Use parent trade price at the time of fill" on an order: server: 1 order: 1127 parent: 1126. I am on the most recent TWS API and TWS/Gateway versions. The parent order is successfully put through and I can see it in TWS pending transmission to the servers: ? ? ? ? contract = Contract()
? ? ? ? contract.symbol = 'ALK'
? ? ? ? contract.secType = "CFD"
? ? ? ? contract.exchange = "SMART"
? ? ? ? contract.currency = 'USD'
? ? ? ? order=Order()
? ? ? ? order.action='BUY'
? ? ? ? order.totalQuantity=quantity
? ? ? ? order.orderType = 'MKT' ?
? ? ? ? order.transmit=False ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? order.eTradeOnly = False
? ? ? ? order.firmQuoteOnly = False? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? self.ib.placeOrder(orderId,contract,order) ?
parentOrderId=orderId
orderId += 1 ?
But when I try to put the forex hedge through as below, it returns the error 10195. I have tried IB API Support and despite them agreeing that my order and contract specifications look good, they are able to replicate the error but are unsure where the problem lies - any fresh eyes able to see where I've gone wrong? Thanks! ? ? ? ? contract=Contract()
? ? ? ? contract.symbol = 'AUD'
? ? ? ? contract.secType = "CASH" ?
? ? ? ? contract.exchange = "IDEALPRO"
? ? ? ? contract.currency = 'USD' ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? order=Order()
? ? ? ? order.action='SELL'
? ? ? ? order.orderType='MKT'
? ? ? ? order.totalQuantity = 0
? ? ? ? order.parentId = parentOrderId
? ? ? ? order.hedgeType = "F"
? ? ? ? order.eTradeOnly = False
? ? ? ? order.firmQuoteOnly = False? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? self.ib.placeOrder(orderId,contract,order) ?
|
Re: Historical Data Download : Compare Experiences
> The problem is that when the reqHeadTimestamp() faces a pacing error it hangs and doesn't recover and it doesn't report any error messages
Thank you for posting this, some of my code to download data started hanging a few months ago. I ended up setting alarms and using signal handlers, but it was a pain to deal with and I never bothered tracking down the cause. I may remove the reqHeadTimestamp() or run them in a separate process and cache the results. |