@0xmonaco/types 0.8.18 → 0.8.19
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 +29 -4
- package/dist/positions/index.d.ts +2 -0
- package/dist/trading/index.d.ts +3 -0
- package/dist/trading/responses.d.ts +3 -0
- package/dist/validation/margin-accounts.d.ts +37 -4
- package/dist/validation/margin-accounts.js +25 -2
- package/dist/validation/trading.d.ts +20 -0
- package/dist/validation/trading.js +66 -0
- package/dist/wire/schema.d.ts +39 -1
- package/package.json +2 -2
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { BaseAPI } from "../api";
|
|
2
2
|
import type { OrderSide, OrderType, PositionSide } from "../trading";
|
|
3
|
+
export type MarginMode = "ISOLATED" | "CROSS";
|
|
3
4
|
export interface MarginAccountSummary {
|
|
4
5
|
marginAccountId: string;
|
|
5
6
|
label?: string;
|
|
6
7
|
riskBucketId?: string;
|
|
7
|
-
marginMode?:
|
|
8
|
+
marginMode?: MarginMode;
|
|
9
|
+
selectedTradingPairIds?: string[];
|
|
8
10
|
tradingPairId?: string;
|
|
9
11
|
strategyKey?: string;
|
|
10
12
|
accountState: string;
|
|
@@ -59,10 +61,19 @@ export interface TransferCollateralToParentMarginAccountRequest {
|
|
|
59
61
|
asset: string;
|
|
60
62
|
amount: string;
|
|
61
63
|
}
|
|
62
|
-
export interface
|
|
64
|
+
export interface TransferCollateralToIsolatedRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
|
|
65
|
+
marginMode?: "ISOLATED";
|
|
63
66
|
tradingPairId: string;
|
|
64
67
|
strategyKey?: string;
|
|
68
|
+
selectedTradingPairIds?: never;
|
|
65
69
|
}
|
|
70
|
+
export interface TransferCollateralToCrossRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
|
|
71
|
+
marginMode: "CROSS";
|
|
72
|
+
selectedTradingPairIds: string[];
|
|
73
|
+
tradingPairId?: never;
|
|
74
|
+
strategyKey?: never;
|
|
75
|
+
}
|
|
76
|
+
export type TransferCollateralToRiskBucketRequest = TransferCollateralToIsolatedRiskBucketRequest | TransferCollateralToCrossRiskBucketRequest;
|
|
66
77
|
export interface TransferCollateralFromParentMarginAccountRequest {
|
|
67
78
|
asset: string;
|
|
68
79
|
amount: string;
|
|
@@ -71,6 +82,9 @@ export interface TransferCollateralResponse {
|
|
|
71
82
|
movementId: string;
|
|
72
83
|
marginAccountId: string;
|
|
73
84
|
strategyKey?: string;
|
|
85
|
+
riskBucketId?: string;
|
|
86
|
+
marginMode?: MarginMode;
|
|
87
|
+
selectedTradingPairIds?: string[];
|
|
74
88
|
asset: string;
|
|
75
89
|
amount: string;
|
|
76
90
|
status: string;
|
|
@@ -107,14 +121,25 @@ export interface SimulateOrderRiskRequest {
|
|
|
107
121
|
leverage: string;
|
|
108
122
|
reduceOnly?: boolean;
|
|
109
123
|
}
|
|
110
|
-
export
|
|
124
|
+
export type SimulateIsolatedRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
|
|
125
|
+
marginMode?: "ISOLATED";
|
|
111
126
|
strategyKey?: string;
|
|
112
|
-
|
|
127
|
+
selectedTradingPairIds?: never;
|
|
128
|
+
};
|
|
129
|
+
export type SimulateCrossRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
|
|
130
|
+
marginMode: "CROSS";
|
|
131
|
+
selectedTradingPairIds: string[];
|
|
132
|
+
strategyKey?: never;
|
|
133
|
+
};
|
|
134
|
+
export type SimulateRiskBucketOrderRiskRequest = SimulateIsolatedRiskBucketOrderRiskRequest | SimulateCrossRiskBucketOrderRiskRequest;
|
|
113
135
|
export interface SimulateOrderRiskResponse {
|
|
114
136
|
accepted: boolean;
|
|
115
137
|
rejectReason?: string;
|
|
116
138
|
marginAccountId: string;
|
|
117
139
|
strategyKey?: string;
|
|
140
|
+
riskBucketId?: string;
|
|
141
|
+
marginMode?: MarginMode;
|
|
142
|
+
selectedTradingPairIds?: string[];
|
|
118
143
|
equityAfter: string;
|
|
119
144
|
initialMarginRequiredAfter: string;
|
|
120
145
|
maintenanceMarginRequiredAfter: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseAPI } from "../api";
|
|
2
|
+
import type { MarginMode } from "../margin-accounts";
|
|
2
3
|
import type { OrderType, PositionSide, TimeInForce } from "../trading";
|
|
3
4
|
export type PositionStatus = "OPEN" | "CLOSED" | "LIQUIDATING";
|
|
4
5
|
export type ClosePositionType = "MARKET" | "LIMIT" | "IOC";
|
|
@@ -6,6 +7,7 @@ export interface Position {
|
|
|
6
7
|
positionId: string;
|
|
7
8
|
marginAccountId: string;
|
|
8
9
|
riskBucketId?: string;
|
|
10
|
+
marginMode?: MarginMode;
|
|
9
11
|
tradingPairId: string;
|
|
10
12
|
side: PositionSide;
|
|
11
13
|
size: string;
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Types for trading operations including order placement and management.
|
|
5
5
|
*/
|
|
6
6
|
import type { BaseAPI } from "../api/index";
|
|
7
|
+
import type { MarginMode } from "../margin-accounts";
|
|
7
8
|
import type { OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
9
|
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse } from "./responses";
|
|
9
10
|
/**
|
|
@@ -29,6 +30,7 @@ export interface TradingAPI extends BaseAPI {
|
|
|
29
30
|
expirationDate?: string;
|
|
30
31
|
timeInForce?: TimeInForce;
|
|
31
32
|
marginAccountId?: string;
|
|
33
|
+
marginMode?: MarginMode;
|
|
32
34
|
riskBucketId?: string;
|
|
33
35
|
riskBucketCollateral?: string;
|
|
34
36
|
strategyKey?: string;
|
|
@@ -52,6 +54,7 @@ export interface TradingAPI extends BaseAPI {
|
|
|
52
54
|
tradingMode?: TradingMode;
|
|
53
55
|
slippageTolerance?: number;
|
|
54
56
|
marginAccountId?: string;
|
|
57
|
+
marginMode?: MarginMode;
|
|
55
58
|
riskBucketId?: string;
|
|
56
59
|
riskBucketCollateral?: string;
|
|
57
60
|
strategyKey?: string;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Response types for trading operations.
|
|
5
5
|
*/
|
|
6
|
+
import type { MarginMode } from "../margin-accounts";
|
|
6
7
|
import type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderSide, OrderStatus, OrderType, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
7
8
|
/**
|
|
8
9
|
* Match result information for order execution.
|
|
@@ -288,6 +289,8 @@ export interface BatchCreateOrderParams {
|
|
|
288
289
|
timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
|
|
289
290
|
/** Margin account UUID for margin/perp orders */
|
|
290
291
|
marginAccountId?: string;
|
|
292
|
+
/** Risk bucket mode for margin/perp orders */
|
|
293
|
+
marginMode?: MarginMode;
|
|
291
294
|
/** Existing isolated risk bucket UUID for risk-bucket-scoped margin orders */
|
|
292
295
|
riskBucketId?: string;
|
|
293
296
|
/** Collateral to allocate into a new isolated risk bucket */
|
|
@@ -34,12 +34,21 @@ export declare const TransferCollateralToParentMarginAccountSchema: z.ZodObject<
|
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
|
|
37
|
-
request: z.ZodObject<{
|
|
37
|
+
request: z.ZodUnion<readonly [z.ZodObject<{
|
|
38
38
|
asset: z.ZodString;
|
|
39
39
|
amount: z.ZodString;
|
|
40
40
|
tradingPairId: z.ZodUUID;
|
|
41
41
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
42
|
-
|
|
42
|
+
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
43
|
+
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
44
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
+
asset: z.ZodString;
|
|
46
|
+
amount: z.ZodString;
|
|
47
|
+
marginMode: z.ZodLiteral<"CROSS">;
|
|
48
|
+
selectedTradingPairIds: z.ZodArray<z.ZodUUID>;
|
|
49
|
+
strategyKey: z.ZodOptional<z.ZodNever>;
|
|
50
|
+
tradingPairId: z.ZodOptional<z.ZodNever>;
|
|
51
|
+
}, z.core.$strict>]>;
|
|
43
52
|
}, z.core.$strip>;
|
|
44
53
|
export declare const TransferCollateralFromParentMarginAccountSchema: z.ZodObject<{
|
|
45
54
|
request: z.ZodObject<{
|
|
@@ -104,7 +113,7 @@ export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
|
|
|
104
113
|
}, z.core.$strict>;
|
|
105
114
|
}, z.core.$strip>;
|
|
106
115
|
export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
107
|
-
request: z.ZodObject<{
|
|
116
|
+
request: z.ZodUnion<readonly [z.ZodObject<{
|
|
108
117
|
side: z.ZodEnum<{
|
|
109
118
|
BUY: "BUY";
|
|
110
119
|
SELL: "SELL";
|
|
@@ -124,5 +133,29 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
124
133
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
125
134
|
tradingPairId: z.ZodUUID;
|
|
126
135
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
127
|
-
|
|
136
|
+
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
137
|
+
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
138
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
+
tradingPairId: z.ZodUUID;
|
|
140
|
+
side: z.ZodEnum<{
|
|
141
|
+
BUY: "BUY";
|
|
142
|
+
SELL: "SELL";
|
|
143
|
+
}>;
|
|
144
|
+
positionSide: z.ZodEnum<{
|
|
145
|
+
LONG: "LONG";
|
|
146
|
+
SHORT: "SHORT";
|
|
147
|
+
NONE: "NONE";
|
|
148
|
+
}>;
|
|
149
|
+
orderType: z.ZodEnum<{
|
|
150
|
+
LIMIT: "LIMIT";
|
|
151
|
+
MARKET: "MARKET";
|
|
152
|
+
}>;
|
|
153
|
+
price: z.ZodOptional<z.ZodString>;
|
|
154
|
+
quantity: z.ZodString;
|
|
155
|
+
leverage: z.ZodString;
|
|
156
|
+
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
157
|
+
marginMode: z.ZodLiteral<"CROSS">;
|
|
158
|
+
selectedTradingPairIds: z.ZodArray<z.ZodUUID>;
|
|
159
|
+
strategyKey: z.ZodOptional<z.ZodNever>;
|
|
160
|
+
}, z.core.$strict>]>;
|
|
128
161
|
}, z.core.$strip>;
|
|
@@ -39,6 +39,19 @@ const RiskBucketRequestSchema = z.object({
|
|
|
39
39
|
tradingPairId: UUIDSchema,
|
|
40
40
|
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
41
41
|
});
|
|
42
|
+
const SelectedCrossTradingPairIdsSchema = z.array(UUIDSchema).min(1, "selectedTradingPairIds is required for CROSS risk buckets");
|
|
43
|
+
const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
|
|
44
|
+
marginMode: z.literal("ISOLATED").optional(),
|
|
45
|
+
selectedTradingPairIds: z.never().optional(),
|
|
46
|
+
});
|
|
47
|
+
const CrossRiskBucketScopeSchema = z.object({
|
|
48
|
+
marginMode: z.literal("CROSS"),
|
|
49
|
+
selectedTradingPairIds: SelectedCrossTradingPairIdsSchema,
|
|
50
|
+
strategyKey: z.never().optional(),
|
|
51
|
+
});
|
|
52
|
+
const CrossRiskBucketRequestSchema = CrossRiskBucketScopeSchema.extend({
|
|
53
|
+
tradingPairId: z.never().optional(),
|
|
54
|
+
});
|
|
42
55
|
export const TransferCollateralSchema = z.object({
|
|
43
56
|
marginAccountId: UUIDSchema,
|
|
44
57
|
request: TransferCollateralRequestSchema,
|
|
@@ -47,7 +60,10 @@ export const TransferCollateralToParentMarginAccountSchema = z.object({
|
|
|
47
60
|
request: ParentMarginAccountCollateralRequestSchema,
|
|
48
61
|
});
|
|
49
62
|
export const TransferCollateralToRiskBucketSchema = z.object({
|
|
50
|
-
request:
|
|
63
|
+
request: z.union([
|
|
64
|
+
ParentMarginAccountCollateralRequestSchema.merge(IsolatedRiskBucketRequestSchema).strict(),
|
|
65
|
+
ParentMarginAccountCollateralRequestSchema.merge(CrossRiskBucketRequestSchema).strict(),
|
|
66
|
+
]),
|
|
51
67
|
});
|
|
52
68
|
export const TransferCollateralFromParentMarginAccountSchema = z.object({
|
|
53
69
|
request: ParentMarginAccountCollateralRequestSchema,
|
|
@@ -70,7 +86,14 @@ const BaseSimulateOrderRiskRequestSchema = z.object({
|
|
|
70
86
|
reduceOnly: z.boolean().optional(),
|
|
71
87
|
});
|
|
72
88
|
const SimulateOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.strict();
|
|
73
|
-
const
|
|
89
|
+
const SimulateIsolatedRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(IsolatedRiskBucketRequestSchema).strict();
|
|
90
|
+
const SimulateCrossRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(CrossRiskBucketScopeSchema)
|
|
91
|
+
.strict()
|
|
92
|
+
.refine((data) => data.selectedTradingPairIds.includes(data.tradingPairId), {
|
|
93
|
+
message: "tradingPairId must be included in selectedTradingPairIds for CROSS risk buckets",
|
|
94
|
+
path: ["selectedTradingPairIds"],
|
|
95
|
+
});
|
|
96
|
+
const SimulateRiskBucketOrderRiskRequestSchema = z.union([SimulateIsolatedRiskBucketOrderRiskRequestSchema, SimulateCrossRiskBucketOrderRiskRequestSchema]);
|
|
74
97
|
export const SimulateOrderRiskSchema = z
|
|
75
98
|
.object({
|
|
76
99
|
marginAccountId: UUIDSchema,
|
|
@@ -19,6 +19,10 @@ export declare const TradingModeSchema: z.ZodEnum<{
|
|
|
19
19
|
SPOT: "SPOT";
|
|
20
20
|
MARGIN: "MARGIN";
|
|
21
21
|
}>;
|
|
22
|
+
export declare const MarginModeSchema: z.ZodEnum<{
|
|
23
|
+
ISOLATED: "ISOLATED";
|
|
24
|
+
CROSS: "CROSS";
|
|
25
|
+
}>;
|
|
22
26
|
/**
|
|
23
27
|
* Position side validation
|
|
24
28
|
*/
|
|
@@ -101,6 +105,10 @@ export declare const PlaceLimitOrderSchema: z.ZodObject<{
|
|
|
101
105
|
FOK: "FOK";
|
|
102
106
|
}>>;
|
|
103
107
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
108
|
+
marginMode: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
ISOLATED: "ISOLATED";
|
|
110
|
+
CROSS: "CROSS";
|
|
111
|
+
}>>;
|
|
104
112
|
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
105
113
|
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
106
114
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
@@ -158,6 +166,10 @@ export declare const PlaceMarketOrderSchema: z.ZodObject<{
|
|
|
158
166
|
}>>;
|
|
159
167
|
slippageTolerance: z.ZodOptional<z.ZodNumber>;
|
|
160
168
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
169
|
+
marginMode: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
ISOLATED: "ISOLATED";
|
|
171
|
+
CROSS: "CROSS";
|
|
172
|
+
}>>;
|
|
161
173
|
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
162
174
|
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
163
175
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
@@ -320,6 +332,10 @@ export declare const BatchCreateOrderItemSchema: z.ZodObject<{
|
|
|
320
332
|
FOK: "FOK";
|
|
321
333
|
}>>;
|
|
322
334
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
335
|
+
marginMode: z.ZodOptional<z.ZodEnum<{
|
|
336
|
+
ISOLATED: "ISOLATED";
|
|
337
|
+
CROSS: "CROSS";
|
|
338
|
+
}>>;
|
|
323
339
|
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
324
340
|
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
325
341
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
@@ -362,6 +378,10 @@ export declare const BatchCreateOrdersSchema: z.ZodObject<{
|
|
|
362
378
|
FOK: "FOK";
|
|
363
379
|
}>>;
|
|
364
380
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
381
|
+
marginMode: z.ZodOptional<z.ZodEnum<{
|
|
382
|
+
ISOLATED: "ISOLATED";
|
|
383
|
+
CROSS: "CROSS";
|
|
384
|
+
}>>;
|
|
365
385
|
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
366
386
|
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
367
387
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
@@ -18,6 +18,9 @@ export const OrderSideSchema = z.enum(["BUY", "SELL"], {
|
|
|
18
18
|
export const TradingModeSchema = z.enum(["SPOT", "MARGIN"], {
|
|
19
19
|
message: 'Trading mode must be "SPOT" or "MARGIN"',
|
|
20
20
|
});
|
|
21
|
+
export const MarginModeSchema = z.enum(["ISOLATED", "CROSS"], {
|
|
22
|
+
message: 'Margin mode must be "ISOLATED" or "CROSS"',
|
|
23
|
+
});
|
|
21
24
|
/**
|
|
22
25
|
* Position side validation
|
|
23
26
|
*/
|
|
@@ -117,6 +120,7 @@ export const PlaceLimitOrderSchema = z
|
|
|
117
120
|
expirationDate: ISO8601DateSchema.optional(),
|
|
118
121
|
timeInForce: TimeInForceSchema.optional(),
|
|
119
122
|
marginAccountId: UUIDSchema.optional(),
|
|
123
|
+
marginMode: MarginModeSchema.optional(),
|
|
120
124
|
riskBucketId: UUIDSchema.optional(),
|
|
121
125
|
riskBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
122
126
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
@@ -151,6 +155,26 @@ export const PlaceLimitOrderSchema = z
|
|
|
151
155
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
152
156
|
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
153
157
|
path: ["options", "tradingMode"],
|
|
158
|
+
})
|
|
159
|
+
.refine((data) => data.options?.marginMode === undefined || data.options?.tradingMode === "MARGIN", {
|
|
160
|
+
message: "marginMode is only supported for MARGIN orders",
|
|
161
|
+
path: ["options", "tradingMode"],
|
|
162
|
+
})
|
|
163
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.marginAccountId !== undefined, {
|
|
164
|
+
message: "marginAccountId is required for CROSS margin orders",
|
|
165
|
+
path: ["options", "marginAccountId"],
|
|
166
|
+
})
|
|
167
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.riskBucketId === undefined, {
|
|
168
|
+
message: "marginMode CROSS cannot be combined with riskBucketId",
|
|
169
|
+
path: ["options", "riskBucketId"],
|
|
170
|
+
})
|
|
171
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.riskBucketCollateral === undefined, {
|
|
172
|
+
message: "marginMode CROSS cannot be combined with riskBucketCollateral",
|
|
173
|
+
path: ["options", "riskBucketCollateral"],
|
|
174
|
+
})
|
|
175
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.strategyKey === undefined, {
|
|
176
|
+
message: "marginMode CROSS cannot be combined with strategyKey",
|
|
177
|
+
path: ["options", "strategyKey"],
|
|
154
178
|
})
|
|
155
179
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.riskBucketId === undefined, {
|
|
156
180
|
message: "riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",
|
|
@@ -173,6 +197,7 @@ export const PlaceMarketOrderSchema = z
|
|
|
173
197
|
tradingMode: TradingModeSchema.optional(),
|
|
174
198
|
slippageTolerance: SlippageToleranceSchema,
|
|
175
199
|
marginAccountId: UUIDSchema.optional(),
|
|
200
|
+
marginMode: MarginModeSchema.optional(),
|
|
176
201
|
riskBucketId: UUIDSchema.optional(),
|
|
177
202
|
riskBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
178
203
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
@@ -207,6 +232,26 @@ export const PlaceMarketOrderSchema = z
|
|
|
207
232
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
208
233
|
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
209
234
|
path: ["options", "tradingMode"],
|
|
235
|
+
})
|
|
236
|
+
.refine((data) => data.options?.marginMode === undefined || data.options?.tradingMode === "MARGIN", {
|
|
237
|
+
message: "marginMode is only supported for MARGIN orders",
|
|
238
|
+
path: ["options", "tradingMode"],
|
|
239
|
+
})
|
|
240
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.marginAccountId !== undefined, {
|
|
241
|
+
message: "marginAccountId is required for CROSS margin orders",
|
|
242
|
+
path: ["options", "marginAccountId"],
|
|
243
|
+
})
|
|
244
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.riskBucketId === undefined, {
|
|
245
|
+
message: "marginMode CROSS cannot be combined with riskBucketId",
|
|
246
|
+
path: ["options", "riskBucketId"],
|
|
247
|
+
})
|
|
248
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.riskBucketCollateral === undefined, {
|
|
249
|
+
message: "marginMode CROSS cannot be combined with riskBucketCollateral",
|
|
250
|
+
path: ["options", "riskBucketCollateral"],
|
|
251
|
+
})
|
|
252
|
+
.refine((data) => data.options?.marginMode !== "CROSS" || data.options?.strategyKey === undefined, {
|
|
253
|
+
message: "marginMode CROSS cannot be combined with strategyKey",
|
|
254
|
+
path: ["options", "strategyKey"],
|
|
210
255
|
})
|
|
211
256
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.riskBucketId === undefined, {
|
|
212
257
|
message: "riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",
|
|
@@ -298,6 +343,7 @@ export const BatchCreateOrderItemSchema = z
|
|
|
298
343
|
expirationDate: ISO8601DateSchema.optional(),
|
|
299
344
|
timeInForce: TimeInForceSchema.optional(),
|
|
300
345
|
marginAccountId: UUIDSchema.optional(),
|
|
346
|
+
marginMode: MarginModeSchema.optional(),
|
|
301
347
|
riskBucketId: UUIDSchema.optional(),
|
|
302
348
|
riskBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
303
349
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
@@ -316,6 +362,26 @@ export const BatchCreateOrderItemSchema = z
|
|
|
316
362
|
.refine((data) => data.riskBucketCollateral === undefined || data.tradingMode === "MARGIN", {
|
|
317
363
|
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
318
364
|
path: ["tradingMode"],
|
|
365
|
+
})
|
|
366
|
+
.refine((data) => data.marginMode === undefined || data.tradingMode === "MARGIN", {
|
|
367
|
+
message: "marginMode is only supported for MARGIN orders",
|
|
368
|
+
path: ["tradingMode"],
|
|
369
|
+
})
|
|
370
|
+
.refine((data) => data.marginMode !== "CROSS" || data.marginAccountId !== undefined, {
|
|
371
|
+
message: "marginAccountId is required for CROSS margin orders",
|
|
372
|
+
path: ["marginAccountId"],
|
|
373
|
+
})
|
|
374
|
+
.refine((data) => data.marginMode !== "CROSS" || data.riskBucketId === undefined, {
|
|
375
|
+
message: "marginMode CROSS cannot be combined with riskBucketId",
|
|
376
|
+
path: ["riskBucketId"],
|
|
377
|
+
})
|
|
378
|
+
.refine((data) => data.marginMode !== "CROSS" || data.riskBucketCollateral === undefined, {
|
|
379
|
+
message: "marginMode CROSS cannot be combined with riskBucketCollateral",
|
|
380
|
+
path: ["riskBucketCollateral"],
|
|
381
|
+
})
|
|
382
|
+
.refine((data) => data.marginMode !== "CROSS" || data.strategyKey === undefined, {
|
|
383
|
+
message: "marginMode CROSS cannot be combined with strategyKey",
|
|
384
|
+
path: ["strategyKey"],
|
|
319
385
|
})
|
|
320
386
|
.refine((data) => data.riskBucketCollateral === undefined || data.riskBucketId === undefined, {
|
|
321
387
|
message: "riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -2330,6 +2330,12 @@ export interface components {
|
|
|
2330
2330
|
* @example my-strategy
|
|
2331
2331
|
*/
|
|
2332
2332
|
strategyKey?: string | null;
|
|
2333
|
+
/**
|
|
2334
|
+
* @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS.
|
|
2335
|
+
* @example CROSS
|
|
2336
|
+
* @enum {string|null}
|
|
2337
|
+
*/
|
|
2338
|
+
marginMode?: "ISOLATED" | "CROSS" | null;
|
|
2333
2339
|
};
|
|
2334
2340
|
BatchCreateOrdersRequest: {
|
|
2335
2341
|
orders: components["schemas"]["BatchCreateOrderItem"][];
|
|
@@ -2759,6 +2765,12 @@ export interface components {
|
|
|
2759
2765
|
* @example my-strategy
|
|
2760
2766
|
*/
|
|
2761
2767
|
strategyKey?: string | null;
|
|
2768
|
+
/**
|
|
2769
|
+
* @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS.
|
|
2770
|
+
* @example CROSS
|
|
2771
|
+
* @enum {string|null}
|
|
2772
|
+
*/
|
|
2773
|
+
marginMode?: "ISOLATED" | "CROSS" | null;
|
|
2762
2774
|
};
|
|
2763
2775
|
CreateOrderResponse: {
|
|
2764
2776
|
/**
|
|
@@ -3192,6 +3204,7 @@ export interface components {
|
|
|
3192
3204
|
strategyKey?: string | null;
|
|
3193
3205
|
riskBucketId?: string | null;
|
|
3194
3206
|
marginMode?: string | null;
|
|
3207
|
+
selectedTradingPairIds?: string[] | null;
|
|
3195
3208
|
};
|
|
3196
3209
|
GetMarkPriceResponse: {
|
|
3197
3210
|
/** Format: uuid */
|
|
@@ -3782,6 +3795,7 @@ export interface components {
|
|
|
3782
3795
|
status?: string | null;
|
|
3783
3796
|
updatedAt?: string | null;
|
|
3784
3797
|
riskBucketId?: string | null;
|
|
3798
|
+
marginMode?: string | null;
|
|
3785
3799
|
};
|
|
3786
3800
|
GetPositionRiskResponse: {
|
|
3787
3801
|
positionId?: string | null;
|
|
@@ -4384,6 +4398,8 @@ export interface components {
|
|
|
4384
4398
|
riskBucketId?: string | null;
|
|
4385
4399
|
/** @description Present only for risk-bucket summary rows. Values: ISOLATED, CROSS. */
|
|
4386
4400
|
marginMode?: string | null;
|
|
4401
|
+
/** @description Present for cross risk-bucket summary rows. */
|
|
4402
|
+
selectedTradingPairIds?: string[] | null;
|
|
4387
4403
|
};
|
|
4388
4404
|
MatchResult: {
|
|
4389
4405
|
/**
|
|
@@ -4573,6 +4589,7 @@ export interface components {
|
|
|
4573
4589
|
status?: string | null;
|
|
4574
4590
|
updatedAt?: string | null;
|
|
4575
4591
|
riskBucketId?: string | null;
|
|
4592
|
+
marginMode?: string | null;
|
|
4576
4593
|
};
|
|
4577
4594
|
PositionHistoryEvent: {
|
|
4578
4595
|
id?: string | null;
|
|
@@ -4960,6 +4977,12 @@ export interface components {
|
|
|
4960
4977
|
marginAccountId?: string | null;
|
|
4961
4978
|
/** @description Populated when the simulated account is an auto-resolved bucket. */
|
|
4962
4979
|
strategyKey?: string | null;
|
|
4980
|
+
/** @description Present when the simulation resolved against a risk bucket. */
|
|
4981
|
+
riskBucketId?: string | null;
|
|
4982
|
+
/** @description Present when the simulation resolved against a risk bucket. Values: ISOLATED, CROSS. */
|
|
4983
|
+
marginMode?: string | null;
|
|
4984
|
+
/** @description Present for cross risk-bucket simulations. */
|
|
4985
|
+
selectedTradingPairIds?: string[] | null;
|
|
4963
4986
|
};
|
|
4964
4987
|
SimulateParentMarginOrderRiskRequest: {
|
|
4965
4988
|
/** Format: uuid */
|
|
@@ -4983,6 +5006,10 @@ export interface components {
|
|
|
4983
5006
|
quantity?: string | null;
|
|
4984
5007
|
leverage?: string | null;
|
|
4985
5008
|
reduceOnly?: boolean | null;
|
|
5009
|
+
/** @description Risk bucket mode. Defaults to ISOLATED. Values: ISOLATED, CROSS. */
|
|
5010
|
+
marginMode?: string | null;
|
|
5011
|
+
/** @description Trading pair UUIDs selected into the cross risk bucket. Required when marginMode is CROSS. */
|
|
5012
|
+
selectedTradingPairIds?: string[] | null;
|
|
4986
5013
|
};
|
|
4987
5014
|
SubAccount: {
|
|
4988
5015
|
/**
|
|
@@ -5313,6 +5340,12 @@ export interface components {
|
|
|
5313
5340
|
newTotalCollateralValue?: string | null;
|
|
5314
5341
|
newWithdrawableCollateral?: string | null;
|
|
5315
5342
|
strategyKey?: string | null;
|
|
5343
|
+
/** @description Present when collateral was allocated to a risk bucket. */
|
|
5344
|
+
riskBucketId?: string | null;
|
|
5345
|
+
/** @description Present when collateral was allocated to a risk bucket. Values: ISOLATED, CROSS. */
|
|
5346
|
+
marginMode?: string | null;
|
|
5347
|
+
/** @description Present for cross risk-bucket transfers. */
|
|
5348
|
+
selectedTradingPairIds?: string[] | null;
|
|
5316
5349
|
};
|
|
5317
5350
|
TransferCollateralToParentMarginAccountRequest: {
|
|
5318
5351
|
asset?: string | null;
|
|
@@ -5323,10 +5356,15 @@ export interface components {
|
|
|
5323
5356
|
amount?: string | null;
|
|
5324
5357
|
/**
|
|
5325
5358
|
* Format: uuid
|
|
5326
|
-
* @description Trading pair UUID whose risk bucket receives collateral.
|
|
5359
|
+
* @description Trading pair UUID whose isolated risk bucket receives collateral.
|
|
5360
|
+
* Required for isolated risk buckets; omitted for cross risk buckets.
|
|
5327
5361
|
*/
|
|
5328
5362
|
tradingPairId?: string | null;
|
|
5329
5363
|
strategyKey?: string | null;
|
|
5364
|
+
/** @description Risk bucket mode. Defaults to ISOLATED. Values: ISOLATED, CROSS. */
|
|
5365
|
+
marginMode?: string | null;
|
|
5366
|
+
/** @description Trading pair UUIDs selected into the cross risk bucket. Required when marginMode is CROSS. */
|
|
5367
|
+
selectedTradingPairIds?: string[] | null;
|
|
5330
5368
|
};
|
|
5331
5369
|
UpdateLimitRequest: {
|
|
5332
5370
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint": "biome lint ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/contracts": "0.8.
|
|
23
|
+
"@0xmonaco/contracts": "0.8.19",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|