Type/to search
33
Follow
63
Followers
Chiến lược dựa trên sự kiện ws có nên được mô tả chi tiết hơn trong tài liệu API không? Đặc biệt là các giao diện cần được xác minh, chẳng hạn như vị trí và số dư.
Help
Created 2019-06-03 10:23:03  Updated 2019-07-31 17:23:08
 11
 2524

Trong tài liệu api của FMZ đã xem một nửa ngày, chỉ có một hàm dials như vậy liên quan đến loại ws, cảm thấy mô tả vẫn chưa đủ rõ ràng, không có hệ thống

Tôi không có trình độ cao, tôi muốn thử bitmex's ws-type api, để có được các thông tin cần xác minh như vị trí, tài khoản, không hiểu chức năng dial, nhưng tôi đã có thể làm điều đó.

Tôi đã gửi một đơn xin việc, và khách hàng đã yêu cầu tôi tự mình đi tìm trường hợp, tìm tài liệu của sàn giao dịch, trường hợp của Strategy Square.

Các trường hợp liên quan đến Strategy Square - sử dụng giao thức websocket và HMAC mới nhất trên nền tảng để lấy chữ ký, thay đổi vị trí đã được chuyển đến WeChat - là một ví dụ điển hình.

Đây là mã cũ, lỗi cũ, xin hãy đổi mã mới, cảm ơn.

Related Recommendations
Comment
All comments (11)

    具体报什么错误?麻烦您问题描述下。
    只说报错,没人知道具体是什么问题的。

    7 years ago
    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) client.write('{"op": "subscribe", "args": "position"}') while (true) { bitmexData = client.read() if(bitmexData.table == 'position' && pos != parseInt(bitmexData.data[0].currentQty)){ Log('position change', pos, parseInt(bitmexData.data[0].currentQty), '@') pos = parseInt(bitmexData.data[0].currentQty) } } }

    这个例子测试过了,没有什么问题,有数据返回。
    您是不是 这个例子里没填 自己的 api ID ?

    var APIKEY = "your Access Key(Bitmex API ID)"

    这个里面 your Access Key(Bitmex API ID) 这个字符串要你替换成自己的 Bitmex 账号 API ID 的。

    7 years ago

    梦总,用这段代码返回的数据,其时间戳,比当前时间要滞后几分钟,例如,我获取bitmex的quote,获取的时间戳ISO时间,折算为北京时间为8月7日6点9分18秒,实际时间为2019-08-07 06:12:37,滞后3分钟,我也跟rest获取的ticker比对,确实错了,这是啥情况呢?求指教:
    2019-08-07 06:12:37 信息 {"table":"quote","action":"insert","data":[{"timestamp":"2019-08-06T22:09:18.150Z","symbol":"XBTUSD","bidSize":34939,"bidPrice":11353....

    7 years ago

    我已经把自己的API替换了 ,在循环中的那个sleep如果使用,对程序应该没有影响吧?

    7 years ago

    img 我把positon换成wallet后,经常报错:错误 TypeError: cannot read property 'write' of null at main (FILE:8)
    2019-06-03 12:09:30,错误 websocket: bad handshake

    7 years ago

    2019-06-03 12:00:52 信息 {"info":"Welcome to the BitMEX Realtime API.","version":"2019-05-29T18:35:35.000Z","timestamp":"2019-06-03T04:00:51.178Z","docs":"https://www.bitmex.com/app/wsAPI","limit":{"remaining":37}}
    2019-06-03 12:00:50 信息 {"info":"Welcome to the BitMEX Realtime API.","version":"2019-05-29T18:35:35.000Z","timestamp":"2019-06-03T04:00:49.503Z","docs":"https://www.bitmex.com/app/wsAPI","limit":{"remaining":38}}
    2019-06-03 12:00:49 信息 {"success":true,"request":{"args":["Zp8Ub0Iom7SxwDXuB5oXetWV",1559534457,"1cf5ce9c114b6991bfde394cdfebab3b36db9ea0e7a365ed7c4328a6f3ce4efe"],"op":"authKeyExpires"}}
    2019-06-03 12:00:48 信息 {"info":"Welcome to the BitMEX Realtime API.","version":"2019-05-29T18:35:35.000Z","timestamp":"2019-06-03T04:00:47.720Z","docs":"https://www.bitmex.com/app/wsAPI","limit":{"remaining":39}} 这是不是提示需要重连?

    7 years ago

    应该是请求成功了,remaining是剩余websocket连接次数,不能太频繁。

    7 years ago

    搞定了,谢谢

    7 years ago

    TypeError: cannot read property 'write' of null at main (FILE:8) 这个报错是 程序错误,估计是您改了什么代码导致的。
    另外 请先确保您的 托管者所在服务器 可以访问到 OKEX 接口。
    目前 只有海外服务器才能访问到OKEX 了。

    7 years ago

    答非所问

    7 years ago
    我把positon换成wallet后,经常报错:错误 TypeError: cannot read property 'write' of null at main (FILE:8) 2019-06-03 12:09:30,错误 websocket: bad handshake

    回复的是你的这个问题,麻烦看下。

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