@0xmonaco/types 1.0.72 → 1.0.73-develop.af0f5d0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildercodes/index.d.ts +7 -3
- package/dist/buildercodes/index.js +1 -1
- package/dist/buildercodes/responses.d.ts +59 -3
- package/dist/buildercodes/responses.js +38 -3
- package/dist/copy-trading/index.d.ts +7 -7
- package/dist/delegated-agents/index.d.ts +15 -5
- package/dist/margin-accounts/index.d.ts +114 -10
- package/dist/pitpass/index.d.ts +21 -6
- package/dist/pitpass/index.js +1 -1
- package/dist/pitpass/responses.d.ts +46 -0
- package/dist/pitpass/responses.js +56 -1
- package/dist/portfolio/index.d.ts +36 -14
- package/dist/trading/orders.d.ts +1 -1
- package/dist/trading/responses.d.ts +18 -6
- package/dist/validation/margin-accounts.d.ts +34 -0
- package/dist/validation/margin-accounts.js +40 -0
- package/dist/websocket/events/liquidation-events.d.ts +3 -3
- package/dist/websocket/events/orders-events.d.ts +6 -0
- package/dist/websocket/events/position-events.d.ts +18 -15
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +7 -0
- package/dist/wire/schema.d.ts +995 -83
- package/package.json +2 -2
|
@@ -166,15 +166,15 @@ export interface PortfolioMarginTotal {
|
|
|
166
166
|
* bound the engine enforces on transfers-out and withdrawals, and therefore
|
|
167
167
|
* also the effective ceiling on funding new isolated or first-use order
|
|
168
168
|
* capacity (allocating collateral to a risk bucket passes through the same
|
|
169
|
-
*
|
|
169
|
+
* capacity-gated door).
|
|
170
170
|
*
|
|
171
171
|
* NOT a clamped `parentAvailableCollateral`: that is an equity figure which
|
|
172
|
-
* credits
|
|
173
|
-
* transfer-out cannot move. This bound never
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* the bound
|
|
172
|
+
* credits unrealized gains and realized PnL still held in open risk
|
|
173
|
+
* buckets, which a transfer-out of the parent cannot move. This bound never
|
|
174
|
+
* credits an unrealized gain; it counts net deposits plus the account's
|
|
175
|
+
* settled realized PnL and funding, less what risk buckets have allocated —
|
|
176
|
+
* `min(net deposits + settled realized PnL - bucket allocations, freeCollateral - max(unrealizedPnl, 0))`,
|
|
177
|
+
* floored at zero. This is the bound the engine's gates actually enforce. Size transfers-out, withdrawals, and
|
|
178
178
|
* new isolated or first-use positions from this field;
|
|
179
179
|
* `parentAvailableCollateral` remains the trading-margin headroom for
|
|
180
180
|
* existing cross exposure.
|
|
@@ -196,12 +196,14 @@ export interface PortfolioRiskBucket {
|
|
|
196
196
|
positionCount: number;
|
|
197
197
|
/**
|
|
198
198
|
* The largest transfer-out of this risk bucket the engine will actually
|
|
199
|
-
* accept. NOT a clamped `freeCollateral`:
|
|
200
|
-
*
|
|
201
|
-
* and
|
|
202
|
-
*
|
|
203
|
-
* an
|
|
204
|
-
*
|
|
199
|
+
* accept. NOT a clamped `freeCollateral`: the bucket's allocated
|
|
200
|
+
* collateral plus its realized PnL, less funding paid, unrealized losses
|
|
201
|
+
* and the margin its positions and resting orders require. Realized profit
|
|
202
|
+
* can leave a live bucket this way (the bucket's allocation may go
|
|
203
|
+
* negative); an unrealized gain never raises it. This is the largest
|
|
204
|
+
* accepted transfer-out, and every smaller amount is accepted too. It is
|
|
205
|
+
* zero on a risk bucket that is not `NORMAL` and on one whose realized loss
|
|
206
|
+
* has used up its allocation.
|
|
205
207
|
*/
|
|
206
208
|
withdrawableCollateral: string;
|
|
207
209
|
/**
|
|
@@ -267,11 +269,31 @@ export interface PortfolioRiskBucket {
|
|
|
267
269
|
*/
|
|
268
270
|
tradingPairId?: string;
|
|
269
271
|
}
|
|
272
|
+
/** One of the caller's open margin accounts in the owner rollup. */
|
|
273
|
+
export interface PortfolioMarginAccount {
|
|
274
|
+
marginAccountId: string;
|
|
275
|
+
/** `default` for the default margin account, else the sub-account's key. */
|
|
276
|
+
subaccountKey: string;
|
|
277
|
+
/** The account's totals; `withdrawableCollateral` is the persisted reconstruction of the engine's bound. */
|
|
278
|
+
total: PortfolioMarginTotal;
|
|
279
|
+
}
|
|
270
280
|
export interface PortfolioMargin {
|
|
271
281
|
asOf: string;
|
|
272
282
|
total: PortfolioMarginTotal;
|
|
273
283
|
positions: PortfolioMarginPositionCounts;
|
|
274
284
|
riskBuckets: PortfolioRiskBucket[];
|
|
285
|
+
/** The margin account `total`, `positions` and `riskBuckets` describe; absent before the first margin account. */
|
|
286
|
+
marginAccountId?: string;
|
|
287
|
+
/** With `includeAccounts`: every open margin account, the default one first. */
|
|
288
|
+
accounts?: PortfolioMarginAccount[];
|
|
289
|
+
/** With `includeAccounts`: the sum of `accounts`' totals (the owner rollup). */
|
|
290
|
+
ownerTotal?: PortfolioMarginTotal;
|
|
291
|
+
}
|
|
292
|
+
export interface PortfolioMarginParams {
|
|
293
|
+
/** One of your margin accounts (default or a sub-account) to describe instead of the default one. */
|
|
294
|
+
marginAccountId?: string;
|
|
295
|
+
/** Also return every open margin account's totals and their sum. */
|
|
296
|
+
includeAccounts?: boolean;
|
|
275
297
|
}
|
|
276
298
|
/** Authoritative, application-scoped portfolio analytics. */
|
|
277
299
|
export interface PortfolioAPI extends BaseAPI {
|
|
@@ -279,5 +301,5 @@ export interface PortfolioAPI extends BaseAPI {
|
|
|
279
301
|
getPerformance(params?: PortfolioPeriodParams): Promise<PortfolioPerformance>;
|
|
280
302
|
getRealizedPnl(params?: PortfolioPeriodParams): Promise<PortfolioRealizedPnl>;
|
|
281
303
|
getAssets(params?: PortfolioPeriodParams): Promise<PortfolioAssets>;
|
|
282
|
-
getMargin(): Promise<PortfolioMargin>;
|
|
304
|
+
getMargin(params?: PortfolioMarginParams): Promise<PortfolioMargin>;
|
|
283
305
|
}
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ export interface Order {
|
|
|
178
178
|
version?: number;
|
|
179
179
|
}
|
|
180
180
|
/** Stable terminal causes for accepted orders that end as CANCELLED. */
|
|
181
|
-
export type OrderTerminalReason = "USER_REQUESTED" | "REPLACED" | "LIQUIDATION" | "INSUFFICIENT_MARGIN" | "REDUCE_ONLY_EXHAUSTED" | "POSITION_CLOSED" | "OCO_SIBLING_TRIGGERED" | "SELF_TRADE_PREVENTION" | "SYSTEM";
|
|
181
|
+
export type OrderTerminalReason = "USER_REQUESTED" | "REPLACED" | "LIQUIDATION" | "INSUFFICIENT_MARGIN" | "REDUCE_ONLY_EXHAUSTED" | "POSITION_CLOSED" | "OCO_SIBLING_TRIGGERED" | "SELF_TRADE_PREVENTION" | "AUTO_DELEVERAGING" | "SYSTEM";
|
|
182
182
|
/**
|
|
183
183
|
* Role of the creator or order
|
|
184
184
|
*/
|
|
@@ -159,7 +159,7 @@ export interface ReplaceOrderResponse {
|
|
|
159
159
|
status: "SUCCESS" | "FAILED";
|
|
160
160
|
/** Operation message */
|
|
161
161
|
message: string;
|
|
162
|
-
/**
|
|
162
|
+
/** The replacement's price and total quantity (see {@link UpdatedFields}) */
|
|
163
163
|
updatedFields: UpdatedFields;
|
|
164
164
|
/** Original order identifier that was replaced */
|
|
165
165
|
originalOrderId?: string;
|
|
@@ -167,12 +167,19 @@ export interface ReplaceOrderResponse {
|
|
|
167
167
|
matchResult?: MatchResult;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* The replacement's price and quantity, as the replace operation placed them
|
|
171
171
|
*/
|
|
172
172
|
export interface UpdatedFields {
|
|
173
|
-
/**
|
|
173
|
+
/** The replacement's price: the requested price, or the original order's when omitted */
|
|
174
174
|
price?: string;
|
|
175
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* The replacement's TOTAL quantity, not its resting size: the requested
|
|
177
|
+
* quantity, or the original order's total when omitted. A 100-lot with 60
|
|
178
|
+
* filled reports "100" and rests 40; read the order's `remainingQuantity`
|
|
179
|
+
* for the resting size. For a margin reduce-only replacement it is the close
|
|
180
|
+
* size placed (the requested quantity, or the original's remaining quantity
|
|
181
|
+
* when omitted).
|
|
182
|
+
*/
|
|
176
183
|
quantity?: string;
|
|
177
184
|
}
|
|
178
185
|
/**
|
|
@@ -336,7 +343,7 @@ export interface BatchReplaceResult {
|
|
|
336
343
|
originalOrderId: string;
|
|
337
344
|
/** New order identifier (if successful) */
|
|
338
345
|
newOrderId?: string;
|
|
339
|
-
/**
|
|
346
|
+
/** The replacement's price and total quantity, if successful (see {@link UpdatedFields}) */
|
|
340
347
|
updatedFields?: UpdatedFields;
|
|
341
348
|
/** Match result information if the new order was processed */
|
|
342
349
|
matchResult?: MatchResult;
|
|
@@ -435,7 +442,12 @@ export interface BatchReplaceOrderParams {
|
|
|
435
442
|
orderId: string;
|
|
436
443
|
/** New order price (optional) */
|
|
437
444
|
price?: string;
|
|
438
|
-
/**
|
|
445
|
+
/**
|
|
446
|
+
* New TOTAL order quantity (optional): the replacement rests this total
|
|
447
|
+
* minus the already-filled amount, so it must exceed the filled amount.
|
|
448
|
+
* Omitted, the order keeps its total. A margin reduce-only quantity is a
|
|
449
|
+
* close size, placed as given.
|
|
450
|
+
*/
|
|
439
451
|
quantity?: string;
|
|
440
452
|
/** For sub-accounts: use master's balance (optional) */
|
|
441
453
|
useMasterBalance?: boolean;
|
|
@@ -50,12 +50,14 @@ export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
|
|
|
50
50
|
tradingPairId: z.ZodUUID;
|
|
51
51
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
52
52
|
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
53
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
53
54
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
54
55
|
applyToPositionMargin: z.ZodOptional<z.ZodBoolean>;
|
|
55
56
|
}, z.core.$strict>, z.ZodObject<{
|
|
56
57
|
asset: z.ZodString;
|
|
57
58
|
amount: z.ZodString;
|
|
58
59
|
marginMode: z.ZodLiteral<"CROSS">;
|
|
60
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
59
61
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
60
62
|
strategyKey: z.ZodOptional<z.ZodNever>;
|
|
61
63
|
tradingPairId: z.ZodOptional<z.ZodNever>;
|
|
@@ -154,6 +156,7 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
154
156
|
tradingPairId: z.ZodUUID;
|
|
155
157
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
156
158
|
marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
|
|
159
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
157
160
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
158
161
|
applyToPositionMargin: z.ZodOptional<z.ZodBoolean>;
|
|
159
162
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -177,7 +180,38 @@ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
|
177
180
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
178
181
|
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
179
182
|
marginMode: z.ZodLiteral<"CROSS">;
|
|
183
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
180
184
|
selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
|
|
181
185
|
strategyKey: z.ZodOptional<z.ZodNever>;
|
|
182
186
|
}, z.core.$strict>]>>;
|
|
183
187
|
}, z.core.$strip>;
|
|
188
|
+
export declare const CreateMarginSubAccountSchema: z.ZodObject<{
|
|
189
|
+
request: z.ZodObject<{
|
|
190
|
+
subaccountKey: z.ZodString;
|
|
191
|
+
label: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, z.core.$strict>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
export declare const CloseMarginSubAccountSchema: z.ZodObject<{
|
|
195
|
+
marginAccountId: z.ZodUUID;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
export declare const GetMarginAccountPnlSchema: z.ZodObject<{
|
|
198
|
+
marginAccountId: z.ZodUUID;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export declare const TransferMarginCollateralSchema: z.ZodObject<{
|
|
201
|
+
request: z.ZodObject<{
|
|
202
|
+
asset: z.ZodString;
|
|
203
|
+
amount: z.ZodString;
|
|
204
|
+
from: z.ZodUnion<readonly [z.ZodObject<{
|
|
205
|
+
wallet: z.ZodLiteral<true>;
|
|
206
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
207
|
+
marginAccountId: z.ZodUUID;
|
|
208
|
+
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
209
|
+
}, z.core.$strict>]>;
|
|
210
|
+
to: z.ZodUnion<readonly [z.ZodObject<{
|
|
211
|
+
wallet: z.ZodLiteral<true>;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
marginAccountId: z.ZodUUID;
|
|
214
|
+
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
215
|
+
}, z.core.$strict>]>;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
}, z.core.$strip>;
|
|
@@ -49,6 +49,9 @@ const RiskBucketRequestSchema = z.object({
|
|
|
49
49
|
});
|
|
50
50
|
const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
|
|
51
51
|
marginMode: z.literal("ISOLATED").optional(),
|
|
52
|
+
// A sub-account funds and previews its own risk buckets; omitted means the
|
|
53
|
+
// default margin account.
|
|
54
|
+
marginAccountId: UUIDSchema.optional(),
|
|
52
55
|
selectedTradingPairIds: z.never().optional(),
|
|
53
56
|
// Omitted defaults server-side to true (the Adjust Margin gesture); false
|
|
54
57
|
// is the plain allocation programmatic funding loops need. The CROSS form
|
|
@@ -64,6 +67,7 @@ const IsolatedRiskBucketRequestSchema = RiskBucketRequestSchema.extend({
|
|
|
64
67
|
// the pair being previewed, not a scope declaration.
|
|
65
68
|
const CrossRiskBucketSimulateRequestSchema = z.object({
|
|
66
69
|
marginMode: z.literal("CROSS"),
|
|
70
|
+
marginAccountId: UUIDSchema.optional(),
|
|
67
71
|
selectedTradingPairIds: z.never().optional(),
|
|
68
72
|
strategyKey: z.never().optional(),
|
|
69
73
|
});
|
|
@@ -74,6 +78,7 @@ const CrossRiskBucketSimulateRequestSchema = z.object({
|
|
|
74
78
|
// it does nothing rather than believing it took effect.
|
|
75
79
|
const CrossRiskBucketRequestSchema = z.object({
|
|
76
80
|
marginMode: z.literal("CROSS"),
|
|
81
|
+
marginAccountId: UUIDSchema.optional(),
|
|
77
82
|
selectedTradingPairIds: z.never().optional(),
|
|
78
83
|
strategyKey: z.never().optional(),
|
|
79
84
|
tradingPairId: z.never().optional(),
|
|
@@ -223,3 +228,38 @@ export const SimulateRiskBucketOrderRiskSchema = z
|
|
|
223
228
|
message: "price is required for LIMIT risk simulations",
|
|
224
229
|
path: ["request", "price"],
|
|
225
230
|
});
|
|
231
|
+
export const CreateMarginSubAccountSchema = z.object({
|
|
232
|
+
request: z
|
|
233
|
+
.object({
|
|
234
|
+
subaccountKey: z
|
|
235
|
+
.string()
|
|
236
|
+
.trim()
|
|
237
|
+
.min(1, "subaccountKey is required")
|
|
238
|
+
.max(64, "subaccountKey must be at most 64 characters")
|
|
239
|
+
.regex(/^[A-Za-z0-9_.:-]+$/, "subaccountKey may contain only letters, digits, '_', '-', '.' and ':'")
|
|
240
|
+
.refine((key) => !key.toLowerCase().startsWith("copy:"), "sub-account keys starting with copy: are reserved")
|
|
241
|
+
.refine((key) => key !== "default", "default names the default margin account"),
|
|
242
|
+
label: z.string().optional(),
|
|
243
|
+
})
|
|
244
|
+
.strict(),
|
|
245
|
+
});
|
|
246
|
+
export const CloseMarginSubAccountSchema = z.object({
|
|
247
|
+
marginAccountId: UUIDSchema,
|
|
248
|
+
});
|
|
249
|
+
export const GetMarginAccountPnlSchema = z.object({
|
|
250
|
+
marginAccountId: UUIDSchema,
|
|
251
|
+
});
|
|
252
|
+
const CollateralTransferEndpointSchema = z.union([
|
|
253
|
+
z.object({ wallet: z.literal(true) }).strict(),
|
|
254
|
+
z.object({ marginAccountId: UUIDSchema, riskBucketId: UUIDSchema.optional() }).strict(),
|
|
255
|
+
]);
|
|
256
|
+
export const TransferMarginCollateralSchema = z.object({
|
|
257
|
+
request: z
|
|
258
|
+
.object({
|
|
259
|
+
asset: z.string().trim().min(1, "Asset is required"),
|
|
260
|
+
amount: PositiveDecimalStringSchema,
|
|
261
|
+
from: CollateralTransferEndpointSchema,
|
|
262
|
+
to: CollateralTransferEndpointSchema,
|
|
263
|
+
})
|
|
264
|
+
.strict(),
|
|
265
|
+
});
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* Liquidation alert event data.
|
|
14
14
|
*
|
|
15
|
-
* `status` and `
|
|
15
|
+
* `status` and `riskBucketState` are free-form strings on the wire (they mirror
|
|
16
16
|
* server-side enums that carry no wire-level rename), so they are typed as
|
|
17
17
|
* `string` rather than a closed union to avoid dropping a risk-critical alert
|
|
18
18
|
* on an unexpected value.
|
|
@@ -28,8 +28,8 @@ export interface LiquidationEventData {
|
|
|
28
28
|
tradingPairId?: string;
|
|
29
29
|
/** Liquidation record status (e.g. "UNRESOLVED", free-form) */
|
|
30
30
|
status: string;
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/** The liquidated risk bucket's state at alert time (e.g. "PENDING_LIQUIDATION", free-form) */
|
|
32
|
+
riskBucketState: string;
|
|
33
33
|
/** Position liquidation price, when known (decimal string) */
|
|
34
34
|
liquidationPrice?: string;
|
|
35
35
|
/** Mark price at alert time, when known (decimal string) */
|
|
@@ -179,6 +179,12 @@ export interface CommonOrderEventData {
|
|
|
179
179
|
* Wire: `parent_order_id`.
|
|
180
180
|
*/
|
|
181
181
|
parentOrderId?: string;
|
|
182
|
+
/**
|
|
183
|
+
* The margin account the order trades on: the default margin account or one
|
|
184
|
+
* of your sub-accounts, so an owner can route events per account. Omitted for
|
|
185
|
+
* a spot order and by servers predating the field. Wire: `margin_account_id`.
|
|
186
|
+
*/
|
|
187
|
+
marginAccountId?: string;
|
|
182
188
|
/**
|
|
183
189
|
* The margin position this order is bound to: the same id REST `getOrder`
|
|
184
190
|
* returns as `positionId`. A margin order placed while its margin account
|
|
@@ -42,7 +42,14 @@ export interface PositionEventData {
|
|
|
42
42
|
side: PositionEventSide | (string & {});
|
|
43
43
|
/** Position lifecycle status (SCREAMING_SNAKE_CASE on the wire, e.g. "OPEN") */
|
|
44
44
|
status: PositionEventStatus | (string & {});
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Absolute position size (decimal string). Open frames carry current size;
|
|
47
|
+
* terminal frames normally carry lifetime reduced quantity — the sum of
|
|
48
|
+
* every reducing execution, not only the exposure before the final close.
|
|
49
|
+
* After restart, incomplete legacy size history carries the known partial
|
|
50
|
+
* quantity and leaves the frame unranked. Detect closure from `status`,
|
|
51
|
+
* never from `size === "0"`.
|
|
52
|
+
*/
|
|
46
53
|
size: string;
|
|
47
54
|
/** Average entry price (decimal string) */
|
|
48
55
|
entryPrice: string;
|
|
@@ -144,14 +151,10 @@ export interface PositionEventData {
|
|
|
144
151
|
* an unranked frame is not comparable with a snapshot row even when their
|
|
145
152
|
* state matches.
|
|
146
153
|
* Absent means UNRANKED, never "oldest", and it does NOT tell you whether
|
|
147
|
-
* anything was persisted.
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* frame is a different projection of the row
|
|
152
|
-
* than persistence stores (terminal frames report `size` 0 and
|
|
153
|
-
* `LIQUIDATED`, while the stored row keeps its size and records `CLOSED`).
|
|
154
|
-
* In the last two, a REST read or a fresh snapshot ranks the mutation.
|
|
154
|
+
* anything was persisted. Current cases are a producer predating this field,
|
|
155
|
+
* an emit path whose command wrote no position row, or a terminal frame
|
|
156
|
+
* rebuilt after restart from legacy reduction history that lacks the size or
|
|
157
|
+
* margin fields needed to reconstruct complete lifetime values.
|
|
155
158
|
* Fall back to a full field comparison rather than ranking it lowest.
|
|
156
159
|
*
|
|
157
160
|
* The merge rule is PER FIELD GROUP, never per frame. On a higher version
|
|
@@ -172,15 +175,15 @@ export interface PositionEventData {
|
|
|
172
175
|
* mutation — up to the one-hour funding interval.
|
|
173
176
|
*
|
|
174
177
|
* A frame is ranked only when it is a faithful projection of the row
|
|
175
|
-
* persisted at that sequence: fills
|
|
176
|
-
* isolated-position margin adds/reductions,
|
|
178
|
+
* persisted at that sequence: fills, non-zero funding settlements, terminal
|
|
179
|
+
* closes/liquidations/ADL, direct isolated-position margin adds/reductions,
|
|
180
|
+
* and copy-position margin adds. Funding carries state captured inside its
|
|
181
|
+
* sequencer command; terminal frames retain lifetime reduced quantity and
|
|
182
|
+
* exact CLOSED/LIQUIDATED classification.
|
|
177
183
|
* The copy add refreshes the isolated child and its copy-cross siblings at
|
|
178
184
|
* the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop
|
|
179
185
|
* refreshes use `margin_added`/`margin_reduced` but are UNRANKED because
|
|
180
|
-
* those commands write no position rows.
|
|
181
|
-
* sequencing and is also unranked. TERMINAL frames are unranked because
|
|
182
|
-
* they report `size` 0 and `LIQUIDATED` while the stored row keeps its size
|
|
183
|
-
* and records `CLOSED`. Wallet IN/OUT and plain isolated allocation emit no
|
|
186
|
+
* those commands write no position rows. Wallet IN/OUT and plain isolated allocation emit no
|
|
184
187
|
* position frame. Transfer frames use captured post-command state and are
|
|
185
188
|
* released only after durable acknowledgement.
|
|
186
189
|
*/
|
|
@@ -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 ["add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "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_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_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_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "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", "stop_follow", "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", "upsert_follow", "upsert_lead_trader", "verify_signature"];
|
|
13
|
+
export declare const OPERATION_IDS: readonly ["add_follow_position_margin", "attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_all_copy_positions", "close_follow_positions", "close_position", "close_sub_account", "create_challenge", "create_delegated_session", "create_order", "create_sub_account", "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_follow", "get_funding_state", "get_index_price", "get_lead_trader", "get_margin_account_movements", "get_margin_account_pnl", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_lead_trader", "get_my_referral_downline", "get_my_referral_position", "get_my_referral_tree", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_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_builder_fee_changes", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_follow_leader_positions", "list_funding_history", "list_funding_payments", "list_lead_trader_closed_trades", "list_lead_trader_open_positions", "list_lead_traders", "list_managed_market_assignments", "list_margin_accounts", "list_my_followers", "list_my_follows", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "preview_follow", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_builder_fee", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "stop_follow", "submit_whitelist", "transfer_collateral", "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", "upsert_follow", "upsert_lead_trader", "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
|
@@ -29,9 +29,11 @@ export const OPERATION_IDS = [
|
|
|
29
29
|
"close_all_copy_positions",
|
|
30
30
|
"close_follow_positions",
|
|
31
31
|
"close_position",
|
|
32
|
+
"close_sub_account",
|
|
32
33
|
"create_challenge",
|
|
33
34
|
"create_delegated_session",
|
|
34
35
|
"create_order",
|
|
36
|
+
"create_sub_account",
|
|
35
37
|
"create_sub_account_limit",
|
|
36
38
|
"create_twap_order",
|
|
37
39
|
"delete_sub_account_limit",
|
|
@@ -49,6 +51,7 @@ export const OPERATION_IDS = [
|
|
|
49
51
|
"get_index_price",
|
|
50
52
|
"get_lead_trader",
|
|
51
53
|
"get_margin_account_movements",
|
|
54
|
+
"get_margin_account_pnl",
|
|
52
55
|
"get_margin_account_summary",
|
|
53
56
|
"get_mark_price",
|
|
54
57
|
"get_market_metadata",
|
|
@@ -57,6 +60,7 @@ export const OPERATION_IDS = [
|
|
|
57
60
|
"get_my_lead_trader",
|
|
58
61
|
"get_my_referral_downline",
|
|
59
62
|
"get_my_referral_position",
|
|
63
|
+
"get_my_referral_tree",
|
|
60
64
|
"get_my_trader_code",
|
|
61
65
|
"get_open_interest",
|
|
62
66
|
"get_order_by_id",
|
|
@@ -101,6 +105,7 @@ export const OPERATION_IDS = [
|
|
|
101
105
|
"list_application_movements",
|
|
102
106
|
"list_application_orders",
|
|
103
107
|
"list_application_users",
|
|
108
|
+
"list_builder_fee_changes",
|
|
104
109
|
"list_buildercode_payouts",
|
|
105
110
|
"list_conditional_orders",
|
|
106
111
|
"list_delegated_agent_owners",
|
|
@@ -129,6 +134,7 @@ export const OPERATION_IDS = [
|
|
|
129
134
|
"replace_order",
|
|
130
135
|
"revoke_delegated_agent",
|
|
131
136
|
"revoke_session",
|
|
137
|
+
"set_builder_fee",
|
|
132
138
|
"set_self_trade_prevention_default",
|
|
133
139
|
"set_trader_code",
|
|
134
140
|
"simulate_fees",
|
|
@@ -137,6 +143,7 @@ export const OPERATION_IDS = [
|
|
|
137
143
|
"simulate_risk_bucket_order_risk",
|
|
138
144
|
"stop_follow",
|
|
139
145
|
"submit_whitelist",
|
|
146
|
+
"transfer_collateral",
|
|
140
147
|
"transfer_collateral_from_margin_account",
|
|
141
148
|
"transfer_collateral_from_parent_margin_account",
|
|
142
149
|
"transfer_collateral_to_margin_account",
|