Callback function to handle completion events
Unsubscribe function to stop listening to events
import { listenDoneBacktest, Backtest } from "backtest-kit";
const unsubscribe = listenDoneBacktest((event) => {
console.log("Backtest completed:", event.strategyName, event.exchangeName, event.symbol);
});
Backtest.background("BTCUSDT", {
strategyName: "my-strategy",
exchangeName: "binance",
frameName: "1d-backtest"
});
// Later: stop listening
unsubscribe();
Subscribes to backtest background execution completion events with queued async processing.
Emits when Backtest.background() completes execution. Events are processed sequentially in order received, even if callback is async. Uses queued wrapper to prevent concurrent execution of the callback.