Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
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 ¨C start stream, get tick types ????????????????????????????????????????????????????????????????????????// Wait in TWS::contractDetails for reply from TWS ????????//m_pClient1->reqMktData( msgID,C,"",true);????????// true ¨C 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 ¨C 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? ? ? ? |
CUSIP/ISIN in ActiveX API using VBA in Excel
Hello,
I have been trying to get ISIN and CUSIP from ActiveX API and failed everytime. I am using reqContractDetails and trying to read secIdList.? I have successfully received the required info while using python API (So my account has necessary subscription). However, how exactly do I read secIdList in VBA while using ActiveX client? I tried to assign the secIdList to TwsLib.ComTagValueList and also checking if secIdList is Null. Everytime I receive error in bold statements.?
I tried looking everywhere and could not arrive at a satisfactory explanation for this issue! Thanks and Regards, Pratik |
How place orders before AND after market hours?
What is the magic combination of settings that lets you place orders through the API both before and after market hours?? I can use outsideRth(true) on an order and place it after market hours, but not before market hours.? If I set this to false then I can place it before market hours but not after market hours. In TWS -> Global Settings -> Presets -> Stocks I can set either "Allow order to be activated, triggered, or filled outside RTH" or I can set "Allow order to be routed and executed during pre-open session".? But I cannot check both.? They are apparently mutually exclusive.
So what is the combination of parameters that let you place an order anytime from 4:00 am to 8:00 pm? Thanks! |
Re: Order field to identify a strategy
Hi all, I use trade references stored in the order reference field, it usually works without problem. Track the order id, order reference and your internal tracking identifier, and you should be able to piece it all together. What I have experienced is position reports being lagged by many minutes, and execution reports arrive in an arbitrary order, but the order references do seem to be stable. Best wishes, M? On Thu, 18 Feb 2021 at 03:04, Bruce B <bruceb444@...> wrote:
-- +44 (0) 7528 551604? Gulfstream Software - Winner Risk Management Awards 2010 This message is subject to : |