指令格式

登录订阅格式

{"op":"login","args":["<API_KEY>", "<timestamp>", "<sign>"]}

API_KEY: 为用户申请的APIKey

timestamp: 为时间戳, 单位是毫秒, 超过 60 秒后会过期

sign: 为签名, sign=CryptoJS.HmacSHA256(timestamp + "#" + api_memo + "#" + "bitmart.WebSocket", secret)

示例

假设用户申请的API的值如下所示:

当前时间:timestamp=1589267764859

申请的API_KEY = "80618e45710812162b04892c7ee5ead4a3cc3e56"

申请的API_SECRET = "6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9"

申请的API_MEMO = "test001";

sign=
   echo -n '1589267764859#test001#bitmart.WebSocket' | openssl dgst -sha256 -hmac "6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9"
 (stdin)= 3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556
  • 请求

    {"op": "login", "args": ["80618e45710812162b04892c7ee5ead4a3cc3e56", "1589267764859", "3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556"]}
    
  • 返回

返回不包含error_code字段则表示成功

{"event":"login"}

注意:如果登录失败会自动断开链接

results matching ""

    No results matching ""