def send_order(
self,
direction: Direction,
offset: Offset,
price: float,
volume: float,
stop: bool = False,
lock: bool = False,
net: bool = False
):
"""
Send a new order.
"""
c = volume / (self.setting['time'] / self.setting['interval'])
contract = self.get_contract(self.vt_symbol)
if contract:
c = round_to(c, contract.min_volume)
print('ccccccccc:', c)
if self.trading:
for x in range(self.setting['time'] // self.setting['interval']):
if self.traded <= volume:
vt_orderids = self.cta_engine.send_order(
self, direction, offset, price, c, stop, lock, net
)
self.traded += c
sleep(self.setting['interval'])
return vt_orderids
else:
return []
在策略运行过程中报错