I coded a simple back-testing framework to help you determine how profitable your trading strategy is, here’s the open source code for it
Backtesting is a way of feeding your current trading strategy to a script that applies it on historical data, in order to determine how successful it could be in the future.
Past performance does not always guarantee future returns, but it's good practice to test your strategy (or trading algorithm) before you go ham.
The backtesting script has two parts:
- A data gatherer
- A strategy tester
The data gatherer fetches historical data from Binance, based on your parameters: candle interval, date since, coin.
This is then saved in a csv file and fed to the strategy tester.
The strategy tester then executes your strategy and displays a plot at the end of the cycle showing you all buy/sell actions as well as overall profit/loss.
I fed it a simple strategy – buy if the price is up 1% in the last minute. Sell at 10% gain or 5% loss – but you can customise these parameters yourself. This strategy broke even on DOTUSDT so you might want to try something else 😉
Here's the guide on how to implement it:
And here's the repo if you're a python wizard: