其他端点
所有端点均位于 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
重新加载工具仓库(原子交换,非致命操作)。
Health probes
| 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"}
Errors
错误采用 RFC 7807 的 application/problem+json 格式,包含 type、title、status 和 detail。在批量处理中,单项失败会以该项的 error 形式出现,其余项仍正常成功。