开云体育

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

Re: CARR Data

 

Thanks.? Must be some edge case I haven't accounted for I'll do some digging.


Re: tickeByTickData or Depth Level 2 does not work when using ISIN instead of conID or symbol

 

Hey Bruce,

You're always going to want to use Contract Id for MD subs..? If you need to start with ISIN, then use that via ReqContractDetails to get the contract id first.? Note it's possible the contract(s) you get back will have the exchange set as the primary (e.g. NASDAQ) when you'll likely want SMART for MD purposes.? Welcome to IB.

-Peter


Re: CARR Data

 

Works for me when requesting 5min bars in 24hr chunks.


Requesting CARR ending 20210304 00:00:00 bar size 5 mins
TRC [1, 1614817854909] SEND:reqHistoricalData:CARR:20210304 00:00:00:86400:SECOND:_5_mins:TRADES:false:false
TRC [18, 1614817855034] historicalDataEnd:Received 235 bars for CARR. [2021-03-02 11:00:00] --> [2021-03-03 18:30:00]
Got 235 bars for CARR with earliest at 1614704400. Have 235 bars now.Requesting CARR ending 20210302 11:00:00 bar size 5 mins
TRC [1, 1614817864915] SEND:reqHistoricalData:CARR:20210302 11:00:00:86400:SECOND:_5_mins:TRADES:false:false
TRC [18, 1614817865014] historicalDataEnd:Received 204 bars for CARR. [2021-03-01 06:00:00] --> [2021-03-02 10:55:00]
Got 204 bars for CARR with earliest at 1614600000. Have 439 bars now.Requesting CARR ending 20210301 06:00:00 bar size 5 mins
TRC [1, 1614817874917] SEND:reqHistoricalData:CARR:20210301 06:00:00:86400:SECOND:_5_mins:TRADES:false:false
TRC [18, 1614817875015] historicalDataEnd:Received 216 bars for CARR. [2021-02-25 14:00:00] --> [2021-02-26 18:55:00]
Got 216 bars for CARR with earliest at 1614283200. Have 655 bars now.
....

On Wed, Mar 3, 2021 at 05:44 PM, <msaracena@...> wrote:
All,

I am unable to access historical market data for CARR.? I do not get an error message back from IB, simply no data is returned. Is there an issue with the data for that ticker?? I am able to access several hundred other tickers with my script without issue.

Mike


Re: SLOW connection times

 

Since the tally of folks that have the same issue seems to be approximately zero, IB having an issue feels unlikely, though not impossible. So let me briefly raise three things that I'd look at if I'd have to trouble shoot API connection issues.

[1] Stale API connections:
We once wrote a simple "Is my TWS alive and actually connected to IB" monitor that would connect to TWS, do a simple operation that requires TWS to communicate with IB, and then disconnect. The monitor was started automatically and frequently but somehow caused stale (not completely closed) API connections to build up. When you click "DATA" to get the connections listing in TWS, do you see stale API connections from past script executions? Those did cause connection request delays, in my case, even when TWS was far away from the maximum number of API connections.

[2] DNS reverse lookup:
You said you checked the network on your server, but did you check DNS as well?
  • Have you experienced any sluggishness (even briefly) for regular commands on your server? Assuming it's a Linux system, even commands such as "ls -l"
  • Does "netstat -a" or "lsof" hang for a few seconds but "netstat -an" or "lsof -n" do not?
Several library functions unexpectedly perform "reverse DNS lookups" and can block the caller (in this case the thread in the Java JVM that handles your incoming API request to TWS) for extended periods of time until failing DNS lookups succeed or time out. If your internet service provider has any instability with reverse DNS lookups, otherwise perfectly fine servers can have operations seemingly randomly freeze for 20 to 30 seconds.

[3] How are your entropy levels?
This is a little stretch but fits the symptoms you are having if you are running some kind of Linux system. And it took me weeks to figure that out on a server I had in a data center in Dallas (though this is not specific to Dallas or Texas)

In order for strong SSL encryption to work, the Linux kernel collects "truely random events" and builds up a buffer of entropy that Java JVMs (and other programs such as sshd, httpd, ...) access through the /dev/urandom device. And while only very few bytes are needed each time, opening or reading from /dev/urandom when the buffer is low or empty will block the caller until enough entropy has been collected. And the Java JVM frequently opens /dev/urandom when various network related operations take place.

You can read up on this with "man urandom" and check your server's entropy level with "cat /proc/sys/kernel/random/entropy_avail"

Hope this helps.


On Wed, Mar 3, 2021 at 11:51 AM, ExStock wrote:
Thanks--we've checked our network pretty thoroughly, although we'll continue to check anything else we can think of, like making sure there's no excess traffic we've forgotten to take into account.?

To further stump me, today about half of my scripts connected in less than a second--less than .1 in some cases--and the other half took >30 seconds.? improvement, but still mystifying!? My best guess is still that _something_ happened on the IB side, but if no one else is having similar problems...


CARR Data

 

All,

I am unable to access historical market data for CARR.? I do not get an error message back from IB, simply no data is returned. Is there an issue with the data for that ticker?? I am able to access several hundred other tickers with my script without issue.

Mike


tickeByTickData or Depth Level 2 does not work when using ISIN instead of conID or symbol

 

Hi,
?
Trying to subscribe to market data using following format (from samples) and including these fields but get error. Which fields are needed for stock and forex when using ISIN? Logically, currency shouldn't even be needed but sample has it so I included it.
?
Code: 321, Msg: Error validating request.-'b0' : cause - The symbol or the local-symbol or the security id must be entered
?
---------------------------------------------------------------------------
Contract ContractSamples::ByISIN(){
Contract contract;
contract.secIdType = "ISIN";
contract.secId = "US45841N1072";
contract.exchange = "SMART";
contract.currency = "USD";
contract.secType = "STK";
return contract;
---------------------------------------------------------------------------

-Bruce


Re: SLOW connection times

 

Thanks--we've checked our network pretty thoroughly, although we'll continue to check anything else we can think of, like making sure there's no excess traffic we've forgotten to take into account.?

To further stump me, today about half of my scripts connected in less than a second--less than .1 in some cases--and the other half took >30 seconds.? improvement, but still mystifying!? My best guess is still that _something_ happened on the IB side, but if no one else is having similar problems...


Re: OptContract Lookup

 

Thank you, I was feeling a bit ... - receiving just the xml dump:)

then I tried edge, same like chrome - well edge is chrome code? these days. I didnt know there is still the internet explorer on my actual win 10. and it works like a charm - cool feature to install an app like this. it is just sad microsoft tends to be so inconsistent in the long run.

now I have a great tool. many thanks
Alex


Re: Can't modify bracket order - ONLY stop loss quantity won't update

 

Thanks for your reply.

I actually am trying to change the quantity of all orders of the bracket order, including the parent, as in the example code I posted.

If i set transmit to True on the parent order, the updates of the take profit and stop loss are then successful. The problem is that in that case, if the new buy limit order gets filled immediately, the take profit order of the original version can get filled before it gets edited. I tested it myself and it is happening.

How can one modify a bracket order then, including the quantity of shares? Seems like a basic endeavour, especially when the quantity is the same between orders of the bracket order


Re: Can't modify bracket order - ONLY stop loss quantity won't update

 

In case of a bracket order must the child orders have the same quantity as the parent order. You can't modify the quantity of the child order(s) independently of that of the parent order.


Re: OptContract Lookup

 

开云体育

The page I linked to contains an install link: 'To install Contract Inspector…'. For your convenience, here's the link again:

?

?

I should have stated that this is Windows only. It's a 'ClickOnce' app, which means once it's installed it will automatically fetch updates. (I'm not actively updating it at present, though there are many improvements I have in mind when I have the time.)

?

Also please note that depending on your version of Windows (and perhaps some other factors that I'm not fully aware of), you may find that this link simply downloads a large lump of XML if you use Edge, Firefox, Chrome etc.

?

If that's the case, then use Internet Explorer instead – just enter 'Internet Explorer' via the search facility on the taskbar and click the link, then navigate to the above link.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of pressl.alex@...
Sent: 03 March 2021 10:52
To: [email protected]
Subject: Re: [TWS API] OptContract Lookup

?

Hello Richard,
This tool looks very cool, but? I have no VS installed to compile. maybe you have an executable somewhere to download?

many thanks.

greetings
Alex


Re: OptContract Lookup

 

Hello Richard,
This tool looks very cool, but? I have no VS installed to compile. maybe you have an executable somewhere to download?

many thanks.

greetings
Alex


Re: OptContract Lookup

 

开云体育

There is no strike 119 for that expiry. 115 or 120 are the nearest strikes.

?

It took me about a minute to find this out using my Contract Inspector program, which you can get from Github at:

?

?

See attached screenshot.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Crow
Sent: 03 March 2021 05:53
To: [email protected]
Subject: [TWS API] OptContract Lookup

?

I am trying to lookup contract details (socket.reqContractDetails()) of the following option contract (com.ib.client.Contract.OptContract):

?

conid 0

symbol XLY

secType OPT

lastTradeDateOrContractMonth 20210416

strike 119.0

right C

exchange SMART

currency USD

?

I get error code 200:?No security definition has been found for the request

?

Anyone know what is wrong with my request?

?

?


Re: OptContract Lookup

 

开云体育

Strike 119.0 does not exist, try a multiple of 5. You do not need you specify the exchange.

downloaden


Re: SLOW connection times

 

Then you have your troubleshoot mapped already. It's not your program.

1- Change TWS version on remote side (less likely to be the issue)

2- Check your network (connect directly to modem and disconnect ALL other wired and wireless devices.

3- Check remote side network and servers (like step 2)

4- Check IP Transit (ping, traceroute, etc / most likely not your problem)

On Tue, Mar 2, 2021, 9:11 PM ExStock <exstock@...> wrote:
Already done, and it connects no problem to that, although it's a more updated version--978, whereas I think the server's version is 976.


Re: OptContract Lookup

 

I'm not sure, probably SMART as exchange not working for options lookup.
Try to pass 'CBOE' as exchange name


Re: reqScannerSubscription() Documentation

 

Thanks Dmitry.

It looks like what I am doing already is still the best approach. I will stick to what is not broken!


OptContract Lookup

 

开云体育

I am trying to lookup contract details (socket.reqContractDetails()) of the following option contract (com.ib.client.Contract.OptContract):

conid 0
symbol XLY
secType OPT
lastTradeDateOrContractMonth 20210416
strike 119.0
right C
exchange SMART
currency USD

I get error code 200:?No security definition has been found for the request

Anyone know what is wrong with my request?



Re: SLOW connection times

 

Already done, and it connects no problem to that, although it's a more updated version--978, whereas I think the server's version is 976.


reqTickers on paper account - bid/ask stay still for long times

 

When I request current ticker with reqTickers in succession, bid/ask stay unchanged for long time like minutes order of magnitude while “last” is updated consistently every time. This is on paper account. I use reqMarketDataType(3).

Anyone saw this anomaly?
I observed with both Stock and Forex contracts and both outside and within RTH.
Yesterday and today, for example.

Is my understanding of the delayed data wrong or I shouldn’t expect consistent data in paper trading?

Thanks in advance,
Alex