@cexyio/cexy 0.1.0-dev.0
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/LICENSE +21 -0
- package/README.md +256 -0
- package/dist/index.cjs +1802 -0
- package/dist/index.d.cts +3929 -0
- package/dist/index.d.ts +3929 -0
- package/dist/index.js +1752 -0
- package/package.json +84 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3929 @@
|
|
|
1
|
+
/** The parts of an outgoing request an authenticator may read or change. */
|
|
2
|
+
interface AuthRequest {
|
|
3
|
+
readonly method: string;
|
|
4
|
+
/** Full URL including the query string. Credentials must never be added to it. */
|
|
5
|
+
readonly url: URL;
|
|
6
|
+
readonly headers: Headers;
|
|
7
|
+
/** The exact body bytes that will be sent (JSON text), if any. */
|
|
8
|
+
readonly body: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Adds credentials to requests for operations that need an API key.
|
|
12
|
+
*
|
|
13
|
+
* Called once per attempt (retries included), so a future signing implementation can put a
|
|
14
|
+
* fresh timestamp and nonce on each attempt. It is never called for public operations.
|
|
15
|
+
*/
|
|
16
|
+
interface Authenticator {
|
|
17
|
+
/** Short, non-secret description, e.g. `"api-key"`. */
|
|
18
|
+
readonly kind: string;
|
|
19
|
+
authenticate(request: AuthRequest): void | Promise<void>;
|
|
20
|
+
/** Removes any secret material from `text` (used on error messages and logs). */
|
|
21
|
+
redact(text: string): string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Today's scheme: `X-API-Key` and `X-API-Secret` headers on every private request.
|
|
25
|
+
* HMAC request signing is planned before SDK 1.0 and will be another `Authenticator`.
|
|
26
|
+
*/
|
|
27
|
+
declare class ApiKeyAuthenticator implements Authenticator {
|
|
28
|
+
#private;
|
|
29
|
+
readonly kind = "api-key";
|
|
30
|
+
constructor(apiKey: string, apiSecret: string);
|
|
31
|
+
/** A non-secret hint for logs: the first characters of the key id. */
|
|
32
|
+
get keyHint(): string;
|
|
33
|
+
authenticate(request: AuthRequest): void;
|
|
34
|
+
redact(text: string): string;
|
|
35
|
+
toString(): string;
|
|
36
|
+
toJSON(): Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Client-side token bucket. `CexyClient` defaults to 100 requests/minute without credentials
|
|
41
|
+
* and 300/minute with an API key (the server allows about 120/min per IP and 600/min per
|
|
42
|
+
* key; this keeps a margin). It adapts to `X-RateLimit-Limit`, `X-RateLimit-Remaining` and
|
|
43
|
+
* `X-RateLimit-Reset` when the server sends them, and to 429 `Retry-After`.
|
|
44
|
+
*/
|
|
45
|
+
interface RateLimiterOptions {
|
|
46
|
+
requestsPerMinute: number;
|
|
47
|
+
/** @internal for tests */
|
|
48
|
+
now?: () => number;
|
|
49
|
+
/** @internal for tests */
|
|
50
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
interface RateLimiterState {
|
|
53
|
+
requestsPerMinute: number;
|
|
54
|
+
tokens: number;
|
|
55
|
+
blockedUntil: number;
|
|
56
|
+
}
|
|
57
|
+
declare class RateLimiter {
|
|
58
|
+
#private;
|
|
59
|
+
constructor(opts: RateLimiterOptions);
|
|
60
|
+
get state(): RateLimiterState;
|
|
61
|
+
/** Waits until a request may be sent, then takes a token. */
|
|
62
|
+
acquire(signal?: AbortSignal): Promise<void>;
|
|
63
|
+
/** Adapts to the server's rate-limit headers. Never raises the configured limit. */
|
|
64
|
+
update(headers: Headers): void;
|
|
65
|
+
/** Blocks all requests for `ms` (used for 429 Retry-After). */
|
|
66
|
+
blockFor(ms: number): void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The SDK surface: exactly the operations in cexy-api-spec/spec/openapi.sdk.json.
|
|
71
|
+
* `auth` decides whether credentials are attached; a test asserts this table against the spec.
|
|
72
|
+
*/
|
|
73
|
+
type OperationAuth = "none" | "api_key";
|
|
74
|
+
type OperationScope = "read" | "trade" | null;
|
|
75
|
+
type HttpMethod = "GET" | "POST" | "DELETE";
|
|
76
|
+
interface OperationInfo {
|
|
77
|
+
readonly method: HttpMethod;
|
|
78
|
+
readonly path: string;
|
|
79
|
+
readonly auth: OperationAuth;
|
|
80
|
+
readonly scope: OperationScope;
|
|
81
|
+
/** The facade method that calls it. */
|
|
82
|
+
readonly sdkMethod: string;
|
|
83
|
+
}
|
|
84
|
+
declare const OPERATIONS: {
|
|
85
|
+
readonly server_time: OperationInfo;
|
|
86
|
+
readonly exchange_config: OperationInfo;
|
|
87
|
+
readonly list_fee_schedules: OperationInfo;
|
|
88
|
+
readonly list_assets: OperationInfo;
|
|
89
|
+
readonly get_asset: OperationInfo;
|
|
90
|
+
readonly list_networks: OperationInfo;
|
|
91
|
+
readonly list_markets: OperationInfo;
|
|
92
|
+
readonly get_market: OperationInfo;
|
|
93
|
+
readonly get_order_book: OperationInfo;
|
|
94
|
+
readonly get_market_trades: OperationInfo;
|
|
95
|
+
readonly get_candles: OperationInfo;
|
|
96
|
+
readonly list_pools: OperationInfo;
|
|
97
|
+
readonly get_pool: OperationInfo;
|
|
98
|
+
readonly list_balances: OperationInfo;
|
|
99
|
+
readonly get_balance: OperationInfo;
|
|
100
|
+
readonly get_ledger: OperationInfo;
|
|
101
|
+
readonly list_notifications: OperationInfo;
|
|
102
|
+
readonly list_sub_accounts: OperationInfo;
|
|
103
|
+
readonly list_api_keys: OperationInfo;
|
|
104
|
+
readonly export_deposits: OperationInfo;
|
|
105
|
+
readonly export_ledger: OperationInfo;
|
|
106
|
+
readonly export_orders: OperationInfo;
|
|
107
|
+
readonly export_trades: OperationInfo;
|
|
108
|
+
readonly export_withdrawals: OperationInfo;
|
|
109
|
+
readonly list_deposits: OperationInfo;
|
|
110
|
+
readonly get_deposit: OperationInfo;
|
|
111
|
+
readonly list_withdrawals: OperationInfo;
|
|
112
|
+
readonly get_withdrawal: OperationInfo;
|
|
113
|
+
readonly list_withdrawal_addresses: OperationInfo;
|
|
114
|
+
readonly deposit_address: OperationInfo;
|
|
115
|
+
readonly list_open_orders: OperationInfo;
|
|
116
|
+
readonly get_order: OperationInfo;
|
|
117
|
+
readonly get_order_by_client_id: OperationInfo;
|
|
118
|
+
readonly order_history: OperationInfo;
|
|
119
|
+
readonly trade_history: OperationInfo;
|
|
120
|
+
readonly place_order: OperationInfo;
|
|
121
|
+
readonly cancel_order: OperationInfo;
|
|
122
|
+
readonly cancel_all: OperationInfo;
|
|
123
|
+
readonly join_pool: OperationInfo;
|
|
124
|
+
readonly exit_pool: OperationInfo;
|
|
125
|
+
};
|
|
126
|
+
type OperationId = keyof typeof OPERATIONS;
|
|
127
|
+
|
|
128
|
+
type FetchLike = (input: string, init: RequestInit) => Promise<Response>;
|
|
129
|
+
/** Per-call options accepted by every facade method as its last argument. */
|
|
130
|
+
interface RequestOptions {
|
|
131
|
+
/** Abort the call (including retries and waits). */
|
|
132
|
+
signal?: AbortSignal;
|
|
133
|
+
/** Overrides the client's `timeoutMs` for each attempt. */
|
|
134
|
+
timeoutMs?: number;
|
|
135
|
+
/** Overrides the client's `maxRetries`. */
|
|
136
|
+
maxRetries?: number;
|
|
137
|
+
/**
|
|
138
|
+
* Mutations only: the `Idempotency-Key` to send. Generated automatically when absent.
|
|
139
|
+
* The server honours it on pool join/exit; set it yourself to make a retry across process
|
|
140
|
+
* restarts safe there. Orders and cancels do NOT honour it: their safety comes from
|
|
141
|
+
* `client_order_id` (see `placeOrder`).
|
|
142
|
+
*/
|
|
143
|
+
idempotencyKey?: string;
|
|
144
|
+
}
|
|
145
|
+
/** Passed to the `onRetry` hook before the SDK waits and retries. */
|
|
146
|
+
interface RetryInfo {
|
|
147
|
+
operation: OperationId;
|
|
148
|
+
method: string;
|
|
149
|
+
path: string;
|
|
150
|
+
/** 1 for the first retry. */
|
|
151
|
+
attempt: number;
|
|
152
|
+
delayMs: number;
|
|
153
|
+
error: unknown;
|
|
154
|
+
idempotencyKey: string | undefined;
|
|
155
|
+
}
|
|
156
|
+
interface TransportConfig {
|
|
157
|
+
baseUrl: string;
|
|
158
|
+
timeoutMs: number;
|
|
159
|
+
maxRetries: number;
|
|
160
|
+
fetch: FetchLike;
|
|
161
|
+
authenticator: Authenticator | null;
|
|
162
|
+
limiter: RateLimiter | null;
|
|
163
|
+
userAgent: string | null;
|
|
164
|
+
sleep: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
165
|
+
random: () => number;
|
|
166
|
+
onRetry?: ((info: RetryInfo) => void) | undefined;
|
|
167
|
+
}
|
|
168
|
+
interface CallSpec {
|
|
169
|
+
op: OperationId;
|
|
170
|
+
pathParams?: Record<string, string>;
|
|
171
|
+
query?: Record<string, unknown> | undefined;
|
|
172
|
+
body?: unknown;
|
|
173
|
+
responseType?: "json" | "text";
|
|
174
|
+
idempotencyKey?: string | undefined;
|
|
175
|
+
}
|
|
176
|
+
interface RawResponse {
|
|
177
|
+
status: number;
|
|
178
|
+
headers: Headers;
|
|
179
|
+
data: unknown;
|
|
180
|
+
}
|
|
181
|
+
declare class Transport {
|
|
182
|
+
readonly config: TransportConfig;
|
|
183
|
+
constructor(config: TransportConfig);
|
|
184
|
+
/**
|
|
185
|
+
* Sends a request with the standard retry policy: GETs retry on retryable errors and
|
|
186
|
+
* network failures. Mutations carry an `Idempotency-Key` reused on every attempt; the server
|
|
187
|
+
* honours it on pool join/exit, which makes their retries safe. The other mutations routed
|
|
188
|
+
* here (cancel-all) are naturally repeatable. `placeOrder` and `cancelOrder` use
|
|
189
|
+
* `attempt()` with their own policies.
|
|
190
|
+
*/
|
|
191
|
+
request(spec: CallSpec, opts?: RequestOptions): Promise<RawResponse>;
|
|
192
|
+
/** Waits before retry number `attempt + 1`, honouring server hints. */
|
|
193
|
+
backoff(op: OperationId, info: OperationInfo, attempt: number, err: unknown, idempotencyKey: string | undefined, signal?: AbortSignal): Promise<void>;
|
|
194
|
+
/** Full-jitter exponential backoff, or the server's hint plus a little jitter. */
|
|
195
|
+
retryDelay(attempt: number, err: unknown): number;
|
|
196
|
+
/** One attempt: rate limiter, credentials, timeout, error mapping. No retries. */
|
|
197
|
+
attempt(spec: CallSpec, opts?: RequestOptions): Promise<RawResponse>;
|
|
198
|
+
buildUrl(info: OperationInfo, pathParams?: Record<string, string>, query?: Record<string, unknown>): URL;
|
|
199
|
+
redact(text: string): string;
|
|
200
|
+
}
|
|
201
|
+
/** Retryable = a network failure/timeout, or an API error with `retryable: true` (incl. 409 CONCURRENT_MODIFICATION). */
|
|
202
|
+
declare function isRetryable(err: unknown): boolean;
|
|
203
|
+
|
|
204
|
+
interface paths {
|
|
205
|
+
"/api/v1/account/api-keys": {
|
|
206
|
+
parameters: {
|
|
207
|
+
query?: never;
|
|
208
|
+
header?: never;
|
|
209
|
+
path?: never;
|
|
210
|
+
cookie?: never;
|
|
211
|
+
};
|
|
212
|
+
/** The account's API keys. */
|
|
213
|
+
get: operations["list_api_keys"];
|
|
214
|
+
put?: never;
|
|
215
|
+
post?: never;
|
|
216
|
+
delete?: never;
|
|
217
|
+
options?: never;
|
|
218
|
+
head?: never;
|
|
219
|
+
patch?: never;
|
|
220
|
+
trace?: never;
|
|
221
|
+
};
|
|
222
|
+
"/api/v1/account/balances": {
|
|
223
|
+
parameters: {
|
|
224
|
+
query?: never;
|
|
225
|
+
header?: never;
|
|
226
|
+
path?: never;
|
|
227
|
+
cookie?: never;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Balances across every asset the account holds.
|
|
231
|
+
* @description Zero balances are omitted; ask for one by symbol to see it explicitly.
|
|
232
|
+
*/
|
|
233
|
+
get: operations["list_balances"];
|
|
234
|
+
put?: never;
|
|
235
|
+
post?: never;
|
|
236
|
+
delete?: never;
|
|
237
|
+
options?: never;
|
|
238
|
+
head?: never;
|
|
239
|
+
patch?: never;
|
|
240
|
+
trace?: never;
|
|
241
|
+
};
|
|
242
|
+
"/api/v1/account/balances/{asset}": {
|
|
243
|
+
parameters: {
|
|
244
|
+
query?: never;
|
|
245
|
+
header?: never;
|
|
246
|
+
path?: never;
|
|
247
|
+
cookie?: never;
|
|
248
|
+
};
|
|
249
|
+
/** One asset's balance, including a zero one. */
|
|
250
|
+
get: operations["get_balance"];
|
|
251
|
+
put?: never;
|
|
252
|
+
post?: never;
|
|
253
|
+
delete?: never;
|
|
254
|
+
options?: never;
|
|
255
|
+
head?: never;
|
|
256
|
+
patch?: never;
|
|
257
|
+
trace?: never;
|
|
258
|
+
};
|
|
259
|
+
"/api/v1/account/ledger": {
|
|
260
|
+
parameters: {
|
|
261
|
+
query?: never;
|
|
262
|
+
header?: never;
|
|
263
|
+
path?: never;
|
|
264
|
+
cookie?: never;
|
|
265
|
+
};
|
|
266
|
+
/** The account's ledger — every balance change, with its cause. */
|
|
267
|
+
get: operations["get_ledger"];
|
|
268
|
+
put?: never;
|
|
269
|
+
post?: never;
|
|
270
|
+
delete?: never;
|
|
271
|
+
options?: never;
|
|
272
|
+
head?: never;
|
|
273
|
+
patch?: never;
|
|
274
|
+
trace?: never;
|
|
275
|
+
};
|
|
276
|
+
"/api/v1/account/notifications": {
|
|
277
|
+
parameters: {
|
|
278
|
+
query?: never;
|
|
279
|
+
header?: never;
|
|
280
|
+
path?: never;
|
|
281
|
+
cookie?: never;
|
|
282
|
+
};
|
|
283
|
+
/** The account's notices, newest first. */
|
|
284
|
+
get: operations["list_notifications"];
|
|
285
|
+
put?: never;
|
|
286
|
+
post?: never;
|
|
287
|
+
delete?: never;
|
|
288
|
+
options?: never;
|
|
289
|
+
head?: never;
|
|
290
|
+
patch?: never;
|
|
291
|
+
trace?: never;
|
|
292
|
+
};
|
|
293
|
+
"/api/v1/account/sub-accounts": {
|
|
294
|
+
parameters: {
|
|
295
|
+
query?: never;
|
|
296
|
+
header?: never;
|
|
297
|
+
path?: never;
|
|
298
|
+
cookie?: never;
|
|
299
|
+
};
|
|
300
|
+
/** This account's sub-accounts. */
|
|
301
|
+
get: operations["list_sub_accounts"];
|
|
302
|
+
put?: never;
|
|
303
|
+
post?: never;
|
|
304
|
+
delete?: never;
|
|
305
|
+
options?: never;
|
|
306
|
+
head?: never;
|
|
307
|
+
patch?: never;
|
|
308
|
+
trace?: never;
|
|
309
|
+
};
|
|
310
|
+
"/api/v1/assets": {
|
|
311
|
+
parameters: {
|
|
312
|
+
query?: never;
|
|
313
|
+
header?: never;
|
|
314
|
+
path?: never;
|
|
315
|
+
cookie?: never;
|
|
316
|
+
};
|
|
317
|
+
/** Every listed asset, with its networks. */
|
|
318
|
+
get: operations["list_assets"];
|
|
319
|
+
put?: never;
|
|
320
|
+
post?: never;
|
|
321
|
+
delete?: never;
|
|
322
|
+
options?: never;
|
|
323
|
+
head?: never;
|
|
324
|
+
patch?: never;
|
|
325
|
+
trace?: never;
|
|
326
|
+
};
|
|
327
|
+
"/api/v1/assets/{symbol}": {
|
|
328
|
+
parameters: {
|
|
329
|
+
query?: never;
|
|
330
|
+
header?: never;
|
|
331
|
+
path?: never;
|
|
332
|
+
cookie?: never;
|
|
333
|
+
};
|
|
334
|
+
/** One asset and its networks. */
|
|
335
|
+
get: operations["get_asset"];
|
|
336
|
+
put?: never;
|
|
337
|
+
post?: never;
|
|
338
|
+
delete?: never;
|
|
339
|
+
options?: never;
|
|
340
|
+
head?: never;
|
|
341
|
+
patch?: never;
|
|
342
|
+
trace?: never;
|
|
343
|
+
};
|
|
344
|
+
"/api/v1/config": {
|
|
345
|
+
parameters: {
|
|
346
|
+
query?: never;
|
|
347
|
+
header?: never;
|
|
348
|
+
path?: never;
|
|
349
|
+
cookie?: never;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Public exchange configuration.
|
|
353
|
+
* @description Everything a frontend needs to render itself: branding, limits, supported intervals and maintenance state.
|
|
354
|
+
*/
|
|
355
|
+
get: operations["exchange_config"];
|
|
356
|
+
put?: never;
|
|
357
|
+
post?: never;
|
|
358
|
+
delete?: never;
|
|
359
|
+
options?: never;
|
|
360
|
+
head?: never;
|
|
361
|
+
patch?: never;
|
|
362
|
+
trace?: never;
|
|
363
|
+
};
|
|
364
|
+
"/api/v1/exports/deposits": {
|
|
365
|
+
parameters: {
|
|
366
|
+
query?: never;
|
|
367
|
+
header?: never;
|
|
368
|
+
path?: never;
|
|
369
|
+
cookie?: never;
|
|
370
|
+
};
|
|
371
|
+
/** Exports the caller's deposits as CSV. */
|
|
372
|
+
get: operations["export_deposits"];
|
|
373
|
+
put?: never;
|
|
374
|
+
post?: never;
|
|
375
|
+
delete?: never;
|
|
376
|
+
options?: never;
|
|
377
|
+
head?: never;
|
|
378
|
+
patch?: never;
|
|
379
|
+
trace?: never;
|
|
380
|
+
};
|
|
381
|
+
"/api/v1/exports/ledger": {
|
|
382
|
+
parameters: {
|
|
383
|
+
query?: never;
|
|
384
|
+
header?: never;
|
|
385
|
+
path?: never;
|
|
386
|
+
cookie?: never;
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Exports the caller's ledger as CSV.
|
|
390
|
+
* @description The complete accounting record: every balance change with its cause.
|
|
391
|
+
*/
|
|
392
|
+
get: operations["export_ledger"];
|
|
393
|
+
put?: never;
|
|
394
|
+
post?: never;
|
|
395
|
+
delete?: never;
|
|
396
|
+
options?: never;
|
|
397
|
+
head?: never;
|
|
398
|
+
patch?: never;
|
|
399
|
+
trace?: never;
|
|
400
|
+
};
|
|
401
|
+
"/api/v1/exports/orders": {
|
|
402
|
+
parameters: {
|
|
403
|
+
query?: never;
|
|
404
|
+
header?: never;
|
|
405
|
+
path?: never;
|
|
406
|
+
cookie?: never;
|
|
407
|
+
};
|
|
408
|
+
/** Exports the caller's orders as CSV. */
|
|
409
|
+
get: operations["export_orders"];
|
|
410
|
+
put?: never;
|
|
411
|
+
post?: never;
|
|
412
|
+
delete?: never;
|
|
413
|
+
options?: never;
|
|
414
|
+
head?: never;
|
|
415
|
+
patch?: never;
|
|
416
|
+
trace?: never;
|
|
417
|
+
};
|
|
418
|
+
"/api/v1/exports/trades": {
|
|
419
|
+
parameters: {
|
|
420
|
+
query?: never;
|
|
421
|
+
header?: never;
|
|
422
|
+
path?: never;
|
|
423
|
+
cookie?: never;
|
|
424
|
+
};
|
|
425
|
+
/** Exports the caller's trades as CSV. */
|
|
426
|
+
get: operations["export_trades"];
|
|
427
|
+
put?: never;
|
|
428
|
+
post?: never;
|
|
429
|
+
delete?: never;
|
|
430
|
+
options?: never;
|
|
431
|
+
head?: never;
|
|
432
|
+
patch?: never;
|
|
433
|
+
trace?: never;
|
|
434
|
+
};
|
|
435
|
+
"/api/v1/exports/withdrawals": {
|
|
436
|
+
parameters: {
|
|
437
|
+
query?: never;
|
|
438
|
+
header?: never;
|
|
439
|
+
path?: never;
|
|
440
|
+
cookie?: never;
|
|
441
|
+
};
|
|
442
|
+
/** Exports the caller's withdrawals as CSV. */
|
|
443
|
+
get: operations["export_withdrawals"];
|
|
444
|
+
put?: never;
|
|
445
|
+
post?: never;
|
|
446
|
+
delete?: never;
|
|
447
|
+
options?: never;
|
|
448
|
+
head?: never;
|
|
449
|
+
patch?: never;
|
|
450
|
+
trace?: never;
|
|
451
|
+
};
|
|
452
|
+
"/api/v1/fees": {
|
|
453
|
+
parameters: {
|
|
454
|
+
query?: never;
|
|
455
|
+
header?: never;
|
|
456
|
+
path?: never;
|
|
457
|
+
cookie?: never;
|
|
458
|
+
};
|
|
459
|
+
/** The fee schedule. */
|
|
460
|
+
get: operations["list_fee_schedules"];
|
|
461
|
+
put?: never;
|
|
462
|
+
post?: never;
|
|
463
|
+
delete?: never;
|
|
464
|
+
options?: never;
|
|
465
|
+
head?: never;
|
|
466
|
+
patch?: never;
|
|
467
|
+
trace?: never;
|
|
468
|
+
};
|
|
469
|
+
"/api/v1/markets": {
|
|
470
|
+
parameters: {
|
|
471
|
+
query?: never;
|
|
472
|
+
header?: never;
|
|
473
|
+
path?: never;
|
|
474
|
+
cookie?: never;
|
|
475
|
+
};
|
|
476
|
+
/** Every visible market with its ticker. */
|
|
477
|
+
get: operations["list_markets"];
|
|
478
|
+
put?: never;
|
|
479
|
+
post?: never;
|
|
480
|
+
delete?: never;
|
|
481
|
+
options?: never;
|
|
482
|
+
head?: never;
|
|
483
|
+
patch?: never;
|
|
484
|
+
trace?: never;
|
|
485
|
+
};
|
|
486
|
+
"/api/v1/markets/{symbol}": {
|
|
487
|
+
parameters: {
|
|
488
|
+
query?: never;
|
|
489
|
+
header?: never;
|
|
490
|
+
path?: never;
|
|
491
|
+
cookie?: never;
|
|
492
|
+
};
|
|
493
|
+
/** One market. */
|
|
494
|
+
get: operations["get_market"];
|
|
495
|
+
put?: never;
|
|
496
|
+
post?: never;
|
|
497
|
+
delete?: never;
|
|
498
|
+
options?: never;
|
|
499
|
+
head?: never;
|
|
500
|
+
patch?: never;
|
|
501
|
+
trace?: never;
|
|
502
|
+
};
|
|
503
|
+
"/api/v1/markets/{symbol}/candles": {
|
|
504
|
+
parameters: {
|
|
505
|
+
query?: never;
|
|
506
|
+
header?: never;
|
|
507
|
+
path?: never;
|
|
508
|
+
cookie?: never;
|
|
509
|
+
};
|
|
510
|
+
/** OHLCV candles. */
|
|
511
|
+
get: operations["get_candles"];
|
|
512
|
+
put?: never;
|
|
513
|
+
post?: never;
|
|
514
|
+
delete?: never;
|
|
515
|
+
options?: never;
|
|
516
|
+
head?: never;
|
|
517
|
+
patch?: never;
|
|
518
|
+
trace?: never;
|
|
519
|
+
};
|
|
520
|
+
"/api/v1/markets/{symbol}/orderbook": {
|
|
521
|
+
parameters: {
|
|
522
|
+
query?: never;
|
|
523
|
+
header?: never;
|
|
524
|
+
path?: never;
|
|
525
|
+
cookie?: never;
|
|
526
|
+
};
|
|
527
|
+
/** Aggregated order book. */
|
|
528
|
+
get: operations["get_order_book"];
|
|
529
|
+
put?: never;
|
|
530
|
+
post?: never;
|
|
531
|
+
delete?: never;
|
|
532
|
+
options?: never;
|
|
533
|
+
head?: never;
|
|
534
|
+
patch?: never;
|
|
535
|
+
trace?: never;
|
|
536
|
+
};
|
|
537
|
+
"/api/v1/markets/{symbol}/trades": {
|
|
538
|
+
parameters: {
|
|
539
|
+
query?: never;
|
|
540
|
+
header?: never;
|
|
541
|
+
path?: never;
|
|
542
|
+
cookie?: never;
|
|
543
|
+
};
|
|
544
|
+
/** A market's recent trades. */
|
|
545
|
+
get: operations["get_market_trades"];
|
|
546
|
+
put?: never;
|
|
547
|
+
post?: never;
|
|
548
|
+
delete?: never;
|
|
549
|
+
options?: never;
|
|
550
|
+
head?: never;
|
|
551
|
+
patch?: never;
|
|
552
|
+
trace?: never;
|
|
553
|
+
};
|
|
554
|
+
"/api/v1/networks": {
|
|
555
|
+
parameters: {
|
|
556
|
+
query?: never;
|
|
557
|
+
header?: never;
|
|
558
|
+
path?: never;
|
|
559
|
+
cookie?: never;
|
|
560
|
+
};
|
|
561
|
+
/** Every configured network. */
|
|
562
|
+
get: operations["list_networks"];
|
|
563
|
+
put?: never;
|
|
564
|
+
post?: never;
|
|
565
|
+
delete?: never;
|
|
566
|
+
options?: never;
|
|
567
|
+
head?: never;
|
|
568
|
+
patch?: never;
|
|
569
|
+
trace?: never;
|
|
570
|
+
};
|
|
571
|
+
"/api/v1/pools": {
|
|
572
|
+
parameters: {
|
|
573
|
+
query?: never;
|
|
574
|
+
header?: never;
|
|
575
|
+
path?: never;
|
|
576
|
+
cookie?: never;
|
|
577
|
+
};
|
|
578
|
+
/** Every pool and what it holds. */
|
|
579
|
+
get: operations["list_pools"];
|
|
580
|
+
put?: never;
|
|
581
|
+
post?: never;
|
|
582
|
+
delete?: never;
|
|
583
|
+
options?: never;
|
|
584
|
+
head?: never;
|
|
585
|
+
patch?: never;
|
|
586
|
+
trace?: never;
|
|
587
|
+
};
|
|
588
|
+
"/api/v1/pools/{symbol}": {
|
|
589
|
+
parameters: {
|
|
590
|
+
query?: never;
|
|
591
|
+
header?: never;
|
|
592
|
+
path?: never;
|
|
593
|
+
cookie?: never;
|
|
594
|
+
};
|
|
595
|
+
/** One market's pool. */
|
|
596
|
+
get: operations["get_pool"];
|
|
597
|
+
put?: never;
|
|
598
|
+
post?: never;
|
|
599
|
+
delete?: never;
|
|
600
|
+
options?: never;
|
|
601
|
+
head?: never;
|
|
602
|
+
patch?: never;
|
|
603
|
+
trace?: never;
|
|
604
|
+
};
|
|
605
|
+
"/api/v1/pools/{symbol}/exit": {
|
|
606
|
+
parameters: {
|
|
607
|
+
query?: never;
|
|
608
|
+
header?: never;
|
|
609
|
+
path?: never;
|
|
610
|
+
cookie?: never;
|
|
611
|
+
};
|
|
612
|
+
get?: never;
|
|
613
|
+
put?: never;
|
|
614
|
+
/**
|
|
615
|
+
* Removes liquidity.
|
|
616
|
+
* @description The pool's resting orders for the market are cancelled first, because reserves locked in an order cannot be paid out. Shares are burned and a proportional slice of both assets is returned.
|
|
617
|
+
*/
|
|
618
|
+
post: operations["exit_pool"];
|
|
619
|
+
delete?: never;
|
|
620
|
+
options?: never;
|
|
621
|
+
head?: never;
|
|
622
|
+
patch?: never;
|
|
623
|
+
trace?: never;
|
|
624
|
+
};
|
|
625
|
+
"/api/v1/pools/{symbol}/join": {
|
|
626
|
+
parameters: {
|
|
627
|
+
query?: never;
|
|
628
|
+
header?: never;
|
|
629
|
+
path?: never;
|
|
630
|
+
cookie?: never;
|
|
631
|
+
};
|
|
632
|
+
get?: never;
|
|
633
|
+
put?: never;
|
|
634
|
+
/**
|
|
635
|
+
* Adds liquidity.
|
|
636
|
+
* @description Both assets are taken, in the ratio the pool already holds — only the quote that ratio requires is debited, however much is offered. The first join into an empty pool sets the price, and is refused if it strays far from the market's last traded price.
|
|
637
|
+
*
|
|
638
|
+
* Send `Idempotency-Key` so a timed-out request can be retried without adding liquidity twice.
|
|
639
|
+
*/
|
|
640
|
+
post: operations["join_pool"];
|
|
641
|
+
delete?: never;
|
|
642
|
+
options?: never;
|
|
643
|
+
head?: never;
|
|
644
|
+
patch?: never;
|
|
645
|
+
trace?: never;
|
|
646
|
+
};
|
|
647
|
+
"/api/v1/time": {
|
|
648
|
+
parameters: {
|
|
649
|
+
query?: never;
|
|
650
|
+
header?: never;
|
|
651
|
+
path?: never;
|
|
652
|
+
cookie?: never;
|
|
653
|
+
};
|
|
654
|
+
/** Server time, so a client can detect clock skew before it breaks two-factor. */
|
|
655
|
+
get: operations["server_time"];
|
|
656
|
+
put?: never;
|
|
657
|
+
post?: never;
|
|
658
|
+
delete?: never;
|
|
659
|
+
options?: never;
|
|
660
|
+
head?: never;
|
|
661
|
+
patch?: never;
|
|
662
|
+
trace?: never;
|
|
663
|
+
};
|
|
664
|
+
"/api/v1/trading/orders": {
|
|
665
|
+
parameters: {
|
|
666
|
+
query?: never;
|
|
667
|
+
header?: never;
|
|
668
|
+
path?: never;
|
|
669
|
+
cookie?: never;
|
|
670
|
+
};
|
|
671
|
+
/** Open orders, newest first. */
|
|
672
|
+
get: operations["list_open_orders"];
|
|
673
|
+
put?: never;
|
|
674
|
+
/**
|
|
675
|
+
* Places an order.
|
|
676
|
+
* @description Funds are reserved before the order reaches the book, so a matched order can never be unfunded. On a buy the reservation covers the value plus the **taker** fee, which is the worst case — a maker fill releases the difference.
|
|
677
|
+
*
|
|
678
|
+
* Set `client_order_id` to make a retry safe: it is unique per account, so a repeat is refused before any funds move, and `GET /trading/orders/by-client-id/{client_order_id}` recovers the outcome. `Idempotency-Key` is not honoured here.
|
|
679
|
+
*/
|
|
680
|
+
post: operations["place_order"];
|
|
681
|
+
delete?: never;
|
|
682
|
+
options?: never;
|
|
683
|
+
head?: never;
|
|
684
|
+
patch?: never;
|
|
685
|
+
trace?: never;
|
|
686
|
+
};
|
|
687
|
+
"/api/v1/trading/orders/{order_id}": {
|
|
688
|
+
parameters: {
|
|
689
|
+
query?: never;
|
|
690
|
+
header?: never;
|
|
691
|
+
path?: never;
|
|
692
|
+
cookie?: never;
|
|
693
|
+
};
|
|
694
|
+
/** One order. */
|
|
695
|
+
get: operations["get_order"];
|
|
696
|
+
put?: never;
|
|
697
|
+
post?: never;
|
|
698
|
+
/** Cancels an order, releasing only what is still reserved. */
|
|
699
|
+
delete: operations["cancel_order"];
|
|
700
|
+
options?: never;
|
|
701
|
+
head?: never;
|
|
702
|
+
patch?: never;
|
|
703
|
+
trace?: never;
|
|
704
|
+
};
|
|
705
|
+
"/api/v1/trading/orders/by-client-id/{client_order_id}": {
|
|
706
|
+
parameters: {
|
|
707
|
+
query?: never;
|
|
708
|
+
header?: never;
|
|
709
|
+
path?: never;
|
|
710
|
+
cookie?: never;
|
|
711
|
+
};
|
|
712
|
+
/** One order, looked up by the id the client supplied. */
|
|
713
|
+
get: operations["get_order_by_client_id"];
|
|
714
|
+
put?: never;
|
|
715
|
+
post?: never;
|
|
716
|
+
delete?: never;
|
|
717
|
+
options?: never;
|
|
718
|
+
head?: never;
|
|
719
|
+
patch?: never;
|
|
720
|
+
trace?: never;
|
|
721
|
+
};
|
|
722
|
+
"/api/v1/trading/orders/cancel-all": {
|
|
723
|
+
parameters: {
|
|
724
|
+
query?: never;
|
|
725
|
+
header?: never;
|
|
726
|
+
path?: never;
|
|
727
|
+
cookie?: never;
|
|
728
|
+
};
|
|
729
|
+
get?: never;
|
|
730
|
+
put?: never;
|
|
731
|
+
/**
|
|
732
|
+
* Cancels every open order, optionally within one market.
|
|
733
|
+
* @description Best-effort: a failure on one order does not stop the rest, and both outcomes are reported. A panic-button endpoint that stops at the first problem is worse than useless.
|
|
734
|
+
*/
|
|
735
|
+
post: operations["cancel_all"];
|
|
736
|
+
delete?: never;
|
|
737
|
+
options?: never;
|
|
738
|
+
head?: never;
|
|
739
|
+
patch?: never;
|
|
740
|
+
trace?: never;
|
|
741
|
+
};
|
|
742
|
+
"/api/v1/trading/orders/history": {
|
|
743
|
+
parameters: {
|
|
744
|
+
query?: never;
|
|
745
|
+
header?: never;
|
|
746
|
+
path?: never;
|
|
747
|
+
cookie?: never;
|
|
748
|
+
};
|
|
749
|
+
/** Order history, including terminal orders. */
|
|
750
|
+
get: operations["order_history"];
|
|
751
|
+
put?: never;
|
|
752
|
+
post?: never;
|
|
753
|
+
delete?: never;
|
|
754
|
+
options?: never;
|
|
755
|
+
head?: never;
|
|
756
|
+
patch?: never;
|
|
757
|
+
trace?: never;
|
|
758
|
+
};
|
|
759
|
+
"/api/v1/trading/trades": {
|
|
760
|
+
parameters: {
|
|
761
|
+
query?: never;
|
|
762
|
+
header?: never;
|
|
763
|
+
path?: never;
|
|
764
|
+
cookie?: never;
|
|
765
|
+
};
|
|
766
|
+
/** The caller's executions. */
|
|
767
|
+
get: operations["trade_history"];
|
|
768
|
+
put?: never;
|
|
769
|
+
post?: never;
|
|
770
|
+
delete?: never;
|
|
771
|
+
options?: never;
|
|
772
|
+
head?: never;
|
|
773
|
+
patch?: never;
|
|
774
|
+
trace?: never;
|
|
775
|
+
};
|
|
776
|
+
"/api/v1/wallet/deposit-address": {
|
|
777
|
+
parameters: {
|
|
778
|
+
query?: never;
|
|
779
|
+
header?: never;
|
|
780
|
+
path?: never;
|
|
781
|
+
cookie?: never;
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* The caller's deposit address for an asset on a network.
|
|
785
|
+
* @description The first call for an asset and network creates the address; every later call, and any call racing the first, returns that same address. On chains where an address works across sibling networks, the account's address from a sibling is reused.
|
|
786
|
+
*/
|
|
787
|
+
get: operations["deposit_address"];
|
|
788
|
+
put?: never;
|
|
789
|
+
post?: never;
|
|
790
|
+
delete?: never;
|
|
791
|
+
options?: never;
|
|
792
|
+
head?: never;
|
|
793
|
+
patch?: never;
|
|
794
|
+
trace?: never;
|
|
795
|
+
};
|
|
796
|
+
"/api/v1/wallet/deposits": {
|
|
797
|
+
parameters: {
|
|
798
|
+
query?: never;
|
|
799
|
+
header?: never;
|
|
800
|
+
path?: never;
|
|
801
|
+
cookie?: never;
|
|
802
|
+
};
|
|
803
|
+
/** Deposit history. */
|
|
804
|
+
get: operations["list_deposits"];
|
|
805
|
+
put?: never;
|
|
806
|
+
post?: never;
|
|
807
|
+
delete?: never;
|
|
808
|
+
options?: never;
|
|
809
|
+
head?: never;
|
|
810
|
+
patch?: never;
|
|
811
|
+
trace?: never;
|
|
812
|
+
};
|
|
813
|
+
"/api/v1/wallet/deposits/{deposit_id}": {
|
|
814
|
+
parameters: {
|
|
815
|
+
query?: never;
|
|
816
|
+
header?: never;
|
|
817
|
+
path?: never;
|
|
818
|
+
cookie?: never;
|
|
819
|
+
};
|
|
820
|
+
/** One deposit. */
|
|
821
|
+
get: operations["get_deposit"];
|
|
822
|
+
put?: never;
|
|
823
|
+
post?: never;
|
|
824
|
+
delete?: never;
|
|
825
|
+
options?: never;
|
|
826
|
+
head?: never;
|
|
827
|
+
patch?: never;
|
|
828
|
+
trace?: never;
|
|
829
|
+
};
|
|
830
|
+
"/api/v1/wallet/withdrawal-addresses": {
|
|
831
|
+
parameters: {
|
|
832
|
+
query?: never;
|
|
833
|
+
header?: never;
|
|
834
|
+
path?: never;
|
|
835
|
+
cookie?: never;
|
|
836
|
+
};
|
|
837
|
+
/** The caller's saved withdrawal addresses. */
|
|
838
|
+
get: operations["list_withdrawal_addresses"];
|
|
839
|
+
put?: never;
|
|
840
|
+
post?: never;
|
|
841
|
+
delete?: never;
|
|
842
|
+
options?: never;
|
|
843
|
+
head?: never;
|
|
844
|
+
patch?: never;
|
|
845
|
+
trace?: never;
|
|
846
|
+
};
|
|
847
|
+
"/api/v1/wallet/withdrawals": {
|
|
848
|
+
parameters: {
|
|
849
|
+
query?: never;
|
|
850
|
+
header?: never;
|
|
851
|
+
path?: never;
|
|
852
|
+
cookie?: never;
|
|
853
|
+
};
|
|
854
|
+
/** Withdrawal history. */
|
|
855
|
+
get: operations["list_withdrawals"];
|
|
856
|
+
put?: never;
|
|
857
|
+
post?: never;
|
|
858
|
+
delete?: never;
|
|
859
|
+
options?: never;
|
|
860
|
+
head?: never;
|
|
861
|
+
patch?: never;
|
|
862
|
+
trace?: never;
|
|
863
|
+
};
|
|
864
|
+
"/api/v1/wallet/withdrawals/{withdrawal_id}": {
|
|
865
|
+
parameters: {
|
|
866
|
+
query?: never;
|
|
867
|
+
header?: never;
|
|
868
|
+
path?: never;
|
|
869
|
+
cookie?: never;
|
|
870
|
+
};
|
|
871
|
+
/** One withdrawal, with its full status history. */
|
|
872
|
+
get: operations["get_withdrawal"];
|
|
873
|
+
put?: never;
|
|
874
|
+
post?: never;
|
|
875
|
+
delete?: never;
|
|
876
|
+
options?: never;
|
|
877
|
+
head?: never;
|
|
878
|
+
patch?: never;
|
|
879
|
+
trace?: never;
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
interface components {
|
|
883
|
+
schemas: {
|
|
884
|
+
/**
|
|
885
|
+
* @description Exact decimal amount, serialized as a string to avoid floating-point precision loss. Example: "1.50000000".
|
|
886
|
+
* @example 1.50000000
|
|
887
|
+
*/
|
|
888
|
+
Amount: string;
|
|
889
|
+
/** @description An existing key. Never carries the secret. */
|
|
890
|
+
ApiKeyResponse: {
|
|
891
|
+
/** @description Permitted source addresses. Empty means unrestricted. */
|
|
892
|
+
allowed_ips: string[];
|
|
893
|
+
/**
|
|
894
|
+
* Format: date-time
|
|
895
|
+
* @description When it was created.
|
|
896
|
+
*/
|
|
897
|
+
created_at: string;
|
|
898
|
+
/**
|
|
899
|
+
* Format: date-time
|
|
900
|
+
* @description When it stops working.
|
|
901
|
+
*/
|
|
902
|
+
expires_at?: string | null;
|
|
903
|
+
/** @description Opaque key identifier, used to revoke it. */
|
|
904
|
+
id: string;
|
|
905
|
+
/** @description The public key id, sent as `X-API-Key`. */
|
|
906
|
+
key_id: string;
|
|
907
|
+
/** @description Human label. */
|
|
908
|
+
label: string;
|
|
909
|
+
/**
|
|
910
|
+
* Format: date-time
|
|
911
|
+
* @description When it was last used, if ever.
|
|
912
|
+
*/
|
|
913
|
+
last_used_at?: string | null;
|
|
914
|
+
/** @description Whether it has been revoked. */
|
|
915
|
+
revoked: boolean;
|
|
916
|
+
/** @description Granted scopes. */
|
|
917
|
+
scopes: components["schemas"]["ApiScope"][];
|
|
918
|
+
};
|
|
919
|
+
/**
|
|
920
|
+
* @description Scope attached to an API key.
|
|
921
|
+
*
|
|
922
|
+
* Scopes narrow what an API key may do. They apply to API keys only: a signed-in session carries none and is not limited by them.
|
|
923
|
+
* @enum {string}
|
|
924
|
+
*/
|
|
925
|
+
ApiScope: "read" | "trade";
|
|
926
|
+
/** @description An asset's policy on one network. */
|
|
927
|
+
AssetNetworkResponse: {
|
|
928
|
+
/** @description Contract address or chain asset id, for a token. */
|
|
929
|
+
contract_address?: string | null;
|
|
930
|
+
/**
|
|
931
|
+
* Format: int32
|
|
932
|
+
* @description Confirmations before a deposit is credited.
|
|
933
|
+
*/
|
|
934
|
+
deposit_confirmations: number;
|
|
935
|
+
/** @description Whether deposits are accepted. */
|
|
936
|
+
deposit_enabled: boolean;
|
|
937
|
+
maintenance?: components["schemas"]["MaintenanceState"] | null;
|
|
938
|
+
max_withdrawal?: components["schemas"]["Amount"] | null;
|
|
939
|
+
/** @description What to call the memo field in a UI. */
|
|
940
|
+
memo_label?: string | null;
|
|
941
|
+
/** @description Whether a memo is mandatory. */
|
|
942
|
+
memo_required: boolean;
|
|
943
|
+
/** @description Whether the network uses a memo / destination tag. */
|
|
944
|
+
memo_supported: boolean;
|
|
945
|
+
min_deposit: components["schemas"]["Amount"];
|
|
946
|
+
min_withdrawal: components["schemas"]["Amount"];
|
|
947
|
+
/**
|
|
948
|
+
* @description Network code.
|
|
949
|
+
* @example bitcoin-mainnet
|
|
950
|
+
*/
|
|
951
|
+
network: string;
|
|
952
|
+
/** @description Network display name. */
|
|
953
|
+
network_name: string;
|
|
954
|
+
/** @description Operator note. */
|
|
955
|
+
notice?: string | null;
|
|
956
|
+
/** @description How the asset exists on this chain. */
|
|
957
|
+
token_kind: string;
|
|
958
|
+
/**
|
|
959
|
+
* Format: int32
|
|
960
|
+
* @description Decimal places a withdrawal amount is truncated to.
|
|
961
|
+
*/
|
|
962
|
+
withdrawal_decimals: number;
|
|
963
|
+
/** @description Whether withdrawals are accepted. */
|
|
964
|
+
withdrawal_enabled: boolean;
|
|
965
|
+
withdrawal_fee: components["schemas"]["Amount"];
|
|
966
|
+
/** @description Asset the withdrawal fee is charged in. */
|
|
967
|
+
withdrawal_fee_asset: string;
|
|
968
|
+
};
|
|
969
|
+
/** @description A tradable asset. */
|
|
970
|
+
AssetResponse: {
|
|
971
|
+
/**
|
|
972
|
+
* Format: int32
|
|
973
|
+
* @description Accounting precision: the decimal places the exchange records internally.
|
|
974
|
+
*
|
|
975
|
+
* Use this for arithmetic. For rendering, use `display_decimals`.
|
|
976
|
+
*/
|
|
977
|
+
decimals: number;
|
|
978
|
+
/**
|
|
979
|
+
* Format: int32
|
|
980
|
+
* @description Decimal places to show in a user interface.
|
|
981
|
+
*
|
|
982
|
+
* Always less than or equal to `decimals`. Rounding for display is presentation only and must never be fed back into a request.
|
|
983
|
+
*/
|
|
984
|
+
display_decimals: number;
|
|
985
|
+
/** @description Identifier for a client-bundled icon, when no logo URL is set. */
|
|
986
|
+
icon_key?: string | null;
|
|
987
|
+
/** @description Logo URL, when the operator has configured one. */
|
|
988
|
+
logo_url?: string | null;
|
|
989
|
+
/**
|
|
990
|
+
* Format: int64
|
|
991
|
+
* @description How old this asset's price may be before it is refused, in seconds.
|
|
992
|
+
*
|
|
993
|
+
* The global default unless an operator set an override for this asset. Exposed beside the flag because the flag alone cannot explain itself: an asset that is not stale after a week and one that is not stale after an hour look identical without it.
|
|
994
|
+
*/
|
|
995
|
+
max_price_age_secs: number;
|
|
996
|
+
/** @description Display name. */
|
|
997
|
+
name: string;
|
|
998
|
+
/** @description Networks this asset can be deposited to or withdrawn from. */
|
|
999
|
+
networks: components["schemas"]["AssetNetworkResponse"][];
|
|
1000
|
+
/** @description Operator note, e.g. why deposits are paused. */
|
|
1001
|
+
notice?: string | null;
|
|
1002
|
+
/**
|
|
1003
|
+
* @description Uppercase ticker.
|
|
1004
|
+
* @example BTC
|
|
1005
|
+
*/
|
|
1006
|
+
symbol: string;
|
|
1007
|
+
/** @description Whether the asset may appear in markets. */
|
|
1008
|
+
trading_enabled: boolean;
|
|
1009
|
+
usd_price: components["schemas"]["Amount"];
|
|
1010
|
+
/**
|
|
1011
|
+
* @description Whether that price is too old to compute with.
|
|
1012
|
+
*
|
|
1013
|
+
* When true, the exchange refuses to derive anything from it: daily limits and auto-approval fail closed rather than guess, and a stored USD value is recorded as absent rather than as a confident wrong figure.
|
|
1014
|
+
*/
|
|
1015
|
+
usd_price_stale: boolean;
|
|
1016
|
+
/**
|
|
1017
|
+
* Format: date-time
|
|
1018
|
+
* @description When that price was last set.
|
|
1019
|
+
*
|
|
1020
|
+
* Exposed because the price is typed in by an operator and refreshed by nothing — there is no feed. Without the timestamp a caller cannot tell a price set an hour ago from one set last month, and both look equally authoritative.
|
|
1021
|
+
*/
|
|
1022
|
+
usd_price_updated_at: string;
|
|
1023
|
+
/** @description Project website. */
|
|
1024
|
+
website_url?: string | null;
|
|
1025
|
+
};
|
|
1026
|
+
/** @description A balance in one asset. */
|
|
1027
|
+
BalanceResponse: {
|
|
1028
|
+
/** @description Asset symbol. */
|
|
1029
|
+
asset: string;
|
|
1030
|
+
available: components["schemas"]["Amount"];
|
|
1031
|
+
locked: components["schemas"]["Amount"];
|
|
1032
|
+
pending: components["schemas"]["Amount"];
|
|
1033
|
+
total: components["schemas"]["Amount"];
|
|
1034
|
+
};
|
|
1035
|
+
/** @description Cancels every open order, optionally within one market. */
|
|
1036
|
+
CancelAllRequest: {
|
|
1037
|
+
/** @description Limit the cancellation to one market. Omitted or `null`, every market's open orders are cancelled. */
|
|
1038
|
+
symbol?: string | null;
|
|
1039
|
+
};
|
|
1040
|
+
/** @description What a bulk cancellation achieved. */
|
|
1041
|
+
CancelAllResponse: {
|
|
1042
|
+
/** @description Orders cancelled. */
|
|
1043
|
+
cancelled: string[];
|
|
1044
|
+
/** @description Orders that could not be cancelled. Each failure is logged server-side. */
|
|
1045
|
+
failed: string[];
|
|
1046
|
+
};
|
|
1047
|
+
/**
|
|
1048
|
+
* @description Candle/kline intervals for market data.
|
|
1049
|
+
* @enum {string}
|
|
1050
|
+
*/
|
|
1051
|
+
CandleInterval: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "1d" | "1w";
|
|
1052
|
+
/** @description An OHLCV bucket. */
|
|
1053
|
+
CandleResponse: {
|
|
1054
|
+
close: components["schemas"]["Amount"];
|
|
1055
|
+
high: components["schemas"]["Amount"];
|
|
1056
|
+
low: components["schemas"]["Amount"];
|
|
1057
|
+
open: components["schemas"]["Amount"];
|
|
1058
|
+
/**
|
|
1059
|
+
* Format: date-time
|
|
1060
|
+
* @description Bucket start.
|
|
1061
|
+
*/
|
|
1062
|
+
open_time: string;
|
|
1063
|
+
quote_volume: components["schemas"]["Amount"];
|
|
1064
|
+
/**
|
|
1065
|
+
* Format: int64
|
|
1066
|
+
* @description Number of trades.
|
|
1067
|
+
*/
|
|
1068
|
+
trade_count: number;
|
|
1069
|
+
volume: components["schemas"]["Amount"];
|
|
1070
|
+
};
|
|
1071
|
+
/** @description A deposit address. */
|
|
1072
|
+
DepositAddressResponse: {
|
|
1073
|
+
/** @description The address to send to. */
|
|
1074
|
+
address: string;
|
|
1075
|
+
/** @description Asset symbol. */
|
|
1076
|
+
asset: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Format: date-time
|
|
1079
|
+
* @description When the address was issued.
|
|
1080
|
+
*/
|
|
1081
|
+
created_at: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Format: int32
|
|
1084
|
+
* @description Confirmations before the deposit is credited.
|
|
1085
|
+
*/
|
|
1086
|
+
deposit_confirmations: number;
|
|
1087
|
+
/** @description Memo / destination tag. **Required when present** — a deposit without it may be unrecoverable. */
|
|
1088
|
+
memo?: string | null;
|
|
1089
|
+
/** @description What to call the memo field in a UI. */
|
|
1090
|
+
memo_label?: string | null;
|
|
1091
|
+
min_deposit: components["schemas"]["Amount"];
|
|
1092
|
+
/** @description Network code. */
|
|
1093
|
+
network: string;
|
|
1094
|
+
};
|
|
1095
|
+
/** @description A deposit. */
|
|
1096
|
+
DepositResponse: {
|
|
1097
|
+
/** @description Address that received it. */
|
|
1098
|
+
address: string;
|
|
1099
|
+
amount: components["schemas"]["Amount"];
|
|
1100
|
+
/** @description Asset symbol. */
|
|
1101
|
+
asset: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Format: int32
|
|
1104
|
+
* @description Confirmations observed.
|
|
1105
|
+
*/
|
|
1106
|
+
confirmations: number;
|
|
1107
|
+
/**
|
|
1108
|
+
* Format: date-time
|
|
1109
|
+
* @description When it was credited.
|
|
1110
|
+
*/
|
|
1111
|
+
credited_at?: string | null;
|
|
1112
|
+
/** @description Explorer link, when the network has one configured. */
|
|
1113
|
+
explorer_url?: string | null;
|
|
1114
|
+
/**
|
|
1115
|
+
* Format: date-time
|
|
1116
|
+
* @description When it was first observed.
|
|
1117
|
+
*/
|
|
1118
|
+
first_seen_at: string;
|
|
1119
|
+
/** @description Deposit id. */
|
|
1120
|
+
id: string;
|
|
1121
|
+
/** @description Memo, if any. */
|
|
1122
|
+
memo?: string | null;
|
|
1123
|
+
/** @description Network code. */
|
|
1124
|
+
network: string;
|
|
1125
|
+
/** @description Operator note, e.g. why it was reversed. */
|
|
1126
|
+
note?: string | null;
|
|
1127
|
+
/**
|
|
1128
|
+
* Format: int32
|
|
1129
|
+
* @description Position within the transaction. Distinguishes two outputs of one transaction.
|
|
1130
|
+
*/
|
|
1131
|
+
output_index: number;
|
|
1132
|
+
/**
|
|
1133
|
+
* Format: int32
|
|
1134
|
+
* @description Confirmations required to credit.
|
|
1135
|
+
*/
|
|
1136
|
+
required_confirmations: number;
|
|
1137
|
+
status: components["schemas"]["DepositStatus"];
|
|
1138
|
+
/** @description Transaction hash. */
|
|
1139
|
+
txid: string;
|
|
1140
|
+
};
|
|
1141
|
+
/**
|
|
1142
|
+
* @description Lifecycle of an incoming blockchain deposit.
|
|
1143
|
+
* @enum {string}
|
|
1144
|
+
*/
|
|
1145
|
+
DepositStatus: "detected" | "credited" | "reversed" | "orphaned" | "below_minimum" | "under_review" | "internal";
|
|
1146
|
+
/** @description A structured value attached to an error. Kept deliberately narrow so that no accidental secret (a token, a key, a full document) can be attached. */
|
|
1147
|
+
DetailValue: string | number | boolean;
|
|
1148
|
+
/** @description The `error` object as it appears on the wire. */
|
|
1149
|
+
ErrorBody: {
|
|
1150
|
+
code: components["schemas"]["ErrorCode"];
|
|
1151
|
+
/** @description Structured context, when available. */
|
|
1152
|
+
details?: {
|
|
1153
|
+
[key: string]: components["schemas"]["DetailValue"];
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* @description Per-field validation messages, keyed by request field name.
|
|
1157
|
+
*
|
|
1158
|
+
* Present only on validation failures. Render each message beside its input.
|
|
1159
|
+
*/
|
|
1160
|
+
fields?: {
|
|
1161
|
+
[key: string]: string;
|
|
1162
|
+
};
|
|
1163
|
+
/** @description Human-readable description. May change between releases. */
|
|
1164
|
+
message: string;
|
|
1165
|
+
/** @description Correlates this response with server logs. Quote it in support requests. */
|
|
1166
|
+
request_id?: string | null;
|
|
1167
|
+
/** @description Whether an identical retry could succeed. */
|
|
1168
|
+
retryable: boolean;
|
|
1169
|
+
};
|
|
1170
|
+
/**
|
|
1171
|
+
* @description Stable, machine-readable error identifiers.
|
|
1172
|
+
*
|
|
1173
|
+
* Serialized as `SCREAMING_SNAKE_CASE`. Adding a variant is backwards-compatible; renaming or removing one is a breaking API change.
|
|
1174
|
+
* @enum {string}
|
|
1175
|
+
*/
|
|
1176
|
+
ErrorCode: "VALIDATION_FAILED" | "MALFORMED_REQUEST" | "INVALID_CURSOR" | "PRECISION_EXCEEDED" | "BELOW_MINIMUM" | "ABOVE_MAXIMUM" | "INVALID_ADDRESS" | "MEMO_REQUIRED" | "UNAUTHENTICATED" | "INVALID_CREDENTIALS" | "TOKEN_EXPIRED" | "SESSION_REVOKED" | "TWO_FACTOR_REQUIRED" | "TWO_FACTOR_INVALID" | "FRESH_TWO_FACTOR_REQUIRED" | "FORBIDDEN" | "API_KEY_NOT_ALLOWED" | "FUTURES_RESTRICTED" | "ACCOUNT_FROZEN" | "ACCOUNT_ON_HOLD" | "EMAIL_NOT_VERIFIED" | "REGION_BLOCKED" | "JURISDICTION_BLOCKED" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "ALREADY_EXISTS" | "INVALID_STATE" | "IDEMPOTENCY_KEY_CONFLICT" | "WINDOW_OPEN" | "EVIDENCE_CONTRADICTS" | "AMOUNT_MISMATCH" | "CONCURRENT_MODIFICATION" | "INSUFFICIENT_FUNDS" | "INSUFFICIENT_FEE_FUNDS" | "MARKET_UNAVAILABLE" | "DEPOSIT_DISABLED" | "WITHDRAWAL_DISABLED" | "SELF_TRADE_BLOCKED" | "LIMIT_EXCEEDED" | "RATE_LIMITED" | "INTERNAL" | "SERVICE_UNAVAILABLE" | "UNDER_MAINTENANCE" | "ENGINE_OVERLOADED";
|
|
1177
|
+
/** @description The top-level error envelope. */
|
|
1178
|
+
ErrorResponse: {
|
|
1179
|
+
error: components["schemas"]["ErrorBody"];
|
|
1180
|
+
};
|
|
1181
|
+
/**
|
|
1182
|
+
* @description Public exchange configuration.
|
|
1183
|
+
*
|
|
1184
|
+
* Everything a frontend needs to render itself without a deploy: branding, limits, supported intervals, and whether the exchange is in maintenance.
|
|
1185
|
+
*/
|
|
1186
|
+
ExchangeConfigResponse: {
|
|
1187
|
+
/** @description Candle intervals the API serves. */
|
|
1188
|
+
candle_intervals: components["schemas"]["CandleInterval"][];
|
|
1189
|
+
/**
|
|
1190
|
+
* Format: int32
|
|
1191
|
+
* @description Default page size for paginated endpoints.
|
|
1192
|
+
*/
|
|
1193
|
+
default_page_size: number;
|
|
1194
|
+
/** @description Whether registration verifies the email address with an emailed code before the authenticator step. Lets a signup form show the right number of steps up front. */
|
|
1195
|
+
email_verification_required: boolean;
|
|
1196
|
+
/**
|
|
1197
|
+
* @description Feature flags a frontend may use to hide unavailable functionality.
|
|
1198
|
+
*
|
|
1199
|
+
* Presentation only. The backend enforces every rule independently.
|
|
1200
|
+
*/
|
|
1201
|
+
features: {
|
|
1202
|
+
[key: string]: boolean;
|
|
1203
|
+
};
|
|
1204
|
+
/** @description Message to show while in maintenance. */
|
|
1205
|
+
maintenance_message?: string | null;
|
|
1206
|
+
/** @description Whether the exchange is in maintenance mode. */
|
|
1207
|
+
maintenance_mode: boolean;
|
|
1208
|
+
/**
|
|
1209
|
+
* Format: int32
|
|
1210
|
+
* @description Maximum page size.
|
|
1211
|
+
*/
|
|
1212
|
+
max_page_size: number;
|
|
1213
|
+
/** @description Display name. */
|
|
1214
|
+
name: string;
|
|
1215
|
+
password_rules: components["schemas"]["PasswordRules"];
|
|
1216
|
+
/** @description Whether new registrations are accepted. */
|
|
1217
|
+
registration_enabled: boolean;
|
|
1218
|
+
/** @description Support contact. */
|
|
1219
|
+
support_url?: string | null;
|
|
1220
|
+
/**
|
|
1221
|
+
* Format: int64
|
|
1222
|
+
* @description Seconds a verified two-factor code authorises sensitive actions for.
|
|
1223
|
+
*/
|
|
1224
|
+
two_factor_freshness_seconds: number;
|
|
1225
|
+
/** @description Where to open the realtime connection, relative to this API's origin. */
|
|
1226
|
+
websocket_path: string;
|
|
1227
|
+
/**
|
|
1228
|
+
* Format: int32
|
|
1229
|
+
* @description The realtime protocol version this server speaks.
|
|
1230
|
+
*/
|
|
1231
|
+
websocket_protocol_version: number;
|
|
1232
|
+
};
|
|
1233
|
+
/** @description Removes liquidity from a pool. */
|
|
1234
|
+
ExitPoolRequest: {
|
|
1235
|
+
shares: components["schemas"]["Amount"];
|
|
1236
|
+
};
|
|
1237
|
+
/** @description What an exit produced. */
|
|
1238
|
+
ExitPoolResponse: {
|
|
1239
|
+
base_returned: components["schemas"]["Amount"];
|
|
1240
|
+
quote_returned: components["schemas"]["Amount"];
|
|
1241
|
+
shares_burned: components["schemas"]["Amount"];
|
|
1242
|
+
shares_held: components["schemas"]["Amount"];
|
|
1243
|
+
};
|
|
1244
|
+
/** @description A fee tier. */
|
|
1245
|
+
FeeScheduleResponse: {
|
|
1246
|
+
/** @description Human label. */
|
|
1247
|
+
label: string;
|
|
1248
|
+
/**
|
|
1249
|
+
* @description Maker rate, as a percentage.
|
|
1250
|
+
* @example 0.1
|
|
1251
|
+
*/
|
|
1252
|
+
maker_fee_percent: string;
|
|
1253
|
+
min_30d_volume_usd: components["schemas"]["Amount"];
|
|
1254
|
+
/**
|
|
1255
|
+
* @description Taker rate, as a percentage.
|
|
1256
|
+
* @example 0.2
|
|
1257
|
+
*/
|
|
1258
|
+
taker_fee_percent: string;
|
|
1259
|
+
/**
|
|
1260
|
+
* Format: int32
|
|
1261
|
+
* @description Tier index.
|
|
1262
|
+
*/
|
|
1263
|
+
tier: number;
|
|
1264
|
+
};
|
|
1265
|
+
/** @description One of the caller's executions. */
|
|
1266
|
+
FillResponse: {
|
|
1267
|
+
fee: components["schemas"]["Amount"];
|
|
1268
|
+
/** @description Asset the fee was charged in. */
|
|
1269
|
+
fee_asset: string;
|
|
1270
|
+
/** @description The caller's order. */
|
|
1271
|
+
order_id: string;
|
|
1272
|
+
price: components["schemas"]["Amount"];
|
|
1273
|
+
quantity: components["schemas"]["Amount"];
|
|
1274
|
+
quote_quantity: components["schemas"]["Amount"];
|
|
1275
|
+
role: components["schemas"]["LiquidityRole"];
|
|
1276
|
+
side: components["schemas"]["OrderSide"];
|
|
1277
|
+
/** @description Market symbol. */
|
|
1278
|
+
symbol: string;
|
|
1279
|
+
/**
|
|
1280
|
+
* Format: date-time
|
|
1281
|
+
* @description When it executed.
|
|
1282
|
+
*/
|
|
1283
|
+
timestamp: string;
|
|
1284
|
+
/** @description Trade id. */
|
|
1285
|
+
trade_id: string;
|
|
1286
|
+
};
|
|
1287
|
+
/** @description Adds liquidity to a pool. */
|
|
1288
|
+
JoinPoolRequest: {
|
|
1289
|
+
base_amount: components["schemas"]["Amount"];
|
|
1290
|
+
/**
|
|
1291
|
+
* @description How far, in percent, the offered ratio may sit from the pool's own before the request is refused rather than repriced. Defaults to 1%.
|
|
1292
|
+
* @example 1
|
|
1293
|
+
*/
|
|
1294
|
+
max_ratio_deviation_percent?: string | null;
|
|
1295
|
+
quote_amount: components["schemas"]["Amount"];
|
|
1296
|
+
};
|
|
1297
|
+
/** @description What a join produced. */
|
|
1298
|
+
JoinPoolResponse: {
|
|
1299
|
+
base_deposited: components["schemas"]["Amount"];
|
|
1300
|
+
quote_deposited: components["schemas"]["Amount"];
|
|
1301
|
+
shares_held: components["schemas"]["Amount"];
|
|
1302
|
+
shares_minted: components["schemas"]["Amount"];
|
|
1303
|
+
};
|
|
1304
|
+
/**
|
|
1305
|
+
* @description What a ledger entry records.
|
|
1306
|
+
* @enum {string}
|
|
1307
|
+
*/
|
|
1308
|
+
LedgerEntryKind: "deposit" | "deposit_reversal" | "withdrawal_debit" | "withdrawal_fee" | "withdrawal_fee_reserve" | "withdrawal_release" | "withdrawal_fee_release" | "order_reserve" | "withdrawal_reserve" | "order_release" | "trade_debit" | "trade_credit" | "trade_fee" | "transfer_out" | "transfer_in" | "adjustment_credit" | "adjustment_debit" | "rebate" | "pool_join" | "pool_exit" | "futures_transfer_reserve" | "futures_transfer_release" | "futures_collateral_sent" | "futures_collateral_returned" | "trade_fee_revenue" | "withdrawal_fee_revenue" | "futures_transfer_fee_revenue" | "futures_hyperliquid_cost" | "futures_transfer_discrepancy" | "exchange_capital";
|
|
1309
|
+
/** @description One entry from the account's ledger. */
|
|
1310
|
+
LedgerEntryResponse: {
|
|
1311
|
+
/** @description Asset symbol. */
|
|
1312
|
+
asset: string;
|
|
1313
|
+
available_after: components["schemas"]["Amount"];
|
|
1314
|
+
available_delta: components["schemas"]["Amount"];
|
|
1315
|
+
/**
|
|
1316
|
+
* Format: date-time
|
|
1317
|
+
* @description When it was applied.
|
|
1318
|
+
*/
|
|
1319
|
+
created_at: string;
|
|
1320
|
+
/** @description Entry id. */
|
|
1321
|
+
id: string;
|
|
1322
|
+
kind: components["schemas"]["LedgerEntryKind"];
|
|
1323
|
+
locked_delta: components["schemas"]["Amount"];
|
|
1324
|
+
pending_delta: components["schemas"]["Amount"];
|
|
1325
|
+
/** @description What caused the entry. */
|
|
1326
|
+
reference: unknown;
|
|
1327
|
+
/**
|
|
1328
|
+
* Format: int64
|
|
1329
|
+
* @description Position in this account's history for this asset.
|
|
1330
|
+
*/
|
|
1331
|
+
sequence: number;
|
|
1332
|
+
};
|
|
1333
|
+
/**
|
|
1334
|
+
* @description Whether a fill added liquidity (maker) or removed it (taker).
|
|
1335
|
+
* @enum {string}
|
|
1336
|
+
*/
|
|
1337
|
+
LiquidityRole: "maker" | "taker";
|
|
1338
|
+
/**
|
|
1339
|
+
* @description Machine-readable reasons a capability is unavailable.
|
|
1340
|
+
* @enum {string}
|
|
1341
|
+
*/
|
|
1342
|
+
MaintenanceReason: "exchange_maintenance" | "network_unavailable" | "deposits_disabled" | "withdrawals_disabled" | "asset_unavailable";
|
|
1343
|
+
/** @description Why a capability is currently unavailable. */
|
|
1344
|
+
MaintenanceState: {
|
|
1345
|
+
/** @description Operator-supplied explanation, when there is one. */
|
|
1346
|
+
message?: string | null;
|
|
1347
|
+
reason: components["schemas"]["MaintenanceReason"];
|
|
1348
|
+
};
|
|
1349
|
+
/** @description A tradable market and its current ticker. */
|
|
1350
|
+
MarketResponse: {
|
|
1351
|
+
/** @description Base asset symbol. */
|
|
1352
|
+
base_asset: string;
|
|
1353
|
+
best_ask: components["schemas"]["Amount"];
|
|
1354
|
+
best_bid: components["schemas"]["Amount"];
|
|
1355
|
+
change_24h_percent: components["schemas"]["Amount"];
|
|
1356
|
+
high_24h: components["schemas"]["Amount"];
|
|
1357
|
+
last_price: components["schemas"]["Amount"];
|
|
1358
|
+
/**
|
|
1359
|
+
* Format: date-time
|
|
1360
|
+
* @description Time of the most recent trade.
|
|
1361
|
+
*/
|
|
1362
|
+
last_trade_at?: string | null;
|
|
1363
|
+
lot_size: components["schemas"]["Amount"];
|
|
1364
|
+
low_24h: components["schemas"]["Amount"];
|
|
1365
|
+
max_quantity?: components["schemas"]["Amount"] | null;
|
|
1366
|
+
min_notional: components["schemas"]["Amount"];
|
|
1367
|
+
min_quantity: components["schemas"]["Amount"];
|
|
1368
|
+
/**
|
|
1369
|
+
* Format: int32
|
|
1370
|
+
* @description Decimal places a price may carry.
|
|
1371
|
+
*/
|
|
1372
|
+
price_decimals: number;
|
|
1373
|
+
/**
|
|
1374
|
+
* Format: int32
|
|
1375
|
+
* @description Decimal places a quantity may carry.
|
|
1376
|
+
*/
|
|
1377
|
+
quantity_decimals: number;
|
|
1378
|
+
/** @description Quote asset symbol. */
|
|
1379
|
+
quote_asset: string;
|
|
1380
|
+
quote_volume_24h: components["schemas"]["Amount"];
|
|
1381
|
+
status: components["schemas"]["MarketStatus"];
|
|
1382
|
+
/** @description Order types this market accepts. */
|
|
1383
|
+
supported_order_types: components["schemas"]["OrderType"][];
|
|
1384
|
+
/** @description Time-in-force options this market accepts. */
|
|
1385
|
+
supported_time_in_force: components["schemas"]["TimeInForce"][];
|
|
1386
|
+
/**
|
|
1387
|
+
* @description `BASE/QUOTE`.
|
|
1388
|
+
* @example BTC/USDT
|
|
1389
|
+
*/
|
|
1390
|
+
symbol: string;
|
|
1391
|
+
tick_size: components["schemas"]["Amount"];
|
|
1392
|
+
/**
|
|
1393
|
+
* Format: date-time
|
|
1394
|
+
* @description When trading opens, for a market not yet live.
|
|
1395
|
+
*/
|
|
1396
|
+
trading_starts_at?: string | null;
|
|
1397
|
+
volume_24h: components["schemas"]["Amount"];
|
|
1398
|
+
};
|
|
1399
|
+
/**
|
|
1400
|
+
* @description Trading availability of a market.
|
|
1401
|
+
* @enum {string}
|
|
1402
|
+
*/
|
|
1403
|
+
MarketStatus: "active" | "paused" | "sell_only" | "pre_trading" | "delisted";
|
|
1404
|
+
/** @description A blockchain network. */
|
|
1405
|
+
NetworkResponse: {
|
|
1406
|
+
/**
|
|
1407
|
+
* Format: int32
|
|
1408
|
+
* @description Typical seconds between blocks, for estimating confirmation time.
|
|
1409
|
+
*/
|
|
1410
|
+
average_block_seconds: number;
|
|
1411
|
+
/**
|
|
1412
|
+
* @description Stable code.
|
|
1413
|
+
* @example bitcoin-mainnet
|
|
1414
|
+
*/
|
|
1415
|
+
code: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* @description Whether deposits on this network are actually being detected.
|
|
1418
|
+
*
|
|
1419
|
+
* False means either half of the pipeline is down: the last scan pass failed — a refused block range, a rate limit, a node that answers but will not serve logs — or finality could not be established, so deposits are being held rather than credited.
|
|
1420
|
+
*
|
|
1421
|
+
* Deposits sent now will be credited late, whenever the chain recovers, rather than lost. This is the field a status page should use to say deposits are degraded; `reachable` only says the node replies, which it may well do while yielding nothing.
|
|
1422
|
+
*/
|
|
1423
|
+
deposits_operational: boolean;
|
|
1424
|
+
/** @description Template for an address explorer link. `{address}` is substituted. */
|
|
1425
|
+
explorer_address_url_template?: string | null;
|
|
1426
|
+
/**
|
|
1427
|
+
* @description Template for a transaction explorer link. `{txid}` is substituted.
|
|
1428
|
+
*
|
|
1429
|
+
* Absent when the operator has configured none; render no link rather than guessing a URL.
|
|
1430
|
+
*/
|
|
1431
|
+
explorer_tx_url_template?: string | null;
|
|
1432
|
+
/** @description Whether the network is operational. */
|
|
1433
|
+
is_active: boolean;
|
|
1434
|
+
/** @description Display name. */
|
|
1435
|
+
name: string;
|
|
1436
|
+
/**
|
|
1437
|
+
* @description Whether the node answers at all.
|
|
1438
|
+
*
|
|
1439
|
+
* Narrower than it sounds, and deliberately so: a reachable node can still be failing to yield deposits. Do not render this alone as "network up".
|
|
1440
|
+
*/
|
|
1441
|
+
reachable: boolean;
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* @description What a notice is about.
|
|
1445
|
+
*
|
|
1446
|
+
* A closed enum so a client can render each kind deliberately — an icon, a colour, a link — rather than pattern-matching on prose that may be reworded.
|
|
1447
|
+
* @enum {string}
|
|
1448
|
+
*/
|
|
1449
|
+
NotificationKind: "deposit_detected" | "deposit_credited" | "withdrawal_requested" | "withdrawal_sent" | "withdrawal_completed" | "withdrawal_failed" | "order_filled" | "security" | "listing_decision" | "announcement";
|
|
1450
|
+
/** @description An in-app notice. */
|
|
1451
|
+
NotificationResponse: {
|
|
1452
|
+
/** @description One or two sentences. */
|
|
1453
|
+
body: string;
|
|
1454
|
+
/**
|
|
1455
|
+
* Format: date-time
|
|
1456
|
+
* @description When it was created.
|
|
1457
|
+
*/
|
|
1458
|
+
created_at: string;
|
|
1459
|
+
/** @description Notice id. */
|
|
1460
|
+
id: string;
|
|
1461
|
+
kind: components["schemas"]["NotificationKind"];
|
|
1462
|
+
/** @description Whether it has been read. */
|
|
1463
|
+
read: boolean;
|
|
1464
|
+
/** @description The referenced resource's opaque id, for linking. */
|
|
1465
|
+
resource_id?: string | null;
|
|
1466
|
+
/** @description What it refers to: `deposit`, `withdrawal`, `order`. */
|
|
1467
|
+
resource_type?: string | null;
|
|
1468
|
+
/** @description Short heading. */
|
|
1469
|
+
title: string;
|
|
1470
|
+
};
|
|
1471
|
+
/** @description One side of the order book, aggregated by price. */
|
|
1472
|
+
OrderBookResponse: {
|
|
1473
|
+
/** @description Asks, best first. */
|
|
1474
|
+
asks: components["schemas"]["Amount"][][];
|
|
1475
|
+
/** @description Bids, best first, as `[price, quantity]` pairs. */
|
|
1476
|
+
bids: components["schemas"]["Amount"][][];
|
|
1477
|
+
/**
|
|
1478
|
+
* Format: int64
|
|
1479
|
+
* @description The realtime sequence this snapshot is current as of.
|
|
1480
|
+
*
|
|
1481
|
+
* Each `orderbook.update` on the `orderbook:{symbol}` websocket channel carries both sides of the top 50 levels in full (`data.full` is always `true`) and replaces the previous state; there are no deltas to buffer. Ignore an update whose `sequence` is at or below the one you hold. A gap only means a book was missed: the next update replaces it whole.
|
|
1482
|
+
*/
|
|
1483
|
+
sequence: number;
|
|
1484
|
+
/** @description Market symbol. */
|
|
1485
|
+
symbol: string;
|
|
1486
|
+
/**
|
|
1487
|
+
* Format: date-time
|
|
1488
|
+
* @description When this snapshot was taken.
|
|
1489
|
+
*/
|
|
1490
|
+
timestamp: string;
|
|
1491
|
+
};
|
|
1492
|
+
/** @description An order. */
|
|
1493
|
+
OrderResponse: {
|
|
1494
|
+
average_price?: components["schemas"]["Amount"] | null;
|
|
1495
|
+
/** @description Your identifier, if you supplied one. */
|
|
1496
|
+
client_order_id?: string | null;
|
|
1497
|
+
/**
|
|
1498
|
+
* Format: date-time
|
|
1499
|
+
* @description When it reached a terminal state.
|
|
1500
|
+
*/
|
|
1501
|
+
closed_at?: string | null;
|
|
1502
|
+
/**
|
|
1503
|
+
* Format: date-time
|
|
1504
|
+
* @description When it was placed.
|
|
1505
|
+
*/
|
|
1506
|
+
created_at: string;
|
|
1507
|
+
/** @description Asset the fees were charged in. */
|
|
1508
|
+
fee_asset?: string | null;
|
|
1509
|
+
fee_paid: components["schemas"]["Amount"];
|
|
1510
|
+
filled_quantity: components["schemas"]["Amount"];
|
|
1511
|
+
filled_quote_quantity: components["schemas"]["Amount"];
|
|
1512
|
+
/** @description Order id. */
|
|
1513
|
+
id: string;
|
|
1514
|
+
price?: components["schemas"]["Amount"] | null;
|
|
1515
|
+
quantity: components["schemas"]["Amount"];
|
|
1516
|
+
quote_quantity?: components["schemas"]["Amount"] | null;
|
|
1517
|
+
remaining_quantity: components["schemas"]["Amount"];
|
|
1518
|
+
reserved_remaining: components["schemas"]["Amount"];
|
|
1519
|
+
side: components["schemas"]["OrderSide"];
|
|
1520
|
+
status: components["schemas"]["OrderStatus"];
|
|
1521
|
+
/** @description Why the order was rejected or cancelled. */
|
|
1522
|
+
status_reason?: string | null;
|
|
1523
|
+
stop_price?: components["schemas"]["Amount"] | null;
|
|
1524
|
+
/** @description Market symbol. */
|
|
1525
|
+
symbol: string;
|
|
1526
|
+
time_in_force: components["schemas"]["TimeInForce"];
|
|
1527
|
+
trigger_direction?: components["schemas"]["TriggerDirection"] | null;
|
|
1528
|
+
/**
|
|
1529
|
+
* Format: date-time
|
|
1530
|
+
* @description When the trigger fired, if it has.
|
|
1531
|
+
*/
|
|
1532
|
+
triggered_at?: string | null;
|
|
1533
|
+
type: components["schemas"]["OrderType"];
|
|
1534
|
+
/**
|
|
1535
|
+
* Format: date-time
|
|
1536
|
+
* @description When it last changed.
|
|
1537
|
+
*/
|
|
1538
|
+
updated_at: string;
|
|
1539
|
+
};
|
|
1540
|
+
/**
|
|
1541
|
+
* @description Which side of a market an order takes.
|
|
1542
|
+
* @enum {string}
|
|
1543
|
+
*/
|
|
1544
|
+
OrderSide: "buy" | "sell";
|
|
1545
|
+
/**
|
|
1546
|
+
* @description Lifecycle of an order.
|
|
1547
|
+
* @enum {string}
|
|
1548
|
+
*/
|
|
1549
|
+
OrderStatus: "pending" | "open" | "partially_filled" | "filled" | "cancelled" | "rejected" | "pending_trigger" | "expired";
|
|
1550
|
+
/**
|
|
1551
|
+
* @description Order types the matching engine accepts.
|
|
1552
|
+
* @enum {string}
|
|
1553
|
+
*/
|
|
1554
|
+
OrderType: "limit" | "market" | "stop_limit" | "stop_market";
|
|
1555
|
+
/** @description Password constraints, published so a form can validate locally. */
|
|
1556
|
+
PasswordRules: {
|
|
1557
|
+
/** @description Whether the password may contain the account's email address. */
|
|
1558
|
+
allows_email_substring: boolean;
|
|
1559
|
+
/** @description A short description of any further rules, for display beside the input. */
|
|
1560
|
+
description: string;
|
|
1561
|
+
/** @description Maximum length in characters. */
|
|
1562
|
+
max_length: number;
|
|
1563
|
+
/** @description Minimum length in characters. */
|
|
1564
|
+
min_length: number;
|
|
1565
|
+
};
|
|
1566
|
+
/**
|
|
1567
|
+
* @description Places an order.
|
|
1568
|
+
*
|
|
1569
|
+
* Set `client_order_id` to make a retry safe: it is unique per account, so a repeat is refused before any funds move, and `GET /trading/orders/by-client-id/{client_order_id}` recovers the outcome. `Idempotency-Key` is not honoured for orders.
|
|
1570
|
+
*/
|
|
1571
|
+
PlaceOrderRequest: {
|
|
1572
|
+
/** @description Your own identifier. Unique per account. */
|
|
1573
|
+
client_order_id?: string | null;
|
|
1574
|
+
price?: components["schemas"]["Amount"] | null;
|
|
1575
|
+
quantity?: components["schemas"]["Amount"] | null;
|
|
1576
|
+
quote_quantity?: components["schemas"]["Amount"] | null;
|
|
1577
|
+
side: components["schemas"]["OrderSide"];
|
|
1578
|
+
stop_price?: components["schemas"]["Amount"] | null;
|
|
1579
|
+
/**
|
|
1580
|
+
* @description Market symbol.
|
|
1581
|
+
* @example BTC/USDT
|
|
1582
|
+
*/
|
|
1583
|
+
symbol: string;
|
|
1584
|
+
time_in_force?: components["schemas"]["TimeInForce"] | null;
|
|
1585
|
+
trigger_direction?: components["schemas"]["TriggerDirection"] | null;
|
|
1586
|
+
type: components["schemas"]["OrderType"];
|
|
1587
|
+
};
|
|
1588
|
+
/** @description The result of placing an order, including anything it executed immediately. */
|
|
1589
|
+
PlaceOrderResponse: {
|
|
1590
|
+
/** @description Fills produced on entry, oldest first. */
|
|
1591
|
+
fills: components["schemas"]["FillResponse"][];
|
|
1592
|
+
order: components["schemas"]["OrderResponse"];
|
|
1593
|
+
};
|
|
1594
|
+
/**
|
|
1595
|
+
* @description A pool as a client sees it.
|
|
1596
|
+
*
|
|
1597
|
+
* Reserves are the custody account's balances, so they include liquidity currently locked in resting orders. `price` is the curve's mid, which sits between the pool's own best bid and ask by exactly its fee — it is not a traded price.
|
|
1598
|
+
*/
|
|
1599
|
+
PoolResponse: {
|
|
1600
|
+
base_reserve: components["schemas"]["Amount"];
|
|
1601
|
+
/**
|
|
1602
|
+
* Format: date-time
|
|
1603
|
+
* @description When the pool was created.
|
|
1604
|
+
*/
|
|
1605
|
+
created_at: string;
|
|
1606
|
+
/**
|
|
1607
|
+
* @description The pool's fee, in percent, priced into every quote it rests.
|
|
1608
|
+
* @example 0.3
|
|
1609
|
+
*/
|
|
1610
|
+
fee_percent: string;
|
|
1611
|
+
/** @description Identifier. */
|
|
1612
|
+
id: string;
|
|
1613
|
+
/**
|
|
1614
|
+
* Format: int32
|
|
1615
|
+
* @description Ladder steps per side.
|
|
1616
|
+
*/
|
|
1617
|
+
ladder_steps: number;
|
|
1618
|
+
price?: components["schemas"]["Amount"] | null;
|
|
1619
|
+
quote_reserve: components["schemas"]["Amount"];
|
|
1620
|
+
shares_outstanding: components["schemas"]["Amount"];
|
|
1621
|
+
status: components["schemas"]["PoolStatus"];
|
|
1622
|
+
/** @description Market the pool quotes. */
|
|
1623
|
+
symbol: string;
|
|
1624
|
+
};
|
|
1625
|
+
/**
|
|
1626
|
+
* @description Whether a pool quotes, and whether it accepts new liquidity.
|
|
1627
|
+
* @enum {string}
|
|
1628
|
+
*/
|
|
1629
|
+
PoolStatus: "active" | "paused" | "closing";
|
|
1630
|
+
/**
|
|
1631
|
+
* @description A public trade.
|
|
1632
|
+
*
|
|
1633
|
+
* Deliberately anonymous: no account identifiers, and no indication of which side was the resting order beyond the aggressor direction.
|
|
1634
|
+
*/
|
|
1635
|
+
PublicTradeResponse: {
|
|
1636
|
+
/** @description Trade id. */
|
|
1637
|
+
id: string;
|
|
1638
|
+
price: components["schemas"]["Amount"];
|
|
1639
|
+
quantity: components["schemas"]["Amount"];
|
|
1640
|
+
/**
|
|
1641
|
+
* Format: int64
|
|
1642
|
+
* @description Gapless per-market sequence.
|
|
1643
|
+
*/
|
|
1644
|
+
sequence: number;
|
|
1645
|
+
side: components["schemas"]["OrderSide"];
|
|
1646
|
+
/**
|
|
1647
|
+
* Format: date-time
|
|
1648
|
+
* @description When it executed.
|
|
1649
|
+
*/
|
|
1650
|
+
timestamp: string;
|
|
1651
|
+
};
|
|
1652
|
+
/**
|
|
1653
|
+
* @description The server's clock.
|
|
1654
|
+
*
|
|
1655
|
+
* Two-factor codes are time-based, so a client can compare its own clock against this before a skewed clock gets a correct code rejected.
|
|
1656
|
+
*/
|
|
1657
|
+
ServerTimeResponse: {
|
|
1658
|
+
/**
|
|
1659
|
+
* Format: int64
|
|
1660
|
+
* @description Current time in milliseconds since the Unix epoch.
|
|
1661
|
+
*/
|
|
1662
|
+
epoch_ms: number;
|
|
1663
|
+
/**
|
|
1664
|
+
* @description Current time as RFC 3339 with an explicit UTC offset.
|
|
1665
|
+
* @example 2024-05-01T12:34:56.789+00:00
|
|
1666
|
+
*/
|
|
1667
|
+
iso: string;
|
|
1668
|
+
};
|
|
1669
|
+
/**
|
|
1670
|
+
* @description Sort direction for a paginated listing.
|
|
1671
|
+
* @enum {string}
|
|
1672
|
+
*/
|
|
1673
|
+
SortDirection: "asc" | "desc";
|
|
1674
|
+
/** @description A sub-account. */
|
|
1675
|
+
SubAccountResponse: {
|
|
1676
|
+
/** @description Always `false`. A sub-account has no withdrawal path — stated explicitly so a client does not have to infer it. */
|
|
1677
|
+
can_withdraw: boolean;
|
|
1678
|
+
/**
|
|
1679
|
+
* Format: date-time
|
|
1680
|
+
* @description When it was created.
|
|
1681
|
+
*/
|
|
1682
|
+
created_at: string;
|
|
1683
|
+
/** @description Opaque identifier. Use it to transfer funds and to issue API keys. */
|
|
1684
|
+
id: string;
|
|
1685
|
+
/** @description Whether it may trade. */
|
|
1686
|
+
is_active: boolean;
|
|
1687
|
+
/** @description The label given at creation. */
|
|
1688
|
+
label: string;
|
|
1689
|
+
};
|
|
1690
|
+
/**
|
|
1691
|
+
* @description How long an order remains eligible to match.
|
|
1692
|
+
* @enum {string}
|
|
1693
|
+
*/
|
|
1694
|
+
TimeInForce: "gtc" | "ioc" | "fok" | "post_only";
|
|
1695
|
+
/**
|
|
1696
|
+
* @description Which way the price must move for a stop to fire.
|
|
1697
|
+
*
|
|
1698
|
+
* Explicit rather than inferred from the side, because the inference is ambiguous: a sell stop below the market is a stop-loss, and a sell stop above it is a take-profit. Both are legitimate, and guessing wrong means an order that fires at exactly the wrong moment — which is the one thing a protective order must never do.
|
|
1699
|
+
* @enum {string}
|
|
1700
|
+
*/
|
|
1701
|
+
TriggerDirection: "above" | "below";
|
|
1702
|
+
/** @description A saved withdrawal address. */
|
|
1703
|
+
WithdrawalAddressResponse: {
|
|
1704
|
+
/** @description The address. */
|
|
1705
|
+
address: string;
|
|
1706
|
+
/** @description Asset, when restricted to one. */
|
|
1707
|
+
asset?: string | null;
|
|
1708
|
+
/**
|
|
1709
|
+
* Format: date-time
|
|
1710
|
+
* @description When it was saved.
|
|
1711
|
+
*/
|
|
1712
|
+
created_at: string;
|
|
1713
|
+
/** @description Address-book entry id. */
|
|
1714
|
+
id: string;
|
|
1715
|
+
/** @description Your label. */
|
|
1716
|
+
label: string;
|
|
1717
|
+
/**
|
|
1718
|
+
* Format: date-time
|
|
1719
|
+
* @description When it was last withdrawn to.
|
|
1720
|
+
*/
|
|
1721
|
+
last_used_at?: string | null;
|
|
1722
|
+
/** @description Memo, if any. */
|
|
1723
|
+
memo?: string | null;
|
|
1724
|
+
/** @description Network code. */
|
|
1725
|
+
network: string;
|
|
1726
|
+
/** @description Whether ownership has been confirmed. */
|
|
1727
|
+
verified: boolean;
|
|
1728
|
+
};
|
|
1729
|
+
/** @description One transition in a withdrawal's life. */
|
|
1730
|
+
WithdrawalHistoryEntry: {
|
|
1731
|
+
/**
|
|
1732
|
+
* Format: date-time
|
|
1733
|
+
* @description When.
|
|
1734
|
+
*/
|
|
1735
|
+
at: string;
|
|
1736
|
+
/** @description Why, where a reason applies. */
|
|
1737
|
+
reason?: string | null;
|
|
1738
|
+
status: components["schemas"]["WithdrawalStatus"];
|
|
1739
|
+
};
|
|
1740
|
+
/** @description A withdrawal. */
|
|
1741
|
+
WithdrawalResponse: {
|
|
1742
|
+
/** @description Destination. */
|
|
1743
|
+
address: string;
|
|
1744
|
+
amount: components["schemas"]["Amount"];
|
|
1745
|
+
/** @description Asset symbol. */
|
|
1746
|
+
asset: string;
|
|
1747
|
+
/**
|
|
1748
|
+
* Format: date-time
|
|
1749
|
+
* @description When it was broadcast.
|
|
1750
|
+
*/
|
|
1751
|
+
broadcast_at?: string | null;
|
|
1752
|
+
/** @description Whether the account holder may still cancel it. */
|
|
1753
|
+
cancellable: boolean;
|
|
1754
|
+
/**
|
|
1755
|
+
* Format: date-time
|
|
1756
|
+
* @description When it confirmed to the required depth.
|
|
1757
|
+
*/
|
|
1758
|
+
completed_at?: string | null;
|
|
1759
|
+
/**
|
|
1760
|
+
* Format: int32
|
|
1761
|
+
* @description Confirmations observed.
|
|
1762
|
+
*/
|
|
1763
|
+
confirmations: number;
|
|
1764
|
+
/**
|
|
1765
|
+
* Format: date-time
|
|
1766
|
+
* @description When it was requested.
|
|
1767
|
+
*/
|
|
1768
|
+
created_at: string;
|
|
1769
|
+
/** @description Explorer link, when available. */
|
|
1770
|
+
explorer_url?: string | null;
|
|
1771
|
+
fee: components["schemas"]["Amount"];
|
|
1772
|
+
/** @description Asset the fee was charged in. */
|
|
1773
|
+
fee_asset: string;
|
|
1774
|
+
/** @description Transitions this withdrawal has been through. */
|
|
1775
|
+
history: components["schemas"]["WithdrawalHistoryEntry"][];
|
|
1776
|
+
/** @description Withdrawal id. */
|
|
1777
|
+
id: string;
|
|
1778
|
+
/** @description Memo, if any. */
|
|
1779
|
+
memo?: string | null;
|
|
1780
|
+
/** @description Network code. */
|
|
1781
|
+
network: string;
|
|
1782
|
+
status: components["schemas"]["WithdrawalStatus"];
|
|
1783
|
+
/** @description Transaction hash, once broadcast. */
|
|
1784
|
+
txid?: string | null;
|
|
1785
|
+
};
|
|
1786
|
+
/**
|
|
1787
|
+
* @description Lifecycle of an outgoing withdrawal.
|
|
1788
|
+
*
|
|
1789
|
+
*
|
|
1790
|
+
*
|
|
1791
|
+
* `pending_approval` waits for an operator to approve the withdrawal. `broadcast_unknown`
|
|
1792
|
+
* means the transaction may have been sent: the funds stay debited until it is resolved
|
|
1793
|
+
* against the chain.
|
|
1794
|
+
* @enum {string}
|
|
1795
|
+
*/
|
|
1796
|
+
WithdrawalStatus: "requested" | "pending_approval" | "approved" | "processing" | "broadcast" | "completed" | "rejected" | "cancelled" | "failed" | "broadcast_unknown";
|
|
1797
|
+
};
|
|
1798
|
+
responses: never;
|
|
1799
|
+
parameters: never;
|
|
1800
|
+
requestBodies: never;
|
|
1801
|
+
headers: never;
|
|
1802
|
+
pathItems: never;
|
|
1803
|
+
}
|
|
1804
|
+
interface operations {
|
|
1805
|
+
list_api_keys: {
|
|
1806
|
+
parameters: {
|
|
1807
|
+
query?: never;
|
|
1808
|
+
header?: never;
|
|
1809
|
+
path?: never;
|
|
1810
|
+
cookie?: never;
|
|
1811
|
+
};
|
|
1812
|
+
requestBody?: never;
|
|
1813
|
+
responses: {
|
|
1814
|
+
/** @description The account's keys, without secrets */
|
|
1815
|
+
200: {
|
|
1816
|
+
headers: {
|
|
1817
|
+
[name: string]: unknown;
|
|
1818
|
+
};
|
|
1819
|
+
content: {
|
|
1820
|
+
"application/json": {
|
|
1821
|
+
data: components["schemas"]["ApiKeyResponse"][];
|
|
1822
|
+
};
|
|
1823
|
+
};
|
|
1824
|
+
};
|
|
1825
|
+
};
|
|
1826
|
+
};
|
|
1827
|
+
list_balances: {
|
|
1828
|
+
parameters: {
|
|
1829
|
+
query?: never;
|
|
1830
|
+
header?: never;
|
|
1831
|
+
path?: never;
|
|
1832
|
+
cookie?: never;
|
|
1833
|
+
};
|
|
1834
|
+
requestBody?: never;
|
|
1835
|
+
responses: {
|
|
1836
|
+
/** @description Balances */
|
|
1837
|
+
200: {
|
|
1838
|
+
headers: {
|
|
1839
|
+
[name: string]: unknown;
|
|
1840
|
+
};
|
|
1841
|
+
content: {
|
|
1842
|
+
"application/json": {
|
|
1843
|
+
data: components["schemas"]["BalanceResponse"][];
|
|
1844
|
+
};
|
|
1845
|
+
};
|
|
1846
|
+
};
|
|
1847
|
+
};
|
|
1848
|
+
};
|
|
1849
|
+
get_balance: {
|
|
1850
|
+
parameters: {
|
|
1851
|
+
query?: never;
|
|
1852
|
+
header?: never;
|
|
1853
|
+
path: {
|
|
1854
|
+
/**
|
|
1855
|
+
* @description Asset symbol
|
|
1856
|
+
* @example BTC
|
|
1857
|
+
*/
|
|
1858
|
+
asset: string;
|
|
1859
|
+
};
|
|
1860
|
+
cookie?: never;
|
|
1861
|
+
};
|
|
1862
|
+
requestBody?: never;
|
|
1863
|
+
responses: {
|
|
1864
|
+
/** @description The balance */
|
|
1865
|
+
200: {
|
|
1866
|
+
headers: {
|
|
1867
|
+
[name: string]: unknown;
|
|
1868
|
+
};
|
|
1869
|
+
content: {
|
|
1870
|
+
"application/json": {
|
|
1871
|
+
data: components["schemas"]["BalanceResponse"];
|
|
1872
|
+
};
|
|
1873
|
+
};
|
|
1874
|
+
};
|
|
1875
|
+
/** @description No such asset */
|
|
1876
|
+
404: {
|
|
1877
|
+
headers: {
|
|
1878
|
+
[name: string]: unknown;
|
|
1879
|
+
};
|
|
1880
|
+
content: {
|
|
1881
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
1882
|
+
};
|
|
1883
|
+
};
|
|
1884
|
+
};
|
|
1885
|
+
};
|
|
1886
|
+
get_ledger: {
|
|
1887
|
+
parameters: {
|
|
1888
|
+
query?: {
|
|
1889
|
+
/** @description Limit to one asset. */
|
|
1890
|
+
asset?: string | null;
|
|
1891
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
1892
|
+
cursor?: string | null;
|
|
1893
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
1894
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
1895
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
1896
|
+
limit?: number | null;
|
|
1897
|
+
};
|
|
1898
|
+
header?: never;
|
|
1899
|
+
path?: never;
|
|
1900
|
+
cookie?: never;
|
|
1901
|
+
};
|
|
1902
|
+
requestBody?: never;
|
|
1903
|
+
responses: {
|
|
1904
|
+
/** @description Ledger entries */
|
|
1905
|
+
200: {
|
|
1906
|
+
headers: {
|
|
1907
|
+
[name: string]: unknown;
|
|
1908
|
+
};
|
|
1909
|
+
content: {
|
|
1910
|
+
"application/json": {
|
|
1911
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
1912
|
+
has_more: boolean;
|
|
1913
|
+
/** @description The page of items, in the requested direction. */
|
|
1914
|
+
items: components["schemas"]["LedgerEntryResponse"][];
|
|
1915
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
1916
|
+
next_cursor?: string;
|
|
1917
|
+
};
|
|
1918
|
+
};
|
|
1919
|
+
};
|
|
1920
|
+
};
|
|
1921
|
+
};
|
|
1922
|
+
list_notifications: {
|
|
1923
|
+
parameters: {
|
|
1924
|
+
query?: {
|
|
1925
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
1926
|
+
cursor?: string | null;
|
|
1927
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
1928
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
1929
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
1930
|
+
limit?: number | null;
|
|
1931
|
+
/** @description Return only notices that have not been read. */
|
|
1932
|
+
unread_only?: boolean | null;
|
|
1933
|
+
};
|
|
1934
|
+
header?: never;
|
|
1935
|
+
path?: never;
|
|
1936
|
+
cookie?: never;
|
|
1937
|
+
};
|
|
1938
|
+
requestBody?: never;
|
|
1939
|
+
responses: {
|
|
1940
|
+
/** @description Notices, newest first */
|
|
1941
|
+
200: {
|
|
1942
|
+
headers: {
|
|
1943
|
+
[name: string]: unknown;
|
|
1944
|
+
};
|
|
1945
|
+
content: {
|
|
1946
|
+
"application/json": {
|
|
1947
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
1948
|
+
has_more: boolean;
|
|
1949
|
+
/** @description The page of items, in the requested direction. */
|
|
1950
|
+
items: components["schemas"]["NotificationResponse"][];
|
|
1951
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
1952
|
+
next_cursor?: string;
|
|
1953
|
+
};
|
|
1954
|
+
};
|
|
1955
|
+
};
|
|
1956
|
+
};
|
|
1957
|
+
};
|
|
1958
|
+
list_sub_accounts: {
|
|
1959
|
+
parameters: {
|
|
1960
|
+
query?: never;
|
|
1961
|
+
header?: never;
|
|
1962
|
+
path?: never;
|
|
1963
|
+
cookie?: never;
|
|
1964
|
+
};
|
|
1965
|
+
requestBody?: never;
|
|
1966
|
+
responses: {
|
|
1967
|
+
/** @description Sub-accounts, oldest first */
|
|
1968
|
+
200: {
|
|
1969
|
+
headers: {
|
|
1970
|
+
[name: string]: unknown;
|
|
1971
|
+
};
|
|
1972
|
+
content: {
|
|
1973
|
+
"application/json": {
|
|
1974
|
+
data: components["schemas"]["SubAccountResponse"][];
|
|
1975
|
+
};
|
|
1976
|
+
};
|
|
1977
|
+
};
|
|
1978
|
+
};
|
|
1979
|
+
};
|
|
1980
|
+
list_assets: {
|
|
1981
|
+
parameters: {
|
|
1982
|
+
query?: never;
|
|
1983
|
+
header?: never;
|
|
1984
|
+
path?: never;
|
|
1985
|
+
cookie?: never;
|
|
1986
|
+
};
|
|
1987
|
+
requestBody?: never;
|
|
1988
|
+
responses: {
|
|
1989
|
+
/** @description Listed assets */
|
|
1990
|
+
200: {
|
|
1991
|
+
headers: {
|
|
1992
|
+
[name: string]: unknown;
|
|
1993
|
+
};
|
|
1994
|
+
content: {
|
|
1995
|
+
"application/json": {
|
|
1996
|
+
data: components["schemas"]["AssetResponse"][];
|
|
1997
|
+
};
|
|
1998
|
+
};
|
|
1999
|
+
};
|
|
2000
|
+
};
|
|
2001
|
+
};
|
|
2002
|
+
get_asset: {
|
|
2003
|
+
parameters: {
|
|
2004
|
+
query?: never;
|
|
2005
|
+
header?: never;
|
|
2006
|
+
path: {
|
|
2007
|
+
/**
|
|
2008
|
+
* @description Asset symbol
|
|
2009
|
+
* @example BTC
|
|
2010
|
+
*/
|
|
2011
|
+
symbol: string;
|
|
2012
|
+
};
|
|
2013
|
+
cookie?: never;
|
|
2014
|
+
};
|
|
2015
|
+
requestBody?: never;
|
|
2016
|
+
responses: {
|
|
2017
|
+
/** @description The asset */
|
|
2018
|
+
200: {
|
|
2019
|
+
headers: {
|
|
2020
|
+
[name: string]: unknown;
|
|
2021
|
+
};
|
|
2022
|
+
content: {
|
|
2023
|
+
"application/json": {
|
|
2024
|
+
data: components["schemas"]["AssetResponse"];
|
|
2025
|
+
};
|
|
2026
|
+
};
|
|
2027
|
+
};
|
|
2028
|
+
/** @description No such asset */
|
|
2029
|
+
404: {
|
|
2030
|
+
headers: {
|
|
2031
|
+
[name: string]: unknown;
|
|
2032
|
+
};
|
|
2033
|
+
content: {
|
|
2034
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2035
|
+
};
|
|
2036
|
+
};
|
|
2037
|
+
};
|
|
2038
|
+
};
|
|
2039
|
+
exchange_config: {
|
|
2040
|
+
parameters: {
|
|
2041
|
+
query?: never;
|
|
2042
|
+
header?: never;
|
|
2043
|
+
path?: never;
|
|
2044
|
+
cookie?: never;
|
|
2045
|
+
};
|
|
2046
|
+
requestBody?: never;
|
|
2047
|
+
responses: {
|
|
2048
|
+
/** @description Exchange configuration */
|
|
2049
|
+
200: {
|
|
2050
|
+
headers: {
|
|
2051
|
+
[name: string]: unknown;
|
|
2052
|
+
};
|
|
2053
|
+
content: {
|
|
2054
|
+
"application/json": {
|
|
2055
|
+
data: components["schemas"]["ExchangeConfigResponse"];
|
|
2056
|
+
};
|
|
2057
|
+
};
|
|
2058
|
+
};
|
|
2059
|
+
};
|
|
2060
|
+
};
|
|
2061
|
+
export_deposits: {
|
|
2062
|
+
parameters: {
|
|
2063
|
+
query?: {
|
|
2064
|
+
/** @description Start of the period, inclusive. Defaults to 30 days ago. */
|
|
2065
|
+
from?: string | null;
|
|
2066
|
+
/** @description End of the period, inclusive. Defaults to now. */
|
|
2067
|
+
to?: string | null;
|
|
2068
|
+
};
|
|
2069
|
+
header?: never;
|
|
2070
|
+
path?: never;
|
|
2071
|
+
cookie?: never;
|
|
2072
|
+
};
|
|
2073
|
+
requestBody?: never;
|
|
2074
|
+
responses: {
|
|
2075
|
+
/** @description CSV of deposits. Columns: deposit_id, time, asset, network, amount, status, txid, output_index, confirmations */
|
|
2076
|
+
200: {
|
|
2077
|
+
headers: {
|
|
2078
|
+
[name: string]: unknown;
|
|
2079
|
+
};
|
|
2080
|
+
content: {
|
|
2081
|
+
"text/csv": string;
|
|
2082
|
+
};
|
|
2083
|
+
};
|
|
2084
|
+
};
|
|
2085
|
+
};
|
|
2086
|
+
export_ledger: {
|
|
2087
|
+
parameters: {
|
|
2088
|
+
query?: {
|
|
2089
|
+
/** @description Start of the period, inclusive. Defaults to 30 days ago. */
|
|
2090
|
+
from?: string | null;
|
|
2091
|
+
/** @description End of the period, inclusive. Defaults to now. */
|
|
2092
|
+
to?: string | null;
|
|
2093
|
+
};
|
|
2094
|
+
header?: never;
|
|
2095
|
+
path?: never;
|
|
2096
|
+
cookie?: never;
|
|
2097
|
+
};
|
|
2098
|
+
requestBody?: never;
|
|
2099
|
+
responses: {
|
|
2100
|
+
/** @description CSV of ledger entries. Columns: entry_id, time, asset, kind, available_delta, locked_delta, pending_delta, available_after, sequence, reference */
|
|
2101
|
+
200: {
|
|
2102
|
+
headers: {
|
|
2103
|
+
[name: string]: unknown;
|
|
2104
|
+
};
|
|
2105
|
+
content: {
|
|
2106
|
+
"text/csv": string;
|
|
2107
|
+
};
|
|
2108
|
+
};
|
|
2109
|
+
};
|
|
2110
|
+
};
|
|
2111
|
+
export_orders: {
|
|
2112
|
+
parameters: {
|
|
2113
|
+
query?: {
|
|
2114
|
+
/** @description Start of the period, inclusive. Defaults to 30 days ago. */
|
|
2115
|
+
from?: string | null;
|
|
2116
|
+
/** @description End of the period, inclusive. Defaults to now. */
|
|
2117
|
+
to?: string | null;
|
|
2118
|
+
};
|
|
2119
|
+
header?: never;
|
|
2120
|
+
path?: never;
|
|
2121
|
+
cookie?: never;
|
|
2122
|
+
};
|
|
2123
|
+
requestBody?: never;
|
|
2124
|
+
responses: {
|
|
2125
|
+
/** @description CSV of orders. Columns: order_id, client_order_id, time, market, side, type, status, price, quantity, filled_quantity, filled_quote_quantity, fee_paid */
|
|
2126
|
+
200: {
|
|
2127
|
+
headers: {
|
|
2128
|
+
[name: string]: unknown;
|
|
2129
|
+
};
|
|
2130
|
+
content: {
|
|
2131
|
+
"text/csv": string;
|
|
2132
|
+
};
|
|
2133
|
+
};
|
|
2134
|
+
/** @description The date range is invalid or too wide */
|
|
2135
|
+
400: {
|
|
2136
|
+
headers: {
|
|
2137
|
+
[name: string]: unknown;
|
|
2138
|
+
};
|
|
2139
|
+
content: {
|
|
2140
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2141
|
+
};
|
|
2142
|
+
};
|
|
2143
|
+
};
|
|
2144
|
+
};
|
|
2145
|
+
export_trades: {
|
|
2146
|
+
parameters: {
|
|
2147
|
+
query?: {
|
|
2148
|
+
/** @description Start of the period, inclusive. Defaults to 30 days ago. */
|
|
2149
|
+
from?: string | null;
|
|
2150
|
+
/** @description End of the period, inclusive. Defaults to now. */
|
|
2151
|
+
to?: string | null;
|
|
2152
|
+
};
|
|
2153
|
+
header?: never;
|
|
2154
|
+
path?: never;
|
|
2155
|
+
cookie?: never;
|
|
2156
|
+
};
|
|
2157
|
+
requestBody?: never;
|
|
2158
|
+
responses: {
|
|
2159
|
+
/** @description CSV of executed trades. Columns: trade_id, time, market, side, role, price, quantity, quote_quantity, fee, fee_asset */
|
|
2160
|
+
200: {
|
|
2161
|
+
headers: {
|
|
2162
|
+
[name: string]: unknown;
|
|
2163
|
+
};
|
|
2164
|
+
content: {
|
|
2165
|
+
"text/csv": string;
|
|
2166
|
+
};
|
|
2167
|
+
};
|
|
2168
|
+
/** @description The date range is invalid or too wide */
|
|
2169
|
+
400: {
|
|
2170
|
+
headers: {
|
|
2171
|
+
[name: string]: unknown;
|
|
2172
|
+
};
|
|
2173
|
+
content: {
|
|
2174
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2175
|
+
};
|
|
2176
|
+
};
|
|
2177
|
+
};
|
|
2178
|
+
};
|
|
2179
|
+
export_withdrawals: {
|
|
2180
|
+
parameters: {
|
|
2181
|
+
query?: {
|
|
2182
|
+
/** @description Start of the period, inclusive. Defaults to 30 days ago. */
|
|
2183
|
+
from?: string | null;
|
|
2184
|
+
/** @description End of the period, inclusive. Defaults to now. */
|
|
2185
|
+
to?: string | null;
|
|
2186
|
+
};
|
|
2187
|
+
header?: never;
|
|
2188
|
+
path?: never;
|
|
2189
|
+
cookie?: never;
|
|
2190
|
+
};
|
|
2191
|
+
requestBody?: never;
|
|
2192
|
+
responses: {
|
|
2193
|
+
/** @description CSV of withdrawals. Columns: withdrawal_id, time, asset, network, amount, fee, fee_asset, status, address, txid */
|
|
2194
|
+
200: {
|
|
2195
|
+
headers: {
|
|
2196
|
+
[name: string]: unknown;
|
|
2197
|
+
};
|
|
2198
|
+
content: {
|
|
2199
|
+
"text/csv": string;
|
|
2200
|
+
};
|
|
2201
|
+
};
|
|
2202
|
+
};
|
|
2203
|
+
};
|
|
2204
|
+
list_fee_schedules: {
|
|
2205
|
+
parameters: {
|
|
2206
|
+
query?: never;
|
|
2207
|
+
header?: never;
|
|
2208
|
+
path?: never;
|
|
2209
|
+
cookie?: never;
|
|
2210
|
+
};
|
|
2211
|
+
requestBody?: never;
|
|
2212
|
+
responses: {
|
|
2213
|
+
/** @description Fee tiers */
|
|
2214
|
+
200: {
|
|
2215
|
+
headers: {
|
|
2216
|
+
[name: string]: unknown;
|
|
2217
|
+
};
|
|
2218
|
+
content: {
|
|
2219
|
+
"application/json": {
|
|
2220
|
+
data: components["schemas"]["FeeScheduleResponse"][];
|
|
2221
|
+
};
|
|
2222
|
+
};
|
|
2223
|
+
};
|
|
2224
|
+
};
|
|
2225
|
+
};
|
|
2226
|
+
list_markets: {
|
|
2227
|
+
parameters: {
|
|
2228
|
+
query?: never;
|
|
2229
|
+
header?: never;
|
|
2230
|
+
path?: never;
|
|
2231
|
+
cookie?: never;
|
|
2232
|
+
};
|
|
2233
|
+
requestBody?: never;
|
|
2234
|
+
responses: {
|
|
2235
|
+
/** @description Markets */
|
|
2236
|
+
200: {
|
|
2237
|
+
headers: {
|
|
2238
|
+
[name: string]: unknown;
|
|
2239
|
+
};
|
|
2240
|
+
content: {
|
|
2241
|
+
"application/json": {
|
|
2242
|
+
data: components["schemas"]["MarketResponse"][];
|
|
2243
|
+
};
|
|
2244
|
+
};
|
|
2245
|
+
};
|
|
2246
|
+
};
|
|
2247
|
+
};
|
|
2248
|
+
get_market: {
|
|
2249
|
+
parameters: {
|
|
2250
|
+
query?: never;
|
|
2251
|
+
header?: never;
|
|
2252
|
+
path: {
|
|
2253
|
+
/**
|
|
2254
|
+
* @description Market symbol
|
|
2255
|
+
* @example BTC/USDT
|
|
2256
|
+
*/
|
|
2257
|
+
symbol: string;
|
|
2258
|
+
};
|
|
2259
|
+
cookie?: never;
|
|
2260
|
+
};
|
|
2261
|
+
requestBody?: never;
|
|
2262
|
+
responses: {
|
|
2263
|
+
/** @description The market */
|
|
2264
|
+
200: {
|
|
2265
|
+
headers: {
|
|
2266
|
+
[name: string]: unknown;
|
|
2267
|
+
};
|
|
2268
|
+
content: {
|
|
2269
|
+
"application/json": {
|
|
2270
|
+
data: components["schemas"]["MarketResponse"];
|
|
2271
|
+
};
|
|
2272
|
+
};
|
|
2273
|
+
};
|
|
2274
|
+
/** @description No such market */
|
|
2275
|
+
404: {
|
|
2276
|
+
headers: {
|
|
2277
|
+
[name: string]: unknown;
|
|
2278
|
+
};
|
|
2279
|
+
content: {
|
|
2280
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2281
|
+
};
|
|
2282
|
+
};
|
|
2283
|
+
};
|
|
2284
|
+
};
|
|
2285
|
+
get_candles: {
|
|
2286
|
+
parameters: {
|
|
2287
|
+
query: {
|
|
2288
|
+
/** @description Latest bucket to return. */
|
|
2289
|
+
end_time?: string | null;
|
|
2290
|
+
/** @description Bucket width. */
|
|
2291
|
+
interval: components["schemas"]["CandleInterval"];
|
|
2292
|
+
/** @description Maximum buckets. Capped server-side. */
|
|
2293
|
+
limit?: number | null;
|
|
2294
|
+
/** @description Earliest bucket to return. */
|
|
2295
|
+
start_time?: string | null;
|
|
2296
|
+
};
|
|
2297
|
+
header?: never;
|
|
2298
|
+
path: {
|
|
2299
|
+
/**
|
|
2300
|
+
* @description Market symbol
|
|
2301
|
+
* @example BTC/USDT
|
|
2302
|
+
*/
|
|
2303
|
+
symbol: string;
|
|
2304
|
+
};
|
|
2305
|
+
cookie?: never;
|
|
2306
|
+
};
|
|
2307
|
+
requestBody?: never;
|
|
2308
|
+
responses: {
|
|
2309
|
+
/** @description Candles */
|
|
2310
|
+
200: {
|
|
2311
|
+
headers: {
|
|
2312
|
+
[name: string]: unknown;
|
|
2313
|
+
};
|
|
2314
|
+
content: {
|
|
2315
|
+
"application/json": {
|
|
2316
|
+
data: components["schemas"]["CandleResponse"][];
|
|
2317
|
+
};
|
|
2318
|
+
};
|
|
2319
|
+
};
|
|
2320
|
+
/** @description No such market */
|
|
2321
|
+
404: {
|
|
2322
|
+
headers: {
|
|
2323
|
+
[name: string]: unknown;
|
|
2324
|
+
};
|
|
2325
|
+
content: {
|
|
2326
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2327
|
+
};
|
|
2328
|
+
};
|
|
2329
|
+
};
|
|
2330
|
+
};
|
|
2331
|
+
get_order_book: {
|
|
2332
|
+
parameters: {
|
|
2333
|
+
query?: {
|
|
2334
|
+
/** @description Price levels per side. Capped server-side. */
|
|
2335
|
+
depth?: number | null;
|
|
2336
|
+
};
|
|
2337
|
+
header?: never;
|
|
2338
|
+
path: {
|
|
2339
|
+
/**
|
|
2340
|
+
* @description Market symbol
|
|
2341
|
+
* @example BTC/USDT
|
|
2342
|
+
*/
|
|
2343
|
+
symbol: string;
|
|
2344
|
+
};
|
|
2345
|
+
cookie?: never;
|
|
2346
|
+
};
|
|
2347
|
+
requestBody?: never;
|
|
2348
|
+
responses: {
|
|
2349
|
+
/** @description Order book */
|
|
2350
|
+
200: {
|
|
2351
|
+
headers: {
|
|
2352
|
+
[name: string]: unknown;
|
|
2353
|
+
};
|
|
2354
|
+
content: {
|
|
2355
|
+
"application/json": {
|
|
2356
|
+
data: components["schemas"]["OrderBookResponse"];
|
|
2357
|
+
};
|
|
2358
|
+
};
|
|
2359
|
+
};
|
|
2360
|
+
/** @description No such market */
|
|
2361
|
+
404: {
|
|
2362
|
+
headers: {
|
|
2363
|
+
[name: string]: unknown;
|
|
2364
|
+
};
|
|
2365
|
+
content: {
|
|
2366
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2367
|
+
};
|
|
2368
|
+
};
|
|
2369
|
+
};
|
|
2370
|
+
};
|
|
2371
|
+
get_market_trades: {
|
|
2372
|
+
parameters: {
|
|
2373
|
+
query?: {
|
|
2374
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
2375
|
+
cursor?: string | null;
|
|
2376
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
2377
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
2378
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
2379
|
+
limit?: number | null;
|
|
2380
|
+
};
|
|
2381
|
+
header?: never;
|
|
2382
|
+
path: {
|
|
2383
|
+
/**
|
|
2384
|
+
* @description Market symbol
|
|
2385
|
+
* @example BTC/USDT
|
|
2386
|
+
*/
|
|
2387
|
+
symbol: string;
|
|
2388
|
+
};
|
|
2389
|
+
cookie?: never;
|
|
2390
|
+
};
|
|
2391
|
+
requestBody?: never;
|
|
2392
|
+
responses: {
|
|
2393
|
+
/** @description Recent trades */
|
|
2394
|
+
200: {
|
|
2395
|
+
headers: {
|
|
2396
|
+
[name: string]: unknown;
|
|
2397
|
+
};
|
|
2398
|
+
content: {
|
|
2399
|
+
"application/json": {
|
|
2400
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
2401
|
+
has_more: boolean;
|
|
2402
|
+
/** @description The page of items, in the requested direction. */
|
|
2403
|
+
items: components["schemas"]["PublicTradeResponse"][];
|
|
2404
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
2405
|
+
next_cursor?: string;
|
|
2406
|
+
};
|
|
2407
|
+
};
|
|
2408
|
+
};
|
|
2409
|
+
/** @description No such market */
|
|
2410
|
+
404: {
|
|
2411
|
+
headers: {
|
|
2412
|
+
[name: string]: unknown;
|
|
2413
|
+
};
|
|
2414
|
+
content: {
|
|
2415
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2416
|
+
};
|
|
2417
|
+
};
|
|
2418
|
+
};
|
|
2419
|
+
};
|
|
2420
|
+
list_networks: {
|
|
2421
|
+
parameters: {
|
|
2422
|
+
query?: never;
|
|
2423
|
+
header?: never;
|
|
2424
|
+
path?: never;
|
|
2425
|
+
cookie?: never;
|
|
2426
|
+
};
|
|
2427
|
+
requestBody?: never;
|
|
2428
|
+
responses: {
|
|
2429
|
+
/** @description Networks */
|
|
2430
|
+
200: {
|
|
2431
|
+
headers: {
|
|
2432
|
+
[name: string]: unknown;
|
|
2433
|
+
};
|
|
2434
|
+
content: {
|
|
2435
|
+
"application/json": {
|
|
2436
|
+
data: components["schemas"]["NetworkResponse"][];
|
|
2437
|
+
};
|
|
2438
|
+
};
|
|
2439
|
+
};
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
list_pools: {
|
|
2443
|
+
parameters: {
|
|
2444
|
+
query?: never;
|
|
2445
|
+
header?: never;
|
|
2446
|
+
path?: never;
|
|
2447
|
+
cookie?: never;
|
|
2448
|
+
};
|
|
2449
|
+
requestBody?: never;
|
|
2450
|
+
responses: {
|
|
2451
|
+
/** @description Liquidity pools */
|
|
2452
|
+
200: {
|
|
2453
|
+
headers: {
|
|
2454
|
+
[name: string]: unknown;
|
|
2455
|
+
};
|
|
2456
|
+
content: {
|
|
2457
|
+
"application/json": {
|
|
2458
|
+
data: components["schemas"]["PoolResponse"][];
|
|
2459
|
+
};
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
};
|
|
2463
|
+
};
|
|
2464
|
+
get_pool: {
|
|
2465
|
+
parameters: {
|
|
2466
|
+
query?: never;
|
|
2467
|
+
header?: never;
|
|
2468
|
+
path: {
|
|
2469
|
+
/**
|
|
2470
|
+
* @description Market symbol
|
|
2471
|
+
* @example BTC/USDT
|
|
2472
|
+
*/
|
|
2473
|
+
symbol: string;
|
|
2474
|
+
};
|
|
2475
|
+
cookie?: never;
|
|
2476
|
+
};
|
|
2477
|
+
requestBody?: never;
|
|
2478
|
+
responses: {
|
|
2479
|
+
/** @description The pool */
|
|
2480
|
+
200: {
|
|
2481
|
+
headers: {
|
|
2482
|
+
[name: string]: unknown;
|
|
2483
|
+
};
|
|
2484
|
+
content: {
|
|
2485
|
+
"application/json": {
|
|
2486
|
+
data: components["schemas"]["PoolResponse"];
|
|
2487
|
+
};
|
|
2488
|
+
};
|
|
2489
|
+
};
|
|
2490
|
+
/** @description No pool for that market */
|
|
2491
|
+
404: {
|
|
2492
|
+
headers: {
|
|
2493
|
+
[name: string]: unknown;
|
|
2494
|
+
};
|
|
2495
|
+
content: {
|
|
2496
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2497
|
+
};
|
|
2498
|
+
};
|
|
2499
|
+
};
|
|
2500
|
+
};
|
|
2501
|
+
exit_pool: {
|
|
2502
|
+
parameters: {
|
|
2503
|
+
query?: never;
|
|
2504
|
+
header?: {
|
|
2505
|
+
/** @description Makes a retry safe */
|
|
2506
|
+
"Idempotency-Key"?: string | null;
|
|
2507
|
+
};
|
|
2508
|
+
path: {
|
|
2509
|
+
/**
|
|
2510
|
+
* @description Market symbol
|
|
2511
|
+
* @example BTC/USDT
|
|
2512
|
+
*/
|
|
2513
|
+
symbol: string;
|
|
2514
|
+
};
|
|
2515
|
+
cookie?: never;
|
|
2516
|
+
};
|
|
2517
|
+
requestBody: {
|
|
2518
|
+
content: {
|
|
2519
|
+
"application/json": components["schemas"]["ExitPoolRequest"];
|
|
2520
|
+
};
|
|
2521
|
+
};
|
|
2522
|
+
responses: {
|
|
2523
|
+
/** @description Liquidity removed */
|
|
2524
|
+
200: {
|
|
2525
|
+
headers: {
|
|
2526
|
+
[name: string]: unknown;
|
|
2527
|
+
};
|
|
2528
|
+
content: {
|
|
2529
|
+
"application/json": {
|
|
2530
|
+
data: components["schemas"]["ExitPoolResponse"];
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
};
|
|
2534
|
+
/** @description More shares than the account holds */
|
|
2535
|
+
400: {
|
|
2536
|
+
headers: {
|
|
2537
|
+
[name: string]: unknown;
|
|
2538
|
+
};
|
|
2539
|
+
content: {
|
|
2540
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2541
|
+
};
|
|
2542
|
+
};
|
|
2543
|
+
/** @description No pool, or no position in it */
|
|
2544
|
+
404: {
|
|
2545
|
+
headers: {
|
|
2546
|
+
[name: string]: unknown;
|
|
2547
|
+
};
|
|
2548
|
+
content: {
|
|
2549
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2550
|
+
};
|
|
2551
|
+
};
|
|
2552
|
+
/** @description The idempotency key was reused with a different body */
|
|
2553
|
+
409: {
|
|
2554
|
+
headers: {
|
|
2555
|
+
[name: string]: unknown;
|
|
2556
|
+
};
|
|
2557
|
+
content: {
|
|
2558
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2559
|
+
};
|
|
2560
|
+
};
|
|
2561
|
+
};
|
|
2562
|
+
};
|
|
2563
|
+
join_pool: {
|
|
2564
|
+
parameters: {
|
|
2565
|
+
query?: never;
|
|
2566
|
+
header?: {
|
|
2567
|
+
/** @description Makes a retry safe */
|
|
2568
|
+
"Idempotency-Key"?: string | null;
|
|
2569
|
+
};
|
|
2570
|
+
path: {
|
|
2571
|
+
/**
|
|
2572
|
+
* @description Market symbol
|
|
2573
|
+
* @example BTC/USDT
|
|
2574
|
+
*/
|
|
2575
|
+
symbol: string;
|
|
2576
|
+
};
|
|
2577
|
+
cookie?: never;
|
|
2578
|
+
};
|
|
2579
|
+
requestBody: {
|
|
2580
|
+
content: {
|
|
2581
|
+
"application/json": components["schemas"]["JoinPoolRequest"];
|
|
2582
|
+
};
|
|
2583
|
+
};
|
|
2584
|
+
responses: {
|
|
2585
|
+
/** @description Liquidity added */
|
|
2586
|
+
200: {
|
|
2587
|
+
headers: {
|
|
2588
|
+
[name: string]: unknown;
|
|
2589
|
+
};
|
|
2590
|
+
content: {
|
|
2591
|
+
"application/json": {
|
|
2592
|
+
data: components["schemas"]["JoinPoolResponse"];
|
|
2593
|
+
};
|
|
2594
|
+
};
|
|
2595
|
+
};
|
|
2596
|
+
/** @description The amounts or the implied price were refused */
|
|
2597
|
+
400: {
|
|
2598
|
+
headers: {
|
|
2599
|
+
[name: string]: unknown;
|
|
2600
|
+
};
|
|
2601
|
+
content: {
|
|
2602
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2603
|
+
};
|
|
2604
|
+
};
|
|
2605
|
+
/** @description No pool for that market */
|
|
2606
|
+
404: {
|
|
2607
|
+
headers: {
|
|
2608
|
+
[name: string]: unknown;
|
|
2609
|
+
};
|
|
2610
|
+
content: {
|
|
2611
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2612
|
+
};
|
|
2613
|
+
};
|
|
2614
|
+
/** @description The idempotency key was reused with a different body */
|
|
2615
|
+
409: {
|
|
2616
|
+
headers: {
|
|
2617
|
+
[name: string]: unknown;
|
|
2618
|
+
};
|
|
2619
|
+
content: {
|
|
2620
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2621
|
+
};
|
|
2622
|
+
};
|
|
2623
|
+
/** @description Insufficient funds */
|
|
2624
|
+
422: {
|
|
2625
|
+
headers: {
|
|
2626
|
+
[name: string]: unknown;
|
|
2627
|
+
};
|
|
2628
|
+
content: {
|
|
2629
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2630
|
+
};
|
|
2631
|
+
};
|
|
2632
|
+
};
|
|
2633
|
+
};
|
|
2634
|
+
server_time: {
|
|
2635
|
+
parameters: {
|
|
2636
|
+
query?: never;
|
|
2637
|
+
header?: never;
|
|
2638
|
+
path?: never;
|
|
2639
|
+
cookie?: never;
|
|
2640
|
+
};
|
|
2641
|
+
requestBody?: never;
|
|
2642
|
+
responses: {
|
|
2643
|
+
/** @description Server time */
|
|
2644
|
+
200: {
|
|
2645
|
+
headers: {
|
|
2646
|
+
[name: string]: unknown;
|
|
2647
|
+
};
|
|
2648
|
+
content: {
|
|
2649
|
+
"application/json": {
|
|
2650
|
+
data: components["schemas"]["ServerTimeResponse"];
|
|
2651
|
+
};
|
|
2652
|
+
};
|
|
2653
|
+
};
|
|
2654
|
+
};
|
|
2655
|
+
};
|
|
2656
|
+
list_open_orders: {
|
|
2657
|
+
parameters: {
|
|
2658
|
+
query?: {
|
|
2659
|
+
/** @description Limit to one status. */
|
|
2660
|
+
status?: components["schemas"]["OrderStatus"] | null;
|
|
2661
|
+
/** @description Limit to one market. */
|
|
2662
|
+
symbol?: string | null;
|
|
2663
|
+
};
|
|
2664
|
+
header?: never;
|
|
2665
|
+
path?: never;
|
|
2666
|
+
cookie?: never;
|
|
2667
|
+
};
|
|
2668
|
+
requestBody?: never;
|
|
2669
|
+
responses: {
|
|
2670
|
+
/** @description Open orders */
|
|
2671
|
+
200: {
|
|
2672
|
+
headers: {
|
|
2673
|
+
[name: string]: unknown;
|
|
2674
|
+
};
|
|
2675
|
+
content: {
|
|
2676
|
+
"application/json": {
|
|
2677
|
+
data: components["schemas"]["OrderResponse"][];
|
|
2678
|
+
};
|
|
2679
|
+
};
|
|
2680
|
+
};
|
|
2681
|
+
};
|
|
2682
|
+
};
|
|
2683
|
+
place_order: {
|
|
2684
|
+
parameters: {
|
|
2685
|
+
query?: never;
|
|
2686
|
+
header?: never;
|
|
2687
|
+
path?: never;
|
|
2688
|
+
cookie?: never;
|
|
2689
|
+
};
|
|
2690
|
+
requestBody: {
|
|
2691
|
+
content: {
|
|
2692
|
+
"application/json": components["schemas"]["PlaceOrderRequest"];
|
|
2693
|
+
};
|
|
2694
|
+
};
|
|
2695
|
+
responses: {
|
|
2696
|
+
/** @description Order accepted, with any immediate fills */
|
|
2697
|
+
200: {
|
|
2698
|
+
headers: {
|
|
2699
|
+
[name: string]: unknown;
|
|
2700
|
+
};
|
|
2701
|
+
content: {
|
|
2702
|
+
"application/json": {
|
|
2703
|
+
data: components["schemas"]["PlaceOrderResponse"];
|
|
2704
|
+
};
|
|
2705
|
+
};
|
|
2706
|
+
};
|
|
2707
|
+
/** @description The order failed validation */
|
|
2708
|
+
400: {
|
|
2709
|
+
headers: {
|
|
2710
|
+
[name: string]: unknown;
|
|
2711
|
+
};
|
|
2712
|
+
content: {
|
|
2713
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2714
|
+
};
|
|
2715
|
+
};
|
|
2716
|
+
/** @description That client order id is already in use */
|
|
2717
|
+
409: {
|
|
2718
|
+
headers: {
|
|
2719
|
+
[name: string]: unknown;
|
|
2720
|
+
};
|
|
2721
|
+
content: {
|
|
2722
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2723
|
+
};
|
|
2724
|
+
};
|
|
2725
|
+
/** @description Insufficient funds, or the market is unavailable */
|
|
2726
|
+
422: {
|
|
2727
|
+
headers: {
|
|
2728
|
+
[name: string]: unknown;
|
|
2729
|
+
};
|
|
2730
|
+
content: {
|
|
2731
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2732
|
+
};
|
|
2733
|
+
};
|
|
2734
|
+
/** @description The market is saturated; retry shortly */
|
|
2735
|
+
503: {
|
|
2736
|
+
headers: {
|
|
2737
|
+
[name: string]: unknown;
|
|
2738
|
+
};
|
|
2739
|
+
content: {
|
|
2740
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2741
|
+
};
|
|
2742
|
+
};
|
|
2743
|
+
};
|
|
2744
|
+
};
|
|
2745
|
+
get_order: {
|
|
2746
|
+
parameters: {
|
|
2747
|
+
query?: never;
|
|
2748
|
+
header?: never;
|
|
2749
|
+
path: {
|
|
2750
|
+
/** @description Order id */
|
|
2751
|
+
order_id: string;
|
|
2752
|
+
};
|
|
2753
|
+
cookie?: never;
|
|
2754
|
+
};
|
|
2755
|
+
requestBody?: never;
|
|
2756
|
+
responses: {
|
|
2757
|
+
/** @description The order */
|
|
2758
|
+
200: {
|
|
2759
|
+
headers: {
|
|
2760
|
+
[name: string]: unknown;
|
|
2761
|
+
};
|
|
2762
|
+
content: {
|
|
2763
|
+
"application/json": {
|
|
2764
|
+
data: components["schemas"]["OrderResponse"];
|
|
2765
|
+
};
|
|
2766
|
+
};
|
|
2767
|
+
};
|
|
2768
|
+
/** @description No such order on this account */
|
|
2769
|
+
404: {
|
|
2770
|
+
headers: {
|
|
2771
|
+
[name: string]: unknown;
|
|
2772
|
+
};
|
|
2773
|
+
content: {
|
|
2774
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2775
|
+
};
|
|
2776
|
+
};
|
|
2777
|
+
};
|
|
2778
|
+
};
|
|
2779
|
+
cancel_order: {
|
|
2780
|
+
parameters: {
|
|
2781
|
+
query?: never;
|
|
2782
|
+
header?: never;
|
|
2783
|
+
path: {
|
|
2784
|
+
/** @description Order id */
|
|
2785
|
+
order_id: string;
|
|
2786
|
+
};
|
|
2787
|
+
cookie?: never;
|
|
2788
|
+
};
|
|
2789
|
+
requestBody?: never;
|
|
2790
|
+
responses: {
|
|
2791
|
+
/** @description Cancelled */
|
|
2792
|
+
200: {
|
|
2793
|
+
headers: {
|
|
2794
|
+
[name: string]: unknown;
|
|
2795
|
+
};
|
|
2796
|
+
content: {
|
|
2797
|
+
"application/json": {
|
|
2798
|
+
data: components["schemas"]["OrderResponse"];
|
|
2799
|
+
};
|
|
2800
|
+
};
|
|
2801
|
+
};
|
|
2802
|
+
/** @description No such order on this account */
|
|
2803
|
+
404: {
|
|
2804
|
+
headers: {
|
|
2805
|
+
[name: string]: unknown;
|
|
2806
|
+
};
|
|
2807
|
+
content: {
|
|
2808
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2809
|
+
};
|
|
2810
|
+
};
|
|
2811
|
+
/** @description The order is no longer open */
|
|
2812
|
+
409: {
|
|
2813
|
+
headers: {
|
|
2814
|
+
[name: string]: unknown;
|
|
2815
|
+
};
|
|
2816
|
+
content: {
|
|
2817
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2818
|
+
};
|
|
2819
|
+
};
|
|
2820
|
+
};
|
|
2821
|
+
};
|
|
2822
|
+
get_order_by_client_id: {
|
|
2823
|
+
parameters: {
|
|
2824
|
+
query?: never;
|
|
2825
|
+
header?: never;
|
|
2826
|
+
path: {
|
|
2827
|
+
/** @description Your identifier */
|
|
2828
|
+
client_order_id: string;
|
|
2829
|
+
};
|
|
2830
|
+
cookie?: never;
|
|
2831
|
+
};
|
|
2832
|
+
requestBody?: never;
|
|
2833
|
+
responses: {
|
|
2834
|
+
/** @description The order */
|
|
2835
|
+
200: {
|
|
2836
|
+
headers: {
|
|
2837
|
+
[name: string]: unknown;
|
|
2838
|
+
};
|
|
2839
|
+
content: {
|
|
2840
|
+
"application/json": {
|
|
2841
|
+
data: components["schemas"]["OrderResponse"];
|
|
2842
|
+
};
|
|
2843
|
+
};
|
|
2844
|
+
};
|
|
2845
|
+
/** @description No such order on this account */
|
|
2846
|
+
404: {
|
|
2847
|
+
headers: {
|
|
2848
|
+
[name: string]: unknown;
|
|
2849
|
+
};
|
|
2850
|
+
content: {
|
|
2851
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2852
|
+
};
|
|
2853
|
+
};
|
|
2854
|
+
};
|
|
2855
|
+
};
|
|
2856
|
+
cancel_all: {
|
|
2857
|
+
parameters: {
|
|
2858
|
+
query?: never;
|
|
2859
|
+
header?: never;
|
|
2860
|
+
path?: never;
|
|
2861
|
+
cookie?: never;
|
|
2862
|
+
};
|
|
2863
|
+
requestBody: {
|
|
2864
|
+
content: {
|
|
2865
|
+
"application/json": components["schemas"]["CancelAllRequest"];
|
|
2866
|
+
};
|
|
2867
|
+
};
|
|
2868
|
+
responses: {
|
|
2869
|
+
/** @description What was cancelled */
|
|
2870
|
+
200: {
|
|
2871
|
+
headers: {
|
|
2872
|
+
[name: string]: unknown;
|
|
2873
|
+
};
|
|
2874
|
+
content: {
|
|
2875
|
+
"application/json": {
|
|
2876
|
+
data: components["schemas"]["CancelAllResponse"];
|
|
2877
|
+
};
|
|
2878
|
+
};
|
|
2879
|
+
};
|
|
2880
|
+
};
|
|
2881
|
+
};
|
|
2882
|
+
order_history: {
|
|
2883
|
+
parameters: {
|
|
2884
|
+
query?: {
|
|
2885
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
2886
|
+
cursor?: string | null;
|
|
2887
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
2888
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
2889
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
2890
|
+
limit?: number | null;
|
|
2891
|
+
/** @description Limit to one status. */
|
|
2892
|
+
status?: components["schemas"]["OrderStatus"] | null;
|
|
2893
|
+
/** @description Limit to one market. */
|
|
2894
|
+
symbol?: string | null;
|
|
2895
|
+
};
|
|
2896
|
+
header?: never;
|
|
2897
|
+
path?: never;
|
|
2898
|
+
cookie?: never;
|
|
2899
|
+
};
|
|
2900
|
+
requestBody?: never;
|
|
2901
|
+
responses: {
|
|
2902
|
+
/** @description Order history */
|
|
2903
|
+
200: {
|
|
2904
|
+
headers: {
|
|
2905
|
+
[name: string]: unknown;
|
|
2906
|
+
};
|
|
2907
|
+
content: {
|
|
2908
|
+
"application/json": {
|
|
2909
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
2910
|
+
has_more: boolean;
|
|
2911
|
+
/** @description The page of items, in the requested direction. */
|
|
2912
|
+
items: components["schemas"]["OrderResponse"][];
|
|
2913
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
2914
|
+
next_cursor?: string;
|
|
2915
|
+
};
|
|
2916
|
+
};
|
|
2917
|
+
};
|
|
2918
|
+
};
|
|
2919
|
+
};
|
|
2920
|
+
trade_history: {
|
|
2921
|
+
parameters: {
|
|
2922
|
+
query?: {
|
|
2923
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
2924
|
+
cursor?: string | null;
|
|
2925
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
2926
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
2927
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
2928
|
+
limit?: number | null;
|
|
2929
|
+
/** @description Limit to one market. */
|
|
2930
|
+
symbol?: string | null;
|
|
2931
|
+
};
|
|
2932
|
+
header?: never;
|
|
2933
|
+
path?: never;
|
|
2934
|
+
cookie?: never;
|
|
2935
|
+
};
|
|
2936
|
+
requestBody?: never;
|
|
2937
|
+
responses: {
|
|
2938
|
+
/** @description Trade history */
|
|
2939
|
+
200: {
|
|
2940
|
+
headers: {
|
|
2941
|
+
[name: string]: unknown;
|
|
2942
|
+
};
|
|
2943
|
+
content: {
|
|
2944
|
+
"application/json": {
|
|
2945
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
2946
|
+
has_more: boolean;
|
|
2947
|
+
/** @description The page of items, in the requested direction. */
|
|
2948
|
+
items: components["schemas"]["FillResponse"][];
|
|
2949
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
2950
|
+
next_cursor?: string;
|
|
2951
|
+
};
|
|
2952
|
+
};
|
|
2953
|
+
};
|
|
2954
|
+
};
|
|
2955
|
+
};
|
|
2956
|
+
deposit_address: {
|
|
2957
|
+
parameters: {
|
|
2958
|
+
query: {
|
|
2959
|
+
/**
|
|
2960
|
+
* @description Asset symbol.
|
|
2961
|
+
* @example BTC
|
|
2962
|
+
*/
|
|
2963
|
+
asset: string;
|
|
2964
|
+
/**
|
|
2965
|
+
* @description Network code.
|
|
2966
|
+
* @example bitcoin-mainnet
|
|
2967
|
+
*/
|
|
2968
|
+
network: string;
|
|
2969
|
+
};
|
|
2970
|
+
header?: never;
|
|
2971
|
+
path?: never;
|
|
2972
|
+
cookie?: never;
|
|
2973
|
+
};
|
|
2974
|
+
requestBody?: never;
|
|
2975
|
+
responses: {
|
|
2976
|
+
/** @description The deposit address */
|
|
2977
|
+
200: {
|
|
2978
|
+
headers: {
|
|
2979
|
+
[name: string]: unknown;
|
|
2980
|
+
};
|
|
2981
|
+
content: {
|
|
2982
|
+
"application/json": {
|
|
2983
|
+
data: components["schemas"]["DepositAddressResponse"];
|
|
2984
|
+
};
|
|
2985
|
+
};
|
|
2986
|
+
};
|
|
2987
|
+
/** @description No such asset or network */
|
|
2988
|
+
404: {
|
|
2989
|
+
headers: {
|
|
2990
|
+
[name: string]: unknown;
|
|
2991
|
+
};
|
|
2992
|
+
content: {
|
|
2993
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
2994
|
+
};
|
|
2995
|
+
};
|
|
2996
|
+
/** @description Deposits are disabled for this pairing */
|
|
2997
|
+
422: {
|
|
2998
|
+
headers: {
|
|
2999
|
+
[name: string]: unknown;
|
|
3000
|
+
};
|
|
3001
|
+
content: {
|
|
3002
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
3003
|
+
};
|
|
3004
|
+
};
|
|
3005
|
+
};
|
|
3006
|
+
};
|
|
3007
|
+
list_deposits: {
|
|
3008
|
+
parameters: {
|
|
3009
|
+
query?: {
|
|
3010
|
+
/** @description Limit to one asset. */
|
|
3011
|
+
asset?: string | null;
|
|
3012
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
3013
|
+
cursor?: string | null;
|
|
3014
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
3015
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
3016
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
3017
|
+
limit?: number | null;
|
|
3018
|
+
};
|
|
3019
|
+
header?: never;
|
|
3020
|
+
path?: never;
|
|
3021
|
+
cookie?: never;
|
|
3022
|
+
};
|
|
3023
|
+
requestBody?: never;
|
|
3024
|
+
responses: {
|
|
3025
|
+
/** @description Deposits */
|
|
3026
|
+
200: {
|
|
3027
|
+
headers: {
|
|
3028
|
+
[name: string]: unknown;
|
|
3029
|
+
};
|
|
3030
|
+
content: {
|
|
3031
|
+
"application/json": {
|
|
3032
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
3033
|
+
has_more: boolean;
|
|
3034
|
+
/** @description The page of items, in the requested direction. */
|
|
3035
|
+
items: components["schemas"]["DepositResponse"][];
|
|
3036
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
3037
|
+
next_cursor?: string;
|
|
3038
|
+
};
|
|
3039
|
+
};
|
|
3040
|
+
};
|
|
3041
|
+
};
|
|
3042
|
+
};
|
|
3043
|
+
get_deposit: {
|
|
3044
|
+
parameters: {
|
|
3045
|
+
query?: never;
|
|
3046
|
+
header?: never;
|
|
3047
|
+
path: {
|
|
3048
|
+
/** @description Deposit id */
|
|
3049
|
+
deposit_id: string;
|
|
3050
|
+
};
|
|
3051
|
+
cookie?: never;
|
|
3052
|
+
};
|
|
3053
|
+
requestBody?: never;
|
|
3054
|
+
responses: {
|
|
3055
|
+
/** @description The deposit */
|
|
3056
|
+
200: {
|
|
3057
|
+
headers: {
|
|
3058
|
+
[name: string]: unknown;
|
|
3059
|
+
};
|
|
3060
|
+
content: {
|
|
3061
|
+
"application/json": {
|
|
3062
|
+
data: components["schemas"]["DepositResponse"];
|
|
3063
|
+
};
|
|
3064
|
+
};
|
|
3065
|
+
};
|
|
3066
|
+
/** @description No such deposit on this account */
|
|
3067
|
+
404: {
|
|
3068
|
+
headers: {
|
|
3069
|
+
[name: string]: unknown;
|
|
3070
|
+
};
|
|
3071
|
+
content: {
|
|
3072
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
3073
|
+
};
|
|
3074
|
+
};
|
|
3075
|
+
};
|
|
3076
|
+
};
|
|
3077
|
+
list_withdrawal_addresses: {
|
|
3078
|
+
parameters: {
|
|
3079
|
+
query?: never;
|
|
3080
|
+
header?: never;
|
|
3081
|
+
path?: never;
|
|
3082
|
+
cookie?: never;
|
|
3083
|
+
};
|
|
3084
|
+
requestBody?: never;
|
|
3085
|
+
responses: {
|
|
3086
|
+
/** @description Saved addresses */
|
|
3087
|
+
200: {
|
|
3088
|
+
headers: {
|
|
3089
|
+
[name: string]: unknown;
|
|
3090
|
+
};
|
|
3091
|
+
content: {
|
|
3092
|
+
"application/json": {
|
|
3093
|
+
data: components["schemas"]["WithdrawalAddressResponse"][];
|
|
3094
|
+
};
|
|
3095
|
+
};
|
|
3096
|
+
};
|
|
3097
|
+
};
|
|
3098
|
+
};
|
|
3099
|
+
list_withdrawals: {
|
|
3100
|
+
parameters: {
|
|
3101
|
+
query?: {
|
|
3102
|
+
/** @description Limit to one asset. */
|
|
3103
|
+
asset?: string | null;
|
|
3104
|
+
/** @description Opaque cursor from a previous response's `next_cursor`. Omit for the first page. */
|
|
3105
|
+
cursor?: string | null;
|
|
3106
|
+
/** @description Sort direction. Defaults to newest-first. */
|
|
3107
|
+
direction?: components["schemas"]["SortDirection"] | null;
|
|
3108
|
+
/** @description Maximum items to return. Clamped to `MAX_LIMIT`. */
|
|
3109
|
+
limit?: number | null;
|
|
3110
|
+
};
|
|
3111
|
+
header?: never;
|
|
3112
|
+
path?: never;
|
|
3113
|
+
cookie?: never;
|
|
3114
|
+
};
|
|
3115
|
+
requestBody?: never;
|
|
3116
|
+
responses: {
|
|
3117
|
+
/** @description Withdrawals */
|
|
3118
|
+
200: {
|
|
3119
|
+
headers: {
|
|
3120
|
+
[name: string]: unknown;
|
|
3121
|
+
};
|
|
3122
|
+
content: {
|
|
3123
|
+
"application/json": {
|
|
3124
|
+
/** @description Whether another page exists. Equivalent to `next_cursor` being present. */
|
|
3125
|
+
has_more: boolean;
|
|
3126
|
+
/** @description The page of items, in the requested direction. */
|
|
3127
|
+
items: components["schemas"]["WithdrawalResponse"][];
|
|
3128
|
+
/** @description Opaque cursor for the next page; pass it back as `cursor`. Omitted on the last page. */
|
|
3129
|
+
next_cursor?: string;
|
|
3130
|
+
};
|
|
3131
|
+
};
|
|
3132
|
+
};
|
|
3133
|
+
};
|
|
3134
|
+
};
|
|
3135
|
+
get_withdrawal: {
|
|
3136
|
+
parameters: {
|
|
3137
|
+
query?: never;
|
|
3138
|
+
header?: never;
|
|
3139
|
+
path: {
|
|
3140
|
+
/** @description Withdrawal id */
|
|
3141
|
+
withdrawal_id: string;
|
|
3142
|
+
};
|
|
3143
|
+
cookie?: never;
|
|
3144
|
+
};
|
|
3145
|
+
requestBody?: never;
|
|
3146
|
+
responses: {
|
|
3147
|
+
/** @description The withdrawal */
|
|
3148
|
+
200: {
|
|
3149
|
+
headers: {
|
|
3150
|
+
[name: string]: unknown;
|
|
3151
|
+
};
|
|
3152
|
+
content: {
|
|
3153
|
+
"application/json": {
|
|
3154
|
+
data: components["schemas"]["WithdrawalResponse"];
|
|
3155
|
+
};
|
|
3156
|
+
};
|
|
3157
|
+
};
|
|
3158
|
+
/** @description No such withdrawal on this account */
|
|
3159
|
+
404: {
|
|
3160
|
+
headers: {
|
|
3161
|
+
[name: string]: unknown;
|
|
3162
|
+
};
|
|
3163
|
+
content: {
|
|
3164
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
3165
|
+
};
|
|
3166
|
+
};
|
|
3167
|
+
};
|
|
3168
|
+
};
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
/**
|
|
3172
|
+
* Friendly names for the generated API models (src/generated/schema.ts).
|
|
3173
|
+
* Amounts are decimal strings; never convert them to `number`.
|
|
3174
|
+
*/
|
|
3175
|
+
|
|
3176
|
+
type S = components["schemas"];
|
|
3177
|
+
type ApiKey = S["ApiKeyResponse"];
|
|
3178
|
+
type ApiScope = S["ApiScope"];
|
|
3179
|
+
type Asset = S["AssetResponse"];
|
|
3180
|
+
type AssetNetwork = S["AssetNetworkResponse"];
|
|
3181
|
+
type Balance = S["BalanceResponse"];
|
|
3182
|
+
type CancelAllRequest = S["CancelAllRequest"];
|
|
3183
|
+
type CancelAllResult = S["CancelAllResponse"];
|
|
3184
|
+
type Candle = S["CandleResponse"];
|
|
3185
|
+
type CandleInterval = S["CandleInterval"];
|
|
3186
|
+
type DepositAddress = S["DepositAddressResponse"];
|
|
3187
|
+
type Deposit = S["DepositResponse"];
|
|
3188
|
+
type DepositStatus = S["DepositStatus"];
|
|
3189
|
+
type ExchangeConfig = S["ExchangeConfigResponse"];
|
|
3190
|
+
type ExitPoolRequest = S["ExitPoolRequest"];
|
|
3191
|
+
type ExitPoolResult = S["ExitPoolResponse"];
|
|
3192
|
+
type FeeSchedule = S["FeeScheduleResponse"];
|
|
3193
|
+
type Fill = S["FillResponse"];
|
|
3194
|
+
type JoinPoolRequest = S["JoinPoolRequest"];
|
|
3195
|
+
type JoinPoolResult = S["JoinPoolResponse"];
|
|
3196
|
+
type LedgerEntry = S["LedgerEntryResponse"];
|
|
3197
|
+
type LedgerEntryKind = S["LedgerEntryKind"];
|
|
3198
|
+
type LiquidityRole = S["LiquidityRole"];
|
|
3199
|
+
type MaintenanceState = S["MaintenanceState"];
|
|
3200
|
+
type Market = S["MarketResponse"];
|
|
3201
|
+
type MarketStatus = S["MarketStatus"];
|
|
3202
|
+
type Network = S["NetworkResponse"];
|
|
3203
|
+
type Notification = S["NotificationResponse"];
|
|
3204
|
+
type NotificationKind = S["NotificationKind"];
|
|
3205
|
+
type OrderBook = S["OrderBookResponse"];
|
|
3206
|
+
type Order = S["OrderResponse"];
|
|
3207
|
+
type OrderSide = S["OrderSide"];
|
|
3208
|
+
type OrderStatus = S["OrderStatus"];
|
|
3209
|
+
type OrderType = S["OrderType"];
|
|
3210
|
+
type PlaceOrderRequest = S["PlaceOrderRequest"];
|
|
3211
|
+
type PlaceOrderResponse = S["PlaceOrderResponse"];
|
|
3212
|
+
type Pool = S["PoolResponse"];
|
|
3213
|
+
type PoolStatus = S["PoolStatus"];
|
|
3214
|
+
type PublicTrade = S["PublicTradeResponse"];
|
|
3215
|
+
type ServerTime = S["ServerTimeResponse"];
|
|
3216
|
+
type SortDirection = S["SortDirection"];
|
|
3217
|
+
type SubAccount = S["SubAccountResponse"];
|
|
3218
|
+
type TimeInForce = S["TimeInForce"];
|
|
3219
|
+
type TriggerDirection = S["TriggerDirection"];
|
|
3220
|
+
type WithdrawalAddress = S["WithdrawalAddressResponse"];
|
|
3221
|
+
type Withdrawal = S["WithdrawalResponse"];
|
|
3222
|
+
type WithdrawalStatus = S["WithdrawalStatus"];
|
|
3223
|
+
/** Query parameters of an operation, from the spec. */
|
|
3224
|
+
type QueryOf<Op extends keyof operations> = NonNullable<operations[Op]["parameters"]["query"]>;
|
|
3225
|
+
/** One page of a cursor-paginated listing. */
|
|
3226
|
+
interface Page<T> {
|
|
3227
|
+
items: T[];
|
|
3228
|
+
has_more: boolean;
|
|
3229
|
+
/** Pass back as `cursor` to get the next page. Absent on the last page. */
|
|
3230
|
+
next_cursor?: string;
|
|
3231
|
+
}
|
|
3232
|
+
/** Cursor paging parameters shared by every paginated listing. */
|
|
3233
|
+
interface CursorParams {
|
|
3234
|
+
cursor?: string | null;
|
|
3235
|
+
limit?: number | null;
|
|
3236
|
+
direction?: SortDirection | null;
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
interface IterateOptions {
|
|
3240
|
+
/** Stop after this many items in total. */
|
|
3241
|
+
maxItems?: number;
|
|
3242
|
+
}
|
|
3243
|
+
/**
|
|
3244
|
+
* Walks a cursor-paginated listing, yielding items one by one and fetching the next page
|
|
3245
|
+
* lazily. Stops on the last page (`has_more: false` or no `next_cursor`).
|
|
3246
|
+
*/
|
|
3247
|
+
declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<Page<T>>, startCursor?: string | null, opts?: IterateOptions): AsyncGenerator<T, void, undefined>;
|
|
3248
|
+
|
|
3249
|
+
type Q<Op extends keyof operations> = QueryOf<Op>;
|
|
3250
|
+
/** Shared plumbing for the resource namespaces. */
|
|
3251
|
+
declare abstract class Resource {
|
|
3252
|
+
protected readonly t: Transport;
|
|
3253
|
+
constructor(transport: Transport);
|
|
3254
|
+
protected data<T>(spec: CallSpec, opts?: RequestOptions): Promise<T>;
|
|
3255
|
+
protected page<T>(spec: CallSpec, opts?: RequestOptions): Promise<Page<T>>;
|
|
3256
|
+
protected text(spec: CallSpec, opts?: RequestOptions): Promise<string>;
|
|
3257
|
+
}
|
|
3258
|
+
declare class MarketsResource extends Resource {
|
|
3259
|
+
/** All markets with their current ticker. */
|
|
3260
|
+
list(opts?: RequestOptions): Promise<Market[]>;
|
|
3261
|
+
/** One market, e.g. `"BTC/USDT"`. */
|
|
3262
|
+
get(symbol: string, opts?: RequestOptions): Promise<Market>;
|
|
3263
|
+
/**
|
|
3264
|
+
* Order-book snapshot aggregated by price, with the realtime `sequence` it is current as of.
|
|
3265
|
+
* To follow the book live, use `CexyWebSocket.orderBook()`, which applies the sync rules.
|
|
3266
|
+
*/
|
|
3267
|
+
orderbook(symbol: string, params?: Q<"get_order_book">, opts?: RequestOptions): Promise<OrderBook>;
|
|
3268
|
+
/** One page of recent public trades. */
|
|
3269
|
+
trades(symbol: string, params?: Q<"get_market_trades">, opts?: RequestOptions): Promise<Page<PublicTrade>>;
|
|
3270
|
+
/** Every public trade, page by page (`for await`). */
|
|
3271
|
+
iterateTrades(symbol: string, params?: Q<"get_market_trades">, iter?: IterateOptions & RequestOptions): AsyncGenerator<PublicTrade, void, undefined>;
|
|
3272
|
+
/** OHLCV candles. `interval` is required. */
|
|
3273
|
+
candles(symbol: string, params: Q<"get_candles">, opts?: RequestOptions): Promise<Candle[]>;
|
|
3274
|
+
}
|
|
3275
|
+
declare class AssetsResource extends Resource {
|
|
3276
|
+
list(opts?: RequestOptions): Promise<Asset[]>;
|
|
3277
|
+
get(symbol: string, opts?: RequestOptions): Promise<Asset>;
|
|
3278
|
+
}
|
|
3279
|
+
declare class NetworksResource extends Resource {
|
|
3280
|
+
list(opts?: RequestOptions): Promise<Network[]>;
|
|
3281
|
+
}
|
|
3282
|
+
declare class FeesResource extends Resource {
|
|
3283
|
+
/** The fee schedules (maker/taker rates by tier). */
|
|
3284
|
+
get(opts?: RequestOptions): Promise<FeeSchedule[]>;
|
|
3285
|
+
}
|
|
3286
|
+
declare class PoolsResource extends Resource {
|
|
3287
|
+
list(opts?: RequestOptions): Promise<Pool[]>;
|
|
3288
|
+
get(symbol: string, opts?: RequestOptions): Promise<Pool>;
|
|
3289
|
+
/** Adds liquidity. Needs the `trade` scope. Amounts are decimal strings. */
|
|
3290
|
+
join(symbol: string, body: JoinPoolRequest, opts?: RequestOptions): Promise<JoinPoolResult>;
|
|
3291
|
+
/** Removes liquidity. Needs the `trade` scope. */
|
|
3292
|
+
exit(symbol: string, body: ExitPoolRequest, opts?: RequestOptions): Promise<ExitPoolResult>;
|
|
3293
|
+
}
|
|
3294
|
+
declare class AccountResource extends Resource {
|
|
3295
|
+
balances(opts?: RequestOptions): Promise<Balance[]>;
|
|
3296
|
+
balance(asset: string, opts?: RequestOptions): Promise<Balance>;
|
|
3297
|
+
ledger(params?: Q<"get_ledger">, opts?: RequestOptions): Promise<Page<LedgerEntry>>;
|
|
3298
|
+
iterateLedger(params?: Q<"get_ledger">, iter?: IterateOptions & RequestOptions): AsyncGenerator<LedgerEntry, void, undefined>;
|
|
3299
|
+
notifications(params?: Q<"list_notifications">, opts?: RequestOptions): Promise<Page<Notification>>;
|
|
3300
|
+
iterateNotifications(params?: Q<"list_notifications">, iter?: IterateOptions & RequestOptions): AsyncGenerator<Notification, void, undefined>;
|
|
3301
|
+
subAccounts(opts?: RequestOptions): Promise<SubAccount[]>;
|
|
3302
|
+
/** Your API keys (metadata only; secrets are never returned). */
|
|
3303
|
+
apiKeys(opts?: RequestOptions): Promise<ApiKey[]>;
|
|
3304
|
+
}
|
|
3305
|
+
/** CSV exports. Each method returns the CSV text. `from`/`to` are RFC 3339 date-times. */
|
|
3306
|
+
declare class ExportsResource extends Resource {
|
|
3307
|
+
deposits(params?: Q<"export_deposits">, opts?: RequestOptions): Promise<string>;
|
|
3308
|
+
ledger(params?: Q<"export_ledger">, opts?: RequestOptions): Promise<string>;
|
|
3309
|
+
orders(params?: Q<"export_orders">, opts?: RequestOptions): Promise<string>;
|
|
3310
|
+
trades(params?: Q<"export_trades">, opts?: RequestOptions): Promise<string>;
|
|
3311
|
+
withdrawals(params?: Q<"export_withdrawals">, opts?: RequestOptions): Promise<string>;
|
|
3312
|
+
}
|
|
3313
|
+
/** Wallet reads. API keys can never withdraw or transfer; there are no such methods. */
|
|
3314
|
+
declare class WalletResource extends Resource {
|
|
3315
|
+
deposits(params?: Q<"list_deposits">, opts?: RequestOptions): Promise<Page<Deposit>>;
|
|
3316
|
+
iterateDeposits(params?: Q<"list_deposits">, iter?: IterateOptions & RequestOptions): AsyncGenerator<Deposit, void, undefined>;
|
|
3317
|
+
deposit(depositId: string, opts?: RequestOptions): Promise<Deposit>;
|
|
3318
|
+
withdrawals(params?: Q<"list_withdrawals">, opts?: RequestOptions): Promise<Page<Withdrawal>>;
|
|
3319
|
+
iterateWithdrawals(params?: Q<"list_withdrawals">, iter?: IterateOptions & RequestOptions): AsyncGenerator<Withdrawal, void, undefined>;
|
|
3320
|
+
withdrawal(withdrawalId: string, opts?: RequestOptions): Promise<Withdrawal>;
|
|
3321
|
+
withdrawalAddresses(opts?: RequestOptions): Promise<WithdrawalAddress[]>;
|
|
3322
|
+
/**
|
|
3323
|
+
* Your deposit address for an asset on a network.
|
|
3324
|
+
*
|
|
3325
|
+
* **Side effect:** the first call for an asset/network CREATES the address (and it is
|
|
3326
|
+
* permanent); later calls return the same address. Always send the `memo` too when the
|
|
3327
|
+
* response has one, or the deposit may be unrecoverable.
|
|
3328
|
+
*/
|
|
3329
|
+
depositAddress(params: Q<"deposit_address">, opts?: RequestOptions): Promise<DepositAddress>;
|
|
3330
|
+
}
|
|
3331
|
+
/** `placeOrder` result. `recovered` is true when the order was found by its client id after an ambiguous failure. */
|
|
3332
|
+
interface PlaceOrderResult extends PlaceOrderResponse {
|
|
3333
|
+
/** The `client_order_id` that was sent (generated if you did not set one). */
|
|
3334
|
+
client_order_id: string;
|
|
3335
|
+
/**
|
|
3336
|
+
* True if the POST failed ambiguously and the order was then found by `client_order_id`.
|
|
3337
|
+
* In that case `fills` is empty; use `trading.trades({ symbol })` for executions.
|
|
3338
|
+
*/
|
|
3339
|
+
recovered: boolean;
|
|
3340
|
+
}
|
|
3341
|
+
/**
|
|
3342
|
+
* `cancelAll` target. `symbol` is required: a market such as `"BTC/USDT"`, or `null` to
|
|
3343
|
+
* cancel in EVERY market (only when passed explicitly).
|
|
3344
|
+
*/
|
|
3345
|
+
interface CancelAllParams {
|
|
3346
|
+
symbol: string | null;
|
|
3347
|
+
}
|
|
3348
|
+
declare class TradingResource extends Resource {
|
|
3349
|
+
#private;
|
|
3350
|
+
/** Open orders, optionally filtered by market/status. */
|
|
3351
|
+
openOrders(params?: Q<"list_open_orders">, opts?: RequestOptions): Promise<Order[]>;
|
|
3352
|
+
order(orderId: string, opts?: RequestOptions): Promise<Order>;
|
|
3353
|
+
orderByClientId(clientOrderId: string, opts?: RequestOptions): Promise<Order>;
|
|
3354
|
+
orderHistory(params?: Q<"order_history">, opts?: RequestOptions): Promise<Page<Order>>;
|
|
3355
|
+
iterateOrderHistory(params?: Q<"order_history">, iter?: IterateOptions & RequestOptions): AsyncGenerator<Order, void, undefined>;
|
|
3356
|
+
/** Your executions. */
|
|
3357
|
+
trades(params?: Q<"trade_history">, opts?: RequestOptions): Promise<Page<Fill>>;
|
|
3358
|
+
iterateTrades(params?: Q<"trade_history">, iter?: IterateOptions & RequestOptions): AsyncGenerator<Fill, void, undefined>;
|
|
3359
|
+
/**
|
|
3360
|
+
* Places a REAL order (needs the `trade` scope). Amounts must be decimal strings.
|
|
3361
|
+
*
|
|
3362
|
+
* Retry safety rests on `client_order_id` (generated as a UUID when absent): it is unique
|
|
3363
|
+
* per account and the server refuses a repeat before any funds move. The server does NOT
|
|
3364
|
+
* honour `Idempotency-Key` on orders (the header is sent but gives no protection). After an
|
|
3365
|
+
* ambiguous failure (network error, timeout or 5xx) the SDK first looks the order up by
|
|
3366
|
+
* `client_order_id` and returns it if it exists (`recovered: true`); only if it does not
|
|
3367
|
+
* exist does it send the order again, with the same `client_order_id`, so a late-arriving
|
|
3368
|
+
* first attempt makes the resend fail as a duplicate, which is again resolved by lookup.
|
|
3369
|
+
* Throws `OrderStateUnknownError` when even the lookup fails.
|
|
3370
|
+
*/
|
|
3371
|
+
placeOrder(order: PlaceOrderRequest, opts?: RequestOptions): Promise<PlaceOrderResult>;
|
|
3372
|
+
/**
|
|
3373
|
+
* Cancels one order (needs the `trade` scope). Retried on network errors and retryable
|
|
3374
|
+
* responses. If a RETRY gets `INVALID_STATE` (the order is no longer open, typically because
|
|
3375
|
+
* the first attempt did cancel it), the cancel is treated as done and the order is fetched
|
|
3376
|
+
* and returned. `INVALID_STATE` on the first attempt is thrown (e.g. already filled).
|
|
3377
|
+
*/
|
|
3378
|
+
cancelOrder(orderId: string, opts?: RequestOptions): Promise<Order>;
|
|
3379
|
+
/**
|
|
3380
|
+
* Cancels every open order in one market: `cancelAll({ symbol: "BTC/USDT" })`.
|
|
3381
|
+
* To cancel across ALL markets, pass `symbol: null` explicitly: `cancelAll({ symbol: null })`.
|
|
3382
|
+
* Omitting `symbol` is an error, so an account-wide cancel never happens by accident
|
|
3383
|
+
* (the server itself treats `{}` as every market).
|
|
3384
|
+
*
|
|
3385
|
+
* The server limits cancel-all to 30 calls per minute per account. It is naturally
|
|
3386
|
+
* repeatable, so it is retried after network errors; a retry reports only what that retry
|
|
3387
|
+
* cancelled.
|
|
3388
|
+
*/
|
|
3389
|
+
cancelAll(params: CancelAllParams, opts?: RequestOptions): Promise<CancelAllResult>;
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
/**
|
|
3393
|
+
* Every `error.code` the API is known to return (from cexy-api-spec/errors.yaml, PROVISIONAL
|
|
3394
|
+
* until the served spec includes the ErrorCode schema). New codes can appear at any time, so
|
|
3395
|
+
* the type stays open: always keep a default branch when switching on it.
|
|
3396
|
+
*/
|
|
3397
|
+
type KnownErrorCode = components["schemas"]["ErrorCode"];
|
|
3398
|
+
type ErrorCode = KnownErrorCode | (string & {});
|
|
3399
|
+
/** The `error` object of the API's error envelope. */
|
|
3400
|
+
type ErrorBody = components["schemas"]["ErrorBody"];
|
|
3401
|
+
/** Base class for everything the SDK throws. */
|
|
3402
|
+
declare class CexyError extends Error {
|
|
3403
|
+
constructor(message: string, options?: {
|
|
3404
|
+
cause?: unknown;
|
|
3405
|
+
});
|
|
3406
|
+
}
|
|
3407
|
+
/** Invalid client configuration, detected locally before any request is sent. */
|
|
3408
|
+
declare class CexyConfigError extends CexyError {
|
|
3409
|
+
}
|
|
3410
|
+
/**
|
|
3411
|
+
* A JS `number` (or a malformed string) was passed where the API expects a decimal string.
|
|
3412
|
+
* Thrown before sending: numbers are IEEE-754 doubles and silently corrupt amounts.
|
|
3413
|
+
*/
|
|
3414
|
+
declare class InvalidAmountError extends CexyError {
|
|
3415
|
+
readonly field: string;
|
|
3416
|
+
constructor(field: string, message: string);
|
|
3417
|
+
}
|
|
3418
|
+
/** The request never produced an HTTP response (DNS, TLS, connection reset, ...). */
|
|
3419
|
+
declare class CexyConnectionError extends CexyError {
|
|
3420
|
+
readonly retryable = true;
|
|
3421
|
+
}
|
|
3422
|
+
/** The request exceeded `timeoutMs`. */
|
|
3423
|
+
declare class CexyTimeoutError extends CexyConnectionError {
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* `placeOrder` failed ambiguously (network error or 5xx), and looking the order up by its
|
|
3427
|
+
* `client_order_id` also failed, so it is unknown whether the order exists.
|
|
3428
|
+
* Check `trading.orderByClientId(clientOrderId)` before placing it again.
|
|
3429
|
+
*/
|
|
3430
|
+
declare class OrderStateUnknownError extends CexyError {
|
|
3431
|
+
readonly clientOrderId: string;
|
|
3432
|
+
constructor(clientOrderId: string, cause: unknown);
|
|
3433
|
+
}
|
|
3434
|
+
interface CexyApiErrorInit {
|
|
3435
|
+
status: number;
|
|
3436
|
+
code: ErrorCode;
|
|
3437
|
+
message: string;
|
|
3438
|
+
details?: Record<string, unknown> | undefined;
|
|
3439
|
+
fields?: Record<string, string> | undefined;
|
|
3440
|
+
requestId?: string | null | undefined;
|
|
3441
|
+
retryable: boolean;
|
|
3442
|
+
headers?: Headers | undefined;
|
|
3443
|
+
}
|
|
3444
|
+
/** An error response from the API (the `{"error": {...}}` envelope). Branch on `code`. */
|
|
3445
|
+
declare class CexyApiError extends CexyError {
|
|
3446
|
+
readonly status: number;
|
|
3447
|
+
readonly code: ErrorCode;
|
|
3448
|
+
readonly details: Record<string, unknown>;
|
|
3449
|
+
readonly fields: Record<string, string>;
|
|
3450
|
+
readonly requestId: string | null;
|
|
3451
|
+
readonly retryable: boolean;
|
|
3452
|
+
constructor(init: CexyApiErrorInit);
|
|
3453
|
+
toString(): string;
|
|
3454
|
+
}
|
|
3455
|
+
/** 401: missing or invalid credentials (`UNAUTHENTICATED`, `INVALID_CREDENTIALS`, ...). */
|
|
3456
|
+
declare class AuthenticationError extends CexyApiError {
|
|
3457
|
+
}
|
|
3458
|
+
/** 403: the key lacks a scope (`FORBIDDEN`), or the route is session-only (`API_KEY_NOT_ALLOWED`). */
|
|
3459
|
+
declare class ForbiddenError extends CexyApiError {
|
|
3460
|
+
}
|
|
3461
|
+
/** 404 */
|
|
3462
|
+
declare class NotFoundError extends CexyApiError {
|
|
3463
|
+
}
|
|
3464
|
+
/** 400: the request failed validation; see `fields`. */
|
|
3465
|
+
declare class ValidationError extends CexyApiError {
|
|
3466
|
+
}
|
|
3467
|
+
/** 409: `ALREADY_EXISTS`, `IDEMPOTENCY_KEY_CONFLICT`, `CONCURRENT_MODIFICATION`, ... */
|
|
3468
|
+
declare class ConflictError extends CexyApiError {
|
|
3469
|
+
}
|
|
3470
|
+
/** 422: a business rule refused the request (`INSUFFICIENT_FUNDS`, `MARKET_UNAVAILABLE`, ...). */
|
|
3471
|
+
declare class UnprocessableError extends CexyApiError {
|
|
3472
|
+
}
|
|
3473
|
+
/** 429: rate limited. `retryAfterMs` is how long the server asked to wait. */
|
|
3474
|
+
declare class RateLimitError extends CexyApiError {
|
|
3475
|
+
readonly retryAfterMs: number | null;
|
|
3476
|
+
constructor(init: CexyApiErrorInit, retryAfterMs: number | null);
|
|
3477
|
+
}
|
|
3478
|
+
/** 5xx */
|
|
3479
|
+
declare class ServerError extends CexyApiError {
|
|
3480
|
+
}
|
|
3481
|
+
/** True for codes listed in errors.yaml. */
|
|
3482
|
+
declare function isKnownErrorCode(code: string): code is KnownErrorCode;
|
|
3483
|
+
/**
|
|
3484
|
+
* Builds the right error subclass for an HTTP error response.
|
|
3485
|
+
* - A known code maps by HTTP status (401 -> AuthenticationError, 403 -> ForbiddenError, ...).
|
|
3486
|
+
* - An unknown code maps to the base `CexyApiError` (never a crash).
|
|
3487
|
+
* - A body without the envelope (a proxy error page) maps by status with code `HTTP_<status>`.
|
|
3488
|
+
*/
|
|
3489
|
+
declare function errorFromResponse(status: number, body: unknown, headers?: Headers, redact?: (text: string) => string): CexyApiError;
|
|
3490
|
+
|
|
3491
|
+
/** A small typed event emitter that works in Node and browsers. */
|
|
3492
|
+
type EventMap = Record<string, unknown[]>;
|
|
3493
|
+
type Listener<A extends unknown[]> = (...args: A) => void;
|
|
3494
|
+
declare class TypedEmitter<E extends EventMap> {
|
|
3495
|
+
#private;
|
|
3496
|
+
/** Adds a listener; returns a function that removes it. */
|
|
3497
|
+
on<K extends keyof E>(event: K, listener: Listener<E[K]>): () => void;
|
|
3498
|
+
once<K extends keyof E>(event: K, listener: Listener<E[K]>): () => void;
|
|
3499
|
+
off<K extends keyof E>(event: K, listener: Listener<E[K]>): void;
|
|
3500
|
+
removeAllListeners(event?: keyof E): void;
|
|
3501
|
+
listenerCount(event: keyof E): number;
|
|
3502
|
+
/** Calls listeners synchronously. A throwing listener does not stop the others. */
|
|
3503
|
+
protected emit<K extends keyof E>(event: K, ...args: E[K]): void;
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
/** Protocol version this SDK was written for. */
|
|
3507
|
+
declare const SUPPORTED_PROTOCOL_VERSION = 1;
|
|
3508
|
+
interface WelcomeFrame {
|
|
3509
|
+
type: "welcome";
|
|
3510
|
+
protocol_version: number;
|
|
3511
|
+
/** The server's own pong cadence (30), not a client deadline. */
|
|
3512
|
+
heartbeat_interval_seconds: number;
|
|
3513
|
+
max_subscriptions: number;
|
|
3514
|
+
connection_id: string;
|
|
3515
|
+
}
|
|
3516
|
+
interface PongFrame {
|
|
3517
|
+
type: "pong";
|
|
3518
|
+
id?: string | null;
|
|
3519
|
+
}
|
|
3520
|
+
interface SubscribedFrame {
|
|
3521
|
+
type: "subscribed";
|
|
3522
|
+
channels: string[];
|
|
3523
|
+
id?: string | null;
|
|
3524
|
+
}
|
|
3525
|
+
interface AuthenticatedFrame {
|
|
3526
|
+
type: "authenticated";
|
|
3527
|
+
id?: string | null;
|
|
3528
|
+
user_id?: string;
|
|
3529
|
+
}
|
|
3530
|
+
interface UnsubscribedFrame {
|
|
3531
|
+
type: "unsubscribed";
|
|
3532
|
+
channels?: string[];
|
|
3533
|
+
id?: string | null;
|
|
3534
|
+
}
|
|
3535
|
+
interface ErrorFrame {
|
|
3536
|
+
type: "error";
|
|
3537
|
+
code: string;
|
|
3538
|
+
message?: string;
|
|
3539
|
+
id?: string | null;
|
|
3540
|
+
}
|
|
3541
|
+
/** `[price, quantity]`, both decimal strings. */
|
|
3542
|
+
type BookLevel = [price: string, quantity: string];
|
|
3543
|
+
interface OrderBookUpdateData {
|
|
3544
|
+
symbol: string;
|
|
3545
|
+
/**
|
|
3546
|
+
* Always `true`: every update is the complete top 50 of both sides and replaces the
|
|
3547
|
+
* previous state. There are no deltas.
|
|
3548
|
+
*/
|
|
3549
|
+
full?: boolean;
|
|
3550
|
+
bids: BookLevel[];
|
|
3551
|
+
asks: BookLevel[];
|
|
3552
|
+
}
|
|
3553
|
+
interface SessionRevokedData {
|
|
3554
|
+
session_id: string | null;
|
|
3555
|
+
reason: string;
|
|
3556
|
+
current: boolean;
|
|
3557
|
+
}
|
|
3558
|
+
interface EventBase<T extends string, D> {
|
|
3559
|
+
type: T;
|
|
3560
|
+
channel: string;
|
|
3561
|
+
/** Per channel, +1 per update. Resets when the server restarts. */
|
|
3562
|
+
sequence?: number;
|
|
3563
|
+
timestamp?: string;
|
|
3564
|
+
data: D;
|
|
3565
|
+
}
|
|
3566
|
+
type Data = Record<string, unknown>;
|
|
3567
|
+
type OrderBookUpdateEvent = EventBase<"orderbook.update", OrderBookUpdateData>;
|
|
3568
|
+
type SessionRevokedEvent = EventBase<"session.revoked", SessionRevokedData>;
|
|
3569
|
+
type TickerUpdateEvent = EventBase<"ticker.update", Data>;
|
|
3570
|
+
type TradeNewEvent = EventBase<"trade.new", Data>;
|
|
3571
|
+
type MarketStatusEvent = EventBase<"market.status", Data>;
|
|
3572
|
+
type OrderEvent = EventBase<"order.created" | "order.updated" | "order.cancelled" | "order.filled", Order>;
|
|
3573
|
+
type BalanceUpdatedEvent = EventBase<"balance.updated", Data>;
|
|
3574
|
+
type DepositEvent = EventBase<"deposit.detected" | "deposit.updated" | "deposit.completed", Data>;
|
|
3575
|
+
type WithdrawalUpdatedEvent = EventBase<"withdrawal.updated", Data>;
|
|
3576
|
+
/** Every event type the SDK knows. Unknown types are ignored (they may be added without notice). */
|
|
3577
|
+
type WsEvent = OrderBookUpdateEvent | SessionRevokedEvent | TickerUpdateEvent | TradeNewEvent | MarketStatusEvent | OrderEvent | BalanceUpdatedEvent | DepositEvent | WithdrawalUpdatedEvent;
|
|
3578
|
+
declare const KNOWN_EVENT_TYPES: ReadonlySet<string>;
|
|
3579
|
+
/** Channels that need `auth`. */
|
|
3580
|
+
declare const PRIVATE_CHANNELS: ReadonlySet<string>;
|
|
3581
|
+
/** Minimal WebSocket surface shared by the browser/Node 22 global and the `ws` package. */
|
|
3582
|
+
interface WebSocketLike {
|
|
3583
|
+
readonly readyState: number;
|
|
3584
|
+
send(data: string): void;
|
|
3585
|
+
close(code?: number, reason?: string): void;
|
|
3586
|
+
onopen: ((ev: unknown) => void) | null;
|
|
3587
|
+
onmessage: ((ev: {
|
|
3588
|
+
data: unknown;
|
|
3589
|
+
}) => void) | null;
|
|
3590
|
+
onclose: ((ev: {
|
|
3591
|
+
code?: number;
|
|
3592
|
+
reason?: string;
|
|
3593
|
+
}) => void) | null;
|
|
3594
|
+
onerror: ((ev: unknown) => void) | null;
|
|
3595
|
+
}
|
|
3596
|
+
type WebSocketConstructor = new (url: string, options?: unknown) => WebSocketLike;
|
|
3597
|
+
|
|
3598
|
+
/** Levels the WebSocket book carries per side. REST levels deeper than this are never merged. */
|
|
3599
|
+
declare const WS_BOOK_DEPTH = 50;
|
|
3600
|
+
interface LiveOrderBookOptions {
|
|
3601
|
+
/** Retry delay after a failed snapshot. Default 1000 ms (doubles up to 30 s). */
|
|
3602
|
+
snapshotRetryMs?: number;
|
|
3603
|
+
}
|
|
3604
|
+
interface LiveOrderBookEvents extends Record<string, unknown[]> {
|
|
3605
|
+
/** The book changed (snapshot applied or update applied). */
|
|
3606
|
+
update: [LiveOrderBook];
|
|
3607
|
+
/** A sequence gap: the book is stale until the next update heals it. */
|
|
3608
|
+
stale: [{
|
|
3609
|
+
expected: number;
|
|
3610
|
+
received: number;
|
|
3611
|
+
}];
|
|
3612
|
+
/** The update after a gap arrived in order; the book is current again. */
|
|
3613
|
+
healed: [];
|
|
3614
|
+
/** A fresh REST snapshot is being taken (reconnect, CONCURRENT_MODIFICATION, first sync). */
|
|
3615
|
+
resync: [];
|
|
3616
|
+
error: [Error];
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* A local order book fed by `orderbook:{symbol}`. Created by `CexyWebSocket.orderBook()`.
|
|
3620
|
+
* Levels are `[price, quantity]` decimal strings, best first, at most 50 per side.
|
|
3621
|
+
*/
|
|
3622
|
+
declare class LiveOrderBook extends TypedEmitter<LiveOrderBookEvents> {
|
|
3623
|
+
#private;
|
|
3624
|
+
readonly symbol: string;
|
|
3625
|
+
bids: BookLevel[];
|
|
3626
|
+
asks: BookLevel[];
|
|
3627
|
+
/** Sequence of the last applied snapshot/update on the current connection. */
|
|
3628
|
+
sequence: number | null;
|
|
3629
|
+
/** True after a sequence gap, until the next in-order update. */
|
|
3630
|
+
stale: boolean;
|
|
3631
|
+
/** False while waiting for a snapshot (after connect, reconnect or resync). */
|
|
3632
|
+
synced: boolean;
|
|
3633
|
+
/** @internal use `CexyWebSocket.orderBook()` */
|
|
3634
|
+
constructor(symbol: string, rest: SnapshotSource, options: LiveOrderBookOptions, onClose: () => void);
|
|
3635
|
+
/** Best bid and ask (null when that side is empty). */
|
|
3636
|
+
get top(): {
|
|
3637
|
+
bid: BookLevel | null;
|
|
3638
|
+
ask: BookLevel | null;
|
|
3639
|
+
};
|
|
3640
|
+
/** @internal The connection dropped: sequences from the next connection are unrelated. */
|
|
3641
|
+
markDisconnected(): void;
|
|
3642
|
+
/**
|
|
3643
|
+
* Takes a fresh REST snapshot and replays buffered updates newer than it.
|
|
3644
|
+
* Called automatically; safe to call yourself.
|
|
3645
|
+
*/
|
|
3646
|
+
resync(attempt?: number): Promise<void>;
|
|
3647
|
+
/** @internal */
|
|
3648
|
+
onUpdate(event: OrderBookUpdateEvent): void;
|
|
3649
|
+
/** Stops following the book and unsubscribes. */
|
|
3650
|
+
close(): void;
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
declare const DEFAULT_WS_URL = "wss://api.cexy.io/api/v1/ws";
|
|
3654
|
+
/** A WebSocket protocol error, a server error frame, or a local guard. */
|
|
3655
|
+
declare class CexyWebSocketError extends CexyError {
|
|
3656
|
+
readonly code: string;
|
|
3657
|
+
/** True when this came from a server `error` frame (not a local guard or disconnect). */
|
|
3658
|
+
readonly fromServer: boolean;
|
|
3659
|
+
constructor(code: string, message: string, fromServer?: boolean);
|
|
3660
|
+
}
|
|
3661
|
+
/** Where order-book snapshots come from (a `CexyClient` fits). */
|
|
3662
|
+
interface SnapshotSource {
|
|
3663
|
+
markets: {
|
|
3664
|
+
orderbook(symbol: string, params?: {
|
|
3665
|
+
depth?: number | null;
|
|
3666
|
+
}): Promise<OrderBook>;
|
|
3667
|
+
};
|
|
3668
|
+
}
|
|
3669
|
+
interface WsLogger {
|
|
3670
|
+
warn(message: string): void;
|
|
3671
|
+
debug?(message: string): void;
|
|
3672
|
+
}
|
|
3673
|
+
interface ReconnectOptions {
|
|
3674
|
+
/** Default 1000 ms. */
|
|
3675
|
+
baseDelayMs?: number;
|
|
3676
|
+
/** Default 30000 ms. */
|
|
3677
|
+
maxDelayMs?: number;
|
|
3678
|
+
/** Default: unlimited. */
|
|
3679
|
+
maxAttempts?: number;
|
|
3680
|
+
}
|
|
3681
|
+
interface CexyWebSocketOptions {
|
|
3682
|
+
/** Default `wss://api.cexy.io/api/v1/ws`. Must be `wss://` (see `allowInsecure`). */
|
|
3683
|
+
url?: string;
|
|
3684
|
+
/** Allow `ws://`, but ONLY for `localhost`, `127.0.0.1` or `::1` (local test servers). Default false. */
|
|
3685
|
+
allowInsecure?: boolean;
|
|
3686
|
+
/**
|
|
3687
|
+
* WebSocket implementation. Default: in Node the optional `ws` package if installed
|
|
3688
|
+
* (so a User-Agent can be sent), else the global `WebSocket` (browsers, Node 22+).
|
|
3689
|
+
*/
|
|
3690
|
+
WebSocket?: WebSocketConstructor;
|
|
3691
|
+
/** REST client used for order-book snapshots (`CexyClient.websocket()` sets it). */
|
|
3692
|
+
restClient?: SnapshotSource;
|
|
3693
|
+
/** Client ping cadence. Required by the server; default 30000 ms. */
|
|
3694
|
+
pingIntervalMs?: number;
|
|
3695
|
+
/** Reconnect if no frame arrives for this long. Default 75000 ms. */
|
|
3696
|
+
livenessTimeoutMs?: number;
|
|
3697
|
+
/** Default 10000 ms. */
|
|
3698
|
+
welcomeTimeoutMs?: number;
|
|
3699
|
+
/** How long `subscribe()` waits for `subscribed`. Default 5000 ms. */
|
|
3700
|
+
ackTimeoutMs?: number;
|
|
3701
|
+
/** Automatic reconnect (default on). */
|
|
3702
|
+
reconnect?: boolean | ReconnectOptions;
|
|
3703
|
+
/** Local subscription cap. Default 100 (the server's limit). */
|
|
3704
|
+
maxSubscriptions?: number;
|
|
3705
|
+
/** Local message cap per fixed minute. Default 200 (server closes above 240). */
|
|
3706
|
+
maxMessagesPerMinute?: number;
|
|
3707
|
+
/** Sent as User-Agent when the implementation allows headers (the `ws` package). */
|
|
3708
|
+
userAgent?: string;
|
|
3709
|
+
logger?: WsLogger;
|
|
3710
|
+
/** @internal deterministic jitter in tests */
|
|
3711
|
+
random?: () => number;
|
|
3712
|
+
}
|
|
3713
|
+
interface SubscribeResult {
|
|
3714
|
+
/** Channels the server confirmed as newly added. */
|
|
3715
|
+
added: string[];
|
|
3716
|
+
/** Channels refused locally because the subscription cap was reached. */
|
|
3717
|
+
refused: string[];
|
|
3718
|
+
/** Channels already held (nothing sent for them). */
|
|
3719
|
+
alreadySubscribed: string[];
|
|
3720
|
+
}
|
|
3721
|
+
interface CloseInfo {
|
|
3722
|
+
code: number | undefined;
|
|
3723
|
+
reason: string | undefined;
|
|
3724
|
+
willReconnect: boolean;
|
|
3725
|
+
}
|
|
3726
|
+
type ResyncReason = "concurrent_modification" | "reconnect";
|
|
3727
|
+
interface CexyWebSocketEvents extends Record<string, unknown[]> {
|
|
3728
|
+
open: [];
|
|
3729
|
+
welcome: [WelcomeFrame];
|
|
3730
|
+
/** Every known event (`ticker.update`, `orderbook.update`, `order.*`, ...). */
|
|
3731
|
+
event: [WsEvent];
|
|
3732
|
+
subscribed: [string[]];
|
|
3733
|
+
/** `unsubscribed` acknowledgement. */
|
|
3734
|
+
unsubscribed: [string[]];
|
|
3735
|
+
/** `authenticated` acknowledgement (after `auth()` or the automatic re-auth on reconnect). */
|
|
3736
|
+
authenticated: [userId: string | null];
|
|
3737
|
+
pong: [id: string | null];
|
|
3738
|
+
/** An `error` frame from the server. */
|
|
3739
|
+
serverError: [CexyWebSocketError, ErrorFrame];
|
|
3740
|
+
/** Transport problems and failed resyncs. */
|
|
3741
|
+
error: [Error];
|
|
3742
|
+
close: [CloseInfo];
|
|
3743
|
+
reconnecting: [{
|
|
3744
|
+
attempt: number;
|
|
3745
|
+
delayMs: number;
|
|
3746
|
+
}];
|
|
3747
|
+
/** Reconnected, re-authenticated (if a token was held) and re-subscribed. */
|
|
3748
|
+
reconnected: [WelcomeFrame];
|
|
3749
|
+
/** State may have been missed: refetch anything you keep from private or public channels. */
|
|
3750
|
+
resync: [ResyncReason];
|
|
3751
|
+
/**
|
|
3752
|
+
* `session.revoked` arrived: private channels are dead. The socket stays open; public
|
|
3753
|
+
* channels keep working. Call `auth()` with a new token to restore private channels.
|
|
3754
|
+
*/
|
|
3755
|
+
authLost: [SessionRevokedEvent];
|
|
3756
|
+
}
|
|
3757
|
+
/** Result of `auth()`. */
|
|
3758
|
+
interface AuthResult {
|
|
3759
|
+
/** From the `authenticated` acknowledgement; null when queued. */
|
|
3760
|
+
userId: string | null;
|
|
3761
|
+
/** True when not connected: the token is kept and sent (and acknowledged) on connect. */
|
|
3762
|
+
queued: boolean;
|
|
3763
|
+
}
|
|
3764
|
+
/**
|
|
3765
|
+
* CEXY.io WebSocket client: heartbeat, liveness, subscriptions with local limits, automatic
|
|
3766
|
+
* reconnect with re-auth and re-subscribe, and live order books.
|
|
3767
|
+
*
|
|
3768
|
+
* API-key authentication on the WebSocket is not available yet: `auth()` takes a session
|
|
3769
|
+
* access token. Programs holding only an API key get public channels and poll REST for
|
|
3770
|
+
* private state.
|
|
3771
|
+
*/
|
|
3772
|
+
declare class CexyWebSocket extends TypedEmitter<CexyWebSocketEvents> {
|
|
3773
|
+
#private;
|
|
3774
|
+
readonly url: string;
|
|
3775
|
+
constructor(options?: CexyWebSocketOptions);
|
|
3776
|
+
/** The last `welcome` frame, or null before the first connection. */
|
|
3777
|
+
get welcome(): WelcomeFrame | null;
|
|
3778
|
+
get connected(): boolean;
|
|
3779
|
+
/** Channels currently held (restored after every reconnect). */
|
|
3780
|
+
get channels(): string[];
|
|
3781
|
+
/** Opens the connection; resolves on the server's `welcome` frame. */
|
|
3782
|
+
connect(): Promise<WelcomeFrame>;
|
|
3783
|
+
/**
|
|
3784
|
+
* Authenticates private channels with a session access token. Resolves on the server's
|
|
3785
|
+
* `authenticated` acknowledgement (same request id); rejects on an `error` with that id
|
|
3786
|
+
* (the token is then forgotten) or when no acknowledgement arrives within `ackTimeoutMs`.
|
|
3787
|
+
* The token is kept in memory and re-sent after each reconnect. When not connected, the
|
|
3788
|
+
* token is queued and the promise resolves with `queued: true`.
|
|
3789
|
+
* (API-key authentication is not available on the WebSocket yet.)
|
|
3790
|
+
*/
|
|
3791
|
+
auth(token: string): Promise<AuthResult>;
|
|
3792
|
+
/** Sends a ping with an id and resolves with the round-trip time in ms. */
|
|
3793
|
+
ping(): Promise<number>;
|
|
3794
|
+
/**
|
|
3795
|
+
* Subscribes to channels, e.g. `["ticker:BTC/USDT", "trades:BTC/USDT"]`. Resolves when the
|
|
3796
|
+
* server confirms. Beyond `maxSubscriptions` channels are refused locally (see `refused`).
|
|
3797
|
+
*/
|
|
3798
|
+
subscribe(channels: string[]): Promise<SubscribeResult>;
|
|
3799
|
+
/**
|
|
3800
|
+
* Unsubscribes. Resolves on the `unsubscribed` acknowledgement (or after `ackTimeoutMs`
|
|
3801
|
+
* without one); rejects on an `error` with the request id.
|
|
3802
|
+
*/
|
|
3803
|
+
unsubscribe(channels: string[]): Promise<void>;
|
|
3804
|
+
/**
|
|
3805
|
+
* A live order book for `symbol` that follows the sync rules: subscribe first, then a REST
|
|
3806
|
+
* snapshot (sequence S); drop updates with sequence <= S; each update replaces the top 50
|
|
3807
|
+
* levels; a gap marks the book stale until the next update; a fresh snapshot after every
|
|
3808
|
+
* reconnect and after `CONCURRENT_MODIFICATION`. Resolves after the first snapshot.
|
|
3809
|
+
*/
|
|
3810
|
+
orderBook(symbol: string, options?: LiveOrderBookOptions): Promise<LiveOrderBook>;
|
|
3811
|
+
/** Closes the connection for good (no reconnect). */
|
|
3812
|
+
close(): void;
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
declare const DEFAULT_BASE_URL = "https://api.cexy.io";
|
|
3816
|
+
/** Default client-side limit without credentials (server: about 120/min per IP). */
|
|
3817
|
+
declare const DEFAULT_RPM_ANONYMOUS = 100;
|
|
3818
|
+
/** Default client-side limit with an API key (server: about 600/min per key). */
|
|
3819
|
+
declare const DEFAULT_RPM_WITH_KEY = 300;
|
|
3820
|
+
interface CexyClientOptions {
|
|
3821
|
+
/** API key id (`ak_…`). Must be given together with `apiSecret`, or not at all. */
|
|
3822
|
+
apiKey?: string;
|
|
3823
|
+
/** API key secret. Never logged, never put in a URL. */
|
|
3824
|
+
apiSecret?: string;
|
|
3825
|
+
/**
|
|
3826
|
+
* Custom credentials scheme (for example HMAC signing once the API supports it).
|
|
3827
|
+
* Mutually exclusive with `apiKey`/`apiSecret`.
|
|
3828
|
+
*/
|
|
3829
|
+
authenticator?: Authenticator;
|
|
3830
|
+
/** Default `https://api.cexy.io`. Must be `https://` (see `allowInsecure`). */
|
|
3831
|
+
baseUrl?: string;
|
|
3832
|
+
/**
|
|
3833
|
+
* Allow plain `http://` (and `ws://` for `websocket()`), but ONLY for a local host
|
|
3834
|
+
* (`localhost`, `127.0.0.1`, `::1`), e.g. a local mock server in tests. Default false.
|
|
3835
|
+
*/
|
|
3836
|
+
allowInsecure?: boolean;
|
|
3837
|
+
/** Per-attempt timeout. Default 10000 ms. */
|
|
3838
|
+
timeoutMs?: number;
|
|
3839
|
+
/** Retries after the first attempt for retryable failures. Default 3. */
|
|
3840
|
+
maxRetries?: number;
|
|
3841
|
+
/** A `fetch` implementation. Default: the global `fetch` (Node 20+, browsers). */
|
|
3842
|
+
fetch?: FetchLike;
|
|
3843
|
+
/**
|
|
3844
|
+
* Client-side rate limit in requests per minute, or `false` to disable. Default 100/min
|
|
3845
|
+
* without credentials (the server allows about 120/min per IP for anonymous calls) and
|
|
3846
|
+
* 300/min with an API key (the server allows about 600/min per key). It adapts downwards
|
|
3847
|
+
* to the server's `X-RateLimit-Limit`/`-Remaining`/`-Reset` headers.
|
|
3848
|
+
*/
|
|
3849
|
+
rateLimit?: {
|
|
3850
|
+
requestsPerMinute: number;
|
|
3851
|
+
} | false;
|
|
3852
|
+
/**
|
|
3853
|
+
* Appended to the User-Agent, e.g. `"my-bot/1.2"` gives `cexy-typescript/0.1.0 my-bot/1.2`.
|
|
3854
|
+
* Browsers do not let scripts set User-Agent; there it is not sent.
|
|
3855
|
+
*/
|
|
3856
|
+
userAgentSuffix?: string;
|
|
3857
|
+
/** Called before each retry (for logging/metrics). Never receives credentials. */
|
|
3858
|
+
onRetry?: (info: RetryInfo) => void;
|
|
3859
|
+
/** @internal Replace timers in tests. */
|
|
3860
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
3861
|
+
/** @internal Deterministic jitter in tests. */
|
|
3862
|
+
random?: () => number;
|
|
3863
|
+
}
|
|
3864
|
+
/**
|
|
3865
|
+
* CEXY.io REST client.
|
|
3866
|
+
*
|
|
3867
|
+
* ```ts
|
|
3868
|
+
* const cexy = new CexyClient(); // public data only
|
|
3869
|
+
* const me = new CexyClient({ apiKey, apiSecret }); // + account, wallet reads, trading
|
|
3870
|
+
* ```
|
|
3871
|
+
*/
|
|
3872
|
+
declare class CexyClient {
|
|
3873
|
+
#private;
|
|
3874
|
+
readonly markets: MarketsResource;
|
|
3875
|
+
readonly assets: AssetsResource;
|
|
3876
|
+
readonly networks: NetworksResource;
|
|
3877
|
+
readonly fees: FeesResource;
|
|
3878
|
+
readonly pools: PoolsResource;
|
|
3879
|
+
readonly account: AccountResource;
|
|
3880
|
+
readonly exports: ExportsResource;
|
|
3881
|
+
readonly wallet: WalletResource;
|
|
3882
|
+
readonly trading: TradingResource;
|
|
3883
|
+
constructor(options?: CexyClientOptions);
|
|
3884
|
+
/** True if the client holds credentials (private endpoints are available). */
|
|
3885
|
+
get hasCredentials(): boolean;
|
|
3886
|
+
get baseUrl(): string;
|
|
3887
|
+
/** Current client-side rate limit state, or null when disabled. */
|
|
3888
|
+
get rateLimit(): {
|
|
3889
|
+
requestsPerMinute: number;
|
|
3890
|
+
tokens: number;
|
|
3891
|
+
blockedUntil: number;
|
|
3892
|
+
} | null;
|
|
3893
|
+
/** The User-Agent this client sends (null in browsers). */
|
|
3894
|
+
get userAgent(): string | null;
|
|
3895
|
+
/** Server clock. Compare it with yours to detect skew. */
|
|
3896
|
+
time(opts?: RequestOptions): Promise<ServerTime>;
|
|
3897
|
+
/** Public exchange configuration (maintenance state, page sizes, WebSocket path, ...). */
|
|
3898
|
+
config(opts?: RequestOptions): Promise<ExchangeConfig>;
|
|
3899
|
+
/**
|
|
3900
|
+
* A WebSocket client for the same deployment, wired to this client for order-book
|
|
3901
|
+
* snapshots. Call `connect()` on it.
|
|
3902
|
+
*/
|
|
3903
|
+
websocket(options?: Omit<CexyWebSocketOptions, "restClient">): CexyWebSocket;
|
|
3904
|
+
toString(): string;
|
|
3905
|
+
toJSON(): Record<string, unknown>;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
/**
|
|
3909
|
+
* An exact decimal amount as a string, e.g. `"0.00150000"`. The API never uses JSON numbers
|
|
3910
|
+
* for money. Do arithmetic with a decimal library (decimal.js, big.js, ...), never with `number`.
|
|
3911
|
+
*/
|
|
3912
|
+
type Amount = string;
|
|
3913
|
+
/** True if `value` is a well-formed decimal string (`"1"`, `"0.5"`, `"-2.25"`). */
|
|
3914
|
+
declare function isAmount(value: unknown): value is Amount;
|
|
3915
|
+
/**
|
|
3916
|
+
* Throws `InvalidAmountError` if an amount field holds a number, bigint or malformed string.
|
|
3917
|
+
* `null`/`undefined` are allowed (optional fields). Called before any request is sent.
|
|
3918
|
+
*/
|
|
3919
|
+
declare function assertAmountFields(body: Record<string, unknown>, fields: readonly string[], context: string): void;
|
|
3920
|
+
|
|
3921
|
+
/** SDK version, kept in sync with package.json (a test enforces this). */
|
|
3922
|
+
declare const VERSION = "0.1.0-dev.0";
|
|
3923
|
+
/** Default User-Agent product token. */
|
|
3924
|
+
declare const USER_AGENT = "cexy-typescript/0.1.0-dev.0";
|
|
3925
|
+
|
|
3926
|
+
/** True for loopback hosts, the only ones where plain-text transport may be allowed. */
|
|
3927
|
+
declare function isLocalHost(hostname: string): boolean;
|
|
3928
|
+
|
|
3929
|
+
export { AccountResource, type Amount, type ApiKey, ApiKeyAuthenticator, type ApiScope, type Asset, type AssetNetwork, AssetsResource, type AuthRequest, type AuthResult, type AuthenticatedFrame, AuthenticationError, type Authenticator, type Balance, type BalanceUpdatedEvent, type BookLevel, type CancelAllParams, type CancelAllRequest, type CancelAllResult, type Candle, type CandleInterval, CexyApiError, type CexyApiErrorInit, CexyClient, type CexyClientOptions, CexyConfigError, CexyConnectionError, CexyError, CexyTimeoutError, CexyWebSocket, CexyWebSocketError, type CexyWebSocketEvents, type CexyWebSocketOptions, type CloseInfo, ConflictError, type CursorParams, DEFAULT_BASE_URL, DEFAULT_RPM_ANONYMOUS, DEFAULT_RPM_WITH_KEY, DEFAULT_WS_URL, type Deposit, type DepositAddress, type DepositEvent, type DepositStatus, type ErrorBody, type ErrorCode, type ErrorFrame, type EventMap, type ExchangeConfig, type ExitPoolRequest, type ExitPoolResult, ExportsResource, type FeeSchedule, FeesResource, type FetchLike, type Fill, ForbiddenError, InvalidAmountError, type IterateOptions, type JoinPoolRequest, type JoinPoolResult, KNOWN_EVENT_TYPES, type KnownErrorCode, type LedgerEntry, type LedgerEntryKind, type LiquidityRole, type Listener, LiveOrderBook, type LiveOrderBookEvents, type LiveOrderBookOptions, type MaintenanceState, type Market, type MarketStatus, type MarketStatusEvent, MarketsResource, type Network, NetworksResource, NotFoundError, type Notification, type NotificationKind, OPERATIONS, type OperationAuth, type OperationId, type OperationInfo, type OperationScope, type Order, type OrderBook, type OrderBookUpdateData, type OrderBookUpdateEvent, type OrderEvent, type OrderSide, OrderStateUnknownError, type OrderStatus, type OrderType, PRIVATE_CHANNELS, type Page, type PlaceOrderRequest, type PlaceOrderResponse, type PlaceOrderResult, type PongFrame, type Pool, type PoolStatus, PoolsResource, type PublicTrade, type QueryOf, RateLimitError, RateLimiter, type RateLimiterOptions, type RateLimiterState, type ReconnectOptions, type RequestOptions, type ResyncReason, type RetryInfo, SUPPORTED_PROTOCOL_VERSION, ServerError, type ServerTime, type SessionRevokedData, type SessionRevokedEvent, type SnapshotSource, type SortDirection, type SubAccount, type SubscribeResult, type SubscribedFrame, type TickerUpdateEvent, type TimeInForce, type TradeNewEvent, TradingResource, type TriggerDirection, TypedEmitter, USER_AGENT, UnprocessableError, type UnsubscribedFrame, VERSION, ValidationError, WS_BOOK_DEPTH, WalletResource, type WebSocketConstructor, type WebSocketLike, type WelcomeFrame, type Withdrawal, type WithdrawalAddress, type WithdrawalStatus, type WithdrawalUpdatedEvent, type WsEvent, type WsLogger, assertAmountFields, type components, errorFromResponse, isAmount, isKnownErrorCode, isLocalHost, isRetryable, type operations, paginate, type paths };
|