Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: Getting invalid prices by following the relevant market rules.
Hello Graham, Did you find any workaround or the cause of this error? I get the same error for a particular stock (WMT) when trying to buy with a limit order on a live account even with round amount (138.00). When requesting ContractDetails I verify that the minTick is 0.01 so, that is not the problem. The same transaction goes well on the paper account but it is not accepted on the live account. Using TWS Build 981.2r, Feb 10 2021. Trying hard to find someone with a solution but no success so far. Just one guy reported that sending a request with transmit = False, waiting some time and send the same with transmit = True solved the problem. Very?frustrating that I missed a trade yesterday due to this unpredictable transaction rejection. |
Re: question about server support and login best practice
Many IBKR API complications feel a bit frustrating and long in the tooth indeed. I see little reason to speculate why it's so and when it's about to change, even though I sure wish it did. If you need free solutions, I believe other participants could offer advice regarding third-party automation tools. If you are ready to pay, you can just set up a virtual desktop in AWS and run TWS or IBG permanently or through weekdays, and even accept outside client connections into it. That will still require logging in once a week, and not much else beyond that. I believe depending on your requirements this would cost about $1000-2000 per year with a modestly equipped AWS instance.
|
Re: How to pull all strikes for a given expiration?
Nick
Yes, you are limited by the throttling. One thread can easily reach the maximum throughput for retrieving historical data.
toggle quoted message
Show quoted text
On 2/19/2021 12:22 AM, Crow wrote:
It appears that if I pull the data via 1 thread, it's just as fast as if I pull the data through 4 threads...in other words, threading will not speed up the data pull, likely because it's throttled. Has anyone else noticed this? |
Options and future options priced in cents/pence instead of USD/GBP
I am trying to collect a list of exchanges that trade options or future options priced in cents/pence instead of dollars/pounds.
I have found issues when placing orders for options and future options meeting this criteria and had to implement fixes. A short list of options and future options meeting this criteria is: options trading at the LSE/ICEEU (examples: Z, GSK, GLEN) and future options trading at the ECBOT (examples: ZC, ZW) For these options and future options, the strike price format must not conflict with the strike price information available in other Contract fields like the local symbol or else the order is rejected with the following (undocumented) error: 478 | Parameters in request conflicts with contract parameters received by contract id: requested strike 1300.0, in contract 13.0; By collecting a list of exchanges where these options and future options are trading, I will be able to program around most of these special cases. I am aware that the price magnifier information available in ContractDetails should help knowing if an option or option contract meets the criteria but I would prefer not to request contract details information to avoid delays when placing orders. Looking for input from users who are aware of these types of options and future options. Thank you. -- |
question about server support and login best practice
Stuart Cracraft
开云体育My sens is that the current nature of IB is to provide two tools which either can be run.One is a headful client cumbersmoe and poor UI called TWI and the other is a thinner client. But that NEITHER of these can be programmed to? ?a) autostart at system boot (I run my clients on AWS and need absolutely no U/I. ? ? ?It is all done in CLI, with NO DESKTOP, to AUTOMATE it. ?b) NEVER require human interaction for the server to authenticate and login to the ? ? ?IB sservers to make paper and cash trades ?c) avoid a “Sunday required U/I human login” - what is that? It went out in the 1970’s… My sense is that IB is backwards on the above, does not provide a mechanism for serverless auto-login password WITHOUT mouse, keyboard, etc. but potentially with the account + password sitting in a file, run automatically by a Unix/Linux (I use Ubuntu) daemon, and doing the automation needful with HANDS-OFF. Please correct me if my above perception is correct or incorrect and then the next question is why possibly IB would not correct the above and take the final step to automate it all the way out. This is supposed to be a platform to automate both paper and cash trading to fully remove emotion and human activity from most market decisions about what to buy and sell, when to do so, for improved performance. The best analogy is , , and other platforms which do ALL the selection and analysis robotically, the rebanacing robotically, and minimize all human error, as the markets are too error-prone for humans to be in may confer extra security in situations requiring robotic, boring, precise analysis and actions taken. Pardon for the length of this question but I never got what think is a bottom line answer from this list for the above Stuart Cracraft P.S. When replying to this email, please ensure you cc my personal email at smcracraft@... And thanks for taking your time. |
Re: CUSIP/ISIN in ActiveX API using VBA in Excel
Thanks Richard!? I tried to test different versions of what you suggested. Still unable to get it to work. Giving me same exception "Specified cast not valid" on the starting line of For loop where contractDetails.secIdList is referred for the first time. Thanks, Pratik |
Re: How to pull all strikes for a given expiration?
开云体育
Thanks for the responses, it looks like the best way is via the link Dmitry posted below.? I agree that the API could be a lot better in terms of pulling options.? It's ok for pulling historical stock data, but could be a lot cleaner.? I wish IB would just
publish a higher-level Java/C/C#/Python interface layer.? How many people trying to use the API have kept running into the same problems that could have been avoided if they simply provided a better API interface.??
By the way, I mostly use the API for pulling data to do my own charting and technical analysis.? I'm mostly pulling historical stock and ETF OHLC bar data on about 500 tickers.? It appears that if I pull the data via 1 thread, it's just as fast as if I pull
the data through 4 threads...in other words, threading will not speed up the data pull, likely because it's throttled.? Has anyone else noticed this?
[A3]?by?dthayer Cut and paste of code I use to get option data. If set strike=0.0 and expiry=0.0, and right="", then you get the entire chain for both puts and calls.
????????Contract *C = new Contract();
????????C->symbol????????= "KMB"; ????????C->currency????????= "USD"; ????????C->secType = "OPT"; ????????C->expiry = "20130621"; ? ? ????????C->strike = 95.0;????????????????????????// Define as 0.0 to get entire option chain ????????C->right = "P";????????????????????????????????// Put no string, 2 double quotes, if want both put and call ????????C->exchange????????= "SMART"; ????????C->multiplier = ""; ????????C->primaryExchange = ""; ????????C->localSymbol = ""; ????????C->includeExpired = 0;
????????m_pClient1->reqMktData(msgID, C,"233",false);????????// false – start stream, get tick types ????????????????????????????????????????????????????????????????????????// Wait in TWS::contractDetails for reply from TWS ????????//m_pClient1->reqMktData( msgID,C,"",true);????????// true – get snapshot, don't specify tick types. From: [email protected] <[email protected]> on behalf of Richard L King <rlking@...>
Sent: Thursday, February 18, 2021 10:28 AM To: [email protected] <[email protected]> Subject: Re: [TWS API] How to pull all strikes for a given expiration? ?
The short answer is "no". ? Longer answer: ? reqSecDefOptParams is one of those API functions that appears to have been designed by a trainee programmer on a Friday afternoon after a liquid lunch (hence the stupid name), coded by another trainee the following Friday based on the beer mat that the first guy sketched it out on, tested to see whether it gives anything back at all but not whether it actually meets the specification, and then lobbed into the build for us poor API users to try and make sense of. ? I've never had anything good to say about it, and I've never heard anyone else say anything good about it. ? Having said that it can be useful, and I do use it in my platform. But the simple fact is that you can't tell whether anything it returns is actually valid unless you go and get the relevant contract details. ? ? From: [email protected] <[email protected]>
On Behalf Of Crow ? How do I pull all strikes for a given expiration?? I found this API: ?
? Which gives me all combinations of expirations and strikes, but the documentation notes:? ? "?returns a list of expiries and a list of strike prices. In some cases it is possible there are combinations of strike and expiry that would not give a valid option contract." ? Instead, I'd simply like the list of strikes available for a particular expiration.? Any way to get that? ? ? ? |
Re: Real-time bars when trading is halted due to circuit breakers
For tickbytick there is: On Thu, Feb 18, 2021, 7:24 PM Alex Gorbachev <ag@...> wrote:
|
Re: Real-time bars when trading is halted due to circuit breakers
I see. Is there an API call to get current trading halts, by any chance? On Thu, 18 Feb 2021 at 21:18 Ray Racine <ray.racine@...> wrote:
|
Re: Real-time bars when trading is halted due to circuit breakers
Don't know the direct answer to your question, however, you don't have to wait until crazy times, they are literally here daily.? On just about any given day there is at least one SPAC on a volatility or news halt for sometimes an hour.? Today it was SFTW. :) On Thu, Feb 18, 2021 at 5:36 PM Alex Gorbachev <ag@...> wrote:
|
Re: How to pull all strikes for a given expiration?
On Thu, Feb 18, 2021 at 6:53 PM Richard L King <rlking@...> wrote:
Breadth and depth - that I agree. For example, I was also very pleased to see options pricing functionality - havent' got to use it for real yet but looking forward to trying. Sorry for sarcasm and taking this offtopic. |
Real-time bars when trading is halted due to circuit breakers
This is hard to find out by experiment unless I wait for crazy times... :) Does TWS API still send real-time bars when trading is halted? Whether the whole market due to circuit breakers or an individual stock. I have the same question about historical bars for halted periods but I guess this I can check by requesting them from one of the past trading halts last spring. For TRADES real time bars during inactive periods, I can see bars (both historical and real-time) with volume=0 and HLOC equal to the last close. Does the same happen when?the trading is halted? Thanks in advance. |
Re: How to pull all strikes for a given expiration?
开云体育Well, I know what you mean, but I don't really agree. There are lots of things that can be criticised about it, but there's no denying it works very well, once you've worked your way around the various oddities. ? I'm certainly not aware of any other free API that comes anywhere close to it in terms of breadth and depth of functionality. ? ? ? From: [email protected] <[email protected]> On Behalf Of Alex Gorbachev
Sent: 18 February 2021 21:35 To: [email protected] Subject: Re: [TWS API] How to pull all strikes for a given expiration? ? Ain't the whole TWS API feels like that? :) |
Re: CUSIP/ISIN in ActiveX API using VBA in Excel
开云体育The problem here is that the secIdList property is actually a generic object of type ComList<ComTagValue, TagValue>, and generic objects cannot be mapped into COM objects (which is why the Excel Object Browser shows it simply as being of type Object). ? So you can't access any of the members of this type. However all is not lost because the ComList<ComTagValue, TagValue>, ?type implements the IList<ComWrapper<T>> interface, which should enable the members of the list to be iterated over using For Each, something like this: ? Dim s As String Dim tv As ComTagValue For Each tv In ContractDetails.secIdList ??? s = s & tv.tag & ": " & tv.value & ";" Next ? MsgBox s, , "SecIdList" ? I haven't been able to actually try this because at the moment I can't seem to make the damn ActiveX Excel workbook work at all (I rebuilt the ActiveX control from the latest files in the Github repository, and at the moment neither the C# API nor the ActiveX API will connect successfully – they just hang). ? Richard ? ? From: [email protected] <[email protected]> On Behalf Of praditik@...
Sent: 18 February 2021 14:17 To: [email protected] Subject: [TWS API] CUSIP/ISIN in ActiveX API using VBA in Excel ? Hello,
|
Re: How to pull all strikes for a given expiration?
Ain't the whole TWS API feels like that? :) On Thu, Feb 18, 2021 at 3:29 PM Richard L King <rlking@...> wrote:
|
Re: "BEST queries are not supported for this contract” when requesting historical trade bars
toggle quoted message
Show quoted text
From: [email protected] <[email protected]> on behalf of Scott Kister <scott@...>
Sent: Thursday, November 5, 2020 6:36 AM To: [email protected] <[email protected]> Subject: Re: [TWS API] "BEST queries are not supported for this contract” when requesting historical trade bars ?
I was getting that error a lot and also came up empty searching for what it meant. I did eventually realize that it was happening when I was requesting historical data from before the IPO date of a stock. When I changed from blindly requesting the last
30 days to doing a reqHeadTimestamp and asking from max(Head, 30 days ago), most of my BEST queries not supported errors went away. I realize that doesn't solve your issue, but may give a clue, or help others.
|
Re: How to pull all strikes for a given expiration?
开云体育The short answer is "no". ? Longer answer: ? reqSecDefOptParams is one of those API functions that appears to have been designed by a trainee programmer on a Friday afternoon after a liquid lunch (hence the stupid name), coded by another trainee the following Friday based on the beer mat that the first guy sketched it out on, tested to see whether it gives anything back at all but not whether it actually meets the specification, and then lobbed into the build for us poor API users to try and make sense of. ? I've never had anything good to say about it, and I've never heard anyone else say anything good about it. ? Having said that it can be useful, and I do use it in my platform. But the simple fact is that you can't tell whether anything it returns is actually valid unless you go and get the relevant contract details. ? ? From: [email protected] <[email protected]> On Behalf Of Crow
Sent: 18 February 2021 06:08 To: [email protected] Subject: [TWS API] How to pull all strikes for a given expiration? ? How do I pull all strikes for a given expiration?? I found this API: ? ? Which gives me all combinations of expirations and strikes, but the documentation notes:? ? "?returns a list of expiries and a list of strike prices. In some cases it is possible there are combinations of strike and expiry that would not give a valid option contract." ? Instead, I'd simply like the list of strikes available for a particular expiration.? Any way to get that? ? ? ? |