开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Stock screener not working anymore after automatically disconnect and connect at 6.00


 

My own source code has a stock screener. This was functioning fine. Since several weeks (I guess after I was forced to update from my 2024 version but I don't know for sure) the scanner stops working after it automatically disconnects and then reconnects every day at 6.00AM see log blow. Why?
?
I don't know where to search, was it the update, bug in my code, problem with Mexem, etc. See my errors from my code.
?
[2025-04-15 02:04:52] ScannerData found stock to analyze. 7002 - Rank: 39, Symbol: HKPD, SecType: STK, Currency: USD, Distance: , Benchmark: , Projection: , Legs String:?
[2025-04-15 02:04:52] ScannerData found stock to analyze. 7002 - Rank: 40, Symbol: SHMD, SecType: STK, Currency: USD, Distance: , Benchmark: , Projection: , Legs String:?
[2025-04-15 02:05:20] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 02:05:48] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
...
[2025-04-15 05:44:36] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 05:45:11] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 05:45:33] Error. Id: -1, Code: 2157, Msg: Sec-def data farm connection is broken:secdefnj
[2025-04-15 05:45:45] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 05:45:47] Error. Id: -1, Code: 2158, Msg: Sec-def data farm connection is OK:secdefnj
[2025-04-15 05:46:16] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 05:46:49] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
...
[2025-04-15 05:59:38] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 06:00:00] Connection Closed
[2025-04-15 06:00:00] Sleeping 10 seconds before next attempt
[2025-04-15 06:00:10] Attempt 23 of 50
[2025-04-15 06:00:10] Error. Id: -1, Code: 504, Msg: Not connected
[2025-04-15 06:00:10] Connecting to 127.0.0.1:4001 clientId:0
[2025-04-15 06:00:10] Error. Id: -1, Code: 502, Msg: Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled and connection port is the same as "Socket Port" on the TWS "Edit->Global Configuration...->API->Settings" menu. Live Trading ports: TWS: 7496; IB Gateway: 4001. Simulated Trading ports for new installations of version 954.1 or newer: ?TWS: 7497; IB Gateway: 4002
[2025-04-15 06:00:10] Cannot connect to 127.0.0.1:4001 clientId:0
[2025-04-15 06:00:10] Sleeping 10 seconds before next attempt
[2025-04-15 06:00:20] Attempt 24 of 50
[2025-04-15 06:00:20] Error. Id: -1, Code: 504, Msg: Not connected
[2025-04-15 06:00:20] Connecting to 127.0.0.1:4001 clientId:0
[2025-04-15 06:00:21] Connected to 127.0.0.1:4001 clientId:0
[2025-04-15 06:00:21] Account List: Uxxxxx
[2025-04-15 06:00:21] Next Valid Id: 1
[2025-04-15 06:00:21] Error. Id: -1, Code: 2104, Msg: Market data farm connection is OK:usfarm
[2025-04-15 06:00:21] Error. Id: -1, Code: 2106, Msg: HMDS data farm connection is OK:ushmds
[2025-04-15 06:00:21] Error. Id: -1, Code: 2158, Msg: Sec-def data farm connection is OK:secdefnj
[2025-04-15 06:00:22] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 06:00:51] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 06:01:27] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:no items retrieved
[2025-04-15 06:01:48] Error. Id: -1, Code: 2105, Msg: HMDS data farm connection is broken:ushmds
[2025-04-15 06:01:48] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:HMDS server disconnect occurred. ?Attempting reconnection...
[2025-04-15 06:01:55] Error. Id: -1, Code: 2106, Msg: HMDS data farm connection is OK:ushmds
[2025-04-15 06:01:55] Error. Id: 7002, Code: 165, Msg: Historical Market Data Service query message:HMDS server connection was successful.
[2025-04-15 06:12:48] Error. Id: -1, Code: 2103, Msg: Market data farm connection is broken:usfarm
[2025-04-15 06:12:49] Error. Id: -1, Code: 2104, Msg: Market data farm connection is OK:usfarm
[2025-04-15 06:17:48] Error. Id: -1, Code: 2103, Msg: Market data farm connection is broken:usfarm
[2025-04-15 06:17:49] Error. Id: -1, Code: 2104, Msg: Market data farm connection is OK:usfarm
[2025-04-15 06:18:49] Error. Id: -1, Code: 1100, Msg: Connectivity between MEXEM and Trading Platform has been lost.
[2025-04-15 06:18:49] Error. Id: -1, Code: 1100, Msg: Connectivity between MEXEM and Trading Platform has been lost.
[2025-04-15 06:18:54] Error. Id: -1, Code: 1100, Msg: Connectivity between MEXEM and Trading Platform has been lost.
[2025-04-15 06:19:01] Error. Id: -1, Code: 1100, Msg: Connectivity between MEXEM and Trading Platform has been lost.
[2025-04-15 06:19:03] Error. Id: -1, Code: 1100, Msg: Connectivity between MEXEM and Trading Platform has been lost.
[2025-04-15 06:19:08] Error. Id: -1, Code: 1100, Msg: Connectivity between MEXEM and Trading Platform has been lost.
[2025-04-15 06:19:14] Error. Id: -1, Code: 1102, Msg: Connectivity between MEXEM and Trading Platform has been restored - data maintained. All data farms are connected: usfarm; ushmds; secdefnj.