from tqsdk import TqApi, TargetPosTask api = TqApi() SYMBOL = "DCE.SP c2005&c2009" # "CZCE.IPS CF005&CY005" quote = api.get_quote(SYMBOL) target_pos = TargetPosTask(api, SYMBOL) print(quote) while True: api.wait_update() target_pos.set_target_volume(1) api.close()
报错 遇到错单
WARNING – 通知: 下单, 已被服务器拒绝, 原因:模拟交易只支持期货合约
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tqsdk\lib.py”, line 240, in _run
self._symbol, self._direction, self._offset, self._volume, limit_price, order.last_msg))
Exception: 遇到错单: DCE.SP c2005&c2009 BUY OPEN 1手 -42.000000
为什么呢?难道不支持标准的组合合约吗?有什么下单的例子没?
组合目前模拟还不支持