websocket API public subscription channels,websocket Indicates the interface related to subscription market data stream
Websocket Address: wss://mds.liquiditytech.com/v2/public
Python Data Decryption Methods:
def decode_binary_data(binary_data):
decompressed_data = zlib.decompress(binary_data, zlib.MAX_WBITS | 16) # Decompress Binary Data Using zlib
text_data = decompressed_data.decode('utf-8') # Decode the Decompressed Binary Data into Text Data
return text_dat
Restriction Rules:
For Public Users: No Login Required
- With one IP address allowed up to 5 connections, and each connection can subscribe to a maximum of 5 different trading pairs.
For Authenticated Users: Login Required
- One IP address can have a maximum of 40 connections, with each connection able to subscribe to up to 50 different trading pairs.
Rate Limit: 10 requests per second per IP for Subscribe and Unsubscribe.
Login:
Request
Field name | Type | Necessary | Remarks |
---|---|---|---|
action | String | Yes | login |
args | Array | Yes | |
> apiKey | String | Yes | |
> sign | String | Yes | |
> timestamp | String | Yes |
Response
Field name | Type | Necessary | Remarks |
---|---|---|---|
id | Int | No | userid |
code | String | Yes | error code |
msg | String | Yes | error message |
event | String | Yes | login |
Example:
Request:
{
"action": "login",
"args": {
"apiKey": "F94ADC2CDF5842C9A928D73CD7DB3001",
"timestamp": "1733651176",
"sign": "3efe149e3196852c279c5f0f924198a35238d59032af230c1879919032100adb"
}
}
Response:
message{
"id": null,
"event": "login",
"code": "200000",
"msg": "success"
}message{
"id": null,
"event": "login",
"code": "10001",
"msg": "auth failed"
}
Tips:
The server may be disconnected due to cloud service abnormalities, system updates, etc. It is recommended to add automatic reconnection logic.
If you do not subscribe or the server does not push data to the user within 30 seconds after the subscription, the system automatically disconnects the user.
To keep the connection valid and stable, it is recommended that you do the following:
- After receiving a message, the user sets a timer for N seconds. The timer value is less than 30.
- If the timer is triggered (no new message is received within N seconds), send the string 'ping'.
- Expect a literal string 'pong' in response. If you do not receive it within N seconds, issue an error or reconnect.