S
StockBud Docs

StockBud.io Metrics and Analytics Schema

Schema for metrics collection, analytics, and performance tracking in StockBud.io

📊 StockBud.io Metrics and Analytics Schema

Version: 1.0.0

Schema for metrics collection, analytics, and performance tracking in StockBud.io

Overview

This schema defines 9 data structures:


Definitions

MetricPoint

Individual metric data point

Properties

PropertyTypeRequiredDescription
namestringMetric name/identifier
valuenumberMetric value
timestampstringMetric timestamp
tagsobjectMetric tags for filtering and grouping
metadataobjectAdditional metric metadata

TypeScript

interface MetricPoint {
  /** Metric name/identifier */
  name: string;
  /** Metric value */
  value: number;
  /** Metric timestamp */
  timestamp: string;
  /** Metric tags for filtering and grouping */
  tags?: Record<string, unknown>;
  /** Additional metric metadata */
  metadata?: Record<string, unknown>;
}

MetricSeries

Time series of metric points

Properties

PropertyTypeRequiredDescription
metric_namestringName of the metric
data_pointsArray<MetricPoint>Array of metric data points
aggregation_typeenum: 'sum', 'average', 'min', 'max', 'count', 'percentile', 'rate'Aggregation method used
time_windowenum: 'minute', 'hour', 'day', 'week', 'month', 'year'Time window for aggregation
start_timestringSeries start time
end_timestringSeries end time

TypeScript

interface MetricSeries {
  /** Name of the metric */
  metric_name: string;
  /** Array of metric data points */
  data_points: MetricPoint[];
  /** Aggregation method used */
  aggregation_type?: "sum" | "average" | "min" | "max" | "count" | "percentile" | "rate";
  /** Time window for aggregation */
  time_window?: "minute" | "hour" | "day" | "week" | "month" | "year";
  /** Series start time */
  start_time?: string;
  /** Series end time */
  end_time?: string;
}

PerformanceMetrics

Portfolio and trading performance metrics

Properties

PropertyTypeRequiredDescription
total_returnnumberTotal return percentage
annualized_returnnumberAnnualized return percentage
sharpe_rationumberSharpe ratio
sortino_rationumberSortino ratio
calmar_rationumberCalmar ratio
max_drawdownnumberMaximum drawdown percentage
volatilitynumberPortfolio volatility
betanumberPortfolio beta vs benchmark
alphanumberPortfolio alpha vs benchmark
win_ratenumberWin rate (percentage of profitable trades)
profit_factornumberProfit factor (gross profit / gross loss)
average_winnumberAverage winning trade amount
average_lossnumberAverage losing trade amount
largest_winnumberLargest winning trade amount
largest_lossnumberLargest losing trade amount
total_tradesintegerTotal number of trades
winning_tradesintegerNumber of winning trades
losing_tradesintegerNumber of losing trades
avg_trade_durationnumberAverage trade duration in hours
turnover_ratenumberPortfolio turnover rate
information_rationumberInformation ratio vs benchmark
tracking_errornumberTracking error vs benchmark
var_95numberValue at Risk (95% confidence)
cvar_95numberConditional Value at Risk (95% confidence)
period_startstringPerformance period start
period_endstringPerformance period end
benchmarkstringBenchmark symbol used for comparison

TypeScript

interface PerformanceMetrics {
  /** Total return percentage */
  total_return?: number;
  /** Annualized return percentage */
  annualized_return?: number;
  /** Sharpe ratio */
  sharpe_ratio?: number;
  /** Sortino ratio */
  sortino_ratio?: number;
  /** Calmar ratio */
  calmar_ratio?: number;
  /** Maximum drawdown percentage */
  max_drawdown?: number;
  /** Portfolio volatility */
  volatility?: number;
  /** Portfolio beta vs benchmark */
  beta?: number;
  /** Portfolio alpha vs benchmark */
  alpha?: number;
  /** Win rate (percentage of profitable trades) */
  win_rate?: number;
  /** Profit factor (gross profit / gross loss) */
  profit_factor?: number;
  /** Average winning trade amount */
  average_win?: number;
  /** Average losing trade amount */
  average_loss?: number;
  /** Largest winning trade amount */
  largest_win?: number;
  /** Largest losing trade amount */
  largest_loss?: number;
  /** Total number of trades */
  total_trades?: number;
  /** Number of winning trades */
  winning_trades?: number;
  /** Number of losing trades */
  losing_trades?: number;
  /** Average trade duration in hours */
  avg_trade_duration?: number;
  /** Portfolio turnover rate */
  turnover_rate?: number;
  /** Information ratio vs benchmark */
  information_ratio?: number;
  /** Tracking error vs benchmark */
  tracking_error?: number;
  /** Value at Risk (95% confidence) */
  var_95?: number;
  /** Conditional Value at Risk (95% confidence) */
  cvar_95?: number;
  /** Performance period start */
  period_start?: string;
  /** Performance period end */
  period_end?: string;
  /** Benchmark symbol used for comparison */
  benchmark?: string;
}

Alert

System alert based on metrics

Properties

PropertyTypeRequiredDescription
idstringUnique alert identifier
alert_typeenum: 'performance', 'risk', 'system', 'compliance', 'market', 'portfolio', 'trade_execution'Type of alert
severityenum: 'low', 'medium', 'high', 'critical'Alert severity level
titlestringAlert title
messagestringAlert message
metric_namestringRelated metric name
metric_valuenumberMetric value that triggered alert
thresholdnumberThreshold that was breached
conditionenum: 'above', 'below', 'equal', 'not_equal', 'change_rate'Condition that triggered alert
affected_symbolsArray<string>Symbols affected by this alert
recommended_actionsArray<string>Recommended actions
acknowledgedbooleanWhether alert has been acknowledged
acknowledged_bystringWho acknowledged the alert
acknowledged_atstringWhen alert was acknowledged
resolvedbooleanWhether alert has been resolved
resolved_atstringWhen alert was resolved
timestampstringAlert creation timestamp
expires_atstringAlert expiration timestamp

TypeScript

interface Alert {
  /** Unique alert identifier */
  id: string;
  /** Type of alert */
  alert_type: "performance" | "risk" | "system" | "compliance" | "market" | "portfolio" | "trade_execution";
  /** Alert severity level */
  severity: "low" | "medium" | "high" | "critical";
  /** Alert title */
  title?: string;
  /** Alert message */
  message: string;
  /** Related metric name */
  metric_name?: string;
  /** Metric value that triggered alert */
  metric_value?: number;
  /** Threshold that was breached */
  threshold?: number;
  /** Condition that triggered alert */
  condition?: "above" | "below" | "equal" | "not_equal" | "change_rate";
  /** Symbols affected by this alert */
  affected_symbols?: string[];
  /** Recommended actions */
  recommended_actions?: string[];
  /** Whether alert has been acknowledged */
  acknowledged?: boolean;
  /** Who acknowledged the alert */
  acknowledged_by?: string;
  /** When alert was acknowledged */
  acknowledged_at?: string;
  /** Whether alert has been resolved */
  resolved?: boolean;
  /** When alert was resolved */
  resolved_at?: string;
  /** Alert creation timestamp */
  timestamp: string;
  /** Alert expiration timestamp */
  expires_at?: string;
}

Insight

AI-generated insight from analytics

Properties

PropertyTypeRequiredDescription
idstringUnique insight identifier
insight_typeenum: 'performance_analysis', 'risk_assessment', 'market_opportunity', 'portfolio_optimization', 'trend_analysis', 'anomaly_detection', 'correlation_analysis', 'predictive_analysis'Type of insight
confidencenumberConfidence level (0-1)
titlestringInsight title
descriptionstringDetailed insight description
supporting_dataobjectData supporting the insight
affected_metricsArray<string>Metrics related to this insight
affected_symbolsArray<string>Symbols affected by this insight
recommended_actionsArray<string>Recommended actions based on insight
impact_scorenumberExpected impact score (0-10)
time_horizonenum: 'immediate', 'short_term', 'medium_term', 'long_term'Time horizon for the insight
generated_atstringInsight generation timestamp
valid_untilstringInsight validity expiration

TypeScript

interface Insight {
  /** Unique insight identifier */
  id: string;
  /** Type of insight */
  insight_type: "performance_analysis" | "risk_assessment" | "market_opportunity" | "portfolio_optimization" | "trend_analysis" | "anomaly_detection" | "correlation_analysis" | "predictive_analysis";
  /** Confidence level (0-1) */
  confidence: number;
  /** Insight title */
  title: string;
  /** Detailed insight description */
  description: string;
  /** Data supporting the insight */
  supporting_data?: Record<string, unknown>;
  /** Metrics related to this insight */
  affected_metrics?: string[];
  /** Symbols affected by this insight */
  affected_symbols?: string[];
  /** Recommended actions based on insight */
  recommended_actions?: string[];
  /** Expected impact score (0-10) */
  impact_score?: number;
  /** Time horizon for the insight */
  time_horizon?: "immediate" | "short_term" | "medium_term" | "long_term";
  /** Insight generation timestamp */
  generated_at?: string;
  /** Insight validity expiration */
  valid_until?: string;
}

SystemMetrics

System performance and health metrics

Properties

PropertyTypeRequiredDescription
cpu_usagenumberCPU usage percentage
memory_usagenumberMemory usage percentage
disk_usagenumberDisk usage percentage
network_latencynumberNetwork latency in milliseconds
api_response_timenumberAverage API response time in milliseconds
database_connectionsintegerActive database connections
active_usersintegerNumber of active users
error_ratenumberError rate (0-1)
uptimenumberSystem uptime in hours
last_backupstringLast backup timestamp
timestampstringMetrics collection timestamp

TypeScript

interface SystemMetrics {
  /** CPU usage percentage */
  cpu_usage?: number;
  /** Memory usage percentage */
  memory_usage?: number;
  /** Disk usage percentage */
  disk_usage?: number;
  /** Network latency in milliseconds */
  network_latency?: number;
  /** Average API response time in milliseconds */
  api_response_time?: number;
  /** Active database connections */
  database_connections?: number;
  /** Number of active users */
  active_users?: number;
  /** Error rate (0-1) */
  error_rate?: number;
  /** System uptime in hours */
  uptime?: number;
  /** Last backup timestamp */
  last_backup?: string;
  /** Metrics collection timestamp */
  timestamp?: string;
}

TradingMetrics

Trading-specific metrics and statistics

Properties

PropertyTypeRequiredDescription
orders_placedintegerNumber of orders placed
orders_filledintegerNumber of orders filled
orders_cancelledintegerNumber of orders cancelled
fill_ratenumberOrder fill rate (0-1)
avg_fill_timenumberAverage fill time in seconds
slippagenumberAverage slippage in basis points
commission_paidnumberTotal commission paid
market_impactnumberAverage market impact in basis points
trading_volumenumberTotal trading volume
active_positionsintegerNumber of active positions
portfolio_concentrationnumberPortfolio concentration (Herfindahl index)
sector_diversificationnumberSector diversification score
timestampstringMetrics timestamp

TypeScript

interface TradingMetrics {
  /** Number of orders placed */
  orders_placed?: number;
  /** Number of orders filled */
  orders_filled?: number;
  /** Number of orders cancelled */
  orders_cancelled?: number;
  /** Order fill rate (0-1) */
  fill_rate?: number;
  /** Average fill time in seconds */
  avg_fill_time?: number;
  /** Average slippage in basis points */
  slippage?: number;
  /** Total commission paid */
  commission_paid?: number;
  /** Average market impact in basis points */
  market_impact?: number;
  /** Total trading volume */
  trading_volume?: number;
  /** Number of active positions */
  active_positions?: number;
  /** Portfolio concentration (Herfindahl index) */
  portfolio_concentration?: number;
  /** Sector diversification score */
  sector_diversification?: number;
  /** Metrics timestamp */
  timestamp?: string;
}

Dashboard

Dashboard configuration and layout

Properties

PropertyTypeRequiredDescription
idstringUnique dashboard identifier
namestringDashboard name
descriptionstringDashboard description
widgetsArray<Widget>Dashboard widgets
layoutobjectDashboard layout configuration
refresh_intervalintegerRefresh interval in seconds
created_bystringDashboard creator
created_atstringCreation timestamp
updated_atstringLast update timestamp

TypeScript

interface Dashboard {
  /** Unique dashboard identifier */
  id: string;
  /** Dashboard name */
  name: string;
  /** Dashboard description */
  description?: string;
  /** Dashboard widgets */
  widgets: Widget[];
  /** Dashboard layout configuration */
  layout?: Record<string, unknown>;
  /** Refresh interval in seconds */
  refresh_interval?: number;
  /** Dashboard creator */
  created_by?: string;
  /** Creation timestamp */
  created_at?: string;
  /** Last update timestamp */
  updated_at?: string;
}

Widget

Dashboard widget configuration

Properties

PropertyTypeRequiredDescription
idstringUnique widget identifier
typeenum: 'line_chart', 'bar_chart', 'pie_chart', 'table', 'metric_card', 'gauge', 'heatmap', 'candlestick', 'scatter_plot'Widget type
titlestringWidget title
descriptionstringWidget description
data_sourcestringData source for the widget
metricsArray<string>Metrics to display
filtersobjectData filters
time_rangeobjectTime range for data
positionobjectWidget position and size
optionsobjectWidget-specific options

TypeScript

interface Widget {
  /** Unique widget identifier */
  id: string;
  /** Widget type */
  type: "line_chart" | "bar_chart" | "pie_chart" | "table" | "metric_card" | "gauge" | "heatmap" | "candlestick" | "scatter_plot";
  /** Widget title */
  title: string;
  /** Widget description */
  description?: string;
  /** Data source for the widget */
  data_source?: string;
  /** Metrics to display */
  metrics?: string[];
  /** Data filters */
  filters?: Record<string, unknown>;
  /** Time range for data */
  time_range?: Record<string, unknown>;
  /** Widget position and size */
  position?: Record<string, unknown>;
  /** Widget-specific options */
  options?: Record<string, unknown>;
}

Usage Example

import type { MetricPoint, MetricSeries, PerformanceMetrics, Alert, Insight, SystemMetrics, TradingMetrics, Dashboard, Widget } from '@stockbud/schemas';
 
// Create a new MetricPoint
const example: MetricPoint = {
  name: "example-value",
  value: 0,
  timestamp: "example-value",
};

Full JSON Schema

Click to expand raw JSON Schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "StockBud.io Metrics and Analytics Schema",
  "description": "Schema for metrics collection, analytics, and performance tracking in StockBud.io",
  "version": "1.0.0",
  "type": "object",
  "definitions": {
    "MetricPoint": {
      "type": "object",
      "description": "Individual metric data point",
      "required": [
        "name",
        "value",
        "timestamp"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Metric name/identifier"
        },
        "value": {
          "type": "number",
          "description": "Metric value"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Metric timestamp"
        },
        "tags": {
          "type": "object",
          "patternProperties": {
            "^[a-zA-Z0-9_]+$": {
              "type": "string"
            }
          },
          "description": "Metric tags for filtering and grouping"
        },
        "metadata": {
          "type": "object",
          "description": "Additional metric metadata"
        }
      }
    },
    "MetricSeries": {
      "type": "object",
      "description": "Time series of metric points",
      "required": [
        "metric_name",
        "data_points"
      ],
      "properties": {
        "metric_name": {
          "type": "string",
          "description": "Name of the metric"
        },
        "data_points": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/MetricPoint"
          },
          "description": "Array of metric data points"
        },
        "aggregation_type": {
          "type": "string",
          "enum": [
            "sum",
            "average",
            "min",
            "max",
            "count",
            "percentile",
            "rate"
          ],
          "description": "Aggregation method used"
        },
        "time_window": {
          "type": "string",
          "enum": [
            "minute",
            "hour",
            "day",
            "week",
            "month",
            "year"
          ],
          "description": "Time window for aggregation"
        },
        "start_time": {
          "type": "string",
          "format": "date-time",
          "description": "Series start time"
        },
        "end_time": {
          "type": "string",
          "format": "date-time",
          "description": "Series end time"
        }
      }
    },
    "PerformanceMetrics": {
      "type": "object",
      "description": "Portfolio and trading performance metrics",
      "properties": {
        "total_return": {
          "type": "number",
          "description": "Total return percentage"
        },
        "annualized_return": {
          "type": "number",
          "description": "Annualized return percentage"
        },
        "sharpe_ratio": {
          "type": "number",
          "description": "Sharpe ratio"
        },
        "sortino_ratio": {
          "type": "number",
          "description": "Sortino ratio"
        },
        "calmar_ratio": {
          "type": "number",
          "description": "Calmar ratio"
        },
        "max_drawdown": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Maximum drawdown percentage"
        },
        "volatility": {
          "type": "number",
          "minimum": 0,
          "description": "Portfolio volatility"
        },
        "beta": {
          "type": "number",
          "description": "Portfolio beta vs benchmark"
        },
        "alpha": {
          "type": "number",
          "description": "Portfolio alpha vs benchmark"
        },
        "win_rate": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Win rate (percentage of profitable trades)"
        },
        "profit_factor": {
          "type": "number",
          "minimum": 0,
          "description": "Profit factor (gross profit / gross loss)"
        },
        "average_win": {
          "type": "number",
          "description": "Average winning trade amount"
        },
        "average_loss": {
          "type": "number",
          "description": "Average losing trade amount"
        },
        "largest_win": {
          "type": "number",
          "description": "Largest winning trade amount"
        },
        "largest_loss": {
          "type": "number",
          "description": "Largest losing trade amount"
        },
        "total_trades": {
          "type": "integer",
          "minimum": 0,
          "description": "Total number of trades"
        },
        "winning_trades": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of winning trades"
        },
        "losing_trades": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of losing trades"
        },
        "avg_trade_duration": {
          "type": "number",
          "minimum": 0,
          "description": "Average trade duration in hours"
        },
        "turnover_rate": {
          "type": "number",
          "minimum": 0,
          "description": "Portfolio turnover rate"
        },
        "information_ratio": {
          "type": "number",
          "description": "Information ratio vs benchmark"
        },
        "tracking_error": {
          "type": "number",
          "minimum": 0,
          "description": "Tracking error vs benchmark"
        },
        "var_95": {
          "type": "number",
          "description": "Value at Risk (95% confidence)"
        },
        "cvar_95": {
          "type": "number",
          "description": "Conditional Value at Risk (95% confidence)"
        },
        "period_start": {
          "type": "string",
          "format": "date-time",
          "description": "Performance period start"
        },
        "period_end": {
          "type": "string",
          "format": "date-time",
          "description": "Performance period end"
        },
        "benchmark": {
          "type": "string",
          "description": "Benchmark symbol used for comparison"
        }
      }
    },
    "Alert": {
      "type": "object",
      "description": "System alert based on metrics",
      "required": [
        "id",
        "alert_type",
        "severity",
        "message",
        "timestamp"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique alert identifier"
        },
        "alert_type": {
          "type": "string",
          "enum": [
            "performance",
            "risk",
            "system",
            "compliance",
            "market",
            "portfolio",
            "trade_execution"
          ],
          "description": "Type of alert"
        },
        "severity": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high",
            "critical"
          ],
          "description": "Alert severity level"
        },
        "title": {
          "type": "string",
          "description": "Alert title"
        },
        "message": {
          "type": "string",
          "description": "Alert message"
        },
        "metric_name": {
          "type": "string",
          "description": "Related metric name"
        },
        "metric_value": {
          "type": "number",
          "description": "Metric value that triggered alert"
        },
        "threshold": {
          "type": "number",
          "description": "Threshold that was breached"
        },
        "condition": {
          "type": "string",
          "enum": [
            "above",
            "below",
            "equal",
            "not_equal",
            "change_rate"
          ],
          "description": "Condition that triggered alert"
        },
        "affected_symbols": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Symbols affected by this alert"
        },
        "recommended_actions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recommended actions"
        },
        "acknowledged": {
          "type": "boolean",
          "default": false,
          "description": "Whether alert has been acknowledged"
        },
        "acknowledged_by": {
          "type": "string",
          "description": "Who acknowledged the alert"
        },
        "acknowledged_at": {
          "type": "string",
          "format": "date-time",
          "description": "When alert was acknowledged"
        },
        "resolved": {
          "type": "boolean",
          "default": false,
          "description": "Whether alert has been resolved"
        },
        "resolved_at": {
          "type": "string",
          "format": "date-time",
          "description": "When alert was resolved"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Alert creation timestamp"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "description": "Alert expiration timestamp"
        }
      }
    },
    "Insight": {
      "type": "object",
      "description": "AI-generated insight from analytics",
      "required": [
        "id",
        "insight_type",
        "confidence",
        "title",
        "description"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique insight identifier"
        },
        "insight_type": {
          "type": "string",
          "enum": [
            "performance_analysis",
            "risk_assessment",
            "market_opportunity",
            "portfolio_optimization",
            "trend_analysis",
            "anomaly_detection",
            "correlation_analysis",
            "predictive_analysis"
          ],
          "description": "Type of insight"
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Confidence level (0-1)"
        },
        "title": {
          "type": "string",
          "description": "Insight title"
        },
        "description": {
          "type": "string",
          "description": "Detailed insight description"
        },
        "supporting_data": {
          "type": "object",
          "description": "Data supporting the insight"
        },
        "affected_metrics": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Metrics related to this insight"
        },
        "affected_symbols": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Symbols affected by this insight"
        },
        "recommended_actions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recommended actions based on insight"
        },
        "impact_score": {
          "type": "number",
          "minimum": 0,
          "maximum": 10,
          "description": "Expected impact score (0-10)"
        },
        "time_horizon": {
          "type": "string",
          "enum": [
            "immediate",
            "short_term",
            "medium_term",
            "long_term"
          ],
          "description": "Time horizon for the insight"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Insight generation timestamp"
        },
        "valid_until": {
          "type": "string",
          "format": "date-time",
          "description": "Insight validity expiration"
        }
      }
    },
    "SystemMetrics": {
      "type": "object",
      "description": "System performance and health metrics",
      "properties": {
        "cpu_usage": {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "description": "CPU usage percentage"
        },
        "memory_usage": {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "description": "Memory usage percentage"
        },
        "disk_usage": {
          "type": "number",
          "minimum": 0,
          "maximum": 100,
          "description": "Disk usage percentage"
        },
        "network_latency": {
          "type": "number",
          "minimum": 0,
          "description": "Network latency in milliseconds"
        },
        "api_response_time": {
          "type": "number",
          "minimum": 0,
          "description": "Average API response time in milliseconds"
        },
        "database_connections": {
          "type": "integer",
          "minimum": 0,
          "description": "Active database connections"
        },
        "active_users": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of active users"
        },
        "error_rate": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Error rate (0-1)"
        },
        "uptime": {
          "type": "number",
          "minimum": 0,
          "description": "System uptime in hours"
        },
        "last_backup": {
          "type": "string",
          "format": "date-time",
          "description": "Last backup timestamp"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Metrics collection timestamp"
        }
      }
    },
    "TradingMetrics": {
      "type": "object",
      "description": "Trading-specific metrics and statistics",
      "properties": {
        "orders_placed": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of orders placed"
        },
        "orders_filled": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of orders filled"
        },
        "orders_cancelled": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of orders cancelled"
        },
        "fill_rate": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Order fill rate (0-1)"
        },
        "avg_fill_time": {
          "type": "number",
          "minimum": 0,
          "description": "Average fill time in seconds"
        },
        "slippage": {
          "type": "number",
          "description": "Average slippage in basis points"
        },
        "commission_paid": {
          "type": "number",
          "minimum": 0,
          "description": "Total commission paid"
        },
        "market_impact": {
          "type": "number",
          "minimum": 0,
          "description": "Average market impact in basis points"
        },
        "trading_volume": {
          "type": "number",
          "minimum": 0,
          "description": "Total trading volume"
        },
        "active_positions": {
          "type": "integer",
          "minimum": 0,
          "description": "Number of active positions"
        },
        "portfolio_concentration": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Portfolio concentration (Herfindahl index)"
        },
        "sector_diversification": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Sector diversification score"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Metrics timestamp"
        }
      }
    },
    "Dashboard": {
      "type": "object",
      "description": "Dashboard configuration and layout",
      "required": [
        "id",
        "name",
        "widgets"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique dashboard identifier"
        },
        "name": {
          "type": "string",
          "description": "Dashboard name"
        },
        "description": {
          "type": "string",
          "description": "Dashboard description"
        },
        "widgets": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Widget"
          },
          "description": "Dashboard widgets"
        },
        "layout": {
          "type": "object",
          "description": "Dashboard layout configuration"
        },
        "refresh_interval": {
          "type": "integer",
          "minimum": 1,
          "description": "Refresh interval in seconds"
        },
        "created_by": {
          "type": "string",
          "description": "Dashboard creator"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Creation timestamp"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "Last update timestamp"
        }
      }
    },
    "Widget": {
      "type": "object",
      "description": "Dashboard widget configuration",
      "required": [
        "id",
        "type",
        "title"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique widget identifier"
        },
        "type": {
          "type": "string",
          "enum": [
            "line_chart",
            "bar_chart",
            "pie_chart",
            "table",
            "metric_card",
            "gauge",
            "heatmap",
            "candlestick",
            "scatter_plot"
          ],
          "description": "Widget type"
        },
        "title": {
          "type": "string",
          "description": "Widget title"
        },
        "description": {
          "type": "string",
          "description": "Widget description"
        },
        "data_source": {
          "type": "string",
          "description": "Data source for the widget"
        },
        "metrics": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Metrics to display"
        },
        "filters": {
          "type": "object",
          "description": "Data filters"
        },
        "time_range": {
          "type": "object",
          "properties": {
            "start": {
              "type": "string",
              "format": "date-time"
            },
            "end": {
              "type": "string",
              "format": "date-time"
            },
            "relative": {
              "type": "string",
              "enum": [
                "1h",
                "1d",
                "1w",
                "1m",
                "3m",
                "1y"
              ]
            }
          },
          "description": "Time range for data"
        },
        "position": {
          "type": "object",
          "properties": {
            "x": {
              "type": "integer"
            },
            "y": {
              "type": "integer"
            },
            "width": {
              "type": "integer"
            },
            "height": {
              "type": "integer"
            }
          },
          "description": "Widget position and size"
        },
        "options": {
          "type": "object",
          "description": "Widget-specific options"
        }
      }
    }
  },
  "properties": {
    "metric_points": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/MetricPoint"
      }
    },
    "metric_series": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/MetricSeries"
      }
    },
    "performance_metrics": {
      "$ref": "#/definitions/PerformanceMetrics"
    },
    "alerts": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Alert"
      }
    },
    "insights": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Insight"
      }
    },
    "system_metrics": {
      "$ref": "#/definitions/SystemMetrics"
    },
    "trading_metrics": {
      "$ref": "#/definitions/TradingMetrics"
    },
    "dashboards": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/Dashboard"
      }
    }
  }
}