Interface BacktestStatistics

Statistical data calculated from backtest results.

All numeric values are null if calculation is unsafe (NaN, Infinity, etc). Provides comprehensive metrics for strategy performance analysis.

const stats = await Backtest.getData("my-strategy");

console.log(`Total signals: ${stats.totalSignals}`);
console.log(`Win rate: ${stats.winRate}%`);
console.log(`Sharpe Ratio: ${stats.sharpeRatio}`);

// Access raw signal data
stats.signalList.forEach(signal => {
console.log(`Signal ${signal.signal.id}: ${signal.pnl.pnlPercentage}%`);
});
interface BacktestStatistics {
    annualizedSharpeRatio: number;
    avgPnl: number;
    certaintyRatio: number;
    expectedYearlyReturns: number;
    lossCount: number;
    sharpeRatio: number;
    signalList: IStrategyTickResultClosed[];
    stdDev: number;
    totalPnl: number;
    totalSignals: number;
    winCount: number;
    winRate: number;
}

Properties

annualizedSharpeRatio: number

Annualized Sharpe Ratio (sharpeRatio × √365), null if unsafe. Higher is better.

avgPnl: number

Average PNL per signal as percentage, null if unsafe. Higher is better.

certaintyRatio: number

Certainty Ratio (avgWin / |avgLoss|), null if unsafe. Higher is better.

expectedYearlyReturns: number

Expected yearly returns based on average trade duration and PNL, null if unsafe. Higher is better.

lossCount: number

Number of losing signals (PNL < 0)

sharpeRatio: number

Sharpe Ratio (risk-adjusted return = avgPnl / stdDev), null if unsafe. Higher is better.

Array of all closed signals with full details (price, PNL, timestamps, etc.)

stdDev: number

Standard deviation of returns (volatility metric), null if unsafe. Lower is better.

totalPnl: number

Cumulative PNL across all signals as percentage, null if unsafe. Higher is better.

totalSignals: number

Total number of closed signals

winCount: number

Number of winning signals (PNL > 0)

winRate: number

Win rate as percentage (0-100), null if unsafe. Higher is better.