You must log in before performing any trading operations. Sending login again while already logged in will be rejected.
Request:
{
"id": "2",
"op": "login",
"args": {
"apiKey": "your-api-key",
"timestamp": "1787042800",
"sign": "base64-signature",
"accountUuid": "sub-account-uuid"
}
}| Field | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | API Key |
| timestamp | string | Yes | Signature timestamp |
| sign | string | Yes | Signature (Base64 encoding) |
| accountUuid | string | No | Sub-account UUID; when specified, trading is performed as that sub-account |
Signature generation :
Signature string: timestamp + "GET" + "/user/verify" + ""
-
Use secretKey to encrypt the signature string with HMAC SHA256
-
Base64 encoding the results
JavaScript example :
const crypto = require('crypto');
function generateSign(timestamp, secretKey) {
const message = timestamp + 'GET' + '/user/verify' + '';
return crypto.createHmac('sha256', secretKey).update(message).digest('base64');
}Python example :
import hmac, base64
def generate_sign(timestamp, secret_key):
message = timestamp + 'GET' + '/user/verify' + ''
signature = hmac.new(bytes(secret_key, 'utf8'), bytes(message, 'utf-8'), digestmod='sha256').digest()
return base64.b64encode(signature).decode()Success response:
{"id": "2", "op": "login", "code": 0, "inTime": 1787042878763, "outTime": 1787042878764}On failure, an error message is returned and the connection is closed.
