SDK reference
Intelligence
pg.intelligence — net outflow forecasts, corridor health, the state reading, advice measured against its baseline, the evaluation, and the bounds of automatic application.
Scope intelligence. Intelligence reads the positions and corridors of the deployment and gives
advice. It never loosens a control, approves, or moves value: an advice either tightens or proposes,
and a proposal goes through the approvals of a person.
| Call | Returns | |
|---|---|---|
forecast(account, horizonHours?) | Forecast | The hourly forecast of net outflow of an account, nostro:-:<physical account>:<asset>. horizonHours is 1 to 720, 72 by default |
health(corridor) | CorridorHealth | The health of a corridor, ASSET@network>ASSET@network: a score and its factors |
state() | StateReading | The state reading: a summary, the positions, breakers and shortfalls, with reasons |
listAdvice(filter?) | Advice[] | Filter { topic?, subject?, active?, after?, limit? }; limit 1 to 1000, 100 by default |
advice(id) | Advice | One advice |
evaluation(range?) | Evaluation | Advice and forecasts against what was realised, over { from, to } (ISO 8601, given together) or over all of them |
bounds() | IntelligenceBounds | The bounds of automatic application |
setBounds(input) | { bounds } | ApprovalWaiting | Operator call. Changes the bounds (BoundsRequest) under an approval bounds_change: without approval the call requests it |
Forecasts
A Forecast is { subject, horizon_hours, buckets, source, model?, as_of }. Each bucket is one hour,
{ at, p50, p90, p99 }; a positive value is value leaving the account. source is baseline or
model.
const forecast = await pg.intelligence.forecast(position.account, 24);
const peak = forecast.buckets.reduce((max, b) => (Number(b.p99) > Number(max) ? b.p99 : max), '0');Advice
An Advice is a choice among bounded options, with the deterministic baseline it is measured
against.
| Field | |
|---|---|
topic | refuel_plan, buffer, corridor, anomaly, state |
subject | What it is about |
options, choice | The options it chose from, and its choice |
effect | none, tighten or propose |
source | model or baseline |
reason | Why, for a person |
applied, applied_ref | What was done with it, and the object that carries it (a proposed transfer, for one) |
outcome | Once evaluated: what was realised and whether it agreed with the baseline |
A treasury transfer that follows an advice names it in advice
(treasury.proposeTransfer).
| Code | Status | When |
|---|---|---|
pathglobal.intelligence.out_of_bounds | 422 | setBounds: the bounds asked for are not admitted |
pathglobal.risk.approval_invalid | 409 | setBounds: the approval is absent, not approved, expired, used, or for another change |
The routes are on Intelligence.