@0xmonaco/core 0.8.11 → 0.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/applications/api.js +4 -4
- package/dist/api/auth/api.d.ts +1 -1
- package/dist/api/auth/api.js +10 -10
- package/dist/api/base.d.ts +2 -2
- package/dist/api/base.js +2 -2
- package/dist/api/delegated-agents/api.js +12 -12
- package/dist/api/faucet/api.d.ts +1 -1
- package/dist/api/faucet/api.js +1 -1
- package/dist/api/fees/api.d.ts +13 -13
- package/dist/api/fees/api.js +18 -18
- package/dist/api/margin-accounts/api.d.ts +8 -3
- package/dist/api/margin-accounts/api.js +69 -25
- package/dist/api/market/api.d.ts +2 -2
- package/dist/api/market/api.js +19 -17
- package/dist/api/orderbook/api.js +13 -13
- package/dist/api/perp/routes.d.ts +68 -52
- package/dist/api/perp/routes.js +9 -2
- package/dist/api/positions/api.d.ts +2 -1
- package/dist/api/positions/api.js +30 -18
- package/dist/api/profile/api.d.ts +23 -23
- package/dist/api/profile/api.js +46 -46
- package/dist/api/sub-accounts/api.d.ts +2 -2
- package/dist/api/sub-accounts/api.js +2 -2
- package/dist/api/trades/api.d.ts +11 -11
- package/dist/api/trades/api.js +10 -10
- package/dist/api/trading/api.d.ts +10 -10
- package/dist/api/trading/api.js +69 -69
- package/dist/api/vault/api.d.ts +71 -28
- package/dist/api/vault/api.js +139 -39
- package/dist/api/whitelist/api.d.ts +2 -2
- package/dist/api/whitelist/api.js +2 -2
- package/dist/api/withdrawals/api.d.ts +8 -5
- package/dist/api/withdrawals/api.js +13 -5
- package/dist/coverage.d.ts +9 -2
- package/dist/coverage.js +9 -2
- package/dist/sdk.d.ts +2 -2
- package/dist/sdk.js +3 -3
- package/package.json +3 -3
package/dist/api/profile/api.js
CHANGED
|
@@ -40,8 +40,8 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
40
40
|
* console.log(`User ID: ${profile.id}`);
|
|
41
41
|
* console.log(`Address: ${profile.address}`);
|
|
42
42
|
* console.log(`Username: ${profile.username}`);
|
|
43
|
-
* console.log(`Account type: ${profile.
|
|
44
|
-
* console.log(`Can withdraw: ${profile.
|
|
43
|
+
* console.log(`Account type: ${profile.accountType}`);
|
|
44
|
+
* console.log(`Can withdraw: ${profile.canWithdraw}`);
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
async getProfile() {
|
|
@@ -56,27 +56,27 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
56
56
|
* @param params - Optional query parameters for pagination and filtering
|
|
57
57
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
58
58
|
* @param params.limit - Number of items per page (default: 20, max: 100)
|
|
59
|
-
* @param params.
|
|
60
|
-
* @param params.
|
|
61
|
-
* @param params.
|
|
59
|
+
* @param params.entryType - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
60
|
+
* @param params.transactionType - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
61
|
+
* @param params.assetId - Filter by asset ID (UUID)
|
|
62
62
|
* @returns Promise resolving to paginated movements response
|
|
63
63
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
64
64
|
*
|
|
65
65
|
* @example
|
|
66
66
|
* ```typescript
|
|
67
|
-
* // Get first page with default
|
|
67
|
+
* // Get first page with default pageSize (20)
|
|
68
68
|
* const movements = await profileAPI.getPaginatedUserMovements();
|
|
69
69
|
* console.log(`Total movements: ${movements.total}`);
|
|
70
70
|
*
|
|
71
|
-
* // Get second page with custom
|
|
72
|
-
* const page2 = await profileAPI.getPaginatedUserMovements({ page: 2,
|
|
73
|
-
* console.log(`Page ${page2.page} of ${page2.
|
|
71
|
+
* // Get second page with custom pageSize
|
|
72
|
+
* const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, pageSize: 50 });
|
|
73
|
+
* console.log(`Page ${page2.page} of ${page2.totalPages}`);
|
|
74
74
|
*
|
|
75
75
|
* // Filter by entry type and transaction type
|
|
76
|
-
* const deposits = await profileAPI.getPaginatedUserMovements({
|
|
76
|
+
* const deposits = await profileAPI.getPaginatedUserMovements({ entryType: "CREDIT", transactionType: "DEPOSIT" });
|
|
77
77
|
*
|
|
78
78
|
* // Filter by asset
|
|
79
|
-
* const usdcMovements = await profileAPI.getPaginatedUserMovements({
|
|
79
|
+
* const usdcMovements = await profileAPI.getPaginatedUserMovements({ assetId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
82
|
async getPaginatedUserMovements(params) {
|
|
@@ -87,17 +87,17 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
87
87
|
if (params?.page !== undefined) {
|
|
88
88
|
searchParams.append("page", params.page.toString());
|
|
89
89
|
}
|
|
90
|
-
if (params?.
|
|
91
|
-
searchParams.append("
|
|
90
|
+
if (params?.pageSize !== undefined) {
|
|
91
|
+
searchParams.append("pageSize", params.pageSize.toString());
|
|
92
92
|
}
|
|
93
|
-
if (params?.
|
|
94
|
-
searchParams.append("
|
|
93
|
+
if (params?.entryType !== undefined) {
|
|
94
|
+
searchParams.append("entryType", params.entryType);
|
|
95
95
|
}
|
|
96
|
-
if (params?.
|
|
97
|
-
searchParams.append("
|
|
96
|
+
if (params?.transactionType !== undefined) {
|
|
97
|
+
searchParams.append("transactionType", params.transactionType);
|
|
98
98
|
}
|
|
99
|
-
if (params?.
|
|
100
|
-
searchParams.append("
|
|
99
|
+
if (params?.assetId !== undefined) {
|
|
100
|
+
searchParams.append("assetId", params.assetId);
|
|
101
101
|
}
|
|
102
102
|
const queryString = searchParams.toString();
|
|
103
103
|
const url = queryString ? `/api/v1/accounts/movements?${queryString}` : "/api/v1/accounts/movements";
|
|
@@ -111,7 +111,7 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
111
111
|
*
|
|
112
112
|
* @param params - Optional query parameters for pagination
|
|
113
113
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
114
|
-
* @param params.
|
|
114
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 100)
|
|
115
115
|
* @returns Promise resolving to paginated balances response
|
|
116
116
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
117
117
|
*
|
|
@@ -121,11 +121,11 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
121
121
|
* const balances = await profileAPI.getUserBalances();
|
|
122
122
|
* console.log(`Total balances: ${balances.total}`);
|
|
123
123
|
* balances.balances.forEach(balance => {
|
|
124
|
-
* console.log(`${balance.symbol}: ${balance.
|
|
124
|
+
* console.log(`${balance.symbol}: ${balance.availableBalance}`);
|
|
125
125
|
* });
|
|
126
126
|
*
|
|
127
127
|
* // Get page 2 with 50 items per page
|
|
128
|
-
* const nextBalances = await profileAPI.getUserBalances({ page: 2,
|
|
128
|
+
* const nextBalances = await profileAPI.getUserBalances({ page: 2, pageSize: 50 });
|
|
129
129
|
* console.log(`Returned ${nextBalances.balances.length} balances`);
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
@@ -134,8 +134,8 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
134
134
|
if (params?.page !== undefined) {
|
|
135
135
|
searchParams.append("page", params.page.toString());
|
|
136
136
|
}
|
|
137
|
-
if (params?.
|
|
138
|
-
searchParams.append("
|
|
137
|
+
if (params?.pageSize !== undefined) {
|
|
138
|
+
searchParams.append("pageSize", params.pageSize.toString());
|
|
139
139
|
}
|
|
140
140
|
const queryString = searchParams.toString();
|
|
141
141
|
const url = queryString ? `/api/v1/accounts/balances?${queryString}` : "/api/v1/accounts/balances";
|
|
@@ -144,7 +144,7 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
144
144
|
/**
|
|
145
145
|
* Get the current user's balance for a specific asset.
|
|
146
146
|
*
|
|
147
|
-
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{
|
|
147
|
+
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{assetId} endpoint.
|
|
148
148
|
* Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
|
|
149
149
|
*
|
|
150
150
|
* @param assetId - The asset identifier (UUID)
|
|
@@ -155,15 +155,15 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
155
155
|
* ```typescript
|
|
156
156
|
* // Get balance for a specific asset
|
|
157
157
|
* const balance = await profileAPI.getUserBalanceByAssetId('123e4567-e89b-12d3-a456-426614174000');
|
|
158
|
-
* console.log(`${balance.symbol}: ${balance.
|
|
159
|
-
* console.log(`Locked: ${balance.
|
|
160
|
-
* console.log(`Total: ${balance.
|
|
158
|
+
* console.log(`${balance.symbol}: ${balance.availableBalance}`);
|
|
159
|
+
* console.log(`Locked: ${balance.lockedBalance}`);
|
|
160
|
+
* console.log(`Total: ${balance.totalBalance}`);
|
|
161
161
|
* ```
|
|
162
162
|
*/
|
|
163
163
|
async getUserBalanceByAssetId(assetId) {
|
|
164
164
|
if (!assetId || assetId.trim() === "") {
|
|
165
165
|
throw new APIError("assetId is required and cannot be empty", {
|
|
166
|
-
endpoint: "/api/v1/accounts/balances/{
|
|
166
|
+
endpoint: "/api/v1/accounts/balances/{assetId}",
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
const url = `/api/v1/accounts/balances/${assetId}`;
|
|
@@ -184,7 +184,7 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
184
184
|
* const stats = await profileAPI.getPortfolioStats("30d");
|
|
185
185
|
* console.log(`PnL: ${stats.pnl}`);
|
|
186
186
|
* console.log(`Volume: ${stats.volume}`);
|
|
187
|
-
* console.log(`Total equity: ${stats.
|
|
187
|
+
* console.log(`Total equity: ${stats.totalEquity}`);
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
190
|
async getPortfolioStats(period) {
|
|
@@ -222,8 +222,8 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
222
222
|
*
|
|
223
223
|
* @param params - Optional query parameters for pagination and filtering
|
|
224
224
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
225
|
-
* @param params.
|
|
226
|
-
* @param params.
|
|
225
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 100)
|
|
226
|
+
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
227
227
|
* @returns Promise resolving to paginated trades response
|
|
228
228
|
* @throws {ValidationError} When the provided params fail client-side validation
|
|
229
229
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
@@ -235,7 +235,7 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
235
235
|
* console.log(`Total trades: ${trades.total}`);
|
|
236
236
|
*
|
|
237
237
|
* // Filter by trading pair
|
|
238
|
-
* const pairTrades = await profileAPI.getUserTrades({
|
|
238
|
+
* const pairTrades = await profileAPI.getUserTrades({ tradingPairId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
239
239
|
* ```
|
|
240
240
|
*/
|
|
241
241
|
async getUserTrades(params) {
|
|
@@ -246,11 +246,11 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
246
246
|
if (params?.page !== undefined) {
|
|
247
247
|
searchParams.append("page", params.page.toString());
|
|
248
248
|
}
|
|
249
|
-
if (params?.
|
|
250
|
-
searchParams.append("
|
|
249
|
+
if (params?.pageSize !== undefined) {
|
|
250
|
+
searchParams.append("pageSize", params.pageSize.toString());
|
|
251
251
|
}
|
|
252
|
-
if (params?.
|
|
253
|
-
searchParams.append("
|
|
252
|
+
if (params?.tradingPairId !== undefined) {
|
|
253
|
+
searchParams.append("tradingPairId", params.tradingPairId);
|
|
254
254
|
}
|
|
255
255
|
const queryString = searchParams.toString();
|
|
256
256
|
const url = queryString ? `/api/v1/accounts/trades?${queryString}` : "/api/v1/accounts/trades";
|
|
@@ -268,7 +268,7 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
268
268
|
*
|
|
269
269
|
* @example
|
|
270
270
|
* ```typescript
|
|
271
|
-
* const funding = await profileAPI.listFundingPayments({
|
|
271
|
+
* const funding = await profileAPI.listFundingPayments({ tradingPairId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
272
272
|
* console.log(`Total funding payments: ${funding.total}`);
|
|
273
273
|
* ```
|
|
274
274
|
*/
|
|
@@ -280,17 +280,17 @@ export class ProfileAPIImpl extends BaseAPI {
|
|
|
280
280
|
if (params?.page !== undefined) {
|
|
281
281
|
searchParams.append("page", params.page.toString());
|
|
282
282
|
}
|
|
283
|
-
if (params?.
|
|
284
|
-
searchParams.append("
|
|
283
|
+
if (params?.pageSize !== undefined) {
|
|
284
|
+
searchParams.append("pageSize", params.pageSize.toString());
|
|
285
285
|
}
|
|
286
|
-
if (params?.
|
|
287
|
-
searchParams.append("
|
|
286
|
+
if (params?.tradingPairId !== undefined) {
|
|
287
|
+
searchParams.append("tradingPairId", params.tradingPairId);
|
|
288
288
|
}
|
|
289
|
-
if (params?.
|
|
290
|
-
searchParams.append("
|
|
289
|
+
if (params?.positionId !== undefined) {
|
|
290
|
+
searchParams.append("positionId", params.positionId);
|
|
291
291
|
}
|
|
292
|
-
if (params?.
|
|
293
|
-
searchParams.append("
|
|
292
|
+
if (params?.marginAccountId !== undefined) {
|
|
293
|
+
searchParams.append("marginAccountId", params.marginAccountId);
|
|
294
294
|
}
|
|
295
295
|
const queryString = searchParams.toString();
|
|
296
296
|
const url = queryString ? `/api/v1/accounts/funding-payments?${queryString}` : "/api/v1/accounts/funding-payments";
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* const {
|
|
13
|
-
* await sdk.subAccounts.createLimit({
|
|
12
|
+
* const { subAccounts } = await sdk.subAccounts.list();
|
|
13
|
+
* await sdk.subAccounts.createLimit({ subAccountId, assetId, maxAmount: "1000.00" });
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
import type { CreateSubAccountLimitRequest, CreateSubAccountLimitResponse, GetSubAccountLimitsResponse, ListSubAccountsResponse, SubAccountsAPI, UpdateSubAccountLimitBody, UpdateSubAccountLimitResponse } from "@0xmonaco/types";
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* const {
|
|
13
|
-
* await sdk.subAccounts.createLimit({
|
|
12
|
+
* const { subAccounts } = await sdk.subAccounts.list();
|
|
13
|
+
* await sdk.subAccounts.createLimit({ subAccountId, assetId, maxAmount: "1000.00" });
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
import { BaseAPI } from "../base";
|
package/dist/api/trades/api.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import type { TradeEvent } from "@0xmonaco/types";
|
|
2
2
|
import { BaseAPI } from "../base";
|
|
3
3
|
/**
|
|
4
|
-
* Raw trade event from the API (
|
|
4
|
+
* Raw trade event from the API (camelCase wire shape).
|
|
5
5
|
*/
|
|
6
6
|
interface RawTradeEvent {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
eventType: string;
|
|
8
|
+
tradingPairId: string;
|
|
9
|
+
tradingMode: string;
|
|
10
10
|
data: {
|
|
11
|
-
|
|
11
|
+
tradeId: string;
|
|
12
12
|
price: string;
|
|
13
13
|
quantity: string;
|
|
14
14
|
/** Raw (integer) quantity; present on single-trade lookups, ignored when mapping */
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
quantityRaw?: string;
|
|
16
|
+
makerSide: string;
|
|
17
17
|
/** Absent when the trade has no recorded execution time */
|
|
18
|
-
|
|
18
|
+
executedAt?: string;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Convert a raw trade event
|
|
22
|
+
* Convert a raw wire trade event to an ergonomic TradeEvent.
|
|
23
23
|
*/
|
|
24
24
|
export declare function parseRawTradeEvent(raw: RawTradeEvent): TradeEvent;
|
|
25
25
|
/**
|
|
@@ -29,7 +29,7 @@ export interface GetTradesOptions {
|
|
|
29
29
|
/** Page number (starts from 1, default: 1) */
|
|
30
30
|
page?: number;
|
|
31
31
|
/** Maximum number of records to return (default: 25, max: 100) */
|
|
32
|
-
|
|
32
|
+
pageSize?: number;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Trades API for fetching historical trade data
|
|
@@ -40,7 +40,7 @@ export declare class TradesAPIImpl extends BaseAPI {
|
|
|
40
40
|
*
|
|
41
41
|
* @param tradingPairId - The trading pair UUID
|
|
42
42
|
* @param options - Pagination options
|
|
43
|
-
* @returns Array of TradeEvent records sorted by
|
|
43
|
+
* @returns Array of TradeEvent records sorted by executedAt descending (newest first)
|
|
44
44
|
*/
|
|
45
45
|
getTrades(tradingPairId: string, options?: GetTradesOptions): Promise<TradeEvent[]>;
|
|
46
46
|
/**
|
package/dist/api/trades/api.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BaseAPI } from "../base";
|
|
2
2
|
import { perpRoutes } from "../perp";
|
|
3
3
|
/**
|
|
4
|
-
* Convert a raw trade event
|
|
4
|
+
* Convert a raw wire trade event to an ergonomic TradeEvent.
|
|
5
5
|
*/
|
|
6
6
|
export function parseRawTradeEvent(raw) {
|
|
7
7
|
return {
|
|
8
8
|
eventType: "trade",
|
|
9
|
-
tradingPairId: raw.
|
|
10
|
-
tradingMode: raw.
|
|
9
|
+
tradingPairId: raw.tradingPairId,
|
|
10
|
+
tradingMode: raw.tradingMode.toUpperCase(),
|
|
11
11
|
data: {
|
|
12
|
-
tradeId: raw.data.
|
|
12
|
+
tradeId: raw.data.tradeId,
|
|
13
13
|
price: raw.data.price,
|
|
14
14
|
quantity: raw.data.quantity,
|
|
15
|
-
makerSide: raw.data.
|
|
16
|
-
executedAt: raw.data.
|
|
15
|
+
makerSide: raw.data.makerSide.toUpperCase(),
|
|
16
|
+
executedAt: raw.data.executedAt ?? "",
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -26,17 +26,17 @@ export class TradesAPIImpl extends BaseAPI {
|
|
|
26
26
|
*
|
|
27
27
|
* @param tradingPairId - The trading pair UUID
|
|
28
28
|
* @param options - Pagination options
|
|
29
|
-
* @returns Array of TradeEvent records sorted by
|
|
29
|
+
* @returns Array of TradeEvent records sorted by executedAt descending (newest first)
|
|
30
30
|
*/
|
|
31
31
|
async getTrades(tradingPairId, options = {}) {
|
|
32
32
|
const { page = 1 } = options;
|
|
33
|
-
// Ensure
|
|
34
|
-
const
|
|
33
|
+
// Ensure pageSize is a positive number between 1 and 100, defaulting to 25
|
|
34
|
+
const pageSize = options.pageSize != null && options.pageSize > 0 ? Math.min(options.pageSize, 100) : 25;
|
|
35
35
|
const params = new URLSearchParams();
|
|
36
36
|
if (page > 1) {
|
|
37
37
|
params.set("page", String(page));
|
|
38
38
|
}
|
|
39
|
-
params.set("
|
|
39
|
+
params.set("pageSize", String(pageSize));
|
|
40
40
|
const response = await this.makePublicRequest(`/api/v1/trades/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
|
|
41
41
|
return response.trades.map(parseRawTradeEvent);
|
|
42
42
|
}
|
|
@@ -80,8 +80,8 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
|
|
|
80
80
|
expirationDate?: string;
|
|
81
81
|
timeInForce?: TimeInForce;
|
|
82
82
|
marginAccountId?: string;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
riskBucketId?: string;
|
|
84
|
+
riskBucketCollateral?: string;
|
|
85
85
|
strategyKey?: string;
|
|
86
86
|
positionSide?: PositionSide;
|
|
87
87
|
leverage?: string;
|
|
@@ -134,8 +134,8 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
|
|
|
134
134
|
tradingMode?: TradingMode;
|
|
135
135
|
slippageTolerance?: number;
|
|
136
136
|
marginAccountId?: string;
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
riskBucketId?: string;
|
|
138
|
+
riskBucketCollateral?: string;
|
|
139
139
|
strategyKey?: string;
|
|
140
140
|
positionSide?: PositionSide;
|
|
141
141
|
leverage?: string;
|
|
@@ -262,9 +262,9 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
|
|
|
262
262
|
*
|
|
263
263
|
* @param params - Query parameters for filtering orders
|
|
264
264
|
* @param params.status - Filter by order status (e.g., "SUBMITTED", "FILLED") (optional)
|
|
265
|
-
* @param params.
|
|
265
|
+
* @param params.tradingPairId - Filter by trading pair UUID (optional)
|
|
266
266
|
* @param params.page - Page number for pagination (defaults to 1, must be > 0)
|
|
267
|
-
* @param params.
|
|
267
|
+
* @param params.pageSize - Number of orders per page (defaults to 10, max 100, must be > 0)
|
|
268
268
|
* @returns Promise resolving to GetPaginatedOrdersResponse with orders and pagination info
|
|
269
269
|
* @throws {APIError} When API communication fails
|
|
270
270
|
*
|
|
@@ -273,13 +273,13 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
|
|
|
273
273
|
* // Get submitted orders for a specific trading pair with custom pagination
|
|
274
274
|
* const orders = await tradingAPI.getPaginatedOrders({
|
|
275
275
|
* status: "SUBMITTED",
|
|
276
|
-
*
|
|
276
|
+
* tradingPairId: "456e7890-e12b-12d3-a456-426614174000",
|
|
277
277
|
* page: 1,
|
|
278
|
-
*
|
|
278
|
+
* pageSize: 20
|
|
279
279
|
* });
|
|
280
280
|
* console.log(`Found ${orders.total} orders, showing page ${orders.page}`);
|
|
281
281
|
*
|
|
282
|
-
* // Get all orders with default pagination (page=1,
|
|
282
|
+
* // Get all orders with default pagination (page=1, pageSize=10)
|
|
283
283
|
* const allOrders = await tradingAPI.getPaginatedOrders();
|
|
284
284
|
* ```
|
|
285
285
|
*/
|
|
@@ -299,7 +299,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
|
|
|
299
299
|
* // Get order details by ID
|
|
300
300
|
* const orderDetails = await tradingAPI.getOrder("order_123");
|
|
301
301
|
* console.log(`Order status: ${orderDetails.order.status}`);
|
|
302
|
-
* console.log(`Remaining quantity: ${orderDetails.order.
|
|
302
|
+
* console.log(`Remaining quantity: ${orderDetails.order.remainingQuantity}`);
|
|
303
303
|
* ```
|
|
304
304
|
*/
|
|
305
305
|
getOrder(orderId: string): Promise<GetOrderResponse>;
|