EventLoop-return
This JSON is the data structure returned by the EventLoop() function. The EventLoop() function monitors the following events: 1. Any WebSocket readable data events; 2. Completion events of concurrent tasks from exchange.Go() and HttpQuery_Go() functions; 3. Message events sent by threads created using the threading.Thread() function in JavaScript language strategies.
Attributes
| Name | Type | Description |
Seq | number | Event sequence number. |
Event | string | Event name. |
ThreadId | number | Event thread ID. |
Index | number | Event index. |
Queue | number | Number of events still waiting in the queue when this event is returned. |
Nano | number | Nanosecond timestamp. |
See Also
Remarks
When using the exchange.Go() function for concurrent requests, the event data structure returned by the EventLoop() function.
json
{
"Seq":1,
"Event":"Exchange_GetTrades",
"ThreadId":0,
"Index":3,
"Queue":0,
"Nano":1682068771309583400
}
When concurrent execution threads in JavaScript language strategies (created by the threading.Thread() function) use the thread object's postMessage() function to send messages, the EventLoop() function in the receiving thread will monitor the following event data structure:
json
{
"Seq":4,
"Event":"thread",
"ThreadId":1,
"Index":0,
"Queue":0,
"Nano":1727592066508674000
}
Ticker and order events pushed by the exchange (Event is tick or order, and Index is the index of the exchange object) also carry a Symbol field plus a Ticker (Ticker structure) or Order (Order structure) field.