@0xmonaco/types 1.0.26 → 1.0.29
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/market/index.d.ts +38 -0
- package/dist/portfolio/index.d.ts +7 -0
- package/dist/positions/index.d.ts +21 -0
- package/dist/profile/index.d.ts +38 -1
- package/dist/pulse/index.d.ts +61 -0
- package/dist/pulse/index.js +9 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/trading/index.d.ts +0 -4
- package/dist/trading/responses.d.ts +32 -2
- package/dist/validation/profile.d.ts +1 -0
- package/dist/validation/profile.js +1 -0
- package/dist/validation/trading.d.ts +1 -0
- package/dist/validation/trading.js +17 -4
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +2 -0
- package/dist/wire/schema.d.ts +382 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/market/index.d.ts
CHANGED
|
@@ -213,6 +213,17 @@ export interface ScreenerItem {
|
|
|
213
213
|
totalQuoteVolumeLtd: string;
|
|
214
214
|
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
215
215
|
totalTradeCountLtd: number;
|
|
216
|
+
/**
|
|
217
|
+
* Latest settled funding rate as a decimal fraction per funding window (the
|
|
218
|
+
* capped settled value); null for spot pairs and margin pairs with no
|
|
219
|
+
* settled funding window yet
|
|
220
|
+
*/
|
|
221
|
+
latestFundingRate: string | null;
|
|
222
|
+
/**
|
|
223
|
+
* Close time of the latest settled funding window (ms since epoch, as string);
|
|
224
|
+
* null for spot pairs and margin pairs with no settled funding window yet
|
|
225
|
+
*/
|
|
226
|
+
lastFundingTime: string | null;
|
|
216
227
|
}
|
|
217
228
|
/**
|
|
218
229
|
* Paginated screener response, sorted by quoteVolume24h desc (nulls last)
|
|
@@ -344,12 +355,16 @@ export interface FundingRecord {
|
|
|
344
355
|
tradingPairId: string;
|
|
345
356
|
fundingRate: string;
|
|
346
357
|
cumulativeFundingPerUnit?: string;
|
|
358
|
+
/** True when the window settled at the carried last rate (sparse-sample rule). */
|
|
359
|
+
carried?: boolean;
|
|
347
360
|
}
|
|
348
361
|
export interface ListFundingHistoryParams {
|
|
349
362
|
startTime?: string;
|
|
350
363
|
endTime?: string;
|
|
351
364
|
page?: number;
|
|
352
365
|
pageSize?: number;
|
|
366
|
+
/** Sort direction for epoch: "ASC" or "DESC" (default DESC). */
|
|
367
|
+
orderBy?: "ASC" | "DESC";
|
|
353
368
|
}
|
|
354
369
|
export interface ListFundingHistoryResponse {
|
|
355
370
|
records: FundingRecord[];
|
|
@@ -357,6 +372,20 @@ export interface ListFundingHistoryResponse {
|
|
|
357
372
|
page: number;
|
|
358
373
|
pageSize: number;
|
|
359
374
|
}
|
|
375
|
+
export interface ListAllFundingHistoryParams {
|
|
376
|
+
startTime?: string;
|
|
377
|
+
endTime?: string;
|
|
378
|
+
page?: number;
|
|
379
|
+
pageSize?: number;
|
|
380
|
+
/** Sort direction for settledAt (default DESC). */
|
|
381
|
+
orderBy?: "ASC" | "DESC";
|
|
382
|
+
}
|
|
383
|
+
export interface ListAllFundingHistoryResponse {
|
|
384
|
+
records: FundingRecord[];
|
|
385
|
+
total: number;
|
|
386
|
+
page: number;
|
|
387
|
+
pageSize: number;
|
|
388
|
+
}
|
|
360
389
|
export interface OpenInterest {
|
|
361
390
|
tradingPairId: string;
|
|
362
391
|
openInterest?: string;
|
|
@@ -431,5 +460,14 @@ export interface MarketAPI extends BaseAPI {
|
|
|
431
460
|
getIndexPrice(tradingPairId: string): Promise<IndexPrice>;
|
|
432
461
|
getFundingState(tradingPairId: string): Promise<FundingState>;
|
|
433
462
|
listFundingHistory(tradingPairId: string, params?: ListFundingHistoryParams): Promise<ListFundingHistoryResponse>;
|
|
463
|
+
/**
|
|
464
|
+
* Fetch settled funding history across every market in one call, so clients
|
|
465
|
+
* don't have to fan out one listFundingHistory request per trading pair.
|
|
466
|
+
* Each record carries its tradingPairId; sorted by settledAt (default DESC).
|
|
467
|
+
* @param params - Optional time bounds (ms-epoch strings, inclusive on
|
|
468
|
+
* settledAt), pagination, and orderBy (ASC or DESC)
|
|
469
|
+
* @returns Promise resolving to the paginated all-markets funding history
|
|
470
|
+
*/
|
|
471
|
+
listAllFundingHistory(params?: ListAllFundingHistoryParams): Promise<ListAllFundingHistoryResponse>;
|
|
434
472
|
getOpenInterest(tradingPairId: string): Promise<OpenInterest>;
|
|
435
473
|
}
|
|
@@ -77,10 +77,17 @@ export interface PortfolioRealizedTotals {
|
|
|
77
77
|
netRealizedPnl: string;
|
|
78
78
|
}
|
|
79
79
|
export interface PortfolioClosedTradeStats {
|
|
80
|
+
/** Fill-based: closing fills in the window (partial fills each counted). */
|
|
80
81
|
count: number;
|
|
82
|
+
/**
|
|
83
|
+
* Position-level: each position (one flat -> open -> flat round-trip) is
|
|
84
|
+
* classified once by its net realized PnL after all fees.
|
|
85
|
+
*/
|
|
81
86
|
winners: number;
|
|
82
87
|
losers: number;
|
|
83
88
|
breakEven: number;
|
|
89
|
+
/** Total classified positions (= winners + losers + breakEven). */
|
|
90
|
+
positions: number;
|
|
84
91
|
winRatePct?: string;
|
|
85
92
|
}
|
|
86
93
|
export interface PortfolioBestDay {
|
|
@@ -10,12 +10,23 @@ export interface Position {
|
|
|
10
10
|
marginMode?: MarginMode;
|
|
11
11
|
tradingPairId: string;
|
|
12
12
|
side: PositionSide;
|
|
13
|
+
/**
|
|
14
|
+
* Open rows: current absolute position quantity. Terminal rows
|
|
15
|
+
* (CLOSED/LIQUIDATED/EXPIRED): total quantity closed over the position's
|
|
16
|
+
* life, summed from its reducing executions when available.
|
|
17
|
+
*/
|
|
13
18
|
size: string;
|
|
14
19
|
entryPrice: string;
|
|
15
20
|
markPrice: string;
|
|
16
21
|
indexPrice?: string;
|
|
17
22
|
unrealizedPnl: string;
|
|
18
23
|
realizedPnl: string;
|
|
24
|
+
/**
|
|
25
|
+
* Open rows: current isolated collateral for this position's risk bucket.
|
|
26
|
+
* Terminal rows: total initial margin allocated across the position's
|
|
27
|
+
* reducing executions when available — the margin basis for lifetime
|
|
28
|
+
* realized return.
|
|
29
|
+
*/
|
|
19
30
|
isolatedMargin: string;
|
|
20
31
|
leverage?: string;
|
|
21
32
|
/**
|
|
@@ -39,6 +50,16 @@ export interface Position {
|
|
|
39
50
|
liquidationPrice: string;
|
|
40
51
|
status: PositionStatus;
|
|
41
52
|
updatedAt: string;
|
|
53
|
+
/**
|
|
54
|
+
* Lifetime realized PnL net of trading fees and funding. Terminal rows
|
|
55
|
+
* only; absent when the position's reducing executions are unavailable.
|
|
56
|
+
*/
|
|
57
|
+
netRealizedPnl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Lifetime realized return on the total allocated initial margin, as a
|
|
60
|
+
* percentage. Terminal rows only; absent when unavailable.
|
|
61
|
+
*/
|
|
62
|
+
realizedRoe?: string;
|
|
42
63
|
}
|
|
43
64
|
export interface ListPositionsParams {
|
|
44
65
|
marginAccountId?: string;
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -237,6 +237,23 @@ export interface GetUserTradesParams {
|
|
|
237
237
|
pageSize?: number;
|
|
238
238
|
/** Filter by trading pair ID (UUID) */
|
|
239
239
|
tradingPairId?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Pagination cursor with three distinct states:
|
|
242
|
+
* - Omitted (`undefined`): legacy page-number pagination via `page`,
|
|
243
|
+
* limited to recent history once the archive window is enabled.
|
|
244
|
+
* - Empty string (`""`): start a cursor walk with no prior position, from
|
|
245
|
+
* the newest row (this endpoint always sorts newest-first).
|
|
246
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
247
|
+
* `nextPageToken`; results resume immediately after that position.
|
|
248
|
+
*
|
|
249
|
+
* In either cursor-walk state (empty or non-empty), `page` is ignored, the
|
|
250
|
+
* response omits exact totals (`total`/`totalPages`/`page` are 0), and
|
|
251
|
+
* results cover full trade history — hot and archived rows merged —
|
|
252
|
+
* unlike page-number mode, which only ever sees recent history. Clients
|
|
253
|
+
* that need complete trade history must use the cursor form (pass `""` to
|
|
254
|
+
* start, then follow `nextPageToken`) rather than `page`.
|
|
255
|
+
*/
|
|
256
|
+
pageToken?: string;
|
|
240
257
|
}
|
|
241
258
|
/**
|
|
242
259
|
* Response from getting user trades
|
|
@@ -252,6 +269,21 @@ export interface GetUserTradesResponse {
|
|
|
252
269
|
total: number;
|
|
253
270
|
/** Total number of pages */
|
|
254
271
|
totalPages: number;
|
|
272
|
+
/**
|
|
273
|
+
* Cursor for the next page. Empty on every page-number (legacy) response —
|
|
274
|
+
* page-number mode never mints a token, full page or not, since resuming
|
|
275
|
+
* from a legacy-minted position could silently strand archived history
|
|
276
|
+
* newer than wherever that page happened to end.
|
|
277
|
+
*
|
|
278
|
+
* To walk full history, start a cursor-mode request with `pageToken`
|
|
279
|
+
* present but empty (`""`); from then on the token is present whenever
|
|
280
|
+
* that page returned any rows (AIP-158 "maybe more" semantics), not only
|
|
281
|
+
* when the page is exactly full. Empty only when a cursor-mode page
|
|
282
|
+
* returned zero rows, which is the sole proof the walk is exhausted. The
|
|
283
|
+
* two modes never bridge — page-number pagination is deprecated for deep
|
|
284
|
+
* history.
|
|
285
|
+
*/
|
|
286
|
+
nextPageToken: string;
|
|
255
287
|
}
|
|
256
288
|
/**
|
|
257
289
|
* Direction of a funding payment from the user's perspective.
|
|
@@ -395,7 +427,12 @@ export interface PortfolioStats {
|
|
|
395
427
|
totalTrades: number;
|
|
396
428
|
/** Total fees paid */
|
|
397
429
|
feesPaid: string;
|
|
398
|
-
/**
|
|
430
|
+
/**
|
|
431
|
+
* Position-level win rate: winning positions over winning + losing positions
|
|
432
|
+
* (break-even excluded). Each position (one flat→open→flat round-trip) is
|
|
433
|
+
* classified once by its net realized PnL after all fees, not per fill. Null
|
|
434
|
+
* when the period has no closed positions.
|
|
435
|
+
*/
|
|
399
436
|
winLossRatio: number | null;
|
|
400
437
|
/** Total equity in USDC terms (spot balances plus perps account equity) */
|
|
401
438
|
totalEquity: string;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulse Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public market-pulse news feed: AI-synthesized, per-asset
|
|
5
|
+
* headlines served from the backend's hourly-refreshed cache.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This endpoint is **public (unauthenticated)** and ETag-cacheable.
|
|
8
|
+
* It returns 503 while the backend cache is cold.
|
|
9
|
+
*/
|
|
10
|
+
import type { BaseAPI } from "../api";
|
|
11
|
+
/** Provenance for one pulse item, for attribution links. */
|
|
12
|
+
export interface PulseSource {
|
|
13
|
+
/** Source article or post URL. */
|
|
14
|
+
url: string;
|
|
15
|
+
/** Source author or publication name. */
|
|
16
|
+
author: string;
|
|
17
|
+
/** Source channel: "twitter" or "news". */
|
|
18
|
+
source: string;
|
|
19
|
+
/** Source publication time, ISO-8601. */
|
|
20
|
+
createdAt: string;
|
|
21
|
+
/** Relevance score, 1 (low) to 5 (high). */
|
|
22
|
+
relevance: number;
|
|
23
|
+
}
|
|
24
|
+
/** One synthesized market-pulse headline. */
|
|
25
|
+
export interface PulseItem {
|
|
26
|
+
/** Watchlist ticker (e.g. "BTC") or "MARKET" for a cross-asset story. */
|
|
27
|
+
asset: string;
|
|
28
|
+
/** Sentiment tag: "Bullish", "Neutral", or "Bearish". */
|
|
29
|
+
sentiment: string;
|
|
30
|
+
/** Synthesized 1-2 sentence summary (at most 240 characters). */
|
|
31
|
+
summary: string;
|
|
32
|
+
/** Timestamp of the most recent source; render relative time client-side. */
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
/** Provenance for the item. */
|
|
35
|
+
sources: PulseSource[];
|
|
36
|
+
}
|
|
37
|
+
/** The latest pulse snapshot. */
|
|
38
|
+
export interface GetPulseResponse {
|
|
39
|
+
/** When this snapshot was produced upstream (ISO-8601 UTC); also the ETag value. */
|
|
40
|
+
generatedAt: string;
|
|
41
|
+
/** Asset universe the snapshot was synthesized against. */
|
|
42
|
+
watchlist: string[];
|
|
43
|
+
/** Pulse items, pre-sorted (watchlist order, MARKET last, newest first per asset). */
|
|
44
|
+
items: PulseItem[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Pulse API interface. The endpoint is public (no auth required).
|
|
48
|
+
*/
|
|
49
|
+
export interface PulseAPI extends BaseAPI {
|
|
50
|
+
/**
|
|
51
|
+
* Get the latest market pulse news feed snapshot.
|
|
52
|
+
*
|
|
53
|
+
* Public/unauthenticated; served from the backend cache (refreshed hourly).
|
|
54
|
+
* Items whose figures could not be verified upstream are removed
|
|
55
|
+
* server-side before caching.
|
|
56
|
+
*
|
|
57
|
+
* @returns Promise resolving to the latest snapshot
|
|
58
|
+
* @throws 503 while the backend cache is cold
|
|
59
|
+
*/
|
|
60
|
+
getPulse(): Promise<GetPulseResponse>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulse Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public market-pulse news feed: AI-synthesized, per-asset
|
|
5
|
+
* headlines served from the backend's hourly-refreshed cache.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This endpoint is **public (unauthenticated)** and ETag-cacheable.
|
|
8
|
+
* It returns 503 while the backend cache is cold.
|
|
9
|
+
*/
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { PitpassAPI } from "../pitpass";
|
|
|
10
10
|
import type { PortfolioAPI } from "../portfolio";
|
|
11
11
|
import type { PositionsAPI } from "../positions";
|
|
12
12
|
import type { ProfileAPI } from "../profile";
|
|
13
|
+
import type { PulseAPI } from "../pulse";
|
|
13
14
|
import type { SubAccountsAPI } from "../sub-accounts";
|
|
14
15
|
import type { TradingAPI, TradingMode } from "../trading";
|
|
15
16
|
import type { VaultAPI } from "../vault";
|
|
@@ -101,6 +102,8 @@ export interface MonacoSDK {
|
|
|
101
102
|
whitelist: WhitelistAPI;
|
|
102
103
|
/** Profile operations API */
|
|
103
104
|
profile: ProfileAPI;
|
|
105
|
+
/** Public market-pulse news feed API (cached, hourly-refreshed) */
|
|
106
|
+
pulse: PulseAPI;
|
|
104
107
|
/** Orderbook REST API for fetching orderbook snapshots */
|
|
105
108
|
orderbook: {
|
|
106
109
|
getOrderbook: (tradingPairId: string, options?: {
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -38,9 +38,7 @@ export interface TradingAPI extends BaseAPI {
|
|
|
38
38
|
positionSide?: PositionSide;
|
|
39
39
|
leverage?: string;
|
|
40
40
|
reduceOnly?: boolean;
|
|
41
|
-
/** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
|
|
42
41
|
takeProfit?: ParentTpSlLegParams;
|
|
43
|
-
/** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
|
|
44
42
|
stopLoss?: ParentTpSlLegParams;
|
|
45
43
|
}): Promise<CreateOrderResponse>;
|
|
46
44
|
/**
|
|
@@ -65,9 +63,7 @@ export interface TradingAPI extends BaseAPI {
|
|
|
65
63
|
positionSide?: PositionSide;
|
|
66
64
|
leverage?: string;
|
|
67
65
|
reduceOnly?: boolean;
|
|
68
|
-
/** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
|
|
69
66
|
takeProfit?: ParentTpSlLegParams;
|
|
70
|
-
/** @deprecated Entry-attached TP/SL is rejected; use position TP/SL. */
|
|
71
67
|
stopLoss?: ParentTpSlLegParams;
|
|
72
68
|
}): Promise<CreateOrderResponse>;
|
|
73
69
|
/**
|
|
@@ -38,8 +38,6 @@ export interface MatchResult {
|
|
|
38
38
|
} | null;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* @deprecated Entry-attached TP/SL is rejected. Use position-associated TP/SL.
|
|
42
|
-
*
|
|
43
41
|
* Parent TP/SL follows the parent order quantity and becomes active once the
|
|
44
42
|
* parent order creates or extends a position.
|
|
45
43
|
*/
|
|
@@ -139,6 +137,23 @@ export interface GetPaginatedOrdersParams {
|
|
|
139
137
|
page?: number;
|
|
140
138
|
/** Number of orders per page (default: 10, max: 100) */
|
|
141
139
|
pageSize?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Pagination cursor with three distinct states:
|
|
142
|
+
* - Omitted (`undefined`): legacy page-number pagination via `page`,
|
|
143
|
+
* limited to recent history once the archive window is enabled.
|
|
144
|
+
* - Empty string (`""`): start a cursor walk with no prior position, from
|
|
145
|
+
* the newest row (or the oldest, when `orderBy` is `"ASC"`).
|
|
146
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
147
|
+
* `nextPageToken`; results resume immediately after that position.
|
|
148
|
+
*
|
|
149
|
+
* In either cursor-walk state (empty or non-empty), `page` is ignored, the
|
|
150
|
+
* response omits exact totals (`total`/`totalPages`/`page` are 0), and
|
|
151
|
+
* results cover full order history — hot and archived rows merged —
|
|
152
|
+
* unlike page-number mode, which only ever sees recent history. Clients
|
|
153
|
+
* that need complete order history must use the cursor form (pass `""` to
|
|
154
|
+
* start, then follow `nextPageToken`) rather than `page`.
|
|
155
|
+
*/
|
|
156
|
+
pageToken?: string;
|
|
142
157
|
}
|
|
143
158
|
/**
|
|
144
159
|
* Response from getting paginated orders
|
|
@@ -159,6 +174,21 @@ export interface GetPaginatedOrdersResponse {
|
|
|
159
174
|
pageSize: number;
|
|
160
175
|
/** Total number of pages */
|
|
161
176
|
totalPages: number;
|
|
177
|
+
/**
|
|
178
|
+
* Cursor for the next page. Empty on every page-number (legacy) response —
|
|
179
|
+
* page-number mode never mints a token, full page or not, since resuming
|
|
180
|
+
* from a legacy-minted position could silently strand archived history
|
|
181
|
+
* newer than wherever that page happened to end.
|
|
182
|
+
*
|
|
183
|
+
* To walk full history, start a cursor-mode request with `pageToken`
|
|
184
|
+
* present but empty (`""`); from then on the token is present whenever
|
|
185
|
+
* that page returned any rows (AIP-158 "maybe more" semantics), not only
|
|
186
|
+
* when the page is exactly full. Empty only when a cursor-mode page
|
|
187
|
+
* returned zero rows, which is the sole proof the walk is exhausted. The
|
|
188
|
+
* two modes never bridge — page-number pagination is deprecated for deep
|
|
189
|
+
* history.
|
|
190
|
+
*/
|
|
191
|
+
nextPageToken: string;
|
|
162
192
|
}
|
|
163
193
|
/**
|
|
164
194
|
* Response from getting a single order by ID
|
|
@@ -66,6 +66,7 @@ export declare const GetUserTradesSchema: z.ZodObject<{
|
|
|
66
66
|
page: z.ZodOptional<z.ZodNumber>;
|
|
67
67
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
68
68
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
69
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
69
70
|
}, z.core.$strip>;
|
|
70
71
|
export declare const ListFundingPaymentsSchema: z.ZodObject<{
|
|
71
72
|
page: z.ZodOptional<z.ZodNumber>;
|
|
@@ -41,6 +41,7 @@ export const GetUserTradesSchema = z.object({
|
|
|
41
41
|
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
42
42
|
pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
43
43
|
tradingPairId: UUIDSchema.optional(),
|
|
44
|
+
pageToken: z.string().optional(),
|
|
44
45
|
});
|
|
45
46
|
export const ListFundingPaymentsSchema = z.object({
|
|
46
47
|
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
@@ -261,6 +261,7 @@ export declare const GetPaginatedOrdersSchema: z.ZodObject<{
|
|
|
261
261
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
262
262
|
page: z.ZodOptional<z.ZodNumber>;
|
|
263
263
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
264
265
|
}, z.core.$strip>;
|
|
265
266
|
export declare const ConditionalOrderConditionTypeSchema: z.ZodEnum<{
|
|
266
267
|
STOP_LOSS: "STOP_LOSS";
|
|
@@ -141,8 +141,12 @@ export const PlaceLimitOrderSchema = z
|
|
|
141
141
|
message: "leverage is required for normal MARGIN orders",
|
|
142
142
|
path: ["options", "leverage"],
|
|
143
143
|
})
|
|
144
|
-
.refine((data) => !hasParentTpSl(data.options), {
|
|
145
|
-
message: "
|
|
144
|
+
.refine((data) => !hasParentTpSl(data.options) || data.options?.tradingMode === "MARGIN", {
|
|
145
|
+
message: "takeProfit/stopLoss are only supported for MARGIN orders",
|
|
146
|
+
path: ["options"],
|
|
147
|
+
})
|
|
148
|
+
.refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
|
|
149
|
+
message: "takeProfit/stopLoss cannot be attached to reduce-only orders",
|
|
146
150
|
path: ["options"],
|
|
147
151
|
})
|
|
148
152
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
@@ -210,8 +214,12 @@ export const PlaceMarketOrderSchema = z
|
|
|
210
214
|
message: "leverage is required for normal MARGIN orders",
|
|
211
215
|
path: ["options", "leverage"],
|
|
212
216
|
})
|
|
213
|
-
.refine((data) => !hasParentTpSl(data.options), {
|
|
214
|
-
message: "
|
|
217
|
+
.refine((data) => !hasParentTpSl(data.options) || data.options?.tradingMode === "MARGIN", {
|
|
218
|
+
message: "takeProfit/stopLoss are only supported for MARGIN orders",
|
|
219
|
+
path: ["options"],
|
|
220
|
+
})
|
|
221
|
+
.refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
|
|
222
|
+
message: "takeProfit/stopLoss cannot be attached to reduce-only orders",
|
|
215
223
|
path: ["options"],
|
|
216
224
|
})
|
|
217
225
|
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
@@ -285,6 +293,7 @@ export const GetPaginatedOrdersSchema = z.object({
|
|
|
285
293
|
marginAccountId: UUIDSchema.optional(),
|
|
286
294
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
287
295
|
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
296
|
+
pageToken: z.string().optional(),
|
|
288
297
|
});
|
|
289
298
|
export const ConditionalOrderConditionTypeSchema = z.enum(["STOP_LOSS", "TAKE_PROFIT"], {
|
|
290
299
|
message: 'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"',
|
|
@@ -343,6 +352,10 @@ export const BatchCreateOrderItemSchema = z
|
|
|
343
352
|
.refine((data) => data.orderType !== "MARKET" || data.price === undefined, {
|
|
344
353
|
message: "Price must not be provided for MARKET orders",
|
|
345
354
|
path: ["price"],
|
|
355
|
+
})
|
|
356
|
+
.refine((data) => data.orderType !== "MARKET" || data.timeInForce === undefined, {
|
|
357
|
+
message: "timeInForce must not be provided for MARKET orders",
|
|
358
|
+
path: ["timeInForce"],
|
|
346
359
|
})
|
|
347
360
|
.refine((data) => data.riskBucketCollateral === undefined || data.tradingMode === "MARGIN", {
|
|
348
361
|
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
@@ -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_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", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "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_rewards_balance", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "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", "verify_signature"];
|
|
13
|
+
export declare const OPERATION_IDS: readonly ["add_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", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "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_sub_account_limits", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "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_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "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", "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
|
@@ -60,6 +60,7 @@ export const OPERATION_IDS = [
|
|
|
60
60
|
"get_position",
|
|
61
61
|
"get_position_pnl_history",
|
|
62
62
|
"get_position_risk",
|
|
63
|
+
"get_pulse",
|
|
63
64
|
"get_rewards_balance",
|
|
64
65
|
"get_screener",
|
|
65
66
|
"get_sub_account_limits",
|
|
@@ -75,6 +76,7 @@ export const OPERATION_IDS = [
|
|
|
75
76
|
"get_withdrawal",
|
|
76
77
|
"health_check",
|
|
77
78
|
"initiate_withdrawal",
|
|
79
|
+
"list_all_funding_history",
|
|
78
80
|
"list_application_balances",
|
|
79
81
|
"list_application_movements",
|
|
80
82
|
"list_application_orders",
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -1052,6 +1052,26 @@ export interface paths {
|
|
|
1052
1052
|
patch?: never;
|
|
1053
1053
|
trace?: never;
|
|
1054
1054
|
};
|
|
1055
|
+
"/api/v1/market/funding/history": {
|
|
1056
|
+
parameters: {
|
|
1057
|
+
query?: never;
|
|
1058
|
+
header?: never;
|
|
1059
|
+
path?: never;
|
|
1060
|
+
cookie?: never;
|
|
1061
|
+
};
|
|
1062
|
+
/**
|
|
1063
|
+
* @description Historical funding settlements across all perp markets in one call, so
|
|
1064
|
+
* clients don't have to fan out one request per trading pair.
|
|
1065
|
+
*/
|
|
1066
|
+
get: operations["list_all_funding_history"];
|
|
1067
|
+
put?: never;
|
|
1068
|
+
post?: never;
|
|
1069
|
+
delete?: never;
|
|
1070
|
+
options?: never;
|
|
1071
|
+
head?: never;
|
|
1072
|
+
patch?: never;
|
|
1073
|
+
trace?: never;
|
|
1074
|
+
};
|
|
1055
1075
|
"/api/v1/market/pairs": {
|
|
1056
1076
|
parameters: {
|
|
1057
1077
|
query?: never;
|
|
@@ -1854,6 +1874,33 @@ export interface paths {
|
|
|
1854
1874
|
patch?: never;
|
|
1855
1875
|
trace?: never;
|
|
1856
1876
|
};
|
|
1877
|
+
"/api/v1/pulse": {
|
|
1878
|
+
parameters: {
|
|
1879
|
+
query?: never;
|
|
1880
|
+
header?: never;
|
|
1881
|
+
path?: never;
|
|
1882
|
+
cookie?: never;
|
|
1883
|
+
};
|
|
1884
|
+
/**
|
|
1885
|
+
* Get the market pulse news feed
|
|
1886
|
+
* @description Get the market pulse news feed.
|
|
1887
|
+
*
|
|
1888
|
+
* Returns the latest cached snapshot of AI-synthesized, per-asset news
|
|
1889
|
+
* headlines with sentiment tags, refreshed hourly from the upstream
|
|
1890
|
+
* pipeline by a background poller. The request path never calls the
|
|
1891
|
+
* upstream. Public endpoint — no authentication required. Responses carry
|
|
1892
|
+
* an ETag (the snapshot's generatedAt); clients may send If-None-Match to
|
|
1893
|
+
* receive 304 when unchanged.
|
|
1894
|
+
*/
|
|
1895
|
+
get: operations["get_pulse"];
|
|
1896
|
+
put?: never;
|
|
1897
|
+
post?: never;
|
|
1898
|
+
delete?: never;
|
|
1899
|
+
options?: never;
|
|
1900
|
+
head?: never;
|
|
1901
|
+
patch?: never;
|
|
1902
|
+
trace?: never;
|
|
1903
|
+
};
|
|
1857
1904
|
"/api/v1/trades/by-id/{tradeId}": {
|
|
1858
1905
|
parameters: {
|
|
1859
1906
|
query?: never;
|
|
@@ -2508,7 +2555,7 @@ export interface components {
|
|
|
2508
2555
|
*/
|
|
2509
2556
|
expirationDate?: string | null;
|
|
2510
2557
|
/**
|
|
2511
|
-
* @description Time in force: GTC, IOC, or FOK
|
|
2558
|
+
* @description Time in force: GTC, IOC, or FOK. LIMIT orders only; rejected on MARKET orders.
|
|
2512
2559
|
* @example GTC
|
|
2513
2560
|
*/
|
|
2514
2561
|
timeInForce?: string | null;
|
|
@@ -2957,7 +3004,7 @@ export interface components {
|
|
|
2957
3004
|
*/
|
|
2958
3005
|
expirationDate?: string | null;
|
|
2959
3006
|
/**
|
|
2960
|
-
* @description Time in force: GTC, IOC, or FOK
|
|
3007
|
+
* @description Time in force: GTC, IOC, or FOK. LIMIT orders only; rejected on MARKET orders.
|
|
2961
3008
|
* @example GTC
|
|
2962
3009
|
*/
|
|
2963
3010
|
timeInForce?: string | null;
|
|
@@ -3270,19 +3317,48 @@ export interface components {
|
|
|
3270
3317
|
*/
|
|
3271
3318
|
createdAt?: string | null;
|
|
3272
3319
|
};
|
|
3320
|
+
/**
|
|
3321
|
+
* @description One settled funding window. Windows are fixed and epoch-aligned (hourly);
|
|
3322
|
+
* a boundary the engine was down for is skipped, never settled retroactively,
|
|
3323
|
+
* so consecutive records can legitimately be more than one interval apart.
|
|
3324
|
+
*/
|
|
3273
3325
|
FundingRecord: {
|
|
3274
3326
|
/** Format: uuid */
|
|
3275
3327
|
tradingPairId?: string | null;
|
|
3276
3328
|
epoch?: string | null;
|
|
3329
|
+
/**
|
|
3330
|
+
* @description Final settled rate for the window as a decimal-string fraction per
|
|
3331
|
+
* funding interval (e.g. "0.0001" = 0.01%). The ±max-rate cap is applied
|
|
3332
|
+
* once to the window average at settlement; this is the capped value that
|
|
3333
|
+
* payments used.
|
|
3334
|
+
*/
|
|
3277
3335
|
fundingRate?: string | null;
|
|
3336
|
+
/**
|
|
3337
|
+
* @description Quote currency charged per unit of base position for this window:
|
|
3338
|
+
* funding_rate x reference_price. Positive means longs paid shorts.
|
|
3339
|
+
*/
|
|
3278
3340
|
fundingDeltaPerUnit?: string | null;
|
|
3341
|
+
/**
|
|
3342
|
+
* @description Running sum of funding_delta_per_unit across all settled windows;
|
|
3343
|
+
* position payments settle against deltas of this value.
|
|
3344
|
+
*/
|
|
3279
3345
|
cumulativeFundingPerUnit?: string | null;
|
|
3346
|
+
/**
|
|
3347
|
+
* @description Mark price at the window boundary — the payment basis for every
|
|
3348
|
+
* position settled in this window.
|
|
3349
|
+
*/
|
|
3280
3350
|
referencePrice?: string | null;
|
|
3281
3351
|
/** Format: uint32 */
|
|
3282
3352
|
sampleCount?: number | null;
|
|
3283
3353
|
windowStartedAt?: string | null;
|
|
3284
3354
|
windowClosedAt?: string | null;
|
|
3285
3355
|
settledAt?: string | null;
|
|
3356
|
+
/**
|
|
3357
|
+
* @description True when the window held fewer than the minimum accepted samples and
|
|
3358
|
+
* settled at the carried last settled rate (zero if no rate was ever
|
|
3359
|
+
* settled) instead of a freshly computed average.
|
|
3360
|
+
*/
|
|
3361
|
+
carried?: boolean | null;
|
|
3286
3362
|
};
|
|
3287
3363
|
GetAppStatsResponse: {
|
|
3288
3364
|
/**
|
|
@@ -3459,11 +3535,31 @@ export interface components {
|
|
|
3459
3535
|
GetFundingStateResponse: {
|
|
3460
3536
|
/** Format: uuid */
|
|
3461
3537
|
tradingPairId?: string | null;
|
|
3538
|
+
/**
|
|
3539
|
+
* @description Most recently SETTLED funding rate as a decimal-string fraction per funding interval; "0" when nothing has settled yet
|
|
3540
|
+
* @example 0.0001
|
|
3541
|
+
*/
|
|
3462
3542
|
currentFundingRate?: string | null;
|
|
3543
|
+
/**
|
|
3544
|
+
* @description Implied rate for the in-progress window. An estimate refreshed on each accepted premium sample (roughly every sample interval plus persistence lag), not a real-time stream; absent when the window has no samples
|
|
3545
|
+
* @example 0.00012
|
|
3546
|
+
*/
|
|
3463
3547
|
estimatedNextFundingRate?: string | null;
|
|
3548
|
+
/**
|
|
3549
|
+
* @description Scheduled end of the current funding window (ms epoch string). An estimate, not a guarantee: settlement lands at or shortly after this boundary when the market is alive, and boundaries that pass while the engine is down are skipped, never settled retroactively
|
|
3550
|
+
* @example 1754006400000
|
|
3551
|
+
*/
|
|
3464
3552
|
nextFundingTime?: string | null;
|
|
3465
|
-
/**
|
|
3553
|
+
/**
|
|
3554
|
+
* Format: uint32
|
|
3555
|
+
* @description Length of a funding window in seconds, inferred from settlement history and market configuration
|
|
3556
|
+
* @example 3600
|
|
3557
|
+
*/
|
|
3466
3558
|
fundingIntervalSeconds?: number | null;
|
|
3559
|
+
/**
|
|
3560
|
+
* @description Close of the most recently settled window (ms epoch string); absent before the first settlement
|
|
3561
|
+
* @example 1754002800000
|
|
3562
|
+
*/
|
|
3467
3563
|
lastFundingTime?: string | null;
|
|
3468
3564
|
updatedAt?: string | null;
|
|
3469
3565
|
};
|
|
@@ -4114,7 +4210,7 @@ export interface components {
|
|
|
4114
4210
|
perpsEquity?: string | null;
|
|
4115
4211
|
/**
|
|
4116
4212
|
* Format: double
|
|
4117
|
-
* @description
|
|
4213
|
+
* @description Position-level win rate: winning positions over winning + losing positions (break-even excluded). Each position (one flat->open->flat round-trip) is classified once by its net realized PnL after all fees, not per fill. Null when the period has no closed positions.
|
|
4118
4214
|
* @example 0.65
|
|
4119
4215
|
*/
|
|
4120
4216
|
winLossRatio?: number | null;
|
|
@@ -4163,13 +4259,23 @@ export interface components {
|
|
|
4163
4259
|
/** Format: uuid */
|
|
4164
4260
|
tradingPairId?: string | null;
|
|
4165
4261
|
side?: string | null;
|
|
4262
|
+
/**
|
|
4263
|
+
* @description Open rows: current absolute position quantity. Terminal rows
|
|
4264
|
+
* (CLOSED/LIQUIDATED/EXPIRED): total quantity closed over the position's
|
|
4265
|
+
* life, summed from its reducing executions when available.
|
|
4266
|
+
*/
|
|
4166
4267
|
size?: string | null;
|
|
4167
4268
|
entryPrice?: string | null;
|
|
4168
4269
|
markPrice?: string | null;
|
|
4169
4270
|
indexPrice?: string | null;
|
|
4170
4271
|
unrealizedPnl?: string | null;
|
|
4171
4272
|
realizedPnl?: string | null;
|
|
4172
|
-
/**
|
|
4273
|
+
/**
|
|
4274
|
+
* @description Open rows: current isolated collateral for this position's risk bucket.
|
|
4275
|
+
* Terminal rows: total initial margin allocated across the position's
|
|
4276
|
+
* reducing executions when available — the margin basis for lifetime
|
|
4277
|
+
* realized return.
|
|
4278
|
+
*/
|
|
4173
4279
|
isolatedMargin?: string | null;
|
|
4174
4280
|
leverage?: string | null;
|
|
4175
4281
|
/**
|
|
@@ -4196,6 +4302,21 @@ export interface components {
|
|
|
4196
4302
|
updatedAt?: string | null;
|
|
4197
4303
|
riskBucketId?: string | null;
|
|
4198
4304
|
marginMode?: string | null;
|
|
4305
|
+
/**
|
|
4306
|
+
* @description Lifetime realized PnL net of trading fees and funding. Terminal rows
|
|
4307
|
+
* only; absent when the position's reducing executions are unavailable.
|
|
4308
|
+
*/
|
|
4309
|
+
netRealizedPnl?: string | null;
|
|
4310
|
+
/**
|
|
4311
|
+
* @description Lifetime realized return on the total allocated initial margin, as a
|
|
4312
|
+
* percentage, computed from NET realized PnL (after trading fees and
|
|
4313
|
+
* funding). The denominator is initial margin only: fees and funding are
|
|
4314
|
+
* costs rather than posted collateral, and funding is signed, so folding it
|
|
4315
|
+
* into the denominator could drive it to zero or negative. Terminal rows
|
|
4316
|
+
* only; absent when unavailable, including when the position's reducing
|
|
4317
|
+
* executions do not account for its whole lifetime.
|
|
4318
|
+
*/
|
|
4319
|
+
realizedRoe?: string | null;
|
|
4199
4320
|
};
|
|
4200
4321
|
GetPositionRiskResponse: {
|
|
4201
4322
|
positionId?: string | null;
|
|
@@ -4284,6 +4405,26 @@ export interface components {
|
|
|
4284
4405
|
*/
|
|
4285
4406
|
applicationMakerFeeBps?: number | null;
|
|
4286
4407
|
};
|
|
4408
|
+
GetPulseResponse: {
|
|
4409
|
+
/**
|
|
4410
|
+
* @description When this snapshot was produced upstream, ISO-8601 UTC; also serves as the response ETag value
|
|
4411
|
+
* @example 2026-07-22T15:17:14Z
|
|
4412
|
+
*/
|
|
4413
|
+
generatedAt?: string | null;
|
|
4414
|
+
/**
|
|
4415
|
+
* @description Asset universe this snapshot was synthesized against
|
|
4416
|
+
* @example [
|
|
4417
|
+
* "BTC",
|
|
4418
|
+
* "ETH",
|
|
4419
|
+
* "SOL",
|
|
4420
|
+
* "SEI",
|
|
4421
|
+
* "HYPE"
|
|
4422
|
+
* ]
|
|
4423
|
+
*/
|
|
4424
|
+
watchlist?: string[] | null;
|
|
4425
|
+
/** @description Pulse items, pre-sorted: watchlist order first, MARKET last, most-recent-first within each asset. Items with unverified figures are removed server-side. */
|
|
4426
|
+
items?: components["schemas"]["PulseItem"][] | null;
|
|
4427
|
+
};
|
|
4287
4428
|
GetRewardsBalanceResponse: {
|
|
4288
4429
|
/** @description One entry per reward token that has a non-zero available balance. */
|
|
4289
4430
|
balances?: components["schemas"]["RewardsBalanceEntry"][] | null;
|
|
@@ -4385,6 +4526,22 @@ export interface components {
|
|
|
4385
4526
|
* @example 8
|
|
4386
4527
|
*/
|
|
4387
4528
|
totalPages?: string | null;
|
|
4529
|
+
/**
|
|
4530
|
+
* @description Cursor for the next page. Empty on every page-number (legacy) response —
|
|
4531
|
+
* page-number mode never mints a token, full page or not, since resuming
|
|
4532
|
+
* a client from a legacy-minted position could silently strand archived
|
|
4533
|
+
* history newer than wherever that page happened to end. To walk full
|
|
4534
|
+
* history, start a cursor-mode request with `page_token` present but
|
|
4535
|
+
* empty (`""`); from then on the token is present whenever that page
|
|
4536
|
+
* returned any rows (AIP-158 "maybe more" semantics), not only when the
|
|
4537
|
+
* page is exactly full. Empty only when a cursor-mode page returned zero
|
|
4538
|
+
* rows, which is the sole proof the walk is exhausted; a non-empty token
|
|
4539
|
+
* does not guarantee further results, so keep following it until a
|
|
4540
|
+
* response returns zero rows and an empty token. The two modes never
|
|
4541
|
+
* bridge: a page-number response's empty token is not "done," it simply
|
|
4542
|
+
* means page-number mode does not participate in cursor continuation.
|
|
4543
|
+
*/
|
|
4544
|
+
nextPageToken?: string | null;
|
|
4388
4545
|
};
|
|
4389
4546
|
IndexComponent: {
|
|
4390
4547
|
provider?: string | null;
|
|
@@ -4547,6 +4704,15 @@ export interface components {
|
|
|
4547
4704
|
*/
|
|
4548
4705
|
balanceId?: string | null;
|
|
4549
4706
|
};
|
|
4707
|
+
ListAllFundingHistoryResponse: {
|
|
4708
|
+
records?: components["schemas"]["FundingRecord"][] | null;
|
|
4709
|
+
/** Format: uint32 */
|
|
4710
|
+
total?: number | null;
|
|
4711
|
+
/** Format: uint32 */
|
|
4712
|
+
page?: number | null;
|
|
4713
|
+
/** Format: uint32 */
|
|
4714
|
+
pageSize?: number | null;
|
|
4715
|
+
};
|
|
4550
4716
|
ListAppBalancesResponse: {
|
|
4551
4717
|
balances?: components["schemas"]["ApplicationBalance"][] | null;
|
|
4552
4718
|
/**
|
|
@@ -4743,6 +4909,22 @@ export interface components {
|
|
|
4743
4909
|
* @example 8
|
|
4744
4910
|
*/
|
|
4745
4911
|
totalPages?: number | null;
|
|
4912
|
+
/**
|
|
4913
|
+
* @description Cursor for the next page. Empty on every page-number (legacy) response —
|
|
4914
|
+
* page-number mode never mints a token, full page or not, since resuming
|
|
4915
|
+
* a client from a legacy-minted position could silently strand archived
|
|
4916
|
+
* history newer than wherever that page happened to end. To walk full
|
|
4917
|
+
* history, start a cursor-mode request with `page_token` present but
|
|
4918
|
+
* empty (`""`); from then on the token is present whenever that page
|
|
4919
|
+
* returned any rows (AIP-158 "maybe more" semantics), not only when the
|
|
4920
|
+
* page is exactly full. Empty only when a cursor-mode page returned zero
|
|
4921
|
+
* rows, which is the sole proof the walk is exhausted; a non-empty token
|
|
4922
|
+
* does not guarantee further results, so keep following it until a
|
|
4923
|
+
* response returns zero rows and an empty token. The two modes never
|
|
4924
|
+
* bridge: a page-number response's empty token is not "done," it simply
|
|
4925
|
+
* means page-number mode does not participate in cursor continuation.
|
|
4926
|
+
*/
|
|
4927
|
+
nextPageToken?: string | null;
|
|
4746
4928
|
};
|
|
4747
4929
|
ListPendingWithdrawalsResponse: {
|
|
4748
4930
|
withdrawals?: components["schemas"]["PendingWithdrawal"][] | null;
|
|
@@ -5101,12 +5283,23 @@ export interface components {
|
|
|
5101
5283
|
date?: string | null;
|
|
5102
5284
|
netRealizedPnl?: string | null;
|
|
5103
5285
|
};
|
|
5286
|
+
/**
|
|
5287
|
+
* @description Win rate is position-level: winners/losers/break_even and win_rate_pct count
|
|
5288
|
+
* each position (one flat -> open -> flat round-trip) once, classified by its
|
|
5289
|
+
* net realized PnL after all fees. `count` stays fill-based (each partial
|
|
5290
|
+
* closing fill is counted).
|
|
5291
|
+
*/
|
|
5104
5292
|
PortfolioClosedTradeStats: {
|
|
5105
5293
|
count?: string | null;
|
|
5106
5294
|
winners?: string | null;
|
|
5107
5295
|
losers?: string | null;
|
|
5108
5296
|
breakEven?: string | null;
|
|
5109
5297
|
winRatePct?: string | null;
|
|
5298
|
+
/**
|
|
5299
|
+
* @description Total classified positions (= winners + losers + break_even): the
|
|
5300
|
+
* position-level denominator, distinct from the fill-based `count`.
|
|
5301
|
+
*/
|
|
5302
|
+
positions?: string | null;
|
|
5110
5303
|
};
|
|
5111
5304
|
PortfolioMarginPositionCounts: {
|
|
5112
5305
|
total?: string | null;
|
|
@@ -5226,13 +5419,23 @@ export interface components {
|
|
|
5226
5419
|
/** Format: uuid */
|
|
5227
5420
|
tradingPairId?: string | null;
|
|
5228
5421
|
side?: string | null;
|
|
5422
|
+
/**
|
|
5423
|
+
* @description Open rows: current absolute position quantity. Terminal rows
|
|
5424
|
+
* (CLOSED/LIQUIDATED/EXPIRED): total quantity closed over the position's
|
|
5425
|
+
* life, summed from its reducing executions when available.
|
|
5426
|
+
*/
|
|
5229
5427
|
size?: string | null;
|
|
5230
5428
|
entryPrice?: string | null;
|
|
5231
5429
|
markPrice?: string | null;
|
|
5232
5430
|
indexPrice?: string | null;
|
|
5233
5431
|
unrealizedPnl?: string | null;
|
|
5234
5432
|
realizedPnl?: string | null;
|
|
5235
|
-
/**
|
|
5433
|
+
/**
|
|
5434
|
+
* @description Open rows: current isolated collateral for this position's risk bucket.
|
|
5435
|
+
* Terminal rows: total initial margin allocated across the position's
|
|
5436
|
+
* reducing executions when available — the margin basis for lifetime
|
|
5437
|
+
* realized return.
|
|
5438
|
+
*/
|
|
5236
5439
|
isolatedMargin?: string | null;
|
|
5237
5440
|
leverage?: string | null;
|
|
5238
5441
|
/**
|
|
@@ -5259,6 +5462,21 @@ export interface components {
|
|
|
5259
5462
|
updatedAt?: string | null;
|
|
5260
5463
|
riskBucketId?: string | null;
|
|
5261
5464
|
marginMode?: string | null;
|
|
5465
|
+
/**
|
|
5466
|
+
* @description Lifetime realized PnL net of trading fees and funding. Terminal rows
|
|
5467
|
+
* only; absent when the position's reducing executions are unavailable.
|
|
5468
|
+
*/
|
|
5469
|
+
netRealizedPnl?: string | null;
|
|
5470
|
+
/**
|
|
5471
|
+
* @description Lifetime realized return on the total allocated initial margin, as a
|
|
5472
|
+
* percentage, computed from NET realized PnL (after trading fees and
|
|
5473
|
+
* funding). The denominator is initial margin only: fees and funding are
|
|
5474
|
+
* costs rather than posted collateral, and funding is signed, so folding it
|
|
5475
|
+
* into the denominator could drive it to zero or negative. Terminal rows
|
|
5476
|
+
* only; absent when unavailable, including when the position's reducing
|
|
5477
|
+
* executions do not account for its whole lifetime.
|
|
5478
|
+
*/
|
|
5479
|
+
realizedRoe?: string | null;
|
|
5262
5480
|
};
|
|
5263
5481
|
PositionHistoryEvent: {
|
|
5264
5482
|
id?: string | null;
|
|
@@ -5412,6 +5630,58 @@ export interface components {
|
|
|
5412
5630
|
*/
|
|
5413
5631
|
tradingMode?: string | null;
|
|
5414
5632
|
};
|
|
5633
|
+
PulseItem: {
|
|
5634
|
+
/**
|
|
5635
|
+
* @description Watchlist ticker (e.g. "BTC") or "MARKET" for a cross-asset story
|
|
5636
|
+
* @example SEI
|
|
5637
|
+
*/
|
|
5638
|
+
asset?: string | null;
|
|
5639
|
+
/**
|
|
5640
|
+
* @description Sentiment tag: "Bullish", "Neutral", or "Bearish"
|
|
5641
|
+
* @example Bullish
|
|
5642
|
+
*/
|
|
5643
|
+
sentiment?: string | null;
|
|
5644
|
+
/**
|
|
5645
|
+
* @description Synthesized 1-2 sentence summary, at most 240 characters
|
|
5646
|
+
* @example SEI gained 4% amid ecosystem growth.
|
|
5647
|
+
*/
|
|
5648
|
+
summary?: string | null;
|
|
5649
|
+
/**
|
|
5650
|
+
* @description Timestamp of the most recent source in the cluster, ISO-8601; render relative time client-side
|
|
5651
|
+
* @example 2026-07-21T02:15:19
|
|
5652
|
+
*/
|
|
5653
|
+
updatedAt?: string | null;
|
|
5654
|
+
/** @description Provenance for the item, for attribution links */
|
|
5655
|
+
sources?: components["schemas"]["PulseSource"][] | null;
|
|
5656
|
+
};
|
|
5657
|
+
PulseSource: {
|
|
5658
|
+
/**
|
|
5659
|
+
* @description Source article or post URL
|
|
5660
|
+
* @example https://coinmarketcap.com/top-stories/6a5f0c340787ae5558351f0f/
|
|
5661
|
+
*/
|
|
5662
|
+
url?: string | null;
|
|
5663
|
+
/**
|
|
5664
|
+
* @description Source author or publication name
|
|
5665
|
+
* @example CoinMarketCap
|
|
5666
|
+
*/
|
|
5667
|
+
author?: string | null;
|
|
5668
|
+
/**
|
|
5669
|
+
* @description Source channel: "twitter" or "news"
|
|
5670
|
+
* @example news
|
|
5671
|
+
*/
|
|
5672
|
+
source?: string | null;
|
|
5673
|
+
/**
|
|
5674
|
+
* @description Source publication time, ISO-8601
|
|
5675
|
+
* @example 2026-07-21T02:15:19
|
|
5676
|
+
*/
|
|
5677
|
+
createdAt?: string | null;
|
|
5678
|
+
/**
|
|
5679
|
+
* Format: uint32
|
|
5680
|
+
* @description Relevance score, 1 (low) to 5 (high)
|
|
5681
|
+
* @example 4
|
|
5682
|
+
*/
|
|
5683
|
+
relevance?: number | null;
|
|
5684
|
+
};
|
|
5415
5685
|
ReducePositionMarginRequest: {
|
|
5416
5686
|
amount?: string | null;
|
|
5417
5687
|
};
|
|
@@ -5593,6 +5863,16 @@ export interface components {
|
|
|
5593
5863
|
* @example 482931
|
|
5594
5864
|
*/
|
|
5595
5865
|
totalTradeCountLtd?: string | null;
|
|
5866
|
+
/**
|
|
5867
|
+
* @description Latest settled funding rate as a decimal fraction per funding window (the capped settled value); null for spot pairs and margin pairs with no settled funding window yet
|
|
5868
|
+
* @example 0.000125
|
|
5869
|
+
*/
|
|
5870
|
+
latestFundingRate?: string | null;
|
|
5871
|
+
/**
|
|
5872
|
+
* @description Close time of the latest settled funding window (ms since epoch); null for spot pairs and margin pairs with no settled funding window yet
|
|
5873
|
+
* @example 1745308800000
|
|
5874
|
+
*/
|
|
5875
|
+
lastFundingTime?: string | null;
|
|
5596
5876
|
};
|
|
5597
5877
|
/** @description One UTC-day bucket in a pair's 7-day snapshot. */
|
|
5598
5878
|
ScreenerSnapshotPoint: {
|
|
@@ -7296,6 +7576,24 @@ export interface operations {
|
|
|
7296
7576
|
pageSize?: number;
|
|
7297
7577
|
/** @description Trading pair identifier (UUID) */
|
|
7298
7578
|
tradingPairId?: string;
|
|
7579
|
+
/**
|
|
7580
|
+
* @description Pagination cursor with three distinct states:
|
|
7581
|
+
* - Omitted: legacy page-number pagination via `page`, limited to recent
|
|
7582
|
+
* history once the archive window is enabled.
|
|
7583
|
+
* - Empty string (""): start a cursor walk with no prior position, from
|
|
7584
|
+
* the newest row (this endpoint always sorts newest-first).
|
|
7585
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
7586
|
+
* `next_page_token`; results resume immediately after that position.
|
|
7587
|
+
*
|
|
7588
|
+
* In either cursor-walk state (empty or non-empty), `page` is ignored, the
|
|
7589
|
+
* response omits exact totals (total/total_pages/page are 0), and results
|
|
7590
|
+
* cover full trade history — hot and archived rows merged — unlike
|
|
7591
|
+
* page-number mode, which only ever sees recent history. Clients that need
|
|
7592
|
+
* complete trade history must use the cursor form (start with an empty
|
|
7593
|
+
* string, then follow next_page_token) rather than `page`. Filters must
|
|
7594
|
+
* match the request that produced the token.
|
|
7595
|
+
*/
|
|
7596
|
+
pageToken?: string;
|
|
7299
7597
|
};
|
|
7300
7598
|
header?: never;
|
|
7301
7599
|
path?: never;
|
|
@@ -8670,6 +8968,37 @@ export interface operations {
|
|
|
8670
8968
|
};
|
|
8671
8969
|
};
|
|
8672
8970
|
};
|
|
8971
|
+
list_all_funding_history: {
|
|
8972
|
+
parameters: {
|
|
8973
|
+
query?: {
|
|
8974
|
+
/** @description Start time as Unix timestamp (milliseconds) */
|
|
8975
|
+
startTime?: number;
|
|
8976
|
+
/** @description End time as Unix timestamp (milliseconds) */
|
|
8977
|
+
endTime?: number;
|
|
8978
|
+
/** @description Page number (1-indexed) */
|
|
8979
|
+
page?: number;
|
|
8980
|
+
/** @description Items per page (max 100) */
|
|
8981
|
+
pageSize?: number;
|
|
8982
|
+
/** @description Sort direction for settledAt */
|
|
8983
|
+
orderBy?: "ASC" | "DESC";
|
|
8984
|
+
};
|
|
8985
|
+
header?: never;
|
|
8986
|
+
path?: never;
|
|
8987
|
+
cookie?: never;
|
|
8988
|
+
};
|
|
8989
|
+
requestBody?: never;
|
|
8990
|
+
responses: {
|
|
8991
|
+
/** @description OK */
|
|
8992
|
+
200: {
|
|
8993
|
+
headers: {
|
|
8994
|
+
[name: string]: unknown;
|
|
8995
|
+
};
|
|
8996
|
+
content: {
|
|
8997
|
+
"application/json": components["schemas"]["ListAllFundingHistoryResponse"];
|
|
8998
|
+
};
|
|
8999
|
+
};
|
|
9000
|
+
};
|
|
9001
|
+
};
|
|
8673
9002
|
list_trading_pairs: {
|
|
8674
9003
|
parameters: {
|
|
8675
9004
|
query?: {
|
|
@@ -8839,6 +9168,8 @@ export interface operations {
|
|
|
8839
9168
|
page?: number;
|
|
8840
9169
|
/** @description Items per page (max 100) */
|
|
8841
9170
|
pageSize?: number;
|
|
9171
|
+
/** @description Sort direction for createdAt */
|
|
9172
|
+
orderBy?: "ASC" | "DESC";
|
|
8842
9173
|
};
|
|
8843
9174
|
header?: never;
|
|
8844
9175
|
path: {
|
|
@@ -9165,6 +9496,24 @@ export interface operations {
|
|
|
9165
9496
|
marginAccountId?: string;
|
|
9166
9497
|
/** @description Sort direction for createdAt */
|
|
9167
9498
|
orderBy?: "ASC" | "DESC";
|
|
9499
|
+
/**
|
|
9500
|
+
* @description Pagination cursor with three distinct states:
|
|
9501
|
+
* - Omitted: legacy page-number pagination via `page`, limited to recent
|
|
9502
|
+
* history once the archive window is enabled.
|
|
9503
|
+
* - Empty string (""): start a cursor walk with no prior position, from
|
|
9504
|
+
* the newest row (or the oldest, when `orderBy` is ASC).
|
|
9505
|
+
* - Non-empty: an opaque cursor from a previous response's
|
|
9506
|
+
* `next_page_token`; results resume immediately after that position.
|
|
9507
|
+
*
|
|
9508
|
+
* In either cursor-walk state (empty or non-empty), `page` is ignored, the
|
|
9509
|
+
* response omits exact totals (total/total_pages/page are 0), and results
|
|
9510
|
+
* cover full order history — hot and archived rows merged — unlike
|
|
9511
|
+
* page-number mode, which only ever sees recent history. Clients that need
|
|
9512
|
+
* complete order history must use the cursor form (start with an empty
|
|
9513
|
+
* string, then follow next_page_token) rather than `page`. Filters and
|
|
9514
|
+
* orderBy must match the request that produced the token.
|
|
9515
|
+
*/
|
|
9516
|
+
pageToken?: string;
|
|
9168
9517
|
};
|
|
9169
9518
|
header?: never;
|
|
9170
9519
|
path?: never;
|
|
@@ -10177,6 +10526,33 @@ export interface operations {
|
|
|
10177
10526
|
};
|
|
10178
10527
|
};
|
|
10179
10528
|
};
|
|
10529
|
+
get_pulse: {
|
|
10530
|
+
parameters: {
|
|
10531
|
+
query?: never;
|
|
10532
|
+
header?: never;
|
|
10533
|
+
path?: never;
|
|
10534
|
+
cookie?: never;
|
|
10535
|
+
};
|
|
10536
|
+
requestBody?: never;
|
|
10537
|
+
responses: {
|
|
10538
|
+
/** @description OK */
|
|
10539
|
+
200: {
|
|
10540
|
+
headers: {
|
|
10541
|
+
[name: string]: unknown;
|
|
10542
|
+
};
|
|
10543
|
+
content: {
|
|
10544
|
+
"application/json": components["schemas"]["GetPulseResponse"];
|
|
10545
|
+
};
|
|
10546
|
+
};
|
|
10547
|
+
/** @description Pulse feed not yet available */
|
|
10548
|
+
503: {
|
|
10549
|
+
headers: {
|
|
10550
|
+
[name: string]: unknown;
|
|
10551
|
+
};
|
|
10552
|
+
content?: never;
|
|
10553
|
+
};
|
|
10554
|
+
};
|
|
10555
|
+
};
|
|
10180
10556
|
get_trade_by_id: {
|
|
10181
10557
|
parameters: {
|
|
10182
10558
|
query?: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint": "biome lint ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/contracts": "1.0.
|
|
23
|
+
"@0xmonaco/contracts": "1.0.29",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|