Skip to main content

Overview

The analytics.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

enum
default:"overall"
Statistics mode to retrieve:
  • overall - Core performance metrics (returns, win rate, Sharpe ratio)
  • advanced - Detailed statistics (trade sizes, hold times, leverage, failures)
enum
default:"all"
Filter by AI variant:
  • all - All variants
  • Apex - Apex variant only
  • Trendsurfer - Trendsurfer variant only
  • Contrarian - Contrarian variant only
  • Sovereign - Sovereign variant only

Response Schema

Overall Stats Mode

When mode: "overall", returns an array of overall statistics:
array
Array of overall statistics objects for each model.

Advanced Stats Mode

When mode: "advanced", returns an array of advanced statistics:
array
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