まず、私は Python2.7 を使用しています。OS は win7 で、IBpy パッケージは github からダウンロードした最新のものです。
IBpy のデモである example_opt.py を実行すると、次の問題が発生しました。
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
サンプルコードは次のとおりです。
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)
誰かがこの問題を解決するのを手伝ってくれませんか? 他の誰かがgithubで問題を尋ねているのを見つけたので、それは最新バージョンのバグかもしれないと思います.
どうもありがとう。オンラインであなたの答えを待っています!