zklighter-perps 1.0.29 → 1.0.31
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/apis/AccountApi.ts +157 -235
- package/apis/BlockApi.ts +28 -26
- package/apis/CandlestickApi.ts +28 -28
- package/apis/InfoApi.ts +21 -21
- package/apis/LiquidationApi.ts +4 -4
- package/apis/OrderApi.ts +85 -85
- package/apis/RootApi.ts +5 -5
- package/apis/TransactionApi.ts +208 -208
- package/models/PublicPoolShare.ts +4 -4
- package/openapi.json +83 -134
- package/package.json +1 -1
package/apis/AccountApi.ts
CHANGED
|
@@ -19,7 +19,6 @@ import type {
|
|
|
19
19
|
AccountPnL,
|
|
20
20
|
Accounts,
|
|
21
21
|
DetailedAccounts,
|
|
22
|
-
Permission,
|
|
23
22
|
ResultCode,
|
|
24
23
|
SubAccounts,
|
|
25
24
|
} from '../models/index';
|
|
@@ -32,51 +31,43 @@ import {
|
|
|
32
31
|
AccountsToJSON,
|
|
33
32
|
DetailedAccountsFromJSON,
|
|
34
33
|
DetailedAccountsToJSON,
|
|
35
|
-
PermissionFromJSON,
|
|
36
|
-
PermissionToJSON,
|
|
37
34
|
ResultCodeFromJSON,
|
|
38
35
|
ResultCodeToJSON,
|
|
39
36
|
SubAccountsFromJSON,
|
|
40
37
|
SubAccountsToJSON,
|
|
41
38
|
} from '../models/index';
|
|
42
39
|
|
|
43
|
-
export interface
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface GetAccountRequest {
|
|
48
|
-
by: GetAccountByEnum;
|
|
40
|
+
export interface AccountRequest {
|
|
41
|
+
by: AccountByEnum;
|
|
49
42
|
value: string;
|
|
50
43
|
}
|
|
51
44
|
|
|
52
|
-
export interface
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
export interface AccountsRequest {
|
|
46
|
+
limit: number;
|
|
47
|
+
index?: number;
|
|
48
|
+
sort?: AccountsSortEnum;
|
|
55
49
|
}
|
|
56
50
|
|
|
57
|
-
export interface
|
|
58
|
-
|
|
59
|
-
value: string;
|
|
60
|
-
resolution: GetAccountPnlResolutionEnum;
|
|
61
|
-
start_timestamp: number;
|
|
62
|
-
end_timestamp: number;
|
|
63
|
-
count_back: number;
|
|
51
|
+
export interface AccountsByL1AddressRequest {
|
|
52
|
+
l1_address: string;
|
|
64
53
|
}
|
|
65
54
|
|
|
66
|
-
export interface
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
sort?: GetAccountsSortEnum;
|
|
55
|
+
export interface ApikeysRequest {
|
|
56
|
+
account_index: number;
|
|
57
|
+
api_key_index: number;
|
|
70
58
|
}
|
|
71
59
|
|
|
72
|
-
export interface
|
|
60
|
+
export interface FaucetRequest {
|
|
73
61
|
l1_address: string;
|
|
74
62
|
}
|
|
75
63
|
|
|
76
|
-
export interface
|
|
77
|
-
by:
|
|
64
|
+
export interface PnlRequest {
|
|
65
|
+
by: PnlByEnum;
|
|
78
66
|
value: string;
|
|
79
|
-
|
|
67
|
+
resolution: PnlResolutionEnum;
|
|
68
|
+
start_timestamp: number;
|
|
69
|
+
end_timestamp: number;
|
|
70
|
+
count_back: number;
|
|
80
71
|
}
|
|
81
72
|
|
|
82
73
|
/**
|
|
@@ -85,60 +76,21 @@ export interface GetPermissionRequest {
|
|
|
85
76
|
export class AccountApi extends runtime.BaseAPI {
|
|
86
77
|
|
|
87
78
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
79
|
+
* Get account by account\'s index. <br>More details about account index: [Account Index](https://apidocs.lighter.xyz/docs/account-index)<hr>**Response Description:**<br><br>1) **Status:** 1 is active 0 is inactive.<br>2) **Collateral:** The amount of collateral in the account.<hr>**Position Details Description:**<br>1) **OOC:** Open order count in that market.<br>2) **Sign:** 1 for Long, -1 for Short.<br>3) **Position:** The amount of position in that market.<br>4) **Avg Entry Price:** The average entry price of the position.<br>5) **Position Value:** The value of the position.<br>6) **Unrealized PnL:** The unrealized profit and loss of the position.<br>7) **Realized PnL:** The realized profit and loss of the position.
|
|
80
|
+
* account
|
|
90
81
|
*/
|
|
91
|
-
async
|
|
92
|
-
if (requestParameters['l1_address'] == null) {
|
|
93
|
-
throw new runtime.RequiredError(
|
|
94
|
-
'l1_address',
|
|
95
|
-
'Required parameter "l1_address" was null or undefined when calling doFaucet().'
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const queryParameters: any = {};
|
|
100
|
-
|
|
101
|
-
if (requestParameters['l1_address'] != null) {
|
|
102
|
-
queryParameters['l1_address'] = requestParameters['l1_address'];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
106
|
-
|
|
107
|
-
const response = await this.request({
|
|
108
|
-
path: `/api/v1/faucet`,
|
|
109
|
-
method: 'GET',
|
|
110
|
-
headers: headerParameters,
|
|
111
|
-
query: queryParameters,
|
|
112
|
-
}, initOverrides);
|
|
113
|
-
|
|
114
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Request funds from faucet
|
|
119
|
-
* DoFaucet
|
|
120
|
-
*/
|
|
121
|
-
async doFaucet(requestParameters: DoFaucetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResultCode> {
|
|
122
|
-
const response = await this.doFaucetRaw(requestParameters, initOverrides);
|
|
123
|
-
return await response.value();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Get account by account\'s l1_address or index. Returns detailed account info
|
|
128
|
-
* GetAccount
|
|
129
|
-
*/
|
|
130
|
-
async getAccountRaw(requestParameters: GetAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DetailedAccounts>> {
|
|
82
|
+
async accountRaw(requestParameters: AccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DetailedAccounts>> {
|
|
131
83
|
if (requestParameters['by'] == null) {
|
|
132
84
|
throw new runtime.RequiredError(
|
|
133
85
|
'by',
|
|
134
|
-
'Required parameter "by" was null or undefined when calling
|
|
86
|
+
'Required parameter "by" was null or undefined when calling account().'
|
|
135
87
|
);
|
|
136
88
|
}
|
|
137
89
|
|
|
138
90
|
if (requestParameters['value'] == null) {
|
|
139
91
|
throw new runtime.RequiredError(
|
|
140
92
|
'value',
|
|
141
|
-
'Required parameter "value" was null or undefined when calling
|
|
93
|
+
'Required parameter "value" was null or undefined when calling account().'
|
|
142
94
|
);
|
|
143
95
|
}
|
|
144
96
|
|
|
@@ -165,214 +117,159 @@ export class AccountApi extends runtime.BaseAPI {
|
|
|
165
117
|
}
|
|
166
118
|
|
|
167
119
|
/**
|
|
168
|
-
* Get account by account\'s
|
|
169
|
-
*
|
|
120
|
+
* Get account by account\'s index. <br>More details about account index: [Account Index](https://apidocs.lighter.xyz/docs/account-index)<hr>**Response Description:**<br><br>1) **Status:** 1 is active 0 is inactive.<br>2) **Collateral:** The amount of collateral in the account.<hr>**Position Details Description:**<br>1) **OOC:** Open order count in that market.<br>2) **Sign:** 1 for Long, -1 for Short.<br>3) **Position:** The amount of position in that market.<br>4) **Avg Entry Price:** The average entry price of the position.<br>5) **Position Value:** The value of the position.<br>6) **Unrealized PnL:** The unrealized profit and loss of the position.<br>7) **Realized PnL:** The realized profit and loss of the position.
|
|
121
|
+
* account
|
|
170
122
|
*/
|
|
171
|
-
async
|
|
172
|
-
const response = await this.
|
|
123
|
+
async account(requestParameters: AccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DetailedAccounts> {
|
|
124
|
+
const response = await this.accountRaw(requestParameters, initOverrides);
|
|
173
125
|
return await response.value();
|
|
174
126
|
}
|
|
175
127
|
|
|
176
128
|
/**
|
|
177
|
-
* Get account
|
|
178
|
-
*
|
|
129
|
+
* Get accounts returns accounts by account index
|
|
130
|
+
* accounts
|
|
179
131
|
*/
|
|
180
|
-
async
|
|
181
|
-
if (requestParameters['
|
|
182
|
-
throw new runtime.RequiredError(
|
|
183
|
-
'account_index',
|
|
184
|
-
'Required parameter "account_index" was null or undefined when calling getAccountApiKeys().'
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (requestParameters['api_key_index'] == null) {
|
|
132
|
+
async accountsRaw(requestParameters: AccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Accounts>> {
|
|
133
|
+
if (requestParameters['limit'] == null) {
|
|
189
134
|
throw new runtime.RequiredError(
|
|
190
|
-
'
|
|
191
|
-
'Required parameter "
|
|
135
|
+
'limit',
|
|
136
|
+
'Required parameter "limit" was null or undefined when calling accounts().'
|
|
192
137
|
);
|
|
193
138
|
}
|
|
194
139
|
|
|
195
140
|
const queryParameters: any = {};
|
|
196
141
|
|
|
197
|
-
if (requestParameters['
|
|
198
|
-
queryParameters['
|
|
142
|
+
if (requestParameters['index'] != null) {
|
|
143
|
+
queryParameters['index'] = requestParameters['index'];
|
|
199
144
|
}
|
|
200
145
|
|
|
201
|
-
if (requestParameters['
|
|
202
|
-
queryParameters['
|
|
146
|
+
if (requestParameters['limit'] != null) {
|
|
147
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (requestParameters['sort'] != null) {
|
|
151
|
+
queryParameters['sort'] = requestParameters['sort'];
|
|
203
152
|
}
|
|
204
153
|
|
|
205
154
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
206
155
|
|
|
207
156
|
const response = await this.request({
|
|
208
|
-
path: `/api/v1/
|
|
157
|
+
path: `/api/v1/accounts`,
|
|
209
158
|
method: 'GET',
|
|
210
159
|
headers: headerParameters,
|
|
211
160
|
query: queryParameters,
|
|
212
161
|
}, initOverrides);
|
|
213
162
|
|
|
214
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
163
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AccountsFromJSON(jsonValue));
|
|
215
164
|
}
|
|
216
165
|
|
|
217
166
|
/**
|
|
218
|
-
* Get account
|
|
219
|
-
*
|
|
167
|
+
* Get accounts returns accounts by account index
|
|
168
|
+
* accounts
|
|
220
169
|
*/
|
|
221
|
-
async
|
|
222
|
-
const response = await this.
|
|
170
|
+
async accounts(requestParameters: AccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Accounts> {
|
|
171
|
+
const response = await this.accountsRaw(requestParameters, initOverrides);
|
|
223
172
|
return await response.value();
|
|
224
173
|
}
|
|
225
174
|
|
|
226
175
|
/**
|
|
227
|
-
* Get
|
|
228
|
-
*
|
|
176
|
+
* Get accounts by l1_address returns all accounts associated with the given L1 address
|
|
177
|
+
* accountsByL1Address
|
|
229
178
|
*/
|
|
230
|
-
async
|
|
231
|
-
if (requestParameters['
|
|
232
|
-
throw new runtime.RequiredError(
|
|
233
|
-
'by',
|
|
234
|
-
'Required parameter "by" was null or undefined when calling getAccountPnl().'
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (requestParameters['value'] == null) {
|
|
239
|
-
throw new runtime.RequiredError(
|
|
240
|
-
'value',
|
|
241
|
-
'Required parameter "value" was null or undefined when calling getAccountPnl().'
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (requestParameters['resolution'] == null) {
|
|
246
|
-
throw new runtime.RequiredError(
|
|
247
|
-
'resolution',
|
|
248
|
-
'Required parameter "resolution" was null or undefined when calling getAccountPnl().'
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (requestParameters['start_timestamp'] == null) {
|
|
253
|
-
throw new runtime.RequiredError(
|
|
254
|
-
'start_timestamp',
|
|
255
|
-
'Required parameter "start_timestamp" was null or undefined when calling getAccountPnl().'
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (requestParameters['end_timestamp'] == null) {
|
|
260
|
-
throw new runtime.RequiredError(
|
|
261
|
-
'end_timestamp',
|
|
262
|
-
'Required parameter "end_timestamp" was null or undefined when calling getAccountPnl().'
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (requestParameters['count_back'] == null) {
|
|
179
|
+
async accountsByL1AddressRaw(requestParameters: AccountsByL1AddressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubAccounts>> {
|
|
180
|
+
if (requestParameters['l1_address'] == null) {
|
|
267
181
|
throw new runtime.RequiredError(
|
|
268
|
-
'
|
|
269
|
-
'Required parameter "
|
|
182
|
+
'l1_address',
|
|
183
|
+
'Required parameter "l1_address" was null or undefined when calling accountsByL1Address().'
|
|
270
184
|
);
|
|
271
185
|
}
|
|
272
186
|
|
|
273
187
|
const queryParameters: any = {};
|
|
274
188
|
|
|
275
|
-
if (requestParameters['
|
|
276
|
-
queryParameters['
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (requestParameters['value'] != null) {
|
|
280
|
-
queryParameters['value'] = requestParameters['value'];
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (requestParameters['resolution'] != null) {
|
|
284
|
-
queryParameters['resolution'] = requestParameters['resolution'];
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (requestParameters['start_timestamp'] != null) {
|
|
288
|
-
queryParameters['start_timestamp'] = requestParameters['start_timestamp'];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (requestParameters['end_timestamp'] != null) {
|
|
292
|
-
queryParameters['end_timestamp'] = requestParameters['end_timestamp'];
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (requestParameters['count_back'] != null) {
|
|
296
|
-
queryParameters['count_back'] = requestParameters['count_back'];
|
|
189
|
+
if (requestParameters['l1_address'] != null) {
|
|
190
|
+
queryParameters['l1_address'] = requestParameters['l1_address'];
|
|
297
191
|
}
|
|
298
192
|
|
|
299
193
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
300
194
|
|
|
301
195
|
const response = await this.request({
|
|
302
|
-
path: `/api/v1/
|
|
196
|
+
path: `/api/v1/accountsByL1Address`,
|
|
303
197
|
method: 'GET',
|
|
304
198
|
headers: headerParameters,
|
|
305
199
|
query: queryParameters,
|
|
306
200
|
}, initOverrides);
|
|
307
201
|
|
|
308
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
202
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubAccountsFromJSON(jsonValue));
|
|
309
203
|
}
|
|
310
204
|
|
|
311
205
|
/**
|
|
312
|
-
* Get
|
|
313
|
-
*
|
|
206
|
+
* Get accounts by l1_address returns all accounts associated with the given L1 address
|
|
207
|
+
* accountsByL1Address
|
|
314
208
|
*/
|
|
315
|
-
async
|
|
316
|
-
const response = await this.
|
|
209
|
+
async accountsByL1Address(requestParameters: AccountsByL1AddressRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubAccounts> {
|
|
210
|
+
const response = await this.accountsByL1AddressRaw(requestParameters, initOverrides);
|
|
317
211
|
return await response.value();
|
|
318
212
|
}
|
|
319
213
|
|
|
320
214
|
/**
|
|
321
|
-
* Get
|
|
322
|
-
*
|
|
215
|
+
* Get account api key
|
|
216
|
+
* apikeys
|
|
323
217
|
*/
|
|
324
|
-
async
|
|
325
|
-
if (requestParameters['
|
|
218
|
+
async apikeysRaw(requestParameters: ApikeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountApiKeys>> {
|
|
219
|
+
if (requestParameters['account_index'] == null) {
|
|
326
220
|
throw new runtime.RequiredError(
|
|
327
|
-
'
|
|
328
|
-
'Required parameter "
|
|
221
|
+
'account_index',
|
|
222
|
+
'Required parameter "account_index" was null or undefined when calling apikeys().'
|
|
329
223
|
);
|
|
330
224
|
}
|
|
331
225
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
226
|
+
if (requestParameters['api_key_index'] == null) {
|
|
227
|
+
throw new runtime.RequiredError(
|
|
228
|
+
'api_key_index',
|
|
229
|
+
'Required parameter "api_key_index" was null or undefined when calling apikeys().'
|
|
230
|
+
);
|
|
336
231
|
}
|
|
337
232
|
|
|
338
|
-
|
|
339
|
-
|
|
233
|
+
const queryParameters: any = {};
|
|
234
|
+
|
|
235
|
+
if (requestParameters['account_index'] != null) {
|
|
236
|
+
queryParameters['account_index'] = requestParameters['account_index'];
|
|
340
237
|
}
|
|
341
238
|
|
|
342
|
-
if (requestParameters['
|
|
343
|
-
queryParameters['
|
|
239
|
+
if (requestParameters['api_key_index'] != null) {
|
|
240
|
+
queryParameters['api_key_index'] = requestParameters['api_key_index'];
|
|
344
241
|
}
|
|
345
242
|
|
|
346
243
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
347
244
|
|
|
348
245
|
const response = await this.request({
|
|
349
|
-
path: `/api/v1/
|
|
246
|
+
path: `/api/v1/apikeys`,
|
|
350
247
|
method: 'GET',
|
|
351
248
|
headers: headerParameters,
|
|
352
249
|
query: queryParameters,
|
|
353
250
|
}, initOverrides);
|
|
354
251
|
|
|
355
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
252
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AccountApiKeysFromJSON(jsonValue));
|
|
356
253
|
}
|
|
357
254
|
|
|
358
255
|
/**
|
|
359
|
-
* Get
|
|
360
|
-
*
|
|
256
|
+
* Get account api key
|
|
257
|
+
* apikeys
|
|
361
258
|
*/
|
|
362
|
-
async
|
|
363
|
-
const response = await this.
|
|
259
|
+
async apikeys(requestParameters: ApikeysRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountApiKeys> {
|
|
260
|
+
const response = await this.apikeysRaw(requestParameters, initOverrides);
|
|
364
261
|
return await response.value();
|
|
365
262
|
}
|
|
366
263
|
|
|
367
264
|
/**
|
|
368
|
-
*
|
|
369
|
-
*
|
|
265
|
+
* Request funds from faucet
|
|
266
|
+
* faucet
|
|
370
267
|
*/
|
|
371
|
-
async
|
|
268
|
+
async faucetRaw(requestParameters: FaucetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ResultCode>> {
|
|
372
269
|
if (requestParameters['l1_address'] == null) {
|
|
373
270
|
throw new runtime.RequiredError(
|
|
374
271
|
'l1_address',
|
|
375
|
-
'Required parameter "l1_address" was null or undefined when calling
|
|
272
|
+
'Required parameter "l1_address" was null or undefined when calling faucet().'
|
|
376
273
|
);
|
|
377
274
|
}
|
|
378
275
|
|
|
@@ -385,47 +282,68 @@ export class AccountApi extends runtime.BaseAPI {
|
|
|
385
282
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
386
283
|
|
|
387
284
|
const response = await this.request({
|
|
388
|
-
path: `/api/v1/
|
|
285
|
+
path: `/api/v1/faucet`,
|
|
389
286
|
method: 'GET',
|
|
390
287
|
headers: headerParameters,
|
|
391
288
|
query: queryParameters,
|
|
392
289
|
}, initOverrides);
|
|
393
290
|
|
|
394
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
291
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ResultCodeFromJSON(jsonValue));
|
|
395
292
|
}
|
|
396
293
|
|
|
397
294
|
/**
|
|
398
|
-
*
|
|
399
|
-
*
|
|
295
|
+
* Request funds from faucet
|
|
296
|
+
* faucet
|
|
400
297
|
*/
|
|
401
|
-
async
|
|
402
|
-
const response = await this.
|
|
298
|
+
async faucet(requestParameters: FaucetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResultCode> {
|
|
299
|
+
const response = await this.faucetRaw(requestParameters, initOverrides);
|
|
403
300
|
return await response.value();
|
|
404
301
|
}
|
|
405
302
|
|
|
406
303
|
/**
|
|
407
|
-
* Get
|
|
408
|
-
*
|
|
304
|
+
* Get account PnL chart
|
|
305
|
+
* pnl
|
|
409
306
|
*/
|
|
410
|
-
async
|
|
307
|
+
async pnlRaw(requestParameters: PnlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AccountPnL>> {
|
|
411
308
|
if (requestParameters['by'] == null) {
|
|
412
309
|
throw new runtime.RequiredError(
|
|
413
310
|
'by',
|
|
414
|
-
'Required parameter "by" was null or undefined when calling
|
|
311
|
+
'Required parameter "by" was null or undefined when calling pnl().'
|
|
415
312
|
);
|
|
416
313
|
}
|
|
417
314
|
|
|
418
315
|
if (requestParameters['value'] == null) {
|
|
419
316
|
throw new runtime.RequiredError(
|
|
420
317
|
'value',
|
|
421
|
-
'Required parameter "value" was null or undefined when calling
|
|
318
|
+
'Required parameter "value" was null or undefined when calling pnl().'
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (requestParameters['resolution'] == null) {
|
|
323
|
+
throw new runtime.RequiredError(
|
|
324
|
+
'resolution',
|
|
325
|
+
'Required parameter "resolution" was null or undefined when calling pnl().'
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (requestParameters['start_timestamp'] == null) {
|
|
330
|
+
throw new runtime.RequiredError(
|
|
331
|
+
'start_timestamp',
|
|
332
|
+
'Required parameter "start_timestamp" was null or undefined when calling pnl().'
|
|
422
333
|
);
|
|
423
334
|
}
|
|
424
335
|
|
|
425
|
-
if (requestParameters['
|
|
336
|
+
if (requestParameters['end_timestamp'] == null) {
|
|
426
337
|
throw new runtime.RequiredError(
|
|
427
|
-
'
|
|
428
|
-
'Required parameter "
|
|
338
|
+
'end_timestamp',
|
|
339
|
+
'Required parameter "end_timestamp" was null or undefined when calling pnl().'
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (requestParameters['count_back'] == null) {
|
|
344
|
+
throw new runtime.RequiredError(
|
|
345
|
+
'count_back',
|
|
346
|
+
'Required parameter "count_back" was null or undefined when calling pnl().'
|
|
429
347
|
);
|
|
430
348
|
}
|
|
431
349
|
|
|
@@ -439,28 +357,40 @@ export class AccountApi extends runtime.BaseAPI {
|
|
|
439
357
|
queryParameters['value'] = requestParameters['value'];
|
|
440
358
|
}
|
|
441
359
|
|
|
442
|
-
if (requestParameters['
|
|
443
|
-
queryParameters['
|
|
360
|
+
if (requestParameters['resolution'] != null) {
|
|
361
|
+
queryParameters['resolution'] = requestParameters['resolution'];
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (requestParameters['start_timestamp'] != null) {
|
|
365
|
+
queryParameters['start_timestamp'] = requestParameters['start_timestamp'];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (requestParameters['end_timestamp'] != null) {
|
|
369
|
+
queryParameters['end_timestamp'] = requestParameters['end_timestamp'];
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (requestParameters['count_back'] != null) {
|
|
373
|
+
queryParameters['count_back'] = requestParameters['count_back'];
|
|
444
374
|
}
|
|
445
375
|
|
|
446
376
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
447
377
|
|
|
448
378
|
const response = await this.request({
|
|
449
|
-
path: `/api/v1/
|
|
379
|
+
path: `/api/v1/pnl`,
|
|
450
380
|
method: 'GET',
|
|
451
381
|
headers: headerParameters,
|
|
452
382
|
query: queryParameters,
|
|
453
383
|
}, initOverrides);
|
|
454
384
|
|
|
455
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
385
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => AccountPnLFromJSON(jsonValue));
|
|
456
386
|
}
|
|
457
387
|
|
|
458
388
|
/**
|
|
459
|
-
* Get
|
|
460
|
-
*
|
|
389
|
+
* Get account PnL chart
|
|
390
|
+
* pnl
|
|
461
391
|
*/
|
|
462
|
-
async
|
|
463
|
-
const response = await this.
|
|
392
|
+
async pnl(requestParameters: PnlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AccountPnL> {
|
|
393
|
+
const response = await this.pnlRaw(requestParameters, initOverrides);
|
|
464
394
|
return await response.value();
|
|
465
395
|
}
|
|
466
396
|
|
|
@@ -469,22 +399,30 @@ export class AccountApi extends runtime.BaseAPI {
|
|
|
469
399
|
/**
|
|
470
400
|
* @export
|
|
471
401
|
*/
|
|
472
|
-
export const
|
|
402
|
+
export const AccountByEnum = {
|
|
473
403
|
Index: 'index',
|
|
474
404
|
L1Address: 'l1_address'
|
|
475
405
|
} as const;
|
|
476
|
-
export type
|
|
406
|
+
export type AccountByEnum = typeof AccountByEnum[keyof typeof AccountByEnum];
|
|
407
|
+
/**
|
|
408
|
+
* @export
|
|
409
|
+
*/
|
|
410
|
+
export const AccountsSortEnum = {
|
|
411
|
+
Asc: 'asc',
|
|
412
|
+
Desc: 'desc'
|
|
413
|
+
} as const;
|
|
414
|
+
export type AccountsSortEnum = typeof AccountsSortEnum[keyof typeof AccountsSortEnum];
|
|
477
415
|
/**
|
|
478
416
|
* @export
|
|
479
417
|
*/
|
|
480
|
-
export const
|
|
418
|
+
export const PnlByEnum = {
|
|
481
419
|
Index: 'index'
|
|
482
420
|
} as const;
|
|
483
|
-
export type
|
|
421
|
+
export type PnlByEnum = typeof PnlByEnum[keyof typeof PnlByEnum];
|
|
484
422
|
/**
|
|
485
423
|
* @export
|
|
486
424
|
*/
|
|
487
|
-
export const
|
|
425
|
+
export const PnlResolutionEnum = {
|
|
488
426
|
_1m: '1m',
|
|
489
427
|
_5m: '5m',
|
|
490
428
|
_15m: '15m',
|
|
@@ -492,20 +430,4 @@ export const GetAccountPnlResolutionEnum = {
|
|
|
492
430
|
_4h: '4h',
|
|
493
431
|
_1d: '1d'
|
|
494
432
|
} as const;
|
|
495
|
-
export type
|
|
496
|
-
/**
|
|
497
|
-
* @export
|
|
498
|
-
*/
|
|
499
|
-
export const GetAccountsSortEnum = {
|
|
500
|
-
Asc: 'asc',
|
|
501
|
-
Desc: 'desc'
|
|
502
|
-
} as const;
|
|
503
|
-
export type GetAccountsSortEnum = typeof GetAccountsSortEnum[keyof typeof GetAccountsSortEnum];
|
|
504
|
-
/**
|
|
505
|
-
* @export
|
|
506
|
-
*/
|
|
507
|
-
export const GetPermissionByEnum = {
|
|
508
|
-
Index: 'index',
|
|
509
|
-
L1Address: 'l1_address'
|
|
510
|
-
} as const;
|
|
511
|
-
export type GetPermissionByEnum = typeof GetPermissionByEnum[keyof typeof GetPermissionByEnum];
|
|
433
|
+
export type PnlResolutionEnum = typeof PnlResolutionEnum[keyof typeof PnlResolutionEnum];
|