bitcain docs
API Reference

Portfolio Analytics

Advanced portfolio analytics - risk metrics (Sharpe, Sortino, VaR), attribution analysis, benchmark comparison, and correlation matrix

Get Risk Metrics

GET
/api/v1/portfolio/{portfolio_id}/analytics/risk-metrics

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

portfolio_id*string
Formatuuid

Query Parameters

lookback_days?integer

Lookback period in days

Default30
Range7 <= value <= 365
period?string

Return period

Default"daily"
Match^(hourly|daily|weekly|monthly)$

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/portfolio/497f6eca-6276-4993-bfeb-53cbbbba6f08/analytics/risk-metrics"
{
  "is_simulated": true,
  "simulated_reason": "Insufficient trade history — real calculations require active trading data",
  "sharpe_ratio": "string",
  "sortino_ratio": "string",
  "max_drawdown": "string",
  "var_95": "string",
  "var_99": "string",
  "cvar_95": "string",
  "beta": "string",
  "alpha": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Attribution Analysis

GET
/api/v1/portfolio/{portfolio_id}/analytics/attribution

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

portfolio_id*string
Formatuuid

Query Parameters

period?string

Attribution period

Default"30d"
Match^(1d|7d|30d|90d|1y|ytd|all)$

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/portfolio/497f6eca-6276-4993-bfeb-53cbbbba6f08/analytics/attribution"
{
  "is_simulated": true,
  "simulated_reason": "Insufficient trade history — real calculations require active trading data",
  "asset_attribution": {
    "property1": "string",
    "property2": "string"
  },
  "strategy_attribution": {
    "property1": "string",
    "property2": "string"
  },
  "time_period_attribution": {
    "property1": "string",
    "property2": "string"
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Benchmark Comparison

GET
/api/v1/portfolio/{portfolio_id}/analytics/benchmarks

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

portfolio_id*string
Formatuuid

Query Parameters

lookback_days?integer

Lookback period in days

Default30
Range7 <= value <= 365
benchmarks?array<>

Benchmarks to compare against

Default["BTC","ETH","SPY"]

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/portfolio/497f6eca-6276-4993-bfeb-53cbbbba6f08/analytics/benchmarks"
[
  {
    "is_simulated": true,
    "simulated_reason": "Insufficient trade history — real calculations require active trading data",
    "benchmark_name": "string",
    "portfolio_return": "string",
    "benchmark_return": "string",
    "outperformance": "string",
    "tracking_error": "string",
    "information_ratio": "string"
  }
]
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Correlation Matrix

GET
/api/v1/portfolio/{portfolio_id}/analytics/correlations

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

portfolio_id*string
Formatuuid

Query Parameters

lookback_days?integer

Lookback period in days

Default30
Range7 <= value <= 365

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/portfolio/497f6eca-6276-4993-bfeb-53cbbbba6f08/analytics/correlations"
{
  "is_simulated": true,
  "simulated_reason": "Insufficient trade history — real calculations require active trading data",
  "asset_correlations": {
    "property1": {
      "property1": "string",
      "property2": "string"
    },
    "property2": {
      "property1": "string",
      "property2": "string"
    }
  },
  "last_updated": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Portfolio History

GET
/api/v1/portfolio/{portfolio_id}/history

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

portfolio_id*string
Formatuuid

Query Parameters

start_date?|

Start date for history (ISO format)

end_date?|

End date for history (ISO format)

granularity?string

Time granularity

Default"daily"
Match^(hourly|daily|weekly|monthly)$

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/portfolio/497f6eca-6276-4993-bfeb-53cbbbba6f08/history"
{
  "is_simulated": true,
  "simulated_reason": "Insufficient trade history — real calculations require active trading data",
  "portfolio_id": "5555717d-15c7-408a-aad2-f3155d61ff77",
  "start_date": "2019-08-24T14:15:22Z",
  "end_date": "2019-08-24T14:15:22Z",
  "granularity": "string",
  "data_points": [
    {
      "timestamp": "2019-08-24T14:15:22Z",
      "total_value_usd": "string",
      "return_since_previous": "string",
      "composition": {
        "property1": "string",
        "property2": "string"
      }
    }
  ]
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Analytics Summary

GET
/api/v1/portfolio/{portfolio_id}/analytics/summary

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

portfolio_id*string
Formatuuid

Query Parameters

lookback_days?integer

Lookback period in days

Default30
Range7 <= value <= 365
period?string

Return period

Default"daily"
Match^(hourly|daily|weekly|monthly)$
attribution_period?string

Attribution period

Default"30d"
Match^(1d|7d|30d|90d|1y|ytd|all)$

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/portfolio/497f6eca-6276-4993-bfeb-53cbbbba6f08/analytics/summary"
{
  "is_simulated": true,
  "simulated_reason": "Insufficient trade history — real calculations require active trading data",
  "portfolio_id": "5555717d-15c7-408a-aad2-f3155d61ff77",
  "calculation_date": "2019-08-24T14:15:22Z",
  "risk_metrics": {
    "is_simulated": true,
    "simulated_reason": "Insufficient trade history — real calculations require active trading data",
    "sharpe_ratio": "string",
    "sortino_ratio": "string",
    "max_drawdown": "string",
    "var_95": "string",
    "var_99": "string",
    "cvar_95": "string",
    "beta": "string",
    "alpha": "string"
  },
  "attribution": {
    "is_simulated": true,
    "simulated_reason": "Insufficient trade history — real calculations require active trading data",
    "asset_attribution": {
      "property1": "string",
      "property2": "string"
    },
    "strategy_attribution": {
      "property1": "string",
      "property2": "string"
    },
    "time_period_attribution": {
      "property1": "string",
      "property2": "string"
    }
  },
  "benchmark_comparisons": [
    {
      "is_simulated": true,
      "simulated_reason": "Insufficient trade history — real calculations require active trading data",
      "benchmark_name": "string",
      "portfolio_return": "string",
      "benchmark_return": "string",
      "outperformance": "string",
      "tracking_error": "string",
      "information_ratio": "string"
    }
  ],
  "correlation_matrix": {
    "is_simulated": true,
    "simulated_reason": "Insufficient trade history — real calculations require active trading data",
    "asset_correlations": {
      "property1": {
        "property1": "string",
        "property2": "string"
      },
      "property2": {
        "property1": "string",
        "property2": "string"
      }
    },
    "last_updated": "2019-08-24T14:15:22Z"
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}