Skip to main content

Examples

Copy-paste recipes against https://calc.dev.emrgex.com. All rates are decimals (0.10 = 10%), prices are per 100 face, dates are ISO.

Price a stored bond by yield

curl -s https://calc.dev.emrgex.com/v1/quotes -H 'content-type: application/json' -d '{
"quotes": [
{ "instrument_id": "MH12034", "input_kind": "yield", "input_value": 0.10,
"settlement_date": "2026-06-09", "options": { "round": 6 } }
]
}'

Solve a yield from a clean price

curl -s https://calc.dev.emrgex.com/v1/quotes -H 'content-type: application/json' -d '{
"quotes": [
{ "instrument_id": "MH12034", "input_kind": "clean_price", "input_value": 107.85,
"settlement_date": "2026-06-09", "options": { "round": 6 } }
]
}'

Price an ad-hoc bond

curl -s https://calc.dev.emrgex.com/v1/quotes -H 'content-type: application/json' -d '{
"instruments": [
{ "id": "B1", "rate_type": "NOMINAL", "day_count": "ACT/ACT.ICMA", "coupon_type": "FIXED",
"frequency": 2, "start": "2020-01-15", "maturity": "2030-01-15",
"coupon_rate": 0.06, "face_value": 100 }
],
"quotes": [
{ "instrument_id": "B1", "input_kind": "clean_price", "input_value": 95.5,
"settlement_date": "2024-06-18", "options": { "round": 6 } }
]
}'

Settlement cash for a trade size

curl -s https://calc.dev.emrgex.com/v1/quotes -H 'content-type: application/json' -d '{
"quotes": [
{ "instrument_id": "MH12034", "input_kind": "yield", "input_value": 0.10,
"amount_kind": "nominal", "amount_value": 1000000,
"settlement_date": "2026-06-09", "options": { "round": 6 } }
]
}'

The result adds an amounts block (clean_amount, accrued_amount, dirty_amount = settlement cash, quantity).

Batch — price many at once

curl -s https://calc.dev.emrgex.com/v1/quotes -H 'content-type: application/json' -d '{
"quotes": [
{ "instrument_id": "MH12034", "input_kind": "yield", "input_value": 0.10, "settlement_date": "2026-06-09" },
{ "instrument_id": "MH12034", "input_kind": "yield", "input_value": 0.11, "settlement_date": "2026-06-09" },
{ "instrument_id": "MH12034", "input_kind": "clean_price", "input_value": 105.0, "settlement_date": "2026-06-09" }
]
}'

Each quote returns its own status; one failure never breaks the rest.

Callable bond — yield-to-worst

Quote a callable bond by price and ask for the worst yield:

... "input_kind": "clean_price", "input_value": 101.5, "options": { "yield_worst": true } ...

The result's metrics.yield_to_worst is min(yield-to-maturity, every yield-to-call).

Index-linked bond (Brazil NTN-B, Mexico UDIBONO)

Supply the published index nominal (VNA) at valuation via index_ratio; every money output is multiplied by index_ratio/100:

... "options": { "index_ratio": 4250.123456, "round": 6 } ...

Shape metrics (yield, duration, convexity) are unit-free and unaffected.

Regional conventions

MarketTypical convention
Brazil (LTN / NTN-F)day_count: BUS/252 (business days, ANBIMA calendar)
Mexico (Bonos M / CETES)NOMINAL / AT_MATURITY with the relevant ACT base
Dominican Rep. (MoH bonds)day_count: ACT/ACT.DRMH + discount_day_count: ACT/ACT.ICMA

These come pre-set on the stored catalog; for ad-hoc bonds, set them on the instrument. See Conventions.

:::tip Going fast For large batches, omit with_cashflows (much smaller, much faster responses) and send one big batch rather than many single requests. :::