Type/to search

Đẩy thông báo thay đổi vị thế Bitmex qua WeChat (giao thức wss, cần ID API Bitmex)

Study
3
Follow
1508
Followers

Sử dụng giao thức websocket và phương pháp lấy chữ ký HMAC mới nhất của nền tảng, khi vị thế có thay đổi thì đẩy thông báo đến WeChat.

Source
JavaScript
function main() {
    var APIKEY = "your Access Key(Bitmex API ID)"
    var expires = parseInt(Date.now() / 1000) + 10
    var signature = exchange.HMAC("sha256", "hex", "GET/realtime" + expires, "{{secretkey}}")//secretkey在执行时自动替换,不用填写
    var client = Dial("wss://www.bitmex.com/realtime", 60)
    var auth = JSON.stringify({args: [APIKEY, expires, signature], op: "authKeyExpires"})
    var pos = 0
    client.write(auth)
Comment
All comments (2)

    这个需要传入API的私钥吗?会不会不安全?

    8 years ago

    不需要,看策略代码

    8 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)