Hi Backtrader, I've had all sorts of issues with IB with my manual trading. I was going to use them for running a strategy, that makes 1 or 2 trades a day on an ETF using Backtrader. Before I invest time into this, would you recommend I use another broker instead? Thanks
Each line in a data feed has:
An attribute array which holds the data
Method getzero(idx, size) to return the data from the beginning
Method plot(idx=0, size=None) which if called as plot() will simply give you the entire array
I managed to overcome this with the chrome extension "High Contrast":
Re: Getting executed twice on closing orders
Ah, I am an idiot. Thanks for your help I had a datafeed issue. Thx!
Working code below.
if __name__ == '__main__':
#Start the brain
cerebro = bt.Cerebro()
# Load Strat
#Start cash level
#Set multiplier and commish level
cerebro.broker.setcommission(commission=0.79, margin=3000.0, mult=1000.0)
df = pd.DataFrame()
df = bck.df()
#Add Dataframe from other module
data = bt.feeds.PandasData(dataname=df,timeframe=bt.TimeFrame.Minutes,compression=1)
#Load data to brain
print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())
results = cerebro.run()
print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())
Solved. Thank you so much for the really quick reply!
Here is the code for reference for anyone else.
self.log('SELL EXECUTED, Price: %.2f, Cost: %.2f, Comm %.2f, Datetime: %s' %
Because the data feed IBData registers itself in the store overwriting DataCls. This would allow anyone to write a different version of IBData (call it MyIBData), which would again overwrite the value of DataCls in the store.
And consequently, getdata would return an instance of MyIBData
Not currently. The platform is stable and resources are dedicated to other projects. Hence the message:
Community - EoDevelopment 1.x
A private working implementation does actually exist. Whether the authors are willing to release that under an Open Source License is unknown.
That's why the name was chosen: cheat. Because you look at the opening price which you shouldn't have access to. It is meant for a study, research, but if you use to validate your strategy, you are cheating yourself.
The commission info schemes are not exposed to the variation of the value of your account, because they are matched against the assets which have no relationship to the status of your account.
It is currently not possible.
Pictures are nice, but if you use the facilities of a forum (like pasting text and quoting it to highlight it, as pointed out above) it could help more.
It will also be of no help to future users, when you remove the picture from your google drive share. Your post has been edited to add the figure for future reference.
In any case it seems you are pretty new to Python. Your error has nothing to do with backtrader. See
Python - Docs - 8.1. datetime — Basic date and time types