Trail price movement callbacks?
4
I dont think this exists but wanted to check with the group before giving up. I'm trying to record movements of the stop price on a trailing order, so I can chart the movement of the floor price and understand how close the price is to the floor at any given time. I dont see any relevant events in the order status events, does this info exist? thank you.
|
Error 201 - Error 201, reqId 1067: Order rejected - reason:<h3>Action Required</h3><br>We have identified certain information on your account that needs to be confirmed or corrected in order to avoid a possible trading disruption.
3
Hi, I encountered the following error today: ERROR Error 201, reqId 1067: Order rejected - reason:<h3>Action Required</h3><br>We have identified certain information on your account that needs to be confirmed or corrected in order to<br>avoid a possible trading disruption. Please click <a href="sso://action=ACCT_MGMT">here</a> to review this information. What could this mean? And how to resolve this issue? Ákos
|
Updating a profit target order
3
Hello! I have been trying to fix something for the last few days but I failed. When the code attempts to update a target order belonging to a bracket order, It throws error 135. After logging I confirmed it tries to update the entry order instead of the profit taking order. Everything in the code seems fine. On trade class: def update_profit_target_price(self, broker_instance, new_profit_target): self.profit_order.lmtPrice = new_profit_target self.profit_order.transmit = True broker_instance.placeOrder(self.profit_order.orderId, self.contract, self.profit_order) And on the logic class after being called to update: def update_profit_targets_to_new_fibo_level(self): # when levels change, the profit target for any OPEN positions that were entered in the current session # is updated; the stop loss for the position remains unchanged for t in self.trade_list: assert isinstance(t, Trade) status = t.status_at_broker(self.ib) if status == 'OPEN': # open position: adjust profit target for open position to new level; leave stop loss as is new_profit_target_price = (self.data[self.profit_taking_for_long_positions]) else: new_profit_target_price = (self.data[self.profit_taking_for_short_positions]) LOG.info(f'{self.contract_ticker} ~ update ~ Trade {t.trade_id}: status = {status}, ' f'Profit target for open position will be updated to new level ' f'(${new_profit_target_price})') t.update_profit_target_price(self.ib, new_profit_target_price) Order structure: # Main order (limit order) main_order = Order() main_order.eTradeOnly = False main_order.firmQuoteOnly = False main_order.orderId = entry_order_id main_order.orderRef = f'{self.stamp}_ENTRY' main_order.action = action main_order.orderType = "LMT" main_order.totalQuantity = quantity main_order.lmtPrice = limit_price # This is now the limit price main_order.transmit = False # To ensure the main order isn't transmitted before its children main_order.tif = 'DAY' # Make the order Good-till-Cancelled main_order.outsideRth = False # Enable Outside Regular Trading Hours # Take profit order take_profit = Order() take_profit.eTradeOnly = False take_profit.firmQuoteOnly = False take_profit.orderId = entry_order_id + 1 take_profit.orderRef = f'{self.stamp}_PROFIT_TARGET' take_profit.action = "SELL" if action == "BUY" else "BUY" take_profit.orderType = "LMT" take_profit.totalQuantity = quantity take_profit.lmtPrice = take_profit_price take_profit.parentId = entry_order_id # Important: this ties the order to the parent order take_profit.tif = 'GTC' take_profit.transmit = False take_profit.outsideRth = True # Here is where you set the order to allow execution outside RTH # Stop loss order stop_loss = Order() stop_loss.eTradeOnly = False stop_loss.firmQuoteOnly = False stop_loss.orderId = entry_order_id + 2 stop_loss.orderRef = f'{self.stamp}_STOP_LOSS' stop_loss.action = "SELL" if action == "BUY" else "BUY" stop_loss.orderType = "STP" stop_loss.totalQuantity = quantity stop_loss.auxPrice = stop_loss_price # Stop price stop_loss.parentId = entry_order_id # Important: this ties the order to the parent order stop_loss.tif = 'GTC' stop_loss.transmit = True stop_loss.outsideRth = True # Here is where you set the order to allow execution outside RTH self.entry_order = main_order self.profit_order = take_profit self.stop_loss_order = stop_loss I have been trying to fix it for a while now but running out of options before digging deeper into status at broker. Does anyone see anything I am missing? Learning here, so please go easy on me. thanks in advance for any input, m
|
10326 - OCA group revision is not allowed
5
Has anyone ever experienced the following error when trying to modify bracket orders ? 10326 - OCA group revision is not allowed It is not documented in the API documentation and IB requires detailed TWS logging in order to provide assistance. -- https://www.tradingsoftwarelab.com
|
How are built the Continuous future data retrieved with secType = CONTFUT ?
10
I submit the question to IB assistance 2 months ago, but no answer received until today. So I ask the group: As wrote in the subject: How are built the Continuous future data retrieved with secType = CONTFUT ? The data are a simple concatenation of the data from the different contracts? Or are the data from previous contracts rescaled avoiding gaps? How is the rollover date chosen? By volume change or expiry date or anything else? I did not find any info about on the web. Anyone know the method used by IB to build the Continuous version of futures?
|
downlod historical SH data, Proshares Short S&P 500, before the split
5
Hi, When I'm trying to download the close prices with endDate 2024-11-07 everything is fine: ticker = "SH" contract = Stock(ticker, 'SMART', 'USD', primaryExchange = 'ARCA') bars = ib.reqHistoricalData(contract, endDateTime='20241107 15:59:00 US/Eastern', durationStr='3 Y', barSizeSetting='1 day', whatToShow='TRADES', useRTH=True) But when I change the date to 2024-11-06 i get this: Error 162, reqId 24: Historical Market Data Service error message:Unknown contract, contract: Stock(symbol='SH', exchange='SMART', primaryExchange='ARCA', currency='USD') It must have something to do with the recent reverse split ?
|
IB_apps github project
2
I created a GitHub project for my python code that works with the ibapi. To give an insight to whether it may be useful to you I made an accompanying youtube video that can be found here: https://youtu.be/GUMMNCQjz6k It is still very much a work in progress and I am still working on fixing bugs improving stability, usage is at one's own risk (if you understand this and want to save some time, the introduction of its functionality starts at 3:25). But now that most things are somewhat up and running I figured I might as well share it to see if I can find others that are interested in it. Especially because I realized I need some motivation to work on making it more stable and adding some automated testing to ensure stability of future versions. The project itself can be found here. https://github.com/irrelevantmuch/IB_apps/ If you have questions, remarks or want to discuss something, feel free to message me at: vriesdephilip@...
|
C++ - TWS API - Connection Closed Handling
5
Hello, After upgrading the API to version 10.30.01 the indication of connection closed between the TWS (version 10.30.1p) and the client has stop to work. To verify, I used the Test C++ application (installed with the new API package): Step 1: Launching TWS application Step 2: Launching the Test Application => success to connect - see connection details on TWS) Step 3: Close TWS application => no indication on the client side to connection closed, no error has appeared (TestCppClient::error has not called) TestCppClient::connectionClosed function has not called TestCppClient::isConnected still return "True" Any adviced? Thank you
|
Visual Studio 2022 and C++ TWS API 10.32
8
Visual Studio 2022 and C++ TWS API 10.32 I am trying to compile this but getting some errors. Has anyone been able to get this to work? 1 Project Compiled fine: 1>TwsSocketClientStatic.vcxproj -> E:\Creation\TWS_API\samples\Cpp\TestCppClient\x64\Debug\TwsSocketClientStatic.lib 1>Done building project "TwsSocketClientStatic.vcxproj". ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ========== ========== Rebuild completed at 5:17 PM and took 52.541 seconds ========== 2 Project Compiled fine: ld started at 5:29 PM... 1>------ Build started: Project: TestCppClientStatic, Configuration: Debug x64 ------ 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(531,5): warning MSB8028: The intermediate directory (x64\Debug\) contains files shared from another project (TwsSocketClient.vcxproj). This can lead to incorrect clean and rebuild behavior. 1>Done building project "TwsSocketClientStatic.vcxproj". 1>LINK : fatal error LNK1104: cannot open file 'libbid.lib' 1>Done building project "TestCppClientStatic.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ========== ========== Build completed at 5:29 PM and took 00.411 seconds ========== What does this linking error even mean? Anyone got a walk through to get a basic compile to .EXE ?
|
ValueError: could not convert string to float: b'\xe2\x88\x9e'
6
Using Python api - From time to time i am getting following error and it stops the api thread completely. I can't catch this exception in Main thread. This happens with HistoricalData callback. It is somehow receiving inifinity character as i understand. Is there a way to catch this exception without updating API source code? File "xxx/ibapi-10.30.1-py3.9.egg/ibapiibapi/client.py", line 398, in run File "xxx/ibapi-10.30.1-py3.9.egg/ibapi/decoder.py", line 1506, in interpret File "xxx/ibapi-10.30.1-py3.9.egg/ibapi/decoder.py", line 616, in processHistoricalDataUpdateMsg File "xxx/ibapi-10.30.1-py3.9.egg/ibapi/utils.py", line 135, in decode ValueError: could not convert string to float: b'\xe2\x88\x9e' thanks,
|
Undocumented error codes: 10089 and 10091 ...
6
Using the Interactive Brokers C# TWS API Version 10.19.04 (still very new to this API). Intermittently, I am receiving the following error codes: This error is reported ONCE: - error_code: 10089 - error_msg: Requested market data requires additional subscription for API. See link in 'Market Data Connections' dialog for more details.Delayed market data is available.MSTR NASDAQ.NMS/TOP/ALL Followed by this error message being reported (multiple times): - error_code: 10091 - error_msg: Part of requested market data requires additional subscription for API. See link in 'Market Data Connections' dialog for more details.Delayed market data is available.MSTR NASDAQ.NMS/TOP/ALL I cannot seem to find any mention of the above error codes in the depreciated or current API documentation error codes. Although, there is the error code: 10090 - with the following description: Part of requested market data is not subscribed. Indicates that some tick types requested require additional market data subscriptions not held in the account. This commonly occurs for instance if a user has options subscriptions but not the underlying stock so the system cannot calculate the real time greek values (other default ticks will be returned). Or alternatively, if generic tick types are specified in a market data request without the associated subscriptions. However, my client's account is a "Pro" account and they have a NASDAQ subscription. I was hoping that someone more seasoned with this API may have some detailed information regarding the errors above, other than the obvious as stated in the message itself. Thanks in advance.
|
is there a web application that connects to IB via the TWS API?
5
Hi, Is there a hopefully open source web app that connects to IB via the TWS API, and exposes active positions on an intra-daily live chart? The challenge I'm having is that if I have the TWS Gateway running, then I can´t simultaneously log in to the IB Mobile App to look at my active positions. I´d love to have something that shows the active positions on a chart. I tried TradingView, which can connect to IB, but cannot do so in read-only mode. I wonder if there is something out there that I could run as a web app, would connect to my running TWS Gateway, and would expose active positions on an intra-day chart live via a web interface? Ákos
|
Interactive brokers HK new regulation - TWS no restart, forced lock - API killer?
7
Hello everyone, since about a week ago TWS changed their app in HK due to some regulation they're not sure about. In particular in global settings: - no option for auto restart, but you are still forced to put an auto log off time - no option to never lock TWS, forced to put an amount of minutes after which TWS logs off. At that point my app is still connected to TWS but can't receive prices / send orders. Is IBCAlpha the solution? From memory it can move the auto restart time periodically so the application never actually restarts. Can it also avoid TWS from locking? Would logging in through the gateway avoid these problems? Thanks a lot,
|
where is it best to host a cloud machine to run TWS API?
3
Hi, For the purposes of trading stocks on the US stock market (NYSE & NASDAQ), where is it best to host a cloud machine to run TWS API? Where as in what cloud provider, which hosting location, like AWS us-east or GCP us-east4 or us-east5? Should one assume that 'the closer to New York the better'? Ákos
|
wrong value for VIX iv calling
4
I am getting the wrong value for VIX iv using barchat data ( 11/3/24 at 19:22) https://www.barchart.com/stocks/quotes/$VIX/overview gets me CBOE Volatility Index ($VIX) 21.88 -1.28 (-5.53%) 11/01/24 [INDEX/CBOE] Implied Volatility 75.97% ( -140.04%) I call self.reqHistoricalData( reqId=self.req_id, contract=contract, endDateTime='', durationStr='3 Y', barSizeSetting='1 day', whatToShow='OPTION_IMPLIED_VOLATILITY', # Changed to request IV useRTH=1, formatDate=1, keepUpToDate=False, chartOptions=[] and get Symbol Date Implied Volatility Open High Low Close Volume VIX 2024-11-01 1.11894644 22.96 23.09 21.16 21.88 0
|
BID_ASK historical bars
2
I'm retrieving 5 minutely historical bars. It appears the BID_ASK data for US stocks is in pennies (USD 0.01). I'm surprised since BID_ASK should be a time average, the weighted average is unlikely to be pennies (always). By comparison, OPTION_IMPLIED_VOLATILITY is reported to several more decimal places. Has anyone else noticed a problem with BID_ASK ? Example (json composite object with "sr" and "bar" - "stock request" and historical bar response - components) ``` { "sr": { "symbol": "NVDA", "primary": "NASDAQ", "tradingClass": "NMS", "reqBar": { "endDateTime": "", "durationStr": "21 D", "barSizeSetting": "5 mins", "whatToShow": "OPTION_IMPLIED_VOLATILITY" } }, "bar": { "m_time": "20241031 13:20:00 America/New_York", "m_open": 0.6062792, "m_high": 0.6062792, "m_low": 0.60548548, "m_close": 0.60548548, "m_volume": 1.0, "m_count": 0, "m_wap": 0.6062792044330731 } },{ "sr": { "symbol": "NVDA", "primary": "NASDAQ", "tradingClass": "NMS", "reqBar": { "endDateTime": "", "durationStr": "21 D", "barSizeSetting": "5 mins", "whatToShow": "BID_ASK" } }, "bar": { "m_time": "20241003 09:30:00 America/New_York", "m_open": 121.31, "m_high": 122.0, "m_low": 120.34, "m_close": 121.33, "m_volume": -1.0, "m_count": -1, "m_wap": -1.0 } } ```
|
modelCode
3
Ive been developing a wire protocol and looking for documentation for the modelCode variable in the PNL call. Seems to work if I just send a null string but trying to understand what it does? Could anyone shed some light on it? Or point me in the right direction? [Moderator: changed codeModel to modelCode]
|
How do you combine multiple responses from reqMktData into a single quote with Bid / Ask / Size
5
When subscribing to live data for specific assets, e.g. MSFT and AAPL, it comes in multiple pieces into different callbacks, specifically, tickPrice and tickSize. How do I combine all responses into a single quote for each asset struct Quote { double AskPrice; double BidPrice; double AskSize; double BidSize; } var msftQuotes = new List<Quote>(); var applQuotes = new List<Quote>(); var msft = new Contract { Symbol = "MSFT", Exchange = "NYSE", SecType = "STK", Currency = "USD" }; var aapl = new Contract { Symbol = "AAPL", Exchange = "NYSE", SecType = "STK", Currency = "USD" }; _client.TickSize += message => { if (message.RequestId == 1) msftQuotes.Add( ??? ); }; _client.TickPrice += message => { if (message.RequestId == 1) msftQuotes.Add( ??? ); }; _client.ClientSocket.reqMktData(1, contract, string.Empty, false, false, null); _client.ClientSocket.reqMktData(2, contract, string.Empty, false, false, null);
|
C++ TWS API reqHistogramData()
3
Hello, I am trying to use the reqHistogramData() function from the EClient, and was wondering what scale the size is for futures contracts. I am requesting against the $ESZ4 contract and I receive the prices and sizes, but the sizes are massive numbers. I was expecting to receive size in # of contracts not what looks like a notional value. I am only requesting for 1 day and there is no way this many contracts traded at these prices. Here is the request I am making: m_pClient->reqHistogramData(1, contract, 0, "1 days"), I am using after hours trading right now, as the time of writing this email is pre-market. Here is a price and size I received -> price: 5882.5, size: 3584865303386919523, and they all have these very large numbers for size. Any help is appreciated, thanks.
|
reqFundamentalData and alternative data feed?
8
Can someone out there throw me a bone with some insight/advice into these three questions: 1) Is reqFundamentalData truly deprecated in the latest version? 2) If so, what is the alternative from IB (if there is any)? 3) What are some of you using for a reliable fundamental data feed that provides Company Overview, Financial Summary, Ratios, Statements, and Analyst Estimates. Background: reqFundamentalData suddening stopped working for me around 5:15am EST October 24, 2024. Everything was fine up until then. Since then all I get are details for one contract and then Historical Data Farm goes inactive. I've been working with API support and I am no further ahead (hence the desperation in my tone). They eventually told me that reqFundamentalData has been deprecated in the latest version. I am not entirely convinced of this because it is listed as a public member in the campus documentation. Also, I cannot find anything in the changelogs. And, the fact I am getting complete details for a single contract raises my spidey senses. The latest suggestion is that I use an alternate paid subscription but when I asked if this subscription contains the data that is provided by the "deprecated function", I'm advised to direct my question directly to the support team that provides this subscription. I found out this morning no actual support team exists for this subscription and my issue has been escalated to yet another group. Thanks, Dave
|
41 - 60 з 12923