My backtest re-runs when I save the strategy file, and shows which trades changed
I'm building a backtesting web app called Hawk Backtester on the side. This post is about one feature, a watch mode for local Python strategies. The loop that annoyed me most was edit the strategy, run it in a terminal, open the results, then try to remember what the previous run looked like. The last step was the worst. If PnL went up a little, I couldn't tell whether my change did it or a…
I'm developing a web-based backtesting tool named Hawk Backtester. One of its standout features is a "watch mode" for local Python strategies. Traditionally, editing a strategy, running it in a terminal, and deciphering the output proved cumbersome. The most frustrating part was determining whether slight improvements in PnL were due to the change made or merely chance.
Now, the backtest automatically reruns upon saving the strategy file, and it highlights which trades were affected. To use it, install Hawk Backtester via `pip install -U hawk-bt`, then run your strategy file, such as `my_strategy.py`. The strategy is defined using the `hawk_bt` library, with parameters displayed as sliders in the browser.
Upon saving the strategy file, the execution engine, compiled to WebAssembly, runs in the browser, while the original Python strategy runs locally and communicates via a WebSocket connection. The diff between runs, indicating changes in trades and PnL, is displayed above the results. Feedback from users is invaluable, and a demo version is available at `https://app.hawk-backtester.com/en/demo/?utm_source=devto&utm_medium=article&utm_campaign=watch_mode`.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.