@0xmonaco/types 1.0.59 → 1.0.61
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/managed-markets/index.d.ts +63 -0
- package/dist/managed-markets/index.js +0 -0
- package/dist/margin-accounts/index.d.ts +92 -2
- package/dist/market/index.d.ts +64 -0
- package/dist/sdk/index.d.ts +2 -0
- package/dist/trading/index.d.ts +5 -2
- package/dist/trading/orders.d.ts +13 -0
- package/dist/trading/responses.d.ts +52 -1
- package/dist/validation/margin-accounts.d.ts +13 -3
- package/dist/validation/margin-accounts.js +62 -20
- package/dist/validation/trading.d.ts +7 -0
- package/dist/validation/trading.js +11 -0
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +3 -0
- package/dist/wire/schema.d.ts +417 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { BaseAPI } from "../api";
|
|
2
|
+
/** Exact uint64 decimal text. Never convert generation or revision through Number. */
|
|
3
|
+
export type ManagedMarketFence = string;
|
|
4
|
+
export type ManagedMarketPhase = "pending" | "validating" | "registering" | "warming" | "activating" | "live" | "failed" | (string & {});
|
|
5
|
+
export interface ManagedMarketLease {
|
|
6
|
+
launchId: string;
|
|
7
|
+
ownerId: string;
|
|
8
|
+
generation: ManagedMarketFence;
|
|
9
|
+
quoteRevision: ManagedMarketFence;
|
|
10
|
+
expiresAt: string;
|
|
11
|
+
refreshIntervalMs: number;
|
|
12
|
+
phase: ManagedMarketPhase;
|
|
13
|
+
}
|
|
14
|
+
export interface ManagedMarketAssignment {
|
|
15
|
+
launchId: string;
|
|
16
|
+
tradingPairId: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
phase: ManagedMarketPhase;
|
|
19
|
+
refreshIntervalMs: number;
|
|
20
|
+
allocationUsdc: string;
|
|
21
|
+
lease?: ManagedMarketLease;
|
|
22
|
+
/** False assignments remain expected inventory but cannot claim or quote. */
|
|
23
|
+
quoteEnabled: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ListManagedMarketAssignmentsRequest {
|
|
26
|
+
page?: number;
|
|
27
|
+
pageSize?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ListManagedMarketAssignmentsResponse {
|
|
30
|
+
items: ManagedMarketAssignment[];
|
|
31
|
+
total: number;
|
|
32
|
+
page: number;
|
|
33
|
+
pageSize: number;
|
|
34
|
+
inventoryObservedAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ClaimManagedMarketLeaseRequest {
|
|
37
|
+
ownerId: string;
|
|
38
|
+
/** Required for renewal; omit for initial claim or after expiry. */
|
|
39
|
+
expectedGeneration?: ManagedMarketFence;
|
|
40
|
+
}
|
|
41
|
+
export interface RefreshManagedMarketQuotesRequest {
|
|
42
|
+
ownerId: string;
|
|
43
|
+
generation: ManagedMarketFence;
|
|
44
|
+
quoteRevision: ManagedMarketFence;
|
|
45
|
+
}
|
|
46
|
+
export interface ManagedMarketQuoteStatus {
|
|
47
|
+
launchId: string;
|
|
48
|
+
generation: ManagedMarketFence;
|
|
49
|
+
quoteRevision: ManagedMarketFence;
|
|
50
|
+
phase: ManagedMarketPhase;
|
|
51
|
+
bidNotional: string;
|
|
52
|
+
askNotional: string;
|
|
53
|
+
oracleReady: boolean;
|
|
54
|
+
readyToActivate: boolean;
|
|
55
|
+
observedAt: string;
|
|
56
|
+
}
|
|
57
|
+
/** Wallet session identity selects assignments; delegated sessions are unsupported. ownerId only fences processes. */
|
|
58
|
+
export interface ManagedMarketsAPI extends BaseAPI {
|
|
59
|
+
listAssignments(request?: ListManagedMarketAssignmentsRequest): Promise<ListManagedMarketAssignmentsResponse>;
|
|
60
|
+
claimLease(launchId: string, request: ClaimManagedMarketLeaseRequest): Promise<ManagedMarketLease>;
|
|
61
|
+
/** On an unknown outcome, reconcile through claimLease before advancing revision. */
|
|
62
|
+
refreshQuotes(launchId: string, request: RefreshManagedMarketQuotesRequest): Promise<ManagedMarketQuoteStatus>;
|
|
63
|
+
}
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseAPI } from "../api";
|
|
2
|
-
import type { OrderSide, OrderType, PositionSide } from "../trading";
|
|
2
|
+
import type { MatchResult, OrderSide, OrderType, PositionSide } from "../trading";
|
|
3
3
|
export type MarginMode = "ISOLATED" | "CROSS";
|
|
4
4
|
export interface MarginAccountSummary {
|
|
5
5
|
marginAccountId: string;
|
|
@@ -245,15 +245,50 @@ export interface SimulateOrderRiskRequest {
|
|
|
245
245
|
/** Required for normal orders; optional and ignored for reduce-only. */
|
|
246
246
|
leverage?: string;
|
|
247
247
|
reduceOnly?: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* MARKET-only slippage tolerance in basis points, 0..1,000 — the rule the
|
|
250
|
+
* server applies to a placed MARKET order: a LIMIT preview carrying it is
|
|
251
|
+
* rejected with the message the order itself would get. It TIGHTENS the walk
|
|
252
|
+
* the preview runs (merged tighter-wins with the engine's 1,000 bps
|
|
253
|
+
* protective band), so `expectedMatchResult` and `estimatedFee` price under
|
|
254
|
+
* the band the real placement will run under. Omit for the placement
|
|
255
|
+
* default; it never widens the band.
|
|
256
|
+
*
|
|
257
|
+
* Carrying a previewed value into placement: the SDK's `placeMarketOrder`
|
|
258
|
+
* and batch helpers take `slippageTolerance` as a RATIO (`0.05` = 500 bps),
|
|
259
|
+
* so pass `slippageToleranceBps / 10_000`; a `slippageToleranceBps` key on
|
|
260
|
+
* those calls is not forwarded.
|
|
261
|
+
*
|
|
262
|
+
* On a first-use ISOLATED preview the value is also forwarded to the
|
|
263
|
+
* bucket's auto-funding for parity with placement; that path floors it at
|
|
264
|
+
* 1,000 bps, so today it does not change the funded figure.
|
|
265
|
+
*/
|
|
266
|
+
slippageToleranceBps?: number;
|
|
248
267
|
}
|
|
249
268
|
export type SimulateIsolatedRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
|
|
250
269
|
marginMode?: "ISOLATED";
|
|
251
270
|
strategyKey?: string;
|
|
252
271
|
selectedTradingPairIds?: never;
|
|
253
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Preview an order against the account's cross risk bucket, or the
|
|
275
|
+
* deterministic bucket a first cross order would create. A cross preview names
|
|
276
|
+
* no pairs: cross scope is derived from trading — a pair joins the bucket when
|
|
277
|
+
* a cross order on it succeeds and, once its positions close, stays listed
|
|
278
|
+
* until a later successful cross order on another pair reconciles the bucket —
|
|
279
|
+
* so the previewed pair is in scope by construction. Read the derived scope
|
|
280
|
+
* the preview ran against from the response's `selectedTradingPairIds`.
|
|
281
|
+
*/
|
|
254
282
|
export type SimulateCrossRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
|
|
255
283
|
marginMode: "CROSS";
|
|
256
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Removed. This used to declare the scope the preview ran against (required,
|
|
286
|
+
* containing `tradingPairId`, covering every open cross position) while the
|
|
287
|
+
* server never priced anything from it. The server now ignores the wire
|
|
288
|
+
* field; the SDK no longer sends it and rejects it here so a caller learns at
|
|
289
|
+
* compile time that it does nothing.
|
|
290
|
+
*/
|
|
291
|
+
selectedTradingPairIds?: never;
|
|
257
292
|
strategyKey?: never;
|
|
258
293
|
};
|
|
259
294
|
export type SimulateRiskBucketOrderRiskRequest = SimulateIsolatedRiskBucketOrderRiskRequest | SimulateCrossRiskBucketOrderRiskRequest;
|
|
@@ -264,6 +299,16 @@ export interface SimulateOrderRiskResponse {
|
|
|
264
299
|
strategyKey?: string;
|
|
265
300
|
riskBucketId?: string;
|
|
266
301
|
marginMode?: MarginMode;
|
|
302
|
+
/**
|
|
303
|
+
* The cross scope the preview ran against; absent for isolated previews and
|
|
304
|
+
* never a caller's list. From `simulateRiskBucketOrderRisk` in CROSS mode it
|
|
305
|
+
* is the DERIVED scope: the active cross bucket's recorded pairs (a pair
|
|
306
|
+
* whose positions have closed stays recorded until a later cross order on
|
|
307
|
+
* another pair reconciles the bucket), every pair with an open position in
|
|
308
|
+
* that bucket, and the previewed pair — the previewed pair alone before the
|
|
309
|
+
* first cross order. `simulateOrderRisk` and `simulateParentMarginOrderRisk`
|
|
310
|
+
* report the recorded pairs plus the previewed pair.
|
|
311
|
+
*/
|
|
267
312
|
selectedTradingPairIds?: string[];
|
|
268
313
|
equityAfter: string;
|
|
269
314
|
initialMarginRequiredAfter: string;
|
|
@@ -301,6 +346,51 @@ export interface SimulateOrderRiskResponse {
|
|
|
301
346
|
* as unavailable, never as zero.
|
|
302
347
|
*/
|
|
303
348
|
estimatedLiquidationPrice?: string;
|
|
349
|
+
/**
|
|
350
|
+
* The simulated match the engine ran to admit this order — the same
|
|
351
|
+
* `MatchResult` shape a placement's `matchResult` carries, from the same
|
|
352
|
+
* walk over the live book at the moment of the preview, under
|
|
353
|
+
* `slippageToleranceBps` merged tighter-wins with the 1,000 bps protective
|
|
354
|
+
* band and the caller's own self-trade-prevention default (the preview runs
|
|
355
|
+
* under the caller's wallet, as placement does). Not a client-side re-walk,
|
|
356
|
+
* so preflight and placement read the same numbers. What a preview cannot
|
|
357
|
+
* carry: `postOnly`, TP/SL legs and a per-order self-trade-prevention
|
|
358
|
+
* override — a post-only order that would cross is refused by placement, not
|
|
359
|
+
* by this preview.
|
|
360
|
+
*
|
|
361
|
+
* Read it as: `totalFilled` is what would execute; `remainingQuantity` what
|
|
362
|
+
* the band or the depth leaves unfilled (the partial-fill indicator — a
|
|
363
|
+
* MARKET preview with a non-zero remainder comes back partially filled when
|
|
364
|
+
* placed); `averageFillPrice` and `executionPriceRange.worstPrice` the fill
|
|
365
|
+
* levels, `null` when nothing crosses; `status` the status placement would
|
|
366
|
+
* end in — `FILLED` for a full fill, `CANCELLED` for a MARKET order the band
|
|
367
|
+
* or the depth cuts short (a MARKET remainder cannot rest, so the fills
|
|
368
|
+
* execute and the rest is cancelled; read `remainingQuantity` for the
|
|
369
|
+
* partial fill), `SUBMITTED` for a LIMIT that rests, `PARTIALLY_FILLED` for
|
|
370
|
+
* a LIMIT that crosses partly and rests the remainder; `actualSlippageBps`
|
|
371
|
+
* the realized slippage against `referencePrice`
|
|
372
|
+
* — for a LIMIT or IOC preview, against the limit price, and `null` when
|
|
373
|
+
* every fill improved on it; `maxSlippageBps` echoes your tolerance.
|
|
374
|
+
*
|
|
375
|
+
* Priced against the book RIGHT NOW. A take-profit / stop-loss closes later,
|
|
376
|
+
* on a different book, under the wider 1,200 bps band a triggered market leg
|
|
377
|
+
* carries — so for a TP/SL estimate apply `actualSlippageBps` to the TRIGGER
|
|
378
|
+
* price as an impact figure rather than displaying this absolute average.
|
|
379
|
+
*
|
|
380
|
+
* Present only when `accepted` is true. Absent (`null` on the wire, like
|
|
381
|
+
* `estimatedLiquidationPrice`) on every refused preview, including the
|
|
382
|
+
* post-match maker-risk rejection; treat absence as unknown, not as a zero
|
|
383
|
+
* fill.
|
|
384
|
+
*/
|
|
385
|
+
expectedMatchResult?: MatchResult;
|
|
386
|
+
/**
|
|
387
|
+
* The touch on the taking side when a MARKET preview ran (best ask for a
|
|
388
|
+
* BUY, best bid for a SELL) — what `expectedMatchResult` and its
|
|
389
|
+
* `actualSlippageBps` are measured from. Present only when `accepted` is
|
|
390
|
+
* true and the preview is a MARKET order; a LIMIT or IOC preview is measured
|
|
391
|
+
* against its own limit price and publishes nothing here.
|
|
392
|
+
*/
|
|
393
|
+
referencePrice?: string;
|
|
304
394
|
}
|
|
305
395
|
export interface MarginAccountsAPI extends BaseAPI {
|
|
306
396
|
listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
|
package/dist/market/index.d.ts
CHANGED
|
@@ -312,23 +312,87 @@ export interface MarketStats {
|
|
|
312
312
|
/** Life-to-date cumulative number of trades summed across all pairs */
|
|
313
313
|
totalTradeCountLtd: number;
|
|
314
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* One notional bracket of a market's margin ladder. Brackets are MARGINAL: a
|
|
317
|
+
* bracket's rate applies only to the notional inside it, and the deduction
|
|
318
|
+
* carries the cheaper margin already charged by the brackets below, so margin
|
|
319
|
+
* is continuous across every bound rather than jumping at it.
|
|
320
|
+
*
|
|
321
|
+
* `PerpMarketConfig.riskTiers` lists every bracket ascending by
|
|
322
|
+
* `lowerBoundNotional`. A position's bracket is the LAST tier whose
|
|
323
|
+
* `lowerBoundNotional` is at or below its notional, `abs(quantity) x markPrice`.
|
|
324
|
+
*/
|
|
315
325
|
export interface RiskTier {
|
|
326
|
+
/**
|
|
327
|
+
* Marginal initial-margin floor rate for notional inside this bracket, as a
|
|
328
|
+
* decimal fraction. The ladder floor is
|
|
329
|
+
* `IM_floor(N) = N x initialMarginRatio - initialMarginDeduction`.
|
|
330
|
+
* A position's requirement is the greater of this floor and its
|
|
331
|
+
* selected-leverage initial margin scaled to the current mark.
|
|
332
|
+
*/
|
|
316
333
|
initialMarginRatio: string;
|
|
334
|
+
/**
|
|
335
|
+
* Marginal maintenance-margin rate for notional inside this bracket, as a
|
|
336
|
+
* decimal fraction. Maintenance margin for a position of notional N in this
|
|
337
|
+
* bracket is `MM(N) = N x maintenanceMarginRatio - maintenanceMarginDeduction`.
|
|
338
|
+
*/
|
|
317
339
|
maintenanceMarginRatio: string;
|
|
318
340
|
/** Maximum authoritative absolute base-asset quantity. */
|
|
319
341
|
maxPositionSize?: string;
|
|
320
342
|
/** @deprecated This legacy alias is base quantity, not notional. */
|
|
321
343
|
maxPositionNotional?: string;
|
|
344
|
+
/** 1-based bracket index within the market's ladder; 1 is the lowest bracket. */
|
|
345
|
+
tierLevel: number;
|
|
346
|
+
/** USD notional at which this bracket starts, inclusive; "0" for tier 1. */
|
|
347
|
+
lowerBoundNotional: string;
|
|
348
|
+
/**
|
|
349
|
+
* Maximum leverage available inside this bracket. Absent only for a
|
|
350
|
+
* single-tier market configured from explicit margin rates rather than
|
|
351
|
+
* from a leverage.
|
|
352
|
+
*/
|
|
353
|
+
maxLeverage?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Continuity term of the ladder's initial-margin floor formula
|
|
356
|
+
* `IM_floor(N) = N x initialMarginRatio - initialMarginDeduction`; "0" for tier 1.
|
|
357
|
+
*/
|
|
358
|
+
initialMarginDeduction: string;
|
|
359
|
+
/**
|
|
360
|
+
* Continuity term of the maintenance-margin formula
|
|
361
|
+
* `MM(N) = N x maintenanceMarginRatio - maintenanceMarginDeduction`; "0" for tier 1.
|
|
362
|
+
*/
|
|
363
|
+
maintenanceMarginDeduction: string;
|
|
322
364
|
}
|
|
323
365
|
export interface PerpMarketConfig {
|
|
324
366
|
tradingPairId: string;
|
|
325
367
|
symbol: string;
|
|
326
368
|
minLeverage: string;
|
|
369
|
+
/**
|
|
370
|
+
* Tier 1 (the lowest bracket) of `riskTiers` — its `maxLeverage`, mirrored
|
|
371
|
+
* here for backward compatibility. Brackets above tier 1 are described
|
|
372
|
+
* only by `riskTiers`.
|
|
373
|
+
*/
|
|
327
374
|
maxLeverage: string;
|
|
375
|
+
/**
|
|
376
|
+
* Tier 1 (the lowest bracket) of `riskTiers` — its `initialMarginRatio`,
|
|
377
|
+
* mirrored here for backward compatibility. Brackets above tier 1 are
|
|
378
|
+
* described only by `riskTiers`. This rate contributes to the ladder floor;
|
|
379
|
+
* selected leverage can produce a higher position initial-margin requirement.
|
|
380
|
+
*/
|
|
328
381
|
initialMarginRatio: string;
|
|
382
|
+
/**
|
|
383
|
+
* Tier 1 (the lowest bracket) of `riskTiers` — its `maintenanceMarginRatio`,
|
|
384
|
+
* mirrored here for backward compatibility. Brackets above tier 1 are
|
|
385
|
+
* described only by `riskTiers`.
|
|
386
|
+
*/
|
|
329
387
|
maintenanceMarginRatio: string;
|
|
330
388
|
fundingIntervalSeconds: number;
|
|
331
389
|
liquidationFeeBps?: string;
|
|
390
|
+
/**
|
|
391
|
+
* The market's full margin ladder, ascending by `lowerBoundNotional` and
|
|
392
|
+
* always non-empty (a market with no configured brackets reports a single
|
|
393
|
+
* tier). A position's bracket is the LAST tier whose `lowerBoundNotional`
|
|
394
|
+
* is at or below its notional, `abs(quantity) x markPrice`.
|
|
395
|
+
*/
|
|
332
396
|
riskTiers: RiskTier[];
|
|
333
397
|
updatedAt: string;
|
|
334
398
|
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { BuildercodesAPI } from "../buildercodes";
|
|
|
5
5
|
import type { DelegatedAgentsAPI } from "../delegated-agents";
|
|
6
6
|
import type { FaucetAPI } from "../faucet";
|
|
7
7
|
import type { FeesAPI } from "../fees";
|
|
8
|
+
import type { ManagedMarketsAPI } from "../managed-markets";
|
|
8
9
|
import type { MarginAccountsAPI } from "../margin-accounts";
|
|
9
10
|
import type { MarketAPI } from "../market";
|
|
10
11
|
import type { PitpassAPI } from "../pitpass";
|
|
@@ -118,6 +119,7 @@ export interface MonacoSDK {
|
|
|
118
119
|
faucet: FaucetAPI;
|
|
119
120
|
/** Deposit-address registration (sweeper) API; requires a session */
|
|
120
121
|
sweeper: SweeperAPI;
|
|
122
|
+
managedMarkets: ManagedMarketsAPI;
|
|
121
123
|
/** Public whitelist (waitlist) submission API */
|
|
122
124
|
whitelist: WhitelistAPI;
|
|
123
125
|
/** Profile operations API */
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -153,7 +153,10 @@ export interface TradingAPI extends BaseAPI {
|
|
|
153
153
|
* partially filled order the replacement rests `total - filled` and locks
|
|
154
154
|
* collateral for that remainder only (FIX convention: `LeavesQty =
|
|
155
155
|
* OrderQty - CumQty`); must exceed the filled amount. Omitted, the
|
|
156
|
-
* replacement keeps the unfilled remainder.
|
|
156
|
+
* replacement keeps the unfilled remainder. Margin reduce-only orders are
|
|
157
|
+
* the exception: their quantity is a close size measured against the live
|
|
158
|
+
* position, placed as given, so neither the subtraction nor the
|
|
159
|
+
* must-exceed-filled rule applies.
|
|
157
160
|
* @param newOrder.useMasterBalance - Whether to use master balance (optional, defaults to false)
|
|
158
161
|
* @param newOrder.postOnly - Re-states post-only intent for the replacement (nothing is inherited from the original order)
|
|
159
162
|
* @returns Promise resolving to a `ReplaceOrderResponse`
|
|
@@ -260,4 +263,4 @@ export interface TradingAPI extends BaseAPI {
|
|
|
260
263
|
}
|
|
261
264
|
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, ListedOrderType, Order, OrderRole, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState, } from "./orders";
|
|
262
265
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
263
|
-
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TwapOrder, UpdatedFields, } from "./responses";
|
|
266
|
+
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, CancelTwapOrderResponse, ConditionalOrder, CreateOrderResponse, CreateTwapOrderOptions, CreateTwapOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, GetTwapOrderTcaResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ListTwapOrdersParams, ListTwapOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, TriggeredOrderSummary, TwapOrder, UpdatedFields, } from "./responses";
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -112,6 +112,19 @@ export interface Order {
|
|
|
112
112
|
conditional?: ConditionalOrder;
|
|
113
113
|
/** Stable cause when status is CANCELLED */
|
|
114
114
|
terminalReason?: OrderTerminalReason;
|
|
115
|
+
/**
|
|
116
|
+
* Present only on an order the engine placed for a take-profit or
|
|
117
|
+
* stop-loss trigger: the conditional order that fired it — the reverse of
|
|
118
|
+
* `ConditionalOrder.triggeredOrderId`, so a close in order history can be
|
|
119
|
+
* attributed to the TP/SL that produced it without scanning the
|
|
120
|
+
* conditional list (0XM-2745).
|
|
121
|
+
*
|
|
122
|
+
* Absent on every order you placed yourself, on TWAP slice children (those
|
|
123
|
+
* carry `parentOrderId` on the wire), and on triggered closes written before
|
|
124
|
+
* the field existed — there is no backfill, so a missing value on an older
|
|
125
|
+
* close means unknown, not "placed by hand". Wire: `conditionalOrderId`.
|
|
126
|
+
*/
|
|
127
|
+
conditionalOrderId?: string;
|
|
115
128
|
/**
|
|
116
129
|
* Opaque, compare-only revision counter for this order's state: a strictly
|
|
117
130
|
* higher value is strictly newer state for that order, and equal values
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Response types for trading operations.
|
|
5
5
|
*/
|
|
6
6
|
import type { MarginMode } from "../margin-accounts";
|
|
7
|
-
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState } from "./orders";
|
|
7
|
+
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderStatusFilter, OrderTerminalReason, OrderType, PositionSide, SelfTradePreventionMode, TimeInForce, TradingMode, TwapExecutionStyle, TwapOrderState } from "./orders";
|
|
8
8
|
/**
|
|
9
9
|
* Match result information for order execution.
|
|
10
10
|
* Contains detailed information about trades, fills, and execution quality.
|
|
@@ -446,6 +446,46 @@ export interface ListConditionalOrdersParams {
|
|
|
446
446
|
page?: number;
|
|
447
447
|
pageSize?: number;
|
|
448
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* What the order a conditional fired into has done so far — a projection of
|
|
451
|
+
* that order's own row, read at request time (0XM-2744).
|
|
452
|
+
*
|
|
453
|
+
* Trigger price and fill price are different numbers: the trigger fires on the
|
|
454
|
+
* mark, the leg then trades against the book, so a MARKET leg fills at least
|
|
455
|
+
* the half-spread (plus its own impact) away from `triggerPrice`, and a LIMIT
|
|
456
|
+
* leg may rest or fill only partly. Every value here is numerically equal to
|
|
457
|
+
* what `getOrder` returns for the same order, but the printed decimal scale
|
|
458
|
+
* can differ between the two reads (this summary is served from the database,
|
|
459
|
+
* `getOrder` from the cache), so compare numerically rather than byte for byte.
|
|
460
|
+
*/
|
|
461
|
+
export interface TriggeredOrderSummary {
|
|
462
|
+
/** The triggered order's id — the same value as the parent's `triggeredOrderId`. */
|
|
463
|
+
orderId: string;
|
|
464
|
+
/**
|
|
465
|
+
* The triggered order's CURRENT status: `SETTLED` for a leg that filled in
|
|
466
|
+
* full (a fully filled order is written as `SETTLED`, so `FILLED` does not
|
|
467
|
+
* appear here); `SUBMITTED` / `PARTIALLY_FILLED` for a LIMIT leg still
|
|
468
|
+
* resting; `CANCELLED` when the protective band left nothing fillable (see
|
|
469
|
+
* `terminalReason`); `EXPIRED` for a LIMIT leg that lapsed. Never
|
|
470
|
+
* `REJECTED`: a close the engine refused leaves the conditional `FAILED`
|
|
471
|
+
* with no `triggeredOrderId`, so no summary exists for it.
|
|
472
|
+
*/
|
|
473
|
+
status: OrderStatus;
|
|
474
|
+
/** Quantity filled so far, in base units; `"0"` until it fills. */
|
|
475
|
+
filledQuantity: string;
|
|
476
|
+
/**
|
|
477
|
+
* Volume-weighted average fill price. Compare with the parent's
|
|
478
|
+
* `triggerPrice`: the gap is the half-spread plus the order's own market
|
|
479
|
+
* impact. Absent until the first fill.
|
|
480
|
+
*/
|
|
481
|
+
averageFillPrice?: string;
|
|
482
|
+
/** Total taker fees paid, in quote units. Absent until it fills. */
|
|
483
|
+
totalTakerFees?: string;
|
|
484
|
+
/** When the order reached FILLED (ISO 8601). Absent otherwise. */
|
|
485
|
+
filledAt?: string;
|
|
486
|
+
/** Stable cause when `status` is `CANCELLED`, same vocabulary as `Order.terminalReason`. */
|
|
487
|
+
terminalReason?: OrderTerminalReason;
|
|
488
|
+
}
|
|
449
489
|
export interface ConditionalOrder {
|
|
450
490
|
conditionalOrderId: string;
|
|
451
491
|
tradingPairId: string;
|
|
@@ -496,6 +536,17 @@ export interface ConditionalOrder {
|
|
|
496
536
|
* zero. Wire: `version`.
|
|
497
537
|
*/
|
|
498
538
|
version?: number;
|
|
539
|
+
/**
|
|
540
|
+
* The execution outcome of the order this conditional fired into
|
|
541
|
+
* (`triggeredOrderId`) — status, filled quantity, average fill price, fees
|
|
542
|
+
* and fill time — read from that order at request time (0XM-2744).
|
|
543
|
+
*
|
|
544
|
+
* Present only when `state` is `TRIGGERED` and the triggered order could be
|
|
545
|
+
* read. Absent while waiting on the trigger, on the `conditional_orders`
|
|
546
|
+
* WebSocket frames (snapshot and live), and in the rare case the close
|
|
547
|
+
* cannot be read. Wire: `triggeredOrder`.
|
|
548
|
+
*/
|
|
549
|
+
triggeredOrder?: TriggeredOrderSummary;
|
|
499
550
|
}
|
|
500
551
|
export interface ListConditionalOrdersResponse {
|
|
501
552
|
orders: ConditionalOrder[];
|
|
@@ -99,6 +99,7 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
|
99
99
|
quantity: z.ZodString;
|
|
100
100
|
leverage: z.ZodOptional<z.ZodString>;
|
|
101
101
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
102
103
|
}, z.core.$strict>;
|
|
103
104
|
}, z.core.$strip>;
|
|
104
105
|
export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
|
|
@@ -121,10 +122,17 @@ export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
|
|
|
121
122
|
quantity: z.ZodString;
|
|
122
123
|
leverage: z.ZodOptional<z.ZodString>;
|
|
123
124
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
125
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
124
126
|
}, z.core.$strict>;
|
|
125
127
|
}, z.core.$strip>;
|
|
126
128
|
export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
127
|
-
request: z.
|
|
129
|
+
request: z.ZodPipe<z.ZodObject<{
|
|
130
|
+
marginMode: z.ZodOptional<z.ZodEnum<{
|
|
131
|
+
ISOLATED: "ISOLATED";
|
|
132
|
+
CROSS: "CROSS";
|
|
133
|
+
}>>;
|
|
134
|
+
selectedTradingPairIds: z.ZodOptional<z.ZodUnknown>;
|
|
135
|
+
}, z.core.$loose>, z.ZodUnion<readonly [z.ZodObject<{
|
|
128
136
|
side: z.ZodEnum<{
|
|
129
137
|
BUY: "BUY";
|
|
130
138
|
SELL: "SELL";
|
|
@@ -142,6 +150,7 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
142
150
|
quantity: z.ZodString;
|
|
143
151
|
leverage: z.ZodOptional<z.ZodString>;
|
|
144
152
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
145
154
|
tradingPairId: z.ZodUUID;
|
|
146
155
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
147
156
|
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
@@ -166,8 +175,9 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
166
175
|
quantity: z.ZodString;
|
|
167
176
|
leverage: z.ZodOptional<z.ZodString>;
|
|
168
177
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
169
179
|
marginMode: z.ZodLiteral<"CROSS">;
|
|
170
|
-
selectedTradingPairIds: z.
|
|
180
|
+
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
171
181
|
strategyKey: z.ZodOptional<z.ZodNever>;
|
|
172
|
-
}, z.core.$strict>]
|
|
182
|
+
}, z.core.$strict>]>>;
|
|
173
183
|
}, z.core.$strip>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Margin Account API Validation Schemas
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { OrderSideSchema, OrderTypeSchema, PositionSideSchema, PositiveDecimalStringSchema, UUIDSchema } from "./trading";
|
|
5
|
+
import { MarketSlippageToleranceBpsSchema, OrderSideSchema, OrderTypeSchema, PositionSideSchema, PositiveDecimalStringSchema, UUIDSchema } from "./trading";
|
|
6
6
|
const PaginationSchema = z.object({
|
|
7
7
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
8
8
|
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
@@ -47,7 +47,6 @@ const RiskBucketRequestSchema = z.object({
|
|
|
47
47
|
tradingPairId: UUIDSchema,
|
|
48
48
|
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
49
49
|
});
|
|
50
|
-
const SelectedCrossTradingPairIdsSchema = z.array(UUIDSchema).min(1, "selectedTradingPairIds is required for CROSS risk buckets");
|
|
51
50
|
const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
|
|
52
51
|
marginMode: z.literal("ISOLATED").optional(),
|
|
53
52
|
selectedTradingPairIds: z.never().optional(),
|
|
@@ -56,11 +55,16 @@ const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
|
|
|
56
55
|
// stays strict-rejected (no per-position margin to commit to).
|
|
57
56
|
applyToPositionMargin: z.boolean().optional(),
|
|
58
57
|
});
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
58
|
+
// A cross preview names no pairs. Cross scope is derived from trading, so a
|
|
59
|
+
// preview has nothing to declare; `selectedTradingPairIds` used to be REQUIRED
|
|
60
|
+
// here (non-empty, containing `tradingPairId`, covering every open cross
|
|
61
|
+
// position) while the server never priced anything from it. The server now
|
|
62
|
+
// ignores it and this schema rejects it, so the caller learns it does nothing
|
|
63
|
+
// rather than believing it took effect. `tradingPairId` stays required: it is
|
|
64
|
+
// the pair being previewed, not a scope declaration.
|
|
65
|
+
const CrossRiskBucketSimulateRequestSchema = z.object({
|
|
62
66
|
marginMode: z.literal("CROSS"),
|
|
63
|
-
selectedTradingPairIds:
|
|
67
|
+
selectedTradingPairIds: z.never().optional(),
|
|
64
68
|
strategyKey: z.never().optional(),
|
|
65
69
|
});
|
|
66
70
|
// A cross transfer-in names no pairs. Cross scope is derived from trading, so
|
|
@@ -83,7 +87,8 @@ export const TransferCollateralToParentMarginAccountSchema = z.object({
|
|
|
83
87
|
});
|
|
84
88
|
// Named ahead of the union: a union of two strict members collapses every
|
|
85
89
|
// mismatch into a single "Invalid input" on `request`, which would hide the one
|
|
86
|
-
// mistake this schema most needs to name
|
|
90
|
+
// mistake this schema most needs to name — in EVERY mode, since the isolated
|
|
91
|
+
// member is strict too and the server names the field there as well.
|
|
87
92
|
const CrossTransferNamesNoPairsSchema = z
|
|
88
93
|
.object({
|
|
89
94
|
marginMode: z.enum(["ISOLATED", "CROSS"]).optional(),
|
|
@@ -91,13 +96,16 @@ const CrossTransferNamesNoPairsSchema = z
|
|
|
91
96
|
})
|
|
92
97
|
.loose()
|
|
93
98
|
.superRefine((request, ctx) => {
|
|
94
|
-
if (request.
|
|
95
|
-
|
|
96
|
-
code: "custom",
|
|
97
|
-
path: ["selectedTradingPairIds"],
|
|
98
|
-
message: "selectedTradingPairIds is not accepted on a CROSS transfer: cross scope is derived from trading, so a funding call has nothing to declare",
|
|
99
|
-
});
|
|
99
|
+
if (request.selectedTradingPairIds === undefined) {
|
|
100
|
+
return;
|
|
100
101
|
}
|
|
102
|
+
ctx.addIssue({
|
|
103
|
+
code: "custom",
|
|
104
|
+
path: ["selectedTradingPairIds"],
|
|
105
|
+
message: request.marginMode === "CROSS"
|
|
106
|
+
? "selectedTradingPairIds is not accepted on a CROSS transfer: cross scope is derived from trading, so a funding call has nothing to declare"
|
|
107
|
+
: "selectedTradingPairIds is not supported for ISOLATED risk buckets",
|
|
108
|
+
});
|
|
101
109
|
});
|
|
102
110
|
export const TransferCollateralToRiskBucketSchema = z.object({
|
|
103
111
|
request: CrossTransferNamesNoPairsSchema.pipe(z.union([
|
|
@@ -124,8 +132,23 @@ const BaseSimulateOrderRiskRequestSchema = z.object({
|
|
|
124
132
|
quantity: PositiveDecimalStringSchema,
|
|
125
133
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
126
134
|
reduceOnly: z.boolean().optional(),
|
|
135
|
+
// The server caps a preview's tolerance at 1,000 bps (the same cap
|
|
136
|
+
// placement enforces on a MARKET order), so 1,001..10,000 fail here rather
|
|
137
|
+
// than round-trip to a 400 — one shared schema, so the cap lives once.
|
|
138
|
+
slippageToleranceBps: MarketSlippageToleranceBpsSchema.optional(),
|
|
127
139
|
});
|
|
128
140
|
const validateOneWaySimulationFields = (data, ctx) => {
|
|
141
|
+
// Mirrors the server (`utils::slippage::validate_slippage_tolerance`, the
|
|
142
|
+
// rule placement applies): a tolerance is MARKET-only, so a LIMIT preview
|
|
143
|
+
// carrying one fails client-side with the same complaint the server would
|
|
144
|
+
// raise instead of round-tripping to a 400.
|
|
145
|
+
if (data.orderType !== "MARKET" && data.slippageToleranceBps !== undefined) {
|
|
146
|
+
ctx.addIssue({
|
|
147
|
+
code: z.ZodIssueCode.custom,
|
|
148
|
+
message: "slippageToleranceBps is only supported for MARKET orders",
|
|
149
|
+
path: ["slippageToleranceBps"],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
129
152
|
if (data.positionSide !== undefined) {
|
|
130
153
|
const expected = data.side === "BUY" ? "LONG" : "SHORT";
|
|
131
154
|
if (data.positionSide !== expected) {
|
|
@@ -148,14 +171,33 @@ const SimulateOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.strict
|
|
|
148
171
|
const SimulateIsolatedRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(IsolatedRiskBucketRequestSchema)
|
|
149
172
|
.strict()
|
|
150
173
|
.superRefine(validateOneWaySimulationFields);
|
|
151
|
-
const SimulateCrossRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(
|
|
174
|
+
const SimulateCrossRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(CrossRiskBucketSimulateRequestSchema)
|
|
152
175
|
.strict()
|
|
153
|
-
.superRefine(validateOneWaySimulationFields)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
176
|
+
.superRefine(validateOneWaySimulationFields);
|
|
177
|
+
// Named ahead of the union for the same reason `CrossTransferNamesNoPairsSchema`
|
|
178
|
+
// is: a union of two strict members collapses every mismatch into a single
|
|
179
|
+
// "Invalid input" on `request`, which would hide the one mistake this schema
|
|
180
|
+
// most needs to name — in every mode, with the server's own wording for
|
|
181
|
+
// ISOLATED (where the field never applied).
|
|
182
|
+
const CrossSimulateNamesNoPairsSchema = z
|
|
183
|
+
.object({
|
|
184
|
+
marginMode: z.enum(["ISOLATED", "CROSS"]).optional(),
|
|
185
|
+
selectedTradingPairIds: z.unknown().optional(),
|
|
186
|
+
})
|
|
187
|
+
.loose()
|
|
188
|
+
.superRefine((request, ctx) => {
|
|
189
|
+
if (request.selectedTradingPairIds === undefined) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
ctx.addIssue({
|
|
193
|
+
code: "custom",
|
|
194
|
+
path: ["selectedTradingPairIds"],
|
|
195
|
+
message: request.marginMode === "CROSS"
|
|
196
|
+
? "selectedTradingPairIds is not accepted on a CROSS preview: cross scope is derived from trading, so a preview has nothing to declare"
|
|
197
|
+
: "selectedTradingPairIds is not supported for ISOLATED risk buckets",
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
const SimulateRiskBucketOrderRiskRequestSchema = CrossSimulateNamesNoPairsSchema.pipe(z.union([SimulateIsolatedRiskBucketOrderRiskRequestSchema, SimulateCrossRiskBucketOrderRiskRequestSchema]));
|
|
159
201
|
export const SimulateOrderRiskSchema = z
|
|
160
202
|
.object({
|
|
161
203
|
marginAccountId: UUIDSchema,
|
|
@@ -76,6 +76,13 @@ export declare const ISO8601DateSchema: z.ZodISODateTime;
|
|
|
76
76
|
*/
|
|
77
77
|
export declare const SlippageToleranceSchema: z.ZodOptional<z.ZodNumber>;
|
|
78
78
|
export declare const SlippageToleranceBpsSchema: z.ZodNumber;
|
|
79
|
+
/**
|
|
80
|
+
* A standalone MARKET order's tolerance, and a MARKET risk preview's: the
|
|
81
|
+
* server caps it at 1,000 bps — the mandatory protective band, which a client
|
|
82
|
+
* value can only tighten — so anything wider fails here instead of
|
|
83
|
+
* round-tripping to a 400. The 10,000 bps schema above is for TP/SL legs.
|
|
84
|
+
*/
|
|
85
|
+
export declare const MarketSlippageToleranceBpsSchema: z.ZodNumber;
|
|
79
86
|
/** TWAP slices cap at 500 bps (5%) — tighter than standalone market orders. */
|
|
80
87
|
export declare const TwapSlippageToleranceBpsSchema: z.ZodNumber;
|
|
81
88
|
export declare const ParentTpSlLegSchema: z.ZodObject<{
|
|
@@ -84,6 +84,17 @@ export const SlippageToleranceBpsSchema = z
|
|
|
84
84
|
.int()
|
|
85
85
|
.min(0, "Slippage tolerance must be at least 0 bps")
|
|
86
86
|
.max(10000, "Slippage tolerance cannot exceed 10000 bps");
|
|
87
|
+
/**
|
|
88
|
+
* A standalone MARKET order's tolerance, and a MARKET risk preview's: the
|
|
89
|
+
* server caps it at 1,000 bps — the mandatory protective band, which a client
|
|
90
|
+
* value can only tighten — so anything wider fails here instead of
|
|
91
|
+
* round-tripping to a 400. The 10,000 bps schema above is for TP/SL legs.
|
|
92
|
+
*/
|
|
93
|
+
export const MarketSlippageToleranceBpsSchema = z
|
|
94
|
+
.number()
|
|
95
|
+
.int()
|
|
96
|
+
.min(0, "Slippage tolerance must be at least 0 bps")
|
|
97
|
+
.max(1000, "Slippage tolerance cannot exceed 1000 bps");
|
|
87
98
|
/** TWAP slices cap at 500 bps (5%) — tighter than standalone market orders. */
|
|
88
99
|
export const TwapSlippageToleranceBpsSchema = z
|
|
89
100
|
.number()
|
|
@@ -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 ["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_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "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_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "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_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
|
|
13
|
+
export declare const OPERATION_IDS: readonly ["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_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "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_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "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_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_managed_market_assignments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
|
|
14
14
|
/** Union of every OpenAPI operationId in the spec. */
|
|
15
15
|
export type OperationId = (typeof OPERATION_IDS)[number];
|
package/dist/wire/operations.js
CHANGED
|
@@ -23,6 +23,7 @@ export const OPERATION_IDS = [
|
|
|
23
23
|
"cancel_twap_order",
|
|
24
24
|
"check_trader_code_availability",
|
|
25
25
|
"claim_buildercode_rewards",
|
|
26
|
+
"claim_managed_market_lease",
|
|
26
27
|
"clear_trader_code",
|
|
27
28
|
"close_position",
|
|
28
29
|
"create_challenge",
|
|
@@ -98,6 +99,7 @@ export const OPERATION_IDS = [
|
|
|
98
99
|
"list_delegated_agents",
|
|
99
100
|
"list_funding_history",
|
|
100
101
|
"list_funding_payments",
|
|
102
|
+
"list_managed_market_assignments",
|
|
101
103
|
"list_margin_accounts",
|
|
102
104
|
"list_pending_withdrawals",
|
|
103
105
|
"list_position_history",
|
|
@@ -106,6 +108,7 @@ export const OPERATION_IDS = [
|
|
|
106
108
|
"list_trading_pairs",
|
|
107
109
|
"list_twap_orders",
|
|
108
110
|
"mint_tokens",
|
|
111
|
+
"refresh_managed_market_quotes",
|
|
109
112
|
"refresh_session",
|
|
110
113
|
"register_deposit_address",
|
|
111
114
|
"replace_order",
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -1079,6 +1079,66 @@ export interface paths {
|
|
|
1079
1079
|
patch?: never;
|
|
1080
1080
|
trace?: never;
|
|
1081
1081
|
};
|
|
1082
|
+
"/api/v1/managed-markets/assignments": {
|
|
1083
|
+
parameters: {
|
|
1084
|
+
query?: never;
|
|
1085
|
+
header?: never;
|
|
1086
|
+
path?: never;
|
|
1087
|
+
cookie?: never;
|
|
1088
|
+
};
|
|
1089
|
+
/**
|
|
1090
|
+
* List caller managed market assignments
|
|
1091
|
+
* @description Requires the configured maker wallet session. Delegated-agent sessions are not supported and receive 403.
|
|
1092
|
+
*/
|
|
1093
|
+
get: operations["list_managed_market_assignments"];
|
|
1094
|
+
put?: never;
|
|
1095
|
+
post?: never;
|
|
1096
|
+
delete?: never;
|
|
1097
|
+
options?: never;
|
|
1098
|
+
head?: never;
|
|
1099
|
+
patch?: never;
|
|
1100
|
+
trace?: never;
|
|
1101
|
+
};
|
|
1102
|
+
"/api/v1/managed-markets/{launchId}/lease": {
|
|
1103
|
+
parameters: {
|
|
1104
|
+
query?: never;
|
|
1105
|
+
header?: never;
|
|
1106
|
+
path?: never;
|
|
1107
|
+
cookie?: never;
|
|
1108
|
+
};
|
|
1109
|
+
get?: never;
|
|
1110
|
+
put?: never;
|
|
1111
|
+
/**
|
|
1112
|
+
* Claim or renew a fenced maker lease
|
|
1113
|
+
* @description Requires the configured maker wallet session. Delegated-agent sessions are not supported and receive 403.
|
|
1114
|
+
*/
|
|
1115
|
+
post: operations["claim_managed_market_lease"];
|
|
1116
|
+
delete?: never;
|
|
1117
|
+
options?: never;
|
|
1118
|
+
head?: never;
|
|
1119
|
+
patch?: never;
|
|
1120
|
+
trace?: never;
|
|
1121
|
+
};
|
|
1122
|
+
"/api/v1/managed-markets/{launchId}/quotes": {
|
|
1123
|
+
parameters: {
|
|
1124
|
+
query?: never;
|
|
1125
|
+
header?: never;
|
|
1126
|
+
path?: never;
|
|
1127
|
+
cookie?: never;
|
|
1128
|
+
};
|
|
1129
|
+
get?: never;
|
|
1130
|
+
put?: never;
|
|
1131
|
+
/**
|
|
1132
|
+
* Refresh the server-bounded managed quote set
|
|
1133
|
+
* @description Requires the configured maker wallet session. Delegated-agent sessions are not supported and receive 403.
|
|
1134
|
+
*/
|
|
1135
|
+
post: operations["refresh_managed_market_quotes"];
|
|
1136
|
+
delete?: never;
|
|
1137
|
+
options?: never;
|
|
1138
|
+
head?: never;
|
|
1139
|
+
patch?: never;
|
|
1140
|
+
trace?: never;
|
|
1141
|
+
};
|
|
1082
1142
|
"/api/v1/margin/accounts": {
|
|
1083
1143
|
parameters: {
|
|
1084
1144
|
query?: never;
|
|
@@ -3186,7 +3246,7 @@ export interface components {
|
|
|
3186
3246
|
*/
|
|
3187
3247
|
price?: string | null;
|
|
3188
3248
|
/**
|
|
3189
|
-
* @description New TOTAL quantity (if changing). On a partially filled order the replacement rests total minus filled, and collateral is locked for that remainder only (FIX cancel/replace convention: LeavesQty = OrderQty - CumQty). Must exceed the filled amount. Omitted, the replacement keeps the unfilled remainder.
|
|
3249
|
+
* @description New TOTAL quantity (if changing). On a partially filled order the replacement rests total minus filled, and collateral is locked for that remainder only (FIX cancel/replace convention: LeavesQty = OrderQty - CumQty). Must exceed the filled amount. Omitted, the replacement keeps the unfilled remainder. Margin reduce-only orders are the exception: their quantity is a close size measured against the live position, placed as given, with no subtraction and no must-exceed-filled rule.
|
|
3190
3250
|
* @example 0.7
|
|
3191
3251
|
*/
|
|
3192
3252
|
quantity?: string | null;
|
|
@@ -3519,6 +3579,12 @@ export interface components {
|
|
|
3519
3579
|
*/
|
|
3520
3580
|
tradingBalance?: string | null;
|
|
3521
3581
|
};
|
|
3582
|
+
ClaimManagedMarketLeaseRequest: {
|
|
3583
|
+
launchId?: string | null;
|
|
3584
|
+
ownerId?: string | null;
|
|
3585
|
+
/** @description Required when renewing an unexpired lease. Decimal string in JSON. */
|
|
3586
|
+
expectedGeneration?: string | null;
|
|
3587
|
+
};
|
|
3522
3588
|
ClosePositionRequest: {
|
|
3523
3589
|
quantity?: string | null;
|
|
3524
3590
|
closeType?: string | null;
|
|
@@ -3568,6 +3634,8 @@ export interface components {
|
|
|
3568
3634
|
* @example 918342
|
|
3569
3635
|
*/
|
|
3570
3636
|
version?: number | null;
|
|
3637
|
+
/** @description Present only when state is TRIGGERED: the execution outcome of the order this conditional fired into (triggeredOrderId) — status, filled quantity, volume-weighted average fill price, taker fees and fill time — read from that order at request time. Trigger price and fill price are different numbers: the trigger fires on the mark price and the leg then trades against the book, so a MARKET leg fills at least the half-spread plus its own impact away from triggerPrice, and a LIMIT leg may still be resting (SUBMITTED / PARTIALLY_FILLED) or have been cut by the protective band (CANCELLED with a terminalReason). Absent while waiting on the trigger, on the conditional_orders WebSocket frames, and in the rare case the triggered order cannot be read. */
|
|
3638
|
+
triggeredOrder?: components["schemas"]["TriggeredOrderSummary"] | null;
|
|
3571
3639
|
};
|
|
3572
3640
|
CreateDelegatedSessionRequest: {
|
|
3573
3641
|
/**
|
|
@@ -5004,6 +5072,11 @@ export interface components {
|
|
|
5004
5072
|
* @enum {string|null}
|
|
5005
5073
|
*/
|
|
5006
5074
|
selfTradePreventionMode?: "CANCEL_MAKER" | "CANCEL_TAKER" | "CANCEL_BOTH" | "SKIP" | null;
|
|
5075
|
+
/**
|
|
5076
|
+
* @description Present only on an order the engine placed for a take-profit or stop-loss trigger: the conditional order (GET /api/v1/orders/conditional/{conditionalOrderId}) that fired it. The reverse of ConditionalOrder.triggeredOrderId, so a close in order history can be attributed to the TP/SL that produced it without scanning the conditional list. Absent on every order a client placed itself, on TWAP slice children (those carry parentOrderId), and on triggered closes written before the field existed — there is no backfill, so a missing key on an older close means unknown, not placed by hand.
|
|
5077
|
+
* @example 019aefab-f665-854c-99dc-ced6db9014aa
|
|
5078
|
+
*/
|
|
5079
|
+
conditionalOrderId?: string | null;
|
|
5007
5080
|
};
|
|
5008
5081
|
/** @description Orderbook snapshot with token metadata and sequence number. */
|
|
5009
5082
|
GetOrderbookResponse: {
|
|
@@ -5068,12 +5141,25 @@ export interface components {
|
|
|
5068
5141
|
tradingPairId?: string | null;
|
|
5069
5142
|
symbol?: string | null;
|
|
5070
5143
|
minLeverage?: string | null;
|
|
5144
|
+
/**
|
|
5145
|
+
* @description Tier-1 maximum leverage: the cap for a position in the lowest notional bracket. Larger positions are capped by their own bracket in riskTiers.
|
|
5146
|
+
* @example 50
|
|
5147
|
+
*/
|
|
5071
5148
|
maxLeverage?: string | null;
|
|
5149
|
+
/**
|
|
5150
|
+
* @description Tier-1 initial-margin floor rate, as a decimal fraction. Mirrors riskTiers[0].initialMarginRatio; use the active bracket's rate and deduction for the ladder floor. Selected leverage can produce a higher position initial-margin requirement.
|
|
5151
|
+
* @example 0.02
|
|
5152
|
+
*/
|
|
5072
5153
|
initialMarginRatio?: string | null;
|
|
5154
|
+
/**
|
|
5155
|
+
* @description Tier-1 maintenance-margin rate, as a decimal fraction. Mirrors riskTiers[0].maintenanceMarginRatio; use the active bracket's rate and deduction to calculate maintenance margin.
|
|
5156
|
+
* @example 0.01
|
|
5157
|
+
*/
|
|
5073
5158
|
maintenanceMarginRatio?: string | null;
|
|
5074
5159
|
/** Format: uint32 */
|
|
5075
5160
|
fundingIntervalSeconds?: number | null;
|
|
5076
5161
|
liquidationFeeBps?: string | null;
|
|
5162
|
+
/** @description The market's full margin ladder, ascending by lowerBoundNotional and always non-empty (a market with no configured brackets reports a single tier). A position's bracket is the LAST tier whose lowerBoundNotional is at or below its notional, abs(quantity) x markPrice. */
|
|
5077
5163
|
riskTiers?: components["schemas"]["RiskTier"][] | null;
|
|
5078
5164
|
updatedAt?: string | null;
|
|
5079
5165
|
};
|
|
@@ -6096,6 +6182,17 @@ export interface components {
|
|
|
6096
6182
|
*/
|
|
6097
6183
|
totalPages?: number | null;
|
|
6098
6184
|
};
|
|
6185
|
+
ListManagedMarketAssignmentsResponse: {
|
|
6186
|
+
/** @description Expected assignments, including phases currently unable to quote. */
|
|
6187
|
+
items?: components["schemas"]["ManagedMarketAssignment"][] | null;
|
|
6188
|
+
/** Format: uint32 */
|
|
6189
|
+
total?: number | null;
|
|
6190
|
+
/** Format: uint32 */
|
|
6191
|
+
page?: number | null;
|
|
6192
|
+
/** Format: uint32 */
|
|
6193
|
+
pageSize?: number | null;
|
|
6194
|
+
inventoryObservedAt?: string | null;
|
|
6195
|
+
};
|
|
6099
6196
|
ListMarginAccountsResponse: {
|
|
6100
6197
|
accounts?: components["schemas"]["MarginAccountSummary"][] | null;
|
|
6101
6198
|
/** Format: uint32 */
|
|
@@ -6254,6 +6351,41 @@ export interface components {
|
|
|
6254
6351
|
*/
|
|
6255
6352
|
pageSize?: number | null;
|
|
6256
6353
|
};
|
|
6354
|
+
ManagedMarketAssignment: {
|
|
6355
|
+
launchId?: string | null;
|
|
6356
|
+
/** Format: uuid */
|
|
6357
|
+
tradingPairId?: string | null;
|
|
6358
|
+
symbol?: string | null;
|
|
6359
|
+
phase?: string | null;
|
|
6360
|
+
/** Format: uint32 */
|
|
6361
|
+
refreshIntervalMs?: number | null;
|
|
6362
|
+
allocationUsdc?: string | null;
|
|
6363
|
+
/** @description Last reserved lease. A claim reconciles its actual engine fencing state. */
|
|
6364
|
+
lease?: components["schemas"]["ManagedMarketLease"] | null;
|
|
6365
|
+
quoteEnabled?: boolean | null;
|
|
6366
|
+
};
|
|
6367
|
+
ManagedMarketLease: {
|
|
6368
|
+
launchId?: string | null;
|
|
6369
|
+
ownerId?: string | null;
|
|
6370
|
+
/** @description All uint64 fences are decimal strings in JSON to preserve exact values. */
|
|
6371
|
+
generation?: string | null;
|
|
6372
|
+
quoteRevision?: string | null;
|
|
6373
|
+
expiresAt?: string | null;
|
|
6374
|
+
/** Format: uint32 */
|
|
6375
|
+
refreshIntervalMs?: number | null;
|
|
6376
|
+
phase?: string | null;
|
|
6377
|
+
};
|
|
6378
|
+
ManagedMarketQuoteStatus: {
|
|
6379
|
+
launchId?: string | null;
|
|
6380
|
+
generation?: string | null;
|
|
6381
|
+
quoteRevision?: string | null;
|
|
6382
|
+
phase?: string | null;
|
|
6383
|
+
bidNotional?: string | null;
|
|
6384
|
+
askNotional?: string | null;
|
|
6385
|
+
oracleReady?: boolean | null;
|
|
6386
|
+
readyToActivate?: boolean | null;
|
|
6387
|
+
observedAt?: string | null;
|
|
6388
|
+
};
|
|
6257
6389
|
MarginAccountMovement: {
|
|
6258
6390
|
id?: string | null;
|
|
6259
6391
|
movementType?: string | null;
|
|
@@ -7163,6 +7295,12 @@ export interface components {
|
|
|
7163
7295
|
*/
|
|
7164
7296
|
relevance?: number | null;
|
|
7165
7297
|
};
|
|
7298
|
+
RefreshManagedMarketQuotesRequest: {
|
|
7299
|
+
launchId?: string | null;
|
|
7300
|
+
ownerId?: string | null;
|
|
7301
|
+
generation?: string | null;
|
|
7302
|
+
quoteRevision?: string | null;
|
|
7303
|
+
};
|
|
7166
7304
|
RefreshRequest: Record<string, never>;
|
|
7167
7305
|
RefreshResponse: {
|
|
7168
7306
|
/**
|
|
@@ -7211,7 +7349,7 @@ export interface components {
|
|
|
7211
7349
|
*/
|
|
7212
7350
|
price?: string | null;
|
|
7213
7351
|
/**
|
|
7214
|
-
* @description New TOTAL quantity (if changing). On a partially filled order the replacement rests total minus filled, and collateral is locked for that remainder only (FIX cancel/replace convention: LeavesQty = OrderQty - CumQty). Must exceed the filled amount. Omitted, the replacement keeps the unfilled remainder.
|
|
7352
|
+
* @description New TOTAL quantity (if changing). On a partially filled order the replacement rests total minus filled, and collateral is locked for that remainder only (FIX cancel/replace convention: LeavesQty = OrderQty - CumQty). Must exceed the filled amount. Omitted, the replacement keeps the unfilled remainder. Margin reduce-only orders are the exception: their quantity is a close size measured against the live position, placed as given, with no subtraction and no must-exceed-filled rule.
|
|
7215
7353
|
* @example 0.7
|
|
7216
7354
|
*/
|
|
7217
7355
|
quantity?: string | null;
|
|
@@ -7284,16 +7422,56 @@ export interface components {
|
|
|
7284
7422
|
*/
|
|
7285
7423
|
available?: string | null;
|
|
7286
7424
|
};
|
|
7425
|
+
/**
|
|
7426
|
+
* @description One notional bracket of a market's margin ladder. Brackets are MARGINAL:
|
|
7427
|
+
* a bracket's rate applies only to the notional inside it, and the deduction
|
|
7428
|
+
* carries the cheaper margin already charged by the brackets below, so margin
|
|
7429
|
+
* is continuous across every bound rather than jumping at it.
|
|
7430
|
+
*/
|
|
7287
7431
|
RiskTier: {
|
|
7432
|
+
/**
|
|
7433
|
+
* @description Marginal initial-margin floor rate for notional inside this bracket, as a decimal fraction. The ladder floor is IM_floor(N) = N x initialMarginRatio - initialMarginDeduction. A position's initial-margin requirement is the greater of this floor and its selected-leverage initial margin scaled to the current mark.
|
|
7434
|
+
* @example 0.04
|
|
7435
|
+
*/
|
|
7288
7436
|
initialMarginRatio?: string | null;
|
|
7437
|
+
/**
|
|
7438
|
+
* @description Marginal maintenance-margin rate for notional inside this bracket, as a decimal fraction. Maintenance margin for a position of notional N in this bracket is MM(N) = N x maintenanceMarginRatio - maintenanceMarginDeduction.
|
|
7439
|
+
* @example 0.02
|
|
7440
|
+
*/
|
|
7289
7441
|
maintenanceMarginRatio?: string | null;
|
|
7290
7442
|
/**
|
|
7291
7443
|
* @deprecated
|
|
7292
7444
|
* @description DEPRECATED compatibility alias. This value is a maximum absolute base-asset quantity, not a notional. Use maxPositionSize.
|
|
7293
7445
|
*/
|
|
7294
7446
|
maxPositionNotional?: string | null;
|
|
7295
|
-
/** @description Maximum authoritative absolute position size in base-asset quantity. */
|
|
7447
|
+
/** @description Maximum authoritative absolute position size in base-asset quantity. A market-wide cap, repeated on every tier rather than varying per bracket. */
|
|
7296
7448
|
maxPositionSize?: string | null;
|
|
7449
|
+
/**
|
|
7450
|
+
* Format: uint32
|
|
7451
|
+
* @description 1-based bracket index within the market's ladder; 1 is the lowest bracket.
|
|
7452
|
+
* @example 2
|
|
7453
|
+
*/
|
|
7454
|
+
tierLevel?: number | null;
|
|
7455
|
+
/**
|
|
7456
|
+
* @description USD notional at which this bracket starts, inclusive; "0" for tier 1.
|
|
7457
|
+
* @example 100000000
|
|
7458
|
+
*/
|
|
7459
|
+
lowerBoundNotional?: string | null;
|
|
7460
|
+
/**
|
|
7461
|
+
* @description Maximum leverage available inside this bracket. Absent only for a single-tier market configured from explicit margin rates rather than from a leverage.
|
|
7462
|
+
* @example 25
|
|
7463
|
+
*/
|
|
7464
|
+
maxLeverage?: string | null;
|
|
7465
|
+
/**
|
|
7466
|
+
* @description Continuity term of the ladder's initial-margin floor formula IM_floor(N) = N x initialMarginRatio - initialMarginDeduction; "0" for tier 1.
|
|
7467
|
+
* @example 2000000
|
|
7468
|
+
*/
|
|
7469
|
+
initialMarginDeduction?: string | null;
|
|
7470
|
+
/**
|
|
7471
|
+
* @description Continuity term of the maintenance-margin formula MM(N) = N x maintenanceMarginRatio - maintenanceMarginDeduction; "0" for tier 1.
|
|
7472
|
+
* @example 1000000
|
|
7473
|
+
*/
|
|
7474
|
+
maintenanceMarginDeduction?: string | null;
|
|
7297
7475
|
};
|
|
7298
7476
|
/** @description Per-pair screener row. Window fields null when insufficient history. */
|
|
7299
7477
|
ScreenerItem: {
|
|
@@ -7551,6 +7729,11 @@ export interface components {
|
|
|
7551
7729
|
/** @description Required for normal orders; optional and ignored for reduce-only. */
|
|
7552
7730
|
leverage?: string | null;
|
|
7553
7731
|
reduceOnly?: boolean | null;
|
|
7732
|
+
/**
|
|
7733
|
+
* Format: int32
|
|
7734
|
+
* @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.
|
|
7735
|
+
*/
|
|
7736
|
+
slippageToleranceBps?: number | null;
|
|
7554
7737
|
};
|
|
7555
7738
|
SimulateOrderRiskResponse: {
|
|
7556
7739
|
accepted?: boolean | null;
|
|
@@ -7602,8 +7785,78 @@ export interface components {
|
|
|
7602
7785
|
riskBucketId?: string | null;
|
|
7603
7786
|
/** @description Present when the simulation resolved against a risk bucket. Values: ISOLATED, CROSS. */
|
|
7604
7787
|
marginMode?: string | null;
|
|
7605
|
-
/**
|
|
7788
|
+
/**
|
|
7789
|
+
* @description The cross scope the preview ran against; absent for isolated previews and
|
|
7790
|
+
* never a request's deprecated list. `SimulateRiskBucketOrderRisk` in CROSS
|
|
7791
|
+
* mode reports the DERIVED scope: the active cross bucket's recorded pairs
|
|
7792
|
+
* (a pair whose positions have closed stays recorded until a later cross
|
|
7793
|
+
* order on another pair reconciles the bucket), every pair with an open
|
|
7794
|
+
* position in that bucket, and the previewed pair — the previewed pair alone
|
|
7795
|
+
* before the first cross order. `SimulateOrderRisk` and
|
|
7796
|
+
* `SimulateParentMarginOrderRisk` report the recorded pairs plus the
|
|
7797
|
+
* previewed pair.
|
|
7798
|
+
*/
|
|
7606
7799
|
selectedTradingPairIds?: string[] | null;
|
|
7800
|
+
/**
|
|
7801
|
+
* @description The simulated match the engine ran to admit this order (0XM-2746): the
|
|
7802
|
+
* same `MatchResult` shape `CreateOrderResponse.match_result` carries for a
|
|
7803
|
+
* real placement, produced by the same `simulate_match_with_stp` walk over
|
|
7804
|
+
* the live book at the moment of the preview — under the caller's
|
|
7805
|
+
* `slippage_tolerance_bps` merged tighter-wins with the mandatory 1,000 bps
|
|
7806
|
+
* protective band, the caller's own self-trade-prevention default (the
|
|
7807
|
+
* preview runs under the caller's wallet, as placement does) and
|
|
7808
|
+
* reduce-only sizing. Not a handler-side re-walk of an orderbook snapshot,
|
|
7809
|
+
* so a preflight and the placement it precedes read the same numbers — the
|
|
7810
|
+
* reason this rides the risk simulation rather than a separate quote
|
|
7811
|
+
* endpoint. What a preview cannot carry: a post-only flag, TP/SL legs and a
|
|
7812
|
+
* per-order self-trade-prevention override, so a post-only placement that
|
|
7813
|
+
* would cross is refused by placement, not by this preview.
|
|
7814
|
+
*
|
|
7815
|
+
* Fields: `total_filled` is what the walk fills; `remaining_quantity` what
|
|
7816
|
+
* it could NOT fill inside the merged band — the partial-fill / band-cut
|
|
7817
|
+
* indicator (0 means the whole size executes; a MARKET preview with a
|
|
7818
|
+
* non-zero remainder comes back partially filled when placed);
|
|
7819
|
+
* `average_fill_price` is the quantity-weighted fill price and
|
|
7820
|
+
* `execution_price_range.worst_price` the worst level reached (highest ask a
|
|
7821
|
+
* BUY takes, lowest bid a SELL hits), both absent when nothing crosses;
|
|
7822
|
+
* `status` is the status placement would end in: FILLED for a full fill,
|
|
7823
|
+
* CANCELLED for a MARKET order the band or the depth cuts short (a MARKET
|
|
7824
|
+
* remainder cannot rest, so the fills execute and the rest is cancelled —
|
|
7825
|
+
* read `remaining_quantity` for the partial fill), SUBMITTED for a LIMIT
|
|
7826
|
+
* that rests, PARTIALLY_FILLED for a LIMIT that crosses partly and rests
|
|
7827
|
+
* the remainder; `actual_slippage_bps` the realized
|
|
7828
|
+
* slippage against `reference_price` as the engine computes it for a
|
|
7829
|
+
* placement, absent when nothing crosses; `max_slippage_bps` echoes the
|
|
7830
|
+
* caller's tolerance, not the merged band. A LIMIT preview that would rest
|
|
7831
|
+
* reports 0 filled, the full size remaining and no prices.
|
|
7832
|
+
*
|
|
7833
|
+
* For a LIMIT or IOC preview the engine measures slippage against the LIMIT
|
|
7834
|
+
* price and reports none when every fill improved on it, exactly as the
|
|
7835
|
+
* placement's `match_result` does; `reference_price` below is therefore
|
|
7836
|
+
* published for MARKET previews only.
|
|
7837
|
+
*
|
|
7838
|
+
* Priced against the book RIGHT NOW. For a take-profit / stop-loss the close
|
|
7839
|
+
* runs later, on a different book, under the wider 1,200 bps band the engine
|
|
7840
|
+
* stamps on a triggered market leg and anchored at trigger time — so for a
|
|
7841
|
+
* TP/SL estimate apply `actual_slippage_bps` to the TRIGGER price as an
|
|
7842
|
+
* impact figure rather than displaying this call's absolute average price.
|
|
7843
|
+
* Fees for this walk are `estimated_fee` above, at the caller's own tier,
|
|
7844
|
+
* which can lag the engine's copy by one refresh interval.
|
|
7845
|
+
*
|
|
7846
|
+
* PRESENT ONLY when `accepted` is true. Absent — never zeros — on every
|
|
7847
|
+
* refused preview (`accepted: false` with a `reject_reason`): validation, an
|
|
7848
|
+
* unknown market or account, insufficient margin, a maker-risk constraint, a
|
|
7849
|
+
* MARKET order with nothing fillable inside the band, and the post-match
|
|
7850
|
+
* maker-risk revalidation, whose match the engine discards. Such previews
|
|
7851
|
+
* may still carry `estimated_fee`, which is priced independently of risk
|
|
7852
|
+
* state. Treat absence as unknown, not as "fills at zero".
|
|
7853
|
+
*/
|
|
7854
|
+
expectedMatchResult?: components["schemas"]["MatchResult"] | null;
|
|
7855
|
+
/**
|
|
7856
|
+
* @description The touch on the taking side when a MARKET preview ran (best ask for a BUY, best bid for a SELL) — what expectedMatchResult's walk and its actualSlippageBps are measured from. Present only when accepted is true and the preview is a MARKET order; a LIMIT or IOC preview is measured against its own limit price and publishes nothing here.
|
|
7857
|
+
* @example 100.25
|
|
7858
|
+
*/
|
|
7859
|
+
referencePrice?: string | null;
|
|
7607
7860
|
};
|
|
7608
7861
|
SimulateParentMarginOrderRiskRequest: {
|
|
7609
7862
|
/** Format: uuid */
|
|
@@ -7617,6 +7870,11 @@ export interface components {
|
|
|
7617
7870
|
/** @description Required for normal orders; optional and ignored for reduce-only. */
|
|
7618
7871
|
leverage?: string | null;
|
|
7619
7872
|
reduceOnly?: boolean | null;
|
|
7873
|
+
/**
|
|
7874
|
+
* Format: int32
|
|
7875
|
+
* @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.
|
|
7876
|
+
*/
|
|
7877
|
+
slippageToleranceBps?: number | null;
|
|
7620
7878
|
};
|
|
7621
7879
|
SimulateRiskBucketOrderRiskRequest: {
|
|
7622
7880
|
/** Format: uuid */
|
|
@@ -7633,8 +7891,16 @@ export interface components {
|
|
|
7633
7891
|
reduceOnly?: boolean | null;
|
|
7634
7892
|
/** @description Risk bucket mode. Defaults to ISOLATED. Values: ISOLATED, CROSS. */
|
|
7635
7893
|
marginMode?: string | null;
|
|
7636
|
-
/**
|
|
7894
|
+
/**
|
|
7895
|
+
* @deprecated
|
|
7896
|
+
* @description Deprecated: accepted and ignored. Cross scope is derived from trading (a pair joins the cross bucket when a cross order on it succeeds; after its positions close it stays listed until a later successful cross order on another pair reconciles the bucket), so a cross preview has nothing to declare: it runs against the account's active cross bucket — or the deterministic bucket a first cross order would create — and the previewed pair is in scope by construction. Rejected for ISOLATED, as before. The response's selectedTradingPairIds reports the derived scope (recorded pairs, pairs with open positions in the bucket, and the previewed pair), never this list.
|
|
7897
|
+
*/
|
|
7637
7898
|
selectedTradingPairIds?: string[] | null;
|
|
7899
|
+
/**
|
|
7900
|
+
* Format: int32
|
|
7901
|
+
* @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.
|
|
7902
|
+
*/
|
|
7903
|
+
slippageToleranceBps?: number | null;
|
|
7638
7904
|
};
|
|
7639
7905
|
SubAccount: {
|
|
7640
7906
|
/**
|
|
@@ -8144,7 +8410,7 @@ export interface components {
|
|
|
8144
8410
|
marginMode?: string | null;
|
|
8145
8411
|
/**
|
|
8146
8412
|
* @deprecated
|
|
8147
|
-
* @description Deprecated: accepted and ignored. Cross scope is derived from trading (a pair joins the cross bucket when a cross order on it succeeds
|
|
8413
|
+
* @description Deprecated: accepted and ignored. Cross scope is derived from trading (a pair joins the cross bucket when a cross order on it succeeds; after its positions close it stays listed until a later successful cross order on another pair reconciles the bucket), so a cross transfer-in has nothing to declare and can no longer replace the scope. Rejected for ISOLATED, as before. Read the current scope from the cross bucket's row in the margin-accounts list or from this response's selectedTradingPairIds; the parent row carries no scope. Pairs declared before scope became derived stay recorded until they trade and their positions close.
|
|
8148
8414
|
*/
|
|
8149
8415
|
selectedTradingPairIds?: string[] | null;
|
|
8150
8416
|
/**
|
|
@@ -8197,6 +8463,53 @@ export interface components {
|
|
|
8197
8463
|
*/
|
|
8198
8464
|
tradingBalance?: string | null;
|
|
8199
8465
|
};
|
|
8466
|
+
/**
|
|
8467
|
+
* @description The execution outcome of the order a conditional order fired into — a
|
|
8468
|
+
* projection of that order's own row, read at request time (0XM-2744), so a
|
|
8469
|
+
* TP/SL history can show what the close actually did next to the price that
|
|
8470
|
+
* fired it. Trigger price and fill price are different numbers: the trigger
|
|
8471
|
+
* fires on the mark, the leg then trades against the book, so a MARKET leg
|
|
8472
|
+
* fills at least the half-spread (plus its own impact) away from the
|
|
8473
|
+
* trigger, and a LIMIT leg may rest or fill only partly.
|
|
8474
|
+
*/
|
|
8475
|
+
TriggeredOrderSummary: {
|
|
8476
|
+
/**
|
|
8477
|
+
* Format: uuid
|
|
8478
|
+
* @description The triggered order's id — the same value as the parent's triggeredOrderId, repeated so the summary is self-contained.
|
|
8479
|
+
* @example 01a0887b-8e7c-7612-983f-b7ee89c2cbbf
|
|
8480
|
+
*/
|
|
8481
|
+
orderId?: string | null;
|
|
8482
|
+
/**
|
|
8483
|
+
* @description The triggered order's CURRENT status, as GET /api/v1/orders/{orderId} reports it: SETTLED for a leg that filled in full (a fully filled order is written as SETTLED, so FILLED does not appear here); SUBMITTED or PARTIALLY_FILLED for a LIMIT leg still resting; CANCELLED when the protective band left nothing fillable or a reduce-only remainder was cut (see terminalReason); EXPIRED for a LIMIT leg that lapsed. Never REJECTED: a close the engine refused leaves the conditional order FAILED with no triggeredOrderId, so no summary exists for it.
|
|
8484
|
+
* @example SETTLED
|
|
8485
|
+
*/
|
|
8486
|
+
status?: string | null;
|
|
8487
|
+
/**
|
|
8488
|
+
* @description Quantity the triggered order has filled so far, in base units. "0" until it fills. Numerically equal to the order's own filledQuantity; the printed decimal scale can differ between this read (served from the database) and GET /api/v1/orders/{orderId} (served from the cache), so compare numerically.
|
|
8489
|
+
* @example 3090659.3
|
|
8490
|
+
*/
|
|
8491
|
+
filledQuantity?: string | null;
|
|
8492
|
+
/**
|
|
8493
|
+
* @description Volume-weighted average price the triggered order filled at. Compare with the parent's triggerPrice: the difference is the half-spread plus the order's own market impact. Absent until the first fill.
|
|
8494
|
+
* @example 0.145611
|
|
8495
|
+
*/
|
|
8496
|
+
averageFillPrice?: string | null;
|
|
8497
|
+
/**
|
|
8498
|
+
* @description Total taker fees the triggered order has paid, in quote units. Absent until it fills.
|
|
8499
|
+
* @example 202.52
|
|
8500
|
+
*/
|
|
8501
|
+
totalTakerFees?: string | null;
|
|
8502
|
+
/**
|
|
8503
|
+
* @description When the triggered order reached FILLED (RFC 3339). Absent while it is resting or partially filled, and on a terminal state that is not a full fill.
|
|
8504
|
+
* @example 2026-09-09T23:23:13.936682Z
|
|
8505
|
+
*/
|
|
8506
|
+
filledAt?: string | null;
|
|
8507
|
+
/**
|
|
8508
|
+
* @description Stable cause when status is CANCELLED — the same vocabulary as the order's own terminalReason. Absent otherwise.
|
|
8509
|
+
* @example SYSTEM
|
|
8510
|
+
*/
|
|
8511
|
+
terminalReason?: string | null;
|
|
8512
|
+
};
|
|
8200
8513
|
TwapOrder: {
|
|
8201
8514
|
/**
|
|
8202
8515
|
* Format: uuid
|
|
@@ -11007,6 +11320,104 @@ export interface operations {
|
|
|
11007
11320
|
};
|
|
11008
11321
|
};
|
|
11009
11322
|
};
|
|
11323
|
+
list_managed_market_assignments: {
|
|
11324
|
+
parameters: {
|
|
11325
|
+
query?: {
|
|
11326
|
+
/** @description Page number (1-indexed) */
|
|
11327
|
+
page?: number;
|
|
11328
|
+
/** @description Items per page (max 100) */
|
|
11329
|
+
pageSize?: number;
|
|
11330
|
+
};
|
|
11331
|
+
header?: never;
|
|
11332
|
+
path?: never;
|
|
11333
|
+
cookie?: never;
|
|
11334
|
+
};
|
|
11335
|
+
requestBody?: never;
|
|
11336
|
+
responses: {
|
|
11337
|
+
/** @description OK */
|
|
11338
|
+
200: {
|
|
11339
|
+
headers: {
|
|
11340
|
+
[name: string]: unknown;
|
|
11341
|
+
};
|
|
11342
|
+
content: {
|
|
11343
|
+
"application/json": components["schemas"]["ListManagedMarketAssignmentsResponse"];
|
|
11344
|
+
};
|
|
11345
|
+
};
|
|
11346
|
+
/** @description Delegated-agent sessions cannot use managed maker controls */
|
|
11347
|
+
403: {
|
|
11348
|
+
headers: {
|
|
11349
|
+
[name: string]: unknown;
|
|
11350
|
+
};
|
|
11351
|
+
content?: never;
|
|
11352
|
+
};
|
|
11353
|
+
};
|
|
11354
|
+
};
|
|
11355
|
+
claim_managed_market_lease: {
|
|
11356
|
+
parameters: {
|
|
11357
|
+
query?: never;
|
|
11358
|
+
header?: never;
|
|
11359
|
+
path: {
|
|
11360
|
+
launchId: string;
|
|
11361
|
+
};
|
|
11362
|
+
cookie?: never;
|
|
11363
|
+
};
|
|
11364
|
+
requestBody: {
|
|
11365
|
+
content: {
|
|
11366
|
+
"application/json": components["schemas"]["ClaimManagedMarketLeaseRequest"];
|
|
11367
|
+
};
|
|
11368
|
+
};
|
|
11369
|
+
responses: {
|
|
11370
|
+
/** @description OK */
|
|
11371
|
+
200: {
|
|
11372
|
+
headers: {
|
|
11373
|
+
[name: string]: unknown;
|
|
11374
|
+
};
|
|
11375
|
+
content: {
|
|
11376
|
+
"application/json": components["schemas"]["ManagedMarketLease"];
|
|
11377
|
+
};
|
|
11378
|
+
};
|
|
11379
|
+
/** @description Delegated-agent sessions cannot use managed maker controls */
|
|
11380
|
+
403: {
|
|
11381
|
+
headers: {
|
|
11382
|
+
[name: string]: unknown;
|
|
11383
|
+
};
|
|
11384
|
+
content?: never;
|
|
11385
|
+
};
|
|
11386
|
+
};
|
|
11387
|
+
};
|
|
11388
|
+
refresh_managed_market_quotes: {
|
|
11389
|
+
parameters: {
|
|
11390
|
+
query?: never;
|
|
11391
|
+
header?: never;
|
|
11392
|
+
path: {
|
|
11393
|
+
launchId: string;
|
|
11394
|
+
};
|
|
11395
|
+
cookie?: never;
|
|
11396
|
+
};
|
|
11397
|
+
requestBody: {
|
|
11398
|
+
content: {
|
|
11399
|
+
"application/json": components["schemas"]["RefreshManagedMarketQuotesRequest"];
|
|
11400
|
+
};
|
|
11401
|
+
};
|
|
11402
|
+
responses: {
|
|
11403
|
+
/** @description OK */
|
|
11404
|
+
200: {
|
|
11405
|
+
headers: {
|
|
11406
|
+
[name: string]: unknown;
|
|
11407
|
+
};
|
|
11408
|
+
content: {
|
|
11409
|
+
"application/json": components["schemas"]["ManagedMarketQuoteStatus"];
|
|
11410
|
+
};
|
|
11411
|
+
};
|
|
11412
|
+
/** @description Delegated-agent sessions cannot use managed maker controls */
|
|
11413
|
+
403: {
|
|
11414
|
+
headers: {
|
|
11415
|
+
[name: string]: unknown;
|
|
11416
|
+
};
|
|
11417
|
+
content?: never;
|
|
11418
|
+
};
|
|
11419
|
+
};
|
|
11420
|
+
};
|
|
11010
11421
|
list_margin_accounts: {
|
|
11011
11422
|
parameters: {
|
|
11012
11423
|
query?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.61",
|
|
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.0.
|
|
19
|
+
"@0xmonaco/contracts": "1.0.61",
|
|
20
20
|
"zod": "^4.1.12"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|