@0xmonaco/types 1.0.73 → 1.0.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -297,7 +297,9 @@ export interface paths {
297
297
  * address — and a per-order mode always overrides it. The write is sequenced
298
298
  * through the matching engine; on success the next order from the wallet
299
299
  * family already resolves the new mode. Delegated-agent sessions cannot
300
- * change it.
300
+ * change it. It spends the per-account settings-write rate limit (about one
301
+ * write per second, burst 10) that the copy trading lead trader and follow
302
+ * writes share.
301
303
  */
302
304
  put: operations["set_self_trade_prevention_default"];
303
305
  post?: never;
@@ -732,9 +734,10 @@ export interface paths {
732
734
  *
733
735
  * The fee can be set while builder fees are switched off
734
736
  * (`builderFeeEnabled` false): it is stored and nothing is charged until they
735
- * are switched on. Once charged, a new fee applies to orders placed after the
736
- * change within a few seconds; resting orders keep the fee they were placed
737
- * with.
737
+ * are switched on. A newly stored fee reaches order requests within a few
738
+ * seconds. Sequencer ordering is authoritative for matching-engine policy and
739
+ * enrollment state: an order processed before one of those sequenced changes
740
+ * uses the earlier state, and a later order uses the new state.
738
741
  *
739
742
  * A refused change is **HTTP 409** / **FAILED_PRECONDITION** when the
740
743
  * application is not enrolled with a payout address or has no changes left
@@ -940,6 +943,11 @@ export interface paths {
940
943
  * retry with backoff, and an overload positively wants one. Only an UNTAGGED
941
944
  * availability failure — matching-engine transport, timeout and fail-closed
942
945
  * paths — carries the unknown outcome.
946
+ *
947
+ * A claim spends the per-user movement budget withdrawals and collateral
948
+ * transfers share. Over budget it is refused with **HTTP 429** /
949
+ * **RESOURCE_EXHAUSTED** before it reaches the sequencer, so it committed
950
+ * nothing and is safe to retry after the interval in `details.retryAfter`.
943
951
  */
944
952
  post: operations["claim_buildercode_rewards"];
945
953
  delete?: never;
@@ -975,7 +983,9 @@ export interface paths {
975
983
  * `leader` handle that names a different leader is refused. `copyExisting`
976
984
  * copies the leader's open positions into the new copy account at creation
977
985
  * (see PreviewFollow for what that costs); it applies only to a create, and
978
- * an edit that sets it is refused.
986
+ * an edit that sets it is refused. A create and an edit each spend the
987
+ * per-account settings-write rate limit (about one write per second, burst
988
+ * 10) that UpsertLeadTrader and the self-trade-prevention default share.
979
989
  */
980
990
  post: operations["upsert_follow"];
981
991
  delete?: never;
@@ -1146,9 +1156,7 @@ export interface paths {
1146
1156
  * There is no margin reduction: a follow exits by being stopped. Follow
1147
1157
  * writes need a master account session (not a delegated agent or a
1148
1158
  * sub-account). 404 unless the follow is yours; 409 while it is stopping
1149
- * or once it is stopped, and when copy trading is not available on the
1150
- * platform at all (the platform then runs copy trading exits only). It
1151
- * spends the per-user movement budget withdrawals and collateral transfers
1159
+ * or once it is stopped. It spends the per-user movement budget withdrawals and collateral transfers
1152
1160
  * share. It is not idempotent: a retry after a timeout whose first attempt
1153
1161
  * landed adds the amount twice, so read the follow before retrying.
1154
1162
  */
@@ -1173,8 +1181,11 @@ export interface paths {
1173
1181
  * @description Stop a follow.
1174
1182
  *
1175
1183
  * Stops mirroring the leader. Stopping one of your own follows only; the
1176
- * follow is identified by its id. An exit is never gated beyond ownership,
1177
- * except that a delegated agent session cannot stop a follow.
1184
+ * follow is identified by its id. An exit is never refused for the state
1185
+ * of the account or the platform. Only three things apply: ownership, the
1186
+ * refusal of a delegated agent session, and a per-account rate limit of
1187
+ * its own (about one stop per second, burst 20), which closes and follow
1188
+ * edits never spend.
1178
1189
  */
1179
1190
  post: operations["stop_follow"];
1180
1191
  delete?: never;
@@ -1232,7 +1243,9 @@ export interface paths {
1232
1243
  * TraderCode handle. The profile is replaced as sent: an omitted `bio` or
1233
1244
  * `minAllocation` clears it and an omitted `status` means ACTIVE; an
1234
1245
  * omitted `shareBps` keeps the current share (the platform default on a
1235
- * registration). A follower with a live follow cannot register.
1246
+ * registration). A follower with a live follow cannot register. It spends
1247
+ * the per-account settings-write rate limit (about one write per second,
1248
+ * burst 10) that UpsertFollow and the self-trade-prevention default share.
1236
1249
  */
1237
1250
  put: operations["upsert_lead_trader"];
1238
1251
  post?: never;
@@ -1360,7 +1373,10 @@ export interface paths {
1360
1373
  *
1361
1374
  * Master accounts only. Creates (or updates, keyed on `agent_address`) a
1362
1375
  * delegation linking the calling owner to an agent wallet, together with the
1363
- * policy that constrains what the agent may do on the owner's behalf.
1376
+ * policy that constrains what the agent may do on the owner's behalf. An
1377
+ * owner holds at most 10 active, unexpired agents; a new one past that is
1378
+ * rejected until one is revoked or expires. Binding an agent to one margin
1379
+ * account (`allowed_margin_account_ids`) makes it that sub-account's key.
1364
1380
  */
1365
1381
  post: operations["upsert_delegated_agent"];
1366
1382
  delete?: never;
@@ -1412,7 +1428,8 @@ export interface paths {
1412
1428
  * `ListDelegatedAgentOwners`) and a freshly generated session public key.
1413
1429
  * The new session acts as the owner but records the agent's address for
1414
1430
  * policy enforcement. Requires an active delegation for the (owner, agent)
1415
- * pair. Session expiry is bounded by the delegation expiry, if set. Every
1431
+ * pair, and, when the delegation has an IP allowlist, a caller address
1432
+ * inside it. Session expiry is bounded by the delegation expiry. Every
1416
1433
  * authenticated request and periodic WebSocket session revalidation requires
1417
1434
  * the backing delegation to remain active and unexpired.
1418
1435
  */
@@ -1696,6 +1713,29 @@ export interface paths {
1696
1713
  patch?: never;
1697
1714
  trace?: never;
1698
1715
  };
1716
+ "/api/v1/margin/accounts/{marginAccountId}/pnl": {
1717
+ parameters: {
1718
+ query?: never;
1719
+ header?: never;
1720
+ path?: never;
1721
+ cookie?: never;
1722
+ };
1723
+ /**
1724
+ * @description One margin account's own PnL: realized (settled on the account plus
1725
+ * still held in its open risk buckets) and unrealized (its positions
1726
+ * repriced at the latest risk marks). Transfers between the caller's
1727
+ * accounts are flows, not PnL, so the figures of the caller's accounts sum
1728
+ * to the owner-wide figure.
1729
+ */
1730
+ get: operations["get_margin_account_pnl"];
1731
+ put?: never;
1732
+ post?: never;
1733
+ delete?: never;
1734
+ options?: never;
1735
+ head?: never;
1736
+ patch?: never;
1737
+ trace?: never;
1738
+ };
1699
1739
  "/api/v1/margin/accounts/{marginAccountId}/simulate-order-risk": {
1700
1740
  parameters: {
1701
1741
  query?: never;
@@ -1728,6 +1768,30 @@ export interface paths {
1728
1768
  patch?: never;
1729
1769
  trace?: never;
1730
1770
  };
1771
+ "/api/v1/margin/collateral/transfer": {
1772
+ parameters: {
1773
+ query?: never;
1774
+ header?: never;
1775
+ path?: never;
1776
+ cookie?: never;
1777
+ };
1778
+ get?: never;
1779
+ put?: never;
1780
+ /**
1781
+ * @description Move collateral between the spot wallet, the caller's margin accounts and
1782
+ * their risk buckets. `from` and `to` each name the wallet or a margin
1783
+ * account (optionally one of its risk buckets). Supported moves: wallet to
1784
+ * the default margin account and back, margin account to margin account,
1785
+ * and margin account to one of its own risk buckets. The older transfer
1786
+ * routes keep working unchanged.
1787
+ */
1788
+ post: operations["transfer_collateral"];
1789
+ delete?: never;
1790
+ options?: never;
1791
+ head?: never;
1792
+ patch?: never;
1793
+ trace?: never;
1794
+ };
1731
1795
  "/api/v1/margin/parent-margin-account": {
1732
1796
  parameters: {
1733
1797
  query?: never;
@@ -1849,6 +1913,56 @@ export interface paths {
1849
1913
  patch?: never;
1850
1914
  trace?: never;
1851
1915
  };
1916
+ "/api/v1/margin/sub-accounts": {
1917
+ parameters: {
1918
+ query?: never;
1919
+ header?: never;
1920
+ path?: never;
1921
+ cookie?: never;
1922
+ };
1923
+ get?: never;
1924
+ put?: never;
1925
+ /**
1926
+ * @description Open a sub-account: another margin account of the caller, keyed by
1927
+ * `subaccount_key`, with its own collateral and its own risk buckets. The
1928
+ * default margin account (key `default`) is the only one deposits and
1929
+ * withdrawals touch; fund a sub-account with `TransferCollateral`.
1930
+ * Re-creating the key of a closed sub-account re-opens the same account.
1931
+ * Keys starting with `copy:` are reserved. An owner may hold a limited
1932
+ * number of open sub-accounts, set by their weighted 14-day volume tier
1933
+ * (10 at the first tier, up to 50) or an admin override; a create past it
1934
+ * is refused. Copy-trading sub-accounts do not count.
1935
+ */
1936
+ post: operations["create_sub_account"];
1937
+ delete?: never;
1938
+ options?: never;
1939
+ head?: never;
1940
+ patch?: never;
1941
+ trace?: never;
1942
+ };
1943
+ "/api/v1/margin/sub-accounts/{marginAccountId}/close": {
1944
+ parameters: {
1945
+ query?: never;
1946
+ header?: never;
1947
+ path?: never;
1948
+ cookie?: never;
1949
+ };
1950
+ get?: never;
1951
+ put?: never;
1952
+ /**
1953
+ * @description Close a sub-account. Refused unless it is flat: no position and no order,
1954
+ * conditional order or TWAP. Its flat, solvent risk buckets close in the
1955
+ * same step, and all of its remaining collateral moves to the default
1956
+ * margin account. A risk bucket in liquidation or bad debt refuses the
1957
+ * close, and nothing moves.
1958
+ */
1959
+ post: operations["close_sub_account"];
1960
+ delete?: never;
1961
+ options?: never;
1962
+ head?: never;
1963
+ patch?: never;
1964
+ trace?: never;
1965
+ };
1852
1966
  "/api/v1/market/funding/history": {
1853
1967
  parameters: {
1854
1968
  query?: never;
@@ -2643,12 +2757,13 @@ export interface paths {
2643
2757
  * Get your referral position
2644
2758
  * @description Read your own referral position (self-scoped).
2645
2759
  *
2646
- * Return the authenticated caller's referral position: their direct (L1)
2647
- * referrer, the total rewards they have earned, and their most recent reward
2648
- * rows. Self-scoped — identity comes only from the session, never a path id,
2760
+ * Return the authenticated caller's referral position: their referral chain
2761
+ * upward (L1, L2 and L3 — who referred them, who referred that wallet, and so
2762
+ * on), the total rewards they have earned, and their most recent reward rows.
2763
+ * Self-scoped — identity comes only from the session, never a path id,
2649
2764
  * so a caller can only ever read their own chain. Every other user is
2650
2765
  * identified by their public wallet address, never an internal id. An empty
2651
- * `referrer` means the caller was not referred.
2766
+ * `referrer` and `upline` mean the caller was not referred.
2652
2767
  */
2653
2768
  get: operations["get_my_referral_position"];
2654
2769
  put?: never;
@@ -2687,6 +2802,41 @@ export interface paths {
2687
2802
  patch?: never;
2688
2803
  trace?: never;
2689
2804
  };
2805
+ "/api/v1/pitpass/referrals/me/tree": {
2806
+ parameters: {
2807
+ query?: never;
2808
+ header?: never;
2809
+ path?: never;
2810
+ cookie?: never;
2811
+ };
2812
+ /**
2813
+ * Get one level of your referral tree
2814
+ * @description Read one level of your own referral tree (self-scoped).
2815
+ *
2816
+ * Return the wallets directly referred by `parent` — the authenticated caller
2817
+ * when `parent` is omitted, otherwise one of the caller's own L1 or L2
2818
+ * referees — one page at a time, newest first. Each node carries its level
2819
+ * relative to the caller, its parent, how many wallets it has referred (so the
2820
+ * client knows whether it can be expanded), and what the caller has earned
2821
+ * from that wallet's own trades. Expanding a node is another call with
2822
+ * `parent` set to that node's wallet; the tree stops at L3, the deepest level
2823
+ * that pays referral rewards.
2824
+ *
2825
+ * Self-scoped — identity comes only from the session. A `parent` that is not
2826
+ * the caller or inside the caller's own L1/L2 downline returns 404, the same
2827
+ * as a wallet that does not exist, so the endpoint cannot be used to read
2828
+ * anyone else's tree. Every node is identified by its public wallet address,
2829
+ * never an internal id.
2830
+ */
2831
+ get: operations["get_my_referral_tree"];
2832
+ put?: never;
2833
+ post?: never;
2834
+ delete?: never;
2835
+ options?: never;
2836
+ head?: never;
2837
+ patch?: never;
2838
+ trace?: never;
2839
+ };
2690
2840
  "/api/v1/pitpass/rewards/balance": {
2691
2841
  parameters: {
2692
2842
  query?: never;
@@ -2729,7 +2879,8 @@ export interface paths {
2729
2879
  * trading balance under the authenticated application, making it tradeable
2730
2880
  * immediately. Ledger-only (one shared vault + one backend ledger) — no
2731
2881
  * on-chain transaction and no gas. Fails with 402 when the rewards balance is
2732
- * insufficient.
2882
+ * insufficient. It spends the per-user movement budget withdrawals and
2883
+ * collateral transfers share.
2733
2884
  */
2734
2885
  post: operations["transfer_rewards"];
2735
2886
  delete?: never;
@@ -2769,7 +2920,13 @@ export interface paths {
2769
2920
  * Submits a MARKET reduce-only close for every open position owned by the
2770
2921
  * caller, optionally filtered to a single trading pair. Best-effort and
2771
2922
  * partial: each position closes independently and per-position failures are
2772
- * reported in `results` rather than aborting the batch.
2923
+ * reported in `results` rather than aborting the batch. Each close draws
2924
+ * one item from the risk-reduction rate limit (an empty call draws one).
2925
+ * The first 100 are charged before anything is sent: over budget, the
2926
+ * whole call is refused with 429 and nothing is closed. Past 100 open
2927
+ * positions the rest are charged 100 at a time as the call reaches them,
2928
+ * and those the budget does not cover are not sent: they come back in
2929
+ * `results` with `RATE_LIMIT_EXCEEDED`, to be retried.
2773
2930
  */
2774
2931
  post: operations["batch_close_all_positions"];
2775
2932
  delete?: never;
@@ -3944,7 +4101,7 @@ export interface components {
3944
4101
  amount?: string | null;
3945
4102
  /**
3946
4103
  * Format: int32
3947
- * @description Realized whole-basis-point rate for this credit after the Monaco-floor clamp, computed from the credited amount divided by the gross protocol take and truncated down. This can be lower than the configured BuilderCodes budget.
4104
+ * @description Basis-point rate applied to this credit. For `BUILDER_FEE`, this is the normalized builder-fee rate charged to the taker. For `REVENUE_SHARE`, it is the realized whole-basis-point rate after the Monaco-floor clamp and can be lower than the configured BuilderCodes budget.
3948
4105
  * @example 1000
3949
4106
  */
3950
4107
  appliedBps?: number | null;
@@ -3954,7 +4111,7 @@ export interface components {
3954
4111
  */
3955
4112
  createdAt?: string | null;
3956
4113
  /**
3957
- * @description Payout category for this credit. `REVENUE_SHARE` is active; `BUILDER_FEE` is reserved and is not currently emitted.
4114
+ * @description Payout category for this credit: `REVENUE_SHARE` for Monaco revenue sharing or `BUILDER_FEE` for an ordinary builder fee charged to the taker.
3958
4115
  * @example REVENUE_SHARE
3959
4116
  * @enum {string|null}
3960
4117
  */
@@ -4271,6 +4428,16 @@ export interface components {
4271
4428
  message?: string | null;
4272
4429
  submittedQuantity?: string | null;
4273
4430
  };
4431
+ CloseSubAccountRequest: {
4432
+ marginAccountId?: string | null;
4433
+ };
4434
+ CloseSubAccountResponse: {
4435
+ marginAccountId?: string | null;
4436
+ /** @description The default margin account that received the remaining collateral. */
4437
+ defaultMarginAccountId?: string | null;
4438
+ /** @description Collateral moved to the default margin account. */
4439
+ amount?: string | null;
4440
+ };
4274
4441
  ClosedTrade: {
4275
4442
  /**
4276
4443
  * Format: uuid
@@ -4299,6 +4466,17 @@ export interface components {
4299
4466
  /** @description Execution time (RFC 3339) */
4300
4467
  closedAt?: string | null;
4301
4468
  };
4469
+ /**
4470
+ * @description One side of a `TransferCollateral`: the spot wallet, or a margin account
4471
+ * and optionally one of its risk buckets.
4472
+ */
4473
+ CollateralTransferEndpoint: {
4474
+ /** @description The spot wallet. Set exactly one of `wallet` and `margin_account_id`. */
4475
+ wallet?: boolean | null;
4476
+ marginAccountId?: string | null;
4477
+ /** @description A risk bucket of `margin_account_id`. */
4478
+ riskBucketId?: string | null;
4479
+ };
4302
4480
  ConditionalOrder: {
4303
4481
  conditionalOrderId?: string | null;
4304
4482
  /** Format: uuid */
@@ -4598,6 +4776,23 @@ export interface components {
4598
4776
  */
4599
4777
  trailingStopOrderId?: string | null;
4600
4778
  };
4779
+ CreateSubAccountRequest: {
4780
+ /**
4781
+ * @description Sub-account key: up to 64 letters, digits, `_`, `-`, `.` or `:`. Keys
4782
+ * starting with `copy:` are reserved, and `default` names the default
4783
+ * margin account.
4784
+ */
4785
+ subaccountKey?: string | null;
4786
+ /** @description Optional display label. */
4787
+ label?: string | null;
4788
+ };
4789
+ CreateSubAccountResponse: {
4790
+ marginAccountId?: string | null;
4791
+ subaccountKey?: string | null;
4792
+ /** @description Values: ACTIVE. */
4793
+ marginAccountState?: string | null;
4794
+ label?: string | null;
4795
+ };
4601
4796
  CreateTwapOrderRequest: {
4602
4797
  /**
4603
4798
  * Format: uuid
@@ -4811,6 +5006,8 @@ export interface components {
4811
5006
  * @description Legacy field; no concurrent open-order cap is enforced. New or updated policies leave it unset.
4812
5007
  */
4813
5008
  maxOpenOrders?: number | null;
5009
+ /** @description IP addresses and CIDR ranges the agent may create its delegated session from, normalized. Empty allows any address. */
5010
+ ipAllowlist?: string[] | null;
4814
5011
  };
4815
5012
  DelegatedAgentOwner: {
4816
5013
  /**
@@ -5144,12 +5341,13 @@ export interface components {
5144
5341
  * margin account yet.
5145
5342
  *
5146
5343
  * This is NOT trading headroom for existing cross exposure. It is bounded
5147
- * by allocation (principal not earmarked by risk buckets) as well as by
5344
+ * by allocation (net deposits plus settled realized PnL not allocated to
5345
+ * risk buckets) as well as by
5148
5346
  * margin requirements, and an unrealized gain does not raise it: a
5149
5347
  * mark-to-market gain is initial margin against existing cross exposure but
5150
5348
  * may not fund an exit. `MarginAccountSummary.free_collateral` credits that
5151
5349
  * gain in full and remains the trading-margin headroom for existing cross
5152
- * exposure — but a NEW isolated or first-use position allocates principal
5350
+ * exposure — but a NEW isolated or first-use position allocates collateral
5153
5351
  * through the same gate this field measures, so size those from this field.
5154
5352
  *
5155
5353
  * Note the two `margin_*` fields answer opposite questions:
@@ -5445,9 +5643,21 @@ export interface components {
5445
5643
  /** Format: uint32 */
5446
5644
  pageSize?: number | null;
5447
5645
  };
5646
+ GetMarginAccountPnlResponse: {
5647
+ marginAccountId?: string | null;
5648
+ /**
5649
+ * @description Decimal string: settled on the account plus still held in its open risk
5650
+ * buckets.
5651
+ */
5652
+ realizedPnl?: string | null;
5653
+ /**
5654
+ * @description Decimal string: the account's open positions repriced at the latest risk
5655
+ * marks.
5656
+ */
5657
+ unrealizedPnl?: string | null;
5658
+ };
5448
5659
  GetMarginAccountSummaryResponse: {
5449
5660
  marginAccountId?: string | null;
5450
- accountState?: string | null;
5451
5661
  equity?: string | null;
5452
5662
  initialMarginRequired?: string | null;
5453
5663
  maintenanceMarginRequired?: string | null;
@@ -5456,23 +5666,23 @@ export interface components {
5456
5666
  * @description The largest amount a transfer-out of this scope will actually accept.
5457
5667
  *
5458
5668
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
5459
- * equity includes realized PnL, accrued funding and mark-to-market gains
5460
- * that are not principal a transfer can move — so the two can differ
5461
- * without limit. An unrealized gain never counts toward this figure.
5669
+ * equity includes mark-to-market gains that a transfer cannot move — so
5670
+ * the two can differ without limit. An unrealized gain never counts toward
5671
+ * this figure.
5462
5672
  *
5463
- * For a risk bucket this is capped by the bucket's allocated collateral;
5464
- * for a parent margin account, by deposited collateral that no risk bucket
5465
- * has earmarked.
5673
+ * For a risk bucket this is the bucket's allocated collateral plus its
5674
+ * realized PnL, less what its positions and resting orders require (the
5675
+ * bucket's allocation may go negative, which is how realized profit leaves
5676
+ * a live bucket); for a parent margin account, net deposits plus settled
5677
+ * realized PnL that no risk bucket has allocated.
5466
5678
  *
5467
- * This is the largest accepted transfer-out, NOT a promise that every
5468
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
5469
- * bucket whose realized loss exceeds its remaining value accepts the full
5470
- * close-out reported here — which settles that loss to the parent margin
5471
- * account — while refusing a partial withdrawal that would leave the bucket
5472
- * holding less collateral than the loss it has already taken. For such a
5473
- * bucket the accepted amounts are everything up to its equity, plus this
5474
- * figure itself, with a gap in between. Size a transfer directly from this
5475
- * field rather than shaving a margin off it.
5679
+ * This is the largest accepted transfer-out, and every smaller amount is
5680
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
5681
+ * liquidation or frozen as bad debt), whose allocation cannot be released,
5682
+ * and on a risk bucket whose realized loss has used up its allocation: that
5683
+ * bucket cannot be released at all, and the parent margin account is
5684
+ * charged at most its allocation, the loss past it being the insurance
5685
+ * fund's.
5476
5686
  */
5477
5687
  withdrawableCollateral?: string | null;
5478
5688
  totalPositionNotional?: string | null;
@@ -5507,6 +5717,16 @@ export interface components {
5507
5717
  copyFollowId?: string | null;
5508
5718
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
5509
5719
  copyLeaderHandle?: string | null;
5720
+ /**
5721
+ * @description The risk bucket's lifecycle state. Present only for risk-bucket rows;
5722
+ * a parent margin account has no lifecycle of its own. Values: NORMAL,
5723
+ * PENDING_LIQUIDATION, LIQUIDATING, BAD_DEBT, CLOSED.
5724
+ */
5725
+ riskBucketState?: string | null;
5726
+ /** @description See `MarginAccountSummary.subaccount_key`. */
5727
+ subaccountKey?: string | null;
5728
+ /** @description See `MarginAccountSummary.margin_account_state`. */
5729
+ marginAccountState?: string | null;
5510
5730
  };
5511
5731
  GetMarkPriceResponse: {
5512
5732
  /** Format: uuid */
@@ -5703,7 +5923,7 @@ export interface components {
5703
5923
  };
5704
5924
  GetMyReferralPositionResponse: {
5705
5925
  /**
5706
- * @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. Never exposes L2/L3 upline or any internal id.
5926
+ * @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. The same wallet as the first `upline` entry; never an internal id.
5707
5927
  * @example 0x0000000000000000000000000000000000000002
5708
5928
  */
5709
5929
  referrer?: string | null;
@@ -5719,6 +5939,21 @@ export interface components {
5719
5939
  referrerDisplay?: string | null;
5720
5940
  /** @description The caller's most recent reward rows, newest first. Bounded server-side — not the full history. */
5721
5941
  rewards?: components["schemas"]["ReferralRewardEntry"][] | null;
5942
+ /** @description The caller's referral chain upward, nearest first: L1 (who referred the caller), then L2 (who referred them), then L3. At most three entries; shorter when the chain ends, empty when the caller was not referred. These are the wallets the caller's own trades pay referral rewards to. */
5943
+ upline?: components["schemas"]["ReferralUplineEntry"][] | null;
5944
+ };
5945
+ GetMyReferralTreeResponse: {
5946
+ /** @description Wallet address whose referees `nodes` lists — the caller's own wallet when the request omitted `parent`. */
5947
+ parent?: string | null;
5948
+ /**
5949
+ * Format: int32
5950
+ * @description Depth of `parent` below the caller: 0 for the caller, 1 or 2 for a referee being expanded. Every node is one level deeper.
5951
+ */
5952
+ parentLevel?: number | null;
5953
+ /** @description The wallets `parent` referred, newest first. A wallet that signed up under several referrers (one per app) appears only under the referrer the reward engine pays. */
5954
+ nodes?: components["schemas"]["ReferralTreeNode"][] | null;
5955
+ /** @description Cursor for the next page; empty when there are no more. */
5956
+ nextPageToken?: string | null;
5722
5957
  };
5723
5958
  /** @description Latest public open interest for a trading pair. */
5724
5959
  GetOpenInterestResponse: {
@@ -5956,7 +6191,7 @@ export interface components {
5956
6191
  */
5957
6192
  batchId?: string | null;
5958
6193
  /**
5959
- * @description Stable terminal cause for a cancelled order: USER_REQUESTED, REPLACED, LIQUIDATION, INSUFFICIENT_MARGIN, REDUCE_ONLY_EXHAUSTED, POSITION_CLOSED, OCO_SIBLING_TRIGGERED, or SYSTEM
6194
+ * @description Stable terminal cause for a cancelled order: USER_REQUESTED, REPLACED, LIQUIDATION, INSUFFICIENT_MARGIN, REDUCE_ONLY_EXHAUSTED, POSITION_CLOSED, OCO_SIBLING_TRIGGERED, SELF_TRADE_PREVENTION, AUTO_DELEVERAGING, or SYSTEM. AUTO_DELEVERAGING means auto-deleveraging closed the position your risk bucket held and this resting order was cancelled with it; you were deleveraged as a counterparty, not liquidated.
5960
6195
  * @example REDUCE_ONLY_EXHAUSTED
5961
6196
  */
5962
6197
  terminalReason?: string | null;
@@ -6141,6 +6376,18 @@ export interface components {
6141
6376
  total?: components["schemas"]["PortfolioMarginTotal"];
6142
6377
  positions?: components["schemas"]["PortfolioMarginPositionCounts"];
6143
6378
  riskBuckets?: components["schemas"]["PortfolioRiskBucket"][] | null;
6379
+ /**
6380
+ * @description The margin account `total`, `positions` and `risk_buckets` describe;
6381
+ * absent when the caller has no margin account yet.
6382
+ */
6383
+ marginAccountId?: string | null;
6384
+ /**
6385
+ * @description With `include_accounts`: every open margin account of the caller, the
6386
+ * default one first, then sub-accounts by key.
6387
+ */
6388
+ accounts?: components["schemas"]["PortfolioMarginAccount"][] | null;
6389
+ /** @description With `include_accounts`: the sum of `accounts`' totals. */
6390
+ ownerTotal?: components["schemas"]["PortfolioMarginTotal"] | null;
6144
6391
  };
6145
6392
  GetPortfolioPerformanceResponse: {
6146
6393
  window?: components["schemas"]["PortfolioSeriesWindow"];
@@ -6394,7 +6641,7 @@ export interface components {
6394
6641
  cumFees?: string | null;
6395
6642
  /**
6396
6643
  * Format: int64
6397
- * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills that leave a position open, direct isolated-position margin adds/reductions, and copy-position margin adds; the copy add refreshes its isolated child and copy-cross siblings at the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Funding omits it because it re-reads live state after sequencing; terminal frames omit it because they report size 0 and sometimes LIQUIDATED while the stored row keeps its size and records CLOSED. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
6644
+ * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills, non-zero funding settlements, terminal closes/liquidations/ADL, direct isolated-position margin adds/reductions, and copy-position margin adds; each uses captured post-command state, and terminal frames retain the stored size and exact CLOSED/LIQUIDATED classification. After restart, a terminal frame rebuilt from legacy reduction history omits the version when that history lacks the margin fields needed to reconstruct complete lifetime allocated margin. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer and funding frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
6398
6645
  * @example 918342
6399
6646
  */
6400
6647
  version?: number | null;
@@ -7461,7 +7708,6 @@ export interface components {
7461
7708
  MarginAccountSummary: {
7462
7709
  /** @description Parent margin account UUID. */
7463
7710
  marginAccountId?: string | null;
7464
- accountState?: string | null;
7465
7711
  equity?: string | null;
7466
7712
  initialMarginRequired?: string | null;
7467
7713
  maintenanceMarginRequired?: string | null;
@@ -7470,23 +7716,23 @@ export interface components {
7470
7716
  * @description The largest amount a transfer-out of this scope will actually accept.
7471
7717
  *
7472
7718
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
7473
- * equity includes realized PnL, accrued funding and mark-to-market gains
7474
- * that are not principal a transfer can move — so the two can differ
7475
- * without limit. An unrealized gain never counts toward this figure.
7719
+ * equity includes mark-to-market gains that a transfer cannot move — so
7720
+ * the two can differ without limit. An unrealized gain never counts toward
7721
+ * this figure.
7476
7722
  *
7477
- * For a risk bucket this is capped by the bucket's allocated collateral;
7478
- * for a parent margin account, by deposited collateral that no risk bucket
7479
- * has earmarked.
7723
+ * For a risk bucket this is the bucket's allocated collateral plus its
7724
+ * realized PnL, less what its positions and resting orders require (the
7725
+ * bucket's allocation may go negative, which is how realized profit leaves
7726
+ * a live bucket); for a parent margin account, net deposits plus settled
7727
+ * realized PnL that no risk bucket has allocated.
7480
7728
  *
7481
- * This is the largest accepted transfer-out, NOT a promise that every
7482
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
7483
- * bucket whose realized loss exceeds its remaining value accepts the full
7484
- * close-out reported here — which settles that loss to the parent margin
7485
- * account — while refusing a partial withdrawal that would leave the bucket
7486
- * holding less collateral than the loss it has already taken. For such a
7487
- * bucket the accepted amounts are everything up to its equity, plus this
7488
- * figure itself, with a gap in between. Size a transfer directly from this
7489
- * field rather than shaving a margin off it.
7729
+ * This is the largest accepted transfer-out, and every smaller amount is
7730
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
7731
+ * liquidation or frozen as bad debt), whose allocation cannot be released,
7732
+ * and on a risk bucket whose realized loss has used up its allocation: that
7733
+ * bucket cannot be released at all, and the parent margin account is
7734
+ * charged at most its allocation, the loss past it being the insurance
7735
+ * fund's.
7490
7736
  */
7491
7737
  withdrawableCollateral?: string | null;
7492
7738
  totalPositionNotional?: string | null;
@@ -7552,6 +7798,22 @@ export interface components {
7552
7798
  copyFollowId?: string | null;
7553
7799
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
7554
7800
  copyLeaderHandle?: string | null;
7801
+ /**
7802
+ * @description The risk bucket's lifecycle state. Present only for risk-bucket rows;
7803
+ * a parent margin account has no lifecycle of its own. Values: NORMAL,
7804
+ * PENDING_LIQUIDATION, LIQUIDATING, BAD_DEBT, CLOSED.
7805
+ */
7806
+ riskBucketState?: string | null;
7807
+ /**
7808
+ * @description The margin account's sub-account key; `default` is the default margin
7809
+ * account.
7810
+ */
7811
+ subaccountKey?: string | null;
7812
+ /**
7813
+ * @description The margin account's state. Values: ACTIVE, CLOSED (a closed
7814
+ * sub-account).
7815
+ */
7816
+ marginAccountState?: string | null;
7555
7817
  };
7556
7818
  MatchResult: {
7557
7819
  /**
@@ -7872,6 +8134,17 @@ export interface components {
7872
8134
  */
7873
8135
  positions?: string | null;
7874
8136
  };
8137
+ /** @description One of the caller's open margin accounts in the owner rollup. */
8138
+ PortfolioMarginAccount: {
8139
+ marginAccountId?: string | null;
8140
+ /** @description `default` for the default margin account, else the sub-account's key. */
8141
+ subaccountKey?: string | null;
8142
+ /**
8143
+ * @description The account's totals. `withdrawable_collateral` here is the persisted
8144
+ * reconstruction of the engine's bound.
8145
+ */
8146
+ total?: components["schemas"]["PortfolioMarginTotal"] | null;
8147
+ };
7875
8148
  PortfolioMarginPositionCounts: {
7876
8149
  total?: string | null;
7877
8150
  cross?: string | null;
@@ -7889,18 +8162,17 @@ export interface components {
7889
8162
  * the bound the engine enforces on transfers-out and withdrawals, and
7890
8163
  * therefore also the effective ceiling on funding new isolated or
7891
8164
  * first-use order capacity, because allocating collateral to a risk
7892
- * bucket passes through the same principal-gated door.
8165
+ * bucket passes through the same capacity-gated door.
7893
8166
  *
7894
8167
  * NOT a clamped `parent_available_collateral`. That field is
7895
- * `free_collateral`, an equity figure: it credits settled realized PnL,
7896
- * accrued funding, and mark-to-market gains that a transfer-out cannot
7897
- * move, so the two can differ without limit. This bound never credits an
7898
- * unrealized gain. Under the default capacity basis it also excludes
7899
- * non-principal balances such as banked realized PnL:
7900
- * `min(deposited principal - bucket allocations,
7901
- * free_collateral - max(unrealized_pnl, 0))`, floored at zero. Whatever
7902
- * the engine's configured capacity basis, this is the bound its gates
7903
- * actually enforce. It agrees with
8168
+ * `free_collateral`, an equity figure: it credits mark-to-market gains
8169
+ * and realized PnL still held in open risk buckets, which a transfer-out
8170
+ * of the parent cannot move, so the two can differ without limit. This bound never credits an
8171
+ * unrealized gain. It counts net deposits plus the account's settled
8172
+ * realized PnL and funding, less what risk buckets have allocated:
8173
+ * `min(net deposits + settled realized PnL - bucket allocations,
8174
+ * free_collateral - max(unrealized_pnl, 0))`, floored at zero. This is the
8175
+ * bound the engine's gates actually enforce. It agrees with
7904
8176
  * `MarginAccountSummary.withdrawable_collateral` up to quote-decimal
7905
8177
  * truncation: this surface truncates toward zero at the quote asset's
7906
8178
  * precision, while the margin-accounts surface may carry sub-tick tails.
@@ -7954,14 +8226,15 @@ export interface components {
7954
8226
  * accept — the bound enforced on bucket collateral withdrawals.
7955
8227
  *
7956
8228
  * NOT a clamped `free_collateral`: free collateral is equity headroom and
7957
- * credits realized PnL and mark-to-market gains that a transfer-out cannot
7958
- * move. This bound is capped by the bucket's settled capacity (its
7959
- * allocated collateral, under the default capacity basis), and an
7960
- * unrealized gain never raises it.
8229
+ * credits mark-to-market gains that a transfer-out cannot move. This bound
8230
+ * is the bucket's allocated collateral plus its realized PnL, less funding
8231
+ * paid, unrealized losses and the margin its positions and resting orders
8232
+ * require. Realized profit can leave a live bucket this way (the bucket's
8233
+ * allocation may go negative); an unrealized gain never raises it.
7961
8234
  *
7962
- * This is the largest accepted transfer-out, NOT a promise that every
7963
- * smaller one is accepted: an underwater flat bucket accepts its full
7964
- * close-out while refusing partial withdrawals below it. Agrees with the
8235
+ * This is the largest accepted transfer-out, and every smaller amount is
8236
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` and on one
8237
+ * whose realized loss has used up its allocation. Agrees with the
7965
8238
  * risk-bucket rows' `MarginAccountSummary.withdrawable_collateral` up to
7966
8239
  * quote-decimal truncation (this surface truncates toward zero; that one
7967
8240
  * may carry sub-tick tails).
@@ -8211,7 +8484,7 @@ export interface components {
8211
8484
  cumFees?: string | null;
8212
8485
  /**
8213
8486
  * Format: int64
8214
- * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: it means the row predates this field or came from a producer that does not stamp it, so treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills that leave a position open, direct isolated-position margin adds/reductions, and copy-position margin adds; the copy add refreshes its isolated child and copy-cross siblings at the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Funding omits it because it re-reads live state after sequencing; terminal frames omit it because they report size 0 and sometimes LIQUIDATED while the stored row keeps its size and records CLOSED. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
8487
+ * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: it means the row predates this field or came from a producer that does not stamp it, so treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills, non-zero funding settlements, terminal closes/liquidations/ADL, direct isolated-position margin adds/reductions, and copy-position margin adds; each uses captured post-command state, and terminal frames retain the stored size and exact CLOSED/LIQUIDATED classification. After restart, a terminal frame rebuilt from legacy reduction history omits the version when that history lacks the margin fields needed to reconstruct complete lifetime allocated margin. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer and funding frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
8215
8488
  * @example 918342
8216
8489
  */
8217
8490
  version?: number | null;
@@ -8619,6 +8892,50 @@ export interface components {
8619
8892
  */
8620
8893
  sourceDisplay?: string | null;
8621
8894
  };
8895
+ /** @description One wallet in the caller's referral tree. */
8896
+ ReferralTreeNode: {
8897
+ /**
8898
+ * @description Public wallet address of this referee. Never an internal id.
8899
+ * @example 0x0000000000000000000000000000000000000004
8900
+ */
8901
+ wallet?: string | null;
8902
+ /** @description Human-facing name for this referee: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `wallet`). Render this instead of raw hex. */
8903
+ display?: string | null;
8904
+ /**
8905
+ * Format: int32
8906
+ * @description Depth below the caller: 1 (the caller referred this wallet), 2, or 3.
8907
+ */
8908
+ level?: number | null;
8909
+ /** @description Wallet address of the referrer of this node — the caller for a level-1 node. */
8910
+ parent?: string | null;
8911
+ /**
8912
+ * Format: date-time
8913
+ * @description RFC 3339 time this wallet signed up under its parent.
8914
+ */
8915
+ referredAt?: string | null;
8916
+ /**
8917
+ * Format: uint32
8918
+ * @description How many wallets this node has referred. Expand the node (request it as `parent`) when this is above 0. Always 0 at level 3, the deepest level shown.
8919
+ */
8920
+ refereeCount?: number | null;
8921
+ /** @description What the caller has earned from this wallet's own trades, across every token, in RAW atomic units. `0` for a wallet that has not traded yet. */
8922
+ totalEarned?: string | null;
8923
+ };
8924
+ /** @description One ancestor in the caller's referral chain. */
8925
+ ReferralUplineEntry: {
8926
+ /**
8927
+ * @description Public wallet address of the ancestor. Never an internal id.
8928
+ * @example 0x0000000000000000000000000000000000000002
8929
+ */
8930
+ wallet?: string | null;
8931
+ /** @description Human-facing name for the ancestor: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `wallet`). Render this instead of raw hex. */
8932
+ display?: string | null;
8933
+ /**
8934
+ * Format: int32
8935
+ * @description How far above the caller this ancestor is: 1 (the caller's direct referrer), 2, or 3.
8936
+ */
8937
+ level?: number | null;
8938
+ };
8622
8939
  RefreshManagedMarketQuotesRequest: {
8623
8940
  launchId?: string | null;
8624
8941
  ownerId?: string | null;
@@ -9278,6 +9595,12 @@ export interface components {
9278
9595
  * @description MARKET only: client slippage tolerance in basis points, 0..1000, the same rule placement enforces — a LIMIT or IOC preview carrying it is rejected. Tightens the previewed walk to the band the real order will run under and never widens it; omit for the placement default.
9279
9596
  */
9280
9597
  slippageToleranceBps?: number | null;
9598
+ /**
9599
+ * @description The margin account the preview runs against: the default margin account
9600
+ * (the default) or any of the caller's open sub-accounts, previewing that
9601
+ * account's own risk buckets.
9602
+ */
9603
+ marginAccountId?: string | null;
9281
9604
  };
9282
9605
  StopFollowResponse: {
9283
9606
  /**
@@ -9753,6 +10076,25 @@ export interface components {
9753
10076
  asset?: string | null;
9754
10077
  amount?: string | null;
9755
10078
  };
10079
+ TransferCollateralRequest: {
10080
+ /** @description Collateral asset symbol or address. */
10081
+ asset?: string | null;
10082
+ amount?: string | null;
10083
+ /** @description Where the collateral comes from. */
10084
+ from?: components["schemas"]["CollateralTransferEndpoint"] | null;
10085
+ /** @description Where the collateral goes. */
10086
+ to?: components["schemas"]["CollateralTransferEndpoint"] | null;
10087
+ };
10088
+ TransferCollateralResponse: {
10089
+ movementId?: string | null;
10090
+ amount?: string | null;
10091
+ /** @description The source margin account, when the source is one. */
10092
+ fromMarginAccountId?: string | null;
10093
+ /** @description The destination margin account, when the destination is one. */
10094
+ toMarginAccountId?: string | null;
10095
+ /** @description The destination risk bucket, when the destination is one. */
10096
+ toRiskBucketId?: string | null;
10097
+ };
9756
10098
  TransferCollateralToMarginAccountRequest: {
9757
10099
  /** @description Parent margin account UUID that receives collateral. */
9758
10100
  marginAccountId?: string | null;
@@ -9857,6 +10199,13 @@ export interface components {
9857
10199
  * row is stale (close/reopen race).
9858
10200
  */
9859
10201
  applyToPositionMargin?: boolean | null;
10202
+ /**
10203
+ * @description The margin account whose risk bucket is funded: the default margin
10204
+ * account (the default) or any of the caller's open sub-accounts, which
10205
+ * fund their own risk buckets from their own collateral. A copy-trading
10206
+ * sub-account's buckets belong to its follow and are refused.
10207
+ */
10208
+ marginAccountId?: string | null;
9860
10209
  };
9861
10210
  TransferRewardsRequest: {
9862
10211
  /**
@@ -10147,21 +10496,21 @@ export interface components {
10147
10496
  */
10148
10497
  name?: string | null;
10149
10498
  /**
10150
- * @description Optional delegation expiry timestamp (ISO 8601). Ends delegated reads, trading, and session refresh. Omit for no delegation expiry; session expiry still applies.
10499
+ * @description Delegation expiry timestamp (ISO 8601). Ends delegated reads, trading, and session refresh. Omit for the default of 14 days from now; at most 180 days ahead.
10151
10500
  * @example 2026-12-31T23:59:59Z
10152
10501
  */
10153
10502
  expiresAt?: string | null;
10154
10503
  /**
10155
- * @description Required JSON array of actions the agent may perform: CREATE_ORDER, CANCEL_ORDER, REPLACE_ORDER. An empty array permits no actions.
10504
+ * @description Required JSON array of actions the agent may perform: CREATE_ORDER, CANCEL_ORDER, REPLACE_ORDER, READ, MANAGE_RISK_BUCKETS. Every delegated session may read the owner's data; a policy listing only READ, or no action, is a read-only key. MANAGE_RISK_BUCKETS lets the agent move a margin account's free collateral into that account's own risk buckets (POST /api/v1/margin/risk-buckets/collateral/transfer-in), only for an account listed in allowedMarginAccountIds and, if the policy lists markets, only into an isolated risk bucket on a listed market. No action lets an agent move collateral any other way. Any other value is rejected.
10156
10505
  * @example [
10157
10506
  * "CREATE_ORDER",
10158
10507
  * "CANCEL_ORDER"
10159
10508
  * ]
10160
10509
  */
10161
10510
  allowedActions: string[];
10162
- /** @description Required JSON array of trading pair UUIDs. An order is allowed if its market or its margin account is permitted. Send [] for account-only scope; both scopes empty permit no orders. */
10511
+ /** @description Required JSON array of trading pair UUIDs. Each listed scope must match: with markets and margin accounts both listed, an order needs a listed market AND a listed account. Send [] for account-only scope; both scopes empty permit no orders. */
10163
10512
  allowedTradingPairIds: string[];
10164
- /** @description Optional JSON array of additional margin account UUIDs. Omitted, null, or [] adds no account scope; it does not grant access to every account. An order is allowed if its market or its margin account is permitted. */
10513
+ /** @description Optional JSON array of margin account UUIDs the agent is bound to. When listed, an order must be on one of these accounts (and on a listed market, if any are listed). Omitted, null, or [] leaves the account unrestricted; both scopes empty permit no orders. */
10165
10514
  allowedMarginAccountIds?: string[] | null;
10166
10515
  /**
10167
10516
  * @description Optional JSON array of permitted order types (LIMIT, MARKET). Omitted, null, or [] means unrestricted order types.
@@ -10192,6 +10541,13 @@ export interface components {
10192
10541
  * @description Unsupported legacy field. Requests that set maxOpenOrders are rejected; no concurrent open-order cap is enforced. Omit this field.
10193
10542
  */
10194
10543
  maxOpenOrders?: number | null;
10544
+ /**
10545
+ * @description Optional JSON array of up to 20 IP addresses or CIDR ranges the agent may create its delegated session from. Omitted, null, or [] allows any address.
10546
+ * @example [
10547
+ * "203.0.113.0/24"
10548
+ * ]
10549
+ */
10550
+ ipAllowlist?: string[] | null;
10195
10551
  };
10196
10552
  UpsertFollowRequest: {
10197
10553
  /**
@@ -10808,7 +11164,19 @@ export interface operations {
10808
11164
  };
10809
11165
  get_portfolio_margin: {
10810
11166
  parameters: {
10811
- query?: never;
11167
+ query?: {
11168
+ /**
11169
+ * @description One of the caller's margin accounts (the default one or a sub-account) to
11170
+ * describe instead of the default one: `total`, `positions` and
11171
+ * `risk_buckets` are then that account's own.
11172
+ */
11173
+ marginAccountId?: string;
11174
+ /**
11175
+ * @description Also return `accounts`, one row per open margin account of the caller,
11176
+ * and `owner_total`, their sum: the owner rollup across sub-accounts.
11177
+ */
11178
+ includeAccounts?: boolean;
11179
+ };
10812
11180
  header?: never;
10813
11181
  path?: never;
10814
11182
  cookie?: never;
@@ -11170,6 +11538,13 @@ export interface operations {
11170
11538
  };
11171
11539
  content?: never;
11172
11540
  };
11541
+ /** @description Settings write rate limit exceeded — the lead trader profile, follow create/edit and self-trade-prevention default share a per-account budget (and the budget the account family shares); retry after the interval in details.retryAfter */
11542
+ 429: {
11543
+ headers: {
11544
+ [name: string]: unknown;
11545
+ };
11546
+ content?: never;
11547
+ };
11173
11548
  /** @description Internal server error */
11174
11549
  500: {
11175
11550
  headers: {
@@ -12274,7 +12649,7 @@ export interface operations {
12274
12649
  page?: number;
12275
12650
  /** @description Items per page (max 100) */
12276
12651
  pageSize?: number;
12277
- /** @description Only return BuilderCodes payouts of this payout kind: REVENUE_SHARE (the frontend's share of Monaco's fee) or BUILDER_FEE (reserved and not currently emitted). Omit for every kind. */
12652
+ /** @description Only return BuilderCodes payouts of this payout kind: REVENUE_SHARE (the frontend's share of Monaco's fee) or BUILDER_FEE (ordinary builder fees charged to takers and credited to enrolled applications). Omit for every kind. */
12278
12653
  kind?: "REVENUE_SHARE" | "BUILDER_FEE";
12279
12654
  };
12280
12655
  header?: never;
@@ -12468,6 +12843,13 @@ export interface operations {
12468
12843
  };
12469
12844
  content?: never;
12470
12845
  };
12846
+ /** @description Movement rate limit exceeded — withdrawals, collateral transfers and reward transfers share a per-user budget; refused before the claim reaches the sequencer, so nothing committed; retry after the interval in details.retryAfter (gRPC: RESOURCE_EXHAUSTED) */
12847
+ 429: {
12848
+ headers: {
12849
+ [name: string]: unknown;
12850
+ };
12851
+ content?: never;
12852
+ };
12471
12853
  /** @description Internal server error */
12472
12854
  500: {
12473
12855
  headers: {
@@ -12597,6 +12979,13 @@ export interface operations {
12597
12979
  };
12598
12980
  content?: never;
12599
12981
  };
12982
+ /** @description Settings write rate limit exceeded — the lead trader profile, follow create/edit and self-trade-prevention default share a per-account budget; retry after the interval in details.retryAfter */
12983
+ 429: {
12984
+ headers: {
12985
+ [name: string]: unknown;
12986
+ };
12987
+ content?: never;
12988
+ };
12600
12989
  /** @description Internal server error */
12601
12990
  500: {
12602
12991
  headers: {
@@ -12992,7 +13381,7 @@ export interface operations {
12992
13381
  "application/json": components["schemas"]["AddFollowPositionMarginResponse"];
12993
13382
  };
12994
13383
  };
12995
- /** @description Invalid follow id, trading pair or amount, or refused by the engine with code COPY_TRADING_REJECTED (no copy position on the pair, the position or the margin account is being liquidated, the position has lost more than its margin, more than the copy account holds; the message names the rule) */
13384
+ /** @description Invalid follow id, trading pair or amount, or refused with code COPY_TRADING_REJECTED (no isolated copy position on the pair, the copy position is being liquidated or is in bad debt, or more than the copy account can put in; the message names the rule) */
12996
13385
  400: {
12997
13386
  headers: {
12998
13387
  [name: string]: unknown;
@@ -13020,7 +13409,7 @@ export interface operations {
13020
13409
  };
13021
13410
  content?: never;
13022
13411
  };
13023
- /** @description The follow is stopping or stopped, or code COPY_TRADING_UNAVAILABLE: copy trading is not available on the platform */
13412
+ /** @description The follow is stopping or stopped */
13024
13413
  409: {
13025
13414
  headers: {
13026
13415
  [name: string]: unknown;
@@ -13098,6 +13487,13 @@ export interface operations {
13098
13487
  };
13099
13488
  content?: never;
13100
13489
  };
13490
+ /** @description Follow stop rate limit exceeded; retry after the interval in details.retryAfter */
13491
+ 429: {
13492
+ headers: {
13493
+ [name: string]: unknown;
13494
+ };
13495
+ content?: never;
13496
+ };
13101
13497
  /** @description Internal server error */
13102
13498
  500: {
13103
13499
  headers: {
@@ -13258,6 +13654,13 @@ export interface operations {
13258
13654
  };
13259
13655
  content?: never;
13260
13656
  };
13657
+ /** @description Settings write rate limit exceeded — the lead trader profile, follow create/edit and self-trade-prevention default share a per-account budget; retry after the interval in details.retryAfter */
13658
+ 429: {
13659
+ headers: {
13660
+ [name: string]: unknown;
13661
+ };
13662
+ content?: never;
13663
+ };
13261
13664
  /** @description Internal server error */
13262
13665
  500: {
13263
13666
  headers: {
@@ -14076,6 +14479,10 @@ export interface operations {
14076
14479
  page?: number;
14077
14480
  /** @description Items per page (max 100) */
14078
14481
  pageSize?: number;
14482
+ /**
14483
+ * @description Keep only risk-bucket rows in this state (see `risk_bucket_state`). A
14484
+ * parent margin account row has no state, so any filter excludes it.
14485
+ */
14079
14486
  state?: string;
14080
14487
  /** @description Trading pair identifier (UUID) */
14081
14488
  tradingPairId?: string;
@@ -14253,6 +14660,39 @@ export interface operations {
14253
14660
  };
14254
14661
  };
14255
14662
  };
14663
+ get_margin_account_pnl: {
14664
+ parameters: {
14665
+ query?: never;
14666
+ header?: never;
14667
+ path: {
14668
+ /**
14669
+ * @description One of the caller's margin accounts: the default one or a sub-account.
14670
+ * @example 2b1a5f9c-0000-4000-8000-000000000001
14671
+ */
14672
+ marginAccountId: string;
14673
+ };
14674
+ cookie?: never;
14675
+ };
14676
+ requestBody?: never;
14677
+ responses: {
14678
+ /** @description OK */
14679
+ 200: {
14680
+ headers: {
14681
+ [name: string]: unknown;
14682
+ };
14683
+ content: {
14684
+ "application/json": components["schemas"]["GetMarginAccountPnlResponse"];
14685
+ };
14686
+ };
14687
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
14688
+ 429: {
14689
+ headers: {
14690
+ [name: string]: unknown;
14691
+ };
14692
+ content?: never;
14693
+ };
14694
+ };
14695
+ };
14256
14696
  simulate_order_risk: {
14257
14697
  parameters: {
14258
14698
  query?: never;
@@ -14319,6 +14759,37 @@ export interface operations {
14319
14759
  };
14320
14760
  };
14321
14761
  };
14762
+ transfer_collateral: {
14763
+ parameters: {
14764
+ query?: never;
14765
+ header?: never;
14766
+ path?: never;
14767
+ cookie?: never;
14768
+ };
14769
+ requestBody: {
14770
+ content: {
14771
+ "application/json": components["schemas"]["TransferCollateralRequest"];
14772
+ };
14773
+ };
14774
+ responses: {
14775
+ /** @description OK */
14776
+ 200: {
14777
+ headers: {
14778
+ [name: string]: unknown;
14779
+ };
14780
+ content: {
14781
+ "application/json": components["schemas"]["TransferCollateralResponse"];
14782
+ };
14783
+ };
14784
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
14785
+ 429: {
14786
+ headers: {
14787
+ [name: string]: unknown;
14788
+ };
14789
+ content?: never;
14790
+ };
14791
+ };
14792
+ };
14322
14793
  get_parent_margin_account_summary: {
14323
14794
  parameters: {
14324
14795
  query?: {
@@ -14537,6 +15008,71 @@ export interface operations {
14537
15008
  };
14538
15009
  };
14539
15010
  };
15011
+ create_sub_account: {
15012
+ parameters: {
15013
+ query?: never;
15014
+ header?: never;
15015
+ path?: never;
15016
+ cookie?: never;
15017
+ };
15018
+ requestBody: {
15019
+ content: {
15020
+ "application/json": components["schemas"]["CreateSubAccountRequest"];
15021
+ };
15022
+ };
15023
+ responses: {
15024
+ /** @description OK */
15025
+ 200: {
15026
+ headers: {
15027
+ [name: string]: unknown;
15028
+ };
15029
+ content: {
15030
+ "application/json": components["schemas"]["CreateSubAccountResponse"];
15031
+ };
15032
+ };
15033
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15034
+ 429: {
15035
+ headers: {
15036
+ [name: string]: unknown;
15037
+ };
15038
+ content?: never;
15039
+ };
15040
+ };
15041
+ };
15042
+ close_sub_account: {
15043
+ parameters: {
15044
+ query?: never;
15045
+ header?: never;
15046
+ path: {
15047
+ /** @example 2b1a5f9c-0000-4000-8000-000000000001 */
15048
+ marginAccountId: string;
15049
+ };
15050
+ cookie?: never;
15051
+ };
15052
+ requestBody: {
15053
+ content: {
15054
+ "application/json": components["schemas"]["CloseSubAccountRequest"];
15055
+ };
15056
+ };
15057
+ responses: {
15058
+ /** @description OK */
15059
+ 200: {
15060
+ headers: {
15061
+ [name: string]: unknown;
15062
+ };
15063
+ content: {
15064
+ "application/json": components["schemas"]["CloseSubAccountResponse"];
15065
+ };
15066
+ };
15067
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15068
+ 429: {
15069
+ headers: {
15070
+ [name: string]: unknown;
15071
+ };
15072
+ content?: never;
15073
+ };
15074
+ };
15075
+ };
14540
15076
  list_all_funding_history: {
14541
15077
  parameters: {
14542
15078
  query?: {
@@ -16347,6 +16883,70 @@ export interface operations {
16347
16883
  };
16348
16884
  };
16349
16885
  };
16886
+ get_my_referral_tree: {
16887
+ parameters: {
16888
+ query?: {
16889
+ parent?: string;
16890
+ /** @description Nodes per page (max 200) */
16891
+ pageSize?: number;
16892
+ /**
16893
+ * @description Opaque cursor from a previous response's `nextPageToken`; omit or send an
16894
+ * empty string for the first page. Only valid with the same `parent`.
16895
+ */
16896
+ pageToken?: string;
16897
+ };
16898
+ header?: never;
16899
+ path?: never;
16900
+ cookie?: never;
16901
+ };
16902
+ requestBody?: never;
16903
+ responses: {
16904
+ /** @description OK */
16905
+ 200: {
16906
+ headers: {
16907
+ [name: string]: unknown;
16908
+ };
16909
+ content: {
16910
+ "application/json": components["schemas"]["GetMyReferralTreeResponse"];
16911
+ };
16912
+ };
16913
+ /** @description Invalid `parent` wallet address, `pageSize`, or `pageToken` */
16914
+ 400: {
16915
+ headers: {
16916
+ [name: string]: unknown;
16917
+ };
16918
+ content?: never;
16919
+ };
16920
+ /** @description Authentication required */
16921
+ 401: {
16922
+ headers: {
16923
+ [name: string]: unknown;
16924
+ };
16925
+ content?: never;
16926
+ };
16927
+ /** @description `parent` is not the caller or one of the caller's own L1/L2 referees */
16928
+ 404: {
16929
+ headers: {
16930
+ [name: string]: unknown;
16931
+ };
16932
+ content?: never;
16933
+ };
16934
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
16935
+ 429: {
16936
+ headers: {
16937
+ [name: string]: unknown;
16938
+ };
16939
+ content?: never;
16940
+ };
16941
+ /** @description Internal server error */
16942
+ 500: {
16943
+ headers: {
16944
+ [name: string]: unknown;
16945
+ };
16946
+ content?: never;
16947
+ };
16948
+ };
16949
+ };
16350
16950
  get_rewards_balance: {
16351
16951
  parameters: {
16352
16952
  query?: never;
@@ -16431,6 +17031,13 @@ export interface operations {
16431
17031
  };
16432
17032
  content?: never;
16433
17033
  };
17034
+ /** @description Movement rate limit exceeded — withdrawals, collateral transfers and reward transfers share a per-user budget; retry after the interval in details.retryAfter */
17035
+ 429: {
17036
+ headers: {
17037
+ [name: string]: unknown;
17038
+ };
17039
+ content?: never;
17040
+ };
16434
17041
  /** @description Internal server error */
16435
17042
  500: {
16436
17043
  headers: {
@@ -16500,6 +17107,13 @@ export interface operations {
16500
17107
  "application/json": components["schemas"]["BatchCloseAllResponse"];
16501
17108
  };
16502
17109
  };
17110
+ /** @description Order rate limit exceeded — each call draws one item per open position it closes (at least 1) from the per-account risk-reduction budget it shares with cancels (and the budget the account family shares). Returned when the first 100 closes do not fit; positions past 100 that do not fit are reported per position as RATE_LIMIT_EXCEEDED instead. Retry after the interval in details.retryAfter */
17111
+ 429: {
17112
+ headers: {
17113
+ [name: string]: unknown;
17114
+ };
17115
+ content?: never;
17116
+ };
16503
17117
  };
16504
17118
  };
16505
17119
  list_position_history: {
@@ -16595,6 +17209,13 @@ export interface operations {
16595
17209
  "application/json": components["schemas"]["ClosePositionResponse"];
16596
17210
  };
16597
17211
  };
17212
+ /** @description Order rate limit exceeded — each close draws one item from the per-account risk-reduction budget it shares with cancels (and the budget the account family shares); retry after the interval in details.retryAfter */
17213
+ 429: {
17214
+ headers: {
17215
+ [name: string]: unknown;
17216
+ };
17217
+ content?: never;
17218
+ };
16598
17219
  };
16599
17220
  };
16600
17221
  get_position_pnl_history: {