@0xmonaco/types 0.8.21 → 0.8.22
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/README.md +37 -25
- package/dist/market/index.d.ts +2 -0
- package/dist/positions/index.d.ts +68 -0
- package/dist/profile/index.d.ts +32 -1
- package/dist/validation/positions.d.ts +15 -0
- package/dist/validation/positions.js +15 -0
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +1 -0
- package/dist/wire/schema.d.ts +223 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -202,50 +202,62 @@ Types for market data operations including trading pair metadata:
|
|
|
202
202
|
import {
|
|
203
203
|
MarketAPI,
|
|
204
204
|
TradingPair,
|
|
205
|
+
GetTradingPairsParams,
|
|
205
206
|
GetTradingPairsResponse,
|
|
206
207
|
GetTradingPairResponse,
|
|
208
|
+
TradingMode,
|
|
207
209
|
} from "@0xmonaco/types";
|
|
208
210
|
|
|
209
211
|
// Market operations
|
|
210
212
|
interface MarketAPI extends BaseAPI {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
getPaginatedTradingPairs(
|
|
214
|
+
params?: GetTradingPairsParams,
|
|
215
|
+
): Promise<GetTradingPairsResponse>;
|
|
216
|
+
getTradingPair(tradingPairId: string): Promise<TradingPair>;
|
|
217
|
+
getTradingPairBySymbol(
|
|
218
|
+
symbol: string,
|
|
219
|
+
marketType?: TradingMode,
|
|
220
|
+
): Promise<TradingPair | undefined>;
|
|
213
221
|
}
|
|
214
222
|
|
|
215
223
|
// Market data types
|
|
216
224
|
interface TradingPair {
|
|
217
225
|
id: string;
|
|
218
226
|
symbol: string;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
baseToken: string;
|
|
228
|
+
quoteToken: string;
|
|
229
|
+
baseAssetId: string;
|
|
230
|
+
quoteAssetId: string;
|
|
231
|
+
baseTokenContract: string;
|
|
232
|
+
quoteTokenContract: string;
|
|
233
|
+
baseDecimals: number;
|
|
234
|
+
baseIconUrl: string;
|
|
235
|
+
quoteDecimals: number;
|
|
236
|
+
quoteIconUrl: string;
|
|
237
|
+
marketType: TradingMode;
|
|
238
|
+
category: string;
|
|
239
|
+
isActive: boolean;
|
|
240
|
+
makerFeeBps: number;
|
|
241
|
+
takerFeeBps: number;
|
|
242
|
+
minOrderSize: string;
|
|
243
|
+
maxOrderSize: string;
|
|
244
|
+
quantityStepSize: string;
|
|
245
|
+
tickSize: string;
|
|
246
|
+
minLeverage?: string | null;
|
|
247
|
+
maxLeverage?: string | null;
|
|
232
248
|
}
|
|
233
249
|
|
|
234
250
|
// Market response types
|
|
235
251
|
interface GetTradingPairsResponse {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
total_pages: number;
|
|
242
|
-
};
|
|
243
|
-
success: boolean;
|
|
252
|
+
tradingPairs: TradingPair[];
|
|
253
|
+
page: number;
|
|
254
|
+
pageSize: number;
|
|
255
|
+
total: number;
|
|
256
|
+
totalPages: number;
|
|
244
257
|
}
|
|
245
258
|
|
|
246
259
|
interface GetTradingPairResponse {
|
|
247
|
-
|
|
248
|
-
success: boolean;
|
|
260
|
+
tradingPair: TradingPair;
|
|
249
261
|
}
|
|
250
262
|
```
|
|
251
263
|
|
package/dist/market/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export interface TradingPair {
|
|
|
48
48
|
minOrderSize: string;
|
|
49
49
|
/** Maximum order size */
|
|
50
50
|
maxOrderSize: string;
|
|
51
|
+
/** Minimum order quantity increment (lot size step) */
|
|
52
|
+
quantityStepSize: string;
|
|
51
53
|
/** Tick size for price increments */
|
|
52
54
|
tickSize: string;
|
|
53
55
|
/** Minimum supported leverage for margin markets (optional, margin only) */
|
|
@@ -18,7 +18,15 @@ export interface Position {
|
|
|
18
18
|
realizedPnl: string;
|
|
19
19
|
isolatedMargin: string;
|
|
20
20
|
leverage?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Position-scoped requirement at markPrice using the market
|
|
23
|
+
* maintenance-margin rate; zero without open exposure.
|
|
24
|
+
*/
|
|
21
25
|
maintenanceMarginRequired: string;
|
|
26
|
+
/**
|
|
27
|
+
* Position-scoped requirement at markPrice honoring effective leverage and
|
|
28
|
+
* the market initial-margin floor; zero without open exposure.
|
|
29
|
+
*/
|
|
22
30
|
initialMarginRequired?: string;
|
|
23
31
|
liquidationPrice: string;
|
|
24
32
|
status: PositionStatus;
|
|
@@ -78,7 +86,15 @@ export interface PositionRisk {
|
|
|
78
86
|
unrealizedPnl: string;
|
|
79
87
|
liquidationPrice: string;
|
|
80
88
|
marginRatio: string;
|
|
89
|
+
/**
|
|
90
|
+
* Position-scoped requirement at markPrice using the market
|
|
91
|
+
* maintenance-margin rate; zero without open exposure.
|
|
92
|
+
*/
|
|
81
93
|
maintenanceMarginRequired: string;
|
|
94
|
+
/**
|
|
95
|
+
* Position-scoped requirement at markPrice honoring effective leverage and
|
|
96
|
+
* the market initial-margin floor; zero without open exposure.
|
|
97
|
+
*/
|
|
82
98
|
initialMarginRequired?: string;
|
|
83
99
|
updatedAt: string;
|
|
84
100
|
}
|
|
@@ -140,6 +156,57 @@ export interface ListPositionHistoryResponse {
|
|
|
140
156
|
page: number;
|
|
141
157
|
pageSize: number;
|
|
142
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Sample interval for position PnL history queries (matches the candles
|
|
161
|
+
* interval ladder).
|
|
162
|
+
*/
|
|
163
|
+
export type PnlHistoryInterval = "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
|
|
164
|
+
/**
|
|
165
|
+
* Query parameters for position PnL history.
|
|
166
|
+
*/
|
|
167
|
+
export interface GetPositionPnlHistoryParams {
|
|
168
|
+
/** Sample interval */
|
|
169
|
+
interval: PnlHistoryInterval;
|
|
170
|
+
/** Start time as Unix timestamp in milliseconds (defaults to the interval's maximum lookback) */
|
|
171
|
+
startTime?: number;
|
|
172
|
+
/** End time as Unix timestamp in milliseconds (defaults to now) */
|
|
173
|
+
endTime?: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* One PnL state sample for a position in one bucket. Cumulative fields are
|
|
177
|
+
* lifetime values as of the bucket; `cumFundingPaid` and `cumFees` are
|
|
178
|
+
* cost-positive (positive means paid/charged).
|
|
179
|
+
*/
|
|
180
|
+
export interface PositionPnlPoint {
|
|
181
|
+
/** Bucket start timestamp (ISO 8601) */
|
|
182
|
+
bucketStart: string;
|
|
183
|
+
/** Signed position quantity (negative for shorts) */
|
|
184
|
+
quantity: string;
|
|
185
|
+
/** Average entry price */
|
|
186
|
+
entryPrice: string;
|
|
187
|
+
/** Mark price at the sample */
|
|
188
|
+
markPrice: string;
|
|
189
|
+
/** Unrealized PnL at the sample: quantity x (mark - entry) */
|
|
190
|
+
unrealizedPnl: string;
|
|
191
|
+
/** Cumulative realized PnL, gross of fees */
|
|
192
|
+
cumRealizedPnl: string;
|
|
193
|
+
/** Cumulative funding paid; positive means paid, negative means received */
|
|
194
|
+
cumFundingPaid: string;
|
|
195
|
+
/** Cumulative trading fees; positive means charged, negative means rebated */
|
|
196
|
+
cumFees: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Position PnL history response.
|
|
200
|
+
* Returned by the /api/v1/positions/{positionId}/pnl/history endpoint.
|
|
201
|
+
*/
|
|
202
|
+
export interface GetPositionPnlHistoryResponse {
|
|
203
|
+
/** Position UUID */
|
|
204
|
+
positionId: string;
|
|
205
|
+
/** Interval used for this query */
|
|
206
|
+
interval: PnlHistoryInterval;
|
|
207
|
+
/** Forward-filled PnL state samples, oldest first */
|
|
208
|
+
data: PositionPnlPoint[];
|
|
209
|
+
}
|
|
143
210
|
export interface PositionsAPI extends BaseAPI {
|
|
144
211
|
listPositions(params?: ListPositionsParams): Promise<ListPositionsResponse>;
|
|
145
212
|
getPosition(positionId: string): Promise<GetPositionResponse>;
|
|
@@ -150,4 +217,5 @@ export interface PositionsAPI extends BaseAPI {
|
|
|
150
217
|
reducePositionMargin(positionId: string, request: ReducePositionMarginRequest): Promise<PositionMarginResponse>;
|
|
151
218
|
attachPositionTpSl(positionId: string, request: AttachPositionTpSlRequest): Promise<AttachPositionTpSlResponse>;
|
|
152
219
|
listPositionHistory(params?: ListPositionHistoryParams): Promise<ListPositionHistoryResponse>;
|
|
220
|
+
getPositionPnlHistory(positionId: string, params: GetPositionPnlHistoryParams): Promise<GetPositionPnlHistoryResponse>;
|
|
153
221
|
}
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -320,8 +320,15 @@ export interface ListFundingPaymentsResponse {
|
|
|
320
320
|
export type PortfolioPeriod = "24h" | "7d" | "30d" | "all";
|
|
321
321
|
/**
|
|
322
322
|
* Metric for portfolio chart queries.
|
|
323
|
+
*
|
|
324
|
+
* `volume` buckets trade volume and `pnl` is the legacy realized-only
|
|
325
|
+
* net-of-fees series. The remaining metrics are served from PnL history
|
|
326
|
+
* snapshots, forward-filled per bucket: `realized_pnl`, `funding_paid`, and
|
|
327
|
+
* `fees` are cumulative lifetime series; `unrealized_pnl`, `total_pnl`, and
|
|
328
|
+
* `equity` are state series. `funding_paid` is cost-positive (positive means
|
|
329
|
+
* paid) — negate for display as a PnL contribution.
|
|
323
330
|
*/
|
|
324
|
-
export type PortfolioMetric = "volume" | "pnl";
|
|
331
|
+
export type PortfolioMetric = "volume" | "pnl" | "unrealized_pnl" | "total_pnl" | "realized_pnl" | "funding_paid" | "fees" | "equity";
|
|
325
332
|
/**
|
|
326
333
|
* A single data point in a portfolio chart time series.
|
|
327
334
|
*/
|
|
@@ -343,11 +350,35 @@ export interface PortfolioChartResponse {
|
|
|
343
350
|
/** Bucketed time series data points */
|
|
344
351
|
data: PortfolioChartPoint[];
|
|
345
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Lifetime PnL components for the authenticated user. The fields satisfy
|
|
355
|
+
* `totalPnl = (spotRealized + perpsRealized) + (spotUnrealized + perpsUnrealized) - fundingPaid - fees`.
|
|
356
|
+
*/
|
|
357
|
+
export interface PnlBreakdown {
|
|
358
|
+
/** Cumulative realized spot PnL, average-cost basis, gross of fees; withdrawals realize at fair value */
|
|
359
|
+
spotRealized: string;
|
|
360
|
+
/** Unrealized PnL on current spot holdings: quantity x (latest close - average cost) */
|
|
361
|
+
spotUnrealized: string;
|
|
362
|
+
/** Cumulative realized perps PnL, gross of fees */
|
|
363
|
+
perpsRealized: string;
|
|
364
|
+
/** Unrealized PnL on open perp positions: quantity x (mark - entry) */
|
|
365
|
+
perpsUnrealized: string;
|
|
366
|
+
/** Cumulative funding paid; positive means paid, negative means received. Subtracted in totalPnl. */
|
|
367
|
+
fundingPaid: string;
|
|
368
|
+
/** Cumulative trading fees; positive means charged, negative means rebated. Subtracted in totalPnl. */
|
|
369
|
+
fees: string;
|
|
370
|
+
}
|
|
346
371
|
/**
|
|
347
372
|
* Portfolio statistics for the authenticated user over a given period.
|
|
348
373
|
* Returned by the /api/v1/accounts/me/portfolio endpoint.
|
|
349
374
|
*/
|
|
350
375
|
export interface PortfolioStats {
|
|
376
|
+
/** Current unrealized PnL across spot holdings and open perp positions. Live value, independent of the period. */
|
|
377
|
+
unrealizedPnl: string;
|
|
378
|
+
/** Current lifetime total PnL: realized + unrealized - fundingPaid - fees. Live value, independent of the period. */
|
|
379
|
+
totalPnl: string;
|
|
380
|
+
/** Lifetime PnL components behind totalPnl */
|
|
381
|
+
pnlBreakdown: PnlBreakdown | null;
|
|
351
382
|
/**
|
|
352
383
|
* Realized PnL over the period on an average-cost basis: gains/losses are
|
|
353
384
|
* booked only when a position is reduced or closed, net of fees, across spot
|
|
@@ -91,3 +91,18 @@ export declare const ListPositionHistorySchema: z.ZodObject<{
|
|
|
91
91
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
92
92
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
93
93
|
}, z.core.$strip>;
|
|
94
|
+
export declare const GetPositionPnlHistorySchema: z.ZodObject<{
|
|
95
|
+
positionId: z.ZodUUID;
|
|
96
|
+
params: z.ZodObject<{
|
|
97
|
+
interval: z.ZodEnum<{
|
|
98
|
+
"1m": "1m";
|
|
99
|
+
"5m": "5m";
|
|
100
|
+
"15m": "15m";
|
|
101
|
+
"1h": "1h";
|
|
102
|
+
"4h": "4h";
|
|
103
|
+
"1d": "1d";
|
|
104
|
+
}>;
|
|
105
|
+
startTime: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
endTime: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
}, z.core.$strip>;
|
|
@@ -95,3 +95,18 @@ export const ListPositionHistorySchema = PaginationSchema.extend({
|
|
|
95
95
|
marginAccountId: UUIDSchema.optional(),
|
|
96
96
|
tradingPairId: UUIDSchema.optional(),
|
|
97
97
|
});
|
|
98
|
+
const PnlHistoryIntervalSchema = z.enum(["1m", "5m", "15m", "1h", "4h", "1d"], {
|
|
99
|
+
message: 'Interval must be one of "1m", "5m", "15m", "1h", "4h", "1d"',
|
|
100
|
+
});
|
|
101
|
+
export const GetPositionPnlHistorySchema = PositionIdSchema.extend({
|
|
102
|
+
params: z
|
|
103
|
+
.object({
|
|
104
|
+
interval: PnlHistoryIntervalSchema,
|
|
105
|
+
startTime: z.number().int().min(0, "startTime must be a non-negative millisecond timestamp").optional(),
|
|
106
|
+
endTime: z.number().int().min(0, "endTime must be a non-negative millisecond timestamp").optional(),
|
|
107
|
+
})
|
|
108
|
+
.refine((data) => data.startTime === undefined || data.endTime === undefined || data.startTime < data.endTime, {
|
|
109
|
+
message: "startTime must be less than endTime",
|
|
110
|
+
path: ["startTime"],
|
|
111
|
+
}),
|
|
112
|
+
});
|
|
@@ -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", "authenticate_backend", "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_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_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_chart", "get_portfolio_stats", "get_position", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "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", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
|
|
13
|
+
export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "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_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_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_chart", "get_portfolio_stats", "get_position", "get_position_pnl_history", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "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", "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
package/dist/wire/schema.d.ts
CHANGED
|
@@ -1590,6 +1590,32 @@ export interface paths {
|
|
|
1590
1590
|
patch?: never;
|
|
1591
1591
|
trace?: never;
|
|
1592
1592
|
};
|
|
1593
|
+
"/api/v1/positions/{positionId}/pnl/history": {
|
|
1594
|
+
parameters: {
|
|
1595
|
+
query?: never;
|
|
1596
|
+
header?: never;
|
|
1597
|
+
path?: never;
|
|
1598
|
+
cookie?: never;
|
|
1599
|
+
};
|
|
1600
|
+
/**
|
|
1601
|
+
* Get position PnL history
|
|
1602
|
+
* @description Get bucketed PnL history for one position.
|
|
1603
|
+
*
|
|
1604
|
+
* Time series of PnL state samples (quantity, entry, mark, unrealized,
|
|
1605
|
+
* cumulative realized/funding/fees) for a position the caller owns, at the
|
|
1606
|
+
* requested interval. Buckets between samples are forward-filled; buckets
|
|
1607
|
+
* before the position's first sample are omitted. Distinct from
|
|
1608
|
+
* ListPositionHistory, which returns lifecycle events.
|
|
1609
|
+
*/
|
|
1610
|
+
get: operations["get_position_pnl_history"];
|
|
1611
|
+
put?: never;
|
|
1612
|
+
post?: never;
|
|
1613
|
+
delete?: never;
|
|
1614
|
+
options?: never;
|
|
1615
|
+
head?: never;
|
|
1616
|
+
patch?: never;
|
|
1617
|
+
trace?: never;
|
|
1618
|
+
};
|
|
1593
1619
|
"/api/v1/positions/{positionId}/risk": {
|
|
1594
1620
|
parameters: {
|
|
1595
1621
|
query?: never;
|
|
@@ -3743,7 +3769,7 @@ export interface components {
|
|
|
3743
3769
|
*/
|
|
3744
3770
|
feesPaid?: string | null;
|
|
3745
3771
|
/**
|
|
3746
|
-
* @description
|
|
3772
|
+
* @description Legacy realized PnL over the period, average-cost basis: gains/losses booked only when a position is reduced or closed, net of fees, with funding folded in. Excludes unrealized PnL on open positions. For the full PnL picture use totalPnl and pnlBreakdown, whose components follow the gross-of-fees convention instead.
|
|
3747
3773
|
* @example -0.01
|
|
3748
3774
|
*/
|
|
3749
3775
|
pnl?: string | null;
|
|
@@ -3773,6 +3799,31 @@ export interface components {
|
|
|
3773
3799
|
* @example 0.00
|
|
3774
3800
|
*/
|
|
3775
3801
|
maxDrawdown?: string | null;
|
|
3802
|
+
/**
|
|
3803
|
+
* @description Current unrealized PnL across open spot holdings (cost basis vs latest close) and open perp positions (entry vs mark). A live value, independent of the period parameter.
|
|
3804
|
+
* @example 12.34
|
|
3805
|
+
*/
|
|
3806
|
+
unrealizedPnl?: string | null;
|
|
3807
|
+
/**
|
|
3808
|
+
* @description Current lifetime total PnL: realized + unrealized - fundingPaid - fees, with realized components gross of fees. A live value, independent of the period parameter; the addends are in pnlBreakdown.
|
|
3809
|
+
* @example 10.11
|
|
3810
|
+
*/
|
|
3811
|
+
totalPnl?: string | null;
|
|
3812
|
+
pnlBreakdown?: components["schemas"]["PnlBreakdown"];
|
|
3813
|
+
};
|
|
3814
|
+
GetPositionPnlHistoryResponse: {
|
|
3815
|
+
/**
|
|
3816
|
+
* Format: uuid
|
|
3817
|
+
* @description Position UUID
|
|
3818
|
+
* @example 123e4567-e89b-12d3-a456-426614174000
|
|
3819
|
+
*/
|
|
3820
|
+
positionId?: string | null;
|
|
3821
|
+
/**
|
|
3822
|
+
* @description Interval used for this query
|
|
3823
|
+
* @example 1h
|
|
3824
|
+
*/
|
|
3825
|
+
interval?: string | null;
|
|
3826
|
+
data?: components["schemas"]["PositionPnlPoint"][] | null;
|
|
3776
3827
|
};
|
|
3777
3828
|
GetPositionResponse: {
|
|
3778
3829
|
positionId?: string | null;
|
|
@@ -3790,7 +3841,16 @@ export interface components {
|
|
|
3790
3841
|
/** @description Current isolated collateral for this position's margin-account bucket. */
|
|
3791
3842
|
isolatedMargin?: string | null;
|
|
3792
3843
|
leverage?: string | null;
|
|
3844
|
+
/**
|
|
3845
|
+
* @description Maintenance margin required by this position at mark_price using the
|
|
3846
|
+
* market maintenance-margin rate. Zero when the position has no open exposure.
|
|
3847
|
+
*/
|
|
3793
3848
|
maintenanceMarginRequired?: string | null;
|
|
3849
|
+
/**
|
|
3850
|
+
* @description Initial margin required by this position at mark_price, honoring both its
|
|
3851
|
+
* effective leverage and the market initial-margin floor. Zero when the
|
|
3852
|
+
* position has no open exposure.
|
|
3853
|
+
*/
|
|
3794
3854
|
initialMarginRequired?: string | null;
|
|
3795
3855
|
liquidationPrice?: string | null;
|
|
3796
3856
|
status?: string | null;
|
|
@@ -3805,7 +3865,16 @@ export interface components {
|
|
|
3805
3865
|
unrealizedPnl?: string | null;
|
|
3806
3866
|
liquidationPrice?: string | null;
|
|
3807
3867
|
marginRatio?: string | null;
|
|
3868
|
+
/**
|
|
3869
|
+
* @description Maintenance margin required by this position at mark_price using the
|
|
3870
|
+
* market maintenance-margin rate. Zero when the position has no open exposure.
|
|
3871
|
+
*/
|
|
3808
3872
|
maintenanceMarginRequired?: string | null;
|
|
3873
|
+
/**
|
|
3874
|
+
* @description Initial margin required by this position at mark_price, honoring both its
|
|
3875
|
+
* effective leverage and the market initial-margin floor. Zero when the
|
|
3876
|
+
* position has no open exposure.
|
|
3877
|
+
*/
|
|
3809
3878
|
initialMarginRequired?: string | null;
|
|
3810
3879
|
updatedAt?: string | null;
|
|
3811
3880
|
};
|
|
@@ -4568,6 +4637,42 @@ export interface components {
|
|
|
4568
4637
|
*/
|
|
4569
4638
|
createdAt?: string | null;
|
|
4570
4639
|
};
|
|
4640
|
+
/**
|
|
4641
|
+
* @description Lifetime PnL components for the authenticated user. The fields satisfy
|
|
4642
|
+
* totalPnl = (spotRealized + perpsRealized) + (spotUnrealized + perpsUnrealized) - fundingPaid - fees.
|
|
4643
|
+
*/
|
|
4644
|
+
PnlBreakdown: {
|
|
4645
|
+
/**
|
|
4646
|
+
* @description Cumulative realized spot PnL, average-cost basis, gross of fees; withdrawals realize at fair value
|
|
4647
|
+
* @example 3.21
|
|
4648
|
+
*/
|
|
4649
|
+
spotRealized?: string | null;
|
|
4650
|
+
/**
|
|
4651
|
+
* @description Unrealized PnL on current spot holdings: quantity x (latest close - average cost)
|
|
4652
|
+
* @example 1.00
|
|
4653
|
+
*/
|
|
4654
|
+
spotUnrealized?: string | null;
|
|
4655
|
+
/**
|
|
4656
|
+
* @description Cumulative realized perps PnL, gross of fees
|
|
4657
|
+
* @example 5.55
|
|
4658
|
+
*/
|
|
4659
|
+
perpsRealized?: string | null;
|
|
4660
|
+
/**
|
|
4661
|
+
* @description Unrealized PnL on open perp positions: quantity x (mark - entry)
|
|
4662
|
+
* @example 2.00
|
|
4663
|
+
*/
|
|
4664
|
+
perpsUnrealized?: string | null;
|
|
4665
|
+
/**
|
|
4666
|
+
* @description Cumulative funding paid; positive means paid, negative means received (same sign convention as the funding-payments endpoint). Subtracted in totalPnl.
|
|
4667
|
+
* @example 0.50
|
|
4668
|
+
*/
|
|
4669
|
+
fundingPaid?: string | null;
|
|
4670
|
+
/**
|
|
4671
|
+
* @description Cumulative trading fees; positive means charged, negative means rebated. Subtracted in totalPnl.
|
|
4672
|
+
* @example 1.15
|
|
4673
|
+
*/
|
|
4674
|
+
fees?: string | null;
|
|
4675
|
+
};
|
|
4571
4676
|
Position: {
|
|
4572
4677
|
positionId?: string | null;
|
|
4573
4678
|
/** @description Margin account UUID for the isolated bucket that owns this position. */
|
|
@@ -4584,7 +4689,16 @@ export interface components {
|
|
|
4584
4689
|
/** @description Current isolated collateral for this position's margin-account bucket. */
|
|
4585
4690
|
isolatedMargin?: string | null;
|
|
4586
4691
|
leverage?: string | null;
|
|
4692
|
+
/**
|
|
4693
|
+
* @description Maintenance margin required by this position at mark_price using the
|
|
4694
|
+
* market maintenance-margin rate. Zero when the position has no open exposure.
|
|
4695
|
+
*/
|
|
4587
4696
|
maintenanceMarginRequired?: string | null;
|
|
4697
|
+
/**
|
|
4698
|
+
* @description Initial margin required by this position at mark_price, honoring both its
|
|
4699
|
+
* effective leverage and the market initial-margin floor. Zero when the
|
|
4700
|
+
* position has no open exposure.
|
|
4701
|
+
*/
|
|
4588
4702
|
initialMarginRequired?: string | null;
|
|
4589
4703
|
liquidationPrice?: string | null;
|
|
4590
4704
|
status?: string | null;
|
|
@@ -4608,6 +4722,52 @@ export interface components {
|
|
|
4608
4722
|
orderId?: string | null;
|
|
4609
4723
|
createdAt?: string | null;
|
|
4610
4724
|
};
|
|
4725
|
+
/**
|
|
4726
|
+
* @description One PnL state sample for a position in one bucket. Cumulative fields are
|
|
4727
|
+
* lifetime values as of the bucket; fundingPaid and fees are cost-positive.
|
|
4728
|
+
*/
|
|
4729
|
+
PositionPnlPoint: {
|
|
4730
|
+
/**
|
|
4731
|
+
* @description Bucket start timestamp (ISO 8601)
|
|
4732
|
+
* @example 2026-02-18T00:00:00Z
|
|
4733
|
+
*/
|
|
4734
|
+
bucketStart?: string | null;
|
|
4735
|
+
/**
|
|
4736
|
+
* @description Signed position quantity (negative for shorts)
|
|
4737
|
+
* @example 1.50
|
|
4738
|
+
*/
|
|
4739
|
+
quantity?: string | null;
|
|
4740
|
+
/**
|
|
4741
|
+
* @description Average entry price
|
|
4742
|
+
* @example 95000.00
|
|
4743
|
+
*/
|
|
4744
|
+
entryPrice?: string | null;
|
|
4745
|
+
/**
|
|
4746
|
+
* @description Mark price at the sample
|
|
4747
|
+
* @example 95410.25
|
|
4748
|
+
*/
|
|
4749
|
+
markPrice?: string | null;
|
|
4750
|
+
/**
|
|
4751
|
+
* @description Unrealized PnL at the sample: quantity x (mark - entry)
|
|
4752
|
+
* @example 615.38
|
|
4753
|
+
*/
|
|
4754
|
+
unrealizedPnl?: string | null;
|
|
4755
|
+
/**
|
|
4756
|
+
* @description Cumulative realized PnL, gross of fees
|
|
4757
|
+
* @example 120.00
|
|
4758
|
+
*/
|
|
4759
|
+
cumRealizedPnl?: string | null;
|
|
4760
|
+
/**
|
|
4761
|
+
* @description Cumulative funding paid; positive means paid, negative means received
|
|
4762
|
+
* @example 3.20
|
|
4763
|
+
*/
|
|
4764
|
+
cumFundingPaid?: string | null;
|
|
4765
|
+
/**
|
|
4766
|
+
* @description Cumulative trading fees; positive means charged, negative means rebated
|
|
4767
|
+
* @example 1.75
|
|
4768
|
+
*/
|
|
4769
|
+
cumFees?: string | null;
|
|
4770
|
+
};
|
|
4611
4771
|
PriceChange: {
|
|
4612
4772
|
/**
|
|
4613
4773
|
* @description Price 24 hours ago
|
|
@@ -5285,6 +5445,11 @@ export interface components {
|
|
|
5285
5445
|
* @example crypto
|
|
5286
5446
|
*/
|
|
5287
5447
|
category?: string | null;
|
|
5448
|
+
/**
|
|
5449
|
+
* @description Minimum order quantity increment (lot size step) in base token
|
|
5450
|
+
* @example 0.00001
|
|
5451
|
+
*/
|
|
5452
|
+
quantityStepSize?: string | null;
|
|
5288
5453
|
};
|
|
5289
5454
|
TransferCollateralFromMarginAccountRequest: {
|
|
5290
5455
|
/** @description Parent margin account UUID that releases collateral. */
|
|
@@ -8745,6 +8910,63 @@ export interface operations {
|
|
|
8745
8910
|
};
|
|
8746
8911
|
};
|
|
8747
8912
|
};
|
|
8913
|
+
get_position_pnl_history: {
|
|
8914
|
+
parameters: {
|
|
8915
|
+
query: {
|
|
8916
|
+
/** @description Sample interval */
|
|
8917
|
+
interval: "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
|
|
8918
|
+
/** @description Start time as Unix timestamp (milliseconds) */
|
|
8919
|
+
startTime?: number;
|
|
8920
|
+
/** @description End time as Unix timestamp (milliseconds) */
|
|
8921
|
+
endTime?: number;
|
|
8922
|
+
};
|
|
8923
|
+
header?: never;
|
|
8924
|
+
path: {
|
|
8925
|
+
positionId: string;
|
|
8926
|
+
};
|
|
8927
|
+
cookie?: never;
|
|
8928
|
+
};
|
|
8929
|
+
requestBody?: never;
|
|
8930
|
+
responses: {
|
|
8931
|
+
/** @description OK */
|
|
8932
|
+
200: {
|
|
8933
|
+
headers: {
|
|
8934
|
+
[name: string]: unknown;
|
|
8935
|
+
};
|
|
8936
|
+
content: {
|
|
8937
|
+
"application/json": components["schemas"]["GetPositionPnlHistoryResponse"];
|
|
8938
|
+
};
|
|
8939
|
+
};
|
|
8940
|
+
/** @description Invalid interval or time range */
|
|
8941
|
+
400: {
|
|
8942
|
+
headers: {
|
|
8943
|
+
[name: string]: unknown;
|
|
8944
|
+
};
|
|
8945
|
+
content?: never;
|
|
8946
|
+
};
|
|
8947
|
+
/** @description Authentication required */
|
|
8948
|
+
401: {
|
|
8949
|
+
headers: {
|
|
8950
|
+
[name: string]: unknown;
|
|
8951
|
+
};
|
|
8952
|
+
content?: never;
|
|
8953
|
+
};
|
|
8954
|
+
/** @description Position not found */
|
|
8955
|
+
404: {
|
|
8956
|
+
headers: {
|
|
8957
|
+
[name: string]: unknown;
|
|
8958
|
+
};
|
|
8959
|
+
content?: never;
|
|
8960
|
+
};
|
|
8961
|
+
/** @description Internal server error */
|
|
8962
|
+
500: {
|
|
8963
|
+
headers: {
|
|
8964
|
+
[name: string]: unknown;
|
|
8965
|
+
};
|
|
8966
|
+
content?: never;
|
|
8967
|
+
};
|
|
8968
|
+
};
|
|
8969
|
+
};
|
|
8748
8970
|
get_position_risk: {
|
|
8749
8971
|
parameters: {
|
|
8750
8972
|
query?: never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.22",
|
|
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": "0.8.
|
|
23
|
+
"@0xmonaco/contracts": "0.8.22",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|