0
Follow
294
Followers
fmz平台没有带止盈止损功能,需要设置止盈止损时需要调用交易所其它功能接口,而不同交易所的止盈止损设置又不一样,因此做了如下封装。
止盈止损的功能尤为重要,即不用市价触发避免了高手续费,也避免了极端情况下被爆仓的可能。
函数考虑到了逐仓全仓,也考虑了U本位币本位的情况。
Source
Python
import json
# 对合约进行止盈止损 cangType=0默认逐仓 =1全仓
def zhiyingzhisun(ex, amount, directionStr, zhiying, zhisun, cangType = 0):
if ex.GetName().find('OK') >= 0 :
# okex
return okexSwap(ex, amount, directionStr, zhiying, zhisun)
elif ex.GetName().find('Huobi') >= 0 :
# huobi
return huobiSwap(ex, amount, directionStr, zhiying, zhisun, cangType)
elif ex.GetName().find('Binance') >= 0 :
# bianRelated strategies
Comment
All comments (4)
- 1
