Skip to content

Rebalance from drift

Goal: each morning, find portfolios past their bands and bring them back to target. Scopes: read, plus advise (advisory mandates: a proposal) or trade (discretionary mandates: orders).

Rebalance from driftYour jobIDEALX APIClient (app)1GET /v1/firms/{firmId}/strategies/{strategyId}2followers with driftBp, outside3GET /v1/accounts/{id}/strategies4lines and rebalancing trades5POST /v1/firms/{firmId}/proposals/check6Advisory: POST …/proposals (send)7Accepts the proposal8Discretionary: POST /v1/accounts/{id}/orders9Webhook order.updated
Rebalance from drift
  1. Your job to IDEALX API: GET /v1/firms/{firmId}/strategies/{strategyId}
  2. IDEALX API to Your job: followers with driftBp, outside
  3. Your job to IDEALX API: GET /v1/accounts/{id}/strategies
  4. IDEALX API to Your job: lines and rebalancing trades
  5. Your job to IDEALX API: POST /v1/firms/{firmId}/proposals/check
  6. Your job to IDEALX API: Advisory: POST …/proposals (send)
  7. Client (app) to IDEALX API: Accepts the proposal
  8. Your job to IDEALX API: Discretionary: POST /v1/accounts/{id}/orders
  9. IDEALX API to Your job: Webhook order.updated

For each strategy, GET /v1/firms/{firmId}/strategies/{strategyId} lists its followers with driftBp (how much of the portfolio is away from target, in basis points) and outside (some line is past its band). Pick the followers with outside: true.

"followers": [
{ "assignmentId": "sta_01937f11b2c3d4e5f6a7b8c9d0e1f2a3", "accountId": "acc_01937f00f1e2d3c4b5a6978877665544",
"portfolioId": "ptf_01937f00f1e2d3c4b5a69788776655a2", "account": "Morgan Family Trust", "version": 2,
"total": { "amount": "184220.15", "currency": "AUD" }, "driftBp": 420, "outside": true }
]
GET /v1/accounts/{id}/strategiesThe strategies this account's portfolios follow, and how close they are
Terminal window
curl "$IDEALX_API/v1/accounts/acc_01937f00f1e2d3c4b5a6978877665544/strategies" -H "Authorization: Bearer $IDEALX_API_KEY"
{
"strategies": [
{
"assignmentId": "sta_01937f11b2c3d4e5f6a7b8c9d0e1f2a3",
"accountId": "acc_01937f00f1e2d3c4b5a6978877665544",
"portfolioId": "ptf_01937f00f1e2d3c4b5a69788776655a2",
"strategy": { "id": "stg_01937f10a1b2c3d4e5f6a7b8c9d0e1f2", "name": "Balanced 60/40", "version": 2, "currentVersion": 2, "riskLevel": 4 },
"currency": "AUD",
"approximate": true,
"total": { "amount": "184220.15", "currency": "AUD" },
"driftBp": 420,
"outside": true,
"lines": [
{
"kind": "instrument", "refId": "XASX:EXW", "name": "EXW · Example World Shares ETF", "detail": "etf",
"targetBp": 2500, "currentBp": 2920, "driftBp": 420, "bandBp": 300, "outside": true, "extra": false,
"value": { "amount": "53792.28", "currency": "AUD" },
"change": { "amount": "7737.24", "currency": "AUD" },
"direction": "sell"
},
{
"kind": "instrument", "refId": "XASX:EXB", "name": "EXB · Example Bond Fund", "detail": "etf",
"targetBp": 3500, "currentBp": 3080, "driftBp": -420, "bandBp": 300, "outside": true, "extra": false,
"value": { "amount": "56739.81", "currency": "AUD" },
"change": { "amount": "7737.24", "currency": "AUD" },
"direction": "buy"
}
],
"trades": [
{ "instrumentId": "XASX:EXW", "name": "EXW · Example World Shares ETF", "side": "sell", "quantity": "55", "approxValue": { "amount": "7653.25", "currency": "AUD" } },
{ "instrumentId": "XASX:EXB", "name": "EXB · Example Bond Fund", "side": "buy", "quantity": "155", "approxValue": { "amount": "7725.20", "currency": "AUD" } }
],
"checks": [],
"capped": [],
"objective": "Long-term growth with moderate swings, for clients with a five-year horizon.",
"notes": null,
"benchmark": "XASX:EXS",
"rebalance": { "kind": "drift" },
"firmId": "frm_01937a1b2c3d4e5f6a7b8c9d0e1f2a3b",
"lastRebalancedAt": "2026-08-14T01:00:00.000Z"
}
]
}

trades are worked out at today’s prices, whole units where the listing needs them, and trimmed so no saved check of the strategy is pushed past (capped names the line and the check that held a buy back). Sells never exceed what is held.

POST /v1/firms/{firmId}/proposals/checkDry run: costs, tax estimate and checks for trades, and whether a second approval applies

Send the trades as items, sells first (their proceeds pay for the buys). Use purpose: "trade" for a discretionary trade, "proposal" (the default) for a proposal.

{
"accountId": "acc_01937f00f1e2d3c4b5a6978877665544",
"portfolioId": "ptf_01937f00f1e2d3c4b5a69788776655a2",
"purpose": "trade",
"items": [
{ "kind": "order", "instrumentId": "XASX:EXW", "side": "sell", "type": "market", "quantity": "55" },
{ "kind": "order", "instrumentId": "XASX:EXB", "side": "buy", "type": "market", "quantity": "155" }
]
}

Create the proposal with send: true (or draft and submit), with a title such as Rebalance to Balanced 60/40 (version 2) and the rationale. Second approval applies as for any proposal. Full walkthrough: Draft, check, send and track a proposal.

Place each order with a reason (required for a firm’s own trade, at most 200 characters) and its own Idempotency-Key, sells first:

Terminal window
curl -X POST "$IDEALX_API/v1/accounts/acc_01937f00f1e2d3c4b5a6978877665544/orders" \
-H "Authorization: Bearer $IDEALX_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: rebal-sta_01937f11-2026-11-25-sell-EXW" \
-d '{
"portfolioId": "ptf_01937f00f1e2d3c4b5a69788776655a2",
"instrumentId": "XASX:EXW",
"side": "sell",
"type": "market",
"quantity": "55",
"reason": "Rebalance to Balanced 60/40 v2: world shares 4.2 points above target"
}'

Orders outside the mandate’s limits (asset classes, amount per instruction or per day) are refused with 403; the check in step 3 shows them first as a mandate block.

  1. Only act on outside: true; inside the bands, leave the portfolio alone.
  2. Re-read GET /v1/accounts/{id}/strategies just before acting: prices move.
  3. Check first, sells before buys, one idempotency key per line per day.
  4. Advisory: propose and track. Discretionary: trade with a reason and follow order.updated.