0
关注
0
关注者

okex上的合约,开多、平多、开空、平空分别怎么写?

创建于: 2018-06-03 20:50:44, 更新于: 2019-07-31 17:33:51
comments   3
hits   3944

okex的原生API,通过type字段 1:开多 2:开空 3:平多 4:平空 就能实现各种交易了。 但通过发明者量化的API怎么写呢? 是下面这样吗?

开多

exchange.SetDirection(“buy”) exchange.Buy(Price, Amount)

平多

exchange.SetDirection(“closebuy”) exchange.Sell(Price, Amount)

开空

exchange.SetDirection(“sell”) exchange.sell(Price, Amount)

平空

exchange.SetDirection(“closesell”) exchange.buy(Price, Amount)

相关推荐
更多内容
全部留言
avatar of 发明者量化-小小梦
发明者量化-小小梦
是的。
2018-06-25 10:40:22
avatar of 发明者量化-小小梦
发明者量化-小小梦
买入 开空是不行的 ,但是不会报错,实盘也不会,不过可能执行成为 买入开多。或者 买入 平空。所以这个设置方向一定要正确。
2018-11-29 08:52:19
avatar of wl
wl
那exchange.SetDirection("buy") exchange.Sell(Price, Amount) 和 exchange.SetDirection("sell") exchange.buy(Price, Amount) 字面逻辑意思分别对应“卖出开多”,“买入开空”在程序中是否会有相应操作执行。模拟回测里像并没有报错。。
2018-11-28 23:21:24