@0xmonaco/types 1.0.72 → 1.0.73-develop.af0f5d0

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;
@@ -706,6 +708,75 @@ export interface paths {
706
708
  patch?: never;
707
709
  trace?: never;
708
710
  };
711
+ "/api/v1/buildercodes/builder-fee": {
712
+ parameters: {
713
+ query?: never;
714
+ header?: never;
715
+ path?: never;
716
+ cookie?: never;
717
+ };
718
+ get?: never;
719
+ /**
720
+ * Set your builder fee
721
+ * @description Set this application's builder fee.
722
+ *
723
+ * The builder fee is an additional taker fee, in basis points, that this
724
+ * frontend charges its own users on top of Monaco's fee. The application is
725
+ * taken from the authenticated session; the caller must be the application's
726
+ * BuilderCodes payout wallet, and delegated-agent sessions are refused.
727
+ *
728
+ * `bps` must be between 0 and the current builder-fee cap
729
+ * (`builderFeeCapBps` on `GetBuildercodesConfig`) inclusive. The application
730
+ * must be enrolled in BuilderCodes with a payout address. At most two changes
731
+ * are allowed in any rolling 24 hours; changes Monaco makes on the
732
+ * application's behalf do not count. Setting the fee it already has is a
733
+ * no-op that succeeds and does not use up a change.
734
+ *
735
+ * The fee can be set while builder fees are switched off
736
+ * (`builderFeeEnabled` false): it is stored and nothing is charged until they
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.
741
+ *
742
+ * A refused change is **HTTP 409** / **FAILED_PRECONDITION** when the
743
+ * application is not enrolled with a payout address or has no changes left
744
+ * (REST adds `details.nextChangeAllowedAt`), and **HTTP 400** /
745
+ * **INVALID_ARGUMENT** when `bps` is above the cap.
746
+ */
747
+ put: operations["set_builder_fee"];
748
+ post?: never;
749
+ delete?: never;
750
+ options?: never;
751
+ head?: never;
752
+ patch?: never;
753
+ trace?: never;
754
+ };
755
+ "/api/v1/buildercodes/builder-fee/changes": {
756
+ parameters: {
757
+ query?: never;
758
+ header?: never;
759
+ path?: never;
760
+ cookie?: never;
761
+ };
762
+ /**
763
+ * List your builder-fee changes
764
+ * @description List this application's builder-fee changes.
765
+ *
766
+ * Newest first, cursor-paginated. Includes every change to this
767
+ * application's builder fee: those its payout wallet made (`BUILDER`) and
768
+ * those Monaco made on its behalf (`ADMIN`). The application is taken from
769
+ * the authenticated session.
770
+ */
771
+ get: operations["list_builder_fee_changes"];
772
+ put?: never;
773
+ post?: never;
774
+ delete?: never;
775
+ options?: never;
776
+ head?: never;
777
+ patch?: never;
778
+ trace?: never;
779
+ };
709
780
  "/api/v1/buildercodes/config": {
710
781
  parameters: {
711
782
  query?: never;
@@ -872,6 +943,11 @@ export interface paths {
872
943
  * retry with backoff, and an overload positively wants one. Only an UNTAGGED
873
944
  * availability failure — matching-engine transport, timeout and fail-closed
874
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`.
875
951
  */
876
952
  post: operations["claim_buildercode_rewards"];
877
953
  delete?: never;
@@ -907,7 +983,9 @@ export interface paths {
907
983
  * `leader` handle that names a different leader is refused. `copyExisting`
908
984
  * copies the leader's open positions into the new copy account at creation
909
985
  * (see PreviewFollow for what that costs); it applies only to a create, and
910
- * 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.
911
989
  */
912
990
  post: operations["upsert_follow"];
913
991
  delete?: never;
@@ -1078,9 +1156,7 @@ export interface paths {
1078
1156
  * There is no margin reduction: a follow exits by being stopped. Follow
1079
1157
  * writes need a master account session (not a delegated agent or a
1080
1158
  * sub-account). 404 unless the follow is yours; 409 while it is stopping
1081
- * or once it is stopped, and when copy trading is not available on the
1082
- * platform at all (the platform then runs copy trading exits only). It
1083
- * 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
1084
1160
  * share. It is not idempotent: a retry after a timeout whose first attempt
1085
1161
  * landed adds the amount twice, so read the follow before retrying.
1086
1162
  */
@@ -1105,8 +1181,11 @@ export interface paths {
1105
1181
  * @description Stop a follow.
1106
1182
  *
1107
1183
  * Stops mirroring the leader. Stopping one of your own follows only; the
1108
- * follow is identified by its id. An exit is never gated beyond ownership,
1109
- * 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.
1110
1189
  */
1111
1190
  post: operations["stop_follow"];
1112
1191
  delete?: never;
@@ -1164,7 +1243,9 @@ export interface paths {
1164
1243
  * TraderCode handle. The profile is replaced as sent: an omitted `bio` or
1165
1244
  * `minAllocation` clears it and an omitted `status` means ACTIVE; an
1166
1245
  * omitted `shareBps` keeps the current share (the platform default on a
1167
- * 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.
1168
1249
  */
1169
1250
  put: operations["upsert_lead_trader"];
1170
1251
  post?: never;
@@ -1292,7 +1373,10 @@ export interface paths {
1292
1373
  *
1293
1374
  * Master accounts only. Creates (or updates, keyed on `agent_address`) a
1294
1375
  * delegation linking the calling owner to an agent wallet, together with the
1295
- * 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.
1296
1380
  */
1297
1381
  post: operations["upsert_delegated_agent"];
1298
1382
  delete?: never;
@@ -1344,7 +1428,8 @@ export interface paths {
1344
1428
  * `ListDelegatedAgentOwners`) and a freshly generated session public key.
1345
1429
  * The new session acts as the owner but records the agent's address for
1346
1430
  * policy enforcement. Requires an active delegation for the (owner, agent)
1347
- * 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
1348
1433
  * authenticated request and periodic WebSocket session revalidation requires
1349
1434
  * the backing delegation to remain active and unexpired.
1350
1435
  */
@@ -1628,6 +1713,29 @@ export interface paths {
1628
1713
  patch?: never;
1629
1714
  trace?: never;
1630
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
+ };
1631
1739
  "/api/v1/margin/accounts/{marginAccountId}/simulate-order-risk": {
1632
1740
  parameters: {
1633
1741
  query?: never;
@@ -1660,6 +1768,30 @@ export interface paths {
1660
1768
  patch?: never;
1661
1769
  trace?: never;
1662
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
+ };
1663
1795
  "/api/v1/margin/parent-margin-account": {
1664
1796
  parameters: {
1665
1797
  query?: never;
@@ -1781,6 +1913,56 @@ export interface paths {
1781
1913
  patch?: never;
1782
1914
  trace?: never;
1783
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
+ };
1784
1966
  "/api/v1/market/funding/history": {
1785
1967
  parameters: {
1786
1968
  query?: never;
@@ -2575,12 +2757,13 @@ export interface paths {
2575
2757
  * Get your referral position
2576
2758
  * @description Read your own referral position (self-scoped).
2577
2759
  *
2578
- * Return the authenticated caller's referral position: their direct (L1)
2579
- * referrer, the total rewards they have earned, and their most recent reward
2580
- * 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,
2581
2764
  * so a caller can only ever read their own chain. Every other user is
2582
2765
  * identified by their public wallet address, never an internal id. An empty
2583
- * `referrer` means the caller was not referred.
2766
+ * `referrer` and `upline` mean the caller was not referred.
2584
2767
  */
2585
2768
  get: operations["get_my_referral_position"];
2586
2769
  put?: never;
@@ -2619,6 +2802,41 @@ export interface paths {
2619
2802
  patch?: never;
2620
2803
  trace?: never;
2621
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
+ };
2622
2840
  "/api/v1/pitpass/rewards/balance": {
2623
2841
  parameters: {
2624
2842
  query?: never;
@@ -2661,7 +2879,8 @@ export interface paths {
2661
2879
  * trading balance under the authenticated application, making it tradeable
2662
2880
  * immediately. Ledger-only (one shared vault + one backend ledger) — no
2663
2881
  * on-chain transaction and no gas. Fails with 402 when the rewards balance is
2664
- * insufficient.
2882
+ * insufficient. It spends the per-user movement budget withdrawals and
2883
+ * collateral transfers share.
2665
2884
  */
2666
2885
  post: operations["transfer_rewards"];
2667
2886
  delete?: never;
@@ -2701,7 +2920,13 @@ export interface paths {
2701
2920
  * Submits a MARKET reduce-only close for every open position owned by the
2702
2921
  * caller, optionally filtered to a single trading pair. Best-effort and
2703
2922
  * partial: each position closes independently and per-position failures are
2704
- * 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.
2705
2930
  */
2706
2931
  post: operations["batch_close_all_positions"];
2707
2932
  delete?: never;
@@ -3823,6 +4048,36 @@ export interface components {
3823
4048
  matchResult?: components["schemas"]["MatchResult"];
3824
4049
  error?: components["schemas"]["BatchReplaceError"];
3825
4050
  };
4051
+ BuilderFeeChange: {
4052
+ /**
4053
+ * @description Who made the change: `BUILDER` (this application's payout wallet) or `ADMIN` (Monaco, on the application's behalf).
4054
+ * @example BUILDER
4055
+ * @enum {string|null}
4056
+ */
4057
+ actorType?: "BUILDER" | "ADMIN" | null;
4058
+ /**
4059
+ * @description The lowercase payout wallet address for a `BUILDER` change, or the Monaco operator's email for an `ADMIN` change.
4060
+ * @example 0x0000000000000000000000000000000000000001
4061
+ */
4062
+ actor?: string | null;
4063
+ /**
4064
+ * Format: uint32
4065
+ * @description Builder fee before the change, in basis points.
4066
+ * @example 0
4067
+ */
4068
+ oldBps?: number | null;
4069
+ /**
4070
+ * Format: uint32
4071
+ * @description Builder fee after the change, in basis points.
4072
+ * @example 10
4073
+ */
4074
+ newBps?: number | null;
4075
+ /**
4076
+ * Format: date-time
4077
+ * @description RFC 3339 time of the change.
4078
+ */
4079
+ createdAt?: string | null;
4080
+ };
3826
4081
  BuildercodePayout: {
3827
4082
  /**
3828
4083
  * Format: uuid
@@ -3846,7 +4101,7 @@ export interface components {
3846
4101
  amount?: string | null;
3847
4102
  /**
3848
4103
  * Format: int32
3849
- * @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.
3850
4105
  * @example 1000
3851
4106
  */
3852
4107
  appliedBps?: number | null;
@@ -3856,7 +4111,7 @@ export interface components {
3856
4111
  */
3857
4112
  createdAt?: string | null;
3858
4113
  /**
3859
- * @description Payout stream this credit belongs to: `REVENUE_SHARE` (the frontend's share of Monaco's fee) or `BUILDER_FEE` (the frontend's own builder fee, paid by the taker). Both land in the same claimable balance.
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.
3860
4115
  * @example REVENUE_SHARE
3861
4116
  * @enum {string|null}
3862
4117
  */
@@ -4173,6 +4428,16 @@ export interface components {
4173
4428
  message?: string | null;
4174
4429
  submittedQuantity?: string | null;
4175
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
+ };
4176
4441
  ClosedTrade: {
4177
4442
  /**
4178
4443
  * Format: uuid
@@ -4201,6 +4466,17 @@ export interface components {
4201
4466
  /** @description Execution time (RFC 3339) */
4202
4467
  closedAt?: string | null;
4203
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
+ };
4204
4480
  ConditionalOrder: {
4205
4481
  conditionalOrderId?: string | null;
4206
4482
  /** Format: uuid */
@@ -4500,6 +4776,23 @@ export interface components {
4500
4776
  */
4501
4777
  trailingStopOrderId?: string | null;
4502
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
+ };
4503
4796
  CreateTwapOrderRequest: {
4504
4797
  /**
4505
4798
  * Format: uuid
@@ -4713,6 +5006,8 @@ export interface components {
4713
5006
  * @description Legacy field; no concurrent open-order cap is enforced. New or updated policies leave it unset.
4714
5007
  */
4715
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;
4716
5011
  };
4717
5012
  DelegatedAgentOwner: {
4718
5013
  /**
@@ -5046,12 +5341,13 @@ export interface components {
5046
5341
  * margin account yet.
5047
5342
  *
5048
5343
  * This is NOT trading headroom for existing cross exposure. It is bounded
5049
- * 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
5050
5346
  * margin requirements, and an unrealized gain does not raise it: a
5051
5347
  * mark-to-market gain is initial margin against existing cross exposure but
5052
5348
  * may not fund an exit. `MarginAccountSummary.free_collateral` credits that
5053
5349
  * gain in full and remains the trading-margin headroom for existing cross
5054
- * exposure — but a NEW isolated or first-use position allocates principal
5350
+ * exposure — but a NEW isolated or first-use position allocates collateral
5055
5351
  * through the same gate this field measures, so size those from this field.
5056
5352
  *
5057
5353
  * Note the two `margin_*` fields answer opposite questions:
@@ -5193,6 +5489,31 @@ export interface components {
5193
5489
  * @example 1000
5194
5490
  */
5195
5491
  buildercodesBudgetBps?: number | null;
5492
+ /** @description Whether builder fees are currently charged. While false, `builderFeeBps` is stored but no builder fee is charged. */
5493
+ builderFeeEnabled?: boolean | null;
5494
+ /**
5495
+ * Format: uint32
5496
+ * @description This application's stored builder fee in basis points: the additional taker fee it charges its users. The fee charged is this value capped at `builderFeeCapBps`, and 0 while `builderFeeEnabled` is false or the application is not enrolled with a payout address.
5497
+ * @example 10
5498
+ */
5499
+ builderFeeBps?: number | null;
5500
+ /**
5501
+ * Format: uint32
5502
+ * @description The highest builder fee, in basis points, that can currently be set or charged.
5503
+ * @example 100
5504
+ */
5505
+ builderFeeCapBps?: number | null;
5506
+ /**
5507
+ * Format: uint32
5508
+ * @description Builder-fee changes this application can still make in the current rolling 24 hours (at most 2).
5509
+ * @example 2
5510
+ */
5511
+ changesRemaining?: number | null;
5512
+ /**
5513
+ * Format: date-time
5514
+ * @description RFC 3339 time at which the next builder-fee change becomes allowed, or null while `changesRemaining` is above 0.
5515
+ */
5516
+ nextChangeAllowedAt?: string | null;
5196
5517
  };
5197
5518
  /** @description OHLCV candlestick data. */
5198
5519
  GetCandlesResponse: {
@@ -5322,9 +5643,21 @@ export interface components {
5322
5643
  /** Format: uint32 */
5323
5644
  pageSize?: number | null;
5324
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
+ };
5325
5659
  GetMarginAccountSummaryResponse: {
5326
5660
  marginAccountId?: string | null;
5327
- accountState?: string | null;
5328
5661
  equity?: string | null;
5329
5662
  initialMarginRequired?: string | null;
5330
5663
  maintenanceMarginRequired?: string | null;
@@ -5333,23 +5666,23 @@ export interface components {
5333
5666
  * @description The largest amount a transfer-out of this scope will actually accept.
5334
5667
  *
5335
5668
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
5336
- * equity includes realized PnL, accrued funding and mark-to-market gains
5337
- * that are not principal a transfer can move — so the two can differ
5338
- * 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.
5339
5672
  *
5340
- * For a risk bucket this is capped by the bucket's allocated collateral;
5341
- * for a parent margin account, by deposited collateral that no risk bucket
5342
- * 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.
5343
5678
  *
5344
- * This is the largest accepted transfer-out, NOT a promise that every
5345
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
5346
- * bucket whose realized loss exceeds its remaining value accepts the full
5347
- * close-out reported here — which settles that loss to the parent margin
5348
- * account — while refusing a partial withdrawal that would leave the bucket
5349
- * holding less collateral than the loss it has already taken. For such a
5350
- * bucket the accepted amounts are everything up to its equity, plus this
5351
- * figure itself, with a gap in between. Size a transfer directly from this
5352
- * 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.
5353
5686
  */
5354
5687
  withdrawableCollateral?: string | null;
5355
5688
  totalPositionNotional?: string | null;
@@ -5384,6 +5717,16 @@ export interface components {
5384
5717
  copyFollowId?: string | null;
5385
5718
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
5386
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;
5387
5730
  };
5388
5731
  GetMarkPriceResponse: {
5389
5732
  /** Format: uuid */
@@ -5580,7 +5923,7 @@ export interface components {
5580
5923
  };
5581
5924
  GetMyReferralPositionResponse: {
5582
5925
  /**
5583
- * @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.
5584
5927
  * @example 0x0000000000000000000000000000000000000002
5585
5928
  */
5586
5929
  referrer?: string | null;
@@ -5596,6 +5939,21 @@ export interface components {
5596
5939
  referrerDisplay?: string | null;
5597
5940
  /** @description The caller's most recent reward rows, newest first. Bounded server-side — not the full history. */
5598
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;
5599
5957
  };
5600
5958
  /** @description Latest public open interest for a trading pair. */
5601
5959
  GetOpenInterestResponse: {
@@ -5833,7 +6191,7 @@ export interface components {
5833
6191
  */
5834
6192
  batchId?: string | null;
5835
6193
  /**
5836
- * @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.
5837
6195
  * @example REDUCE_ONLY_EXHAUSTED
5838
6196
  */
5839
6197
  terminalReason?: string | null;
@@ -6018,6 +6376,18 @@ export interface components {
6018
6376
  total?: components["schemas"]["PortfolioMarginTotal"];
6019
6377
  positions?: components["schemas"]["PortfolioMarginPositionCounts"];
6020
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;
6021
6391
  };
6022
6392
  GetPortfolioPerformanceResponse: {
6023
6393
  window?: components["schemas"]["PortfolioSeriesWindow"];
@@ -6271,7 +6641,7 @@ export interface components {
6271
6641
  cumFees?: string | null;
6272
6642
  /**
6273
6643
  * Format: int64
6274
- * @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.
6275
6645
  * @example 918342
6276
6646
  */
6277
6647
  version?: number | null;
@@ -6997,6 +7367,12 @@ export interface components {
6997
7367
  */
6998
7368
  totalPages?: number | null;
6999
7369
  };
7370
+ ListBuilderFeeChangesResponse: {
7371
+ /** @description Builder-fee changes, newest first. */
7372
+ changes?: components["schemas"]["BuilderFeeChange"][] | null;
7373
+ /** @description Cursor for the next page; empty when there are no more. */
7374
+ nextPageToken?: string | null;
7375
+ };
7000
7376
  ListBuildercodePayoutsResponse: {
7001
7377
  /** @description Per-trade credits, newest first. */
7002
7378
  payouts?: components["schemas"]["BuildercodePayout"][] | null;
@@ -7332,7 +7708,6 @@ export interface components {
7332
7708
  MarginAccountSummary: {
7333
7709
  /** @description Parent margin account UUID. */
7334
7710
  marginAccountId?: string | null;
7335
- accountState?: string | null;
7336
7711
  equity?: string | null;
7337
7712
  initialMarginRequired?: string | null;
7338
7713
  maintenanceMarginRequired?: string | null;
@@ -7341,23 +7716,23 @@ export interface components {
7341
7716
  * @description The largest amount a transfer-out of this scope will actually accept.
7342
7717
  *
7343
7718
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
7344
- * equity includes realized PnL, accrued funding and mark-to-market gains
7345
- * that are not principal a transfer can move — so the two can differ
7346
- * 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.
7347
7722
  *
7348
- * For a risk bucket this is capped by the bucket's allocated collateral;
7349
- * for a parent margin account, by deposited collateral that no risk bucket
7350
- * 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.
7351
7728
  *
7352
- * This is the largest accepted transfer-out, NOT a promise that every
7353
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
7354
- * bucket whose realized loss exceeds its remaining value accepts the full
7355
- * close-out reported here — which settles that loss to the parent margin
7356
- * account — while refusing a partial withdrawal that would leave the bucket
7357
- * holding less collateral than the loss it has already taken. For such a
7358
- * bucket the accepted amounts are everything up to its equity, plus this
7359
- * figure itself, with a gap in between. Size a transfer directly from this
7360
- * 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.
7361
7736
  */
7362
7737
  withdrawableCollateral?: string | null;
7363
7738
  totalPositionNotional?: string | null;
@@ -7423,6 +7798,22 @@ export interface components {
7423
7798
  copyFollowId?: string | null;
7424
7799
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
7425
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;
7426
7817
  };
7427
7818
  MatchResult: {
7428
7819
  /**
@@ -7743,6 +8134,17 @@ export interface components {
7743
8134
  */
7744
8135
  positions?: string | null;
7745
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
+ };
7746
8148
  PortfolioMarginPositionCounts: {
7747
8149
  total?: string | null;
7748
8150
  cross?: string | null;
@@ -7760,18 +8162,17 @@ export interface components {
7760
8162
  * the bound the engine enforces on transfers-out and withdrawals, and
7761
8163
  * therefore also the effective ceiling on funding new isolated or
7762
8164
  * first-use order capacity, because allocating collateral to a risk
7763
- * bucket passes through the same principal-gated door.
8165
+ * bucket passes through the same capacity-gated door.
7764
8166
  *
7765
8167
  * NOT a clamped `parent_available_collateral`. That field is
7766
- * `free_collateral`, an equity figure: it credits settled realized PnL,
7767
- * accrued funding, and mark-to-market gains that a transfer-out cannot
7768
- * move, so the two can differ without limit. This bound never credits an
7769
- * unrealized gain. Under the default capacity basis it also excludes
7770
- * non-principal balances such as banked realized PnL:
7771
- * `min(deposited principal - bucket allocations,
7772
- * free_collateral - max(unrealized_pnl, 0))`, floored at zero. Whatever
7773
- * the engine's configured capacity basis, this is the bound its gates
7774
- * 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
7775
8176
  * `MarginAccountSummary.withdrawable_collateral` up to quote-decimal
7776
8177
  * truncation: this surface truncates toward zero at the quote asset's
7777
8178
  * precision, while the margin-accounts surface may carry sub-tick tails.
@@ -7825,14 +8226,15 @@ export interface components {
7825
8226
  * accept — the bound enforced on bucket collateral withdrawals.
7826
8227
  *
7827
8228
  * NOT a clamped `free_collateral`: free collateral is equity headroom and
7828
- * credits realized PnL and mark-to-market gains that a transfer-out cannot
7829
- * move. This bound is capped by the bucket's settled capacity (its
7830
- * allocated collateral, under the default capacity basis), and an
7831
- * 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.
7832
8234
  *
7833
- * This is the largest accepted transfer-out, NOT a promise that every
7834
- * smaller one is accepted: an underwater flat bucket accepts its full
7835
- * 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
7836
8238
  * risk-bucket rows' `MarginAccountSummary.withdrawable_collateral` up to
7837
8239
  * quote-decimal truncation (this surface truncates toward zero; that one
7838
8240
  * may carry sub-tick tails).
@@ -8082,7 +8484,7 @@ export interface components {
8082
8484
  cumFees?: string | null;
8083
8485
  /**
8084
8486
  * Format: int64
8085
- * @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.
8086
8488
  * @example 918342
8087
8489
  */
8088
8490
  version?: number | null;
@@ -8490,6 +8892,50 @@ export interface components {
8490
8892
  */
8491
8893
  sourceDisplay?: string | null;
8492
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
+ };
8493
8939
  RefreshManagedMarketQuotesRequest: {
8494
8940
  launchId?: string | null;
8495
8941
  ownerId?: string | null;
@@ -8820,6 +9266,39 @@ export interface components {
8820
9266
  */
8821
9267
  isCustom?: boolean | null;
8822
9268
  };
9269
+ SetBuilderFeeRequest: {
9270
+ /**
9271
+ * Format: uint32
9272
+ * @description New builder fee in basis points, from 0 up to the current `builderFeeCapBps` inclusive. 0 stops charging a builder fee.
9273
+ * @example 10
9274
+ */
9275
+ bps: number;
9276
+ };
9277
+ SetBuilderFeeResponse: {
9278
+ /**
9279
+ * Format: uint32
9280
+ * @description The builder fee now stored, in basis points.
9281
+ * @example 10
9282
+ */
9283
+ builderFeeBps?: number | null;
9284
+ /**
9285
+ * Format: uint32
9286
+ * @description The builder fee this change replaced, in basis points. Equal to `builderFeeBps` when the request set the fee it already had, which changes nothing.
9287
+ * @example 0
9288
+ */
9289
+ previousBuilderFeeBps?: number | null;
9290
+ /**
9291
+ * Format: uint32
9292
+ * @description Builder-fee changes this application can still make in the current rolling 24 hours (at most 2).
9293
+ * @example 1
9294
+ */
9295
+ changesRemaining?: number | null;
9296
+ /**
9297
+ * Format: date-time
9298
+ * @description RFC 3339 time at which the next builder-fee change becomes allowed, or null while `changesRemaining` is above 0.
9299
+ */
9300
+ nextChangeAllowedAt?: string | null;
9301
+ };
8823
9302
  SetSelfTradePreventionDefaultRequest: {
8824
9303
  /**
8825
9304
  * @description The self-trade-prevention mode applied when an order from this wallet would match the wallet family's own resting order and the order names no override: `CANCEL_MAKER` (cancel the resting order — the platform default), `CANCEL_TAKER` (cancel the incoming order), `CANCEL_BOTH`, or `SKIP` (trade around own orders). Input is case-insensitive.
@@ -9116,6 +9595,12 @@ export interface components {
9116
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.
9117
9596
  */
9118
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;
9119
9604
  };
9120
9605
  StopFollowResponse: {
9121
9606
  /**
@@ -9591,6 +10076,25 @@ export interface components {
9591
10076
  asset?: string | null;
9592
10077
  amount?: string | null;
9593
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
+ };
9594
10098
  TransferCollateralToMarginAccountRequest: {
9595
10099
  /** @description Parent margin account UUID that receives collateral. */
9596
10100
  marginAccountId?: string | null;
@@ -9695,6 +10199,13 @@ export interface components {
9695
10199
  * row is stale (close/reopen race).
9696
10200
  */
9697
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;
9698
10209
  };
9699
10210
  TransferRewardsRequest: {
9700
10211
  /**
@@ -9963,12 +10474,12 @@ export interface components {
9963
10474
  };
9964
10475
  UpdatedFields: {
9965
10476
  /**
9966
- * @description New price (if changed)
10477
+ * @description The replacement's limit price: the requested price, or the original order's price when price was omitted.
9967
10478
  * @example 35500.00
9968
10479
  */
9969
10480
  price?: string | null;
9970
10481
  /**
9971
- * @description New quantity (if changed)
10482
+ * @description The replacement's total quantity: the requested quantity, or the original order's total when quantity was omitted. It is not the resting size: the replacement rests this total minus the already-filled amount, so a 100-lot with 60 filled reports 100 here and rests 40. Read the order's remainingQuantity for the resting size. Margin reduce-only replacements are the exception: this is the close size placed, which is the requested quantity or, when omitted, the original's remaining quantity.
9972
10483
  * @example 0.7
9973
10484
  */
9974
10485
  quantity?: string | null;
@@ -9985,21 +10496,21 @@ export interface components {
9985
10496
  */
9986
10497
  name?: string | null;
9987
10498
  /**
9988
- * @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.
9989
10500
  * @example 2026-12-31T23:59:59Z
9990
10501
  */
9991
10502
  expiresAt?: string | null;
9992
10503
  /**
9993
- * @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.
9994
10505
  * @example [
9995
10506
  * "CREATE_ORDER",
9996
10507
  * "CANCEL_ORDER"
9997
10508
  * ]
9998
10509
  */
9999
10510
  allowedActions: string[];
10000
- /** @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. */
10001
10512
  allowedTradingPairIds: string[];
10002
- /** @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. */
10003
10514
  allowedMarginAccountIds?: string[] | null;
10004
10515
  /**
10005
10516
  * @description Optional JSON array of permitted order types (LIMIT, MARKET). Omitted, null, or [] means unrestricted order types.
@@ -10030,6 +10541,13 @@ export interface components {
10030
10541
  * @description Unsupported legacy field. Requests that set maxOpenOrders are rejected; no concurrent open-order cap is enforced. Omit this field.
10031
10542
  */
10032
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;
10033
10551
  };
10034
10552
  UpsertFollowRequest: {
10035
10553
  /**
@@ -10646,7 +11164,19 @@ export interface operations {
10646
11164
  };
10647
11165
  get_portfolio_margin: {
10648
11166
  parameters: {
10649
- 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
+ };
10650
11180
  header?: never;
10651
11181
  path?: never;
10652
11182
  cookie?: never;
@@ -11008,6 +11538,13 @@ export interface operations {
11008
11538
  };
11009
11539
  content?: never;
11010
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
+ };
11011
11548
  /** @description Internal server error */
11012
11549
  500: {
11013
11550
  headers: {
@@ -11928,6 +12465,135 @@ export interface operations {
11928
12465
  };
11929
12466
  };
11930
12467
  };
12468
+ set_builder_fee: {
12469
+ parameters: {
12470
+ query?: never;
12471
+ header?: never;
12472
+ path?: never;
12473
+ cookie?: never;
12474
+ };
12475
+ requestBody: {
12476
+ content: {
12477
+ "application/json": components["schemas"]["SetBuilderFeeRequest"];
12478
+ };
12479
+ };
12480
+ responses: {
12481
+ /** @description OK */
12482
+ 200: {
12483
+ headers: {
12484
+ [name: string]: unknown;
12485
+ };
12486
+ content: {
12487
+ "application/json": components["schemas"]["SetBuilderFeeResponse"];
12488
+ };
12489
+ };
12490
+ /** @description bps is above the current builder-fee cap (gRPC: INVALID_ARGUMENT) */
12491
+ 400: {
12492
+ headers: {
12493
+ [name: string]: unknown;
12494
+ };
12495
+ content?: never;
12496
+ };
12497
+ /** @description Authentication required */
12498
+ 401: {
12499
+ headers: {
12500
+ [name: string]: unknown;
12501
+ };
12502
+ content?: never;
12503
+ };
12504
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12505
+ 403: {
12506
+ headers: {
12507
+ [name: string]: unknown;
12508
+ };
12509
+ content?: never;
12510
+ };
12511
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
12512
+ 404: {
12513
+ headers: {
12514
+ [name: string]: unknown;
12515
+ };
12516
+ content?: never;
12517
+ };
12518
+ /** @description The application is not enrolled in BuilderCodes with a payout address, or it has already made two changes in the last 24 hours; the latter carries `details.nextChangeAllowedAt` (gRPC: FAILED_PRECONDITION) */
12519
+ 409: {
12520
+ headers: {
12521
+ [name: string]: unknown;
12522
+ };
12523
+ content?: never;
12524
+ };
12525
+ /** @description Internal server error */
12526
+ 500: {
12527
+ headers: {
12528
+ [name: string]: unknown;
12529
+ };
12530
+ content?: never;
12531
+ };
12532
+ };
12533
+ };
12534
+ list_builder_fee_changes: {
12535
+ parameters: {
12536
+ query?: {
12537
+ /** @description Items per page (max 100) */
12538
+ pageSize?: number;
12539
+ /**
12540
+ * @description Opaque cursor from a previous response's `nextPageToken`; omit or send an
12541
+ * empty string for the first page.
12542
+ */
12543
+ pageToken?: string;
12544
+ };
12545
+ header?: never;
12546
+ path?: never;
12547
+ cookie?: never;
12548
+ };
12549
+ requestBody?: never;
12550
+ responses: {
12551
+ /** @description OK */
12552
+ 200: {
12553
+ headers: {
12554
+ [name: string]: unknown;
12555
+ };
12556
+ content: {
12557
+ "application/json": components["schemas"]["ListBuilderFeeChangesResponse"];
12558
+ };
12559
+ };
12560
+ /** @description Invalid page size or page token */
12561
+ 400: {
12562
+ headers: {
12563
+ [name: string]: unknown;
12564
+ };
12565
+ content?: never;
12566
+ };
12567
+ /** @description Authentication required */
12568
+ 401: {
12569
+ headers: {
12570
+ [name: string]: unknown;
12571
+ };
12572
+ content?: never;
12573
+ };
12574
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12575
+ 403: {
12576
+ headers: {
12577
+ [name: string]: unknown;
12578
+ };
12579
+ content?: never;
12580
+ };
12581
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
12582
+ 404: {
12583
+ headers: {
12584
+ [name: string]: unknown;
12585
+ };
12586
+ content?: never;
12587
+ };
12588
+ /** @description Internal server error */
12589
+ 500: {
12590
+ headers: {
12591
+ [name: string]: unknown;
12592
+ };
12593
+ content?: never;
12594
+ };
12595
+ };
12596
+ };
11931
12597
  get_buildercodes_config: {
11932
12598
  parameters: {
11933
12599
  query?: never;
@@ -11983,7 +12649,7 @@ export interface operations {
11983
12649
  page?: number;
11984
12650
  /** @description Items per page (max 100) */
11985
12651
  pageSize?: number;
11986
- /** @description Only return BuilderCodes payouts of this payout kind: REVENUE_SHARE (the frontend's share of Monaco's fee) or BUILDER_FEE (the frontend's own builder fee). 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. */
11987
12653
  kind?: "REVENUE_SHARE" | "BUILDER_FEE";
11988
12654
  };
11989
12655
  header?: never;
@@ -12177,6 +12843,13 @@ export interface operations {
12177
12843
  };
12178
12844
  content?: never;
12179
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
+ };
12180
12853
  /** @description Internal server error */
12181
12854
  500: {
12182
12855
  headers: {
@@ -12306,6 +12979,13 @@ export interface operations {
12306
12979
  };
12307
12980
  content?: never;
12308
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
+ };
12309
12989
  /** @description Internal server error */
12310
12990
  500: {
12311
12991
  headers: {
@@ -12701,7 +13381,7 @@ export interface operations {
12701
13381
  "application/json": components["schemas"]["AddFollowPositionMarginResponse"];
12702
13382
  };
12703
13383
  };
12704
- /** @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) */
12705
13385
  400: {
12706
13386
  headers: {
12707
13387
  [name: string]: unknown;
@@ -12729,7 +13409,7 @@ export interface operations {
12729
13409
  };
12730
13410
  content?: never;
12731
13411
  };
12732
- /** @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 */
12733
13413
  409: {
12734
13414
  headers: {
12735
13415
  [name: string]: unknown;
@@ -12807,6 +13487,13 @@ export interface operations {
12807
13487
  };
12808
13488
  content?: never;
12809
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
+ };
12810
13497
  /** @description Internal server error */
12811
13498
  500: {
12812
13499
  headers: {
@@ -12967,6 +13654,13 @@ export interface operations {
12967
13654
  };
12968
13655
  content?: never;
12969
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
+ };
12970
13664
  /** @description Internal server error */
12971
13665
  500: {
12972
13666
  headers: {
@@ -13785,6 +14479,10 @@ export interface operations {
13785
14479
  page?: number;
13786
14480
  /** @description Items per page (max 100) */
13787
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
+ */
13788
14486
  state?: string;
13789
14487
  /** @description Trading pair identifier (UUID) */
13790
14488
  tradingPairId?: string;
@@ -13962,6 +14660,39 @@ export interface operations {
13962
14660
  };
13963
14661
  };
13964
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
+ };
13965
14696
  simulate_order_risk: {
13966
14697
  parameters: {
13967
14698
  query?: never;
@@ -14028,6 +14759,37 @@ export interface operations {
14028
14759
  };
14029
14760
  };
14030
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
+ };
14031
14793
  get_parent_margin_account_summary: {
14032
14794
  parameters: {
14033
14795
  query?: {
@@ -14246,6 +15008,71 @@ export interface operations {
14246
15008
  };
14247
15009
  };
14248
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
+ };
14249
15076
  list_all_funding_history: {
14250
15077
  parameters: {
14251
15078
  query?: {
@@ -16056,6 +16883,70 @@ export interface operations {
16056
16883
  };
16057
16884
  };
16058
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
+ };
16059
16950
  get_rewards_balance: {
16060
16951
  parameters: {
16061
16952
  query?: never;
@@ -16140,6 +17031,13 @@ export interface operations {
16140
17031
  };
16141
17032
  content?: never;
16142
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
+ };
16143
17041
  /** @description Internal server error */
16144
17042
  500: {
16145
17043
  headers: {
@@ -16209,6 +17107,13 @@ export interface operations {
16209
17107
  "application/json": components["schemas"]["BatchCloseAllResponse"];
16210
17108
  };
16211
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
+ };
16212
17117
  };
16213
17118
  };
16214
17119
  list_position_history: {
@@ -16304,6 +17209,13 @@ export interface operations {
16304
17209
  "application/json": components["schemas"]["ClosePositionResponse"];
16305
17210
  };
16306
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
+ };
16307
17219
  };
16308
17220
  };
16309
17221
  get_position_pnl_history: {