Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: InteractiveBroker's instrument database
As I remember for only NYSE it's about 1TB data is used for exchanges, financial products' prices etc for a day or an hour, it's not a good idea to store all the data in one computer, but you can collect data of specific tickets On Sun, Nov 22, 2020, 14:28 Mikhail Ershov <misha-ershov@...> wrote: I think it's very very large DB |
Re: Automatic chart on TWS
¿ªÔÆÌåÓýTry using the local symbol for the option. For the AAPL contract you mention, this would be: ? AAPL? 201127C00120000 ? You can see this symbol in TWS in the 'Symbol' column rather than the 'Fin Instrument' column, which appears to be what you were trying. ? ? From: [email protected] <[email protected]> On Behalf Of Ace
Sent: 22 November 2020 20:06 To: [email protected] Subject: [TWS API] Automatic chart on TWS ? Hi, |
Automatic chart on TWS
Hi,
I algo trade with the Python API. The TWS platform displays the action and I found a simple way to have charts update to the stock symbol that got triggred by the algo using pyautogui. With a screen of 16 charts I have the script move the mouse to the symbol box of the chart, type the symbol ans do shft+enter to display the traded symbol. But this only works for stock symbols. I would like to make it work for options. The symbol name of an oiption on TWS is like this "AAPL Nov27'20 120 CALL" but typing it the in the chart box results in an error. For options charting you typically type the equity symbol, scroll down to options and then search the options chains. There's way to do something with pyautogui by knowing where the options symbol will appear in a portfolio window, right-cliking on it, scroll down to charts and click New Chart, but the chart will pop up at a random place on the screen with a random size. I want the charts to stay at predetermined locations ans sizes. Anybody playing with this stuff? Thanks |
Re: Historical Market Depth?
Nick
¿ªÔÆÌåÓýUnless something changed recently historical o/h/l/c data is available at 10, 5 and 1 sec bars. On 11/22/2020 1:52 PM, Mikhail Ershov
wrote:
I haven't tried that in practice, but looking at limitations with historical data I can suppose you can't get market depths in a historical manner. The maximum granularity you can get is 30-sec bars (open, high, low and close prices. may be with volume). IB have a small possibility to suscribe on, receive and store tick-by-tick data, |
Re: Historical Market Depth?
I haven't tried that in practice, but looking at limitations with historical data https://interactivebrokers.github.io/tws-api/historical_limitations.html#non-available_hd I can suppose you can't get market depths in a historical manner.
The maximum granularity you can get is 30-sec bars (open, high, low and close prices. may be with volume). IB have a small possibility to suscribe on, receive and store tick-by-tick data, but it's not the main purpose of that api. |
Re: Historical Market Depth?
Sorry for necromancing this 2011.
In 2020... ... The API provides real-time market depth but I don't think every change to the order book is sent since changes occur too frequently (multiple times per sec). Do you think this is accurate? Can we pull historical market depth on US equities? |
Re: Margin for generic orders basket, multiple legs
Dear Francois,
thank you for your reply. Let me be more precise: I know that guaranteed combos with up to 6? legs can be and used in whatif orders, but these are only available for all contract? types, mostly only for options combinations, and very few futures, such as CL.BZ for example. Unfortunately most of future spreads are not native of the exchange, so they must be created as non guaranteed (NG), but for the latter only 2 legs can be used. Beside this there is an additional recent limitation, which is not documented on IB website, that prohibits the creation of negative capable legs NG combos. This is probably due to the loss IB incurred in when crude oil futures price went negative (negative capable leg..), but I noticed it can also affects interest rate futures and some other energy futures, anything which could have a negative price. This is due to the wrong logic of combos order, which assumes positive prices of the legs. In practice this means that only native order are supported for these negative capable legs, so stop orders for example, which are not native, cannot be currently be placed on any combo with a CL leg for example. CL.BZ is a native spread, but stop orders are not supported by the exchange. Few months ago a stop NG order could be for CL-BZ for example, but know the systems raises an error and prevents order submission(the error is "NG orders are for negative capable legs are not supported). As far as I can tell this change is not documented anywhere. In any case, I am interested in currency trades or CFD, which are not supported in combos at all, so a combo whatif cannot be used, not? even for 2 legs. To summarize, there are only few garanteed combos with more than 2 legs which are supported, while for NG combos only 2 legs can be used, each leg must not be negative price capable, and currencies cannot be used at all. Future currencies can be a solution for 2 legs trades, but not for more complex trades, and they have limitations due to the lot size. The management of stop orders on negative capable combos is an important issue, which would deserve a separate topic and solution in itself. All the interesting 3 futures legs combos I tried to create are rejected (in API or TWS), while currencies or CFD legs are rejected also any two legs NG combos. Note that the whatif oerder is in general not efficient in assessing a mutiple legs position impact, since it only gives the margin impact of the single legs, and the sum of the single legs margin is not in general the total margin, due to margin credits for certain future combinations, or for currency positions, due to the possible compensation between some currencies balance when the crosses have a common currency, like gbpusd combined with usdjpy for example. See this post for more details. Thanks QT |
InteractiveBroker's instrument database
¿ªÔÆÌåÓý
Hello everybody,
Is there a way to dump somehow, complete IB's instruments database, together with all parameters (conID, supported exchanges, trading times, tick size etc.)? ?
Regards,
Alex
|
SEDOL SecID support discontinued?
The ?state that SecIdType supports ISIN, CUSIP, RIC and SEDOL.
ISIN, CUSIP and RIC seem to work ok, but when testing multiple symbols using SEDOL, IB reports the notorious error "No security definition has been found for the request".? Can anyone verify whether SEDOL is in fact supported, or perhaps it was un-supported some time ago? If SEDOL is only partially supported, then under which conditions (for example, perhaps only for certain SecTypes/Exchanges)?? |
Re: TWS API | Options market data request issue.
LS
here is the log for stable version, no "model is not valid" error, but still "competing?live session" error §ã§Ò, 21 §ß§à§ñ§Ò. 2020 §Ô. §Ó 14:57, LS <justgreey@...>:
|
Re: TWS API | Options market data request issue.
LS
Thanks for your reply.? I tried as you suggested, still nothing.Now I downloaded IBGateway and tried it as well, still same error.? In the log tab I could see another weird?message:? "Model is not valid: Active:true TSLA/20201127/490.0/Call TOP/PACED....."? that kept repeating. What could be the problem? Contracts to request market data are looking like this: §á§ä, 20 §ß§à§ñ§Ò. 2020 §Ô. §Ó 17:24, Mikhail Ershov <misha-ershov@...>: Probably problem fixed in 981th version, |
Understanding margin for option spreads
I'm just trying to understand the exact margin requirements to open (and hold) an option spread so my program can decide if there is margin to open the position or not.
I'm using a WHATIF-order to get the margin requirements of the spread. This gives me "EquityWithLoan", "initMargin" and "maintMargin". For all 3 I get before, after and change.
If I now want to open this spread, I have to make sure that my "Available Funds" is more than the initial margin change and that my "Excess Liquidity" is larger than the change in maintenance margin. Did I get this right? |
Re: Margin for generic orders basket, multiple legs
Hi,
Margin for combo orders works fine. This is simply achieved by creating a combo order, and ask for whatif, exactly the same way as if the order was for a single leg. In a generic coding language, that would look like: IContractOrd = new IBApi.Contract() IContractOrd.Symbol="SPY" IContractOrd.secType="BAG" IContractOrd.exchange="SMART" IContractOrd.currency="USD" IContractOrd.ComboLegs = new List<ComboLeg>()
// create all your legs (see API doc), then:
IContractOrd.ComboLegs.Add(leg1) IContractOrd.ComboLegs.Add(leg2)
IContractOrd.ComboLegs.Add(leg3)IContractOrd.ComboLegs.Add(leg4) IOrder = new IBApi.Order() IOrder.OrderRef = "4faf0786-dddd-4554-8307-05204548b17b" IOrder.account="U123456" IOrder.action = "SELL"
IOrder.orderType = "LMT"
IOrder.tif="GTC" IOrder.totalQuantity = 5
IOrder.transmit = true?? //you need to transmit to get whatif response. In this case, it does NOT transmit the order to the market!IOrder.WhatIf = true???? // Make sure you set this to true ! IBApi.placeOrder(NextOrderId,IContractOrd,IOrder ) Indeed you are right, about spreads or more complex strategies: combo margin is way less than leg-by-leg order. You can see an example here : This is an SPY Iron Condor. If you send 4 separate orders, you'll be required $68.366 margin. If you send a combo order, IB will require only $2.500 margin! These computations are done through whatif orders. And yes, you can create combos with many more than 2 legs, including mixing options and underlying stock. |
Margin for generic orders basket, multiple legs
Hi,
I know how to get the margin impact for a single product order using whatif, but I need to compute the margin impact of an orders basket. This is important for different trades such as multilegs future spreads, currencies, or any other basket. How can it be achieved? Note that summing the margin of single positions does not give the correct result, since for example a long gbpusd and long usdjpy position will partially reduce the net usd position, so the margin will be lower that the sum of the individual gbpusd and usdjpy positions. The same applies to future spreads, which can have reduced margins, but IB only supports combos spreads with 2 legs, so for more than 2 legs the whatif does not work. This is a general problem, so I hope a solution is possible without having to code all the margin calculation, or having to place everytime different simulated orders on the paper account, checking the initial and final margin, and then closing them before making another margin estimation. Thanks |