@0xmonaco/types 0.8.21 → 0.8.22-develop.efb9dc9
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/auth/index.d.ts +7 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/market/index.d.ts +2 -0
- package/dist/pitpass/index.d.ts +60 -0
- package/dist/pitpass/index.js +6 -0
- package/dist/pitpass/responses.d.ts +44 -0
- package/dist/pitpass/responses.js +53 -0
- package/dist/positions/index.d.ts +68 -0
- package/dist/profile/index.d.ts +32 -1
- package/dist/sdk/index.d.ts +3 -0
- 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 +5 -0
- package/dist/wire/schema.d.ts +530 -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/auth/index.d.ts
CHANGED
|
@@ -22,9 +22,12 @@ export interface AuthAPI extends BaseAPI {
|
|
|
22
22
|
* 4. Verifies the signature, registering the session public key
|
|
23
23
|
*
|
|
24
24
|
* @param clientId - Client ID of the application
|
|
25
|
+
* @param referralCode - Optional PitPass TraderCode (wallet address) of the referrer.
|
|
26
|
+
* Passed through to the verify call so a first-time sign-up records the referral
|
|
27
|
+
* relationship. Has no effect when the user already exists.
|
|
25
28
|
* @returns Promise resolving to the authentication state (including the session keypair)
|
|
26
29
|
*/
|
|
27
|
-
authenticate(clientId: string): Promise<AuthState>;
|
|
30
|
+
authenticate(clientId: string, referralCode?: string): Promise<AuthState>;
|
|
28
31
|
/**
|
|
29
32
|
* Signs a challenge message using the wallet client.
|
|
30
33
|
*
|
|
@@ -54,9 +57,11 @@ export interface AuthAPI extends BaseAPI {
|
|
|
54
57
|
* @param nonce - Nonce from the challenge response
|
|
55
58
|
* @param clientId - Client ID of the application
|
|
56
59
|
* @param session - The locally-generated session keypair (hex-encoded)
|
|
60
|
+
* @param referralCode - Optional PitPass TraderCode (wallet address) of the referrer;
|
|
61
|
+
* recorded at first sign-up only.
|
|
57
62
|
* @returns Promise resolving to the authentication state
|
|
58
63
|
*/
|
|
59
|
-
verifySignature(address: string, signature: string, nonce: string, clientId: string, session: SessionCredentials): Promise<AuthState>;
|
|
64
|
+
verifySignature(address: string, signature: string, nonce: string, clientId: string, session: SessionCredentials, referralCode?: string): Promise<AuthState>;
|
|
60
65
|
/**
|
|
61
66
|
* Extends the current session's expiry. The request is signed with the
|
|
62
67
|
* active session key (set via {@link setSessionKeypair}).
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
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) */
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PitPass Types
|
|
3
|
+
*
|
|
4
|
+
* Types for PitPass TraderCode API: code lookup, rewards balance, and transfer.
|
|
5
|
+
*/
|
|
6
|
+
import type { BaseAPI } from "../api";
|
|
7
|
+
import type { GetRewardsBalanceResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "./responses";
|
|
8
|
+
/**
|
|
9
|
+
* PitPass TraderCode API interface.
|
|
10
|
+
*
|
|
11
|
+
* Provides methods for reading your wallet-derived TraderCode, looking up a
|
|
12
|
+
* referral code at sign-up, reading your accrued rewards balance, and
|
|
13
|
+
* transferring rewards into a tradeable balance.
|
|
14
|
+
*/
|
|
15
|
+
export interface PitpassAPI extends BaseAPI {
|
|
16
|
+
/**
|
|
17
|
+
* Return the authenticated caller's TraderCode (their normalized wallet address).
|
|
18
|
+
*
|
|
19
|
+
* Never 404s — every signed-in wallet has a derivable code. Ensures the
|
|
20
|
+
* backing row so referrals attributed to this wallet have a code to link.
|
|
21
|
+
*
|
|
22
|
+
* @returns Promise resolving to the caller's TraderCode and its creation timestamp
|
|
23
|
+
*/
|
|
24
|
+
getMyTraderCode(): Promise<TraderCodeResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Public, unauthenticated lookup of a TraderCode.
|
|
27
|
+
*
|
|
28
|
+
* Used to validate a referral code at sign-up. The code is a wallet address
|
|
29
|
+
* (the `Monaco - <address>` display form is also accepted). Returns the
|
|
30
|
+
* normalized code when it resolves to a known wallet, or throws a 404 when
|
|
31
|
+
* the code does not resolve to any user.
|
|
32
|
+
*
|
|
33
|
+
* @param code - The TraderCode (wallet address or `Monaco - <address>` form) to look up
|
|
34
|
+
* @returns Promise resolving to the normalized TraderCode
|
|
35
|
+
*/
|
|
36
|
+
getTraderCodeInfo(code: string): Promise<TraderCodeInfoResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Return the caller's current PitPass rewards-bucket balances.
|
|
39
|
+
*
|
|
40
|
+
* Rewards accumulate here as referred users trade. Call
|
|
41
|
+
* {@link transferRewards} to move them into a tradeable balance.
|
|
42
|
+
* Returns an empty `balances` array when no rewards have been earned yet.
|
|
43
|
+
*
|
|
44
|
+
* @returns Promise resolving to the list of per-token reward balances
|
|
45
|
+
*/
|
|
46
|
+
getRewardsBalance(): Promise<GetRewardsBalanceResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Transfer earned PitPass rewards into a trading balance.
|
|
49
|
+
*
|
|
50
|
+
* Moves the specified amount of a reward token from the caller's rewards
|
|
51
|
+
* bucket into their trading balance under the authenticated application.
|
|
52
|
+
* Ledger-only — no on-chain transaction, immediately tradeable.
|
|
53
|
+
*
|
|
54
|
+
* @param params - Token address and raw-unit amount to transfer
|
|
55
|
+
* @returns Promise resolving to the post-transfer rewards and trading balances
|
|
56
|
+
*/
|
|
57
|
+
transferRewards(params: TransferRewardsParams): Promise<TransferRewardsResponse>;
|
|
58
|
+
}
|
|
59
|
+
export type { GetRewardsBalanceResponse, RewardsBalanceEntry, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse, } from "./responses";
|
|
60
|
+
export { GetRewardsBalanceResponseSchema, RewardsBalanceEntrySchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PitPass Types
|
|
3
|
+
*
|
|
4
|
+
* Types for PitPass TraderCode API: code lookup, rewards balance, and transfer.
|
|
5
|
+
*/
|
|
6
|
+
export { GetRewardsBalanceResponseSchema, RewardsBalanceEntrySchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PitPass TraderCode Response Types
|
|
3
|
+
*
|
|
4
|
+
* Types for PitPass TraderCode API responses and requests.
|
|
5
|
+
* All types are derived from Zod schemas for runtime validation.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
/** Schema for a single token entry in the rewards balance response. */
|
|
9
|
+
export declare const RewardsBalanceEntrySchema: z.ZodObject<{
|
|
10
|
+
token: z.ZodString;
|
|
11
|
+
available: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
/** Schema for the rewards balance response. */
|
|
14
|
+
export declare const GetRewardsBalanceResponseSchema: z.ZodObject<{
|
|
15
|
+
balances: z.ZodArray<z.ZodObject<{
|
|
16
|
+
token: z.ZodString;
|
|
17
|
+
available: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
/** Schema for a TraderCode response. */
|
|
21
|
+
export declare const TraderCodeResponseSchema: z.ZodObject<{
|
|
22
|
+
code: z.ZodString;
|
|
23
|
+
createdAt: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
/** Schema for the public TraderCode info response. */
|
|
26
|
+
export declare const TraderCodeInfoResponseSchema: z.ZodObject<{
|
|
27
|
+
code: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
/** Schema for the transfer rewards request body. */
|
|
30
|
+
export declare const TransferRewardsParamsSchema: z.ZodObject<{
|
|
31
|
+
token: z.ZodString;
|
|
32
|
+
amount: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
/** Schema for the transfer rewards response. */
|
|
35
|
+
export declare const TransferRewardsResponseSchema: z.ZodObject<{
|
|
36
|
+
rewardsBalance: z.ZodString;
|
|
37
|
+
tradingBalance: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type RewardsBalanceEntry = z.infer<typeof RewardsBalanceEntrySchema>;
|
|
40
|
+
export type GetRewardsBalanceResponse = z.infer<typeof GetRewardsBalanceResponseSchema>;
|
|
41
|
+
export type TraderCodeResponse = z.infer<typeof TraderCodeResponseSchema>;
|
|
42
|
+
export type TraderCodeInfoResponse = z.infer<typeof TraderCodeInfoResponseSchema>;
|
|
43
|
+
export type TransferRewardsParams = z.infer<typeof TransferRewardsParamsSchema>;
|
|
44
|
+
export type TransferRewardsResponse = z.infer<typeof TransferRewardsResponseSchema>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PitPass TraderCode Response Types
|
|
3
|
+
*
|
|
4
|
+
* Types for PitPass TraderCode API responses and requests.
|
|
5
|
+
* All types are derived from Zod schemas for runtime validation.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
/** Schema for a single token entry in the rewards balance response. */
|
|
9
|
+
export const RewardsBalanceEntrySchema = z.object({
|
|
10
|
+
/** Reward token contract address (0x-prefixed). */
|
|
11
|
+
token: z.string(),
|
|
12
|
+
/** Available rewards balance in RAW atomic units of the token. */
|
|
13
|
+
available: z.string(),
|
|
14
|
+
});
|
|
15
|
+
/** Schema for the rewards balance response. */
|
|
16
|
+
export const GetRewardsBalanceResponseSchema = z.object({
|
|
17
|
+
/** One entry per reward token that has a non-zero available balance. */
|
|
18
|
+
balances: z.array(RewardsBalanceEntrySchema),
|
|
19
|
+
});
|
|
20
|
+
/** Schema for a TraderCode response. */
|
|
21
|
+
export const TraderCodeResponseSchema = z.object({
|
|
22
|
+
/** The caller's TraderCode — their normalized wallet address. */
|
|
23
|
+
code: z.string(),
|
|
24
|
+
/** RFC 3339 timestamp when the code row was first derived. */
|
|
25
|
+
createdAt: z.string(),
|
|
26
|
+
});
|
|
27
|
+
/** Schema for the public TraderCode info response. */
|
|
28
|
+
export const TraderCodeInfoResponseSchema = z.object({
|
|
29
|
+
/** The resolved TraderCode (normalized wallet address). */
|
|
30
|
+
code: z.string(),
|
|
31
|
+
});
|
|
32
|
+
/** Schema for the transfer rewards request body. */
|
|
33
|
+
export const TransferRewardsParamsSchema = z.object({
|
|
34
|
+
/** Reward token contract address (0x-prefixed) to transfer. */
|
|
35
|
+
token: z
|
|
36
|
+
.string()
|
|
37
|
+
.trim()
|
|
38
|
+
.min(1, "token is required")
|
|
39
|
+
.regex(/^0x[0-9a-fA-F]{40}$/, "token must be a 0x-prefixed EVM address"),
|
|
40
|
+
/** Amount to transfer, in RAW atomic units of the token. Must be a positive integer string. */
|
|
41
|
+
amount: z
|
|
42
|
+
.string()
|
|
43
|
+
.trim()
|
|
44
|
+
.min(1, "amount is required")
|
|
45
|
+
.refine((v) => /^\d+$/.test(v) && BigInt(v) > 0n, "amount must be a positive integer string"),
|
|
46
|
+
});
|
|
47
|
+
/** Schema for the transfer rewards response. */
|
|
48
|
+
export const TransferRewardsResponseSchema = z.object({
|
|
49
|
+
/** Your rewards-bucket balance after the transfer, RAW atomic units. */
|
|
50
|
+
rewardsBalance: z.string(),
|
|
51
|
+
/** Your trading balance for the token after the transfer, RAW atomic units. */
|
|
52
|
+
tradingBalance: z.string(),
|
|
53
|
+
});
|
|
@@ -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
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { FaucetAPI } from "../faucet";
|
|
|
6
6
|
import type { FeesAPI } from "../fees";
|
|
7
7
|
import type { MarginAccountsAPI } from "../margin-accounts";
|
|
8
8
|
import type { Interval, MarketAPI } from "../market";
|
|
9
|
+
import type { PitpassAPI } from "../pitpass";
|
|
9
10
|
import type { PositionsAPI } from "../positions";
|
|
10
11
|
import type { ProfileAPI } from "../profile";
|
|
11
12
|
import type { SubAccountsAPI } from "../sub-accounts";
|
|
@@ -81,6 +82,8 @@ export interface MonacoSDK {
|
|
|
81
82
|
positions: PositionsAPI;
|
|
82
83
|
/** Sub-account management API */
|
|
83
84
|
subAccounts: SubAccountsAPI;
|
|
85
|
+
/** PitPass TraderCode referral and rewards API */
|
|
86
|
+
pitpass: PitpassAPI;
|
|
84
87
|
/** Testnet faucet API */
|
|
85
88
|
faucet: FaucetAPI;
|
|
86
89
|
/** Public whitelist (waitlist) submission API */
|
|
@@ -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_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_chart", "get_portfolio_stats", "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"];
|
|
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
|
@@ -41,6 +41,7 @@ export const OPERATION_IDS = [
|
|
|
41
41
|
"get_market_metadata",
|
|
42
42
|
"get_market_stats",
|
|
43
43
|
"get_my_fee_tier",
|
|
44
|
+
"get_my_trader_code",
|
|
44
45
|
"get_open_interest",
|
|
45
46
|
"get_order_by_id",
|
|
46
47
|
"get_orderbook_snapshot",
|
|
@@ -52,10 +53,13 @@ export const OPERATION_IDS = [
|
|
|
52
53
|
"get_portfolio_chart",
|
|
53
54
|
"get_portfolio_stats",
|
|
54
55
|
"get_position",
|
|
56
|
+
"get_position_pnl_history",
|
|
55
57
|
"get_position_risk",
|
|
58
|
+
"get_rewards_balance",
|
|
56
59
|
"get_screener",
|
|
57
60
|
"get_sub_account_limits",
|
|
58
61
|
"get_trade_by_id",
|
|
62
|
+
"get_trader_code_info",
|
|
59
63
|
"get_trades",
|
|
60
64
|
"get_trading_pair_by_id",
|
|
61
65
|
"get_user_balance_by_asset",
|
|
@@ -97,6 +101,7 @@ export const OPERATION_IDS = [
|
|
|
97
101
|
"transfer_collateral_to_margin_account",
|
|
98
102
|
"transfer_collateral_to_parent_margin_account",
|
|
99
103
|
"transfer_collateral_to_risk_bucket",
|
|
104
|
+
"transfer_rewards",
|
|
100
105
|
"update_sub_account_limit",
|
|
101
106
|
"upsert_delegated_agent",
|
|
102
107
|
"verify_signature",
|
package/dist/wire/schema.d.ts
CHANGED
|
@@ -1470,6 +1470,108 @@ export interface paths {
|
|
|
1470
1470
|
patch?: never;
|
|
1471
1471
|
trace?: never;
|
|
1472
1472
|
};
|
|
1473
|
+
"/api/v1/pitpass/codes/me": {
|
|
1474
|
+
parameters: {
|
|
1475
|
+
query?: never;
|
|
1476
|
+
header?: never;
|
|
1477
|
+
path?: never;
|
|
1478
|
+
cookie?: never;
|
|
1479
|
+
};
|
|
1480
|
+
/**
|
|
1481
|
+
* Get your TraderCode
|
|
1482
|
+
* @description Claim your TraderCode.
|
|
1483
|
+
*
|
|
1484
|
+
* Get your TraderCode.
|
|
1485
|
+
*
|
|
1486
|
+
* Return the authenticated caller's TraderCode, which is derived from their
|
|
1487
|
+
* wallet address (rendered `Monaco - <address>` by clients). Never 404s — the
|
|
1488
|
+
* code always exists for a signed-in wallet — and ensures the backing row so
|
|
1489
|
+
* referrals attributed to this wallet have a code to link.
|
|
1490
|
+
*/
|
|
1491
|
+
get: operations["get_my_trader_code"];
|
|
1492
|
+
put?: never;
|
|
1493
|
+
post?: never;
|
|
1494
|
+
delete?: never;
|
|
1495
|
+
options?: never;
|
|
1496
|
+
head?: never;
|
|
1497
|
+
patch?: never;
|
|
1498
|
+
trace?: never;
|
|
1499
|
+
};
|
|
1500
|
+
"/api/v1/pitpass/codes/{code}": {
|
|
1501
|
+
parameters: {
|
|
1502
|
+
query?: never;
|
|
1503
|
+
header?: never;
|
|
1504
|
+
path?: never;
|
|
1505
|
+
cookie?: never;
|
|
1506
|
+
};
|
|
1507
|
+
/**
|
|
1508
|
+
* Look up a TraderCode
|
|
1509
|
+
* @description Look up a TraderCode (public).
|
|
1510
|
+
*
|
|
1511
|
+
* Public, unauthenticated lookup used to validate a referral code at signup.
|
|
1512
|
+
* The code is a wallet address; returns the normalized code when it resolves
|
|
1513
|
+
* to a known wallet. Returns 404 when the code does not resolve to a user.
|
|
1514
|
+
*/
|
|
1515
|
+
get: operations["get_trader_code_info"];
|
|
1516
|
+
put?: never;
|
|
1517
|
+
post?: never;
|
|
1518
|
+
delete?: never;
|
|
1519
|
+
options?: never;
|
|
1520
|
+
head?: never;
|
|
1521
|
+
patch?: never;
|
|
1522
|
+
trace?: never;
|
|
1523
|
+
};
|
|
1524
|
+
"/api/v1/pitpass/rewards/balance": {
|
|
1525
|
+
parameters: {
|
|
1526
|
+
query?: never;
|
|
1527
|
+
header?: never;
|
|
1528
|
+
path?: never;
|
|
1529
|
+
cookie?: never;
|
|
1530
|
+
};
|
|
1531
|
+
/**
|
|
1532
|
+
* Get your rewards balance
|
|
1533
|
+
* @description Read accrued PitPass rewards balance.
|
|
1534
|
+
*
|
|
1535
|
+
* Return the caller's current rewards-bucket balances across all reward tokens.
|
|
1536
|
+
* Rewards accumulate here as referred users trade; call TransferRewards to move
|
|
1537
|
+
* them into a tradeable balance. Returns an empty list when no rewards have
|
|
1538
|
+
* been earned yet.
|
|
1539
|
+
*/
|
|
1540
|
+
get: operations["get_rewards_balance"];
|
|
1541
|
+
put?: never;
|
|
1542
|
+
post?: never;
|
|
1543
|
+
delete?: never;
|
|
1544
|
+
options?: never;
|
|
1545
|
+
head?: never;
|
|
1546
|
+
patch?: never;
|
|
1547
|
+
trace?: never;
|
|
1548
|
+
};
|
|
1549
|
+
"/api/v1/pitpass/rewards/transfer": {
|
|
1550
|
+
parameters: {
|
|
1551
|
+
query?: never;
|
|
1552
|
+
header?: never;
|
|
1553
|
+
path?: never;
|
|
1554
|
+
cookie?: never;
|
|
1555
|
+
};
|
|
1556
|
+
get?: never;
|
|
1557
|
+
put?: never;
|
|
1558
|
+
/**
|
|
1559
|
+
* Transfer rewards into a trading balance
|
|
1560
|
+
* @description Transfer earned rewards into a trading balance.
|
|
1561
|
+
*
|
|
1562
|
+
* Move spendable PitPass reward balance from your rewards bucket into a
|
|
1563
|
+
* trading balance under the authenticated application, making it tradeable
|
|
1564
|
+
* immediately. Ledger-only (one shared vault + one backend ledger) — no
|
|
1565
|
+
* on-chain transaction and no gas. Fails with 402 when the rewards balance is
|
|
1566
|
+
* insufficient.
|
|
1567
|
+
*/
|
|
1568
|
+
post: operations["transfer_rewards"];
|
|
1569
|
+
delete?: never;
|
|
1570
|
+
options?: never;
|
|
1571
|
+
head?: never;
|
|
1572
|
+
patch?: never;
|
|
1573
|
+
trace?: never;
|
|
1574
|
+
};
|
|
1473
1575
|
"/api/v1/positions": {
|
|
1474
1576
|
parameters: {
|
|
1475
1577
|
query?: never;
|
|
@@ -1590,6 +1692,32 @@ export interface paths {
|
|
|
1590
1692
|
patch?: never;
|
|
1591
1693
|
trace?: never;
|
|
1592
1694
|
};
|
|
1695
|
+
"/api/v1/positions/{positionId}/pnl/history": {
|
|
1696
|
+
parameters: {
|
|
1697
|
+
query?: never;
|
|
1698
|
+
header?: never;
|
|
1699
|
+
path?: never;
|
|
1700
|
+
cookie?: never;
|
|
1701
|
+
};
|
|
1702
|
+
/**
|
|
1703
|
+
* Get position PnL history
|
|
1704
|
+
* @description Get bucketed PnL history for one position.
|
|
1705
|
+
*
|
|
1706
|
+
* Time series of PnL state samples (quantity, entry, mark, unrealized,
|
|
1707
|
+
* cumulative realized/funding/fees) for a position the caller owns, at the
|
|
1708
|
+
* requested interval. Buckets between samples are forward-filled; buckets
|
|
1709
|
+
* before the position's first sample are omitted. Distinct from
|
|
1710
|
+
* ListPositionHistory, which returns lifecycle events.
|
|
1711
|
+
*/
|
|
1712
|
+
get: operations["get_position_pnl_history"];
|
|
1713
|
+
put?: never;
|
|
1714
|
+
post?: never;
|
|
1715
|
+
delete?: never;
|
|
1716
|
+
options?: never;
|
|
1717
|
+
head?: never;
|
|
1718
|
+
patch?: never;
|
|
1719
|
+
trace?: never;
|
|
1720
|
+
};
|
|
1593
1721
|
"/api/v1/positions/{positionId}/risk": {
|
|
1594
1722
|
parameters: {
|
|
1595
1723
|
query?: never;
|
|
@@ -3743,7 +3871,7 @@ export interface components {
|
|
|
3743
3871
|
*/
|
|
3744
3872
|
feesPaid?: string | null;
|
|
3745
3873
|
/**
|
|
3746
|
-
* @description
|
|
3874
|
+
* @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
3875
|
* @example -0.01
|
|
3748
3876
|
*/
|
|
3749
3877
|
pnl?: string | null;
|
|
@@ -3773,6 +3901,31 @@ export interface components {
|
|
|
3773
3901
|
* @example 0.00
|
|
3774
3902
|
*/
|
|
3775
3903
|
maxDrawdown?: string | null;
|
|
3904
|
+
/**
|
|
3905
|
+
* @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.
|
|
3906
|
+
* @example 12.34
|
|
3907
|
+
*/
|
|
3908
|
+
unrealizedPnl?: string | null;
|
|
3909
|
+
/**
|
|
3910
|
+
* @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.
|
|
3911
|
+
* @example 10.11
|
|
3912
|
+
*/
|
|
3913
|
+
totalPnl?: string | null;
|
|
3914
|
+
pnlBreakdown?: components["schemas"]["PnlBreakdown"];
|
|
3915
|
+
};
|
|
3916
|
+
GetPositionPnlHistoryResponse: {
|
|
3917
|
+
/**
|
|
3918
|
+
* Format: uuid
|
|
3919
|
+
* @description Position UUID
|
|
3920
|
+
* @example 123e4567-e89b-12d3-a456-426614174000
|
|
3921
|
+
*/
|
|
3922
|
+
positionId?: string | null;
|
|
3923
|
+
/**
|
|
3924
|
+
* @description Interval used for this query
|
|
3925
|
+
* @example 1h
|
|
3926
|
+
*/
|
|
3927
|
+
interval?: string | null;
|
|
3928
|
+
data?: components["schemas"]["PositionPnlPoint"][] | null;
|
|
3776
3929
|
};
|
|
3777
3930
|
GetPositionResponse: {
|
|
3778
3931
|
positionId?: string | null;
|
|
@@ -3790,7 +3943,16 @@ export interface components {
|
|
|
3790
3943
|
/** @description Current isolated collateral for this position's margin-account bucket. */
|
|
3791
3944
|
isolatedMargin?: string | null;
|
|
3792
3945
|
leverage?: string | null;
|
|
3946
|
+
/**
|
|
3947
|
+
* @description Maintenance margin required by this position at mark_price using the
|
|
3948
|
+
* market maintenance-margin rate. Zero when the position has no open exposure.
|
|
3949
|
+
*/
|
|
3793
3950
|
maintenanceMarginRequired?: string | null;
|
|
3951
|
+
/**
|
|
3952
|
+
* @description Initial margin required by this position at mark_price, honoring both its
|
|
3953
|
+
* effective leverage and the market initial-margin floor. Zero when the
|
|
3954
|
+
* position has no open exposure.
|
|
3955
|
+
*/
|
|
3794
3956
|
initialMarginRequired?: string | null;
|
|
3795
3957
|
liquidationPrice?: string | null;
|
|
3796
3958
|
status?: string | null;
|
|
@@ -3805,7 +3967,16 @@ export interface components {
|
|
|
3805
3967
|
unrealizedPnl?: string | null;
|
|
3806
3968
|
liquidationPrice?: string | null;
|
|
3807
3969
|
marginRatio?: string | null;
|
|
3970
|
+
/**
|
|
3971
|
+
* @description Maintenance margin required by this position at mark_price using the
|
|
3972
|
+
* market maintenance-margin rate. Zero when the position has no open exposure.
|
|
3973
|
+
*/
|
|
3808
3974
|
maintenanceMarginRequired?: string | null;
|
|
3975
|
+
/**
|
|
3976
|
+
* @description Initial margin required by this position at mark_price, honoring both its
|
|
3977
|
+
* effective leverage and the market initial-margin floor. Zero when the
|
|
3978
|
+
* position has no open exposure.
|
|
3979
|
+
*/
|
|
3809
3980
|
initialMarginRequired?: string | null;
|
|
3810
3981
|
updatedAt?: string | null;
|
|
3811
3982
|
};
|
|
@@ -3863,6 +4034,10 @@ export interface components {
|
|
|
3863
4034
|
*/
|
|
3864
4035
|
applicationMakerFeeBps?: number | null;
|
|
3865
4036
|
};
|
|
4037
|
+
GetRewardsBalanceResponse: {
|
|
4038
|
+
/** @description One entry per reward token that has a non-zero available balance. */
|
|
4039
|
+
balances?: components["schemas"]["RewardsBalanceEntry"][] | null;
|
|
4040
|
+
};
|
|
3866
4041
|
/** @description Paginated screener response sorted by quoteVolume24h desc (nulls last). */
|
|
3867
4042
|
GetScreenerResponse: {
|
|
3868
4043
|
items?: components["schemas"]["ScreenerItem"][] | null;
|
|
@@ -3911,6 +4086,10 @@ export interface components {
|
|
|
3911
4086
|
*/
|
|
3912
4087
|
tradingMode?: string | null;
|
|
3913
4088
|
};
|
|
4089
|
+
GetTraderCodeInfoResponse: {
|
|
4090
|
+
/** @description The resolved TraderCode (normalized wallet address) */
|
|
4091
|
+
code?: string | null;
|
|
4092
|
+
};
|
|
3914
4093
|
/** @description Recent trades for a trading pair. */
|
|
3915
4094
|
GetTradesResponse: {
|
|
3916
4095
|
trades?: components["schemas"]["PublicTrade"][] | null;
|
|
@@ -4568,6 +4747,42 @@ export interface components {
|
|
|
4568
4747
|
*/
|
|
4569
4748
|
createdAt?: string | null;
|
|
4570
4749
|
};
|
|
4750
|
+
/**
|
|
4751
|
+
* @description Lifetime PnL components for the authenticated user. The fields satisfy
|
|
4752
|
+
* totalPnl = (spotRealized + perpsRealized) + (spotUnrealized + perpsUnrealized) - fundingPaid - fees.
|
|
4753
|
+
*/
|
|
4754
|
+
PnlBreakdown: {
|
|
4755
|
+
/**
|
|
4756
|
+
* @description Cumulative realized spot PnL, average-cost basis, gross of fees; withdrawals realize at fair value
|
|
4757
|
+
* @example 3.21
|
|
4758
|
+
*/
|
|
4759
|
+
spotRealized?: string | null;
|
|
4760
|
+
/**
|
|
4761
|
+
* @description Unrealized PnL on current spot holdings: quantity x (latest close - average cost)
|
|
4762
|
+
* @example 1.00
|
|
4763
|
+
*/
|
|
4764
|
+
spotUnrealized?: string | null;
|
|
4765
|
+
/**
|
|
4766
|
+
* @description Cumulative realized perps PnL, gross of fees
|
|
4767
|
+
* @example 5.55
|
|
4768
|
+
*/
|
|
4769
|
+
perpsRealized?: string | null;
|
|
4770
|
+
/**
|
|
4771
|
+
* @description Unrealized PnL on open perp positions: quantity x (mark - entry)
|
|
4772
|
+
* @example 2.00
|
|
4773
|
+
*/
|
|
4774
|
+
perpsUnrealized?: string | null;
|
|
4775
|
+
/**
|
|
4776
|
+
* @description Cumulative funding paid; positive means paid, negative means received (same sign convention as the funding-payments endpoint). Subtracted in totalPnl.
|
|
4777
|
+
* @example 0.50
|
|
4778
|
+
*/
|
|
4779
|
+
fundingPaid?: string | null;
|
|
4780
|
+
/**
|
|
4781
|
+
* @description Cumulative trading fees; positive means charged, negative means rebated. Subtracted in totalPnl.
|
|
4782
|
+
* @example 1.15
|
|
4783
|
+
*/
|
|
4784
|
+
fees?: string | null;
|
|
4785
|
+
};
|
|
4571
4786
|
Position: {
|
|
4572
4787
|
positionId?: string | null;
|
|
4573
4788
|
/** @description Margin account UUID for the isolated bucket that owns this position. */
|
|
@@ -4584,7 +4799,16 @@ export interface components {
|
|
|
4584
4799
|
/** @description Current isolated collateral for this position's margin-account bucket. */
|
|
4585
4800
|
isolatedMargin?: string | null;
|
|
4586
4801
|
leverage?: string | null;
|
|
4802
|
+
/**
|
|
4803
|
+
* @description Maintenance margin required by this position at mark_price using the
|
|
4804
|
+
* market maintenance-margin rate. Zero when the position has no open exposure.
|
|
4805
|
+
*/
|
|
4587
4806
|
maintenanceMarginRequired?: string | null;
|
|
4807
|
+
/**
|
|
4808
|
+
* @description Initial margin required by this position at mark_price, honoring both its
|
|
4809
|
+
* effective leverage and the market initial-margin floor. Zero when the
|
|
4810
|
+
* position has no open exposure.
|
|
4811
|
+
*/
|
|
4588
4812
|
initialMarginRequired?: string | null;
|
|
4589
4813
|
liquidationPrice?: string | null;
|
|
4590
4814
|
status?: string | null;
|
|
@@ -4608,6 +4832,52 @@ export interface components {
|
|
|
4608
4832
|
orderId?: string | null;
|
|
4609
4833
|
createdAt?: string | null;
|
|
4610
4834
|
};
|
|
4835
|
+
/**
|
|
4836
|
+
* @description One PnL state sample for a position in one bucket. Cumulative fields are
|
|
4837
|
+
* lifetime values as of the bucket; fundingPaid and fees are cost-positive.
|
|
4838
|
+
*/
|
|
4839
|
+
PositionPnlPoint: {
|
|
4840
|
+
/**
|
|
4841
|
+
* @description Bucket start timestamp (ISO 8601)
|
|
4842
|
+
* @example 2026-02-18T00:00:00Z
|
|
4843
|
+
*/
|
|
4844
|
+
bucketStart?: string | null;
|
|
4845
|
+
/**
|
|
4846
|
+
* @description Signed position quantity (negative for shorts)
|
|
4847
|
+
* @example 1.50
|
|
4848
|
+
*/
|
|
4849
|
+
quantity?: string | null;
|
|
4850
|
+
/**
|
|
4851
|
+
* @description Average entry price
|
|
4852
|
+
* @example 95000.00
|
|
4853
|
+
*/
|
|
4854
|
+
entryPrice?: string | null;
|
|
4855
|
+
/**
|
|
4856
|
+
* @description Mark price at the sample
|
|
4857
|
+
* @example 95410.25
|
|
4858
|
+
*/
|
|
4859
|
+
markPrice?: string | null;
|
|
4860
|
+
/**
|
|
4861
|
+
* @description Unrealized PnL at the sample: quantity x (mark - entry)
|
|
4862
|
+
* @example 615.38
|
|
4863
|
+
*/
|
|
4864
|
+
unrealizedPnl?: string | null;
|
|
4865
|
+
/**
|
|
4866
|
+
* @description Cumulative realized PnL, gross of fees
|
|
4867
|
+
* @example 120.00
|
|
4868
|
+
*/
|
|
4869
|
+
cumRealizedPnl?: string | null;
|
|
4870
|
+
/**
|
|
4871
|
+
* @description Cumulative funding paid; positive means paid, negative means received
|
|
4872
|
+
* @example 3.20
|
|
4873
|
+
*/
|
|
4874
|
+
cumFundingPaid?: string | null;
|
|
4875
|
+
/**
|
|
4876
|
+
* @description Cumulative trading fees; positive means charged, negative means rebated
|
|
4877
|
+
* @example 1.75
|
|
4878
|
+
*/
|
|
4879
|
+
cumFees?: string | null;
|
|
4880
|
+
};
|
|
4611
4881
|
PriceChange: {
|
|
4612
4882
|
/**
|
|
4613
4883
|
* @description Price 24 hours ago
|
|
@@ -4764,6 +5034,15 @@ export interface components {
|
|
|
4764
5034
|
*/
|
|
4765
5035
|
message?: string | null;
|
|
4766
5036
|
};
|
|
5037
|
+
RewardsBalanceEntry: {
|
|
5038
|
+
/** @description Reward token contract address (0x-prefixed). */
|
|
5039
|
+
token?: string | null;
|
|
5040
|
+
/**
|
|
5041
|
+
* @description Available rewards balance in RAW atomic units of the token.
|
|
5042
|
+
* @example 1200000
|
|
5043
|
+
*/
|
|
5044
|
+
available?: string | null;
|
|
5045
|
+
};
|
|
4767
5046
|
RiskTier: {
|
|
4768
5047
|
initialMarginRatio?: string | null;
|
|
4769
5048
|
maintenanceMarginRatio?: string | null;
|
|
@@ -5172,6 +5451,15 @@ export interface components {
|
|
|
5172
5451
|
*/
|
|
5173
5452
|
tradeId?: string | null;
|
|
5174
5453
|
};
|
|
5454
|
+
TraderCodeResponse: {
|
|
5455
|
+
/** @description Your TraderCode — your normalized wallet address (clients render it `Monaco - <address>`). */
|
|
5456
|
+
code?: string | null;
|
|
5457
|
+
/**
|
|
5458
|
+
* @description RFC 3339 timestamp when the code row was first derived
|
|
5459
|
+
* @example 2026-07-07T18:00:00Z
|
|
5460
|
+
*/
|
|
5461
|
+
createdAt?: string | null;
|
|
5462
|
+
};
|
|
5175
5463
|
/** @description Trading pair configuration including tokens, fees, and order limits. */
|
|
5176
5464
|
TradingPairData: {
|
|
5177
5465
|
/**
|
|
@@ -5285,6 +5573,11 @@ export interface components {
|
|
|
5285
5573
|
* @example crypto
|
|
5286
5574
|
*/
|
|
5287
5575
|
category?: string | null;
|
|
5576
|
+
/**
|
|
5577
|
+
* @description Minimum order quantity increment (lot size step) in base token
|
|
5578
|
+
* @example 0.00001
|
|
5579
|
+
*/
|
|
5580
|
+
quantityStepSize?: string | null;
|
|
5288
5581
|
};
|
|
5289
5582
|
TransferCollateralFromMarginAccountRequest: {
|
|
5290
5583
|
/** @description Parent margin account UUID that releases collateral. */
|
|
@@ -5367,6 +5660,27 @@ export interface components {
|
|
|
5367
5660
|
/** @description Trading pair UUIDs selected into the cross risk bucket. Required when marginMode is CROSS. */
|
|
5368
5661
|
selectedTradingPairIds?: string[] | null;
|
|
5369
5662
|
};
|
|
5663
|
+
TransferRewardsRequest: {
|
|
5664
|
+
/** @description Reward token contract address (0x-prefixed) to transfer. */
|
|
5665
|
+
token: string;
|
|
5666
|
+
/**
|
|
5667
|
+
* @description Amount to transfer, in RAW atomic units of the token.
|
|
5668
|
+
* @example 1000000
|
|
5669
|
+
*/
|
|
5670
|
+
amount: string;
|
|
5671
|
+
};
|
|
5672
|
+
TransferRewardsResponse: {
|
|
5673
|
+
/**
|
|
5674
|
+
* @description Your rewards-bucket balance after the transfer, RAW atomic units.
|
|
5675
|
+
* @example 0
|
|
5676
|
+
*/
|
|
5677
|
+
rewardsBalance?: string | null;
|
|
5678
|
+
/**
|
|
5679
|
+
* @description Your trading balance for the token after the transfer, RAW atomic units.
|
|
5680
|
+
* @example 1000000
|
|
5681
|
+
*/
|
|
5682
|
+
tradingBalance?: string | null;
|
|
5683
|
+
};
|
|
5370
5684
|
UpdateLimitRequest: {
|
|
5371
5685
|
/**
|
|
5372
5686
|
* Format: uuid
|
|
@@ -5519,6 +5833,8 @@ export interface components {
|
|
|
5519
5833
|
* @example 3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29
|
|
5520
5834
|
*/
|
|
5521
5835
|
sessionPublicKey: string;
|
|
5836
|
+
/** @description Optional PitPass TraderCode captured at signup (e.g. from a `?ref=CODE` link). When a user verifies for the very first time with a valid code, a referral relationship is recorded atomically. Ignored for users who already exist, and silently ignored if the code is unknown — a bad code never blocks sign-in. */
|
|
5837
|
+
referralCode?: string | null;
|
|
5522
5838
|
};
|
|
5523
5839
|
VerifyResponse: {
|
|
5524
5840
|
/**
|
|
@@ -8559,6 +8875,162 @@ export interface operations {
|
|
|
8559
8875
|
};
|
|
8560
8876
|
};
|
|
8561
8877
|
};
|
|
8878
|
+
get_my_trader_code: {
|
|
8879
|
+
parameters: {
|
|
8880
|
+
query?: never;
|
|
8881
|
+
header?: never;
|
|
8882
|
+
path?: never;
|
|
8883
|
+
cookie?: never;
|
|
8884
|
+
};
|
|
8885
|
+
requestBody?: never;
|
|
8886
|
+
responses: {
|
|
8887
|
+
/** @description OK */
|
|
8888
|
+
200: {
|
|
8889
|
+
headers: {
|
|
8890
|
+
[name: string]: unknown;
|
|
8891
|
+
};
|
|
8892
|
+
content: {
|
|
8893
|
+
"application/json": components["schemas"]["TraderCodeResponse"];
|
|
8894
|
+
};
|
|
8895
|
+
};
|
|
8896
|
+
/** @description Authentication required */
|
|
8897
|
+
401: {
|
|
8898
|
+
headers: {
|
|
8899
|
+
[name: string]: unknown;
|
|
8900
|
+
};
|
|
8901
|
+
content?: never;
|
|
8902
|
+
};
|
|
8903
|
+
/** @description Internal server error */
|
|
8904
|
+
500: {
|
|
8905
|
+
headers: {
|
|
8906
|
+
[name: string]: unknown;
|
|
8907
|
+
};
|
|
8908
|
+
content?: never;
|
|
8909
|
+
};
|
|
8910
|
+
};
|
|
8911
|
+
};
|
|
8912
|
+
get_trader_code_info: {
|
|
8913
|
+
parameters: {
|
|
8914
|
+
query?: never;
|
|
8915
|
+
header?: never;
|
|
8916
|
+
path: {
|
|
8917
|
+
code: string;
|
|
8918
|
+
};
|
|
8919
|
+
cookie?: never;
|
|
8920
|
+
};
|
|
8921
|
+
requestBody?: never;
|
|
8922
|
+
responses: {
|
|
8923
|
+
/** @description OK */
|
|
8924
|
+
200: {
|
|
8925
|
+
headers: {
|
|
8926
|
+
[name: string]: unknown;
|
|
8927
|
+
};
|
|
8928
|
+
content: {
|
|
8929
|
+
"application/json": components["schemas"]["GetTraderCodeInfoResponse"];
|
|
8930
|
+
};
|
|
8931
|
+
};
|
|
8932
|
+
/** @description Code not found */
|
|
8933
|
+
404: {
|
|
8934
|
+
headers: {
|
|
8935
|
+
[name: string]: unknown;
|
|
8936
|
+
};
|
|
8937
|
+
content?: never;
|
|
8938
|
+
};
|
|
8939
|
+
/** @description Internal server error */
|
|
8940
|
+
500: {
|
|
8941
|
+
headers: {
|
|
8942
|
+
[name: string]: unknown;
|
|
8943
|
+
};
|
|
8944
|
+
content?: never;
|
|
8945
|
+
};
|
|
8946
|
+
};
|
|
8947
|
+
};
|
|
8948
|
+
get_rewards_balance: {
|
|
8949
|
+
parameters: {
|
|
8950
|
+
query?: never;
|
|
8951
|
+
header?: never;
|
|
8952
|
+
path?: never;
|
|
8953
|
+
cookie?: never;
|
|
8954
|
+
};
|
|
8955
|
+
requestBody?: never;
|
|
8956
|
+
responses: {
|
|
8957
|
+
/** @description OK */
|
|
8958
|
+
200: {
|
|
8959
|
+
headers: {
|
|
8960
|
+
[name: string]: unknown;
|
|
8961
|
+
};
|
|
8962
|
+
content: {
|
|
8963
|
+
"application/json": components["schemas"]["GetRewardsBalanceResponse"];
|
|
8964
|
+
};
|
|
8965
|
+
};
|
|
8966
|
+
/** @description Authentication required */
|
|
8967
|
+
401: {
|
|
8968
|
+
headers: {
|
|
8969
|
+
[name: string]: unknown;
|
|
8970
|
+
};
|
|
8971
|
+
content?: never;
|
|
8972
|
+
};
|
|
8973
|
+
/** @description Internal server error */
|
|
8974
|
+
500: {
|
|
8975
|
+
headers: {
|
|
8976
|
+
[name: string]: unknown;
|
|
8977
|
+
};
|
|
8978
|
+
content?: never;
|
|
8979
|
+
};
|
|
8980
|
+
};
|
|
8981
|
+
};
|
|
8982
|
+
transfer_rewards: {
|
|
8983
|
+
parameters: {
|
|
8984
|
+
query?: never;
|
|
8985
|
+
header?: never;
|
|
8986
|
+
path?: never;
|
|
8987
|
+
cookie?: never;
|
|
8988
|
+
};
|
|
8989
|
+
requestBody: {
|
|
8990
|
+
content: {
|
|
8991
|
+
"application/json": components["schemas"]["TransferRewardsRequest"];
|
|
8992
|
+
};
|
|
8993
|
+
};
|
|
8994
|
+
responses: {
|
|
8995
|
+
/** @description OK */
|
|
8996
|
+
200: {
|
|
8997
|
+
headers: {
|
|
8998
|
+
[name: string]: unknown;
|
|
8999
|
+
};
|
|
9000
|
+
content: {
|
|
9001
|
+
"application/json": components["schemas"]["TransferRewardsResponse"];
|
|
9002
|
+
};
|
|
9003
|
+
};
|
|
9004
|
+
/** @description Invalid token or amount */
|
|
9005
|
+
400: {
|
|
9006
|
+
headers: {
|
|
9007
|
+
[name: string]: unknown;
|
|
9008
|
+
};
|
|
9009
|
+
content?: never;
|
|
9010
|
+
};
|
|
9011
|
+
/** @description Authentication required */
|
|
9012
|
+
401: {
|
|
9013
|
+
headers: {
|
|
9014
|
+
[name: string]: unknown;
|
|
9015
|
+
};
|
|
9016
|
+
content?: never;
|
|
9017
|
+
};
|
|
9018
|
+
/** @description Insufficient rewards balance */
|
|
9019
|
+
409: {
|
|
9020
|
+
headers: {
|
|
9021
|
+
[name: string]: unknown;
|
|
9022
|
+
};
|
|
9023
|
+
content?: never;
|
|
9024
|
+
};
|
|
9025
|
+
/** @description Internal server error */
|
|
9026
|
+
500: {
|
|
9027
|
+
headers: {
|
|
9028
|
+
[name: string]: unknown;
|
|
9029
|
+
};
|
|
9030
|
+
content?: never;
|
|
9031
|
+
};
|
|
9032
|
+
};
|
|
9033
|
+
};
|
|
8562
9034
|
list_positions: {
|
|
8563
9035
|
parameters: {
|
|
8564
9036
|
query?: {
|
|
@@ -8745,6 +9217,63 @@ export interface operations {
|
|
|
8745
9217
|
};
|
|
8746
9218
|
};
|
|
8747
9219
|
};
|
|
9220
|
+
get_position_pnl_history: {
|
|
9221
|
+
parameters: {
|
|
9222
|
+
query: {
|
|
9223
|
+
/** @description Sample interval */
|
|
9224
|
+
interval: "1m" | "5m" | "15m" | "1h" | "4h" | "1d";
|
|
9225
|
+
/** @description Start time as Unix timestamp (milliseconds) */
|
|
9226
|
+
startTime?: number;
|
|
9227
|
+
/** @description End time as Unix timestamp (milliseconds) */
|
|
9228
|
+
endTime?: number;
|
|
9229
|
+
};
|
|
9230
|
+
header?: never;
|
|
9231
|
+
path: {
|
|
9232
|
+
positionId: string;
|
|
9233
|
+
};
|
|
9234
|
+
cookie?: never;
|
|
9235
|
+
};
|
|
9236
|
+
requestBody?: never;
|
|
9237
|
+
responses: {
|
|
9238
|
+
/** @description OK */
|
|
9239
|
+
200: {
|
|
9240
|
+
headers: {
|
|
9241
|
+
[name: string]: unknown;
|
|
9242
|
+
};
|
|
9243
|
+
content: {
|
|
9244
|
+
"application/json": components["schemas"]["GetPositionPnlHistoryResponse"];
|
|
9245
|
+
};
|
|
9246
|
+
};
|
|
9247
|
+
/** @description Invalid interval or time range */
|
|
9248
|
+
400: {
|
|
9249
|
+
headers: {
|
|
9250
|
+
[name: string]: unknown;
|
|
9251
|
+
};
|
|
9252
|
+
content?: never;
|
|
9253
|
+
};
|
|
9254
|
+
/** @description Authentication required */
|
|
9255
|
+
401: {
|
|
9256
|
+
headers: {
|
|
9257
|
+
[name: string]: unknown;
|
|
9258
|
+
};
|
|
9259
|
+
content?: never;
|
|
9260
|
+
};
|
|
9261
|
+
/** @description Position not found */
|
|
9262
|
+
404: {
|
|
9263
|
+
headers: {
|
|
9264
|
+
[name: string]: unknown;
|
|
9265
|
+
};
|
|
9266
|
+
content?: never;
|
|
9267
|
+
};
|
|
9268
|
+
/** @description Internal server error */
|
|
9269
|
+
500: {
|
|
9270
|
+
headers: {
|
|
9271
|
+
[name: string]: unknown;
|
|
9272
|
+
};
|
|
9273
|
+
content?: never;
|
|
9274
|
+
};
|
|
9275
|
+
};
|
|
9276
|
+
};
|
|
8748
9277
|
get_position_risk: {
|
|
8749
9278
|
parameters: {
|
|
8750
9279
|
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-develop.efb9dc9",
|
|
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-develop.efb9dc9",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|