@0xmonaco/types 1.0.73 → 1.0.75
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/api/index.d.ts +0 -7
- package/dist/applications/index.d.ts +14 -15
- package/dist/applications/index.js +2 -2
- package/dist/applications/requests.d.ts +70 -15
- package/dist/applications/requests.js +2 -3
- package/dist/applications/responses.d.ts +35 -39
- package/dist/applications/responses.js +1 -1
- package/dist/buildercodes/responses.d.ts +2 -3
- package/dist/buildercodes/responses.js +2 -3
- package/dist/copy-trading/index.d.ts +7 -7
- package/dist/delegated-agents/index.d.ts +15 -5
- package/dist/fees/responses.js +2 -2
- package/dist/margin-accounts/index.d.ts +185 -21
- package/dist/market/index.d.ts +76 -6
- package/dist/pitpass/index.d.ts +31 -11
- package/dist/pitpass/index.js +1 -1
- package/dist/pitpass/responses.d.ts +67 -0
- package/dist/pitpass/responses.js +92 -8
- package/dist/portfolio/index.d.ts +36 -14
- package/dist/positions/index.d.ts +81 -14
- package/dist/profile/index.d.ts +114 -44
- package/dist/trading/index.d.ts +1 -1
- package/dist/trading/orders.d.ts +6 -32
- package/dist/trading/responses.d.ts +9 -14
- package/dist/validation/applications.d.ts +51 -0
- package/dist/validation/applications.js +45 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +1 -0
- package/dist/validation/margin-accounts.d.ts +44 -3
- package/dist/validation/margin-accounts.js +57 -6
- package/dist/validation/market.d.ts +24 -0
- package/dist/validation/market.js +22 -0
- package/dist/validation/positions.d.ts +5 -3
- package/dist/validation/positions.js +12 -5
- package/dist/validation/profile.d.ts +19 -2
- package/dist/validation/profile.js +36 -4
- package/dist/validation/trading.d.ts +2 -2
- package/dist/websocket/base.d.ts +56 -6
- package/dist/websocket/client.d.ts +8 -3
- package/dist/websocket/events/index.d.ts +1 -0
- package/dist/websocket/events/index.js +1 -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 +33 -15
- package/dist/websocket/events/position-valuation-events.d.ts +60 -0
- package/dist/websocket/events/position-valuation-events.js +15 -0
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +7 -0
- package/dist/wire/schema.d.ts +1441 -307
- package/package.json +2 -2
|
@@ -375,11 +375,11 @@ export declare const ConditionalOrderTriggerSourceSchema: z.ZodEnum<{
|
|
|
375
375
|
export declare const ConditionalOrderStateSchema: z.ZodEnum<{
|
|
376
376
|
CANCELLED: "CANCELLED";
|
|
377
377
|
EXPIRED: "EXPIRED";
|
|
378
|
-
FAILED: "FAILED";
|
|
379
378
|
PENDING_PARENT: "PENDING_PARENT";
|
|
380
379
|
ACTIVE: "ACTIVE";
|
|
381
380
|
TRIGGERING: "TRIGGERING";
|
|
382
381
|
TRIGGERED: "TRIGGERED";
|
|
382
|
+
FAILED: "FAILED";
|
|
383
383
|
}>;
|
|
384
384
|
export declare const ClosePositionSideSchema: z.ZodEnum<{
|
|
385
385
|
LONG: "LONG";
|
|
@@ -395,11 +395,11 @@ export declare const ListConditionalOrdersSchema: z.ZodObject<{
|
|
|
395
395
|
state: z.ZodOptional<z.ZodEnum<{
|
|
396
396
|
CANCELLED: "CANCELLED";
|
|
397
397
|
EXPIRED: "EXPIRED";
|
|
398
|
-
FAILED: "FAILED";
|
|
399
398
|
PENDING_PARENT: "PENDING_PARENT";
|
|
400
399
|
ACTIVE: "ACTIVE";
|
|
401
400
|
TRIGGERING: "TRIGGERING";
|
|
402
401
|
TRIGGERED: "TRIGGERED";
|
|
402
|
+
FAILED: "FAILED";
|
|
403
403
|
}>>;
|
|
404
404
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
405
405
|
pageToken: z.ZodOptional<z.ZodString>;
|
package/dist/websocket/base.d.ts
CHANGED
|
@@ -7,8 +7,40 @@
|
|
|
7
7
|
* WebSocket connection status
|
|
8
8
|
*/
|
|
9
9
|
export type WebSocketStatus = "connected" | "connecting" | "disconnected" | "reconnecting";
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Connection-attempt context delivered with every status change.
|
|
12
|
+
*
|
|
13
|
+
* `"reconnecting"` with `hasConnected: false` means the client has never
|
|
14
|
+
* reached the server and is still trying (the first connect failed);
|
|
15
|
+
* `hasConnected: true` means a working connection was lost.
|
|
16
|
+
*/
|
|
17
|
+
export interface WebSocketStatusInfo {
|
|
18
|
+
/**
|
|
19
|
+
* The retry this status refers to. `0` for `"connecting"` and
|
|
20
|
+
* `"connected"`; `1`, `2`, … for `"reconnecting"` (the retry just
|
|
21
|
+
* scheduled); for `"disconnected"`, the number of retries scheduled in the
|
|
22
|
+
* outage before it, counting one still in backoff when `disconnect()` is
|
|
23
|
+
* called (`0` after a clean close of a working connection).
|
|
24
|
+
*/
|
|
25
|
+
attempt: number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether this client has reached the server at least once since it was
|
|
28
|
+
* created or since the last `disconnect()`.
|
|
29
|
+
*/
|
|
30
|
+
hasConnected: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Set only on `"reconnecting"`: the delay, in milliseconds, before the
|
|
33
|
+
* scheduled retry opens its connection.
|
|
34
|
+
*/
|
|
35
|
+
nextRetryDelayMs?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handler invoked whenever the WebSocket connection status changes.
|
|
39
|
+
*
|
|
40
|
+
* Inside the handler, `getStatus()` returns the status being reported. A
|
|
41
|
+
* handler that takes only `status` remains valid.
|
|
42
|
+
*/
|
|
43
|
+
export type StatusHandler = (status: WebSocketStatus, info: WebSocketStatusInfo) => void;
|
|
12
44
|
/**
|
|
13
45
|
* Why the connection was re-established. Delivered by
|
|
14
46
|
* {@link MonacoWebSocketConfig.onResync} after the socket reopens and sends its
|
|
@@ -129,9 +161,11 @@ export interface MonacoWebSocketConfig {
|
|
|
129
161
|
/** Enable auto-reconnect on disconnect (default: true) */
|
|
130
162
|
autoReconnect?: boolean;
|
|
131
163
|
/**
|
|
132
|
-
* Maximum reconnection attempts (default: unlimited). Retry
|
|
133
|
-
* full-jitter exponential backoff capped at 30s, so unlimited
|
|
134
|
-
* capped-rate, not a tight loop.
|
|
164
|
+
* Maximum reconnection attempts per outage (default: unlimited). Retry
|
|
165
|
+
* delay is full-jitter exponential backoff capped at 30s, so unlimited
|
|
166
|
+
* retries are capped-rate, not a tight loop. Once the attempts run out the
|
|
167
|
+
* client reports `"disconnected"`; a later `connect()` starts a fresh
|
|
168
|
+
* budget.
|
|
135
169
|
*/
|
|
136
170
|
maxReconnectAttempts?: number;
|
|
137
171
|
/** Base delay for the exponential backoff in milliseconds (default: 1000) */
|
|
@@ -141,7 +175,23 @@ export interface MonacoWebSocketConfig {
|
|
|
141
175
|
* retried, in milliseconds (default: 10000)
|
|
142
176
|
*/
|
|
143
177
|
connectionTimeoutMs?: number;
|
|
144
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Called on every connection status change, with the attempt context in
|
|
180
|
+
* {@link WebSocketStatusInfo}:
|
|
181
|
+
*
|
|
182
|
+
* - `"connecting"` — a connection is opening outside a retry cycle: the
|
|
183
|
+
* first connect, a `connect()` after a terminal `"disconnected"`, or a
|
|
184
|
+
* fresh session's reconnect after terminal authentication loss.
|
|
185
|
+
* - `"connected"` — the connection opened.
|
|
186
|
+
* - `"reconnecting"` — a retry is scheduled, once per retry. It holds until
|
|
187
|
+
* a retry connects or the retries run out; retries do not report
|
|
188
|
+
* `"connecting"`.
|
|
189
|
+
* - `"disconnected"` — terminal: a clean close, retries exhausted, terminal
|
|
190
|
+
* authentication loss, or `disconnect()`.
|
|
191
|
+
*
|
|
192
|
+
* An error thrown by this callback, or a rejection of the promise an async
|
|
193
|
+
* callback returns, is logged and does not affect the connection.
|
|
194
|
+
*/
|
|
145
195
|
onStatusChange?: StatusHandler;
|
|
146
196
|
/**
|
|
147
197
|
* Called after every automatic reconnect sends authentication/subscription
|
|
@@ -52,7 +52,7 @@ import type { Interval } from "../market";
|
|
|
52
52
|
import type { TradingMode } from "../trading";
|
|
53
53
|
import type { WebSocketStatus } from "./base";
|
|
54
54
|
import type { OrderbookQuotationMode } from "./clients/orderbook-client";
|
|
55
|
-
import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, TradeEvent, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
|
|
55
|
+
import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, TradeEvent, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
|
|
56
56
|
import type { OrderSnapshotItem, SnapshotHandler } from "./snapshots";
|
|
57
57
|
export type MessageHandler<T> = (data: T) => void;
|
|
58
58
|
export interface MonacoWebSocket {
|
|
@@ -84,8 +84,13 @@ export interface MonacoWebSocket {
|
|
|
84
84
|
conditionalOrders: (handler: MessageHandler<ConditionalOrderEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<ConditionalOrderEventData>) => () => void;
|
|
85
85
|
/** Subscribe to TWAP parent-order lifecycle events (requires authentication) */
|
|
86
86
|
twapOrders: (handler: MessageHandler<TwapOrderEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<TwapOrderEventData>) => () => void;
|
|
87
|
-
/**
|
|
88
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe to position state updates (requires authentication); omit `tradingPairId` for all pairs. `onSnapshot` receives every open position.
|
|
89
|
+
*
|
|
90
|
+
* `handler` receives lifecycle `position_update` frames only. `onValuation`, when given, receives the periodic `position_valuation`
|
|
91
|
+
* frames carried on the same channel; without it they are ignored. Apply a valuation only to a position already held as `OPEN`.
|
|
92
|
+
*/
|
|
93
|
+
positions: (handler: MessageHandler<PositionEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<PositionEventData>, onValuation?: MessageHandler<PositionValuationEvent>) => () => void;
|
|
89
94
|
/** Subscribe to liquidation alerts (requires authentication); omit `tradingPairId` for all pairs */
|
|
90
95
|
liquidations: (handler: MessageHandler<LiquidationEvent>, tradingPairId?: string, onSnapshot?: SnapshotHandler<LiquidationEventData>) => () => void;
|
|
91
96
|
/** Subscribe to account-level margin health updates for the authenticated user (requires authentication) */
|
|
@@ -10,5 +10,6 @@ export * from "./ohlcv-events";
|
|
|
10
10
|
export * from "./orderbook-events";
|
|
11
11
|
export * from "./orders-events";
|
|
12
12
|
export * from "./position-events";
|
|
13
|
+
export * from "./position-valuation-events";
|
|
13
14
|
export * from "./trade-events";
|
|
14
15
|
export * from "./twap-order-events";
|
|
@@ -10,5 +10,6 @@ export * from "./ohlcv-events";
|
|
|
10
10
|
export * from "./orderbook-events";
|
|
11
11
|
export * from "./orders-events";
|
|
12
12
|
export * from "./position-events";
|
|
13
|
+
export * from "./position-valuation-events";
|
|
13
14
|
export * from "./trade-events";
|
|
14
15
|
export * from "./twap-order-events";
|
|
@@ -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;
|
|
@@ -134,6 +141,21 @@ export interface PositionEventData {
|
|
|
134
141
|
* that window, and the frame is the fresher one.
|
|
135
142
|
*/
|
|
136
143
|
updatedAt: string;
|
|
144
|
+
/**
|
|
145
|
+
* When the position OPENED (ISO 8601): the fill that took its exposure from
|
|
146
|
+
* zero to non-zero. It never changes for the life of `positionId`, so time
|
|
147
|
+
* held is now minus `openedAt` while open, and `updatedAt` minus `openedAt`
|
|
148
|
+
* on a terminal frame. A flip closes the position and opens a new one with
|
|
149
|
+
* a new `positionId` and its own `openedAt`.
|
|
150
|
+
*
|
|
151
|
+
* Absent when the server does not know it — never filled with the time the
|
|
152
|
+
* frame was sent. A REST read of the same position reports the same
|
|
153
|
+
* instant, normally to within one matching-engine step; after a server
|
|
154
|
+
* restart it can move by the server's own clock drift. Clamp a computed time
|
|
155
|
+
* held at zero. Not versioned: take it from the newest payload (frame or
|
|
156
|
+
* REST read) rather than skipping it on an equal `version`.
|
|
157
|
+
*/
|
|
158
|
+
openedAt?: string;
|
|
137
159
|
/**
|
|
138
160
|
* Opaque, non-negative producer-owned row version for this position
|
|
139
161
|
* (0XM-2673). Compare only within the same `positionId`; higher is newer.
|
|
@@ -144,14 +166,10 @@ export interface PositionEventData {
|
|
|
144
166
|
* an unranked frame is not comparable with a snapshot row even when their
|
|
145
167
|
* state matches.
|
|
146
168
|
* 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.
|
|
169
|
+
* anything was persisted. Current cases are a producer predating this field,
|
|
170
|
+
* an emit path whose command wrote no position row, or a terminal frame
|
|
171
|
+
* rebuilt after restart from legacy reduction history that lacks the size or
|
|
172
|
+
* margin fields needed to reconstruct complete lifetime values.
|
|
155
173
|
* Fall back to a full field comparison rather than ranking it lowest.
|
|
156
174
|
*
|
|
157
175
|
* The merge rule is PER FIELD GROUP, never per frame. On a higher version
|
|
@@ -172,15 +190,15 @@ export interface PositionEventData {
|
|
|
172
190
|
* mutation — up to the one-hour funding interval.
|
|
173
191
|
*
|
|
174
192
|
* 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,
|
|
193
|
+
* persisted at that sequence: fills, non-zero funding settlements, terminal
|
|
194
|
+
* closes/liquidations/ADL, direct isolated-position margin adds/reductions,
|
|
195
|
+
* and copy-position margin adds. Funding carries state captured inside its
|
|
196
|
+
* sequencer command; terminal frames retain lifetime reduced quantity and
|
|
197
|
+
* exact CLOSED/LIQUIDATED classification.
|
|
177
198
|
* The copy add refreshes the isolated child and its copy-cross siblings at
|
|
178
199
|
* the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop
|
|
179
200
|
* 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
|
|
201
|
+
* those commands write no position rows. Wallet IN/OUT and plain isolated allocation emit no
|
|
184
202
|
* position frame. Transfer frames use captured post-command state and are
|
|
185
203
|
* released only after durable acknowledgement.
|
|
186
204
|
*/
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position Valuation WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Periodic mark-derived valuation of one OPEN position, delivered on the same
|
|
5
|
+
* authenticated `positions` / `positions:<tradingPairId>` channel as lifecycle
|
|
6
|
+
* `position_update` frames, with `eventType: "position_valuation"`.
|
|
7
|
+
*
|
|
8
|
+
* Valuation data only: it carries no size, side, status or version, and never
|
|
9
|
+
* creates, reopens, closes or resizes a position. Apply it only to a position
|
|
10
|
+
* you already hold as `OPEN` whose `updatedAt` is earlier than the frame's
|
|
11
|
+
* `valuedAt`, and ignore it otherwise: valuations are spread over each
|
|
12
|
+
* interval, so one can arrive after a newer `position_update` (a fill, a close,
|
|
13
|
+
* a funding settlement) for the same position. `@0xmonaco/core` delivers these to the `onValuation` callback of
|
|
14
|
+
* `positions(...)`, never to its lifecycle handler.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The five mark-derived figures of one open position, from the same
|
|
18
|
+
* derivation as a lifecycle frame's figures for that position.
|
|
19
|
+
*/
|
|
20
|
+
export interface PositionValuationEventData {
|
|
21
|
+
/** Position identifier (UUID) */
|
|
22
|
+
positionId: string;
|
|
23
|
+
/** Margin account that owns the position (UUID) */
|
|
24
|
+
marginAccountId: string;
|
|
25
|
+
/** Trading pair identifier (UUID) */
|
|
26
|
+
tradingPairId: string;
|
|
27
|
+
/** Current mark price (decimal string) */
|
|
28
|
+
markPrice: string;
|
|
29
|
+
/** Unrealized PnL at the mark price (decimal string) */
|
|
30
|
+
unrealizedPnl: string;
|
|
31
|
+
/**
|
|
32
|
+
* Liquidation price (decimal string), or `null` when the server cannot
|
|
33
|
+
* derive one for this position (for example an isolated risk bucket shared
|
|
34
|
+
* by several positions, or one whose collateral basis is not positive).
|
|
35
|
+
*/
|
|
36
|
+
liquidationPrice: string | null;
|
|
37
|
+
/** Initial margin this position requires at the mark price (decimal string) */
|
|
38
|
+
initialMarginRequired: string;
|
|
39
|
+
/** Maintenance margin this position requires at the mark price (decimal string) */
|
|
40
|
+
maintenanceMarginRequired: string;
|
|
41
|
+
/**
|
|
42
|
+
* When the server read the position (RFC 3339). Not the oracle publish time
|
|
43
|
+
* and not the position's last mutation (`updatedAt` on lifecycle frames),
|
|
44
|
+
* but on the same server clock as `updatedAt`: a valuation whose `valuedAt`
|
|
45
|
+
* is not later than the held position's `updatedAt` was read before that
|
|
46
|
+
* state and is stale.
|
|
47
|
+
*/
|
|
48
|
+
valuedAt: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Periodic valuation frame for one open position.
|
|
52
|
+
*/
|
|
53
|
+
export interface PositionValuationEvent {
|
|
54
|
+
/** Event type identifier */
|
|
55
|
+
eventType: "position_valuation";
|
|
56
|
+
/** User ID (UUID) */
|
|
57
|
+
userId: string;
|
|
58
|
+
/** Valuation data */
|
|
59
|
+
data: PositionValuationEventData;
|
|
60
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Position Valuation WebSocket Event Types
|
|
3
|
+
*
|
|
4
|
+
* Periodic mark-derived valuation of one OPEN position, delivered on the same
|
|
5
|
+
* authenticated `positions` / `positions:<tradingPairId>` channel as lifecycle
|
|
6
|
+
* `position_update` frames, with `eventType: "position_valuation"`.
|
|
7
|
+
*
|
|
8
|
+
* Valuation data only: it carries no size, side, status or version, and never
|
|
9
|
+
* creates, reopens, closes or resizes a position. Apply it only to a position
|
|
10
|
+
* you already hold as `OPEN` whose `updatedAt` is earlier than the frame's
|
|
11
|
+
* `valuedAt`, and ignore it otherwise: valuations are spread over each
|
|
12
|
+
* interval, so one can arrive after a newer `position_update` (a fill, a close,
|
|
13
|
+
* a funding settlement) for the same position. `@0xmonaco/core` delivers these to the `onValuation` callback of
|
|
14
|
+
* `positions(...)`, never to its lifecycle handler.
|
|
15
|
+
*/
|
|
@@ -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_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_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_from_sub_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_collateral_to_sub_account", "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",
|
|
@@ -139,11 +143,14 @@ export const OPERATION_IDS = [
|
|
|
139
143
|
"simulate_risk_bucket_order_risk",
|
|
140
144
|
"stop_follow",
|
|
141
145
|
"submit_whitelist",
|
|
146
|
+
"transfer_collateral",
|
|
142
147
|
"transfer_collateral_from_margin_account",
|
|
143
148
|
"transfer_collateral_from_parent_margin_account",
|
|
149
|
+
"transfer_collateral_from_sub_account",
|
|
144
150
|
"transfer_collateral_to_margin_account",
|
|
145
151
|
"transfer_collateral_to_parent_margin_account",
|
|
146
152
|
"transfer_collateral_to_risk_bucket",
|
|
153
|
+
"transfer_collateral_to_sub_account",
|
|
147
154
|
"transfer_rewards",
|
|
148
155
|
"update_sub_account_limit",
|
|
149
156
|
"upsert_delegated_agent",
|