跳至主要内容

其他端點

所有端點均位於 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_typeday_count,每項皆附有說明,並包含 calculation_code 的格式。詳見 慣例

curl https://calc.dev.emrgex.com/v1/admin/conventions

GET /v1/admin/instruments

列出已儲存工具的特性(除非設定 with_cashflows=true,否則不含現金流陣列; cashflow_count 一律包含)。所有篩選條件皆為選擇性,且以 AND 邏輯組合。

Query paramMatch
rate_typeday_countcalculation_codecurrencyperiod_name完全相符
issuerrate_kindname子字串(不分大小寫)
q跨 id/nemo/isin/issuer/name 的子字串
amortizingcallable布林值
maturity_frommaturity_to含端點的日期範圍
coupon_mincoupon_max範圍
sortid · nemo · issuer · maturity · coupon
orderasc · 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

重新載入工具儲存庫(原子交換,非致命性)。

健康檢查探針

EndpointPurpose
GET /v1/health/livez存活檢查(僅程序本身)
GET /v1/health/readyz就緒檢查(排空期間會失敗)
GET /v1/health/startupz啟動檢查(暖載入完成)
curl https://calc.dev.emrgex.com/v1/health/livez # {"status":"alive"}

錯誤

錯誤採用 RFC 7807application/problem+json 格式,包含 typetitlestatusdetail。在批次處理中,個別項目的失敗會以該項目的 error 形式呈現,其餘項目則正常成功。