Running an Algorithm Backtest with the Stock Analysis Engine

by jayjohnson
GNU/Linux ◆ xterm-color ◆ bash 2562 views

Running an Algorithm Backtest with the Stock Analysis Engine

How good is this?

It depends, but the README demo algo is up 25% while I am writing this - 2019-01-09**

SPY Algo showing 25% profitable net gain on 2019-01-09

Above is an algo’s trading history image generated from processing live intraday pricing data showing a profitable net gain of 2,583.8 from an initial 10,000 USD investment.

The backtest command line tool uses an algorithm config dictionary to build multiple Williams %R indicators into an algorithm with a 10,000.00 USD starting balance. Once configured, the backtest iterates through each trading dataset and evaluates if it should buy or sell based off the pricing data. After it finishes, the tool will display a chart showing the algorithm’s balance and the stock’s close price per minute using matplotlib and seaborn.

# this can take a few minutes to evaluate
# as more data is collected
# because each day has 390 rows to process
bt -t SPY -f /tmp/history.json