等级: 免费版
- 注册:
- 2021-8-3
- 曾用名:
|
if portfolio.buy_quantity==0 :
buy_open(context.s1, "Market",0 ,volume=1,serial_id = 1)
print(1)
if portfolio.sell_quantity==0 :
sell_open(context.s1, "Market",0 ,volume=1,serial_id = 2)
print(2)
if portfolio.buy_quantity>0 :
buy_close(context.s1, "Limit", context.zcc ,volume=1,serial_id = 3)
print(3)
if portfolio.sell_quantity>0 :
sell_close(context.s1, "Limit",context.zc ,volume=1,serial_id = 4)
print(4)
这段测试代码持仓为0分别下1单空,1单多。下止损单是下面两个代码吗?
|
|