if nShortAmount != nHoldAmount:
order = order_target(current_future, nShortAmount, side='short', pindex=1)
if order != None and order.filled > 0:
log.info('Futures: %s, action: short %s, filled: %d, price: %.2f' % \
(order.security, ('平空' if order.is_buy else '开仓'), order.filled, order.price))
else:
log.info('Futures: %s, order failure' % (current_future))
持仓数量 不等于 目标空单,就买入目标空单,这样不会导致 空单增多吗
比如 持仓 为1,目标为2 ,再买入空单,不是变成 3 了 ?
如果 order_target 的amount 是目标单,那只要将目标单输入就好了。
2018-04-27