[英]Interactive brokers TWS API error message
下面是我的老师给出的运行程序的错误堆栈跟踪:
C:\Users\USER\AppData\Local\Programs\Python\Python37\python.exe "D:/miscellaneous/Investment/programming/Chris Wong 20201218/real_python_trading_course 202102/thinkific/ib_api/> b_api_framework-test01_20210614.py"
ERROR -1 2104 Market data farm connection is OK:hfarm
ERROR -1 2104 Market data farm connection is OK:eufarm
ERROR -1 2104 Market data farm connection is OK:usfuture
ERROR -1 2104 Market data farm connection is OK:cashfarm
ERROR -1 2104 Market data farm connection is OK:usfarm
ERROR -1 2106 HMDS data farm connection is OK:hkhmds
ERROR -1 2106 HMDS data farm connection is OK:ushmds
ERROR -1 2158 Sec-def data farm connection is OK:secdefnj
unhandled exception in EReader thread
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\ibapi-9.76.1-py3.7.egg\ibapi\reader.py", line 34, in run
data = self.conn.recvMsg()
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\ibapi-9.76.1-py3.7.egg\ibapi\connection.py", line 99, in recvMsg
buf = self._recvAllMsg()
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\ibapi-9.76.1-py3.7.egg\ibapi\connection.py", line 119, in _recvAllMsg
buf = self.socket.recv(4096)
OSError: [WinError 10038] 嘗試操作的對象不是通訊端。
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\ibapi-9.76.1-py3.7.egg\ibapi\client.py", line 239, in run
self.decoder.interpret(fields)
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\ibapi-9.76.1-py3.7.egg\ibapi\decoder.py", line 1280, in interpret
handleInfo.processMeth(self, iter(fields))
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\ibapi-9.76.1-py3.7.egg\ibapi\decoder.py", line 271, in processContractDataMsg
contract.contract.symbol = decode(str, fields)
AttributeError: 'ContractDetails' object has no attribute 'contract'
Traceback (most recent call last):
File "D:/miscellaneous/Investment/programming/Chris Wong 20201218/real_python_trading_course 202102/thinkific/ib_api/ib_api_framework-test01_20210614.py", line 686, in <module>
resolved_ibcontract = app.resolve_ib_contract(ibcontract)
File "D:/miscellaneous/Investment/programming/Chris Wong 20201218/real_python_trading_course 202102/thinkific/ib_api/ib_api_framework-test01_20210614.py", line 342, in resolve_ib_contract
new_contract_details = self.contract_details_queue.get(timeout = MAX_WAIT_SECONDS)
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\queue.py", line 178, in get
raise Empty
_queue.Empty
Process finished with exit code 1
任何人都可以帮忙解决这个问题,因为代码是我老师的知识产权,我不能公开它。
*我买了一台新的笔记本电脑并安装了 anaconda。 它现在可以工作,所以它应该不是由程序引起的。
这是问题:
contract.contract.symbol = decode(str, fields)
AttributeError: 'ContractDetails' object has no attribute 'contract'
我想你的意思是:
contract.symbol = decode(str, fields)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.