其他端點
所有端點均位於 https://calc.dev.emrgex.com/v1 之下。
POST /v1/carry
針對一組臨時(ad-hoc)及/或已儲存工具的每日持有收益(carry,即有效利率法)——批次處理。每個
carries 項目會引用一項工具,並提供一個輸入值,以及(選擇性地)一個 carry_to 期界
(留空=下一個票息日)。
curl -s https://calc.dev.emrgex.com/v1/carry -H 'content-type: application/json' -d '{
"carries": [
{ "instrument_id": "MH12034", "input_kind": "yield", "input_value": 0.10,
"settlement_date": "2026-06-09", "carry_to": "2026-09-09" }
]
}'
POST /v1/generate_cash_flows
為一組臨時(ad-hoc)及/或已儲存工具產生現金流排程——批次處理。
curl -s https://calc.dev.emrgex.com/v1/generate_cash_flows -H 'content-type: application/json' -d '{
"schedules": [ { "instrument_id": "MH12034" } ]
}'
GET /v1/admin/conventions
探索功能:列出引擎所支援的每一種 rate_type 與 day_count,每項皆附有說明,並包含
calculation_code 的格式。詳見 慣例。
curl https://calc.dev.emrgex.com/v1/admin/conventions
GET /v1/admin/instruments
列出已儲存工具的特性(除非設定 with_cashflows=true,否則不含現金流陣列;
cashflow_count 一律包含)。所有篩選條件皆為選擇性,且以 AND 邏輯組合。
| Query param | Match |
|---|---|
rate_type、day_count、calculation_code、currency、period_name | 完全相符 |
issuer、rate_kind、name | 子字串(不分大小寫) |
q | 跨 id/nemo/isin/issuer/name 的子字串 |
amortizing、callable | 布林值 |
maturity_from、maturity_to | 含端點的日期範圍 |
coupon_min、coupon_max | 範圍 |
sort | id · nemo · issuer · maturity · coupon |
order | asc · desc |
limit(≤ 1000)、offset | 分頁;limit=0 僅回傳總數 |
with_cashflows | 包含各工具已儲存的排程 |
curl "https://calc.dev.emrgex.com/v1/admin/instruments?callable=true&sort=maturity&limit=10"
PATCH /v1/admin/instruments/{id}
就地更新已儲存工具的 coupon_rate 及/或 coupon_type——例如浮動利率
重設或重新議定(repactuação)。此變更為記憶體內的覆寫(重新載入目錄即可還原檔案
原貌),並會使快取失效,讓下一次計算反映該變更。
curl -s -X PATCH https://calc.dev.emrgex.com/v1/admin/instruments/MH12034 \
-H 'content-type: application/json' -d '{ "coupon_rate": 0.12 }'
POST /v1/admin/cache/reload
重新載入工具儲存庫(原子交換,非致命性)。
健康檢查探針
| Endpoint | Purpose |
|---|---|
GET /v1/health/livez | 存活檢查(僅程序本身) |
GET /v1/health/readyz | 就緒檢查(排空期間會失敗) |
GET /v1/health/startupz | 啟動檢查(暖載入完成) |
curl https://calc.dev.emrgex.com/v1/health/livez # {"status":"alive"}
錯誤
錯誤採用 RFC 7807 的 application/problem+json 格式,包含
type、title、status 與 detail。在批次處理中,個別項目的失敗會以該項目的
error 形式呈現,其餘項目則正常成功。