はじめに
ベースURLと規約
| ベースURL | https://calc.dev.emrgex.com |
| プレフィックス | すべてのエンドポイントは /v1 配下にあります |
| レートと利回り | 小数表記 — 0.06 は6%を意味します |
| 価格 | 額面100あたりの価格 |
| 日付 | ISO形式 YYYY-MM-DD |
| コンテンツタイプ | application/json |
最初のリクエスト
登録済み(stored) インストゥルメントを評価します。instrument_id で参照し、利回りを指定します。
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 } }
]
}'
レスポンスは バッチエンベロープ です。クォートごとに1エントリが返され、それぞれが独自の status を持ちます。
{
"data": [
{
"index": 0,
"id": "MH12034",
"status": "ok",
"data": {
"instrument_id": "MH12034",
"convention": "NOMINAL · ACT/ACT.DRMH",
"calculation_code": "ACT/ACT.DRMH|NOMINAL",
"metrics": {
"yield": 0.1,
"dirty_price": 112.547645,
"clean_price": 107.853124,
"accrued_interest": 4.694521,
"modified_duration": 5.12,
"convexity": 33.7,
"dv01": 0.0576
}
}
}
]
}
利回りではなく価格で評価する
input_kind を clean_price または dirty_price に設定すると、emrgexが 利回りを逆算 します。
{ "instrument_id": "MH12034", "input_kind": "clean_price", "input_value": 107.85,
"settlement_date": "2026-06-09", "options": { "round": 6 } }
独自の債券を定義する(アドホック)
インストゥルメントを instruments 内にインラインで記述し、quotes からその id を参照します。
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 } }
]
}'
取引数量を追加する
amount を指定すると、額面100あたりの価格に加えて、金額ベースの数値(受渡金額)が得られます。
{ "instrument_id": "MH12034", "input_kind": "yield", "input_value": 0.10,
"amount_kind": "nominal", "amount_value": 1000000,
"settlement_date": "2026-06-09", "options": { "round": 6 } }
ヘルスチェック
curl https://calc.dev.emrgex.com/v1/health/livez
# {"status":"alive"}
:::tip Performance
大量に評価するには、多数のクォートを 1回 の /v1/quotes リクエスト(バッチ)でまとめて送信してください。各債券のスケジュールが必要な場合を除き、with_cashflows は オフ のままにしてください。レスポンスが大幅に小さく、高速になります。
:::
:::note Authentication 開発用サービスは現在オープンになっています(APIキー不要)。本番環境のデプロイではHMACリクエスト署名を有効化できます。 :::