Portfolio calculations
Submit positions once to calculate clearing margin, portfolio analytics, stress tests, or ISDA SIMM.
The canonical field-level contract is the OpenAPI schema.
Calculate a portfolio
POST /portfolios accepts multiple accounts and position types in one request.
Common request fields
- Name
portfolio- Type
- array
- Description
Required. The positions to calculate.
- Name
calculation_type- Type
- string
- Description
margins,analytics,simm,all, or a comma-separated combination.
- Name
currency_code- Type
- string
- Description
Reporting currency. Defaults to
USD.
- Name
risk_metrics- Type
- object
- Description
VaR, expected-shortfall, lookback, confidence, MPOR, and option revaluation settings.
- Name
risk_free_rate- Type
- number
- Description
Optional portfolio-wide analytics override. If omitted, validated ETD options use their maturity-matched rate.
- Name
stress_test_enabled- Type
- boolean
- Description
Run the scenarios available to the caller.
cURL
curl -sS "$C9_API_ENDPOINT/portfolios" \
-H "Authorization: Bearer $C9_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"calculation_type": "margins,analytics",
"portfolio": [{
"account_code": "RATES_1",
"exchange_code": "CME",
"contract_code": "SR3",
"contract_type": "FUT",
"contract_expiry": "MAR-28",
"net_position": 25,
"account_type": "H"
}]
}'
Always inspect exceptions and closest_matches. A request can succeed while individual positions are excluded or corrected.
Focused response fragments
The response contains one result object per account. Start with the summary fields:
{
"account_code": "RATES_1",
"currency_code": "USD",
"initial_margin": 184250.75,
"value_at_risk": 42110.22,
"stress_loss": 88600.00,
"dv01": -3125.40
}
Use the relevant drill-down instead of processing the whole response blindly:
{
"margin_by_ccp": [
{ "clearing_org": "CME", "result_type": "span2", "initial_margin": 184250.75 }
],
"exceptions": [],
"closest_matches": []
}
Other focused sections include margin_by_contract, margin_by_span, margin_by_cmerates, margin_by_events, event_risk, scenario_analysis, stress_tests, and simm_metrics.
Optimize CME rates
POST /portfolios/optimize compares eligible CME listed-rates and cleared-rates allocations. Send the normal portfolio payload and set cross_margin: true on at least one eligible CME rates future.
{
"data": [{
"baseline": { "total": 3527745.46 },
"optimized": { "total": 2992170.20, "saving": 535575.26, "saving_pct": 15.18 },
"legs": [{ "contract_code": "SR3", "recommendation": "MOVE_TO_SEQ" }]
}]
}
The CME cleared-rates engine must be enabled on the caller's licence.