print(“my_contract_index:”, my_contract_index)
print(datetime.datetime.fromtimestamp(klines.iloc[-1+i][“datetime”] / 1e9))
print(“计算历史仓位my_positon:”, my_positon)
print(“chichangstatus:”, chichangstatus)
i=i+1
报错信息1:
my_contract_index: KQ.i@CZCE.AP
1970-01-01 08:00:00
计算历史仓位my_positon: 0
chichangstatus: 0
my_contract_index: KQ.i@CZCE.AP
1970-01-01 08:00:00
计算历史仓位my_positon: 0
chichangstatus: 0
my_contract_index: KQ.i@CZCE.AP
1970-01-01 08:00:00
计算历史仓位my_positon: 0
chichangstatus: 0
long2: True
打印日期一直是1970年,如果品种少就是当前K线的日期:2020-6-9
报错信息2
File “C:/TianQin/strategies/singlema_tdtphama.py”, line 2411, in
api.wait_update()
File “C:Python37libsite-packagestqsdkapi.py”, line 891, in wait_update
self._run_until_idle()
File “C:Python37libsite-packagestqsdkapi.py”, line 1534, in _run_until_idle
self._run_once()
File “C:Python37libsite-packagestqsdkapi.py”, line 1527, in _run_once
raise self._exceptions.pop(0)
File “C:/TianQin/strategies/singlema_tdtphama.py”, line 2055, in tdtphama_2
my_order2 = old_order_handle(stra_name, my_contract_id, my_order2, api, my_quote_id, klines_1m)
File “C:TianQinstrategiesfun_son_singlma.py”, line 152, in old_order_handle
my_order = api.insert_order(symbol=my_order.instrument_id, direction=my_order.direction, offset=my_order.offset, limit_price=my_limitprice11, volume=my_order.volume_left)
File “C:Python37libsite-packagestqsdkapi.py”, line 624, in insert_order
raise Exception(“合约代码 %s 不存在, 请检查合约代码是否填写正确” % (symbol))
Exception: 合约代码 TA009 不存在, 请检查合约代码是否填写正确
系统提示TA009不存在,实际上TA009是没错的。交易品种少的时候就可以交易
我在代码里面写的是”CZCE.TA009″,前面是有交易所的,而且单独运行TA这个品种就不会报错,应该不是在这里的问题。而且不是每次都是TA,下一次可能是bu或者是MA