Replies: 5 comments 21 replies
-
Usually works again when I restart the IB Gateway and stack handler. Do you guys usually update always to the latest version of IB Gateway? |
Beta Was this translation helpful? Give feedback.
-
I had this problem but restarting the stack handler did the trick (I didn't have to restart the gateway). More worrying, this shouldn't crash - it should fail gracefully and carry on running, since psystemtrade is designed to recover from eg short internet outages. I wonder if the error being thrown is due to the refactoring done by @tgibson11 |
Beta Was this translation helpful? Give feedback.
-
This may not be your issue (unless you use a USB wifi adapter), but I'll tell you my experience anyway. I had been losing the connection several times per week. After trying different things, I eventually tried buying a new USB Wifi adapter, and that solved the problem. I haven't had a single lost connection for months now. This site led me to my solution: https://github.com/morrownr/USB-WiFi TL;DR, "there are only 2 companies supplying chipsets for USB Wifi adapters - Mediatek and Realtek." And Realtek does not make standards-compliant drivers that can be supported directly in the linux kernel. Compounding the problem is that the 2 most popular brands of USB wifi adapter will switch chipsets without changing the model number, so you don't know what chipset you'll get before buying one of their products. |
Beta Was this translation helpful? Give feedback.
-
So, the error is ultimately coming from tick_data.py, line 245 (analyse_for_tick). This returns missing_data (not missing_contract, which is the only thing I've touched so far.). So I think I'm exonerated. This is exactly the type of error I'm trying to eliminate with my refactoring. |
Beta Was this translation helpful? Give feedback.
-
I've had many crashes of IB gateway over the past 4 months. It subjectively seems to occur more often when logged into paper trading but happens with live trading as well. Most of the time this seems to happen during the overnight NA reset 23:45 - 00:45 ET. I'll wake up in the morning and find the dialog box open asking me if I want to reconnect. I click reconnect and it usually does so immediately.
So I run interactive_control, stop both processes, then run them again by either pasting the crontab code line in a terminal or changing the cron time to a few minutes from present then changing it back later. Since most of the crashes seem to happen overnight for me there are usually no problems with orders since the markets are mostly not in permitted trading hours. |
Beta Was this translation helpful? Give feedback.
-
Hi Everyone,
Just wanted to check whether any of you frequently experience in live trading stack handler crashes due to IB market data farm connection getting broken. Happens to me quite a lot.
2022-12-07 15:49:16 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'strategy_name': 'prod', 'instrument_code': 'CAD_micro', 'contract_order_id': 129, 'instrument_order_id': 153} Sending order (Order ID:129) Type best for prod/CAD_micro/20221200, qty [-1], fill [0]@ price, None Parent:153 Children:no_children to algo sysexecution.algos.algo_original_best.algoOriginalBest
2022-12-07 15:49:16 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractData'} Reqid -1: 2119 Market data farm is connecting:usfuture
2022-12-07 15:49:16 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibContractPositionData'} Reqid -1: 2119 Market data farm is connecting:usfuture
2022-12-07 15:49:16 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractPriceData'} Reqid -1: 2119 Market data farm is connecting:usfuture
2022-12-07 15:49:16 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractPriceData'} Reqid -1: 2119 Market data farm is connecting:usfuture
2022-12-07 15:49:17 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:17 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibContractPositionData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:17 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractPriceData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:17 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractPriceData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:23 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:23 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibContractPositionData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:23 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractPriceData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
2022-12-07 15:49:23 {'type': 'stack_handler', 'broker': 'IB', 'clientid': 376, 'component': 'ibFuturesContractPriceData'} Reqid -1: 2103 Market data farm connection is broken:usfuture
Traceback (most recent call last):
File "/home/pysystemtrade/opt/pysystemtrade/sysproduction/linux/scripts/run.py", line 65, in
func(*args, **kwargs)
File "/home/pysystemtrade/opt/pysystemtrade/sysproduction/run_stack_handler.py", line 11, in run_stack_handler
price_process.run_process()
File "/home/pysystemtrade/opt/pysystemtrade/syscontrol/run_process.py", line 103, in run_process
self._main_loop_over_methods()
File "/home/pysystemtrade/opt/pysystemtrade/syscontrol/run_process.py", line 126, in _main_loop_over_methods
timer_class.check_and_run()
File "/home/pysystemtrade/opt/pysystemtrade/syscontrol/timer_functions.py", line 124, in check_and_run
self.run_function()
File "/home/pysystemtrade/opt/pysystemtrade/syscontrol/timer_functions.py", line 299, in run_function
self._function()
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/stack_handler/create_broker_orders_from_contract_orders.py", line 43, in create_broker_orders_from_contract_orders
self.create_broker_order_for_contract_order(contract_order_id)
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/stack_handler/create_broker_orders_from_contract_orders.py", line 59, in create_broker_order_for_contract_order
algo_instance_and_placed_broker_order_with_controls = self.send_to_algo(
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/stack_handler/create_broker_orders_from_contract_orders.py", line 254, in send_to_algo
placed_broker_order_with_controls = algo_instance.submit_trade()
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/algos/algo_original_best.py", line 58, in submit_trade
placed_broker_order_with_controls = self.prepare_and_submit_trade()
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/algos/algo_original_best.py", line 106, in prepare_and_submit_trade
okay_to_do_limit_trade = limit_trade_viable(ticker_object = ticker_object,
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/algos/algo_original_best.py", line 220, in limit_trade_viable
if adverse_size_issue(ticker_object, wait_for_valid_tick=True, log=log):
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/algos/algo_original_best.py", line 340, in adverse_size_issue
latest_imbalance_ratio_exceeded = _is_imbalance_ratio_exceeded(
File "/home/pysystemtrade/opt/pysystemtrade/sysexecution/algos/algo_original_best.py", line 358, in _is_imbalance_ratio_exceeded
latest_imbalance_ratio = current_tick_analysis.imbalance_ratio
AttributeError: 'named_object' object has no attribute 'imbalance_ratio'
Beta Was this translation helpful? Give feedback.
All reactions