Skip to main content

Contract DSL

POST /api/v1/contract/price

Price any DSL contract via Monte Carlo.

Request

{
"contract": { ... },
"market": {
"spot": 100.0,
"rate": 0.05,
"volatility": 0.20,
"dividend": 0.0
},
"pricer": {
"numPaths": 100000,
"numSteps": 252
}
}

The contract field accepts any ContractSpec variant. The market field provides pricing parameters. For multi-asset contracts, use assets and correlations instead of spot/volatility.

Response

{
"price": 5.234,
"description": "BullCallSpread(SPX, 95/105)"
}

POST /api/v1/contract/describe

Return a human-readable description of a contract without pricing it.

Request

{
"contract": {
"type": "strategy",
"strategy": "straddle",
"underlying": "SPX",
"strike": 100,
"expiry": "2026-12-31"
}
}

Response

{
"description": "Straddle(SPX, K=100)"
}

POST /api/v1/contract/greeks

Price + bump-and-reprice Greeks for any DSL contract.

Response

{
"price": 5.234,
"delta": 0.12,
"gamma": 0.003,
"vega": 15.2,
"theta": -2.1,
"rho": 3.4,
"description": "BullCallSpread(SPX, 95/105)"
}

Greeks are computed by bumping spot (±1%), vol (+1%), rate (+1bp), and time (-1d).

POST /api/v1/strategy/price

Shortcut to price a named strategy. Same as /contract/price with type: "strategy".

Request

{
"strategy": {
"strategy": "iron_condor",
"underlying": "SPX",
"putBuy": 90,
"putSell": 95,
"callSell": 105,
"callBuy": 110,
"expiry": "2026-12-31"
},
"market": { "spot": 100, "rate": 0.05, "volatility": 0.20 }
}

Multi-asset example

{
"contract": {
"type": "worst_of_autocall",
"underlyings": ["AAPL", "MSFT", "GOOGL"],
"observationDates": ["2026-06-15", "2026-12-15"],
"callBarrier": 1.0,
"couponBarrier": 0.8,
"protectionBarrier": 0.6,
"couponRate": 0.02,
"productType": "phoenix",
"memoryCoupon": true
},
"market": {
"rate": 0.05,
"assets": {
"AAPL": { "spot": 180, "volatility": 0.25, "dividend": 0.005 },
"MSFT": { "spot": 400, "volatility": 0.22, "dividend": 0.008 },
"GOOGL": { "spot": 140, "volatility": 0.28, "dividend": 0.0 }
},
"correlations": [
{ "asset1": "AAPL", "asset2": "MSFT", "correlation": 0.7 },
{ "asset1": "AAPL", "asset2": "GOOGL", "correlation": 0.6 },
{ "asset1": "MSFT", "asset2": "GOOGL", "correlation": 0.65 }
]
}
}