Loading ...

关于bitmex市价止盈止损和触发后平仓的API接口程序编写问题

Author: futuresloser, Created: 2019-04-19 13:23:53, Updated: 2019-04-19 13:34:25

查询了交流社区的各种帖子,还是对这一功能无从下手。 img 由于bitmex经常出现overload,只有提前设置好传入系统的单子才能成交。图片上画箭头的三个功能至关重要,很多新手没有关注过。 比如4.2号那天设置4300突破追涨的话,只要把“市价止损”选项里“设置买入止损”、填写数量和触发价格为:4300,同时不要勾选触发后平仓这个选项就可以实现。 经查询,bitmex的请求地址:https://www.bitmex.com/api/v1/order 请求方式:Post 请求数据: “symbol=” & symbol & “&price=” & price & “&quantity=” & qty & “&side=Buy&ordType=StopLimit&execInst=LastPrice” & “&stopPx=” & triggerprice 有关的帖子里提到fmz下单时的指令是是这样var id = exchange.IO("api", “POST”, “/api/v1/order”, “symbol=XBTUSD&side=Buy&orderQty=1&price=5000&execInst=ParticipateDoNotInitiate”) 那么要实现操作界面上,“市价止损”选项里“设置买入止损”、“设置卖出止损”(或者“市价止盈”选项里“设置卖出止盈”、“设置买入止盈”)以及“促发后平仓”(不选择该选项)的操作指令怎样下达? 能否按上面格式举例说明?谢谢!


More

Justin20181111 可以说一下具体的写法吗

futuresloser 经过实盘检验,可以执行了,但是模拟回测时会报错

futuresloser 模拟测试报错2019-04-18 00:00:00 错误 main:686:10 - TypeError: Cannot convert "POST" to int。

小小梦 ``` Order Types All orders require a symbol. All other fields are optional except when otherwise specified. These are the valid ordTypes: Limit: The default order type. Specify an orderQty and price. Market: A traditional Market order. A Market order will execute until filled or your bankruptcy price is reached, at which point it will cancel. Stop: A Stop Market order. Specify an orderQty and stopPx. When the stopPx is reached, the order will be entered into the book. On sell orders, the order will trigger if the triggering price is lower than the stopPx. On buys, higher. Note: Stop orders do not consume margin until triggered. Be sure that the required margin is available in your account so that it may trigger fully. Close Stops don't require an orderQty. See Execution Instructions below. StopLimit: Like a Stop Market, but enters a Limit order instead of a Market order. Specify an orderQty, stopPx, and price. MarketIfTouched: Similar to a Stop, but triggers are done in the opposite direction. Useful for Take Profit orders. LimitIfTouched: As above; use for Take Profit Limit orders. ``` 可以看下 BITMEX API 文档上这段描述,如果需要下 买入止损 ,卖出止盈之类的的 单子,参考设置 参数 ordTypes: 有以下几种: Limit: 传统的限价单 Market: 市价单 Stop: 市价止损单 StopLimit: 限价止损单 MarketIfTouched: LimitIfTouched: