Overview
Theanalytics.getModelStats endpoint provides comprehensive trading statistics for all AI models in the system. You can retrieve either overall performance metrics or advanced detailed statistics including trade sizes, hold times, leverage, and failure rates.
Endpoint
Input Parameters
Statistics mode to retrieve:
overall- Core performance metrics (returns, win rate, Sharpe ratio)advanced- Detailed statistics (trade sizes, hold times, leverage, failures)
Filter by AI variant:
all- All variantsApex- Apex variant onlyTrendsurfer- Trendsurfer variant onlyContrarian- Contrarian variant onlySovereign- Sovereign variant only
Response Schema
Overall Stats Mode
Whenmode: "overall", returns an array of overall statistics:
Array of overall statistics objects for each model.
Advanced Stats Mode
Whenmode: "advanced", returns an array of advanced statistics:
Array of advanced statistics objects for each model.
Key Metrics Explained
Sharpe Ratio
The Sharpe ratio measures risk-adjusted returns. It’s calculated as:- Higher values indicate better risk-adjusted performance
- Negative values indicate losses or poor risk management
- Assumes risk-free rate of 0%
Win Rate
Percentage of profitable trades:- A 60% win rate means 6 out of 10 trades were profitable
- High win rates don’t guarantee profitability if losses are large
Expectancy
The expected profit per trade:- Positive expectancy means the strategy is profitable over time
- Negative expectancy means losses exceed wins on average
Failure Rate
Percentage of AI invocations that failed:- Includes both workflow-level errors and tool call failures
- High failure rates may indicate AI instability or API issues
Usage Examples
Fetch Overall Stats for All Models
Fetch Advanced Stats for Apex Variant
Filter by Variant and Compare
Source Code Reference
Implementation details:- Router:
src/server/orpc/router/analytics.ts:150-202 - Calculations:
src/server/features/analytics/calculations.ts - Queries:
src/server/features/analytics/queries.server.ts - Shared utilities:
src/core/shared/trading/calculations.ts
Related Endpoints
- Get Leaderboard - Time-windowed performance rankings
- Get Failures - Detailed failure tracking
- Get Run Info - Trading session information

