开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育
Date   
How to get IV data for option chains? 7
I'm able to get the IV of every option by requesting market data and looking at the "Option Implied Volatility" tick from tickGeneric. The issue is that I can't request market data for the entire option chain (or can I?). So, how do I get the IV of the entire chain? This the value the I'm trying to get (the one on the right) Thank you!
Started by uselessblack@... @ · Most recent @
Trading Future CME Group Long/Short contract 4
Hello, I would like to open 2 positions on CME Group NQ (Nasdaq 100 Future contract). First position must be long with 2 contacts and second position short with 1 contract (the second position is considered as hedging in case if the market moves suddenly). Question: is it possible through the api to open and hold the 2 positions on the same time ? (the second position will not close 1 contract from the first position) Thanks
Started by zzitounti@... @ · Most recent @
Eurex orderbook lines missing
Requesting Market Depth (L2) data of Eurex futures (FDAX, FDXM, FGBL) with 10 lines (orderbook levels) currently I only get lines 1 to 5 with 'normal' price (index) data and lines 6 to 10 with more or less constant values not related to the top bid/ask price changes. This phenomenon started 9. Aug. at 06:00 (UTC+2) and currently goes on. I try to find out if this is genuine missing data from the exchange (caused by low liquidity?) or maybe caused by some software issues/effects (at IB or my side).
Started by Greg Angelow @
default histogram period
Hi all, I'm trying to reproduce the BookTrader window. I'm able to get the histogram column, but I don't know the default period used, so I'm unable to get the actual value. Example: using '1 day' period I get volume 5000 over the BookTrader window and by the api I get the volume 6124 to the same price (MES contract today) using REALTIME market data. Someone knows the default period of the BookTrader Histogram column? Best Regards, Fernando
Started by Fernando Ribeiro @
Trailing Stop/Stop-Loss Combo 13
Hey guys, I have created a Python program that connects to the TWS API and places bracket trades when certain market conditions are met. The program is working as intended with one exception. I would like to be able to place a combined Stop Loss and Trailing Stop Loss instead of just a Stop Loss to take advantage of this combo in an attempt to reduce losses. An article on Investopedia refers to the strategy as being available on Active Trades and provides the following example which illustrates exactly what I am seeking... "For example, you could set a stop-loss at 2% below the current stock price and a trailing stop at 2.5% below the current stock price. As share price increases, the trailing stop will surpass the fixed stop-loss, rendering it redundant or obsolete." This is exactly the behaviour I would like for my bracket trades. As I was unable to find a way to do this in a single order (I thought there might be an option to add a Stop Loss to a Trailing Stop Loss or visa versa), I instead placed an additional child order. So I have the following: Parent > child: Take Profit > child: Stop Loss > child: Trailing Stop Loss This is submitted and works perfectly, with one unfortunate exception. In the scenario when the Trailing Stop Loss moves to the exact price of the Stop Loss and remains there as the price movement reverses, if the Stop Loss/Trailing Stop Loss orders are triggered together, both orders are filled, so I end up with one of the orders closing out my position, and the other opening a new position for the same quantity. Is there a way to do either of the following: 1) Include a Stop Loss within a Trailing Stop Loss order (or visa versa) 2) Cancel the Stop Loss order when the Trailing Stop Loss reaches or moves beyond the Stop Loss price I very much appreciate any insights to this issue. Regards, Scott.
Started by scott_hopgood@... @ · Most recent @
"Ignore Rth" Error with PriceCondition 6
I am using C# TWS API and my code has been working fine with most of the APIs being used. REcently I wanted to try PriceCondition to the order but after the order was submitted, I got an error from EWrapper. Here is a code snippet how I add the PriceCondition. The rest of the code has been working for 2 years so I won't worry about it. var priceCondition = new PriceCondition(); priceCondition.Price = 125.00 priceCondition.ConId = contract.ConId; priceCondition.IsMore = true priceCondition.Exchange = contract.Exchange; order.Conditions.Add(priceCondition); order.ConditionsCancelOrder = true; order.OutsideRth = true; order.ConditionsIgnoreRth = true; It doesn't matter what value i set to OutsideRth and ConditionsIgnoreRth. I always got this error. errorCode:320,str:Error reading request. Unable to parse field: 'Ignore Rth' for input string: 'o',advancedOrderRejectjson:, Has anyone hit this issue before?
Started by Robby @ · Most recent @
TWS not connecting throwing a timeout error as port is stuck in (CLOSE_WAIT) state 4
Hey, guys. I hope everyone is doing great. I have a sporadic problem occurring when I cannot connect with TWS, it gives a timeout error, and on checking the port it's usually stuck in the CLOSE_WAIT status and only way I can clear that is by restarting TWS. Can someone please explain why the port goes stuck into CLOSE_WAIT state, what are the ways to avoid that? My personal understanding is it happens when the client doesn't disconnect properly, but in my strategy I have handled exceptions etc and have made sure to call disconnect() at the end. This only time I connect is at the opening bell to trade i.e. 9.30 Eastern Time, most of the times it works like a charm, but sometimes it doesn't. One important thing to mention, we have a basic flask backend to respond on HTTP requests to track TWS status & which account is logged into through this code: def is_port_open(port): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(1) # 1 second timeout result = sock.connect_ex(('127.0.0.1', port)) sock.close() return result == 0 def check_tws_account_status(): paper_port = 7497 dollar_port = 7496 if is_port_open(paper_port): return 'paper' elif is_port_open(dollar_port): return 'dollar' else: return 'none' Do you think this may have been causing the issue? I would really appreciate any resources to understand this CLOSE_WAIT status situation. Thanks!
Started by mubbashirali35@... @ · Most recent @
Create a self updating list of executions 2
Is there a possibility to create a self-updating list of executions iwthin the API? Right now I use every account update to pull executions for the updated contract and isolate the last trade but there must be a more elegant way to do this.
Started by domahan@... @ · Most recent @
irregular behavior of cancelled orders
Hi: After recent TWS updates I started to observe some irregular behavior of cancelled orders, that never happened before. I catch an OpenOrder order cancelled message as usual, but the order appears to be stuck in TWS after that. When mouse over in TWS it says 'Active on CFE', however it appears not be active at all, as it doesn't get executed after all even when the limit price is good to be executed. When I proceed to cancel it in TWS manually, my app catches the error 202 (order cancelled), although it's already been accounted for as cancelled before based on the OpenOrder message. There's no apparent reason for this happening as I made no changes to my app in weeks. And it only happened to my futures orders so far. Anyone else observe the same recently?
Started by bespalex @
secID empty 3
I am trying to retrieve all executions with according ISIN by using secID but the response to secID seems to be empty. Can anyone tell me what I am doing wrong? ... class TradingApp(EWrapper, EClient): def __init__(self): EClient.__init__(self, self) def position(self, account: str, contract: Contract, position: Decimal, avgCost: float): print("Position.", "Account:", account, "Symbol:",contract.symbol,"secId:", contract.secId, "Position:", position, "Avg cost:", avgCost) def positionEnd(self): print("PositionEnd") ... Response: Position. Account: **** Symbol: AAPL secId: Position: **** Avg cost: **
Started by domahan@... @ · Most recent @
Sometimes no data delivered by callback 14
Dear Community, i have noticed that some historical Data requests seem to go "unanswered" somehow. I compared the tws log and the api log which are set to full detail. In the tws log there are the requested bars that were requested, but in the api logs they are missing. Does someone have any information about this ? regards Simon
Started by simon.meier1987@... @ · Most recent @
Missing Days on historical request 2
Two weeks in a row I'm not getting data for all the days. Futures contracts (ES, NQ, CL, etc.). This week the data for 7/31 is missing. I've tried to download it 2 evenings in a row and the first night (Wednesday night) I received nothing, and last night (Thursday) I got the thursday 8/1 data. In all cases the start date is 7/30 @ 18:00EDT. Last week the data showed up when I tried again on Sunday evening. Dale
Started by Dale Joyce @ · Most recent @
Triggered SEC Rule 201 flag 4
How does a TWS-API application access the TWS triggered SEC Rule 201 ("Short Sale Price Test Circuit Breaker") indicator from the TWS API?
Started by Kevin R Keane @ · Most recent @
Market order requires cash quantity 2
I'm trying to place a MKT order as follows: ``` var order = new Order { Action = "BUY", OrderType = "MKT", TotalQuantity = (decimal)0.000015 }; clientSocket.placeOrder(GenerateId(), contract, order); ``` The contract is BTC (bitcoin by Paxos). But I'm getting the following error: Error! id: 1721833816, errorCode: 10289, errorMsg: You must set Cash Quantity for this order Any idea why? As I saw for a MKT order only the (unit) quantity is needed, not cash.
Started by Yonatan Doron @ · Most recent @
sqqq and tqqq 1 minute historical data.
good day to all the experts in this group. i need 1 minute historical data for sqqq and tqqq going back to 2018 in order to import it to ninjatrader 8. some months ago one could connect ib's data feed to ninjatrader and the platform could download the data. however, nt disabled this capability recently. as a result, i'm looking for a free tool to use ib to download all historical data for the extended (04:00 to 20:00) session for qqq, sqqq and tqqq to text files. if anyone has any suggestions or advice i will be most grateful. thanks, all the best, regards.
Started by marcos gonzález @
Can't pull NVDA Option Contract Details 8
I am trying to pull contract details (strikes) for NVDA options using Contract Inspector. After 30+ minutes, nothing is returned. Works for other tickers, but not NVDA. Anyone else able to reproduce this or know why? I am using TWS Gateway 10.30.1h.
Started by Crow @ · Most recent @
tax optimizer issue 2
anyone know is it immediately effective (need to wait for some time?) if i change the tax optimizer type. and is it possible to change it through API? and apart from FIFO or LIFO, is it possible to sell my stock dynamically? for example, say, i have 3 positions as below 2024-05-20 100 shares 2024-06-15 200 shares 2024-07-10 300 shares can i choose selling the 200 shares in 2024-06-15 first? thanks!
Started by alan chau @ · Most recent @
Scanner sometimes blocks forever 3
Still quite new to this API so hopefully making a silly error... This code worked out of hours: topPercentLoserListed = ScannerSubscription(instrument='STK', locationCode='STK.US.MAJOR', numberOfRows=2, scanCode='TOP_PERC_LOSE', abovePrice='5', aboveVolume='500000') bot = ib.reqScannerData(topPercentLoserListed) ...but tried running it now and it just blocks forever. Anyone experienced this? The same but with TOP_PERC_GAIN works fine. Although there is an error message after it runs: Error 162, reqId 67980: Historical Market Data Service error message:API scanner subscription cancelled: 67980 Is this because I'm doing something wrong? Thanks Nick
Started by NickW @ · Most recent @
C++ TWS API reqContractDetails() & reqSecDefOptParams() 3
Hi, Why are these two tasks so slow? I am trying to create an interactive application where a user can just give a ticker, and basic settings like maximum days to expiration, ITM/OTM, and set a minimum dollar value purchase to alert on when a large purchase is observed on any of the calls or puts for the ticker. (I intend to put this in a production algorithm, but just testing right now to see if I can do this fast) The problem seems to be that when I read in the option chain with reqSecDefOptParams() for the ticker, even when drilling down on current selected settings to reduce the number of contracts to stream at once, they come with contract.conId = 0. I have to then reqContractDetails() again to get conId and its painfully slow. Am I missing something with reqSecDefOptParams()? Should they come with conId's filled out? Has anyone else observed this? Thanks
Started by Brendan Lydon @ · Most recent @
short stock buy-in 11
Hello: what happened today, a part my short stock position went missing, as if I bought it shortly before the open. There was no notification of any kind other than a bulletin later during the day. In this case the price is unknown before the close, when it's calculated based on VWAP. I was lucky today in that the VWA price moved in my direction, but otherwise I could be underwater. Never happened to me before, so I wonder if there's any API mechanism to be made aware of such close-out happening? Right now I have no idea how to account for this abrupt position change at an unknown price other than cease trading for the day.
Started by bespalex @ · Most recent @
Current Image
Image Name
Sat 8:39am