Interface LiveStatistics

Statistical data calculated from live trading results.

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

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

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

// Access raw event data (includes idle, opened, active, closed)
stats.eventList.forEach(event => {
if (event.action === "closed") {
console.log(`Closed signal: ${event.pnl}%`);
}
});
interface LiveStatistics {
    annualizedSharpeRatio: number;
    avgPnl: number;
    certaintyRatio: number;
    eventList: TickEvent[];
    expectedYearlyReturns: number;
    lossCount: number;
    sharpeRatio: number;
    stdDev: number;
    totalClosed: number;
    totalEvents: number;
    totalPnl: number;
    winCount: number;
    winRate: number;
}

Properties

annualizedSharpeRatio: number

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

avgPnl: number

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

certaintyRatio: number

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

eventList: TickEvent[]

Array of all events (idle, opened, active, closed) with full details

expectedYearlyReturns: number

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

lossCount: number

Number of losing closed signals (PNL < 0)

sharpeRatio: number

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

stdDev: number

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

totalClosed: number

Total number of closed signals only

totalEvents: number

Total number of all events (includes idle, opened, active, closed)

totalPnl: number

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

winCount: number

Number of winning closed signals (PNL > 0)

winRate: number

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