3.46K 浏览
0

以前都正常的。

if position.pos_long > 0 or position.pos_short > 0: # 有仓位才继续
if v > 0: # 持仓>0
current_close = k.close.values[-1]
if current_close <= stop_price:
target_pos.set_target_volume(0)
savetradeinfo([currenttime(), code, ‘SELL’, ‘CLOSE’, ref1_close, v, ‘日内止损’])

[‘2020-05-07 11:17:02’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:09’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:10’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:11’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:11’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:12’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:12’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:13’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:13’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:14’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:14’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:15’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:15’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:16’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:16’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:17’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:17’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:18’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:18’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:19’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:19’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:20’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:20’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:21’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:21’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:22’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:22’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:23’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:23’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:24’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:24’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:25’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:25’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:26’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:26’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:27’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:27’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:28’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:28’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:29’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:29’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:30’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:30’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:31’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:31’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:32’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:32’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:33’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:33’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:34’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:34’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:35’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:35’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:36’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:36’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:37’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:37’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:38’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:38’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:39’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:39’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:40’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:40’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:41’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:41’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:42’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:42’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:43’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:43’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]
[‘2020-05-07 11:17:44’, ‘CZCE.AP010’, ‘SELL’, ‘CLOSE’, 9146.0, 2.0, ‘日内止损’]

west 已回答的问题 2020年5月8日
0

target_pos.set_target_volume(0)之后需要调用wait_update()

west 已回答的问题 2020年5月8日