Yield Engine
Accrue interest on ring-fenced vault balances, aggregate yields across accounts, and forecast future earnings. All calculations use decimal.js with ROUND_HALF_UP precision.
/api/v1/engine/yieldEndpoints
POST
/api/v1/engine/yield/accrueSoonCalculate and apply interest accrual for a vault
GET
/api/v1/engine/yield/aggregate/{user_id}SoonGet total yield across all user vaults
GET
/api/v1/engine/yield/vault/{vault_id}SoonGet yield details for a specific vault
POST
/api/v1/engine/yield/forecastSoonForecast yield over a given time horizon
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_id | string | Required | User identifier |
| horizon_months | integer | Required | Forecast horizon in months (max 60) |
| include_reinvestment | boolean | Optional | Whether to compound yield (default: true) |
Example
Request
http
POST /api/v1/engine/yield/forecast HTTP/1.1
Host: api.tpay365.com
Authorization: Bearer sk_live_abc123
Content-Type: application/json
{
"user_id": "usr_8821-9920",
"horizon_months": 12,
"include_reinvestment": true
}Response
json
{
"current_balance": 1250000,
"projected_yield": 43750,
"effective_apy": "3.50",
"monthly_breakdown": [
{ "month": 1, "accrued": 3646, "balance": 1253646 },
{ "month": 2, "accrued": 3656, "balance": 1257302 }
],
"forecast_date": "2027-02-10T00:00:00Z"
}