3
关注
1228
关注者

关于如何在BitMEX挂仅被动成交做市单和批量下单(IO范例)

创建于: 2019-04-17 15:46:32, 更新于: 2019-04-19 15:25:48
comments   13
hits   4535

使用IO函数,具体参数参考BitMEX文档:https://www.fmz.com/bbs-topic/3666

做市单(仅被动成交)

var id = exchange.IO("api", "POST", "/api/v1/order", "symbol=XBTUSD&side=Buy&orderQty=1&price=5000&execInst=ParticipateDoNotInitiate")

批量挂单

var bulk = []
bulk.push({symbol:'XBTUSD', side:'Buy', orderQty:100, price:5000, execInst:'ParticipateDoNotInitiate'})
bulk.push({symbol:'XBTUSD', side:'Buy', orderQty:200, price:5100, execInst:'ParticipateDoNotInitiate'})
var param = "orders=" + JSON.stringify(bulk)
var ids = exchange.IO("api", "POST", "/api/v1/order/bulk", param)
Log(ids)

撤销所有订单

exchange.IO("api","DELETE","/api/v1/order/all","symbol=XBTUSD")
相关推荐
更多内容
全部留言
avatar of mztcoin
mztcoin
牛逼,四年前就回答了我现在的问题
2024-05-18 02:05:39
avatar of wufuhao100w
wufuhao100w
如果是post_only的话有可能下单不成功的,如果下单不成功的话会返回什么值呢?会不会导致机器人停止?
2019-12-15 22:06:08
avatar of 不要香菜
不要香菜
HTTP请求 POST /api/futures/v3/order 请求示例 POST/api/futures/v3/order{"client_oid": “12233456”,"order_type”:”1”,"instrument_id":"BTC-USD-180213","type":"1","price":"432.11","size":"2","match_price":"0"} order_type String 否 参数填数字,0:普通委托(order type不填或填0都是普通委托) 1:只做Maker(Post only) 2:全部成交或立即取消(FOK) 3:立即成交并取消剩余(IOC)
2019-09-20 10:09:04
avatar of wufuhao100w
wufuhao100w
好的
2019-12-22 10:55:45
avatar of 小草
小草
直接Log的返回结果吗,查bitmex文档就好
2019-12-20 10:34:21
avatar of wufuhao100w
wufuhao100w
不好意思又来打扰您了,我下单成功了但是返回的是一串信息并不是订单id: map[account:251345 avgPx:<nil> clOrdID: clOrdLinkID: contingencyType: cumQty:0 currency:XBT displayQty:<nil> exDestination:XBME execInst:ParticipateDoNotInitiate leavesQty:20 multiLegReporting 请问怎么解决?
2019-12-19 22:56:11
avatar of wufuhao100w
wufuhao100w
好的,谢谢
2019-12-19 22:36:33
avatar of 小草
小草
对,str(num)
2019-12-19 22:31:46
avatar of wufuhao100w
wufuhao100w
你好,我尝试了一下,报错说TypeError: can only concatenate str (not "int") to str,用的是python,是否要把orderQty = 1的“1”和price = 5000的“5000”改成字符串格式?
2019-12-19 22:26:52
avatar of 小草
小草
对,最好再查一下文档,看看有没有变
2019-12-17 22:45:52
avatar of wufuhao100w
wufuhao100w
想问一下大神,如果我要下post_only的单只需要把上面的代码 exchange.IO("api", "POST", "/api/v1/order", "symbol=XBTUSD&side=Buy&orderQty=1&price=5000&execInst=ParticipateDoNotInitiate") 复制过去就可以了吗?具体就是把方向、价格、数量的参数改成想要的数值就可以了?
2019-12-17 22:29:04
avatar of wufuhao100w
wufuhao100w
好的,谢谢
2019-12-16 19:04:00
avatar of 小草
小草
看bitemx的文档,有返回结果介绍。要处理正确就不会有问题
2019-12-16 09:04:01