@0xmonaco/types 1.1.9 → 1.1.10

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.
@@ -5,8 +5,8 @@
5
5
  * endpoints.
6
6
  */
7
7
  import type { BaseAPI } from "../api";
8
- import type { GetAppStatsParams, ListAppBalancesParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
9
- import type { ApplicationConfigResponse, GetAppStatsResponse, ListAppBalancesResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse } from "./responses";
8
+ import type { GetAppStatsParams, ListAppBalancesParams, ListAppMarginAccountsParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
9
+ import type { ApplicationConfigResponse, GetAppStatsResponse, ListAppBalancesResponse, ListAppMarginAccountsResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse } from "./responses";
10
10
  /**
11
11
  * Applications API interface.
12
12
  *
@@ -46,12 +46,26 @@ export interface ApplicationsAPI extends BaseAPI {
46
46
  */
47
47
  listApplicationMovements(params: ListAppMovementsParams): Promise<ListAppMovementsResponse>;
48
48
  /**
49
- * Lists user balances held within the application. Public, selected by `clientId`.
49
+ * Lists user wallet balances held within the application. Public, selected by `clientId`.
50
+ *
51
+ * Funds held in a margin account are not included, so a user funded through
52
+ * margin can show zero here. Read those users from
53
+ * `GET /api/v1/applications/margin-accounts` (`listApplicationMarginAccounts`).
50
54
  *
51
55
  * @param params - Pagination and filter options
52
56
  * @returns Promise resolving to a paginated list of balances
53
57
  */
54
58
  listApplicationBalances(params: ListAppBalancesParams): Promise<ListAppBalancesResponse>;
59
+ /**
60
+ * Lists the application's margin accounts, sub-accounts included. Public,
61
+ * selected by `clientId`. Figures are a persisted baseline repriced at the
62
+ * latest risk marks, so they can briefly lag the matching engine.
63
+ * Copy-trading accounts are not listed.
64
+ *
65
+ * @param params - Pagination and filter options
66
+ * @returns Promise resolving to a paginated list of margin accounts
67
+ */
68
+ listApplicationMarginAccounts(params: ListAppMarginAccountsParams): Promise<ListAppMarginAccountsResponse>;
55
69
  /**
56
70
  * Gets aggregate volume and fee stats for the application. Public, selected by `clientId`.
57
71
  *
@@ -60,5 +74,5 @@ export interface ApplicationsAPI extends BaseAPI {
60
74
  */
61
75
  getApplicationStats(params: GetAppStatsParams): Promise<GetAppStatsResponse>;
62
76
  }
63
- export type { GetAppStatsParams, ListAppBalancesParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams } from "./requests";
64
- export type { AppBalance, ApplicationConfigResponse, AppMovement, AppOrder, AppUser, GetAppStatsResponse, ListAppBalancesResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse, } from "./responses";
77
+ export type { GetAppStatsParams, ListAppBalancesParams, ListAppMarginAccountsParams, ListAppMovementsParams, ListAppOrdersParams, ListAppUsersParams, } from "./requests";
78
+ export type { AppBalance, ApplicationConfigResponse, AppMarginAccount, AppMovement, AppOrder, AppUser, GetAppStatsResponse, ListAppBalancesResponse, ListAppMarginAccountsResponse, ListAppMovementsResponse, ListAppOrdersResponse, ListAppUsersResponse, } from "./responses";
@@ -95,6 +95,26 @@ export interface ListAppMovementsParams {
95
95
  /** Filter by asset UUID */
96
96
  assetId?: string;
97
97
  }
98
+ /**
99
+ * Query parameters for listing application margin accounts.
100
+ */
101
+ export interface ListAppMarginAccountsParams {
102
+ /** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
103
+ clientId: string;
104
+ /**
105
+ * Keep only this wallet's margin accounts in the application. A wallet with
106
+ * no margin account here returns an empty page.
107
+ */
108
+ address?: string;
109
+ /** Items per page, 1 to 1000 (default 20). Rejected if larger. */
110
+ pageSize?: number;
111
+ /**
112
+ * Pagination cursor: omit or pass `""` to start, otherwise a previous
113
+ * response's `nextPageToken`. Ordered by margin account id ascending.
114
+ * Filters must match the request that minted the token.
115
+ */
116
+ pageToken?: string;
117
+ }
98
118
  /**
99
119
  * Query parameters for listing application balances.
100
120
  */
@@ -132,13 +132,13 @@ export interface AppBalance {
132
132
  decimals: number;
133
133
  /** Balance UUID */
134
134
  id: string;
135
- /** Last sync timestamp (ISO 8601) */
135
+ /** @deprecated This timestamp is not kept up to date and must not be used. It is not a sync or health signal. */
136
136
  lastSyncAt: string | null;
137
- /** Last sync block number */
137
+ /** @deprecated This block number is not kept up to date and must not be used. It is not a sync or health signal. */
138
138
  lastSyncBlock: number | null;
139
139
  /** Locked balance */
140
140
  lockedBalance: string;
141
- /** On-chain balance */
141
+ /** @deprecated This value is not kept up to date and must not be used. It is not a sync or health signal. */
142
142
  onChainBalance: string;
143
143
  /** Token symbol */
144
144
  symbol: string | null;
@@ -225,6 +225,50 @@ export interface ListAppBalancesResponse {
225
225
  */
226
226
  totalCapped: boolean;
227
227
  }
228
+ /**
229
+ * One margin account of an application.
230
+ *
231
+ * Every figure is a persisted baseline repriced at the latest risk marks, so it
232
+ * can briefly lag the matching engine.
233
+ */
234
+ export interface AppMarginAccount {
235
+ /** Margin account UUID */
236
+ marginAccountId: string;
237
+ /** UUID of the user who owns this margin account */
238
+ userId: string;
239
+ /** Wallet address of the owning user */
240
+ address: string;
241
+ /** Sub-account key; `default` is the parent margin account */
242
+ subaccountKey: string;
243
+ /** `ACTIVE`, or `CLOSED` for a closed sub-account */
244
+ marginAccountState: string;
245
+ /** Deposited collateral in USD, before any PnL */
246
+ collateral: string;
247
+ /** Settled collateral, unrealized PnL at the latest risk marks, and realized PnL held by open risk buckets */
248
+ equity: string;
249
+ /** Collateral available for new margin. Not the withdrawal bound. */
250
+ freeCollateral: string;
251
+ /** Collateral a transfer out can take. The matching engine enforces the transfer and can accept less. */
252
+ withdrawableCollateral: string;
253
+ /** When this margin account was last persisted. Repricing at newer marks does not move it. */
254
+ updatedAt: string;
255
+ }
256
+ /**
257
+ * Paginated list of application margin accounts.
258
+ */
259
+ export interface ListAppMarginAccountsResponse {
260
+ marginAccounts: AppMarginAccount[];
261
+ /** Margin accounts matching the filter, bounded by the server count ceiling. */
262
+ total: number;
263
+ /** Items per page */
264
+ pageSize: number;
265
+ /** Pages at this `pageSize`, bounded by the same ceiling as `total`. */
266
+ totalPages: number;
267
+ /** Cursor for the next page; `""` proves the walk is exhausted. */
268
+ nextPageToken: string;
269
+ /** `true` when more than the server ceiling matched, so `total` / `totalPages` are a lower bound. */
270
+ totalCapped: boolean;
271
+ }
228
272
  /**
229
273
  * Aggregate volume and fee stats for an application.
230
274
  *
@@ -239,6 +239,8 @@ export interface ScreenerItem {
239
239
  totalQuoteVolumeLtd: string;
240
240
  /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
241
241
  totalTradeCountLtd: number;
242
+ /** The life-to-date totals split into their order-book and RFQ parts */
243
+ totalVolumeLtdBySource?: LtdVolumeBySource;
242
244
  /**
243
245
  * Latest settled funding rate as a decimal fraction per funding window (the
244
246
  * capped settled value); null for spot pairs and margin pairs with no
@@ -278,6 +280,22 @@ export interface ScreenerItem {
278
280
  * Null for spot pairs and margin pairs whose current window has no samples yet
279
281
  */
280
282
  estimatedNextFundingRate: string | null;
283
+ /**
284
+ * The 24h quote volume split into its order-book and RFQ parts; absent while
285
+ * any candle in the window has no recorded split, or when `quoteVolume24h`
286
+ * is null.
287
+ */
288
+ quoteVolume24hBySource?: ScreenerQuoteVolumeBySource | null;
289
+ }
290
+ /**
291
+ * A screener row's 24h quote volume split by execution source: the order-book
292
+ * part plus the RFQ part is `quoteVolume24h` (decimal strings).
293
+ */
294
+ export interface ScreenerQuoteVolumeBySource {
295
+ /** Quote-token volume filled on the order book in the last 24 hours */
296
+ orderBookQuoteVolume: string;
297
+ /** Quote-token volume filled by RFQ block trades in the last 24 hours */
298
+ rfqQuoteVolume: string;
281
299
  }
282
300
  /**
283
301
  * Paginated screener response, sorted by quoteVolume24h desc (nulls last)
@@ -329,12 +347,33 @@ export interface MarketMetadata {
329
347
  totalQuoteVolumeLtd: string;
330
348
  /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
331
349
  totalTradeCountLtd: number;
350
+ /** The life-to-date totals split into their order-book and RFQ parts */
351
+ totalVolumeLtdBySource?: LtdVolumeBySource;
332
352
  /**
333
353
  * The rolling 24h volumes split into their order-book and RFQ parts; absent
334
354
  * while any candle in the window has no recorded split.
335
355
  */
336
356
  volume24hBySource?: Volume24hBySource | null;
337
357
  }
358
+ /**
359
+ * Life-to-date totals split by how they executed (RFQ-17): the order-book part
360
+ * and the RFQ part, which add up exactly to the totals beside them. Base volume
361
+ * is set only for a single market (null or absent elsewhere).
362
+ */
363
+ export interface LtdVolumeBySource {
364
+ /** Life-to-date base-token volume filled on the order book (single market only) */
365
+ orderBookBaseVolume?: string | null;
366
+ /** Life-to-date base-token volume filled by RFQ block trades (single market only) */
367
+ rfqBaseVolume?: string | null;
368
+ /** Life-to-date quote-token volume filled on the order book */
369
+ orderBookQuoteVolume: string;
370
+ /** Life-to-date quote-token volume filled by RFQ block trades */
371
+ rfqQuoteVolume: string;
372
+ /** Life-to-date number of order-book trades */
373
+ orderBookTradeCount: number;
374
+ /** Life-to-date number of RFQ fills (one per maker child) */
375
+ rfqTradeCount: number;
376
+ }
338
377
  /**
339
378
  * A market's rolling 24h volume split by execution source: each total is the
340
379
  * order-book part plus the RFQ part (decimal strings).
@@ -357,6 +396,8 @@ export interface MarketStats {
357
396
  totalQuoteVolumeLtd: string;
358
397
  /** Life-to-date cumulative number of trades summed across all pairs */
359
398
  totalTradeCountLtd: number;
399
+ /** The life-to-date totals split into their order-book and RFQ parts */
400
+ totalVolumeLtdBySource?: LtdVolumeBySource;
360
401
  }
361
402
  /**
362
403
  * One notional bracket of a market's margin ladder. Brackets are MARGINAL: a
@@ -73,6 +73,8 @@ export interface PortfolioPerformance {
73
73
  netExternalFlows: string;
74
74
  pnl?: string;
75
75
  returnPct?: string;
76
+ /** Modified Dietz return: pnl over starting equity plus deposits minus withdrawals, each weighted by time in the account. Never below -100%. Defined after equity touches zero; omitted when the window has no positive-equity sample or withdrawals leave the time-weighted capital below 5% of what it would have been without them. Not bounded above: a capital just over that limit can still give a gain of up to about 20 times the return on the full base. */
77
+ modifiedDietzReturnPct?: string;
76
78
  maxDrawdown?: PortfolioPerformanceDrawdown;
77
79
  points: PortfolioPerformancePoint[];
78
80
  }
@@ -116,6 +118,7 @@ export interface PortfolioRealizedPnl {
116
118
  export interface PortfolioAssetsPerformance {
117
119
  pnl?: string;
118
120
  returnPct?: string;
121
+ modifiedDietzReturnPct?: string;
119
122
  calculationMethod: "sampled_twr";
120
123
  }
121
124
  export interface PortfolioAssetRow {
@@ -9,12 +9,30 @@
9
9
  */
10
10
  import type { BaseAPI } from "../api";
11
11
  import type { AcceptRfqParams, CancelRfqParams, CreateRfqParams, RespondRfqLastLookParams, UpsertRfqQuoteParams, WithdrawRfqQuoteParams } from "../validation/rfq";
12
- import type { GetRfqCapabilitiesResponse, ListRfqsResponse, RespondRfqLastLookResponse, RfqQuoteVersion, RfqStatus, WithdrawRfqQuoteResponse } from "./responses";
12
+ import type { GetRfqCapabilitiesResponse, ListRfqsResponse, RespondRfqLastLookResponse, RfqQuoteVersion, RfqStatus, RfqView, WithdrawRfqQuoteResponse } from "./responses";
13
13
  /** `listRfqs` paging: up to 100 per page (default 50), and the previous page's token. */
14
14
  export interface ListRfqsParams {
15
15
  pageSize?: number;
16
16
  pageToken?: string;
17
17
  }
18
+ /** Options for `waitForRfqView`. */
19
+ export interface WaitForRfqViewOptions {
20
+ /**
21
+ * How long to wait for a matching view, in milliseconds (default 10000).
22
+ * When it passes, the RFQ is read once; no match then rejects.
23
+ */
24
+ timeoutMs?: number;
25
+ /** A view you already hold (e.g. `createRfq`'s `view`), checked first. */
26
+ initialView?: RfqView | null;
27
+ /** Aborts the wait; it rejects with the signal's reason. */
28
+ signal?: AbortSignal;
29
+ }
30
+ /** The taker's view `waitForRfqView` found, and where it came from. */
31
+ export interface RfqViewMatch {
32
+ view: RfqView;
33
+ /** `push` from the `rfq` channel; `read` from a `getRfq` fallback; `initial` from `initialView`. */
34
+ source: "initial" | "push" | "read";
35
+ }
18
36
  /**
19
37
  * RFQ API.
20
38
  *
@@ -32,7 +50,9 @@ export interface RfqAPI extends BaseAPI {
32
50
  /**
33
51
  * An RFQ's authoritative status. As taker: the current `view` and, once
34
52
  * executed, the `outcome`. As maker: your latest quote, `ownLatestVersion`
35
- * and, once selected, `ownSelection` for last look.
53
+ * and, once selected, `ownSelection` for last look. To wait for quotes,
54
+ * follow the `rfq` channel's `RfqView` pushes (`waitForRfqView` in
55
+ * `@0xmonaco/core`) instead of polling this: each read rebuilds the view.
36
56
  */
37
57
  getRfq(rfqId: string): Promise<RfqStatus>;
38
58
  /**
@@ -161,11 +161,29 @@ export interface MonacoSDK {
161
161
  pageSize?: number;
162
162
  /** Cursor from a previous response's `nextPageToken`; omit to start */
163
163
  pageToken?: string;
164
+ /** The execution source to keep: RFQ block fills or order-book fills (each trade's `data.executionSource`); omit for every fill. */
165
+ executionSource?: "RFQ" | "CLOB";
164
166
  }) => Promise<{
165
167
  trades: TradeEvent[];
166
168
  /** Empty exactly when the walk is finished. */
167
169
  nextPageToken: string;
168
170
  }>;
171
+ /**
172
+ * The RFQ block prints a `rfqTrades` subscriber missed, oldest first: pages
173
+ * the pair's RFQ history newest first until `sinceExecutionId`.
174
+ * `complete` is `false` when `maxPages` ran out first.
175
+ */
176
+ recoverRfqTrades: (tradingPairId: string, options?: {
177
+ /** The newest `executionId` already seen; omit to read only the newest page. */
178
+ sinceExecutionId?: string;
179
+ /** Rows per page (default: 100, max: 1000) */
180
+ pageSize?: number;
181
+ /** Most pages to read (default: 10) */
182
+ maxPages?: number;
183
+ }) => Promise<{
184
+ trades: TradeEvent[];
185
+ complete: boolean;
186
+ }>;
169
187
  /**
170
188
  * One page of the trade feed: every market, newest first, or only the
171
189
  * trades one application took (`takerApplicationId`). Public and rate
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Public application listing validation schemas
3
3
  *
4
- * The four reporting listings are cursor paged (0XM-2822). Each schema
4
+ * The five reporting listings are cursor paged (0XM-2822). Each schema
5
5
  * REJECTS `page` rather than omitting it: forwarding the params field by
6
6
  * field drops a stray `page` before it reaches the wire, which means a
7
7
  * JavaScript or `any` caller looping on `{ page: n }` would be handed the
@@ -49,3 +49,10 @@ export declare const ListAppBalancesSchema: z.ZodObject<{
49
49
  userId: z.ZodOptional<z.ZodUUID>;
50
50
  assetId: z.ZodOptional<z.ZodUUID>;
51
51
  }, z.core.$strip>;
52
+ export declare const ListAppMarginAccountsSchema: z.ZodObject<{
53
+ clientId: z.ZodString;
54
+ page: z.ZodOptional<z.ZodNever>;
55
+ pageSize: z.ZodOptional<z.ZodNumber>;
56
+ pageToken: z.ZodOptional<z.ZodString>;
57
+ address: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Public application listing validation schemas
3
3
  *
4
- * The four reporting listings are cursor paged (0XM-2822). Each schema
4
+ * The five reporting listings are cursor paged (0XM-2822). Each schema
5
5
  * REJECTS `page` rather than omitting it: forwarding the params field by
6
6
  * field drops a stray `page` before it reaches the wire, which means a
7
7
  * JavaScript or `any` caller looping on `{ page: n }` would be handed the
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { z } from "zod";
14
14
  import { UUIDSchema } from "./trading";
15
+ import { AddressSchema } from "./vault";
15
16
  /** A client ID is required; `page` is gone; a page size is bounded; a cursor may be `""` to start. */
16
17
  const AppCursorPaginationSchema = z.object({
17
18
  /** The application's public client ID; the listings are selected by it. */
@@ -43,3 +44,6 @@ export const ListAppBalancesSchema = AppCursorPaginationSchema.extend({
43
44
  userId: UUIDSchema.optional(),
44
45
  assetId: UUIDSchema.optional(),
45
46
  });
47
+ export const ListAppMarginAccountsSchema = AppCursorPaginationSchema.extend({
48
+ address: AddressSchema.optional(),
49
+ });
@@ -246,26 +246,14 @@ export declare const ListAllFundingHistorySchema: z.ZodObject<{
246
246
  DESC: "DESC";
247
247
  }>>;
248
248
  }, z.core.$strip>;
249
- /**
250
- * Public trades-feed listing validation schema.
251
- *
252
- * Cursor paged (0XM-2821). `page` is REJECTED rather than omitted, but NOT for
253
- * the same reason as {@link ListFundingHistorySchema}. That one is built on a
254
- * query builder that serializes whatever keys the params object carries, so a
255
- * leftover `page` reaches the wire and comes back as the server's `400`.
256
- * `getTrades` instead sets `pageSize` and `pageToken` explicitly, so a stray
257
- * `page` never leaves the client at all — which makes rejecting it more
258
- * important here, not less. Stripped silently, it would leave the caller
259
- * requesting page 2, 3, 4 and receiving the FIRST cursor page every time, with
260
- * no error from either side to reveal the loop. `z.never()` turns that silent
261
- * non-advancing walk into an immediate `ValidationError`.
262
- *
263
- * The ceiling is the cursor-mode 1000; the historical default of 25 stays.
264
- */
265
249
  export declare const GetTradesSchema: z.ZodObject<{
266
250
  page: z.ZodOptional<z.ZodNever>;
267
251
  pageSize: z.ZodOptional<z.ZodNumber>;
268
252
  pageToken: z.ZodOptional<z.ZodString>;
253
+ executionSource: z.ZodOptional<z.ZodEnum<{
254
+ CLOB: "CLOB";
255
+ RFQ: "RFQ";
256
+ }>>;
269
257
  }, z.core.$strip>;
270
258
  /** Options for the every-market trade feed (`listTrades`). */
271
259
  export declare const ListTradesSchema: z.ZodObject<{
@@ -262,12 +262,16 @@ export const ListAllFundingHistorySchema = FundingHistoryCursorSchema;
262
262
  *
263
263
  * The ceiling is the cursor-mode 1000; the historical default of 25 stays.
264
264
  */
265
- export const GetTradesSchema = z.object({
265
+ const TradesPageSchema = z.object({
266
266
  page: z.never().optional(),
267
267
  pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
268
268
  pageToken: z.string().optional(),
269
269
  });
270
+ export const GetTradesSchema = TradesPageSchema.extend({
271
+ /** The execution source to keep (RFQ-15). */
272
+ executionSource: z.enum(["RFQ", "CLOB"]).optional(),
273
+ });
270
274
  /** Options for the every-market trade feed (`listTrades`). */
271
- export const ListTradesSchema = GetTradesSchema.extend({
275
+ export const ListTradesSchema = TradesPageSchema.extend({
272
276
  takerApplicationId: UUIDSchema.optional(),
273
277
  });
@@ -369,8 +369,7 @@ export const ReplaceOrderSchema = z.object({
369
369
  quantity: PositiveDecimalStringSchema.optional(),
370
370
  useMasterBalance: z.boolean().optional(),
371
371
  // No MARKET/IOC-FOK refine here: order type and time-in-force are not
372
- // replaceable fields — the server validates postOnly against the
373
- // persisted original order, which this client-side schema cannot see.
372
+ // replaceable fields, and only a live resting order can be replaced.
374
373
  postOnly: z.boolean().optional(),
375
374
  // Re-stated per replace, never inherited from the original order.
376
375
  selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
@@ -703,8 +702,7 @@ export const BatchReplaceOrderItemSchema = z
703
702
  quantity: PositiveDecimalStringSchema.optional(),
704
703
  useMasterBalance: z.boolean().optional(),
705
704
  // No MARKET/IOC-FOK refine here: order type and time-in-force are not
706
- // replaceable fields — the server validates postOnly against the
707
- // persisted original order, which this client-side schema cannot see.
705
+ // replaceable fields, and only a live resting order can be replaced.
708
706
  postOnly: z.boolean().optional(),
709
707
  // Re-stated per replace, never inherited from the original order.
710
708
  selfTradePreventionMode: SelfTradePreventionModeSchema.optional(),
@@ -60,7 +60,7 @@ import type { TradingMode } from "../trading";
60
60
  import type { SubscriptionChangeHandler, WebSocketStatus, WebSocketSubscriptionState } from "./base";
61
61
  import type { OrderbookQuotationMode } from "./clients/orderbook-client";
62
62
  import type { Bbo, DepthBook, LocalBookOptions } from "./depth";
63
- import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketLiquidationEvent, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, RfqEvent, RfqTradeEvent, TradeEvent, TradeEventData, TradeGap, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
63
+ import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketLiquidationEvent, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, RfqEvent, RfqTradeEvent, RfqTradeEventData, TradeEvent, TradeEventData, TradeGap, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
64
64
  import type { OHLCVSnapshotCandle, OrderSnapshotItem, SnapshotHandler } from "./snapshots";
65
65
  /** Options for `ws.trades`. */
66
66
  export interface TradesOptions {
@@ -200,9 +200,12 @@ export interface MonacoWebSocket {
200
200
  rfq: (handler: MessageHandler<RfqEvent>) => () => void;
201
201
  /**
202
202
  * Subscribe to the public, anonymised RFQ block prints for one pair. RFQ
203
- * fills never print on `trades`. There is no snapshot: deduplicate on
204
- * `data.executionId`, and backfill from the REST trade reads, which include
205
- * RFQ fills with `executionSource: "RFQ"`.
203
+ * fills never print on `trades`. Prints are best-effort: deduplicate on
204
+ * `data.executionId`, and recover any you missed with
205
+ * `trades.recoverRfqTrades`, which pages the pair's RFQ history
206
+ * (`getTrades` with `executionSource: "RFQ"`). `onSnapshot`, if given,
207
+ * receives the pair's newest RFQ prints from that history at subscribe
208
+ * time; a snapshot row's `publishedAt` is its `executedAt`.
206
209
  */
207
- rfqTrades: (tradingPairId: string, handler: MessageHandler<RfqTradeEvent>) => () => void;
210
+ rfqTrades: (tradingPairId: string, handler: MessageHandler<RfqTradeEvent>, onSnapshot?: SnapshotHandler<RfqTradeEventData>) => () => void;
208
211
  }
@@ -181,6 +181,12 @@ export interface MarketStatsSummary {
181
181
  * and omitted (never zero) until both open interest and a price are known.
182
182
  */
183
183
  openInterestNotional?: string;
184
+ /**
185
+ * The 24h volumes split into their order-book and RFQ parts, as on the
186
+ * per-market frame. Omitted while any candle in the window has no recorded
187
+ * split.
188
+ */
189
+ dailyVolumeBySource?: DailyVolumeBySource;
184
190
  }
185
191
  /**
186
192
  * All-markets summary event on the `market_stats` channel: one
@@ -10,6 +10,6 @@
10
10
  * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
- export declare const OPERATION_IDS: readonly ["accept_rfq", "add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_all_after", "cancel_conditional_order", "cancel_order", "cancel_rfq", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_rfq", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_builder", "get_builder_series", "get_builder_totals", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_fee_schedule", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_liquidation_metrics", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_protocol_series", "get_protocol_totals", "get_pulse", "get_region_status", "get_rewards_balance", "get_rfq", "get_rfq_capabilities", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_sweeper_deposit_status", "get_token_custody", "get_trade_by_id", "get_trade_flow", "get_trader_code_info", "get_trader_metrics", "get_trades", "get_trading_pair_by_id", "get_treasury_net_fees", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_wallet_summary", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_all_liquidation_events", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_builder_fee_changes", "list_builder_leaderboard", "list_buildercode_payouts", "list_builders", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_insurance_funds", "list_invite_codes", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_liquidation_events", "list_managed_market_assignments", "list_margin_accounts", "list_market_volumes", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_rfqs", "list_sub_accounts_with_balances", "list_sweeper_deposits", "list_token_custody", "list_trades", "list_trading_pairs", "list_twap_order_slices", "list_twap_orders", "list_vault_deposits", "list_vault_withdrawals", "list_wallet_leaderboard", "list_wallet_liquidations", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "request_invite_codes", "respond_rfq_last_look", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "upsert_rfq_quote", "verify_signature", "withdraw_rfq_quote"];
13
+ export declare const OPERATION_IDS: readonly ["accept_rfq", "add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_all_after", "cancel_conditional_order", "cancel_order", "cancel_rfq", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_rfq", "create_sub_account", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_builder", "get_builder_series", "get_builder_totals", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_fee_schedule", "get_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_liquidation_metrics", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_protocol_series", "get_protocol_totals", "get_pulse", "get_region_status", "get_rewards_balance", "get_rfq", "get_rfq_capabilities", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_sweeper_deposit_status", "get_token_custody", "get_trade_by_id", "get_trade_flow", "get_trader_code_info", "get_trader_metrics", "get_trades", "get_trading_pair_by_id", "get_treasury_net_fees", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_wallet_summary", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_all_liquidation_events", "list_application_balances", "list_application_margin_accounts", "list_application_movements", "list_application_orders", "list_application_users", "list_builder_fee_changes", "list_builder_leaderboard", "list_buildercode_payouts", "list_builders", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_insurance_funds", "list_invite_codes", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_liquidation_events", "list_managed_market_assignments", "list_margin_accounts", "list_market_volumes", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_rfqs", "list_sub_accounts_with_balances", "list_sweeper_deposits", "list_token_custody", "list_trades", "list_trading_pairs", "list_twap_order_slices", "list_twap_orders", "list_vault_deposits", "list_vault_withdrawals", "list_wallet_leaderboard", "list_wallet_liquidations", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "request_invite_codes", "respond_rfq_last_look", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "transfer_collateral", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "upsert_follow", "upsert_lead_trader", "upsert_rfq_quote", "verify_signature", "withdraw_rfq_quote"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -123,6 +123,7 @@ export const OPERATION_IDS = [
123
123
  "list_all_funding_history",
124
124
  "list_all_liquidation_events",
125
125
  "list_application_balances",
126
+ "list_application_margin_accounts",
126
127
  "list_application_movements",
127
128
  "list_application_orders",
128
129
  "list_application_users",
@@ -768,7 +768,10 @@ export interface paths {
768
768
  * List application balances
769
769
  * @description List application balances.
770
770
  *
771
- * Returns a paginated list of the balances of the application's users.
771
+ * Returns a paginated list of the wallet balances of the application's users.
772
+ * Funds held in a margin account are not included, so a user funded through
773
+ * margin can show zero here. Read those users from
774
+ * `GET /api/v1/applications/margin-accounts`.
772
775
  * Public: the application is selected by `client_id`.
773
776
  */
774
777
  get: operations["list_application_balances"];
@@ -803,6 +806,38 @@ export interface paths {
803
806
  patch?: never;
804
807
  trace?: never;
805
808
  };
809
+ "/api/v1/applications/margin-accounts": {
810
+ parameters: {
811
+ query?: never;
812
+ header?: never;
813
+ path?: never;
814
+ cookie?: never;
815
+ };
816
+ /**
817
+ * List application margin accounts
818
+ * @description List application margin accounts.
819
+ *
820
+ * Returns a paginated list of the application's margin accounts, one row per
821
+ * margin account with sub-accounts listed beside their parent. An
822
+ * application that funds its users through margin reads their collateral
823
+ * here: margin collateral is not a wallet balance, so `ListAppBalances` does
824
+ * not show it.
825
+ *
826
+ * Figures are a persisted baseline repriced at the latest risk marks. They
827
+ * can briefly lag the matching engine, which this read never calls.
828
+ * Copy-trading accounts are not listed, so the rows need not add up to all
829
+ * of a wallet's margin collateral.
830
+ * Public: the application is selected by `client_id`.
831
+ */
832
+ get: operations["list_application_margin_accounts"];
833
+ put?: never;
834
+ post?: never;
835
+ delete?: never;
836
+ options?: never;
837
+ head?: never;
838
+ patch?: never;
839
+ trace?: never;
840
+ };
806
841
  "/api/v1/applications/movements": {
807
842
  parameters: {
808
843
  query?: never;
@@ -3066,6 +3101,14 @@ export interface paths {
3066
3101
  * consume, nor an original that fails to cancel, and the same original
3067
3102
  * listed twice is judged per occurrence — so confirm against open orders
3068
3103
  * rather than relying on the code alone.
3104
+ *
3105
+ * A replacement the pair's size rules refuse (below the minimum, above the
3106
+ * maximum, off the quantity step, or a total that does not exceed what
3107
+ * already filled) is also refused before the cancel, so its original keeps
3108
+ * its price and queue spot. It is not a guarantee either: the kept order's
3109
+ * funds are not freed for the other items, one of which may then fail after
3110
+ * its own cancel, and another item's replacement may cross and sweep it
3111
+ * under self-trade prevention.
3069
3112
  */
3070
3113
  post: operations["batch_replace_orders"];
3071
3114
  delete?: never;
@@ -4357,7 +4400,7 @@ export interface components {
4357
4400
  * @description Distinct taker seller user IDs in executed trade records in this window, including system IDs on liquidation and ADL fills; all counts are null when this window is suppressed
4358
4401
  */
4359
4402
  takerSellerCount?: number | null;
4360
- /** @description True when any user count in this window is below five; all counts in the window are then null */
4403
+ /** @description True when any user count in this window is below five, or while the activity history does not yet reach back to the window's start (briefly, after the activity aggregate is first built); all counts in the window are then null */
4361
4404
  suppressed?: boolean | null;
4362
4405
  };
4363
4406
  AddFollowPositionMarginRequest: {
@@ -4488,13 +4531,22 @@ export interface components {
4488
4531
  * @description Balance UUID
4489
4532
  */
4490
4533
  id?: string | null;
4491
- /** @description Last sync timestamp (ISO 8601) */
4534
+ /**
4535
+ * @deprecated
4536
+ * @description Deprecated: this timestamp is not kept up to date and must not be used. It is not a sync or health signal.
4537
+ */
4492
4538
  lastSyncAt?: string | null;
4493
- /** @description Last sync block number */
4539
+ /**
4540
+ * @deprecated
4541
+ * @description Deprecated: this block number is not kept up to date and must not be used. It is not a sync or health signal.
4542
+ */
4494
4543
  lastSyncBlock?: string | null;
4495
4544
  /** @description Locked balance */
4496
4545
  lockedBalance?: string | null;
4497
- /** @description On-chain balance */
4546
+ /**
4547
+ * @deprecated
4548
+ * @description Deprecated: this value is not kept up to date and must not be used. It is not a sync or health signal.
4549
+ */
4498
4550
  onChainBalance?: string | null;
4499
4551
  /** @description Token symbol */
4500
4552
  symbol?: string | null;
@@ -4510,6 +4562,66 @@ export interface components {
4510
4562
  */
4511
4563
  userId?: string | null;
4512
4564
  };
4565
+ /**
4566
+ * @description One margin account of an application.
4567
+ *
4568
+ * A public row, so it is deliberately smaller than `MarginAccountSummary`: it
4569
+ * carries no free-text label, no risk bucket or position data, and no margin
4570
+ * requirement. Risk buckets are not rows: their allocated collateral and held
4571
+ * realized PnL are already inside the account's figures.
4572
+ *
4573
+ * Every figure is a persisted baseline repriced at the latest risk marks, so
4574
+ * it can briefly lag the matching engine.
4575
+ */
4576
+ ApplicationMarginAccount: {
4577
+ /**
4578
+ * Format: uuid
4579
+ * @description Margin account UUID
4580
+ */
4581
+ marginAccountId?: string | null;
4582
+ /**
4583
+ * Format: uuid
4584
+ * @description UUID of the user who owns this margin account
4585
+ */
4586
+ userId?: string | null;
4587
+ /** @description Wallet address of the owning user */
4588
+ address?: string | null;
4589
+ /**
4590
+ * @description Sub-account key; default is the parent margin account
4591
+ * @example default
4592
+ */
4593
+ subaccountKey?: string | null;
4594
+ /**
4595
+ * @description Margin account state: ACTIVE or CLOSED (a closed sub-account)
4596
+ * @example ACTIVE
4597
+ */
4598
+ marginAccountState?: string | null;
4599
+ /**
4600
+ * @description Deposited collateral in USD, before any PnL. A persisted baseline: it can briefly lag the matching engine.
4601
+ * @example 1000
4602
+ */
4603
+ collateral?: string | null;
4604
+ /**
4605
+ * @description Account equity in USD: settled collateral, unrealized PnL at the latest risk marks, and realized PnL held by open risk buckets. A persisted baseline repriced at the latest risk marks: it can briefly lag the matching engine.
4606
+ * @example 1012.5
4607
+ */
4608
+ equity?: string | null;
4609
+ /**
4610
+ * @description Collateral available for new margin, in USD. Not the withdrawal bound. A persisted baseline: it can briefly lag the matching engine.
4611
+ * @example 800
4612
+ */
4613
+ freeCollateral?: string | null;
4614
+ /**
4615
+ * @description Collateral a transfer out of this margin account can take, in USD. A persisted baseline: the matching engine enforces the transfer and can accept less.
4616
+ * @example 750
4617
+ */
4618
+ withdrawableCollateral?: string | null;
4619
+ /**
4620
+ * Format: date-time
4621
+ * @description When this margin account was last persisted (RFC 3339). Repricing at newer marks does not move it.
4622
+ */
4623
+ updatedAt?: string | null;
4624
+ };
4513
4625
  ApplicationMovement: {
4514
4626
  /** @description Transaction amount */
4515
4627
  amount?: string | null;
@@ -5012,7 +5124,7 @@ export interface components {
5012
5124
  */
5013
5125
  postOnly?: boolean | null;
5014
5126
  /**
5015
- * @description Client-assigned correlation handle, echoed back on order reads (detail and list) and on order WebSocket events. At most 64 characters from [A-Za-z0-9._:-]; surrounding whitespace is trimmed before storage, and a blank or whitespace-only value is treated as absent. Uniqueness is enforced only among your orders that are RESTING on the book: an item reusing a value another of your resting orders still holds fails that item alone — the batch itself returns 2xx / OK and the offending item's result slot carries error.code CLIENT_ORDER_ID_CONFLICT; no transport-level 409 / ALREADY_EXISTS is raised. An order that never rests — MARKET, IOC/FOK, or a LIMIT that fills completely on arrival — does not take the handle, and the value is released the moment any order reaches a terminal state. It is therefore NOT an idempotency key, though on this replace path a retry cannot double-execute: the request names the original order id, and the sequencer revalidates that original in memory and on the book at sequence time, so once the first replacement succeeds the original is gone and a retry is rejected with ORDER_NOT_FOUND rather than placing a second order. That code is itself ambiguous — the original may instead have filled or been cancelled — so the risk here is acting on a stale view, not duplicate execution. Reconcile a lost response against the order WebSocket stream, which carries this value on the submit acknowledgement and on fills, including for orders that never rest; order history is replica-backed and can omit an order that did land. The stream is not replayable and has no sequence number to backfill from, and events are not persisted for redelivery, so one can be missed while your connection still looks healthy. A matching event is therefore positive proof the order was accepted, but silence is NEVER evidence it was not, and no client-observable condition makes it so. Absent positive evidence the outcome is unresolved: hold and escalate rather than resubmitting. A replace item carries no order type or time-in-force and its original must still be RESTING, so the IOC/FOK and MARKET post-acceptance rejection shapes are unreachable here. Failures split by WHEN they occur, and the difference decides whether your original survives. Before sequencing: every validation failure — a malformed value included — fails ITS ITEM alone with a structured error.code (INVALID_CLIENT_ORDER_ID for a malformed handle, the same code batch-create uses) and no mutation and no event, batch-create parity; the whole request 400s only for an empty or oversize batch. (Earlier releases rejected the whole batch for a malformed value here.) A pre-cancel gate then drops two more classes before anything is cancelled — a handle conflict, and a post-only replacement that would cross the book as it will stand once this batch's originals are cancelled — so in the ordinary POST_ONLY_WOULD_CROSS case the item fails with its original still RESTING and untouched. After that the endpoint is CANCEL-FIRST: the original is cancelled in pass 1, so a residual placement failure then — a self-trade rejection, or a crossing that only became apparent in pass 2 — leaves the original CANCELLED and emits its cancellation events (terminal reason 'replaced') while the item reports the placement error and no replacement is placed. Never assume a failed item left your original resting; read results[] and the stream. Single ReplaceOrder differs: it is atomic, and a rejected replacement leaves the original untouched. Where no surface is conclusive, do not resubmit. A replacement is a new order with a new id, so it carries its own value and inherits nothing from the original — restate it to keep the handle.
5127
+ * @description Client-assigned correlation handle, echoed back on order reads (detail and list) and on order WebSocket events. At most 64 characters from [A-Za-z0-9._:-]; surrounding whitespace is trimmed before storage, and a blank or whitespace-only value is treated as absent. Uniqueness is enforced only among your orders that are RESTING on the book: an item reusing a value another of your resting orders still holds fails that item alone — the batch itself returns 2xx / OK and the offending item's result slot carries error.code CLIENT_ORDER_ID_CONFLICT; no transport-level 409 / ALREADY_EXISTS is raised. An order that never rests — MARKET, IOC/FOK, or a LIMIT that fills completely on arrival — does not take the handle, and the value is released the moment any order reaches a terminal state. It is therefore NOT an idempotency key, though on this replace path a retry cannot double-execute: the request names the original order id, and the sequencer revalidates that original in memory and on the book at sequence time, so once the first replacement succeeds the original is gone and a retry is rejected with ORDER_NOT_FOUND rather than placing a second order. That code is itself ambiguous — the original may instead have filled or been cancelled — so the risk here is acting on a stale view, not duplicate execution. Reconcile a lost response against the order WebSocket stream, which carries this value on the submit acknowledgement and on fills, including for orders that never rest; order history is replica-backed and can omit an order that did land. The stream is not replayable and has no sequence number to backfill from, and events are not persisted for redelivery, so one can be missed while your connection still looks healthy. A matching event is therefore positive proof the order was accepted, but silence is NEVER evidence it was not, and no client-observable condition makes it so. Absent positive evidence the outcome is unresolved: hold and escalate rather than resubmitting. A replace item carries no order type or time-in-force and its original must still be RESTING, so the IOC/FOK and MARKET post-acceptance rejection shapes are unreachable here. Failures split by WHEN they occur, and the difference decides whether your original survives. Before sequencing: every validation failure — a malformed value included — fails ITS ITEM alone with a structured error.code (INVALID_CLIENT_ORDER_ID for a malformed handle, the same code batch-create uses) and no mutation and no event, batch-create parity; the whole request 400s only for an empty or oversize batch. (Earlier releases rejected the whole batch for a malformed value here.) A pre-cancel gate then drops three more classes before anything is cancelled — a replacement the pair's size rules refuse, a handle conflict, and a post-only replacement that would cross the book as it will stand once this batch's originals are cancelled — so in the ordinary POST_ONLY_WOULD_CROSS case the item fails with its original still RESTING and untouched. After that the endpoint is CANCEL-FIRST: the original is cancelled in pass 1, so a residual placement failure then — a self-trade rejection, or a crossing that only became apparent in pass 2 — leaves the original CANCELLED and emits its cancellation events (terminal reason 'replaced') while the item reports the placement error and no replacement is placed. Never assume a failed item left your original resting; read results[] and the stream. Single ReplaceOrder differs: it is atomic, and a rejected replacement leaves the original untouched. Where no surface is conclusive, do not resubmit. A replacement is a new order with a new id, so it carries its own value and inherits nothing from the original — restate it to keep the handle.
5016
5128
  * @example quote-btc-1130-a
5017
5129
  */
5018
5130
  clientOrderId?: string | null;
@@ -7371,6 +7483,7 @@ export interface components {
7371
7483
  * @example 117845632.18
7372
7484
  */
7373
7485
  quoteVolume24h?: string | null;
7486
+ totalVolumeLtdBySource?: components["schemas"]["LtdVolumeBySource"];
7374
7487
  volume24hBySource?: components["schemas"]["Volume24hBySource"];
7375
7488
  };
7376
7489
  /** @description Exchange-wide life-to-date cumulative market statistics across all trading pairs. */
@@ -7386,6 +7499,7 @@ export interface components {
7386
7499
  * @example 19284736
7387
7500
  */
7388
7501
  totalTradeCountLtd?: number | null;
7502
+ totalVolumeLtdBySource?: components["schemas"]["LtdVolumeBySource"];
7389
7503
  };
7390
7504
  GetMovementsResponse: {
7391
7505
  movements?: components["schemas"]["LedgerMovement"][] | null;
@@ -7996,6 +8110,8 @@ export interface components {
7996
8110
  returnPct?: string | null;
7997
8111
  maxDrawdown?: components["schemas"]["PortfolioPerformanceDrawdown"];
7998
8112
  points?: components["schemas"]["PortfolioPerformancePoint"][] | null;
8113
+ /** @description Modified Dietz return over the window: pnl divided by the starting equity plus each deposit minus each withdrawal, each weighted by the share of the window it was in the account (a flow is taken at the middle of its sample interval). Never below -100%, since an account cannot lose more than it received. Unlike return_pct it stays defined after equity touches zero. Null when the window has no positive-equity sample, or when withdrawals leave that time-weighted capital below 5% of what it would have been without them (the starting equity plus the time-weighted deposits), so the gain on a sliver of capital is not reported. Not bounded above: a capital just over that limit can still give a gain of up to about 20 times the return on the full base. max_drawdown and calculation_method describe the time-weighted return_pct series only and can cover less of the window than this figure. */
8114
+ modifiedDietzReturnPct?: string | null;
7999
8115
  };
8000
8116
  GetPortfolioRealizedPnlResponse: {
8001
8117
  window?: components["schemas"]["PortfolioSeriesWindow"];
@@ -8609,7 +8725,7 @@ export interface components {
8609
8725
  */
8610
8726
  code?: string | null;
8611
8727
  };
8612
- /** @description Current public long/short account positioning and active trader aggregates. Accounts are classified by net position across OPEN risk buckets. Account identifiers are never returned; position metrics are null when either side has fewer than five accounts. Responses may be reused from a per-pair cache for up to 30 seconds. */
8728
+ /** @description Current public long/short account positioning and active trader aggregates. Accounts are classified by net position across OPEN risk buckets. Account identifiers are never returned; position metrics are null when either side has fewer than five accounts, and an active-trader window's counts are null while it is suppressed. Responses may be reused from a per-pair cache for up to 30 seconds. */
8613
8729
  GetTraderMetricsResponse: {
8614
8730
  /**
8615
8731
  * Format: uuid
@@ -9335,6 +9451,38 @@ export interface components {
9335
9451
  */
9336
9452
  totalCapped?: boolean | null;
9337
9453
  };
9454
+ ListAppMarginAccountsResponse: {
9455
+ marginAccounts?: components["schemas"]["ApplicationMarginAccount"][] | null;
9456
+ /**
9457
+ * Format: uint32
9458
+ * @description Number of margin accounts matching the filter, bounded by the server ceiling — a lower bound when totalCapped is true.
9459
+ * @example 50
9460
+ */
9461
+ total?: number | null;
9462
+ /**
9463
+ * Format: uint32
9464
+ * @description Items per page
9465
+ * @example 20
9466
+ */
9467
+ pageSize?: number | null;
9468
+ /**
9469
+ * Format: uint32
9470
+ * @description Number of pages at this pageSize, bounded by the server ceiling — a lower bound when totalCapped is true.
9471
+ * @example 3
9472
+ */
9473
+ totalPages?: number | null;
9474
+ /**
9475
+ * @description Cursor for the next page, minted from the last row of an over-fetched
9476
+ * page: this listing is one ordered read, so a page shorter than
9477
+ * `pageSize` proves the walk is exhausted and this is empty.
9478
+ */
9479
+ nextPageToken?: string | null;
9480
+ /**
9481
+ * @description True when more than the server ceiling of margin accounts matched, so the count stopped at the ceiling and total/totalPages are a lower bound.
9482
+ * @example false
9483
+ */
9484
+ totalCapped?: boolean | null;
9485
+ };
9338
9486
  ListAppMovementsResponse: {
9339
9487
  movements?: components["schemas"]["ApplicationMovement"][] | null;
9340
9488
  /**
@@ -9909,6 +10057,45 @@ export interface components {
9909
10057
  /** @description Opaque cursor for the next page; empty when the page is the end of the ordered result */
9910
10058
  nextPageToken?: string | null;
9911
10059
  };
10060
+ /**
10061
+ * @description Life-to-date totals split by how they executed (RFQ-17): the order-book part
10062
+ * and the RFQ part, which add up exactly to the totals beside them. Base volume
10063
+ * is present only where the totals carry it (a single market).
10064
+ */
10065
+ LtdVolumeBySource: {
10066
+ /**
10067
+ * @description Life-to-date base-token volume filled on the order book
10068
+ * @example 123000.00000000
10069
+ */
10070
+ orderBookBaseVolume?: string | null;
10071
+ /**
10072
+ * @description Life-to-date base-token volume filled by RFQ block trades
10073
+ * @example 456.78900000
10074
+ */
10075
+ rfqBaseVolume?: string | null;
10076
+ /**
10077
+ * @description Life-to-date quote-token volume filled on the order book
10078
+ * @example 9100000000.00
10079
+ */
10080
+ orderBookQuoteVolume?: string | null;
10081
+ /**
10082
+ * @description Life-to-date quote-token volume filled by RFQ block trades
10083
+ * @example 23456789.50
10084
+ */
10085
+ rfqQuoteVolume?: string | null;
10086
+ /**
10087
+ * Format: int64
10088
+ * @description Life-to-date number of order-book trades
10089
+ * @example 482900
10090
+ */
10091
+ orderBookTradeCount?: number | null;
10092
+ /**
10093
+ * Format: int64
10094
+ * @description Life-to-date number of RFQ fills (one per maker child)
10095
+ * @example 31
10096
+ */
10097
+ rfqTradeCount?: number | null;
10098
+ };
9912
10099
  ManagedMarketAssignment: {
9913
10100
  launchId?: string | null;
9914
10101
  /** Format: uuid */
@@ -10417,6 +10604,8 @@ export interface components {
10417
10604
  returnPct?: string | null;
10418
10605
  /** @enum {string|null} */
10419
10606
  calculationMethod?: "sampled_twr" | null;
10607
+ /** @description Modified Dietz return over the window, defined after spot equity touches zero; see GetPortfolioPerformanceResponse.modified_dietz_return_pct */
10608
+ modifiedDietzReturnPct?: string | null;
10420
10609
  };
10421
10610
  PortfolioBestDay: {
10422
10611
  /**
@@ -12050,6 +12239,25 @@ export interface components {
12050
12239
  * @example 0.00012
12051
12240
  */
12052
12241
  estimatedNextFundingRate?: string | null;
12242
+ quoteVolume24hBySource?: components["schemas"]["ScreenerQuoteVolumeBySource"];
12243
+ totalVolumeLtdBySource?: components["schemas"]["LtdVolumeBySource"];
12244
+ };
12245
+ /**
12246
+ * @description A screener row's 24h quote volume split by execution source (RFQ-17). The
12247
+ * order-book part is the displayed total minus the displayed RFQ part, so the
12248
+ * two always add up to quoteVolume24h.
12249
+ */
12250
+ ScreenerQuoteVolumeBySource: {
12251
+ /**
12252
+ * @description Quote-token volume filled on the order book in the last 24 hours
12253
+ * @example 115265632.18
12254
+ */
12255
+ orderBookQuoteVolume?: string | null;
12256
+ /**
12257
+ * @description Quote-token volume filled by RFQ block trades in the last 24 hours
12258
+ * @example 2580000.00
12259
+ */
12260
+ rfqQuoteVolume?: string | null;
12053
12261
  };
12054
12262
  /** @description One UTC-day bucket in a pair's 7-day snapshot. */
12055
12263
  ScreenerSnapshotPoint: {
@@ -16299,6 +16507,74 @@ export interface operations {
16299
16507
  };
16300
16508
  };
16301
16509
  };
16510
+ list_application_margin_accounts: {
16511
+ parameters: {
16512
+ query: {
16513
+ /** @description Application client ID */
16514
+ clientId: string;
16515
+ /** @description Filter by wallet address. A wallet with no margin account in the application returns an empty page. */
16516
+ address?: string;
16517
+ /** @description Items per page (max 1000) */
16518
+ pageSize?: number;
16519
+ /**
16520
+ * @description Pagination cursor with two states:
16521
+ * - Omitted or empty string (""): start a cursor walk with no prior
16522
+ * position.
16523
+ * - Non-empty: an opaque cursor from a previous response's
16524
+ * `nextPageToken`; results resume immediately after that position.
16525
+ *
16526
+ * Ordered by margin account id ascending.
16527
+ *
16528
+ * Filters must match the request that produced the token, or the request
16529
+ * is rejected 400.
16530
+ */
16531
+ pageToken?: string;
16532
+ };
16533
+ header?: never;
16534
+ path?: never;
16535
+ cookie?: never;
16536
+ };
16537
+ requestBody?: never;
16538
+ responses: {
16539
+ /** @description OK */
16540
+ 200: {
16541
+ headers: {
16542
+ [name: string]: unknown;
16543
+ };
16544
+ content: {
16545
+ "application/json": components["schemas"]["ListAppMarginAccountsResponse"];
16546
+ };
16547
+ };
16548
+ /** @description Bad request (missing client_id, invalid address, page size or page token) */
16549
+ 400: {
16550
+ headers: {
16551
+ [name: string]: unknown;
16552
+ };
16553
+ content?: never;
16554
+ };
16555
+ /** @description No active, displayed application has this client_id (unknown, inactive and hidden builders read alike) */
16556
+ 404: {
16557
+ headers: {
16558
+ [name: string]: unknown;
16559
+ };
16560
+ content?: never;
16561
+ };
16562
+ /** @description Public read rate limit exceeded for this client IP; retry after the interval in details.retryAfter */
16563
+ 429: {
16564
+ headers: {
16565
+ [name: string]: unknown;
16566
+ };
16567
+ content?: never;
16568
+ };
16569
+ /** @description Internal server error */
16570
+ 500: {
16571
+ headers: {
16572
+ [name: string]: unknown;
16573
+ };
16574
+ content?: never;
16575
+ };
16576
+ };
16577
+ };
16302
16578
  list_application_movements: {
16303
16579
  parameters: {
16304
16580
  query: {
@@ -16451,6 +16727,13 @@ export interface operations {
16451
16727
  };
16452
16728
  content?: never;
16453
16729
  };
16730
+ /** @description The read did not finish within its 3 s budget; narrow the filters or retry later */
16731
+ 503: {
16732
+ headers: {
16733
+ [name: string]: unknown;
16734
+ };
16735
+ content?: never;
16736
+ };
16454
16737
  };
16455
16738
  };
16456
16739
  get_application_stats: {
@@ -16503,6 +16786,13 @@ export interface operations {
16503
16786
  };
16504
16787
  content?: never;
16505
16788
  };
16789
+ /** @description The read did not finish within its 3 s budget; narrow the filters or retry later */
16790
+ 503: {
16791
+ headers: {
16792
+ [name: string]: unknown;
16793
+ };
16794
+ content?: never;
16795
+ };
16506
16796
  };
16507
16797
  };
16508
16798
  list_application_users: {
@@ -23516,6 +23806,8 @@ export interface operations {
23516
23806
  * pair is rejected rather than seeking into another pair's history.
23517
23807
  */
23518
23808
  pageToken?: string;
23809
+ /** @description The execution source to keep: RFQ (RFQ block fills) or CLOB (order-book fills), the values of each trade's executionSource. Omit for every fill. RFQ covers recent fills (the hot trade store); older RFQ fills stay on the unfiltered pages */
23810
+ executionSource?: "RFQ" | "CLOB";
23519
23811
  };
23520
23812
  header?: never;
23521
23813
  path: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "type": "module",
5
5
  "homepage": "https://docs.0xmonaco.com/sdk/typescript",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "lint": "biome lint ."
17
17
  },
18
18
  "dependencies": {
19
- "@0xmonaco/contracts": "1.1.9",
19
+ "@0xmonaco/contracts": "1.1.10",
20
20
  "zod": "^4.6.7"
21
21
  },
22
22
  "peerDependencies": {