@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
|
@@ -3,11 +3,11 @@ export declare const perpRoutes: {
|
|
|
3
3
|
readonly create: () => string;
|
|
4
4
|
readonly list: (params?: {
|
|
5
5
|
page?: number;
|
|
6
|
-
|
|
6
|
+
pageSize?: number;
|
|
7
7
|
status?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
tradingPair?: string;
|
|
9
|
+
tradingMode?: string;
|
|
10
|
+
marginAccountId?: string;
|
|
11
11
|
}) => string;
|
|
12
12
|
readonly get: (orderId: string) => string;
|
|
13
13
|
readonly replace: (orderId: string) => string;
|
|
@@ -18,11 +18,11 @@ export declare const perpRoutes: {
|
|
|
18
18
|
readonly batchCreate: () => string;
|
|
19
19
|
readonly batchReplace: () => string;
|
|
20
20
|
readonly listConditional: (params?: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
marginAccountId?: string;
|
|
22
|
+
tradingPairId?: string;
|
|
23
23
|
state?: string;
|
|
24
24
|
page?: number;
|
|
25
|
-
|
|
25
|
+
pageSize?: number;
|
|
26
26
|
}) => string;
|
|
27
27
|
readonly cancelConditional: (conditionalOrderId: string) => string;
|
|
28
28
|
};
|
|
@@ -35,20 +35,24 @@ export declare const perpRoutes: {
|
|
|
35
35
|
readonly withdrawals: {
|
|
36
36
|
readonly initiate: () => string;
|
|
37
37
|
readonly byIndex: (withdrawalIndex: number) => string;
|
|
38
|
+
readonly list: (params?: {
|
|
39
|
+
page?: number;
|
|
40
|
+
pageSize?: number;
|
|
41
|
+
}) => string;
|
|
38
42
|
};
|
|
39
43
|
readonly market: {
|
|
40
44
|
readonly listTradingPairs: (params?: {
|
|
41
45
|
page?: number;
|
|
42
46
|
limit?: number;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
marketType?: string;
|
|
48
|
+
baseToken?: string;
|
|
49
|
+
quoteToken?: string;
|
|
50
|
+
isActive?: boolean;
|
|
47
51
|
}) => string;
|
|
48
52
|
readonly getTradingPair: (tradingPairId: string) => string;
|
|
49
53
|
readonly getCandles: (tradingPairId: string, interval: string, params?: {
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
startTime?: number;
|
|
55
|
+
endTime?: number;
|
|
52
56
|
limit?: number;
|
|
53
57
|
}) => string;
|
|
54
58
|
readonly getMarketMetadata: (tradingPairId: string) => string;
|
|
@@ -58,17 +62,17 @@ export declare const perpRoutes: {
|
|
|
58
62
|
readonly getIndexPrice: (tradingPairId: string) => string;
|
|
59
63
|
readonly getFundingState: (tradingPairId: string) => string;
|
|
60
64
|
readonly listFundingHistory: (tradingPairId: string, params?: {
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
startTime?: string;
|
|
66
|
+
endTime?: string;
|
|
63
67
|
page?: number;
|
|
64
|
-
|
|
68
|
+
pageSize?: number;
|
|
65
69
|
}) => string;
|
|
66
70
|
readonly getOpenInterest: (tradingPairId: string) => string;
|
|
67
71
|
readonly getScreener: (params?: {
|
|
68
72
|
page?: number;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
marketType?: string;
|
|
75
|
+
isActive?: boolean;
|
|
72
76
|
category?: string;
|
|
73
77
|
}) => string;
|
|
74
78
|
readonly getMarketStats: () => string;
|
|
@@ -76,7 +80,7 @@ export declare const perpRoutes: {
|
|
|
76
80
|
readonly orderbook: {
|
|
77
81
|
readonly get: (tradingPairId: string, params?: {
|
|
78
82
|
levels?: number;
|
|
79
|
-
|
|
83
|
+
tradingMode?: string;
|
|
80
84
|
magnitude?: string | number;
|
|
81
85
|
denomination?: string;
|
|
82
86
|
}) => string;
|
|
@@ -88,42 +92,42 @@ export declare const perpRoutes: {
|
|
|
88
92
|
}) => string;
|
|
89
93
|
readonly byId: (tradeId: string) => string;
|
|
90
94
|
readonly user: (params?: {
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
marginAccountId?: string;
|
|
96
|
+
tradingPairId?: string;
|
|
93
97
|
page?: number;
|
|
94
|
-
|
|
98
|
+
pageSize?: number;
|
|
95
99
|
}) => string;
|
|
96
100
|
};
|
|
97
101
|
readonly applications: {
|
|
98
102
|
readonly orders: (params?: {
|
|
99
103
|
page?: number;
|
|
100
|
-
|
|
104
|
+
pageSize?: number;
|
|
101
105
|
status?: string;
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
userId?: string;
|
|
107
|
+
tradingPairId?: string;
|
|
104
108
|
side?: string;
|
|
105
|
-
|
|
109
|
+
orderType?: string;
|
|
106
110
|
}) => string;
|
|
107
111
|
readonly users: (params?: {
|
|
108
112
|
page?: number;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
pageSize?: number;
|
|
114
|
+
isActive?: boolean;
|
|
115
|
+
accountType?: string;
|
|
112
116
|
address?: string;
|
|
113
117
|
}) => string;
|
|
114
118
|
readonly movements: (params?: {
|
|
115
119
|
page?: number;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
pageSize?: number;
|
|
121
|
+
userId?: string;
|
|
122
|
+
transactionType?: string;
|
|
123
|
+
entryType?: string;
|
|
124
|
+
assetId?: string;
|
|
121
125
|
}) => string;
|
|
122
126
|
readonly balances: (params?: {
|
|
123
127
|
page?: number;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
pageSize?: number;
|
|
129
|
+
userId?: string;
|
|
130
|
+
assetId?: string;
|
|
127
131
|
}) => string;
|
|
128
132
|
readonly stats: (params?: {
|
|
129
133
|
since?: string;
|
|
@@ -143,49 +147,61 @@ export declare const perpRoutes: {
|
|
|
143
147
|
};
|
|
144
148
|
readonly positions: {
|
|
145
149
|
readonly list: (params?: {
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
marginAccountId?: string;
|
|
151
|
+
tradingPairId?: string;
|
|
148
152
|
status?: string;
|
|
149
153
|
page?: number;
|
|
150
|
-
|
|
154
|
+
pageSize?: number;
|
|
151
155
|
}) => string;
|
|
152
156
|
readonly get: (positionId: string) => string;
|
|
153
157
|
readonly close: (positionId: string) => string;
|
|
158
|
+
readonly batchCloseAll: () => string;
|
|
154
159
|
readonly risk: (positionId: string) => string;
|
|
155
160
|
readonly addMargin: (positionId: string) => string;
|
|
156
161
|
readonly reduceMargin: (positionId: string) => string;
|
|
157
162
|
readonly attachTpSl: (positionId: string) => string;
|
|
158
163
|
readonly history: (params?: {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
positionId?: string;
|
|
165
|
+
marginAccountId?: string;
|
|
166
|
+
tradingPairId?: string;
|
|
162
167
|
page?: number;
|
|
163
|
-
|
|
168
|
+
pageSize?: number;
|
|
164
169
|
}) => string;
|
|
165
170
|
};
|
|
166
171
|
readonly marginAccounts: {
|
|
167
172
|
readonly list: (params?: {
|
|
168
173
|
page?: number;
|
|
169
|
-
|
|
174
|
+
pageSize?: number;
|
|
170
175
|
state?: string;
|
|
171
|
-
|
|
176
|
+
tradingPairId?: string;
|
|
177
|
+
}) => string;
|
|
178
|
+
readonly parentSummary: (params?: {
|
|
179
|
+
tradingPairId?: string;
|
|
172
180
|
}) => string;
|
|
173
181
|
readonly summary: (marginAccountId: string, params?: {
|
|
174
|
-
|
|
182
|
+
tradingPairId?: string;
|
|
175
183
|
}) => string;
|
|
176
184
|
readonly availableCollateral: (params?: {
|
|
177
185
|
asset?: string;
|
|
178
186
|
}) => string;
|
|
179
187
|
readonly transferIn: (marginAccountId: string) => string;
|
|
180
|
-
readonly
|
|
188
|
+
readonly transferInParent: () => string;
|
|
189
|
+
readonly transferInRiskBucket: () => string;
|
|
181
190
|
readonly transferOut: (marginAccountId: string) => string;
|
|
191
|
+
readonly transferOutParent: () => string;
|
|
182
192
|
readonly movements: (marginAccountId: string, params?: {
|
|
183
|
-
|
|
193
|
+
movementType?: string;
|
|
194
|
+
page?: number;
|
|
195
|
+
pageSize?: number;
|
|
196
|
+
}) => string;
|
|
197
|
+
readonly parentMovements: (params?: {
|
|
198
|
+
movementType?: string;
|
|
184
199
|
page?: number;
|
|
185
|
-
|
|
200
|
+
pageSize?: number;
|
|
186
201
|
}) => string;
|
|
202
|
+
readonly simulateParentMarginOrderRisk: () => string;
|
|
187
203
|
readonly simulateOrderRisk: (marginAccountId: string) => string;
|
|
188
|
-
readonly
|
|
204
|
+
readonly simulateRiskBucketOrderRisk: () => string;
|
|
189
205
|
};
|
|
190
206
|
readonly streams: {
|
|
191
207
|
readonly orderbook: () => string;
|
package/dist/api/perp/routes.js
CHANGED
|
@@ -38,6 +38,7 @@ export const perpRoutes = {
|
|
|
38
38
|
withdrawals: {
|
|
39
39
|
initiate: () => `${API_V1}/withdrawals`,
|
|
40
40
|
byIndex: (withdrawalIndex) => `${API_V1}/withdrawals/${encodeSegment(String(withdrawalIndex))}`,
|
|
41
|
+
list: (params) => withQuery(`${API_V1}/withdrawals`, params),
|
|
41
42
|
},
|
|
42
43
|
market: {
|
|
43
44
|
listTradingPairs: (params) => withQuery(`${API_V1}/market/pairs`, params),
|
|
@@ -85,6 +86,7 @@ export const perpRoutes = {
|
|
|
85
86
|
list: (params) => withQuery(`${API_V1}/positions`, params),
|
|
86
87
|
get: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}`,
|
|
87
88
|
close: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/close`,
|
|
89
|
+
batchCloseAll: () => `${API_V1}/positions/batch-close-all`,
|
|
88
90
|
risk: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/risk`,
|
|
89
91
|
addMargin: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/margin/add`,
|
|
90
92
|
reduceMargin: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/margin/reduce`,
|
|
@@ -93,14 +95,19 @@ export const perpRoutes = {
|
|
|
93
95
|
},
|
|
94
96
|
marginAccounts: {
|
|
95
97
|
list: (params) => withQuery(`${API_V1}/margin/accounts`, params),
|
|
98
|
+
parentSummary: (params) => withQuery(`${API_V1}/margin/parent-margin-account`, params),
|
|
96
99
|
summary: (marginAccountId, params) => withQuery(`${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}`, params),
|
|
97
100
|
availableCollateral: (params) => withQuery(`${API_V1}/margin/collateral/available`, params),
|
|
98
101
|
transferIn: (marginAccountId) => `${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}/collateral/transfer-in`,
|
|
99
|
-
|
|
102
|
+
transferInParent: () => `${API_V1}/margin/parent-margin-account/collateral/transfer-in`,
|
|
103
|
+
transferInRiskBucket: () => `${API_V1}/margin/risk-buckets/collateral/transfer-in`,
|
|
100
104
|
transferOut: (marginAccountId) => `${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}/collateral/transfer-out`,
|
|
105
|
+
transferOutParent: () => `${API_V1}/margin/parent-margin-account/collateral/transfer-out`,
|
|
101
106
|
movements: (marginAccountId, params) => withQuery(`${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}/movements`, params),
|
|
107
|
+
parentMovements: (params) => withQuery(`${API_V1}/margin/parent-margin-account/movements`, params),
|
|
108
|
+
simulateParentMarginOrderRisk: () => `${API_V1}/margin/parent-margin-account/simulate-order-risk`,
|
|
102
109
|
simulateOrderRisk: (marginAccountId) => `${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}/simulate-order-risk`,
|
|
103
|
-
|
|
110
|
+
simulateRiskBucketOrderRisk: () => `${API_V1}/margin/risk-buckets/simulate-order-risk`,
|
|
104
111
|
},
|
|
105
112
|
streams: {
|
|
106
113
|
orderbook: () => `${API_V1}/streaming/orderbook`,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { AddPositionMarginRequest, AttachPositionTpSlRequest, AttachPositionTpSlResponse, ClosePositionRequest, ClosePositionResponse, GetPositionResponse, ListPositionHistoryParams, ListPositionHistoryResponse, ListPositionsParams, ListPositionsResponse, PositionMarginResponse, PositionRisk, PositionsAPI, ReducePositionMarginRequest } from "@0xmonaco/types";
|
|
1
|
+
import type { AddPositionMarginRequest, AttachPositionTpSlRequest, AttachPositionTpSlResponse, BatchCloseAllRequest, BatchCloseAllResponse, ClosePositionRequest, ClosePositionResponse, GetPositionResponse, ListPositionHistoryParams, ListPositionHistoryResponse, ListPositionsParams, ListPositionsResponse, PositionMarginResponse, PositionRisk, PositionsAPI, ReducePositionMarginRequest } from "@0xmonaco/types";
|
|
2
2
|
import { BaseAPI } from "../base";
|
|
3
3
|
export declare class PositionsAPIImpl extends BaseAPI implements PositionsAPI {
|
|
4
4
|
listPositions(params?: ListPositionsParams): Promise<ListPositionsResponse>;
|
|
5
5
|
getPosition(positionId: string): Promise<GetPositionResponse>;
|
|
6
6
|
closePosition(positionId: string, request: ClosePositionRequest): Promise<ClosePositionResponse>;
|
|
7
|
+
batchCloseAllPositions(request?: BatchCloseAllRequest): Promise<BatchCloseAllResponse>;
|
|
7
8
|
getPositionRisk(positionId: string): Promise<PositionRisk>;
|
|
8
9
|
addPositionMargin(positionId: string, request: AddPositionMarginRequest): Promise<PositionMarginResponse>;
|
|
9
10
|
reducePositionMargin(positionId: string, request: ReducePositionMarginRequest): Promise<PositionMarginResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddPositionMarginSchema, AttachPositionTpSlSchema, ClosePositionSchema, GetPositionRiskSchema, GetPositionSchema, ListPositionHistorySchema, ListPositionsSchema, ReducePositionMarginSchema, validate, } from "@0xmonaco/types";
|
|
1
|
+
import { AddPositionMarginSchema, AttachPositionTpSlSchema, BatchCloseAllSchema, ClosePositionSchema, GetPositionRiskSchema, GetPositionSchema, ListPositionHistorySchema, ListPositionsSchema, ReducePositionMarginSchema, validate, } from "@0xmonaco/types";
|
|
2
2
|
import { BaseAPI } from "../base";
|
|
3
3
|
import { perpRoutes } from "../perp";
|
|
4
4
|
export class PositionsAPIImpl extends BaseAPI {
|
|
@@ -17,13 +17,25 @@ export class PositionsAPIImpl extends BaseAPI {
|
|
|
17
17
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.close(positionId), {
|
|
18
18
|
method: "POST",
|
|
19
19
|
body: JSON.stringify({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
closeType: request.closeType,
|
|
21
|
+
limitPrice: request.limitPrice,
|
|
22
|
+
slippageToleranceBps: request.slippageToleranceBps,
|
|
23
23
|
quantity: request.quantity,
|
|
24
24
|
}),
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
+
async batchCloseAllPositions(request) {
|
|
28
|
+
if (request) {
|
|
29
|
+
validate(BatchCloseAllSchema, request);
|
|
30
|
+
}
|
|
31
|
+
return await this.makeAuthenticatedRequest(perpRoutes.positions.batchCloseAll(), {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
tradingPairId: request?.tradingPairId,
|
|
35
|
+
slippageToleranceBps: request?.slippageToleranceBps,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
27
39
|
async getPositionRisk(positionId) {
|
|
28
40
|
validate(GetPositionRiskSchema, { positionId });
|
|
29
41
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.risk(positionId));
|
|
@@ -52,26 +64,26 @@ export class PositionsAPIImpl extends BaseAPI {
|
|
|
52
64
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.attachTpSl(positionId), {
|
|
53
65
|
method: "POST",
|
|
54
66
|
body: JSON.stringify({
|
|
55
|
-
|
|
67
|
+
takeProfit: request.takeProfit
|
|
56
68
|
? {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
triggerPrice: request.takeProfit.triggerPrice,
|
|
70
|
+
orderType: request.takeProfit.orderType,
|
|
71
|
+
limitPrice: request.takeProfit.limitPrice,
|
|
60
72
|
quantity: request.takeProfit.quantity,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
73
|
+
timeInForce: request.takeProfit.timeInForce,
|
|
74
|
+
slippageToleranceBps: request.takeProfit.slippageToleranceBps,
|
|
75
|
+
expiresAt: request.takeProfit.expiresAt,
|
|
64
76
|
}
|
|
65
77
|
: undefined,
|
|
66
|
-
|
|
78
|
+
stopLoss: request.stopLoss
|
|
67
79
|
? {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
triggerPrice: request.stopLoss.triggerPrice,
|
|
81
|
+
orderType: request.stopLoss.orderType,
|
|
82
|
+
limitPrice: request.stopLoss.limitPrice,
|
|
71
83
|
quantity: request.stopLoss.quantity,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
timeInForce: request.stopLoss.timeInForce,
|
|
85
|
+
slippageToleranceBps: request.stopLoss.slippageToleranceBps,
|
|
86
|
+
expiresAt: request.stopLoss.expiresAt,
|
|
75
87
|
}
|
|
76
88
|
: undefined,
|
|
77
89
|
}),
|
|
@@ -39,8 +39,8 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
39
39
|
* console.log(`User ID: ${profile.id}`);
|
|
40
40
|
* console.log(`Address: ${profile.address}`);
|
|
41
41
|
* console.log(`Username: ${profile.username}`);
|
|
42
|
-
* console.log(`Account type: ${profile.
|
|
43
|
-
* console.log(`Can withdraw: ${profile.
|
|
42
|
+
* console.log(`Account type: ${profile.accountType}`);
|
|
43
|
+
* console.log(`Can withdraw: ${profile.canWithdraw}`);
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
getProfile(): Promise<UserProfile>;
|
|
@@ -53,27 +53,27 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
53
53
|
* @param params - Optional query parameters for pagination and filtering
|
|
54
54
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
55
55
|
* @param params.limit - Number of items per page (default: 20, max: 100)
|
|
56
|
-
* @param params.
|
|
57
|
-
* @param params.
|
|
58
|
-
* @param params.
|
|
56
|
+
* @param params.entryType - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
57
|
+
* @param params.transactionType - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
58
|
+
* @param params.assetId - Filter by asset ID (UUID)
|
|
59
59
|
* @returns Promise resolving to paginated movements response
|
|
60
60
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```typescript
|
|
64
|
-
* // Get first page with default
|
|
64
|
+
* // Get first page with default pageSize (20)
|
|
65
65
|
* const movements = await profileAPI.getPaginatedUserMovements();
|
|
66
66
|
* console.log(`Total movements: ${movements.total}`);
|
|
67
67
|
*
|
|
68
|
-
* // Get second page with custom
|
|
69
|
-
* const page2 = await profileAPI.getPaginatedUserMovements({ page: 2,
|
|
70
|
-
* console.log(`Page ${page2.page} of ${page2.
|
|
68
|
+
* // Get second page with custom pageSize
|
|
69
|
+
* const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, pageSize: 50 });
|
|
70
|
+
* console.log(`Page ${page2.page} of ${page2.totalPages}`);
|
|
71
71
|
*
|
|
72
72
|
* // Filter by entry type and transaction type
|
|
73
|
-
* const deposits = await profileAPI.getPaginatedUserMovements({
|
|
73
|
+
* const deposits = await profileAPI.getPaginatedUserMovements({ entryType: "CREDIT", transactionType: "DEPOSIT" });
|
|
74
74
|
*
|
|
75
75
|
* // Filter by asset
|
|
76
|
-
* const usdcMovements = await profileAPI.getPaginatedUserMovements({
|
|
76
|
+
* const usdcMovements = await profileAPI.getPaginatedUserMovements({ assetId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
|
|
@@ -85,7 +85,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
85
85
|
*
|
|
86
86
|
* @param params - Optional query parameters for pagination
|
|
87
87
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
88
|
-
* @param params.
|
|
88
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 100)
|
|
89
89
|
* @returns Promise resolving to paginated balances response
|
|
90
90
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
91
91
|
*
|
|
@@ -95,11 +95,11 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
95
95
|
* const balances = await profileAPI.getUserBalances();
|
|
96
96
|
* console.log(`Total balances: ${balances.total}`);
|
|
97
97
|
* balances.balances.forEach(balance => {
|
|
98
|
-
* console.log(`${balance.symbol}: ${balance.
|
|
98
|
+
* console.log(`${balance.symbol}: ${balance.availableBalance}`);
|
|
99
99
|
* });
|
|
100
100
|
*
|
|
101
101
|
* // Get page 2 with 50 items per page
|
|
102
|
-
* const nextBalances = await profileAPI.getUserBalances({ page: 2,
|
|
102
|
+
* const nextBalances = await profileAPI.getUserBalances({ page: 2, pageSize: 50 });
|
|
103
103
|
* console.log(`Returned ${nextBalances.balances.length} balances`);
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
@@ -107,7 +107,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
107
107
|
/**
|
|
108
108
|
* Get the current user's balance for a specific asset.
|
|
109
109
|
*
|
|
110
|
-
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{
|
|
110
|
+
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{assetId} endpoint.
|
|
111
111
|
* Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
|
|
112
112
|
*
|
|
113
113
|
* @param assetId - The asset identifier (UUID)
|
|
@@ -118,9 +118,9 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
118
118
|
* ```typescript
|
|
119
119
|
* // Get balance for a specific asset
|
|
120
120
|
* const balance = await profileAPI.getUserBalanceByAssetId('123e4567-e89b-12d3-a456-426614174000');
|
|
121
|
-
* console.log(`${balance.symbol}: ${balance.
|
|
122
|
-
* console.log(`Locked: ${balance.
|
|
123
|
-
* console.log(`Total: ${balance.
|
|
121
|
+
* console.log(`${balance.symbol}: ${balance.availableBalance}`);
|
|
122
|
+
* console.log(`Locked: ${balance.lockedBalance}`);
|
|
123
|
+
* console.log(`Total: ${balance.totalBalance}`);
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
|
126
126
|
getUserBalanceByAssetId(assetId: string): Promise<AccountBalance>;
|
|
@@ -139,7 +139,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
139
139
|
* const stats = await profileAPI.getPortfolioStats("30d");
|
|
140
140
|
* console.log(`PnL: ${stats.pnl}`);
|
|
141
141
|
* console.log(`Volume: ${stats.volume}`);
|
|
142
|
-
* console.log(`Total equity: ${stats.
|
|
142
|
+
* console.log(`Total equity: ${stats.totalEquity}`);
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
145
|
getPortfolioStats(period: PortfolioPeriod): Promise<PortfolioStats>;
|
|
@@ -171,8 +171,8 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
171
171
|
*
|
|
172
172
|
* @param params - Optional query parameters for pagination and filtering
|
|
173
173
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
174
|
-
* @param params.
|
|
175
|
-
* @param params.
|
|
174
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 100)
|
|
175
|
+
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
176
176
|
* @returns Promise resolving to paginated trades response
|
|
177
177
|
* @throws {ValidationError} When the provided params fail client-side validation
|
|
178
178
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
@@ -184,7 +184,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
184
184
|
* console.log(`Total trades: ${trades.total}`);
|
|
185
185
|
*
|
|
186
186
|
* // Filter by trading pair
|
|
187
|
-
* const pairTrades = await profileAPI.getUserTrades({
|
|
187
|
+
* const pairTrades = await profileAPI.getUserTrades({ tradingPairId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
190
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
@@ -200,7 +200,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
200
200
|
*
|
|
201
201
|
* @example
|
|
202
202
|
* ```typescript
|
|
203
|
-
* const funding = await profileAPI.listFundingPayments({
|
|
203
|
+
* const funding = await profileAPI.listFundingPayments({ tradingPairId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
204
204
|
* console.log(`Total funding payments: ${funding.total}`);
|
|
205
205
|
* ```
|
|
206
206
|
*/
|