Closed FrankPSch closed 4 years ago
Hi there,
it seems that zipline-trader requires IBpy to connect to TWS. Since IBpy has not been updated for several years, I try to connect to the official TWS API. Therefore, I installed the TWS API and created a new file ib_broker.zip which needs to be placed in the directory /zipline/gens/brokers. Any thoughts on this file are highly appreciated - so far no errors in my configuration, but not used in live trading so far as it is Sunday.
Thanks, Frank
Summary of changes made (see above):
Imports
#from ib.ext.EClientSocket import EClientSocket
from ibapi.client import *
#from ib.ext.EWrapper import EWrapper
from ibapi.wrapper import *
#from ib.ext.Contract import Contract
from ibapi.contract import *
#from ib.ext.Order import Order
from ibapi.order import *
#from ib.ext.ExecutionFilter import ExecutionFilter
#from ib.ext.EClientErrors import EClientErrors
from ibapi.common import *
from ibapi import *
Classes
#class TWSConnection(EClientSocket, EWrapper):
class TWSConnection(EClient, EWrapper):
In the def init of class TWSConnection(EClient, EWrapper)
# EClientSocket.__init__(self, anyWrapper=self)
EClient.__init__(self, wrapper=self)
self.eConnect = self.connect
At the end of class TWSConnection(EClient, EWrapper)
#self.connect()
self.myConnect()
Replacing def connect(self)
#def connect(self):
def myConnect(self):
Frank, Check out:
https://pypi.org/project/zipline-live2/ https://github.com/shlomikushchi/zipline-live2
Will save you work! alan
Hi Alan,
thanks a lot for the links!
On the 2nd link, it says that zipline-live2 is now continued under https://github.com/shlomikushchi/zipline-trader, which is what I installed. Both versions import ib.ext
in the file ib_broker.py
and therefore seem to require an IBpy installation.
On https://github.com/blampe/IbPy (last updated 2017), it says Beginning with release 9.73, InteractiveBrokers is now officially supporting a new Python API client (Python 3 only). This should make this repo superfluous except for Python 2.
Is this what the community is using? Very good, should it still be up to date! With with Python version does it run stable, and should Python then be installed from Conda or from Python.Org?
Thanks again, Frank
Frank, I don't know exactly what is wrong with what your are doing.
I use Linux boxes...and have successfully run live IB-TWS/IB-Gateway trading on AWS Instances, Windows10-HyperV-Ubuntu, and AWS Workspaces and haven't seen the troubles with IBpy you are seeing, yet I'm not surprised you are seeing them...it is a persnickity process.
We are using anaconda, and then installing our slight modification(zipline-broker) of zipline-live2 (Note: we haven't tried the new version zipline-broker yet) on top of it.
That kind of install I can help you with...some version of Linux...for us, at this time, Windows 10 is a step too far that does nothing for our current goals. alan
Hi Alan,
thanks a lot for your hepl! In the meantime, I was able to move a bit further, one step at a time... Still way to go but on other topics now, so I am closing this issue. It feels a bit strange to work with such old versions but it only means more thorough testing ;)
Frank
Dear Zipline-Trader Maintainers,
Key Question: what do I need to install on top of python, C++ 14.0, IB TWS and zipline-trader for live trading? Backtesting is working well.
1) Before I tell you about my issue, let me describe my environment:
(2) Now that you know a little about me, let me tell you about the issue I am having:
zipline run -f my_zl_trader_test.py --state-file my_zl_trader_test.state --broker ib --broker-url localhost:7496:1232 --bundle quantopian-quandl --data-frequency daily --realtime-bar-target ./realtime-bars
Error: unsupported broker: can't import module zipline.gens.brokers.ib_broker
If I check the file ib_broker.py I find:
-> Do I need to install anything else?
(3) Here is how you can reproduce this issue on your machine:
(4) What steps have you taken to resolve this already?
Thanks a lot for taking the time, Frank