Проблема с подключением к TWS
Atom
21.11.2022


Некоторое время назад подключение работало, хотя и не стабильно: постоянно были трудности со скачиванием тикеров, после добавления тикера не хотел скачивать историю по любым временным интервалам.
Сейчас прекратил вообще подключаться.
Исходные данные:
TWS (10.19.1g, NOV 15, 2022) работает на той же Win машине, что и Hydra (5.0.131).
Задание на один единственный тикер с таймфреймом 1 день.
Подключение к 127.0.0.1 к измененному порту (изменил во время отладки).


Подключение проходит проверку, хотя и со странностями.
Логи показывают, что коннектор шлет сообщения в TWS API.

А TWS API их принимает и закрывает соединение

2022-11-21 12:00:17.890 [CU] INFO [JTS-SocketListener-66] - State: HEADER, IsAPI: UNKNOWN
2022-11-21 12:00:17.890 [CU] INFO [JTS-SocketListener-66] - State: STOP, IsAPI: YES
2022-11-21 12:00:17.891 [CU] INFO [AWT-EventQueue-0] - ArEServer: Adding 2124194153 with id 2147483647
2022-11-21 12:00:17.892 [CU] DEBUG [AWT-EventQueue-0] - MDConnectionsModel: Added [0:0:0:0:0:0:0:1:53699 CLIENT PENDING -]
2022-11-21 12:00:17.892 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:SYS] Starting new conversation with client on 0:0:0:0:0:0:0:1
2022-11-21 12:00:17.892 [CU] INFO [JTS-EServerSocketNotifier-151] - Starting async queue thread
2022-11-21 12:00:17.893 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:SYS] Server version is 163
2022-11-21 12:00:17.893 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:SYS] Client version is 163
2022-11-21 12:00:17.893 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:SYS] is 3rdParty true
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:INFO] Start processing incoming messages for client {2147483647} using pacer.
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:INFO] Handling incoming StartApi(71) message.
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:DET] Started reading message:
2022-11-21 12:00:17.895 [CU] DEBUG [JTS-EServerSocket-150] - Start API message, ClientID=0
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:DET] Finished reading message:
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:DET] StartApi(71)::[version=2]
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:DET] [2;0;null]
2022-11-21 12:00:17.895 [CU] DEBUG [JTS-EServerSocket-150] - Starting new thread: JTS-EMsgPacer-153
2022-11-21 12:00:17.895 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:INFO] Handling incoming SetLogLevel(14) message.
2022-11-21 12:00:17.896 [CU] INFO [JTS-EServerSocket-150] - Ignoring API request 'jextend.cC' since API is not accepted.
2022-11-21 12:00:17.896 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:INFO] Close call made for client{2147483647} socket connection.
2022-11-21 12:00:17.896 [CU] INFO [JTS-EServerSocket-150] - Cleaning up [serverId: 2147483647]...
2022-11-21 12:00:17.896 [CU] INFO [JTS-EServerSocket-150] - Cleaning up [serverId: 2147483647]...
2022-11-21 12:00:17.896 [CU] INFO [JTS-EServerSocket-150] - Cleaning up [serverId: 2147483647]...
2022-11-21 12:00:17.896 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:DET] closePrim called. Stopping all mkt data and HMDS requests for client{2147483647}.
2022-11-21 12:00:17.897 [CU] INFO [JTS-EServerSocket-150] - ArEServer: Removing 2124194153 with id 2147483647
2022-11-21 12:00:17.897 [CU] INFO [JTS-EServerSocket-150] - ============ EServerSocket messages stats ============
2022-11-21 12:00:17.897 [CU] INFO [JTS-EServerSocket-150] - Number of socket messages pushed to updates queue: 1
2022-11-21 12:00:17.897 [CU] INFO [JTS-EServerSocketNotifier-151] - Terminating async queue thread
2022-11-21 12:00:17.897 [CU] INFO [JTS-EServerSocket-150] - Number of socket messages sent directly: 0
2022-11-21 12:00:17.898 [CU] INFO [JTS-EServerSocket-150] - =======================================================
2022-11-21 12:00:17.898 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:INFO] Closed API client{2147483647} session.
2022-11-21 12:00:17.898 [CU] INFO [JTS-EServerSocket-150] - There are no API orders being processed.
2022-11-21 12:00:17.898 [CU] INFO [JTS-EServerSocket-150] - SecDefRequestTimeOut: There are no timed out SecDef requests.
2022-11-21 12:00:17.898 [CU] DEBUG [AWT-EventQueue-0] - MDConnectionsModel: Updated [0:0:0:0:0:0:0:1:53699 CLIENT CLOSING -]
2022-11-21 12:00:17.896 [CU] DEBUG [JTS-EMsgPacer-153] - Process messages start
2022-11-21 12:00:17.899 [CU] INFO [JTS-EWriter2-152] - [2147483647:163:163:1:0:0:0:INFO] Client{2147483647} already closing or closed.
2022-11-21 12:00:17.898 [CU] INFO [JTS-EServerSocket-150] - UnhandledOrderPresetRequest: There are no unprocessed order preset requests.
2022-11-21 12:00:17.900 [CU] INFO [JTS-EWriter2-152] - [2147483647:163:163:1:0:0:0:SYS] Writer thread terminated for socket client{2147483647}.
2022-11-21 12:00:17.900 [CU] DEBUG [JTS-EMsgPacer-153] - intervalStartTime: 1669028417900
2022-11-21 12:00:17.901 [CU] DEBUG [JTS-EMsgPacer-153] - queueSize: 1
2022-11-21 12:00:17.901 [CU] DEBUG [JTS-EMsgPacer-153] - maxNumOfMessagesAtTimeInterval: 1
2022-11-21 12:00:17.901 [CU] DEBUG [JTS-EMsgPacer-153] - timeStepNum: 0; maxNumOfMessagesAtTimeStep: 1
2022-11-21 12:00:17.901 [CU] INFO [JTS-EServerSocket-150] - [2147483647:163:163:1:0:0:0:SYS] Ending conversation with client{2147483647} at 0:0:0:0:0:0:0:1
2022-11-21 12:00:17.901 [CU] DEBUG [JTS-EMsgPacer-153] - Processing message: StartApi(71)::[version=2]
2022-11-21 12:00:17.902 [CU] INFO [JTS-EMsgPacer-153] - [2147483647:163:163:1:0:0:0:DET] Start validating message:
2022-11-21 12:00:17.902 [CU] INFO [JTS-EMsgPacer-153] - [2147483647:163:163:1:0:0:0:DET] Finished validating message:
2022-11-21 12:00:17.902 [CU] INFO [JTS-EMsgPacer-153] - [2147483647:163:163:1:0:0:0:DET] Started processing message:
2022-11-21 12:00:17.902 [CU] INFO [JTS-EMsgPacer-153] - [0:163:163:1:0:0:0:DET] Finished processing message:
2022-11-21 12:00:17.902 [CU] DEBUG [JTS-EMsgPacer-153] - Process messages end, completed in 2 ms
2022-11-21 12:00:17.902 [CU] INFO [AWT-EventQueue-0] - [0:163:163:1:0:9:1:INFO] Sending next valid order id.
2022-11-21 12:00:17.903 [CU] DEBUG [AWT-EventQueue-0] - Deleting logs created >= 7 day(s) ago [logFileTypes=[API, API_ENCRYPTED]]...
2022-11-21 12:00:17.925 [CU] DEBUG [AWT-EventQueue-0] - Checking timestamps [count=222,filenames=[много файлов]]...
2022-11-21 12:00:17.934 [CU] DEBUG [AWT-EventQueue-0] - Opened a new encrypted log: файл
2022-11-21 12:00:17.935 [CU] INFO [AWT-EventQueue-0] - [0:163:163:1:0:9:1:DET] [9;1;1]
2022-11-21 12:00:22.896 [CU] DEBUG [AWT-EventQueue-0] - MDConnectionsModel: Removed [0:0:0:0:0:0:0:1:53699 CLIENT CLOSING -]

По идее, коннектор должен еще прочитать nextOrderID, но соединение уже закрыто и дальше ничего не работает.
Коннектор, вроде как, шлет все сообщения сразу при подключении, хотя код обфусцирован, там особо не разберешься.

Может кто указать в какую сторону посмотреть чтобы решить проблему?
Кто-нибудь сталкивался с подобным?
image5409.png 14 KB (31) image5393.png 84 KB (31)




Добавить файлы через драг-н-дроп, , или вставить из буфера обмена.

loading
clippy