haifengat/pyctp

f.ExchangeID=self.strToBytes(self.instruments[pInstrument].ExchangeID) KeyError: 'MA2409'

GoFireStar opened this issue · 0 comments

py_ctp v6.7.2

tt = TestTrade(front_trade, broker, investor, pwd, appid, auth_code, proc)
tt.run()
time.sleep(5)
tt.t.ReqOrderInsert(r'MA2409', DirectType.Buy, OffsetType.Open, 2507, 3)

Exception in thread Decrypt handshake data failed
Thread-1 (OnRspError):
Traceback (most recent call last):
File "D:\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "D:\Python\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "D:\Python\Python310\lib\site-packages\py_ctp\trade.py", line 687, in OnRspError
print('=== [TRADE] OnRspError ===\n{0}'.format(info.dict))
File "D:\Python\Python310\lib\site-packages\py_ctp\structs_py.py", line 31, in dict
return {'ErrorID': self.ErrorID, 'ErrorMsg': str(self.ErrorMsg, 'GB2312')}
TypeError: decoding str is not supported
Traceback (most recent call last):
File "D:\WorkSpace\Quant\CTP\py-ctp\test.py", line 84, in
tt.t.ReqOrderInsert(r'MA2409', DirectType.Buy, OffsetType.Open, 2507, 3)
File "D:\Python\Python310\lib\site-packages\py_ctp\trade.py", line 567, in ReqOrderInsert
f.ExchangeID=self.strToBytes(self.instruments[pInstrument].ExchangeID)
KeyError: 'MA2409' 海风大佬,这个是什么问题解决