Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 12:53:41 +0000



TWS Issues 2023-02-07

View Count: 922

[2023-02-07 16:18:58]
User900285 - Posts: 94
Hello,
These are some discoveries I made when testing the current version of Sierra Chart connected to TWS.
I did experience a software crash when trying to load a real-time stock option symbol in Sierra Chart. The other two things are related to issues with sending orders from Sierra Chart to TWS.

This is a currently valid stock option symbol that would have normally provided real-time data through IB: AAPL-OPT-20230210-155-C-SMART-100-USD
I know in the recent post you mentioned disabling real-time data from TWS, it does cause a crash for me when trying to load this symbol.

When loading this symbol onto a chart the message log looks like this:

Interactive Brokers | Subscribing to Symbol: AAPL, SecurityType: OPT, Expiration: 20230210, Exchange: SMART, Primary Exchange: , Currency: USD, Multiplier: 100, CallPut: C, Strike: 155, LocalSymbol: , TradingClass: | 2023-02-07 11:08:06.829
Interactive Brokers | Requesting security definition data for: AAPL-OPT-20230210-155-C-SMART-100-USD. ID: 5 | 2023-02-07 11:08:06.829
Interactive Brokers | Using primary service for historical data for AAPL-OPT-20230210-155-C-SMART-100-USD | 2023-02-07 11:08:06.829
Starting DelayedDownloadMonitoringTimer | 2023-02-07 11:08:06.829
Starting HDTimeoutTimer | 2023-02-07 11:08:06.829
Added historical Intraday data request for AAPL-OPT-20230210-155-C-SMART-100-USD to the queue. | 2023-02-07 11:08:06.829
Intraday data recording state for symbol AAPL-OPT-20230210-155-C-SMART-100-USD is set to download 'Pending'. | 2023-02-07 11:08:06.829
Triggering next historical data download in queue. | 2023-02-07 11:08:06.829
Delaying start of download for AAPL-OPT-20230210-155-C-SMART-100-USD. | 2023-02-07 11:08:06.829
Unsubscribed from market depth data for AAPL-NQTV | 2023-02-07 11:08:11.111
Interactive Brokers | Stopping market orders updates for: AAPL-NQTV. Service code: nasdaq_exchange.data | 2023-02-07 11:08:11.111
Requesting market depth updates for: AAPL-OPT-20230210-155-C-SMART-100-USD if supported. | 2023-02-07 11:08:11.111
Message from IB: Market data farm connection is OK:usopt.nj. IB Error Code: 2104. Request ID: -1. | 2023-02-07 11:08:11.623
Message from IB: Exchanges - Top: BATS; EDGX; PEARL; PHLX; EMERALD; CBOE2; NASDAQBX; MIAX; CBOE; Need additional market data permissions - Depth: AMEX; MERCURY; PSE; ISE; BOX; NASDAQOM; GEMINI; . IB Error Code: 2152. Request ID: 100005. | 2023-02-07 11:08:11.763
HD Request # 2 | Downloading Intraday chart data for AAPL-OPT-20230210-155-C-SMART-100-USD to the file AAPL-OPT-20230210-155-C-SMART-100-USD.scid. Service: interactive_brokers.trading | 2023-02-07 11:08:11.827
HD Request # 2 | Download start date-time: 2023-01-28 11:08:11.000000. File last date-time: 00:00:00.000000 | 2023-02-07 11:08:11.827
HD Request # 2 | Requesting a total of 7 days and 0 seconds. | 2023-02-07 11:08:11.827
HD Request # 2 | IB Backfill - Seconds requested: 86400. Seconds Remaining: 518400. | 2023-02-07 11:08:11.827
HD Request # 2 | Requesting 1 Day of data at 30 secs with ending date-time at 2023-02-01 12:18:11 for AAPL-OPT-20230210-155-C-SMART-100-USD. PriceType:TRADES | 2023-02-07 11:08:11.827
HD Request # 2 | Processing historical data message from TWS | 2023-02-07 11:08:12.137
HD Request # 2 | Receiving Intraday data for AAPL-OPT-20230210-155-C-SMART-100-USD starting at 2023-01-31 12:18:30.000000 | 2023-02-07 11:08:12.137
HD Request # 2 | Received 2881 records and wrote 780 records from 2023-01-26 14:18:00 to 2023-02-01 12:18:00. | 2023-02-07 11:08:12.138
HD Request # 2 | IB Backfill - Seconds requested: 86400. Seconds Remaining: 432000. | 2023-02-07 11:08:12.138
HD Request # 2 | Requesting 1 Day of data at 30 secs with ending date-time at 2023-02-02 12:18:11 for AAPL-OPT-20230210-155-C-SMART-100-USD. PriceType:TRADES | 2023-02-07 11:08:12.138
HD Request # 2 | Processing historical data message from TWS | 2023-02-07 11:08:18.048
HD Request # 2 | Received 2881 records and wrote 780 records from 2023-01-27 14:18:00 to 2023-02-02 12:18:00. | 2023-02-07 11:08:18.049
HD Request # 2 | IB Backfill - Seconds requested: 86400. Seconds Remaining: 345600. | 2023-02-07 11:08:18.049
HD Request # 2 | Requesting 1 Day of data at 30 secs with ending date-time at 2023-02-03 12:18:11 for AAPL-OPT-20230210-155-C-SMART-100-USD. PriceType:TRADES | 2023-02-07 11:08:18.049
HD Request # 2 | Processing historical data message from TWS | 2023-02-07 11:08:27.918
HD Request # 2 | Received 2881 records and wrote 780 records from 2023-01-30 14:18:00 to 2023-02-03 12:18:00. | 2023-02-07 11:08:27.919
HD Request # 2 | IB Backfill - Seconds requested: 86400. Seconds Remaining: 259200. | 2023-02-07 11:08:27.919
HD Request # 2 | Requesting 1 Day of data at 30 secs with ending date-time at 2023-02-04 12:18:11 for AAPL-OPT-20230210-155-C-SMART-100-USD. PriceType:TRADES | 2023-02-07 11:08:27.919
HD Request # 2 | Processing historical data message from TWS | 2023-02-07 11:08:36.036
HD Request # 2 | Received 2880 records and wrote 443 records from 2023-01-31 11:30:00 to 2023-02-03 15:59:30. | 2023-02-07 11:08:36.037
HD Request # 2 | IB Backfill - Seconds requested: 86400. Seconds Remaining: 172800. | 2023-02-07 11:08:36.037
HD Request # 2 | Requesting 1 Day of data at 30 secs with ending date-time at 2023-02-05 12:18:11 for AAPL-OPT-20230210-155-C-SMART-100-USD. PriceType:TRADES | 2023-02-07 11:08:36.037

Sierra Chart is in a state of downloading historical data for around 30 seconds. Then I get the completion message saying it is finished the download, and the software crashes. I replicated it twice to make sure it would happen again and yes.

The next two things are related to direct routed stock orders getting rejected and, a message about 'Outside Regular Trading Hours' for the STOP order type.

When connected to Interactive Brokers, the chart symbol is set to a Sierra Chart Symbol like AAPL-NQTV.
I use a direct routing symbol for the Trade Only Symbol and set Use as Trade Only Symbol to yes.
The symbol used for the Trade Only symbol is AAPL-STK-ISLAND-USD.
The order being sent will get rejected with a message like this:

New order rejected - This order will be directly routed to ISLAND. Direct routed orders may result in higher trade fees. Restriction is specified in Precautionary Settings of Global Configuration/API. Internal Order ID: 3409. Service Order ID: 212. Symbol: AAPL-STK-ISLAND-USD. Account: Account# | 2023-02-07 10:27:33.698 *

Upon enabling the appropriate setting in the TWS API Precautionary settings, this message goes away and the orders send properly.
The setting to enable in TWS is TWS > Global Settings > API > Precautionary > Bypass Redirect Order warning for Stock API Orders.

The second message I was getting every time is this:

Trading message from IB: Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed. Error Code: 2109. ServiceOrderID: 269. InternalOrderID: 3474. | 2023-02-07 10:59:07.551

This order ID is for an attached stop order with the order type STOP. Upon changing the attached stop type to a STOP LIMIT type, this message no longer appears in the Trade Service Log.
It seems this has to do with the way IBKR deals with the STOP order type in after hours trading.
Date Time Of Last Edit: 2023-02-07 16:34:04
[2023-02-07 18:09:34]
Sierra_Chart Engineering - Posts: 17226
The only thing of concern here, is this:
it does cause a crash for me when trying to load this symbol.

However it really makes no sense why there would be an abnormal shutdown of Sierra Chart. Nothing has changed which would cause that. What exactly do you see after the abnormal shutdown? Is there any error message from the operating system.

Try running Sierra Chart in Safe Mode.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-02-07 18:24:03]
User900285 - Posts: 94
I just ran Sierra Chart in safe mode and there is no crash.

The issue is due to a custom study that is hooking into market depth data or market by order data. It is my mistake for leaving this study on the chart when trying to load the Interactive Brokers option contract. I need to troubleshoot that study to see which fields are not valid when using this symbol, and make sure those do not perform calculations.

The real-time data from IBKR is working in Sierra Chart when I load the AAPL stock option symbol mentioned above.

Regarding the abnormal shut down, there is no message from the operating system. The program simply closes. There is no freezing of the user interface. This has occurred for me in the past. In that case I determined it was caused by a custom study making a division by 0.

Thank you.
Date Time Of Last Edit: 2023-02-07 18:26:22
[2023-02-07 19:22:09]
Sierra_Chart Engineering - Posts: 17226
We do see a problem with the processing of the historical data from TWS and we will resolve that now. Not sure that would be causing an abnormal shutdown but it will definitely cause an issue with the processing of historical data.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-02-07 19:26:52]
Sierra_Chart Engineering - Posts: 17226
Actually disregard post #4 that is an incorrect determination. There is no problem with historical data processing. At least not that we have found yet.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account