@0xmonaco/types 1.0.60 → 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/margin-accounts/index.d.ts +65 -1
- package/dist/market/index.d.ts +64 -0
- package/dist/trading/index.d.ts +4 -1
- package/dist/validation/margin-accounts.d.ts +4 -0
- package/dist/validation/margin-accounts.js +16 -1
- package/dist/validation/trading.d.ts +7 -0
- package/dist/validation/trading.js +11 -0
- package/dist/wire/schema.d.ts +131 -3
- package/package.json +2 -2
|
@@ -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,6 +245,25 @@ 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";
|
|
@@ -327,6 +346,51 @@ export interface SimulateOrderRiskResponse {
|
|
|
327
346
|
* as unavailable, never as zero.
|
|
328
347
|
*/
|
|
329
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;
|
|
330
394
|
}
|
|
331
395
|
export interface MarginAccountsAPI extends BaseAPI {
|
|
332
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/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`
|
|
@@ -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,6 +122,7 @@ 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<{
|
|
@@ -148,6 +150,7 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
148
150
|
quantity: z.ZodString;
|
|
149
151
|
leverage: z.ZodOptional<z.ZodString>;
|
|
150
152
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
151
154
|
tradingPairId: z.ZodUUID;
|
|
152
155
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
153
156
|
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
@@ -172,6 +175,7 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
172
175
|
quantity: z.ZodString;
|
|
173
176
|
leverage: z.ZodOptional<z.ZodString>;
|
|
174
177
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
175
179
|
marginMode: z.ZodLiteral<"CROSS">;
|
|
176
180
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
177
181
|
strategyKey: z.ZodOptional<z.ZodNever>;
|
|
@@ -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(),
|
|
@@ -132,8 +132,23 @@ const BaseSimulateOrderRiskRequestSchema = z.object({
|
|
|
132
132
|
quantity: PositiveDecimalStringSchema,
|
|
133
133
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
134
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(),
|
|
135
139
|
});
|
|
136
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
|
+
}
|
|
137
152
|
if (data.positionSide !== undefined) {
|
|
138
153
|
const expected = data.side === "BUY" ? "LONG" : "SHORT";
|
|
139
154
|
if (data.positionSide !== expected) {
|
|
@@ -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()
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -3246,7 +3246,7 @@ export interface components {
|
|
|
3246
3246
|
*/
|
|
3247
3247
|
price?: string | null;
|
|
3248
3248
|
/**
|
|
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.
|
|
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.
|
|
3250
3250
|
* @example 0.7
|
|
3251
3251
|
*/
|
|
3252
3252
|
quantity?: string | null;
|
|
@@ -5141,12 +5141,25 @@ export interface components {
|
|
|
5141
5141
|
tradingPairId?: string | null;
|
|
5142
5142
|
symbol?: string | null;
|
|
5143
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
|
+
*/
|
|
5144
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
|
+
*/
|
|
5145
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
|
+
*/
|
|
5146
5158
|
maintenanceMarginRatio?: string | null;
|
|
5147
5159
|
/** Format: uint32 */
|
|
5148
5160
|
fundingIntervalSeconds?: number | null;
|
|
5149
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. */
|
|
5150
5163
|
riskTiers?: components["schemas"]["RiskTier"][] | null;
|
|
5151
5164
|
updatedAt?: string | null;
|
|
5152
5165
|
};
|
|
@@ -7336,7 +7349,7 @@ export interface components {
|
|
|
7336
7349
|
*/
|
|
7337
7350
|
price?: string | null;
|
|
7338
7351
|
/**
|
|
7339
|
-
* @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.
|
|
7340
7353
|
* @example 0.7
|
|
7341
7354
|
*/
|
|
7342
7355
|
quantity?: string | null;
|
|
@@ -7409,16 +7422,56 @@ export interface components {
|
|
|
7409
7422
|
*/
|
|
7410
7423
|
available?: string | null;
|
|
7411
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
|
+
*/
|
|
7412
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
|
+
*/
|
|
7413
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
|
+
*/
|
|
7414
7441
|
maintenanceMarginRatio?: string | null;
|
|
7415
7442
|
/**
|
|
7416
7443
|
* @deprecated
|
|
7417
7444
|
* @description DEPRECATED compatibility alias. This value is a maximum absolute base-asset quantity, not a notional. Use maxPositionSize.
|
|
7418
7445
|
*/
|
|
7419
7446
|
maxPositionNotional?: string | null;
|
|
7420
|
-
/** @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. */
|
|
7421
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;
|
|
7422
7475
|
};
|
|
7423
7476
|
/** @description Per-pair screener row. Window fields null when insufficient history. */
|
|
7424
7477
|
ScreenerItem: {
|
|
@@ -7676,6 +7729,11 @@ export interface components {
|
|
|
7676
7729
|
/** @description Required for normal orders; optional and ignored for reduce-only. */
|
|
7677
7730
|
leverage?: string | null;
|
|
7678
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;
|
|
7679
7737
|
};
|
|
7680
7738
|
SimulateOrderRiskResponse: {
|
|
7681
7739
|
accepted?: boolean | null;
|
|
@@ -7739,6 +7797,66 @@ export interface components {
|
|
|
7739
7797
|
* previewed pair.
|
|
7740
7798
|
*/
|
|
7741
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;
|
|
7742
7860
|
};
|
|
7743
7861
|
SimulateParentMarginOrderRiskRequest: {
|
|
7744
7862
|
/** Format: uuid */
|
|
@@ -7752,6 +7870,11 @@ export interface components {
|
|
|
7752
7870
|
/** @description Required for normal orders; optional and ignored for reduce-only. */
|
|
7753
7871
|
leverage?: string | null;
|
|
7754
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;
|
|
7755
7878
|
};
|
|
7756
7879
|
SimulateRiskBucketOrderRiskRequest: {
|
|
7757
7880
|
/** Format: uuid */
|
|
@@ -7773,6 +7896,11 @@ export interface components {
|
|
|
7773
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.
|
|
7774
7897
|
*/
|
|
7775
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;
|
|
7776
7904
|
};
|
|
7777
7905
|
SubAccount: {
|
|
7778
7906
|
/**
|
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": {
|