[英]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.