@0xmonaco/types 1.0.77 → 1.0.81
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/auth/responses.d.ts +1 -1
- package/dist/margin-accounts/index.d.ts +33 -1
- package/dist/pitpass/index.d.ts +9 -7
- package/dist/pitpass/index.js +2 -2
- package/dist/pitpass/responses.d.ts +2 -2
- package/dist/pitpass/responses.js +15 -12
- package/dist/portfolio/index.d.ts +16 -2
- package/dist/positions/index.d.ts +56 -6
- package/dist/sdk/index.d.ts +1 -1
- package/dist/trading/index.d.ts +16 -0
- package/dist/trading/orders.d.ts +4 -1
- package/dist/websocket/client.d.ts +21 -10
- package/dist/websocket/client.js +9 -4
- package/dist/websocket/events/account-events.d.ts +5 -1
- package/dist/websocket/events/account-events.js +5 -1
- package/dist/websocket/events/copy-events.d.ts +1 -1
- package/dist/websocket/events/instrument-events.d.ts +13 -0
- package/dist/websocket/events/instrument-events.js +5 -0
- package/dist/websocket/events/orders-events.d.ts +5 -2
- package/dist/websocket/events/position-events.d.ts +21 -5
- package/dist/websocket/snapshots.d.ts +23 -2
- package/dist/websocket/snapshots.js +6 -1
- package/dist/wire/schema.d.ts +175 -58
- package/package.json +2 -2
package/dist/auth/responses.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface AuthState {
|
|
|
51
51
|
*/
|
|
52
52
|
isNewUser?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
* True when a
|
|
54
|
+
* True when a TraderCodes referral relationship was recorded on this verify: a
|
|
55
55
|
* valid, non-self TraderCode was presented on the wallet's first-ever sign-in
|
|
56
56
|
* and resolved to a known referrer. Use it to confirm the referral landed on
|
|
57
57
|
* the signup-success screen. Absent on responses from a server that predates
|
|
@@ -26,7 +26,11 @@ export interface MarginAccountSummary {
|
|
|
26
26
|
/** Equity headroom: equity less the initial margin requirement. */
|
|
27
27
|
freeCollateral: string;
|
|
28
28
|
/**
|
|
29
|
-
* The largest amount a transfer-out of this scope
|
|
29
|
+
* The largest amount a transfer-out of this scope accepts without lowering
|
|
30
|
+
* any position's posted margin, so without moving a leverage or a
|
|
31
|
+
* liquidation price. A removal from an isolated risk bucket with one open
|
|
32
|
+
* position can take more, out of that position's margin: see
|
|
33
|
+
* `maxRemovableCollateral`.
|
|
30
34
|
*
|
|
31
35
|
* Not a clamped `freeCollateral`. Free collateral is equity headroom, and
|
|
32
36
|
* equity includes mark-to-market gains that a transfer cannot move — so the
|
|
@@ -93,6 +97,24 @@ export interface MarginAccountSummary {
|
|
|
93
97
|
* precision, like `withdrawableCollateral`.
|
|
94
98
|
*/
|
|
95
99
|
availableOrderCollateral?: string;
|
|
100
|
+
/**
|
|
101
|
+
* The largest removal from this risk bucket the risk engine accepts when the
|
|
102
|
+
* removal may also lower the posted margin of the bucket's one open
|
|
103
|
+
* position: `withdrawableCollateral` plus the position's margin above its
|
|
104
|
+
* initial margin at the mark, capped by what the parent margin account
|
|
105
|
+
* accepts. Everything past `withdrawableCollateral` comes out of the
|
|
106
|
+
* position's margin, so it raises the position's leverage and moves its
|
|
107
|
+
* liquidation price toward the mark.
|
|
108
|
+
*
|
|
109
|
+
* Equal to `withdrawableCollateral` on a cross risk bucket and on an
|
|
110
|
+
* isolated one with no open position or several.
|
|
111
|
+
*
|
|
112
|
+
* Present only on risk-bucket rows served from a live risk engine snapshot;
|
|
113
|
+
* absent (the key is omitted, never null) on parent rows and on
|
|
114
|
+
* persisted-fallback reads. Truncated toward zero at the quote asset's
|
|
115
|
+
* precision, like `withdrawableCollateral`.
|
|
116
|
+
*/
|
|
117
|
+
maxRemovableCollateral?: string;
|
|
96
118
|
/**
|
|
97
119
|
* Copy trading: present only on a copy risk bucket row (a follow's copy
|
|
98
120
|
* account — its cross risk bucket and any isolated children). The id of the
|
|
@@ -401,6 +423,16 @@ export type SimulateRiskBucketOrderRiskRequest = SimulateIsolatedRiskBucketOrder
|
|
|
401
423
|
export interface SimulateOrderRiskResponse {
|
|
402
424
|
accepted: boolean;
|
|
403
425
|
rejectReason?: string;
|
|
426
|
+
/**
|
|
427
|
+
* Structured code of the refusal behind `rejectReason`: the same code
|
|
428
|
+
* placing the order would return in the error envelope (for example
|
|
429
|
+
* `MARGIN_MODE_CONFLICT` when the margin account holds the pair in its other
|
|
430
|
+
* margin mode, `INVALID_ORDER` for the catch-all). Present for
|
|
431
|
+
* client-class refusals; absent on an accepted preview, and absent when the
|
|
432
|
+
* preview failed on a server-side fault (`rejectReason` is then a generic
|
|
433
|
+
* retry message).
|
|
434
|
+
*/
|
|
435
|
+
rejectCode?: string;
|
|
404
436
|
marginAccountId: string;
|
|
405
437
|
strategyKey?: string;
|
|
406
438
|
riskBucketId?: string;
|
package/dist/pitpass/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* TraderCodes Types (`sdk.pitpass`)
|
|
3
3
|
*
|
|
4
|
-
* Types for
|
|
4
|
+
* Types for the TraderCodes API: code lookup, rewards balance, and transfer.
|
|
5
5
|
*/
|
|
6
6
|
import type { BaseAPI } from "../api";
|
|
7
7
|
import type { GetMyReferralDownlineParams, GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetMyReferralTreeParams, GetMyReferralTreeResponse, GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "./responses";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* TraderCodes API interface (`sdk.pitpass`).
|
|
10
10
|
*
|
|
11
11
|
* Provides methods for reading your wallet-derived TraderCode, looking up a
|
|
12
12
|
* referral code at sign-up, reading your accrued rewards balance, and
|
|
@@ -71,7 +71,7 @@ export interface PitpassAPI extends BaseAPI {
|
|
|
71
71
|
*/
|
|
72
72
|
getTraderCodeInfo(code: string): Promise<TraderCodeInfoResponse>;
|
|
73
73
|
/**
|
|
74
|
-
* Return the caller's current
|
|
74
|
+
* Return the caller's current TraderCodes rewards-bucket balances.
|
|
75
75
|
*
|
|
76
76
|
* Rewards accumulate here as referred users trade. Call
|
|
77
77
|
* {@link transferRewards} to move them into a tradeable balance.
|
|
@@ -81,7 +81,7 @@ export interface PitpassAPI extends BaseAPI {
|
|
|
81
81
|
*/
|
|
82
82
|
getRewardsBalance(): Promise<GetRewardsBalanceResponse>;
|
|
83
83
|
/**
|
|
84
|
-
* Transfer earned
|
|
84
|
+
* Transfer earned TraderCodes rewards into a trading balance.
|
|
85
85
|
*
|
|
86
86
|
* Moves the specified amount of a reward token from the caller's rewards
|
|
87
87
|
* bucket into their trading balance under the authenticated application.
|
|
@@ -93,7 +93,8 @@ export interface PitpassAPI extends BaseAPI {
|
|
|
93
93
|
transferRewards(params: TransferRewardsParams): Promise<TransferRewardsResponse>;
|
|
94
94
|
/**
|
|
95
95
|
* Read your own referral position: your referral chain upward (`upline`, L1
|
|
96
|
-
* then L2
|
|
96
|
+
* then L2 and onward, as many levels as your trades on this client
|
|
97
|
+
* application pay), your direct referrer, total earned, and most recent
|
|
97
98
|
* reward rows.
|
|
98
99
|
*
|
|
99
100
|
* Self-scoped — the server derives your identity from the session, so you can
|
|
@@ -125,7 +126,8 @@ export interface PitpassAPI extends BaseAPI {
|
|
|
125
126
|
* referred (yourself when `parent` is omitted), a page at a time, newest
|
|
126
127
|
* first. Expand a node by calling again with `parent` set to its wallet;
|
|
127
128
|
* nodes with `refereeCount > 0` are expandable, down to the deepest level
|
|
128
|
-
*
|
|
129
|
+
* any client application rewards (at most 10). Your direct referees (L1)
|
|
130
|
+
* are always listed.
|
|
129
131
|
*
|
|
130
132
|
* Self-scoped: `parent` must be you or one of your own referees above that
|
|
131
133
|
* deepest level — any other wallet is a 404. Each wallet appears once, under the referrer that
|
package/dist/pitpass/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* TraderCodes Types (`sdk.pitpass`)
|
|
3
3
|
*
|
|
4
|
-
* Types for
|
|
4
|
+
* Types for the TraderCodes API: code lookup, rewards balance, and transfer.
|
|
5
5
|
*/
|
|
6
6
|
export { GetMyReferralDownlineParamsSchema, GetMyReferralDownlineResponseSchema, GetMyReferralPositionResponseSchema, GetMyReferralTreeParamsSchema, GetMyReferralTreeResponseSchema, GetRewardsBalanceResponseSchema, LevelEarningsSchema, ReferralDirectRefereeSchema, ReferralEarningsSourceSchema, ReferralEarningsSummarySchema, ReferralRewardEntrySchema, ReferralTreeNodeSchema, ReferralUplineEntrySchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* TraderCodes Response Types
|
|
3
3
|
*
|
|
4
|
-
* Types for
|
|
4
|
+
* Types for TraderCodes API responses and requests.
|
|
5
5
|
* All types are derived from Zod schemas for runtime validation.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* TraderCodes Response Types
|
|
3
3
|
*
|
|
4
|
-
* Types for
|
|
4
|
+
* Types for TraderCodes API responses and requests.
|
|
5
5
|
* All types are derived from Zod schemas for runtime validation.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
@@ -107,13 +107,13 @@ export const ReferralRewardEntrySchema = z.object({
|
|
|
107
107
|
source: z.string(),
|
|
108
108
|
/** Human-facing name for the source: their custom handle if claimed, else the wallet. */
|
|
109
109
|
sourceDisplay: z.string(),
|
|
110
|
-
/** Referral level
|
|
110
|
+
/** Referral level: 1 (direct), 2, and so on (at most 10). */
|
|
111
111
|
level: z.number(),
|
|
112
112
|
/** Reward amount, in RAW atomic units of the token. */
|
|
113
113
|
amount: z.string(),
|
|
114
114
|
/** Reward token contract address (0x-prefixed). */
|
|
115
115
|
token: z.string(),
|
|
116
|
-
/** The referral rate applied, as a decimal fraction (e.g. `0.30`
|
|
116
|
+
/** The referral rate applied, as a decimal fraction (e.g. `0.30`). */
|
|
117
117
|
rateApplied: z.string(),
|
|
118
118
|
/** RFC 3339 timestamp when the reward row was recorded. */
|
|
119
119
|
createdAt: z.string(),
|
|
@@ -124,14 +124,15 @@ export const ReferralUplineEntrySchema = z.object({
|
|
|
124
124
|
wallet: z.string(),
|
|
125
125
|
/** Human-facing name for the ancestor: their custom handle if claimed, else the wallet. */
|
|
126
126
|
display: z.string(),
|
|
127
|
-
/** How far above the caller this ancestor is: 1 (direct referrer), 2,
|
|
127
|
+
/** How far above the caller this ancestor is: 1 (direct referrer), 2, and so on (at most 10). */
|
|
128
128
|
level: z.number(),
|
|
129
129
|
});
|
|
130
130
|
/** The caller's own referral position: who referred them and what they've earned. */
|
|
131
131
|
export const GetMyReferralPositionResponseSchema = z.object({
|
|
132
132
|
/**
|
|
133
133
|
* Public wallet address of the caller's direct (L1) referrer. Empty string
|
|
134
|
-
* when the caller was not referred. Same wallet as the first `upline` entry
|
|
134
|
+
* when the caller was not referred. Same wallet as the first `upline` entry
|
|
135
|
+
* whenever `upline` is not empty.
|
|
135
136
|
*/
|
|
136
137
|
referrer: z.string(),
|
|
137
138
|
/** Human-facing name for the referrer: their custom handle if claimed, else the wallet (empty when not referred). */
|
|
@@ -141,10 +142,12 @@ export const GetMyReferralPositionResponseSchema = z.object({
|
|
|
141
142
|
/** The caller's most recent reward rows, newest first (bounded server-side). */
|
|
142
143
|
rewards: z.array(ReferralRewardEntrySchema),
|
|
143
144
|
/**
|
|
144
|
-
* The caller's referral chain upward, nearest first: L1, L2, and so on,
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
145
|
+
* The caller's referral chain upward, nearest first: L1, L2, and so on, as
|
|
146
|
+
* many levels as the caller's trades on this client application pay (at
|
|
147
|
+
* most 10). Shorter when the chain ends; empty when the caller was not
|
|
148
|
+
* referred or this client application pays no referral levels. These are the
|
|
149
|
+
* wallets the caller's own trades on this client application pay referral
|
|
150
|
+
* rewards to.
|
|
148
151
|
*/
|
|
149
152
|
upline: z.array(ReferralUplineEntrySchema),
|
|
150
153
|
});
|
|
@@ -191,7 +194,7 @@ export const ReferralEarningsSummarySchema = z.object({
|
|
|
191
194
|
level3Earned: z.string(),
|
|
192
195
|
/**
|
|
193
196
|
* Earnings per level, ascending, one entry per level with earnings. Covers
|
|
194
|
-
* every level, including levels deeper than
|
|
197
|
+
* every level, including levels deeper than TraderCodes rewards today.
|
|
195
198
|
*/
|
|
196
199
|
byLevel: z.array(LevelEarningsSchema),
|
|
197
200
|
});
|
|
@@ -241,7 +244,7 @@ export const ReferralTreeNodeSchema = z.object({
|
|
|
241
244
|
wallet: z.string(),
|
|
242
245
|
/** Human-facing name: their custom handle if claimed, else the wallet. */
|
|
243
246
|
display: z.string(),
|
|
244
|
-
/** Depth below the caller: 1 (you referred them), 2, and so on
|
|
247
|
+
/** Depth below the caller: 1 (you referred them), 2, and so on, as deep as any client application rewards (at most 10). */
|
|
245
248
|
level: z.number(),
|
|
246
249
|
/** Wallet address of this node's referrer — your own wallet for a level-1 node. */
|
|
247
250
|
parent: z.string(),
|
|
@@ -195,8 +195,10 @@ export interface PortfolioRiskBucket {
|
|
|
195
195
|
unrealizedPnl: string;
|
|
196
196
|
positionCount: number;
|
|
197
197
|
/**
|
|
198
|
-
* The largest transfer-out of this risk bucket the engine
|
|
199
|
-
*
|
|
198
|
+
* The largest transfer-out of this risk bucket the engine accepts without
|
|
199
|
+
* lowering a position's posted margin; a removal from an isolated risk
|
|
200
|
+
* bucket with one open position can take more (`maxRemovableCollateral`).
|
|
201
|
+
* NOT a clamped `freeCollateral`: the bucket's allocated
|
|
200
202
|
* collateral plus its realized PnL, less funding paid, unrealized losses
|
|
201
203
|
* and the margin its positions and resting orders require. Realized profit
|
|
202
204
|
* can leave a live bucket this way (the bucket's allocation may go
|
|
@@ -218,6 +220,18 @@ export interface PortfolioRiskBucket {
|
|
|
218
220
|
* (the key is omitted, never null) on persisted-fallback reads.
|
|
219
221
|
*/
|
|
220
222
|
availableOrderCollateral?: string;
|
|
223
|
+
/**
|
|
224
|
+
* The largest removal from this risk bucket the engine accepts when the
|
|
225
|
+
* removal may also lower the posted margin of the bucket's one open
|
|
226
|
+
* position, down to its initial margin at the mark — the same figure as
|
|
227
|
+
* `MarginAccountSummary.maxRemovableCollateral`. Equal to
|
|
228
|
+
* `withdrawableCollateral` for a cross risk bucket and for an isolated one
|
|
229
|
+
* with no open position or several.
|
|
230
|
+
*
|
|
231
|
+
* Present only when a live risk engine snapshot served it; absent (the key
|
|
232
|
+
* is omitted, never null) on persisted-fallback reads.
|
|
233
|
+
*/
|
|
234
|
+
maxRemovableCollateral?: string;
|
|
221
235
|
/**
|
|
222
236
|
* The mode this bucket is margined under.
|
|
223
237
|
*
|
|
@@ -13,6 +13,38 @@ export type PositionStatus = "OPEN" | "CLOSED" | "LIQUIDATING" | "LIQUIDATED" |
|
|
|
13
13
|
*/
|
|
14
14
|
export type PositionStatusFilter = "OPEN" | "CLOSED" | "LIQUIDATING" | "LIQUIDATED";
|
|
15
15
|
export type ClosePositionType = "MARKET" | "LIMIT" | "IOC";
|
|
16
|
+
/**
|
|
17
|
+
* Whether a position's lifetime totals (`exitPrice`, `realizedRoe`,
|
|
18
|
+
* `feesPaid`, `fundingPaid`, `cumFees`, `netRealizedPnl`) are served, and if
|
|
19
|
+
* not, whether they will be. The server never sends
|
|
20
|
+
* `LIFETIME_TOTALS_STATUS_UNSPECIFIED`.
|
|
21
|
+
*
|
|
22
|
+
* - `LIFETIME_TOTALS_STATUS_COMPLETE`: the position's history covers its whole
|
|
23
|
+
* lifetime. The lifetime fields are served under their own rules (a
|
|
24
|
+
* terminal row's `netRealizedPnl`, `realizedRoe` and `cumFees` can still wait
|
|
25
|
+
* on the position's PnL sample).
|
|
26
|
+
* - `LIFETIME_TOTALS_STATUS_PENDING`: the position's history is still being
|
|
27
|
+
* written up to this row's `version`, or the row changed while it was being
|
|
28
|
+
* read. Every lifetime field is absent.
|
|
29
|
+
* Temporary: retry the read after a short backoff (seconds). Until the
|
|
30
|
+
* position-history checkpoint is seeded, PENDING arises only when the
|
|
31
|
+
* position row changed between the row read and the totals read.
|
|
32
|
+
* - `LIFETIME_TOTALS_STATUS_INCOMPLETE`: the lifetime totals are not complete
|
|
33
|
+
* now, and a quick retry will not change that. A gap in legacy history (or
|
|
34
|
+
* reducing executions that do not reconcile with `realizedPnl`) is
|
|
35
|
+
* permanent; a maintained-totals row that is missing or has drifted is
|
|
36
|
+
* repaired by the background reconcile (at startup and daily), after which
|
|
37
|
+
* the row reads COMPLETE. Every lifetime field that is present comes from
|
|
38
|
+
* the maintained totals, which are cross-checked against each other and
|
|
39
|
+
* repaired by the background reconcile (e.g. `exitPrice` can be present
|
|
40
|
+
* while `cumFees` is absent). `OPEN` and `LIQUIDATING` positions are
|
|
41
|
+
* checked against realized PnL too: an `OPEN` or `LIQUIDATING` row whose
|
|
42
|
+
* reductions do not account for it is INCOMPLETE with no `cumFees` and no
|
|
43
|
+
* `fundingPaid`.
|
|
44
|
+
*
|
|
45
|
+
* Never read an absent lifetime field as zero.
|
|
46
|
+
*/
|
|
47
|
+
export type LifetimeTotalsStatus = "LIFETIME_TOTALS_STATUS_UNSPECIFIED" | "LIFETIME_TOTALS_STATUS_COMPLETE" | "LIFETIME_TOTALS_STATUS_PENDING" | "LIFETIME_TOTALS_STATUS_INCOMPLETE";
|
|
16
48
|
export interface Position {
|
|
17
49
|
positionId: string;
|
|
18
50
|
marginAccountId: string;
|
|
@@ -86,9 +118,13 @@ export interface Position {
|
|
|
86
118
|
*/
|
|
87
119
|
exitPrice?: string;
|
|
88
120
|
/**
|
|
89
|
-
* Lifetime funding paid (signed; negative means
|
|
90
|
-
*
|
|
91
|
-
*
|
|
121
|
+
* Lifetime funding paid since the position opened (signed; negative means
|
|
122
|
+
* received). On a terminal row, summed over the position's reducing
|
|
123
|
+
* executions. On an open row, the funding accrued on the size still open
|
|
124
|
+
* plus the funding its partial closes settled, so the last open value
|
|
125
|
+
* equals the terminal value. Absent when unavailable, including on an open
|
|
126
|
+
* row whose `lifetimeTotalsStatus` is not `LIFETIME_TOTALS_STATUS_COMPLETE`;
|
|
127
|
+
* never an understated partial.
|
|
92
128
|
*/
|
|
93
129
|
fundingPaid?: string;
|
|
94
130
|
/**
|
|
@@ -108,6 +144,9 @@ export interface Position {
|
|
|
108
144
|
* of PnL retention, or for positions predating the PnL service — rather than
|
|
109
145
|
* an understated partial. On a terminal row it is also null until the
|
|
110
146
|
* final close is recorded in its PnL sample, or while fee data is incomplete.
|
|
147
|
+
* On an `OPEN` or `LIQUIDATING` row it is also null when the position's reductions do not
|
|
148
|
+
* account for its `realizedPnl` (`lifetimeTotalsStatus` INCOMPLETE), rather
|
|
149
|
+
* than an understated total.
|
|
111
150
|
*/
|
|
112
151
|
cumFees?: string;
|
|
113
152
|
/**
|
|
@@ -162,6 +201,14 @@ export interface Position {
|
|
|
162
201
|
* version.
|
|
163
202
|
*/
|
|
164
203
|
openedAt?: string | null;
|
|
204
|
+
/**
|
|
205
|
+
* Whether this row's lifetime totals are served — see
|
|
206
|
+
* {@link LifetimeTotalsStatus}. Set on every REST read row; `null` or absent
|
|
207
|
+
* from a server that predates the field. WebSocket position frames do not
|
|
208
|
+
* carry it. Widened with `string` so a status this SDK version predates is
|
|
209
|
+
* passed through rather than mistyped; handle the unknown case.
|
|
210
|
+
*/
|
|
211
|
+
lifetimeTotalsStatus?: LifetimeTotalsStatus | (string & {}) | null;
|
|
165
212
|
}
|
|
166
213
|
export interface ListPositionsParams {
|
|
167
214
|
marginAccountId?: string;
|
|
@@ -179,9 +226,12 @@ export interface ListPositionsParams {
|
|
|
179
226
|
* **Order depends on the filter.** `status: "OPEN"` is answered from the
|
|
180
227
|
* matching engine's live view and is ordered by
|
|
181
228
|
* `(marginAccountId, tradingPairId, positionId)` ascending — stable, but
|
|
182
|
-
* UUID order, NOT newest-first.
|
|
183
|
-
*
|
|
184
|
-
*
|
|
229
|
+
* UUID order, NOT newest-first. `status: "CLOSED"` and
|
|
230
|
+
* `status: "LIQUIDATED"` read persisted rows newest-closed first, so a
|
|
231
|
+
* position held for weeks and closed today leads the list. Every other
|
|
232
|
+
* filter reads persisted rows newest-opened first. Each is a separate
|
|
233
|
+
* cursor space, so a token is only valid in the one that minted it, and
|
|
234
|
+
* crossing between the live and persisted walks is
|
|
185
235
|
* ASYMMETRIC: a persisted token offered to `status: "OPEN"` is served by
|
|
186
236
|
* the persisted walk while the engine is reachable, but a LIVE token
|
|
187
237
|
* cannot cross — once the engine is unreachable the request is a 400 and
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ export interface MonacoSDK {
|
|
|
112
112
|
portfolio: PortfolioAPI;
|
|
113
113
|
/** Sub-account management API */
|
|
114
114
|
subAccounts: SubAccountsAPI;
|
|
115
|
-
/**
|
|
115
|
+
/** TraderCodes referral and rewards API */
|
|
116
116
|
pitpass: PitpassAPI;
|
|
117
117
|
/** BuilderCodes frontend revenue-share payout API */
|
|
118
118
|
buildercodes: BuildercodesAPI;
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -30,6 +30,14 @@ export interface TradingAPI extends BaseAPI {
|
|
|
30
30
|
expirationDate?: string;
|
|
31
31
|
timeInForce?: TimeInForce;
|
|
32
32
|
marginAccountId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Defaults to `ISOLATED`. One margin mode per market and margin account:
|
|
35
|
+
* while the account holds the pair in its other risk bucket (an open
|
|
36
|
+
* position, or a resting order that is not reduce-only) an order that is
|
|
37
|
+
* not reduce-only is rejected with `MARGIN_MODE_CONFLICT`; reduce-only
|
|
38
|
+
* orders always pass. On an isolated-only market a `CROSS` order that is
|
|
39
|
+
* not reduce-only is rejected with `CROSS_MARGIN_NOT_ALLOWED`.
|
|
40
|
+
*/
|
|
33
41
|
marginMode?: MarginMode;
|
|
34
42
|
riskBucketId?: string;
|
|
35
43
|
/** Initial order budget; unfilled funds do not back the isolated position. */
|
|
@@ -84,6 +92,14 @@ export interface TradingAPI extends BaseAPI {
|
|
|
84
92
|
tradingMode?: TradingMode;
|
|
85
93
|
slippageTolerance?: number;
|
|
86
94
|
marginAccountId?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Defaults to `ISOLATED`. One margin mode per market and margin account:
|
|
97
|
+
* while the account holds the pair in its other risk bucket (an open
|
|
98
|
+
* position, or a resting order that is not reduce-only) an order that is
|
|
99
|
+
* not reduce-only is rejected with `MARGIN_MODE_CONFLICT`; reduce-only
|
|
100
|
+
* orders always pass. On an isolated-only market a `CROSS` order that is
|
|
101
|
+
* not reduce-only is rejected with `CROSS_MARGIN_NOT_ALLOWED`.
|
|
102
|
+
*/
|
|
87
103
|
marginMode?: MarginMode;
|
|
88
104
|
riskBucketId?: string;
|
|
89
105
|
/** Initial order budget; unfilled funds do not back the isolated position. */
|
package/dist/trading/orders.d.ts
CHANGED
|
@@ -44,7 +44,10 @@ export interface Order {
|
|
|
44
44
|
averageFillPrice?: string;
|
|
45
45
|
/** Trading mode (SPOT or MARGIN) */
|
|
46
46
|
tradingMode: TradingMode;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Time in force - GTC, IOC, or FOK (GTD is deprecated and rejected).
|
|
49
|
+
* Absent on a MARKET order, which has none.
|
|
50
|
+
*/
|
|
48
51
|
timeInForce?: TimeInForce;
|
|
49
52
|
/** Order creation timestamp (ISO 8601) */
|
|
50
53
|
createdAt: string;
|
|
@@ -42,18 +42,23 @@
|
|
|
42
42
|
* baseline over REST for the extra consumer.
|
|
43
43
|
*
|
|
44
44
|
* Where the server has no snapshot arm for a channel yet, the callback is
|
|
45
|
-
* simply never invoked — a silent no-op, not an error. `orderbook
|
|
46
|
-
* `
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* simply never invoked — a silent no-op, not an error. `orderbook` and
|
|
46
|
+
* `movements` take no `onSnapshot` at all: they stream events rather than
|
|
47
|
+
* state, and the channel-coverage lock pins that classification against the
|
|
48
|
+
* server's own snapshot dispatch. `trades` and `ohlcv` are also event streams,
|
|
49
|
+
* but their `onSnapshot` delivers recent history as a baseline. `trades` sends
|
|
50
|
+
* the pair's newest trades, which can overlap the first live trades or miss
|
|
51
|
+
* one executed just before the subscribe, so a consumer dedupes on `tradeId`.
|
|
52
|
+
* `ohlcv` sends the series' newest candles, whose newest candle can be partial
|
|
53
|
+
* or missing, so a consumer upserts live candles by `T`.
|
|
49
54
|
*/
|
|
50
55
|
import type { SessionCredentials } from "../auth/index";
|
|
51
56
|
import type { Interval } from "../market";
|
|
52
57
|
import type { TradingMode } from "../trading";
|
|
53
58
|
import type { WebSocketStatus } from "./base";
|
|
54
59
|
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, PositionValuationEvent, TradeEvent, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
|
|
56
|
-
import type { OrderSnapshotItem, SnapshotHandler } from "./snapshots";
|
|
60
|
+
import type { AccountEvent, AccountEventData, ConditionalOrderEvent, ConditionalOrderEventData, CopyEvent, CopyRelationshipEventData, InstrumentEvent, InstrumentEventData, LiquidationEvent, LiquidationEventData, MarketStatsAllEvent, MarketStatsData, MarketStatsEvent, MarketStatsSummary, OHLCVEvent, OHLCVPriceType, OrderbookEvent, OrderEvent, PositionEvent, PositionEventData, PositionValuationEvent, TradeEvent, TradeEventData, TwapOrderEvent, TwapOrderEventData, UserBalanceEvent, UserBalanceEventData, UserMovementEvent } from "./events";
|
|
61
|
+
import type { OHLCVSnapshotCandle, OrderSnapshotItem, SnapshotHandler } from "./snapshots";
|
|
57
62
|
export type MessageHandler<T> = (data: T) => void;
|
|
58
63
|
export interface MonacoWebSocket {
|
|
59
64
|
/** Connect to the WebSocket server */
|
|
@@ -70,10 +75,16 @@ export interface MonacoWebSocket {
|
|
|
70
75
|
orders: (tradingPairId: string, tradingMode: TradingMode, handler: MessageHandler<OrderEvent>, onSnapshot?: SnapshotHandler<OrderSnapshotItem>) => () => void;
|
|
71
76
|
/** Subscribe to orderbook events (public) */
|
|
72
77
|
orderbook: (tradingPairId: string, tradingMode: TradingMode, magnitude: number, quotationMode: OrderbookQuotationMode, handler: MessageHandler<OrderbookEvent>) => () => void;
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Subscribe to OHLCV candlestick events (public); `onSnapshot` receives the series' newest 350 candles, oldest first.
|
|
80
|
+
* The newest snapshot candle can be partial or missing, so upsert live candles by `T`. A `*` price type gets no snapshot.
|
|
81
|
+
*/
|
|
82
|
+
ohlcv: (tradingPairId: string, tradingMode: TradingMode, interval: Interval, handler: MessageHandler<OHLCVEvent>, priceType?: OHLCVPriceType, onSnapshot?: SnapshotHandler<OHLCVSnapshotCandle>) => () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Subscribe to trade events (public); `onSnapshot` receives the pair's newest 50 trades, newest first.
|
|
85
|
+
* The snapshot can overlap the first live trades or miss one executed just before subscribing, so dedupe on `tradeId`.
|
|
86
|
+
*/
|
|
87
|
+
trades: (tradingPairId: string, handler: MessageHandler<TradeEvent>, onSnapshot?: SnapshotHandler<TradeEventData>) => () => void;
|
|
77
88
|
/** Subscribe to user movement events (requires authentication) */
|
|
78
89
|
movements: (handler: MessageHandler<UserMovementEvent>) => () => void;
|
|
79
90
|
/** Subscribe to user order events for all trading pairs (requires authentication); `onSnapshot` receives every resting order */
|
package/dist/websocket/client.js
CHANGED
|
@@ -42,8 +42,13 @@
|
|
|
42
42
|
* baseline over REST for the extra consumer.
|
|
43
43
|
*
|
|
44
44
|
* Where the server has no snapshot arm for a channel yet, the callback is
|
|
45
|
-
* simply never invoked — a silent no-op, not an error. `orderbook
|
|
46
|
-
* `
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* simply never invoked — a silent no-op, not an error. `orderbook` and
|
|
46
|
+
* `movements` take no `onSnapshot` at all: they stream events rather than
|
|
47
|
+
* state, and the channel-coverage lock pins that classification against the
|
|
48
|
+
* server's own snapshot dispatch. `trades` and `ohlcv` are also event streams,
|
|
49
|
+
* but their `onSnapshot` delivers recent history as a baseline. `trades` sends
|
|
50
|
+
* the pair's newest trades, which can overlap the first live trades or miss
|
|
51
|
+
* one executed just before the subscribe, so a consumer dedupes on `tradeId`.
|
|
52
|
+
* `ohlcv` sends the series' newest candles, whose newest candle can be partial
|
|
53
|
+
* or missing, so a consumer upserts live candles by `T`.
|
|
49
54
|
*/
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
*
|
|
13
13
|
* A subscribe-time snapshot arrives ahead of the live diffs, carrying one row
|
|
14
14
|
* per margin account you own IN THE APPLICATION YOU AUTHENTICATED UNDER -
|
|
15
|
-
* including FLAT accounts
|
|
15
|
+
* including FLAT accounts. A flat account sends no periodic frame; it gets a
|
|
16
|
+
* live frame (on the same per-account `sequence`) only after its collateral
|
|
17
|
+
* moves. Moves before the producer's next tick collapse into one frame with
|
|
18
|
+
* the latest state, normally within ~2s; a burst wider than 512 flat accounts
|
|
19
|
+
* spreads over the following ticks. Live
|
|
16
20
|
* delivery is wider: it is per user and carries no application filter, so if
|
|
17
21
|
* the same wallet trades through more than one application you also receive
|
|
18
22
|
* live frames for those accounts. Do NOT treat an account absent from the
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
*
|
|
13
13
|
* A subscribe-time snapshot arrives ahead of the live diffs, carrying one row
|
|
14
14
|
* per margin account you own IN THE APPLICATION YOU AUTHENTICATED UNDER -
|
|
15
|
-
* including FLAT accounts
|
|
15
|
+
* including FLAT accounts. A flat account sends no periodic frame; it gets a
|
|
16
|
+
* live frame (on the same per-account `sequence`) only after its collateral
|
|
17
|
+
* moves. Moves before the producer's next tick collapse into one frame with
|
|
18
|
+
* the latest state, normally within ~2s; a burst wider than 512 flat accounts
|
|
19
|
+
* spreads over the following ticks. Live
|
|
16
20
|
* delivery is wider: it is per user and carries no application filter, so if
|
|
17
21
|
* the same wallet trades through more than one application you also receive
|
|
18
22
|
* live frames for those accounts. Do NOT treat an account absent from the
|
|
@@ -29,7 +29,7 @@ export type CopyStopReason = "FOLLOWER" | "STOP_LOSS" | "SKIP_LIMIT" | "ADMIN" |
|
|
|
29
29
|
* Why a leader fill was not mirrored. Only `INSUFFICIENT_MARGIN` advances the
|
|
30
30
|
* relationship's `consecutiveSkips` streak.
|
|
31
31
|
*/
|
|
32
|
-
export type CopySkipReason = "INSUFFICIENT_MARGIN" | "BELOW_MIN" | "LEVERAGE_MISMATCH" | "MARKET_STATE" | "LEADER_EQUITY" | "NO_LIQUIDITY";
|
|
32
|
+
export type CopySkipReason = "INSUFFICIENT_MARGIN" | "BELOW_MIN" | "LEVERAGE_MISMATCH" | "MARKET_STATE" | "LEADER_EQUITY" | "NO_LIQUIDITY" | "MARGIN_MODE_CONFLICT";
|
|
33
33
|
/**
|
|
34
34
|
* Why a relationship frame was sent. `snapshot` marks a subscribe-time
|
|
35
35
|
* baseline row; every other value names the change that produced a live
|
|
@@ -30,7 +30,13 @@
|
|
|
30
30
|
* `quoteAssetId`, `baseToken`, `quoteToken`, `baseAssetName`, `quoteAssetName`,
|
|
31
31
|
* `baseDecimals` and `quoteDecimals`. Perp frames add `minLeverage`. These are
|
|
32
32
|
* declared optional because a server that predates them omits them.
|
|
33
|
+
*
|
|
34
|
+
* Perp frames also carry `riskTiers`, the market's whole margin ladder in the
|
|
35
|
+
* same {@link RiskTier} shape and values as the REST perp config's
|
|
36
|
+
* `riskTiers`. An edit to any tier emits a `config_change` whose
|
|
37
|
+
* `changedFields` names `risk_tiers`.
|
|
33
38
|
*/
|
|
39
|
+
import type { RiskTier } from "../../market";
|
|
34
40
|
/**
|
|
35
41
|
* The kind of instrument change a frame reports.
|
|
36
42
|
*
|
|
@@ -118,6 +124,13 @@ export interface InstrumentEventData {
|
|
|
118
124
|
initialMarginRate?: string;
|
|
119
125
|
/** Maintenance margin rate (decimal string). Perp-only; omitted for spot. */
|
|
120
126
|
maintenanceMarginRate?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The market's whole margin ladder, ascending by `tierLevel`, with the same
|
|
129
|
+
* fields and values as the REST perp config's `riskTiers` (no
|
|
130
|
+
* `maxPositionSize`). Perp-only; omitted for spot, and declared optional
|
|
131
|
+
* because a server that predates it omits it.
|
|
132
|
+
*/
|
|
133
|
+
riskTiers?: RiskTier[];
|
|
121
134
|
/** Names of the fields this mutation touched (snake_case wire field names) */
|
|
122
135
|
changedFields: string[];
|
|
123
136
|
/** Timestamp when the configuration was last updated (ISO 8601) */
|
|
@@ -30,4 +30,9 @@
|
|
|
30
30
|
* `quoteAssetId`, `baseToken`, `quoteToken`, `baseAssetName`, `quoteAssetName`,
|
|
31
31
|
* `baseDecimals` and `quoteDecimals`. Perp frames add `minLeverage`. These are
|
|
32
32
|
* declared optional because a server that predates them omits them.
|
|
33
|
+
*
|
|
34
|
+
* Perp frames also carry `riskTiers`, the market's whole margin ladder in the
|
|
35
|
+
* same {@link RiskTier} shape and values as the REST perp config's
|
|
36
|
+
* `riskTiers`. An edit to any tier emits a `config_change` whose
|
|
37
|
+
* `changedFields` names `risk_tiers`.
|
|
33
38
|
*/
|
|
@@ -57,8 +57,11 @@ export interface CommonOrderEventData {
|
|
|
57
57
|
quantity?: string;
|
|
58
58
|
/** Order quantity in RAW (integer, base-unit) precision. Wire: `quantity_raw`. */
|
|
59
59
|
quantityRaw?: string;
|
|
60
|
-
/**
|
|
61
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Time in force. `null` on every event of a MARKET order, which has none,
|
|
62
|
+
* and on a maker fill, which does not carry the maker's value.
|
|
63
|
+
*/
|
|
64
|
+
timeInForce?: TimeInForce | (string & {}) | null;
|
|
62
65
|
/**
|
|
63
66
|
* Client-assigned correlation handle, echoed so an event can be matched to
|
|
64
67
|
* the request that placed the order without a round trip to `getOrder`.
|
|
@@ -127,11 +127,13 @@ export interface PositionEventData {
|
|
|
127
127
|
* not move it. Do not use it as a reconciliation key — that is `version`'s
|
|
128
128
|
* job; this is display metadata.
|
|
129
129
|
*
|
|
130
|
-
* It matches a REST read of the same OPEN position exactly.
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
130
|
+
* It matches a REST read of the same OPEN position exactly. A TERMINAL REST
|
|
131
|
+
* read carries the instant the matching engine emitted the close, which can
|
|
132
|
+
* differ slightly from this frame's close instant; older terminal rows may
|
|
133
|
+
* instead carry the server's persistence clock, trailing the close by the
|
|
134
|
+
* persistence lag. Any position read after a matching-engine restart also
|
|
135
|
+
* comes from the persistence clock and differs by that lag. Accurate to that
|
|
136
|
+
* lag, not to the microsecond.
|
|
135
137
|
*
|
|
136
138
|
* A third case is not lag-bounded: while the server's matching engine is
|
|
137
139
|
* unreachable, a REST read of an OPEN position falls back to that row's
|
|
@@ -203,6 +205,20 @@ export interface PositionEventData {
|
|
|
203
205
|
* released only after durable acknowledgement.
|
|
204
206
|
*/
|
|
205
207
|
version?: number;
|
|
208
|
+
/**
|
|
209
|
+
* Lifetime funding since the position opened (decimal string; positive
|
|
210
|
+
* means paid, negative means received): the funding accrued on the size
|
|
211
|
+
* still open plus the funding its partial closes settled. A terminal frame
|
|
212
|
+
* carries the closed position's whole-life total, the same `fundingPaid` a
|
|
213
|
+
* REST read of the closed position returns. The subscribe-time snapshot
|
|
214
|
+
* carries the REST value for the same row.
|
|
215
|
+
*
|
|
216
|
+
* Absent means UNKNOWN, never zero: the server cannot account for every
|
|
217
|
+
* earlier reduction yet (a value would understate it), or a deployment
|
|
218
|
+
* older than this field sent the frame. Keep the last known value rather
|
|
219
|
+
* than clearing it.
|
|
220
|
+
*/
|
|
221
|
+
fundingPaid?: string;
|
|
206
222
|
}
|
|
207
223
|
/**
|
|
208
224
|
* Position event emitted when a user's position state changes.
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* The server injects one `Snapshot` frame per subscription, after the
|
|
5
5
|
* `Subscribed` ack and before that subscription's first live diff. Its `data`
|
|
6
6
|
* is the channel's COMPLETE current state as a flat array — a consumer that
|
|
7
|
-
* applies it wholesale needs no REST baseline read for that channel.
|
|
7
|
+
* applies it wholesale needs no REST baseline read for that channel. `trades`
|
|
8
|
+
* and `ohlcv` are the exceptions: their arrays are recent history rather than
|
|
9
|
+
* complete state. `trades` is the pair's newest trades, which can overlap the
|
|
10
|
+
* first live trades or miss one executed just before the subscribe — dedupe on
|
|
11
|
+
* `tradeId`. `ohlcv` is the subscribed series' newest candles, whose newest
|
|
12
|
+
* candle can be partial or missing — upsert live candles by `T`.
|
|
8
13
|
*
|
|
9
14
|
* Two rules hold across every channel:
|
|
10
15
|
*
|
|
@@ -24,6 +29,7 @@
|
|
|
24
29
|
* frame, so its callback is never invoked. That is a silent no-op, never an
|
|
25
30
|
* error.
|
|
26
31
|
*/
|
|
32
|
+
import type { Candlestick } from "../market";
|
|
27
33
|
import type { OrderSide, OrderType, SelfTradePreventionMode, TimeInForce, TradingMode } from "../trading";
|
|
28
34
|
/**
|
|
29
35
|
* Receives one channel's complete subscribe-time state.
|
|
@@ -42,6 +48,21 @@ import type { OrderSide, OrderType, SelfTradePreventionMode, TimeInForce, Tradin
|
|
|
42
48
|
* see `MonacoWebSocket` for the full rule.
|
|
43
49
|
*/
|
|
44
50
|
export type SnapshotHandler<T> = (items: T[]) => void;
|
|
51
|
+
/**
|
|
52
|
+
* One candle in an `ohlcv` channel snapshot: the live frame's candlestick
|
|
53
|
+
* without `s`.
|
|
54
|
+
*
|
|
55
|
+
* The channel fixes the pair, interval and price series, so a row carries no
|
|
56
|
+
* envelope and no symbol; `i` is the subscription's interval. `T` is the
|
|
57
|
+
* period start and `t` the period end (start plus the interval), as on a live
|
|
58
|
+
* candle.
|
|
59
|
+
*
|
|
60
|
+
* The snapshot is the series' newest candles, oldest first: recent history,
|
|
61
|
+
* not a gap-free replay. The newest candle can be partial or missing, so a
|
|
62
|
+
* consumer upserts live candles by `T` — a live candle replaces the snapshot
|
|
63
|
+
* candle with the same `T`, or appends a newer one.
|
|
64
|
+
*/
|
|
65
|
+
export type OHLCVSnapshotCandle = Omit<Candlestick, "s">;
|
|
45
66
|
/**
|
|
46
67
|
* One resting order in an `orders` channel snapshot.
|
|
47
68
|
*
|
|
@@ -102,7 +123,7 @@ export interface OrderSnapshotItem {
|
|
|
102
123
|
remainingQuantityRaw: string | null;
|
|
103
124
|
/** Order status; the snapshot carries only resting statuses */
|
|
104
125
|
status: string;
|
|
105
|
-
/** Time in force */
|
|
126
|
+
/** Time in force; `null` on a MARKET order, which has none */
|
|
106
127
|
timeInForce: TimeInForce | (string & {}) | null;
|
|
107
128
|
/** Average fill price (decimal string); `null` before the first fill */
|
|
108
129
|
averageFillPrice: string | null;
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* The server injects one `Snapshot` frame per subscription, after the
|
|
5
5
|
* `Subscribed` ack and before that subscription's first live diff. Its `data`
|
|
6
6
|
* is the channel's COMPLETE current state as a flat array — a consumer that
|
|
7
|
-
* applies it wholesale needs no REST baseline read for that channel.
|
|
7
|
+
* applies it wholesale needs no REST baseline read for that channel. `trades`
|
|
8
|
+
* and `ohlcv` are the exceptions: their arrays are recent history rather than
|
|
9
|
+
* complete state. `trades` is the pair's newest trades, which can overlap the
|
|
10
|
+
* first live trades or miss one executed just before the subscribe — dedupe on
|
|
11
|
+
* `tradeId`. `ohlcv` is the subscribed series' newest candles, whose newest
|
|
12
|
+
* candle can be partial or missing — upsert live candles by `T`.
|
|
8
13
|
*
|
|
9
14
|
* Two rules hold across every channel:
|
|
10
15
|
*
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -2804,12 +2804,12 @@ export interface paths {
|
|
|
2804
2804
|
*
|
|
2805
2805
|
* Return the authenticated caller's referral position: their referral chain
|
|
2806
2806
|
* upward (L1, L2 and onward — who referred them, who referred that wallet, and
|
|
2807
|
-
* so on, as many levels as
|
|
2808
|
-
* have earned, and their most recent reward rows.
|
|
2807
|
+
* so on, as many levels as their trades on this client application pay), the
|
|
2808
|
+
* total rewards they have earned, and their most recent reward rows.
|
|
2809
2809
|
* Self-scoped — identity comes only from the session, never a path id,
|
|
2810
2810
|
* so a caller can only ever read their own chain. Every other user is
|
|
2811
2811
|
* identified by their public wallet address, never an internal id. An empty
|
|
2812
|
-
* `referrer`
|
|
2812
|
+
* `referrer` means the caller was not referred.
|
|
2813
2813
|
*/
|
|
2814
2814
|
get: operations["get_my_referral_position"];
|
|
2815
2815
|
put?: never;
|
|
@@ -2867,8 +2867,9 @@ export interface paths {
|
|
|
2867
2867
|
* relative to the caller, its parent, how many wallets it has referred (so the
|
|
2868
2868
|
* client knows whether it can be expanded), and what the caller has earned
|
|
2869
2869
|
* from that wallet's own trades. Expanding a node is another call with
|
|
2870
|
-
* `parent` set to that node's wallet; the tree
|
|
2871
|
-
*
|
|
2870
|
+
* `parent` set to that node's wallet; the tree always lists the caller's
|
|
2871
|
+
* direct referees (L1) and goes as deep as any client application rewards,
|
|
2872
|
+
* at most 10 levels.
|
|
2872
2873
|
*
|
|
2873
2874
|
* Self-scoped — identity comes only from the session. A `parent` that is not
|
|
2874
2875
|
* the caller or a referee the caller can expand returns 404, the same
|
|
@@ -2894,7 +2895,7 @@ export interface paths {
|
|
|
2894
2895
|
};
|
|
2895
2896
|
/**
|
|
2896
2897
|
* Get your rewards balance
|
|
2897
|
-
* @description Read accrued
|
|
2898
|
+
* @description Read accrued TraderCodes rewards balance.
|
|
2898
2899
|
*
|
|
2899
2900
|
* Return the caller's current rewards-bucket balances across all reward tokens.
|
|
2900
2901
|
* Rewards accumulate here as referred users trade; call TransferRewards to move
|
|
@@ -2923,7 +2924,7 @@ export interface paths {
|
|
|
2923
2924
|
* Transfer rewards into a trading balance
|
|
2924
2925
|
* @description Transfer earned rewards into a trading balance.
|
|
2925
2926
|
*
|
|
2926
|
-
* Move spendable
|
|
2927
|
+
* Move spendable TraderCodes reward balance from your rewards bucket into a
|
|
2927
2928
|
* trading balance under the authenticated application, making it tradeable
|
|
2928
2929
|
* immediately. Ledger-only (one shared vault + one backend ledger) — no
|
|
2929
2930
|
* on-chain transaction and no gas. Fails with 402 when the rewards balance is
|
|
@@ -3934,7 +3935,7 @@ export interface components {
|
|
|
3934
3935
|
*/
|
|
3935
3936
|
strategyKey?: string | null;
|
|
3936
3937
|
/**
|
|
3937
|
-
* @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED.
|
|
3938
|
+
* @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED. One margin mode per market and margin account: while the account holds the pair in its other risk bucket (an open position, or a resting order that is not reduce-only), an order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code MARGIN_MODE_CONFLICT; reduce-only orders always pass, so a pair already held in both modes can be reduced on either side until one closes.
|
|
3938
3939
|
* @example CROSS
|
|
3939
3940
|
* @enum {string|null}
|
|
3940
3941
|
*/
|
|
@@ -4137,7 +4138,7 @@ export interface components {
|
|
|
4137
4138
|
amount?: string | null;
|
|
4138
4139
|
/**
|
|
4139
4140
|
* Format: int32
|
|
4140
|
-
* @description Basis-point rate applied to this credit. For `BUILDER_FEE`, this is the normalized builder-fee rate charged to the taker. For `REVENUE_SHARE`, it is the realized whole-basis-point rate
|
|
4141
|
+
* @description Basis-point rate applied to this credit. For `BUILDER_FEE`, this is the normalized builder-fee rate charged to the taker. For `REVENUE_SHARE`, it is the realized whole-basis-point rate for that fill and can be lower than the configured BuilderCodes budget.
|
|
4141
4142
|
* @example 1000
|
|
4142
4143
|
*/
|
|
4143
4144
|
appliedBps?: number | null;
|
|
@@ -4735,7 +4736,7 @@ export interface components {
|
|
|
4735
4736
|
*/
|
|
4736
4737
|
strategyKey?: string | null;
|
|
4737
4738
|
/**
|
|
4738
|
-
* @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED.
|
|
4739
|
+
* @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED. One margin mode per market and margin account: while the account holds the pair in its other risk bucket (an open position, or a resting order that is not reduce-only), an order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code MARGIN_MODE_CONFLICT; reduce-only orders always pass, so a pair already held in both modes can be reduced on either side until one closes.
|
|
4739
4740
|
* @example CROSS
|
|
4740
4741
|
* @enum {string|null}
|
|
4741
4742
|
*/
|
|
@@ -4901,7 +4902,7 @@ export interface components {
|
|
|
4901
4902
|
*/
|
|
4902
4903
|
riskBucketId?: string | null;
|
|
4903
4904
|
/**
|
|
4904
|
-
* @description Risk bucket mode for margin TWAP orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED.
|
|
4905
|
+
* @description Risk bucket mode for margin TWAP orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED. One margin mode per market and margin account: while the account holds the pair in its other risk bucket (an open position, or a resting order that is not reduce-only), an order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code MARGIN_MODE_CONFLICT; reduce-only orders always pass, so a pair already held in both modes can be reduced on either side until one closes.
|
|
4905
4906
|
* @example CROSS
|
|
4906
4907
|
* @enum {string|null}
|
|
4907
4908
|
*/
|
|
@@ -5517,15 +5518,15 @@ export interface components {
|
|
|
5517
5518
|
* @example 0x0000000000000000000000000000000000000001
|
|
5518
5519
|
*/
|
|
5519
5520
|
payoutAddress?: string | null;
|
|
5520
|
-
/** @description Whether the BuilderCodes revenue share is switched on. While false no new share accrues; balances already credited stay readable and claimable. */
|
|
5521
|
+
/** @description Whether the BuilderCodes revenue share is switched on for this application. While false no new share accrues on this application's fills; balances already credited stay readable and claimable. */
|
|
5521
5522
|
buildercodesEnabled?: boolean | null;
|
|
5522
5523
|
/**
|
|
5523
5524
|
* Format: uint32
|
|
5524
|
-
* @description
|
|
5525
|
+
* @description This application's configured target BuilderCodes revenue share of Monaco's protocol fee on each taker fill, in basis points. The rate actually paid on a fill is the payout row's appliedBps, which can be lower.
|
|
5525
5526
|
* @example 1000
|
|
5526
5527
|
*/
|
|
5527
5528
|
buildercodesBudgetBps?: number | null;
|
|
5528
|
-
/** @description Whether builder fees are currently charged. While false, `builderFeeBps` is stored but no builder fee is charged. */
|
|
5529
|
+
/** @description Whether builder fees are currently charged on this application's orders. While false, `builderFeeBps` is stored but no builder fee is charged. */
|
|
5529
5530
|
builderFeeEnabled?: boolean | null;
|
|
5530
5531
|
/**
|
|
5531
5532
|
* Format: uint32
|
|
@@ -5698,7 +5699,11 @@ export interface components {
|
|
|
5698
5699
|
maintenanceMarginRequired?: string | null;
|
|
5699
5700
|
freeCollateral?: string | null;
|
|
5700
5701
|
/**
|
|
5701
|
-
* @description The largest amount a transfer-out of this scope
|
|
5702
|
+
* @description The largest amount a transfer-out of this scope accepts without lowering
|
|
5703
|
+
* any position's posted margin, so without moving a leverage or a
|
|
5704
|
+
* liquidation price. A removal from an isolated risk bucket with one open
|
|
5705
|
+
* position can take more, out of that position's margin: see
|
|
5706
|
+
* `max_removable_collateral`.
|
|
5702
5707
|
*
|
|
5703
5708
|
* NOT a clamped `free_collateral`. Free collateral is equity headroom, and
|
|
5704
5709
|
* equity includes mark-to-market gains that a transfer cannot move — so
|
|
@@ -5765,6 +5770,12 @@ export interface components {
|
|
|
5765
5770
|
subaccountKey?: string | null;
|
|
5766
5771
|
/** @description See `MarginAccountSummary.margin_account_state`. */
|
|
5767
5772
|
marginAccountState?: string | null;
|
|
5773
|
+
/**
|
|
5774
|
+
* @description See `MarginAccountSummary.max_removable_collateral`: the largest removal
|
|
5775
|
+
* the risk engine accepts when it may also lower the posted margin of the
|
|
5776
|
+
* bucket's one open position.
|
|
5777
|
+
*/
|
|
5778
|
+
maxRemovableCollateral?: string | null;
|
|
5768
5779
|
};
|
|
5769
5780
|
GetMarkPriceResponse: {
|
|
5770
5781
|
/** Format: uuid */
|
|
@@ -5970,7 +5981,7 @@ export interface components {
|
|
|
5970
5981
|
};
|
|
5971
5982
|
GetMyReferralPositionResponse: {
|
|
5972
5983
|
/**
|
|
5973
|
-
* @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. The same wallet as the first `upline` entry; never an internal id.
|
|
5984
|
+
* @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. The same wallet as the first `upline` entry whenever `upline` is not empty; never an internal id.
|
|
5974
5985
|
* @example 0x0000000000000000000000000000000000000002
|
|
5975
5986
|
*/
|
|
5976
5987
|
referrer?: string | null;
|
|
@@ -5986,7 +5997,7 @@ export interface components {
|
|
|
5986
5997
|
referrerDisplay?: string | null;
|
|
5987
5998
|
/** @description The caller's most recent reward rows, newest first. Bounded server-side — not the full history. */
|
|
5988
5999
|
rewards?: components["schemas"]["ReferralRewardEntry"][] | null;
|
|
5989
|
-
/** @description The caller's referral chain upward, nearest first: L1 (who referred the caller), then L2 (who referred them), and so on
|
|
6000
|
+
/** @description The caller's referral chain upward, nearest first: L1 (who referred the caller), then L2 (who referred them), and so on: the levels the caller's trades on this client application pay (at most 10). Shorter when the chain ends; empty when the caller was not referred or this client application pays no referral levels. These are the wallets the caller's own trades on this client application pay referral rewards to. */
|
|
5990
6001
|
upline?: components["schemas"]["ReferralUplineEntry"][] | null;
|
|
5991
6002
|
};
|
|
5992
6003
|
GetMyReferralTreeResponse: {
|
|
@@ -6085,7 +6096,7 @@ export interface components {
|
|
|
6085
6096
|
*/
|
|
6086
6097
|
tradingMode?: string | null;
|
|
6087
6098
|
/**
|
|
6088
|
-
* @description Time in force: GTC, IOC, or FOK
|
|
6099
|
+
* @description Time in force: GTC, IOC, or FOK. Absent on MARKET orders, which have none.
|
|
6089
6100
|
* @example GTC
|
|
6090
6101
|
*/
|
|
6091
6102
|
timeInForce?: string | null;
|
|
@@ -6609,11 +6620,13 @@ export interface components {
|
|
|
6609
6620
|
* same instant — the list, the detail read, the risk read, the WebSocket
|
|
6610
6621
|
* positions snapshot, and the live position_update frames.
|
|
6611
6622
|
*
|
|
6612
|
-
*
|
|
6613
|
-
*
|
|
6614
|
-
* position_update frame
|
|
6615
|
-
*
|
|
6616
|
-
*
|
|
6623
|
+
* A TERMINAL row carries the instant the matching engine emitted the
|
|
6624
|
+
* close, which can differ slightly from the close instant on the live
|
|
6625
|
+
* position_update frame; older terminal rows may instead carry the
|
|
6626
|
+
* persistence clock, trailing the close by the persistence lag. Any
|
|
6627
|
+
* position read after a matching-engine restart also comes from the
|
|
6628
|
+
* persistence clock and differs from the matching engine's by that lag.
|
|
6629
|
+
* Accurate to that lag, not to the microsecond.
|
|
6617
6630
|
*
|
|
6618
6631
|
* A third case is not lag-bounded: an OPEN row read while the matching
|
|
6619
6632
|
* engine is unreachable falls back to the row's own lifecycle columns
|
|
@@ -6656,9 +6669,14 @@ export interface components {
|
|
|
6656
6669
|
*/
|
|
6657
6670
|
exitPrice?: string | null;
|
|
6658
6671
|
/**
|
|
6659
|
-
* @description Lifetime funding paid (signed; negative means
|
|
6660
|
-
*
|
|
6661
|
-
*
|
|
6672
|
+
* @description Lifetime funding paid since the position opened (signed; negative means
|
|
6673
|
+
* received). On a terminal row, summed over the position's reducing
|
|
6674
|
+
* executions. On an OPEN or LIQUIDATING row, the funding accrued on the size
|
|
6675
|
+
* still open plus the funding its partial closes settled, so the last open
|
|
6676
|
+
* value equals the terminal value. Absent when the position's reducing
|
|
6677
|
+
* executions do not account for its whole lifetime, and on an OPEN or
|
|
6678
|
+
* LIQUIDATING row whenever lifetime_totals_status is not COMPLETE; never an
|
|
6679
|
+
* understated partial.
|
|
6662
6680
|
*/
|
|
6663
6681
|
fundingPaid?: string | null;
|
|
6664
6682
|
/**
|
|
@@ -6680,6 +6698,9 @@ export interface components {
|
|
|
6680
6698
|
* for positions predating the PnL service — rather than an understated
|
|
6681
6699
|
* partial. On a terminal row it is also null until the final close is
|
|
6682
6700
|
* recorded in the position's PnL sample, or while fee data is incomplete.
|
|
6701
|
+
* On an OPEN or LIQUIDATING row it is also null when the position's reductions
|
|
6702
|
+
* do not account for its realized PnL (lifetime_totals_status INCOMPLETE),
|
|
6703
|
+
* rather than an understated total.
|
|
6683
6704
|
*/
|
|
6684
6705
|
cumFees?: string | null;
|
|
6685
6706
|
/**
|
|
@@ -6693,6 +6714,13 @@ export interface components {
|
|
|
6693
6714
|
* `Position.opened_at` above.
|
|
6694
6715
|
*/
|
|
6695
6716
|
openedAt?: string | null;
|
|
6717
|
+
/**
|
|
6718
|
+
* Format: enum
|
|
6719
|
+
* @description Whether this position's lifetime totals are served. Same contract as
|
|
6720
|
+
* `Position.lifetime_totals_status` above.
|
|
6721
|
+
* @enum {string|null}
|
|
6722
|
+
*/
|
|
6723
|
+
lifetimeTotalsStatus?: "LIFETIME_TOTALS_STATUS_UNSPECIFIED" | "LIFETIME_TOTALS_STATUS_COMPLETE" | "LIFETIME_TOTALS_STATUS_PENDING" | "LIFETIME_TOTALS_STATUS_INCOMPLETE" | null;
|
|
6696
6724
|
};
|
|
6697
6725
|
GetPositionRiskResponse: {
|
|
6698
6726
|
positionId?: string | null;
|
|
@@ -6738,11 +6766,13 @@ export interface components {
|
|
|
6738
6766
|
* same instant — the list, the detail read, the risk read, the WebSocket
|
|
6739
6767
|
* positions snapshot, and the live position_update frames.
|
|
6740
6768
|
*
|
|
6741
|
-
*
|
|
6742
|
-
*
|
|
6743
|
-
* position_update frame
|
|
6744
|
-
*
|
|
6745
|
-
*
|
|
6769
|
+
* A TERMINAL row carries the instant the matching engine emitted the
|
|
6770
|
+
* close, which can differ slightly from the close instant on the live
|
|
6771
|
+
* position_update frame; older terminal rows may instead carry the
|
|
6772
|
+
* persistence clock, trailing the close by the persistence lag. Any
|
|
6773
|
+
* position read after a matching-engine restart also comes from the
|
|
6774
|
+
* persistence clock and differs from the matching engine's by that lag.
|
|
6775
|
+
* Accurate to that lag, not to the microsecond.
|
|
6746
6776
|
*
|
|
6747
6777
|
* A third case is not lag-bounded: an OPEN row read while the matching
|
|
6748
6778
|
* engine is unreachable falls back to the row's own lifecycle columns
|
|
@@ -7835,7 +7865,11 @@ export interface components {
|
|
|
7835
7865
|
maintenanceMarginRequired?: string | null;
|
|
7836
7866
|
freeCollateral?: string | null;
|
|
7837
7867
|
/**
|
|
7838
|
-
* @description The largest amount a transfer-out of this scope
|
|
7868
|
+
* @description The largest amount a transfer-out of this scope accepts without lowering
|
|
7869
|
+
* any position's posted margin, so without moving a leverage or a
|
|
7870
|
+
* liquidation price. A removal from an isolated risk bucket with one open
|
|
7871
|
+
* position can take more, out of that position's margin: see
|
|
7872
|
+
* `max_removable_collateral`.
|
|
7839
7873
|
*
|
|
7840
7874
|
* NOT a clamped `free_collateral`. Free collateral is equity headroom, and
|
|
7841
7875
|
* equity includes mark-to-market gains that a transfer cannot move — so
|
|
@@ -7940,6 +7974,25 @@ export interface components {
|
|
|
7940
7974
|
* sub-account).
|
|
7941
7975
|
*/
|
|
7942
7976
|
marginAccountState?: string | null;
|
|
7977
|
+
/**
|
|
7978
|
+
* @description The largest removal from this risk bucket the risk engine accepts when
|
|
7979
|
+
* the removal may also lower the posted margin of the bucket's one open
|
|
7980
|
+
* position: `withdrawable_collateral` plus the position's margin above its
|
|
7981
|
+
* initial margin at the mark, capped by what the parent margin account
|
|
7982
|
+
* accepts. Everything past `withdrawable_collateral` comes out of the
|
|
7983
|
+
* position's margin, so it raises the position's leverage and moves its
|
|
7984
|
+
* liquidation price toward the mark.
|
|
7985
|
+
*
|
|
7986
|
+
* Equal to `withdrawable_collateral` on a cross risk bucket and on an
|
|
7987
|
+
* isolated one with no open position or several, where a removal never
|
|
7988
|
+
* reaches into posted margin.
|
|
7989
|
+
*
|
|
7990
|
+
* Present only on risk-bucket rows served from a live risk engine snapshot;
|
|
7991
|
+
* absent on parent rows and on persisted-fallback reads. Printed truncated
|
|
7992
|
+
* toward zero at the quote asset's precision, like
|
|
7993
|
+
* `withdrawable_collateral`.
|
|
7994
|
+
*/
|
|
7995
|
+
maxRemovableCollateral?: string | null;
|
|
7943
7996
|
};
|
|
7944
7997
|
MatchResult: {
|
|
7945
7998
|
/**
|
|
@@ -8347,8 +8400,11 @@ export interface components {
|
|
|
8347
8400
|
unrealizedPnl?: string | null;
|
|
8348
8401
|
positionCount?: string | null;
|
|
8349
8402
|
/**
|
|
8350
|
-
* @description The largest transfer-out of this risk bucket the engine
|
|
8351
|
-
*
|
|
8403
|
+
* @description The largest transfer-out of this risk bucket the engine accepts without
|
|
8404
|
+
* lowering a position's posted margin — the bound enforced on bucket
|
|
8405
|
+
* collateral withdrawals that leave the positions' leverage alone. A removal
|
|
8406
|
+
* from an isolated risk bucket with one open position can take more: see
|
|
8407
|
+
* `max_removable_collateral`.
|
|
8352
8408
|
*
|
|
8353
8409
|
* NOT a clamped `free_collateral`: free collateral is equity headroom and
|
|
8354
8410
|
* credits mark-to-market gains that a transfer-out cannot move. This bound
|
|
@@ -8410,6 +8466,16 @@ export interface components {
|
|
|
8410
8466
|
copyFollowId?: string | null;
|
|
8411
8467
|
/** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
|
|
8412
8468
|
copyLeaderHandle?: string | null;
|
|
8469
|
+
/**
|
|
8470
|
+
* @description The largest removal from this risk bucket the engine accepts when the
|
|
8471
|
+
* removal may also lower the posted margin of the bucket's one open
|
|
8472
|
+
* position, down to its initial margin at the mark — the same figure as
|
|
8473
|
+
* `MarginAccountSummary.max_removable_collateral`. Equal to
|
|
8474
|
+
* `withdrawable_collateral` for a cross risk bucket and for an isolated one
|
|
8475
|
+
* with no open position or several. Present only when a live risk engine
|
|
8476
|
+
* snapshot served it; truncated toward zero at quote decimals.
|
|
8477
|
+
*/
|
|
8478
|
+
maxRemovableCollateral?: string | null;
|
|
8413
8479
|
};
|
|
8414
8480
|
PortfolioSeriesWindow: {
|
|
8415
8481
|
/**
|
|
@@ -8532,11 +8598,13 @@ export interface components {
|
|
|
8532
8598
|
* same instant — the list, the detail read, the risk read, the WebSocket
|
|
8533
8599
|
* positions snapshot, and the live position_update frames.
|
|
8534
8600
|
*
|
|
8535
|
-
*
|
|
8536
|
-
*
|
|
8537
|
-
* position_update frame
|
|
8538
|
-
*
|
|
8539
|
-
*
|
|
8601
|
+
* A TERMINAL row carries the instant the matching engine emitted the
|
|
8602
|
+
* close, which can differ slightly from the close instant on the live
|
|
8603
|
+
* position_update frame; older terminal rows may instead carry the
|
|
8604
|
+
* persistence clock, trailing the close by the persistence lag. Any
|
|
8605
|
+
* position read after a matching-engine restart also comes from the
|
|
8606
|
+
* persistence clock and differs from the matching engine's by that lag.
|
|
8607
|
+
* Accurate to that lag, not to the microsecond.
|
|
8540
8608
|
*
|
|
8541
8609
|
* A third case is not lag-bounded: an OPEN row read while the matching
|
|
8542
8610
|
* engine is unreachable falls back to the row's own lifecycle columns
|
|
@@ -8579,9 +8647,14 @@ export interface components {
|
|
|
8579
8647
|
*/
|
|
8580
8648
|
exitPrice?: string | null;
|
|
8581
8649
|
/**
|
|
8582
|
-
* @description Lifetime funding paid (signed; negative means
|
|
8583
|
-
*
|
|
8584
|
-
*
|
|
8650
|
+
* @description Lifetime funding paid since the position opened (signed; negative means
|
|
8651
|
+
* received). On a terminal row, summed over the position's reducing
|
|
8652
|
+
* executions. On an OPEN or LIQUIDATING row, the funding accrued on the size
|
|
8653
|
+
* still open plus the funding its partial closes settled, so the last open
|
|
8654
|
+
* value equals the terminal value. Absent when the position's reducing
|
|
8655
|
+
* executions do not account for its whole lifetime, and on an OPEN or
|
|
8656
|
+
* LIQUIDATING row whenever lifetime_totals_status is not COMPLETE; never an
|
|
8657
|
+
* understated partial.
|
|
8585
8658
|
*/
|
|
8586
8659
|
fundingPaid?: string | null;
|
|
8587
8660
|
/**
|
|
@@ -8603,6 +8676,9 @@ export interface components {
|
|
|
8603
8676
|
* for positions predating the PnL service — rather than an understated
|
|
8604
8677
|
* partial. On a terminal row it is also null until the final close is
|
|
8605
8678
|
* recorded in the position's PnL sample, or while fee data is incomplete.
|
|
8679
|
+
* On an OPEN or LIQUIDATING row it is also null when the position's reductions
|
|
8680
|
+
* do not account for its realized PnL (lifetime_totals_status INCOMPLETE),
|
|
8681
|
+
* rather than an understated total.
|
|
8606
8682
|
*/
|
|
8607
8683
|
cumFees?: string | null;
|
|
8608
8684
|
/**
|
|
@@ -8639,6 +8715,28 @@ export interface components {
|
|
|
8639
8715
|
* equal version.
|
|
8640
8716
|
*/
|
|
8641
8717
|
openedAt?: string | null;
|
|
8718
|
+
/**
|
|
8719
|
+
* Format: enum
|
|
8720
|
+
* @description Whether this row's lifetime totals (exit_price, realized_roe, fees_paid,
|
|
8721
|
+
* funding_paid, cum_fees, net_realized_pnl) are served: COMPLETE when the
|
|
8722
|
+
* position's history covers its whole lifetime, PENDING while that history
|
|
8723
|
+
* is still being written up to this row's version or the row changed while
|
|
8724
|
+
* it was being read (every lifetime field is
|
|
8725
|
+
* absent; retry shortly), INCOMPLETE when the totals are not complete now
|
|
8726
|
+
* and a quick retry will not change that (a legacy-history gap is
|
|
8727
|
+
* permanent; a missing or drifted maintained-totals row is repaired by the
|
|
8728
|
+
* background reconcile at startup and daily; every field that is present
|
|
8729
|
+
* comes from the maintained totals, which are cross-checked against each
|
|
8730
|
+
* other and repaired by the background reconcile; an absent one is not
|
|
8731
|
+
* zero). Until the position-history
|
|
8732
|
+
* checkpoint is seeded, PENDING arises only when the position row changed
|
|
8733
|
+
* between the row read and the totals read. OPEN and LIQUIDATING positions
|
|
8734
|
+
* are checked against realized PnL too, and are INCOMPLETE without cum_fees
|
|
8735
|
+
* or funding_paid when their reductions do not account for it. Set on every
|
|
8736
|
+
* row of the REST and gRPC reads; WebSocket position frames do not carry it.
|
|
8737
|
+
* @enum {string|null}
|
|
8738
|
+
*/
|
|
8739
|
+
lifetimeTotalsStatus?: "LIFETIME_TOTALS_STATUS_UNSPECIFIED" | "LIFETIME_TOTALS_STATUS_COMPLETE" | "LIFETIME_TOTALS_STATUS_PENDING" | "LIFETIME_TOTALS_STATUS_INCOMPLETE" | null;
|
|
8642
8740
|
};
|
|
8643
8741
|
PositionHistoryEvent: {
|
|
8644
8742
|
id?: string | null;
|
|
@@ -8948,7 +9046,7 @@ export interface components {
|
|
|
8948
9046
|
source?: string | null;
|
|
8949
9047
|
/**
|
|
8950
9048
|
* Format: int32
|
|
8951
|
-
* @description Referral level the caller earns from this source at: 1 (direct), 2, and so on (at most 10). Rows at a level deeper than
|
|
9049
|
+
* @description Referral level the caller earns from this source at: 1 (direct), 2, and so on (at most 10). Rows at a level deeper than TraderCodes rewards today are earlier earnings, kept as history.
|
|
8952
9050
|
* @example 1
|
|
8953
9051
|
*/
|
|
8954
9052
|
level?: number | null;
|
|
@@ -8977,7 +9075,7 @@ export interface components {
|
|
|
8977
9075
|
* `GetRewardsBalance` reports the live bucket, which `TransferRewards` draws
|
|
8978
9076
|
* down, so the two diverge after any transfer. Read the rewards balance for
|
|
8979
9077
|
* current availability. Denominated in the single reward token's atomic units
|
|
8980
|
-
* (Monaco pays
|
|
9078
|
+
* (Monaco pays TraderCodes rewards in one token — the quote asset); if a deployment
|
|
8981
9079
|
* ever pays in more than one reward token, atomic units across tokens are not
|
|
8982
9080
|
* additive, so read the per-token `earnings_by_source` rows for a correct
|
|
8983
9081
|
* breakdown.
|
|
@@ -9010,7 +9108,7 @@ export interface components {
|
|
|
9010
9108
|
* @example 100000
|
|
9011
9109
|
*/
|
|
9012
9110
|
level3Earned?: string | null;
|
|
9013
|
-
/** @description All-time credited earnings per referral level, ascending by level, one entry per level the caller has earned at (levels with nothing earned are omitted). Covers every level, including levels deeper than
|
|
9111
|
+
/** @description All-time credited earnings per referral level, ascending by level, one entry per level the caller has earned at (levels with nothing earned are omitted). Covers every level, including levels deeper than TraderCodes rewards today. */
|
|
9014
9112
|
byLevel?: components["schemas"]["LevelEarnings"][] | null;
|
|
9015
9113
|
};
|
|
9016
9114
|
/** @description A single reward the caller has earned, one row per referred trade × level. */
|
|
@@ -9714,6 +9812,11 @@ export interface components {
|
|
|
9714
9812
|
* @example 100.25
|
|
9715
9813
|
*/
|
|
9716
9814
|
referencePrice?: string | null;
|
|
9815
|
+
/**
|
|
9816
|
+
* @description Structured code of the refusal behind rejectReason, the same code placing the order would return in the error envelope (e.g. MARGIN_MODE_CONFLICT when the margin account holds the pair in its other margin mode; INVALID_ORDER for the catch-all). Present for client-class refusals; absent on an accepted preview, and absent when the preview failed on a server-side fault (rejectReason is then a generic retry message).
|
|
9817
|
+
* @example MARGIN_MODE_CONFLICT
|
|
9818
|
+
*/
|
|
9819
|
+
rejectCode?: string | null;
|
|
9717
9820
|
};
|
|
9718
9821
|
SimulateParentMarginOrderRiskRequest: {
|
|
9719
9822
|
/** Format: uuid */
|
|
@@ -10919,7 +11022,7 @@ export interface components {
|
|
|
10919
11022
|
*/
|
|
10920
11023
|
isNewUser?: boolean | null;
|
|
10921
11024
|
/**
|
|
10922
|
-
* @description True when a
|
|
11025
|
+
* @description True when a TraderCodes referral relationship was recorded on this verify: a valid, non-self TraderCode presented on the wallet's first sign-in to THIS application resolved to a known referrer. Scoped like `is_new_user` (per `(wallet, application)`), so a wallet already registered on another application can still see this on its first sign-in to a new one. False for a returning user of this application, an absent or unknown code, or a self-referral. Confirms the referral landed for the signup success screen.
|
|
10923
11026
|
* @example true
|
|
10924
11027
|
*/
|
|
10925
11028
|
referralApplied?: boolean | null;
|
|
@@ -17611,19 +17714,33 @@ export interface operations {
|
|
|
17611
17714
|
* carries no timestamps for a position the persistor has not written
|
|
17612
17715
|
* yet. It is ordered by `(marginAccountId, tradingPairId, positionId)`
|
|
17613
17716
|
* ascending — stable and total, but UUID order, NOT newest-first.
|
|
17614
|
-
* -
|
|
17615
|
-
* `(
|
|
17616
|
-
*
|
|
17617
|
-
*
|
|
17618
|
-
*
|
|
17619
|
-
* `opened_at`
|
|
17620
|
-
*
|
|
17621
|
-
*
|
|
17622
|
-
*
|
|
17623
|
-
*
|
|
17717
|
+
* - `status=CLOSED` and `status=LIQUIDATED` read persisted terminal
|
|
17718
|
+
* rows, ordered by `(closed_at, id)` descending: newest-closed first,
|
|
17719
|
+
* so a position held for weeks and closed today leads the list. A
|
|
17720
|
+
* terminal row's `closed_at` is the closing command's instant, stamped
|
|
17721
|
+
* once. A legacy terminal row with no `closed_at` sorts by its
|
|
17722
|
+
* `opened_at` instead (the epoch if that is missing too).
|
|
17723
|
+
* - Every other persisted walk (no filter, `status=LIQUIDATING`, and
|
|
17724
|
+
* `status=OPEN` when it falls back to persisted rows, see below) is
|
|
17725
|
+
* ordered by the IMMUTABLE `(opened_at, id)` descending:
|
|
17726
|
+
* newest-opened first. These filters admit live rows, whose close time
|
|
17727
|
+
* is unset and changes when they close, so they cannot sort on it. The
|
|
17728
|
+
* removed page-number mode sorted on `COALESCE(closed_at,
|
|
17729
|
+
* last_funding_at, opened_at)`, which *advances* whenever a position
|
|
17730
|
+
* takes a funding payment or closes, so rows moved across a resume
|
|
17731
|
+
* point mid-walk; `opened_at` never changes after the insert. Order
|
|
17732
|
+
* therefore differs from the removed mode's. One exception: an operator
|
|
17733
|
+
* correction may move an OPEN position's `opened_at` EARLIER, never
|
|
17734
|
+
* later, to its opening fill. A walk in flight while that runs can
|
|
17735
|
+
* return such a position a second time, but cannot skip one: dedupe on
|
|
17736
|
+
* `positionId`.
|
|
17737
|
+
*
|
|
17738
|
+
* The two persisted orders are separate cursor spaces too: a token is
|
|
17739
|
+
* pinned to its filter, so it only resumes the order that minted it.
|
|
17624
17740
|
*
|
|
17625
|
-
*
|
|
17626
|
-
* that minted it, and crossing between them is
|
|
17741
|
+
* The live and persisted walks are separate cursor spaces, so a token is
|
|
17742
|
+
* only valid in the one that minted it, and crossing between them is
|
|
17743
|
+
* ASYMMETRIC:
|
|
17627
17744
|
*
|
|
17628
17745
|
* - A PERSISTED token offered to `status=OPEN` while the engine is
|
|
17629
17746
|
* reachable is served: the live branch does not recognise it, declines,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.81",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lint": "biome lint ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@0xmonaco/contracts": "1.0.
|
|
19
|
+
"@0xmonaco/contracts": "1.0.81",
|
|
20
20
|
"zod": "^4.1.12"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|