Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
- Twsapi
- Messages
Search
Re: historical open interest
So I did some reverse engineering of TWS and found that the WhatToShow enum is just turned into a string in the protocol.? It seems that when open interest data is being requested, WhatToShow is set to either "Option_Open_Interest Call" or "Option_Open_Interest Put" in the protocol.? Is this a valid thing to do for reqHistoricalData (not just reqHistoricalTicks) and this is just a short coming of the Java API (that the WhatToShow enum is missing some things)?? Or is this some weird hack that shouldn't work which is why it isn't documented by IB? thanx, Hunter
On Saturday, March 13, 2021, 8:48:31 PM PST, Hunter C Payne via groups.io <hunterpayne2001@...> wrote:
Hi all, ?? I was wondering if anyone knew a way to get historical open interest data on equities from IB.? Is it buried in reqFundamentalData somewhere these days?? I know I can find it in TWS itself but I can't seem to determine which API calls return this specific data. thanx, Hunter |
Re: event when a stock reaches a certain price
I am not aware of a scanner that does what you are looking for. Please keep in mind the IB API is mostly for the support af TWS and if TWS does not need it, it's probably not there.
toggle quoted message
Show quoted text
If you are only interested in price changes, subscribing to tick id 4 (Last Price) should suffice.That tick will only be sent when the trade price changes, Take a look at . Even at 800 contracts, data volume will be quite reasonable. But your 800 contracts simultaneously will run against the data lines limitation. Take a look at the ":How Market Data is Allocated" in For 800 market lines you'd need:
´³¨¹°ù²µ±ð²Ô On Wed, Mar 17, 2021 at 07:28 PM, corneliu maftuleac wrote: I think the list of tickers is around 800 (I am using ibinsync python api, but the general idea is the same). |
Re: event when a stock reaches a certain price
corneliu maftuleac
I think the list of tickers is around 800 (I am using ibinsync python api, but the general idea is the same).
So, your suggestion is to just use regular market data (ex: reqMktData(conId, contract, 221)) and it should be fine? I was thinking there should be a more advanced solution like a scanner subscription or something, because in fact I dont need the data itself rather just a notification when price reaches certain level. |
Re: How to create a performance efficient trading app so each sub process runs smoothly in Python?
You can also think of using something like ZeroMQ as your messaging/concurency backbone. Python has a bindings module for it - pyzmq. On Wed, Mar 17, 2021 at 2:40 AM Alex Gorbachev <ag@...> wrote:
|
Re: event when a stock reaches a certain price
Can you be more specific what you consider huge? Did you buy quote boosters so that you can subscribe to more than 100 contracts?
toggle quoted message
Show quoted text
From what you are doing, I'd say you'd only need to subscribe to monitor the Last Price and Last Size ticks. So you would look at roughly 4 - 5 call backs per contract per second. You might want to review your approach and code. I am subscribing to a pretty massive amount of data (process and log them in a Json format) and my server does not break a sweat. And it's a very small server for today's standards. Just to give you some idea:
´³¨¹°ù²µ±ð²Ô On Wed, Mar 17, 2021 at 03:54 PM, corneliu maftuleac wrote:
Hi, |
event when a stock reaches a certain price
corneliu maftuleac
Hi,
I am trying to monitor a list of tickers (lets say the list is big). I want to know when one of the tickers reaches a certain price. The target price is generated by an algo so it's not just a %-change. I tried subscribing to realtime data to all of the instruments but this generates HUGE amount of network traffic to the point that my code is not really able to process all of the events. Is this possible to do with scanner subscriptions? I dont find where I can specify that scanner subscriptions to work only with a specific ticker or a list of tickers. |
Little tool for option chain contract creation
juxeiier
¿ªÔÆÌåÓýHi,I have created a little library which can scrape option chains in a (hopefully) easy manner. The topic is discussed here /g/twsapi/message/46566 /g/twsapi/message/42241 /g/twsapi/topic/81356218 The source code, together with installation details, is here . The usage is then as simple as chain = ibt.getOptionContractsUpUntilDays(aapl, 60) or aapl=Stock(symbol='AAPL', exchange='SMART/AMEX') chains = ibt.getOptionContractsUpUntilDays(aapl, 60)It works on my site, but is very new, so probably some shortcomings :) Would be great if someone could test it. Cheers, Juergen |
Re: How to create a performance efficient trading app so each sub process runs smoothly in Python?
I love Python but it has its own place and it's not good for real-time-ish parallel compute. You can hack around things but in the end it won't be crazy. You can consider Go and node.js from mainstream languages (apart from C++). I personally always wanted to try Elixir but never got around - perfect for highly concurrent stuff.? On Sat, Mar 13, 2021 at 2:52 PM matt <rmdeboer82@...> wrote: What would be the best way to do on-the-fly computations using Numpy, Pandas for trading using IB TWS API, writing to/from mySQL, and in the meanwhile receive and send data and orders? |
Re: Request for options contracts per expirtation date
I'm not a fan of TWS API design at all (to say the least). But at this point it has so much history and dependencies that it is not feasible to improve it dramatically in an evolutionary manner. You probably know that being 30 years in software development. :) On your topic... I think I just replied how I get the chains in another thread using?reqSecDefOptParams as Francois suggested. On Tue, Mar 16, 2021 at 7:15 AM juxeiier <juxeiier@...> wrote: Hi Francois, |
Re: How to get all VALID options
I do get valid chains in this way: chains = ib.reqSecDefOptParams(contract.symbol, '', contract.secType, contract.conId) then I just get the one for exchange SMART. Then for expiration date I need, I get the list of strikes and create a list of Option() objects - options. that list I pass to reqQualifyContracts() -?ib.qualifyContracts(*options) The combinations of expirations and strikes that don't exist don't pass qualification (you'll see errors in the stderr but they are handled in the background). The options that were qualified successfully have non-zero conId so I filter them out. You don't have to do too many calls - just get a product of expirations/strikes you need and then create list of Option() objects, qualify them and filter on conId. I use the ib-insync Python module so my method calls might be slightly different from standard API (I guess only capitalization?). Is that what you are also doing? On Tue, Mar 16, 2021 at 7:01 AM juxeiier <juxeiier@...> wrote: This is really unbelievable. |
Re: Anyone upgraded Java version for TWS on Linux?
Thanks Hunter, very helpful. I did some digging around in that directory as you suggested and found some differences between various files. I copied a few files over from the IB JVM directory to the stock JDK 8 directory. Still didn't work. I've given up as the performance actually does seem to be OK now; at least not bad enough that it's worth spending more time digging. But this was helpful advice that I've filed away in case it becomes a big enough issue. Thanks John On Mon, Mar 15, 2021 at 1:53 PM Hunter C Payne via <hunterpayne2001=[email protected]> wrote:
|
Option settlement price AM/PM
When a stock closes for trading at the end of business on expiration Friday, the last trade determines the options settlement price (PM settlement).
That is not true for those European-style options that expire in the morning (AM settlement), for instance RUT, NDX, and 3rd-Friday SPX. Settlement prices for RUT, NDX and the "original 3rd-Friday SPX options" are calculated by using the opening stock price for each stock in the index. These options stop trading when the market closes on Thursday, one day prior to expiration Friday. Then, is there any way to get this settlement timing info about options, using API? For instance AM/PM settlement, or exact date+time of settlement time? |
Re: How to get all VALID options
juxeiier
I probably will not need all call and put contracts, but at least say 2SD strikes prices away from current underlying prices.
Then I scan all chains for all symbols, for example to see if there is a nice Jade Lizard opportunity somewhere. I definetly have no time to do this manually ;) |
Re: How to get all VALID options
Matthias Frener
>??If I get all contracts for all chains for 120days from today, that takes 2hours just for 3 symbols!! Do you need them all? (and you probably do something wrong, should be way faster with?reqSecDefOptParams). Wanted to speed up option chain on UI - so no point on download all because I won't look at all anyhow. I keep the last 16 queried option chains on cache. If I open #17, #0 falls out of cache and #17 goes into. So if you want to look at #0 again, it will need to get strikes again, but #17 is fast now. Am Di., 16. M?rz 2021 um 11:26?Uhr schrieb juxeiier <juxeiier@...>: Hi Matthias, |
Re: How to get all VALID options
juxeiier
Hi Matthias,
thx for help. You really cache the contracts locally? If I get all contracts for all chains for 120days from today, that takes 2hours just for 3 symbols!! That is the reason I implemented a little serializer/caching mechanism with the pickler module(python). After restart of the algorithm, I have all the contracts almost immediatly at my disposal. |
Re: Getting last Expired Option Price
Matthias Frener
I actually the closing the pricing of the current trading day. Maybe we have different use-cases, but I only need expired option prices for the daily?settlement. So I use last price just after markte close. The exact value (used on monthly balance) will than later sync from FlexQuery after the transaction shows up there. Am Di., 16. M?rz 2021 um 10:19?Uhr schrieb Francois G via <namasteparis=[email protected]>: Hi Mattias & Alexandre, |
Re: How to get all VALID options
Matthias Frener
> I now struggle in reveiving the greeks for the options. Are they even there when markets are closed? You probably have to switch to frozen market-data type. You will only see live-greeks while market is open, otherwise there is no bid/ask and difficult to calculate it. (the exact time depends on markte, e.g. 9:30-16:00 for stock options on CBEO or 24/5 (with 10min stop each day) at GLOBEX), > But still,?why do we need to do this? We deserve better from IB, since all this data is available in the option trader window.TWS has same issue. Option an option chain and change between dates and scroll up/down the strikes. You will that is terrible slow, takes seconds until you have all the strikes and even longer until prices show up - because they probably have to da same as we have to. What I did to make it smooth in my App is indeed to store it locally. I cache option chains that have been requested from TWS locally. So it only slow the first time, second time it's cache hit and there immediatly. Am Di., 16. M?rz 2021 um 11:01?Uhr schrieb juxeiier <juxeiier@...>: This is really unbelievable. |
to navigate to use esc to dismiss