止损功能应该是 通过代码自己编写止损条件 + 使用下单函数 来完成的,比如:
if order.status == “FINISHED” and order.volume_left == 0:
# 成交后立即挂止盈止损单
entry_price = quote.last_price # 用成交价或当前价
profit_target = entry_price + 200 # 止盈价
stop_loss = entry_price – 200 # 止损价
# 挂止盈单(卖出平仓)
profit_order = api.insert_order(symbol=symbol,direction=”SELL”,offset=”CLOSE”,
volume=1, limit_price=profit_target)
# 挂止损单(卖出平仓)
loss_order = api.insert_order(symbol=symbol,direction=”SELL”,offset=”CLOSE”,
volume=1, limit_price=stop_loss)