@0xmonaco/types 1.0.47 → 1.0.50-develop.9c1b239
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 +75 -2
- package/dist/portfolio/index.d.ts +12 -0
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sweeper/index.d.ts +49 -27
- package/dist/sweeper/index.js +4 -6
- package/dist/trading/orders.d.ts +5 -0
- package/dist/validation/margin-accounts.d.ts +2 -0
- package/dist/validation/margin-accounts.js +4 -0
- package/dist/vault/index.d.ts +7 -1
- package/dist/websocket/base.d.ts +69 -0
- package/dist/websocket/events/account-events.d.ts +8 -5
- package/dist/websocket/events/balance-events.d.ts +1 -1
- package/dist/websocket/events/conditional-order-events.d.ts +71 -9
- package/dist/websocket/events/instrument-events.d.ts +12 -2
- package/dist/websocket/events/market-stats-events.d.ts +6 -1
- package/dist/websocket/events/ohlcv-events.d.ts +8 -3
- package/dist/websocket/events/orderbook-events.d.ts +2 -2
- package/dist/websocket/events/orders-events.d.ts +173 -64
- package/dist/websocket/events/position-events.d.ts +8 -2
- package/dist/websocket/events/trade-events.d.ts +2 -2
- package/dist/websocket/events/twap-order-events.d.ts +24 -6
- package/dist/wire/schema.d.ts +142 -21
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ export interface OrderEvent {
|
|
|
18
18
|
/** Order ID (UUID) */
|
|
19
19
|
orderId: string;
|
|
20
20
|
/** Event type */
|
|
21
|
-
eventType: OrderEventType;
|
|
21
|
+
eventType: OrderEventType | (string & {});
|
|
22
22
|
/** ISO 8601 timestamp */
|
|
23
23
|
timestamp: string;
|
|
24
24
|
/** Event-specific data */
|
|
@@ -46,11 +46,11 @@ export interface CommonOrderEventData {
|
|
|
46
46
|
*/
|
|
47
47
|
tradingPair: string;
|
|
48
48
|
/** Trading mode (e.g., "SPOT", "MARGIN") */
|
|
49
|
-
tradingMode: TradingMode;
|
|
49
|
+
tradingMode: TradingMode | (string & {});
|
|
50
50
|
/** Order type - present in most events */
|
|
51
|
-
orderType?: OrderType;
|
|
51
|
+
orderType?: OrderType | (string & {});
|
|
52
52
|
/** Order side - present in most events */
|
|
53
|
-
side?: OrderSide;
|
|
53
|
+
side?: OrderSide | (string & {});
|
|
54
54
|
/** Order price - present in most events */
|
|
55
55
|
price?: string;
|
|
56
56
|
/** Order quantity - present in most events */
|
|
@@ -58,7 +58,7 @@ export interface CommonOrderEventData {
|
|
|
58
58
|
/** Order quantity in RAW (integer, base-unit) precision. Wire: `quantity_raw`. */
|
|
59
59
|
quantityRaw?: string;
|
|
60
60
|
/** Time in force - present in most events */
|
|
61
|
-
timeInForce?: TimeInForce;
|
|
61
|
+
timeInForce?: TimeInForce | (string & {});
|
|
62
62
|
/**
|
|
63
63
|
* Client-assigned correlation handle, echoed so an event can be matched to
|
|
64
64
|
* the request that placed the order without a round trip to `getOrder`.
|
|
@@ -79,6 +79,45 @@ export interface CommonOrderEventData {
|
|
|
79
79
|
* silence. Omitted when the order carried none. Wire: `client_order_id`.
|
|
80
80
|
*/
|
|
81
81
|
clientOrderId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* `true` when the order was admitted post-only (maker-only), so a subscriber
|
|
84
|
+
* can confirm the flag was honoured without a round trip to `getOrder`.
|
|
85
|
+
* Carried on the `OrderPlaced` acknowledgement, the taker fill, and the
|
|
86
|
+
* resting order's lifecycle — `OrderPartiallyCancelled` (an in-place
|
|
87
|
+
* reduction, which is how an MM's own `remainingQuantityTarget` replace is
|
|
88
|
+
* announced), `OrderCancelled` and `OrderExpired`.
|
|
89
|
+
*
|
|
90
|
+
* Declared on the shared block, but two variants can never carry it, and
|
|
91
|
+
* this optional field is the only thing that says so: a **maker fill**,
|
|
92
|
+
* which is out of scope because a maker already learned the flag from its
|
|
93
|
+
* own acknowledgement; and **`OrderRejected`**, which only ever describes a
|
|
94
|
+
* MARKET order with no liquidity or an unfilled IOC/FOK — and post-only is
|
|
95
|
+
* refused on both, so no post-only order can reach it.
|
|
96
|
+
*
|
|
97
|
+
* Only ever present as `true`: on a variant that CARRIES the field, an order
|
|
98
|
+
* that is not post-only omits the key rather than sending `postOnly: false`,
|
|
99
|
+
* exactly as the REST read model's `postOnly?: boolean` does, so
|
|
100
|
+
* `event.data.postOnly ?? false` reads the same as REST *for that event*.
|
|
101
|
+
*
|
|
102
|
+
* That equivalence is per-event, and it does NOT hold on a maker fill.
|
|
103
|
+
* A post-only order rests and therefore fills as a maker, and the maker
|
|
104
|
+
* payload never declares the field — so `?? false` there would return
|
|
105
|
+
* `false` for an order REST reports as `true`. Absence on a maker fill
|
|
106
|
+
* carries NO information. Track `postOnly` as order-level state learned from
|
|
107
|
+
* the `OrderPlaced` acknowledgement (or a REST read) and carry it forward;
|
|
108
|
+
* never re-derive it from whichever event arrived last.
|
|
109
|
+
*
|
|
110
|
+
* On a carrying variant, absent is not evidence the flag was dropped — it is
|
|
111
|
+
* the ordinary shape of a non-post-only order, and also what an order placed
|
|
112
|
+
* before the flag was persisted reports.
|
|
113
|
+
*
|
|
114
|
+
* A post-only order that WOULD have crossed the book is rejected before
|
|
115
|
+
* acceptance and emits no event at all (see `clientOrderId`), so in practice
|
|
116
|
+
* the flag reaches a subscriber on a resting order's lifecycle — never on a
|
|
117
|
+
* taker fill, which an admitted post-only order cannot produce.
|
|
118
|
+
* Wire: `post_only`.
|
|
119
|
+
*/
|
|
120
|
+
postOnly?: boolean;
|
|
82
121
|
}
|
|
83
122
|
/**
|
|
84
123
|
* OrderPlaced event - emitted when a new order is placed
|
|
@@ -87,54 +126,94 @@ export interface OrderPlacedEvent extends OrderEvent {
|
|
|
87
126
|
eventType: "OrderPlaced";
|
|
88
127
|
data: CommonOrderEventData & {
|
|
89
128
|
/** Order status */
|
|
90
|
-
status: OrderStatus;
|
|
129
|
+
status: OrderStatus | (string & {});
|
|
91
130
|
};
|
|
92
131
|
}
|
|
93
132
|
/**
|
|
94
133
|
* OrderMatched event - emitted when an order is matched but not necessarily filled
|
|
95
|
-
* This event is only emitted for taker orders
|
|
134
|
+
* This event is only emitted for taker orders.
|
|
135
|
+
*
|
|
136
|
+
* Carries the SAME payload as `OrderFilled`/`OrderPartiallyFilled`: the
|
|
137
|
+
* matching engine builds one `TakerOrderEventData` and picks the event type
|
|
138
|
+
* from the resulting status, so every execution field below is on the wire
|
|
139
|
+
* here too.
|
|
140
|
+
*
|
|
141
|
+
* Because this event carries only that one shape, the fields below follow it
|
|
142
|
+
* exactly rather than being uniformly optional. A match that filled nothing
|
|
143
|
+
* still SENDS the keys — `tradeId`, `executionPrice` and `executedAt` arrive as
|
|
144
|
+
* `null`, not absent. Only `lastFillQuantity` and `lastFillQuantityRaw` are
|
|
145
|
+
* ever omitted, being the pair the server skips when there is no incremental
|
|
146
|
+
* fill.
|
|
96
147
|
*/
|
|
97
148
|
export interface OrderMatchedEvent extends OrderEvent {
|
|
98
149
|
eventType: "OrderMatched";
|
|
99
150
|
data: CommonOrderEventData & {
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
151
|
+
/** Fill role of this order (`taker` on this event). */
|
|
152
|
+
role: OrderRole | (string & {});
|
|
153
|
+
/** Trade ID of the first trade this event covers. `null` when it covers none. */
|
|
154
|
+
tradeId: string | null;
|
|
155
|
+
/** Execution price of the first trade this event covers. `null` when it covers none. */
|
|
156
|
+
executionPrice: string | null;
|
|
157
|
+
/** Cumulative quantity filled on the order at this event. Wire: `filled_quantity`. */
|
|
158
|
+
filledQuantity: string;
|
|
159
|
+
/** `filledQuantity` in RAW (integer, base-unit) precision. Wire: `filled_quantity_raw`. */
|
|
160
|
+
filledQuantityRaw: string;
|
|
161
|
+
/** Incremental quantity filled by THIS event. Omitted when there is no fill. Wire: `last_fill_quantity`. */
|
|
162
|
+
lastFillQuantity?: string;
|
|
163
|
+
/** `lastFillQuantity` in RAW (integer, base-unit) precision. Omitted with it. Wire: `last_fill_quantity_raw`. */
|
|
164
|
+
lastFillQuantityRaw?: string;
|
|
165
|
+
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
166
|
+
remainingQuantityRaw: string;
|
|
167
|
+
/**
|
|
168
|
+
* Monaco fee for the fills this event covers, in normalized decimal QUOTE
|
|
169
|
+
* units (negative = maker rebate). Excludes the application taker fee, so
|
|
170
|
+
* it is smaller than the order echo's `totalTakerFees` for an application
|
|
171
|
+
* that charges one, and equal to it for one that does not. Wire: `fee`.
|
|
172
|
+
*/
|
|
173
|
+
fee: string;
|
|
174
|
+
/**
|
|
175
|
+
* `fee` in RAW quote-unit precision (scaled by 10^quoteDecimals). Always a
|
|
176
|
+
* whole number -- the engine truncates every fee to an integral raw unit
|
|
177
|
+
* when it stores it -- so `fee` is exactly this value divided by
|
|
178
|
+
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
179
|
+
*/
|
|
180
|
+
feeRaw: string;
|
|
181
|
+
/** Execution timestamp of the first trade this event covers (ISO 8601). `null` when it covers none. */
|
|
182
|
+
executedAt: string | null;
|
|
183
|
+
/** Reference price used for slippage calculation. `null` when unset. */
|
|
184
|
+
referencePrice: string | null;
|
|
185
|
+
/** Best price achieved in matching. `null` when unset. */
|
|
186
|
+
bestPrice: string | null;
|
|
187
|
+
/** Worst price achieved in matching. `null` when unset. */
|
|
188
|
+
worstPrice: string | null;
|
|
189
|
+
/** Actual slippage in basis points. `null` when unset. */
|
|
190
|
+
actualSlippageBps: number | null;
|
|
191
|
+
/** Maximum allowed slippage in basis points. `null` when unset. */
|
|
192
|
+
maxSlippageBps: number | null;
|
|
193
|
+
/** Number of trades executed. */
|
|
194
|
+
tradesCount: number;
|
|
195
|
+
/** Remaining quantity to be filled. */
|
|
196
|
+
remainingQuantity: string;
|
|
197
|
+
/** Average fill price across all trades. `null` when there is none. */
|
|
198
|
+
averageFillPrice: string | null;
|
|
199
|
+
/** Order status. */
|
|
200
|
+
status: OrderStatus | (string & {});
|
|
122
201
|
};
|
|
123
202
|
}
|
|
124
203
|
/**
|
|
125
204
|
* OrderPartiallyFilled event - emitted when an order is partially filled
|
|
126
|
-
* Can be emitted for both taker and maker orders with different field sets
|
|
205
|
+
* Can be emitted for both taker and maker orders with different field sets.
|
|
127
206
|
*
|
|
128
|
-
* Taker events
|
|
129
|
-
*
|
|
207
|
+
* Taker events add `trades_count` and the slippage fields; maker events add
|
|
208
|
+
* `trade_id` and `execution_price`. Both roles report the cumulative fill as
|
|
209
|
+
* `filled_quantity` and this event's increment as `last_fill_quantity`, and
|
|
210
|
+
* both carry the fill charge as `fee` (0XM-2389). `total_filled`,
|
|
211
|
+
* `execution_quantity` and `maker_fee` were never emitted on a fill payload
|
|
212
|
+
* and are not declared here.
|
|
130
213
|
*/
|
|
131
214
|
export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
132
215
|
eventType: "OrderPartiallyFilled";
|
|
133
216
|
data: CommonOrderEventData & {
|
|
134
|
-
/** Taker order ID (taker orders only) */
|
|
135
|
-
takerOrderId?: string;
|
|
136
|
-
/** Maker order ID (maker orders only) */
|
|
137
|
-
makerOrderId?: string;
|
|
138
217
|
/** Reference price (taker orders only) */
|
|
139
218
|
referencePrice?: string;
|
|
140
219
|
/** Best price (taker orders only) */
|
|
@@ -147,14 +226,12 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
147
226
|
maxSlippageBps?: number;
|
|
148
227
|
/** Number of trades (taker orders only - not present for maker) */
|
|
149
228
|
tradesCount?: number;
|
|
150
|
-
/** Total filled quantity (taker orders only - not present for maker) */
|
|
151
|
-
totalFilled?: string;
|
|
152
229
|
/** Remaining quantity (present for both taker and maker) */
|
|
153
230
|
remainingQuantity?: string;
|
|
154
231
|
/** Average fill price (taker orders only) */
|
|
155
232
|
averageFillPrice?: string;
|
|
156
233
|
/** Order status (taker orders only) */
|
|
157
|
-
status?: OrderStatus;
|
|
234
|
+
status?: OrderStatus | (string & {});
|
|
158
235
|
/** Trade ID (maker orders only) */
|
|
159
236
|
tradeId?: string;
|
|
160
237
|
/** Execution price (maker orders only) */
|
|
@@ -180,30 +257,43 @@ export interface OrderPartiallyFilledEvent extends OrderEvent {
|
|
|
180
257
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
181
258
|
remainingQuantityRaw?: string;
|
|
182
259
|
/**
|
|
183
|
-
*
|
|
184
|
-
* (
|
|
260
|
+
* Monaco fee for the fills this event covers, in normalized decimal QUOTE
|
|
261
|
+
* units (negative = maker rebate). The wire field is `fee`, not `makerFee`;
|
|
262
|
+
* taker and maker carry the same field. A taker event aggregates every
|
|
263
|
+
* trade it covers; a maker event is one trade.
|
|
264
|
+
*
|
|
265
|
+
* Excludes the application taker fee, so it is NOT the order echo's
|
|
266
|
+
* `totalTakerFees` (which is `fee + applicationTakerFee`). It previously
|
|
267
|
+
* held the raw integer value now exposed as `feeRaw`.
|
|
185
268
|
*/
|
|
186
269
|
fee?: string;
|
|
270
|
+
/**
|
|
271
|
+
* `fee` in RAW quote-unit precision (scaled by 10^quoteDecimals). Always a
|
|
272
|
+
* whole number -- the engine truncates every fee to an integral raw unit
|
|
273
|
+
* when it stores it -- so `fee` is exactly this value divided by
|
|
274
|
+
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
275
|
+
*/
|
|
276
|
+
feeRaw?: string;
|
|
187
277
|
/** Trade execution timestamp (maker orders only) */
|
|
188
278
|
executedAt?: string;
|
|
189
279
|
/** Role of the order in the trade (taker or maker) */
|
|
190
|
-
role?: OrderRole;
|
|
280
|
+
role?: OrderRole | (string & {});
|
|
191
281
|
};
|
|
192
282
|
}
|
|
193
283
|
/**
|
|
194
284
|
* OrderFilled event - emitted when an order is completely filled
|
|
195
|
-
* Can be emitted for both taker and maker orders with different field sets
|
|
285
|
+
* Can be emitted for both taker and maker orders with different field sets.
|
|
196
286
|
*
|
|
197
|
-
* Taker events
|
|
198
|
-
*
|
|
287
|
+
* Taker events add `trades_count` and the slippage fields; maker events add
|
|
288
|
+
* `trade_id` and `execution_price`. Both roles report the cumulative fill as
|
|
289
|
+
* `filled_quantity` and this event's increment as `last_fill_quantity`, and
|
|
290
|
+
* both carry the fill charge as `fee` (0XM-2389). `total_filled`,
|
|
291
|
+
* `execution_quantity` and `maker_fee` were never emitted on a fill payload
|
|
292
|
+
* and are not declared here.
|
|
199
293
|
*/
|
|
200
294
|
export interface OrderFilledEvent extends OrderEvent {
|
|
201
295
|
eventType: "OrderFilled";
|
|
202
296
|
data: CommonOrderEventData & {
|
|
203
|
-
/** Taker order ID (taker orders only) */
|
|
204
|
-
takerOrderId?: string;
|
|
205
|
-
/** Maker order ID (maker orders only) */
|
|
206
|
-
makerOrderId?: string;
|
|
207
297
|
/** Reference price (taker orders only) */
|
|
208
298
|
referencePrice?: string;
|
|
209
299
|
/** Best price (taker orders only) */
|
|
@@ -216,14 +306,12 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
216
306
|
maxSlippageBps?: number;
|
|
217
307
|
/** Number of trades (taker orders only - not present for maker) */
|
|
218
308
|
tradesCount?: number;
|
|
219
|
-
/** Total filled quantity (taker orders only - not present for maker) */
|
|
220
|
-
totalFilled?: string;
|
|
221
309
|
/** Remaining quantity (present for both, should be 0 for filled orders) */
|
|
222
310
|
remainingQuantity?: string;
|
|
223
311
|
/** Average fill price (taker orders only) */
|
|
224
312
|
averageFillPrice?: string;
|
|
225
313
|
/** Order status (taker orders only) */
|
|
226
|
-
status?: OrderStatus;
|
|
314
|
+
status?: OrderStatus | (string & {});
|
|
227
315
|
/** Trade ID (maker orders only) */
|
|
228
316
|
tradeId?: string;
|
|
229
317
|
/** Execution price (maker orders only) */
|
|
@@ -249,14 +337,27 @@ export interface OrderFilledEvent extends OrderEvent {
|
|
|
249
337
|
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
250
338
|
remainingQuantityRaw?: string;
|
|
251
339
|
/**
|
|
252
|
-
*
|
|
253
|
-
* (
|
|
340
|
+
* Monaco fee for the fills this event covers, in normalized decimal QUOTE
|
|
341
|
+
* units (negative = maker rebate). The wire field is `fee`, not `makerFee`;
|
|
342
|
+
* taker and maker carry the same field. A taker event aggregates every
|
|
343
|
+
* trade it covers; a maker event is one trade.
|
|
344
|
+
*
|
|
345
|
+
* Excludes the application taker fee, so it is NOT the order echo's
|
|
346
|
+
* `totalTakerFees` (which is `fee + applicationTakerFee`). It previously
|
|
347
|
+
* held the raw integer value now exposed as `feeRaw`.
|
|
254
348
|
*/
|
|
255
349
|
fee?: string;
|
|
350
|
+
/**
|
|
351
|
+
* `fee` in RAW quote-unit precision (scaled by 10^quoteDecimals). Always a
|
|
352
|
+
* whole number -- the engine truncates every fee to an integral raw unit
|
|
353
|
+
* when it stores it -- so `fee` is exactly this value divided by
|
|
354
|
+
* 10^quoteDecimals, and `BigInt(feeRaw)` is safe. Wire: `fee_raw`.
|
|
355
|
+
*/
|
|
356
|
+
feeRaw?: string;
|
|
256
357
|
/** Trade execution timestamp (maker orders only) */
|
|
257
358
|
executedAt?: string;
|
|
258
359
|
/** Role of the order in the trade (taker or maker) */
|
|
259
|
-
role?: OrderRole;
|
|
360
|
+
role?: OrderRole | (string & {});
|
|
260
361
|
};
|
|
261
362
|
}
|
|
262
363
|
/**
|
|
@@ -268,7 +369,7 @@ export interface OrderCancelledEvent extends OrderEvent {
|
|
|
268
369
|
/** Reason for cancellation */
|
|
269
370
|
reason?: string;
|
|
270
371
|
/** Stable machine-readable cancellation cause */
|
|
271
|
-
terminalReason?: OrderTerminalReason;
|
|
372
|
+
terminalReason?: OrderTerminalReason | (string & {});
|
|
272
373
|
/**
|
|
273
374
|
* Cumulative order fill at cancellation, mirroring `filledQuantity` on the
|
|
274
375
|
* taker/maker fill events so consumers read one field across every order
|
|
@@ -308,11 +409,15 @@ export interface OrderRejectedEvent extends OrderEvent {
|
|
|
308
409
|
/** Reason for rejection */
|
|
309
410
|
reason: string;
|
|
310
411
|
/** Order status */
|
|
311
|
-
status: OrderStatus;
|
|
412
|
+
status: OrderStatus | (string & {});
|
|
312
413
|
/** Total filled quantity (may-be partially filled) */
|
|
313
414
|
totalFilled: string;
|
|
415
|
+
/** `totalFilled` in RAW (integer, base-unit) precision. Wire: `total_filled_raw`. */
|
|
416
|
+
totalFilledRaw: string;
|
|
314
417
|
/** Remaining quantity that couldn't be filled */
|
|
315
418
|
remainingQuantity: string;
|
|
419
|
+
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
420
|
+
remainingQuantityRaw: string;
|
|
316
421
|
};
|
|
317
422
|
}
|
|
318
423
|
/**
|
|
@@ -321,12 +426,16 @@ export interface OrderRejectedEvent extends OrderEvent {
|
|
|
321
426
|
export interface OrderExpiredEvent extends OrderEvent {
|
|
322
427
|
eventType: "OrderExpired";
|
|
323
428
|
data: CommonOrderEventData & {
|
|
324
|
-
/** Filled quantity before expiration */
|
|
325
|
-
filledQuantity
|
|
326
|
-
/**
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
|
|
429
|
+
/** Filled quantity before expiration. `null` when the order never filled. */
|
|
430
|
+
filledQuantity: string | null;
|
|
431
|
+
/** `filledQuantity` in RAW (integer, base-unit) precision. Wire: `filled_quantity_raw`. */
|
|
432
|
+
filledQuantityRaw: string | null;
|
|
433
|
+
/** Remaining quantity at expiration. `null` when unset. */
|
|
434
|
+
remainingQuantity: string | null;
|
|
435
|
+
/** `remainingQuantity` in RAW (integer, base-unit) precision. Wire: `remaining_quantity_raw`. */
|
|
436
|
+
remainingQuantityRaw: string | null;
|
|
437
|
+
/** Average fill price. `null` when no fills occurred. */
|
|
438
|
+
averageFillPrice: string | null;
|
|
330
439
|
/** Reason for expiration */
|
|
331
440
|
reason: string;
|
|
332
441
|
};
|
|
@@ -342,7 +451,7 @@ export interface OrderPartiallyCancelledEvent extends OrderEvent {
|
|
|
342
451
|
eventType: "OrderPartiallyCancelled";
|
|
343
452
|
data: CommonOrderEventData & {
|
|
344
453
|
/** Order status — non-terminal (the order still rests) */
|
|
345
|
-
status: OrderStatus;
|
|
454
|
+
status: OrderStatus | (string & {});
|
|
346
455
|
/** Cumulative filled quantity, unchanged by the reduction */
|
|
347
456
|
filledQuantity: string;
|
|
348
457
|
/** Cumulative filled quantity in RAW precision. Wire: `filled_quantity_raw`. */
|
|
@@ -23,6 +23,12 @@ export type PositionEventSide = "LONG" | "SHORT";
|
|
|
23
23
|
export type PositionEventStatus = "OPEN" | "LIQUIDATING" | "CLOSED" | "LIQUIDATED" | "EXPIRED";
|
|
24
24
|
/**
|
|
25
25
|
* Position event data containing the current state of a single position.
|
|
26
|
+
*
|
|
27
|
+
* `side` and `status` are typed `Union | (string & {})`: `@0xmonaco/core`
|
|
28
|
+
* parses this frame leniently, so an unrecognized value is passed through
|
|
29
|
+
* rather than throwing inside the WebSocket message handler and dropping a
|
|
30
|
+
* risk-critical update entirely (0XM-2627/0XM-2628). The unions name the values
|
|
31
|
+
* the server sends today — `switch` over them with a `default` branch.
|
|
26
32
|
*/
|
|
27
33
|
export interface PositionEventData {
|
|
28
34
|
/** Position identifier (UUID) */
|
|
@@ -32,9 +38,9 @@ export interface PositionEventData {
|
|
|
32
38
|
/** Trading pair identifier (UUID) */
|
|
33
39
|
tradingPairId: string;
|
|
34
40
|
/** Position side */
|
|
35
|
-
side: PositionEventSide;
|
|
41
|
+
side: PositionEventSide | (string & {});
|
|
36
42
|
/** Position lifecycle status (SCREAMING_SNAKE_CASE on the wire, e.g. "OPEN") */
|
|
37
|
-
status: PositionEventStatus;
|
|
43
|
+
status: PositionEventStatus | (string & {});
|
|
38
44
|
/** Absolute position size (decimal string) */
|
|
39
45
|
size: string;
|
|
40
46
|
/** Average entry price (decimal string) */
|
|
@@ -15,7 +15,7 @@ export interface TradeEventData {
|
|
|
15
15
|
/** Executed quantity */
|
|
16
16
|
quantity: string;
|
|
17
17
|
/** Side of the maker order (BUY or SELL) */
|
|
18
|
-
makerSide: OrderSide;
|
|
18
|
+
makerSide: OrderSide | (string & {});
|
|
19
19
|
/** Timestamp when the trade was executed (ISO 8601) */
|
|
20
20
|
executedAt: string;
|
|
21
21
|
}
|
|
@@ -28,7 +28,7 @@ export interface TradeEvent {
|
|
|
28
28
|
/** Trading pair ID (UUID) */
|
|
29
29
|
tradingPairId: string;
|
|
30
30
|
/** Trading mode (SPOT or MARGIN) */
|
|
31
|
-
tradingMode: TradingMode;
|
|
31
|
+
tradingMode: TradingMode | (string & {});
|
|
32
32
|
/** Trade execution data */
|
|
33
33
|
data: TradeEventData;
|
|
34
34
|
}
|
|
@@ -18,12 +18,20 @@ export type TwapOrderEventReason = "created" | "slice_placed" | "slice_skipped"
|
|
|
18
18
|
* Field names mirror the backend `TwapOrderEventData` payload (snake_case on
|
|
19
19
|
* the wire, camelCased by the client); the SDK parser normalizes explicit
|
|
20
20
|
* `null` values to absent, so nullable wire fields are optional here.
|
|
21
|
+
*
|
|
22
|
+
* **The value unions below are the values the server sends today, not a
|
|
23
|
+
* runtime guarantee**, which is why each is typed `Union | (string & {})`:
|
|
24
|
+
* `@0xmonaco/core` hands this whole payload through with a single cast and
|
|
25
|
+
* validates no value field, so an unrecognized `side`, `tradingMode`,
|
|
26
|
+
* `executionStyle`, `state`, `triggerDirection` or `reason` arrives as-is
|
|
27
|
+
* rather than dropping the update (0XM-2628). Autocomplete still offers the
|
|
28
|
+
* known values; `switch` over one with a `default` branch.
|
|
21
29
|
*/
|
|
22
30
|
export interface TwapOrderEventData {
|
|
23
31
|
twapOrderId: string;
|
|
24
32
|
tradingPairId: string;
|
|
25
|
-
side: OrderSide;
|
|
26
|
-
tradingMode: TradingMode;
|
|
33
|
+
side: OrderSide | (string & {});
|
|
34
|
+
tradingMode: TradingMode | (string & {});
|
|
27
35
|
totalQuantity: string;
|
|
28
36
|
executedQuantity: string;
|
|
29
37
|
executedNotional: string;
|
|
@@ -41,7 +49,7 @@ export interface TwapOrderEventData {
|
|
|
41
49
|
clientTwapId?: string;
|
|
42
50
|
randomize: boolean;
|
|
43
51
|
/** Child execution style: "TAKER" (banded MARKET slices) or "PASSIVE" (post-only children at the touch, taker sweep at each slice deadline) */
|
|
44
|
-
executionStyle: TwapExecutionStyle;
|
|
52
|
+
executionStyle: TwapExecutionStyle | (string & {});
|
|
45
53
|
/** Window start (ISO 8601) */
|
|
46
54
|
startAt: string;
|
|
47
55
|
/** Window end (ISO 8601). Execution stops hard at this time. */
|
|
@@ -55,13 +63,23 @@ export interface TwapOrderEventData {
|
|
|
55
63
|
nextSliceAt?: string;
|
|
56
64
|
slicesPlaced: number;
|
|
57
65
|
slicesSkipped: number;
|
|
58
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Lifecycle state of the parent order.
|
|
68
|
+
*
|
|
69
|
+
* Widened past {@link TwapOrderState} on purpose: `@0xmonaco/core` parses
|
|
70
|
+
* this frame leniently, so a state added server-side after this SDK version
|
|
71
|
+
* ships is delivered as-is rather than dropping the whole update (0XM-2628).
|
|
72
|
+
* `TwapOrderState` names the values the server sends today — narrow with a
|
|
73
|
+
* `switch` that keeps a `default` branch rather than relying on
|
|
74
|
+
* exhaustiveness.
|
|
75
|
+
*/
|
|
76
|
+
state: TwapOrderState | (string & {});
|
|
59
77
|
/** Terminal annotation, e.g. "ended with shortfall 1.5"; absent for non-terminal parents */
|
|
60
78
|
terminalReason?: string;
|
|
61
79
|
/** Conditional configuration + activation stamp (parity with the REST read
|
|
62
80
|
* model). All absent on unconditional parents. */
|
|
63
81
|
triggerPrice?: string;
|
|
64
|
-
triggerDirection?: "ABOVE" | "BELOW";
|
|
82
|
+
triggerDirection?: "ABOVE" | "BELOW" | (string & {});
|
|
65
83
|
conditionalExpiry?: string;
|
|
66
84
|
triggeredAt?: string;
|
|
67
85
|
createdAt: string;
|
|
@@ -69,7 +87,7 @@ export interface TwapOrderEventData {
|
|
|
69
87
|
cancelledAt?: string;
|
|
70
88
|
completedAt?: string;
|
|
71
89
|
/** Mutation that produced this snapshot */
|
|
72
|
-
reason: TwapOrderEventReason;
|
|
90
|
+
reason: TwapOrderEventReason | (string & {});
|
|
73
91
|
}
|
|
74
92
|
export interface TwapOrderEvent {
|
|
75
93
|
eventType: "twap_order_update";
|