Risk and intelligence

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.

CallReturns
forecast(account, horizonHours?)ForecastThe hourly forecast of net outflow of an account, nostro:-:<physical account>:<asset>. horizonHours is 1 to 720, 72 by default
health(corridor)CorridorHealthThe health of a corridor, ASSET@network>ASSET@network: a score and its factors
state()StateReadingThe 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)AdviceOne advice
evaluation(range?)EvaluationAdvice and forecasts against what was realised, over { from, to } (ISO 8601, given together) or over all of them
bounds()IntelligenceBoundsThe bounds of automatic application
setBounds(input){ bounds } | ApprovalWaitingOperator 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
topicrefuel_plan, buffer, corridor, anomaly, state
subjectWhat it is about
options, choiceThe options it chose from, and its choice
effectnone, tighten or propose
sourcemodel or baseline
reasonWhy, for a person
applied, applied_refWhat was done with it, and the object that carries it (a proposed transfer, for one)
outcomeOnce evaluated: what was realised and whether it agreed with the baseline

A treasury transfer that follows an advice names it in advice (treasury.proposeTransfer).

CodeStatusWhen
pathglobal.intelligence.out_of_bounds422setBounds: the bounds asked for are not admitted
pathglobal.risk.approval_invalid409setBounds: the approval is absent, not approved, expired, used, or for another change

The routes are on Intelligence.

On this page