As we speak I’m open sourcing my Foreign exchange backtesting / buying and selling engine. It could run a buying and selling algorithm in opposition to historic market knowledge by downloading hundreds of candlesticks and working the algorithm in opposition to EACH candlestick. The purpose is the engine runs almost identically for each backtesting and dwell buying and selling, which is why the algorithm runs for every candlestick within the simulation. Many different buying and selling engines I’ve discovered run the algorithm over all candles without delay.
Contemplating that for every candlestick, almost each earlier candlestick as much as some restrict is accounted for within the ensuing commerce choices, there are numerous hundreds of thousands and hundreds of thousands of calculations per second, so Go was a terrific selection for such a program. A big backtest runs in simply seconds with none multithreading in any respect on my M1 MacBook Professional.
The brand new license is 0BSD. Please do no matter you need with it. PRs and bug fixes welcome.
There are numerous bugs, and I admittedly did a poor job on the time of writing check circumstances for the software program, so it’s exhausting to know whether or not it’s truly legitimate. I principally laid the groundwork for future improvement. The code can also be fairly messy within the backtest.go file, so refactorings are very a lot welcome!
The next is from the mission README (if it sounds sales-ey that’s as a result of it got here from my LinkedIn):
Autotrader is a foreign exchange quantitative buying and selling engine I developed in two weeks utilizing Go. The distinctive backtesting simulations runs a user-designed buying and selling algorithm in opposition to historic market knowledge. The simulation accounts for brokerage charges, hedging, leverage, market orders, restrict orders, cease orders, and extra. As soon as a dependable technique has been recognized, the consumer can run the buying and selling algorithm they created on their dwell brokerage account.
Autotrader inserts layers of abstraction all the way in which down from the implementation of the buying and selling technique to the orders and positions maintained by the brokers over their JSON REST APIs. All monetary algorithms and knowledge buildings used on this mission have been developed from scratch, together with a time sequence desk impressed by the NumPy Python knowledge science library.