Reputation: 1
Firstly, I use Python2.7, my OS is win7, and my IBpy package is the newest, downloaded from github.
I run example_opt.py, which is an demo from IBpy, then I came across following problem:
Server Version: 76
TWS Time at connection:20160326 10:39:29 CST
<managedAccounts accountsList=DU228380>
<nextValidId orderId=1>
<error id=None, errorCode=None, errorMsg=chr() arg not in range(256)>
<connectionClosed>
DISCONNECTED
And the example code is the following:
from ib.ext.Contract import Contract
from ib.opt import ibConnection, message
import time
def watcher(msg):
print msg
con = ibConnection(port=7497, clientId=888)
con.registerAll(watcher)
con.connect()
contract = Contract()
contract.m_symbol = "EUR"
contract.m_exchange = "IDEALPRO"
contract.m_currency = "USD"
contract.m_secType = "CASH"
con.reqMktData(1, contract, '', False)
time.sleep(5)
con.disconnect()
print "DISCONNECTED"
time.sleep(60)
Could somebody help me solve this problem? I think it may be a bug of the latest version because I find somebody else also asked the problem in github.
Many Thanks. Waiting for your answer online!
Upvotes: 0
Views: 284
Reputation: 21
Try changing the language of your IB app. In my case, I had IB's language set in "Spanish" and I was getting this error on IbPy continuously; then, I changed language to "English" and I could connect to TWS.
Upvotes: 1