I also wonder about the discrepancy. The closing price is 26.27. The sell creation order is 26.27. But then price and cost of that order is 27.25. There could be something like slippage, but in the tutorial no slippage is being set. The value 27.25 is not in the CSV either so it's generated somehow.
2000-01-13, Close, 26.27
2000-01-13, SELL CREATE, 26.27
2000-01-14, SELL EXECUTED, Price: 27.25, Cost: 27.25, Comm 0.03 ## Note the change in Cost here!```
@steven-vo said in Anyone use backtrader to do live trading on Bitcoin exchange?:
Even though using the given source code, I still ran into the "granularity is too small" issue and after some tracing, I found that the init (L60) method (in ccxt.py) defaults the ohlcv_limit to 450 if ohlcv_limit is not set.
You're probably using old code. This issue seem to be fixed by this commit 10 days ago: https://github.com/bartosh/backtrader/commit/d0147a736f7ff03c3da036b53866fad9e3c402d0
Whereas orders are created by the system, indicators are created by end users. Something that could be my own code
self.my_smas = [bt.ind.SMA(period=x) for x in range(5, 30, 5)]
Accessing the indicators later is a matter of getting thestrat as shown above and accessing the my_smas attribute (a list containing several Simple Moving Averages)
Just by looking at the values it would seem that your data doesn't move 20 points altogether in an entire year. You need to fine tune the Renko filter to your data set. There is no one size fits all for it.
Anaconda (as a distribution) and ipython, spyder, etc. (as shells) are ok. Nothing against it. If you want interactivity, saving your work with charts embedded, coming back and making edition in between cells.
They simply impose restrictions (like the mentioned one for the multiprocessing module under Windows) which you need to be aware of.
You may want to have a look at PyCharm as integrated environment (execution of scripts inside
PyCharm* suffers from the same pitfalls as above)
But serious jobs are better executed from the command line (Cygwin under Windows offers a fantastic Unix-like experience and the WSL is already mature enough for many things)
Yes, I've tested and you were absolutely right. When the market is open all works as expected for the paper trading account. When it is closed it does no backfill.
Thanks for the hint about the demo one.
But I guess this is just something in the implementation of the datafeed in backtrader, right? I would suspect that normally you can ask IB for any historical data at any moment? The real-time data is just needed to establish the from-to range? Am I getting it correctly or there is something else going on behind the scene?
In any case, I know now what the problem was so I can continue with what I wanted to do.
The right question here would be not "how you count it" but how brokers (usually) count it. My personal experience with different brokers is that there is no "bar based" system.
Bars can have many different durations (1-min, 5-min, 2-days), you would have to 1st define the actual bar duration and then the length. You would also have to take into account that during thin trading sessions, several 1-min bars will be missing (no negotiation took place). Should they count because your expected timeframe is 1-min or shall the broker be counting only those with executed volume?
Great work! I am also a fan of Bokeh too...
My 2 cents would be to try backtrader_contrib first. Once the first commits start coming in, I am sure others will follow. I think half of the reason it has not taken off so far is that @backtrader has not been so active as of late. We had a couple of projects (like @Richard-O-Regan's basic trade stats and @Ed-Bartosh's CCXT integration) which would be ideal additions to the backtrader_contrib repo.
I'm very new to Backtrader and the community, but I have to echo the comments made here. After having worked with various other python & non-python trading platforms, I was blown away when I stumbled upon Backtrader and the depth of its capabilities. It's incredible and you should be very proud!
It would be an absolute shame to see the project wither and splinter into various forks.
Please continue to support the project. If you do want to take some time off, then please consider inviting a few others into the project as collaborators.
The ta-lib developer has been so kind as to re-expose the interface that made automatic parsing of ta-lib functions possible.
PyPi Package: https://pypi.python.org/pypi/TA-Lib/0.4.15
Issue #176: https://github.com/mrjbq7/ta-lib/issues/176
Upgrading to 0.4.15 should solve the problem.