Binance API or updating backtrader every 5 min
guwop last edited by
I've backtested a variety of cryptocurrency strategies with backtrader and am now at the point where I'd like to start papertrading. I'm struggling to come up with the best way to go about implementing it. I'd prefer to be able to connect backtrader directly to Binance through its API, but I'm having a hard time finding how to directly do this. I found a thread on implementing a CCXT extension, but there still seems to be some issues with that. My other option would be to set a timer on a python script to the Binance API, store the data as a CSV, and then have backtrader take in the new data. My main question about this method is whether or not backtrader has the ability to (once initially run) call on the new data every few minutes so that I'm trading on a 5 minute lag or less.
Hopefully I described my situation well enough, if not please let me know. If anybody has additional ideas that what I'd come up with, I'm all ears! Thanks y'all
Your best bet is to create a data feed which reports to be a
This data feed waits for something like:
- A csv file which grows
- A binary file which grows
- Communication over a socket or pipe
- It can even call the
BinanceAPI every 5 minutes and use the result
Of course you want to pay attention to these events in a background thread.
And you return the data to the system.
Check for example the sources for