ccxt 4.1.73 → 4.1.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -8
- package/dist/ccxt.browser.js +699 -1337
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -4
- package/dist/cjs/src/base/Exchange.js +25 -2
- package/dist/cjs/src/bybit.js +30 -7
- package/dist/cjs/src/cex.js +61 -3
- package/dist/cjs/src/exmo.js +34 -31
- package/dist/cjs/src/kraken.js +2 -0
- package/dist/cjs/src/okx.js +45 -2
- package/dist/cjs/src/pro/cex.js +317 -10
- package/js/ccxt.d.ts +2 -5
- package/js/ccxt.js +2 -4
- package/js/src/abstract/kraken.d.ts +2 -0
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +25 -2
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +30 -7
- package/js/src/cex.d.ts +1 -0
- package/js/src/cex.js +61 -3
- package/js/src/exmo.d.ts +1 -1
- package/js/src/exmo.js +34 -31
- package/js/src/kraken.js +2 -0
- package/js/src/okx.d.ts +2 -0
- package/js/src/okx.js +45 -2
- package/js/src/pro/cex.d.ts +11 -2
- package/js/src/pro/cex.js +318 -11
- package/package.json +1 -1
- package/js/src/abstract/tidex.d.ts +0 -28
- package/js/src/abstract/tidex.js +0 -11
package/js/src/pro/cex.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import cexRest from '../cex.js';
|
|
9
|
-
import {
|
|
9
|
+
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
10
|
+
import { ArgumentsRequired, ExchangeError, BadRequest } from '../base/errors.js';
|
|
10
11
|
import { Precise } from '../base/Precise.js';
|
|
11
12
|
import { ArrayCacheBySymbolById, ArrayCacheByTimestamp, ArrayCache } from '../base/ws/Cache.js';
|
|
12
|
-
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
export default class cex extends cexRest {
|
|
15
15
|
describe() {
|
|
@@ -25,6 +25,14 @@ export default class cex extends cexRest {
|
|
|
25
25
|
'watchOrderBook': true,
|
|
26
26
|
'watchOHLCV': true,
|
|
27
27
|
'watchPosition': undefined,
|
|
28
|
+
'createOrderWs': true,
|
|
29
|
+
'editOrderWs': true,
|
|
30
|
+
'cancelOrderWs': true,
|
|
31
|
+
'cancelOrdersWs': true,
|
|
32
|
+
'fetchOrderWs': true,
|
|
33
|
+
'fetchOpenOrdersWs': true,
|
|
34
|
+
'fetchTickerWs': true,
|
|
35
|
+
'fetchBalanceWs': true,
|
|
28
36
|
},
|
|
29
37
|
'urls': {
|
|
30
38
|
'api': {
|
|
@@ -41,7 +49,7 @@ export default class cex extends cexRest {
|
|
|
41
49
|
requestId() {
|
|
42
50
|
const requestId = this.sum(this.safeInteger(this.options, 'requestId', 0), 1);
|
|
43
51
|
this.options['requestId'] = requestId;
|
|
44
|
-
return requestId;
|
|
52
|
+
return requestId.toString();
|
|
45
53
|
}
|
|
46
54
|
async watchBalance(params = {}) {
|
|
47
55
|
/**
|
|
@@ -53,7 +61,7 @@ export default class cex extends cexRest {
|
|
|
53
61
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
54
62
|
*/
|
|
55
63
|
await this.authenticate(params);
|
|
56
|
-
const messageHash =
|
|
64
|
+
const messageHash = this.requestId();
|
|
57
65
|
const url = this.urls['api']['ws'];
|
|
58
66
|
const subscribe = {
|
|
59
67
|
'e': 'get-balance',
|
|
@@ -100,7 +108,8 @@ export default class cex extends cexRest {
|
|
|
100
108
|
result[code] = account;
|
|
101
109
|
}
|
|
102
110
|
this.balance = this.safeBalance(result);
|
|
103
|
-
|
|
111
|
+
const messageHash = this.safeString(message, 'oid');
|
|
112
|
+
client.resolve(this.balance, messageHash);
|
|
104
113
|
}
|
|
105
114
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
106
115
|
/**
|
|
@@ -290,6 +299,27 @@ export default class cex extends cexRest {
|
|
|
290
299
|
}
|
|
291
300
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
292
301
|
}
|
|
302
|
+
async fetchTickerWs(symbol, params = {}) {
|
|
303
|
+
/**
|
|
304
|
+
* @method
|
|
305
|
+
* @name cex#fetchTickerWs
|
|
306
|
+
* @see https://docs.cex.io/#ws-api-ticker-deprecated
|
|
307
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
308
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
309
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
310
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
311
|
+
*/
|
|
312
|
+
await this.loadMarkets();
|
|
313
|
+
const market = this.market(symbol);
|
|
314
|
+
const url = this.urls['api']['ws'];
|
|
315
|
+
const messageHash = this.requestId();
|
|
316
|
+
const request = this.extend({
|
|
317
|
+
'e': 'ticker',
|
|
318
|
+
'oid': messageHash,
|
|
319
|
+
'data': [market['base'], market['quote']],
|
|
320
|
+
}, params);
|
|
321
|
+
return await this.watch(url, messageHash, request, messageHash);
|
|
322
|
+
}
|
|
293
323
|
handleTicker(client, message) {
|
|
294
324
|
//
|
|
295
325
|
// {
|
|
@@ -306,10 +336,12 @@ export default class cex extends cexRest {
|
|
|
306
336
|
const data = this.safeValue(message, 'data', {});
|
|
307
337
|
const ticker = this.parseWsTicker(data);
|
|
308
338
|
const symbol = ticker['symbol'];
|
|
309
|
-
const messageHash = 'ticker:' + symbol;
|
|
310
339
|
this.tickers[symbol] = ticker;
|
|
340
|
+
let messageHash = 'ticker:' + symbol;
|
|
311
341
|
client.resolve(ticker, messageHash);
|
|
312
342
|
client.resolve(ticker, 'tickers');
|
|
343
|
+
messageHash = this.safeString(message, 'oid');
|
|
344
|
+
client.resolve(ticker, messageHash);
|
|
313
345
|
}
|
|
314
346
|
parseWsTicker(ticker, market = undefined) {
|
|
315
347
|
//
|
|
@@ -374,6 +406,25 @@ export default class cex extends cexRest {
|
|
|
374
406
|
'info': ticker,
|
|
375
407
|
}, market);
|
|
376
408
|
}
|
|
409
|
+
async fetchBalanceWs(params = {}) {
|
|
410
|
+
/**
|
|
411
|
+
* @method
|
|
412
|
+
* @name cex#fetchBalanceWs
|
|
413
|
+
* @see https://docs.cex.io/#ws-api-get-balance
|
|
414
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
415
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
416
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure}
|
|
417
|
+
*/
|
|
418
|
+
await this.loadMarkets();
|
|
419
|
+
await this.authenticate();
|
|
420
|
+
const url = this.urls['api']['ws'];
|
|
421
|
+
const messageHash = this.requestId();
|
|
422
|
+
const request = this.extend({
|
|
423
|
+
'e': 'get-balance',
|
|
424
|
+
'oid': messageHash,
|
|
425
|
+
}, params);
|
|
426
|
+
return await this.watch(url, messageHash, request, messageHash);
|
|
427
|
+
}
|
|
377
428
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
378
429
|
/**
|
|
379
430
|
* @method
|
|
@@ -662,7 +713,8 @@ export default class cex extends cexRest {
|
|
|
662
713
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
663
714
|
this.orders = new ArrayCacheBySymbolById(limit);
|
|
664
715
|
}
|
|
665
|
-
const
|
|
716
|
+
const storedOrders = this.orders;
|
|
717
|
+
const ordersBySymbol = this.safeValue(storedOrders.hashmap, symbol, {});
|
|
666
718
|
let order = this.safeValue(ordersBySymbol, orderId);
|
|
667
719
|
if (order === undefined) {
|
|
668
720
|
order = this.parseWsOrderUpdate(data, market);
|
|
@@ -687,7 +739,6 @@ export default class cex extends cexRest {
|
|
|
687
739
|
order['timestamp'] = timestamp;
|
|
688
740
|
order['datetime'] = this.iso8601(timestamp);
|
|
689
741
|
order = this.safeOrder(order);
|
|
690
|
-
const storedOrders = this.orders;
|
|
691
742
|
storedOrders.append(order);
|
|
692
743
|
const messageHash = 'orders:' + symbol;
|
|
693
744
|
client.resolve(storedOrders, messageHash);
|
|
@@ -748,7 +799,10 @@ export default class cex extends cexRest {
|
|
|
748
799
|
}
|
|
749
800
|
const base = this.safeCurrencyCode(baseId);
|
|
750
801
|
const quote = this.safeCurrencyCode(quoteId);
|
|
751
|
-
|
|
802
|
+
let symbol = undefined;
|
|
803
|
+
if (base !== undefined && quote !== undefined) {
|
|
804
|
+
symbol = base + '/' + quote;
|
|
805
|
+
}
|
|
752
806
|
market = this.safeMarket(symbol, market);
|
|
753
807
|
const time = this.safeInteger(order, 'time', this.milliseconds());
|
|
754
808
|
let timestamp = time;
|
|
@@ -1113,6 +1167,236 @@ export default class cex extends cexRest {
|
|
|
1113
1167
|
client.resolve(stored, messageHash);
|
|
1114
1168
|
}
|
|
1115
1169
|
}
|
|
1170
|
+
async fetchOrderWs(id, symbol = undefined, params = {}) {
|
|
1171
|
+
/**
|
|
1172
|
+
* @method
|
|
1173
|
+
* @name cex#fetchOrderWs
|
|
1174
|
+
* @description fetches information on an order made by the user
|
|
1175
|
+
* @see https://docs.cex.io/#ws-api-get-order
|
|
1176
|
+
* @param {string} symbol not used by cex fetchOrder
|
|
1177
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
1178
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1179
|
+
*/
|
|
1180
|
+
await this.loadMarkets();
|
|
1181
|
+
await this.authenticate();
|
|
1182
|
+
let market = undefined;
|
|
1183
|
+
if (symbol !== undefined) {
|
|
1184
|
+
market = this.market(symbol);
|
|
1185
|
+
}
|
|
1186
|
+
const data = this.extend({
|
|
1187
|
+
'order_id': id.toString(),
|
|
1188
|
+
}, params);
|
|
1189
|
+
const url = this.urls['api']['ws'];
|
|
1190
|
+
const messageHash = this.requestId();
|
|
1191
|
+
const request = {
|
|
1192
|
+
'e': 'get-order',
|
|
1193
|
+
'oid': messageHash,
|
|
1194
|
+
'data': data,
|
|
1195
|
+
};
|
|
1196
|
+
const response = await this.watch(url, messageHash, request, messageHash);
|
|
1197
|
+
return this.parseOrder(response, market);
|
|
1198
|
+
}
|
|
1199
|
+
async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1200
|
+
/**
|
|
1201
|
+
* @method
|
|
1202
|
+
* @name cex#fetchOpenOrdersWs
|
|
1203
|
+
* @see https://docs.cex.io/#ws-api-open-orders
|
|
1204
|
+
* @description fetch all unfilled currently open orders
|
|
1205
|
+
* @param {string} symbol unified market symbol
|
|
1206
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1207
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
1208
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
1209
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1210
|
+
*/
|
|
1211
|
+
if (symbol === undefined) {
|
|
1212
|
+
throw new ArgumentsRequired(this.id + 'fetchOpenOrdersWs requires a symbol.');
|
|
1213
|
+
}
|
|
1214
|
+
await this.loadMarkets();
|
|
1215
|
+
await this.authenticate();
|
|
1216
|
+
const market = this.market(symbol);
|
|
1217
|
+
const url = this.urls['api']['ws'];
|
|
1218
|
+
const messageHash = this.requestId();
|
|
1219
|
+
const data = this.extend({
|
|
1220
|
+
'pair': [market['baseId'], market['quoteId']],
|
|
1221
|
+
}, params);
|
|
1222
|
+
const request = {
|
|
1223
|
+
'e': 'open-orders',
|
|
1224
|
+
'oid': messageHash,
|
|
1225
|
+
'data': data,
|
|
1226
|
+
};
|
|
1227
|
+
const response = await this.watch(url, messageHash, request, messageHash);
|
|
1228
|
+
return this.parseOrders(response, market, since, limit, params);
|
|
1229
|
+
}
|
|
1230
|
+
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1231
|
+
/**
|
|
1232
|
+
* @method
|
|
1233
|
+
* @name cex#createOrderWs
|
|
1234
|
+
* @see https://docs.cex.io/#ws-api-order-placement
|
|
1235
|
+
* @description create a trade order
|
|
1236
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1237
|
+
* @param {string} type 'market' or 'limit'
|
|
1238
|
+
* @param {string} side 'buy' or 'sell'
|
|
1239
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1240
|
+
* @param {float} price the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1241
|
+
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
1242
|
+
* @param {boolean} [params.maker_only] Optional, maker only places an order only if offers best sell (<= max) or buy(>= max) price for this pair, if not order placement will be rejected with an error - "Order is not maker"
|
|
1243
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
1244
|
+
*/
|
|
1245
|
+
if (price === undefined) {
|
|
1246
|
+
throw new BadRequest(this.id + ' createOrderWs requires a price argument');
|
|
1247
|
+
}
|
|
1248
|
+
await this.loadMarkets();
|
|
1249
|
+
await this.authenticate();
|
|
1250
|
+
const market = this.market(symbol);
|
|
1251
|
+
const url = this.urls['api']['ws'];
|
|
1252
|
+
const messageHash = this.requestId();
|
|
1253
|
+
const data = this.extend({
|
|
1254
|
+
'pair': [market['baseId'], market['quoteId']],
|
|
1255
|
+
'amount': amount,
|
|
1256
|
+
'price': price,
|
|
1257
|
+
'type': side,
|
|
1258
|
+
}, params);
|
|
1259
|
+
const request = {
|
|
1260
|
+
'e': 'place-order',
|
|
1261
|
+
'oid': messageHash,
|
|
1262
|
+
'data': data,
|
|
1263
|
+
};
|
|
1264
|
+
const rawOrder = await this.watch(url, messageHash, request, messageHash);
|
|
1265
|
+
return this.parseOrder(rawOrder, market);
|
|
1266
|
+
}
|
|
1267
|
+
async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1268
|
+
/**
|
|
1269
|
+
* @method
|
|
1270
|
+
* @name cex#editOrderWs
|
|
1271
|
+
* @description edit a trade order
|
|
1272
|
+
* @see https://docs.cex.io/#ws-api-cancel-replace
|
|
1273
|
+
* @param {string} id order id
|
|
1274
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1275
|
+
* @param {string} type 'market' or 'limit'
|
|
1276
|
+
* @param {string} side 'buy' or 'sell'
|
|
1277
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
1278
|
+
* @param {float|undefined} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1279
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
1280
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
|
|
1281
|
+
*/
|
|
1282
|
+
if (amount === undefined) {
|
|
1283
|
+
throw new ArgumentsRequired(this.id + ' editOrder() requires a amount argument');
|
|
1284
|
+
}
|
|
1285
|
+
if (price === undefined) {
|
|
1286
|
+
throw new ArgumentsRequired(this.id + ' editOrder() requires a price argument');
|
|
1287
|
+
}
|
|
1288
|
+
await this.loadMarkets();
|
|
1289
|
+
await this.authenticate();
|
|
1290
|
+
const market = this.market(symbol);
|
|
1291
|
+
const data = this.extend({
|
|
1292
|
+
'pair': [market['baseId'], market['quoteId']],
|
|
1293
|
+
'type': side,
|
|
1294
|
+
'amount': amount,
|
|
1295
|
+
'price': price,
|
|
1296
|
+
'order_id': id,
|
|
1297
|
+
}, params);
|
|
1298
|
+
const messageHash = this.requestId();
|
|
1299
|
+
const url = this.urls['api']['ws'];
|
|
1300
|
+
const request = {
|
|
1301
|
+
'e': 'cancel-replace-order',
|
|
1302
|
+
'oid': messageHash,
|
|
1303
|
+
'data': data,
|
|
1304
|
+
};
|
|
1305
|
+
const response = await this.watch(url, messageHash, request, messageHash, messageHash);
|
|
1306
|
+
return this.parseOrder(response, market);
|
|
1307
|
+
}
|
|
1308
|
+
async cancelOrderWs(id, symbol = undefined, params = {}) {
|
|
1309
|
+
/**
|
|
1310
|
+
* @method
|
|
1311
|
+
* @name cex#cancelOrderWs
|
|
1312
|
+
* @see https://docs.cex.io/#ws-api-order-cancel
|
|
1313
|
+
* @description cancels an open order
|
|
1314
|
+
* @param {string} id order id
|
|
1315
|
+
* @param {string} symbol not used by cex cancelOrder ()
|
|
1316
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
1317
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1318
|
+
*/
|
|
1319
|
+
await this.loadMarkets();
|
|
1320
|
+
await this.authenticate();
|
|
1321
|
+
let market = undefined;
|
|
1322
|
+
if (symbol !== undefined) {
|
|
1323
|
+
market = this.market(symbol);
|
|
1324
|
+
}
|
|
1325
|
+
const data = this.extend({
|
|
1326
|
+
'order_id': id,
|
|
1327
|
+
}, params);
|
|
1328
|
+
const messageHash = this.requestId();
|
|
1329
|
+
const url = this.urls['api']['ws'];
|
|
1330
|
+
const request = {
|
|
1331
|
+
'e': 'cancel-order',
|
|
1332
|
+
'oid': messageHash,
|
|
1333
|
+
'data': data,
|
|
1334
|
+
};
|
|
1335
|
+
const response = await this.watch(url, messageHash, request, messageHash, messageHash);
|
|
1336
|
+
return this.parseOrder(response, market);
|
|
1337
|
+
}
|
|
1338
|
+
async cancelOrdersWs(ids, symbol = undefined, params = {}) {
|
|
1339
|
+
/**
|
|
1340
|
+
* @method
|
|
1341
|
+
* @name cex#cancelOrdersWs
|
|
1342
|
+
* @description cancel multiple orders
|
|
1343
|
+
* @see https://docs.cex.io/#ws-api-mass-cancel-place
|
|
1344
|
+
* @param {string[]} ids order ids
|
|
1345
|
+
* @param {string} symbol not used by cex cancelOrders()
|
|
1346
|
+
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
1347
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1348
|
+
*/
|
|
1349
|
+
if (symbol !== undefined) {
|
|
1350
|
+
throw new BadRequest(this.id + ' cancelOrderWs does not allow filtering by symbol');
|
|
1351
|
+
}
|
|
1352
|
+
await this.loadMarkets();
|
|
1353
|
+
await this.authenticate();
|
|
1354
|
+
const messageHash = this.requestId();
|
|
1355
|
+
const data = this.extend({
|
|
1356
|
+
'cancel-orders': ids,
|
|
1357
|
+
}, params);
|
|
1358
|
+
const url = this.urls['api']['ws'];
|
|
1359
|
+
const request = {
|
|
1360
|
+
'e': 'mass-cancel-place-orders',
|
|
1361
|
+
'oid': messageHash,
|
|
1362
|
+
'data': data,
|
|
1363
|
+
};
|
|
1364
|
+
const response = await this.watch(url, messageHash, request, messageHash, messageHash);
|
|
1365
|
+
//
|
|
1366
|
+
// {
|
|
1367
|
+
// "cancel-orders": [{
|
|
1368
|
+
// "order_id": 69202557979,
|
|
1369
|
+
// "fremains": "0.15000000"
|
|
1370
|
+
// }],
|
|
1371
|
+
// "place-orders": [],
|
|
1372
|
+
// "placed-cancelled": []
|
|
1373
|
+
// }
|
|
1374
|
+
//
|
|
1375
|
+
const canceledOrders = this.safeValue(response, 'cancel-orders');
|
|
1376
|
+
return this.parseOrders(canceledOrders, undefined, undefined, undefined, params);
|
|
1377
|
+
}
|
|
1378
|
+
resolveData(client, message) {
|
|
1379
|
+
//
|
|
1380
|
+
// "e": "open-orders",
|
|
1381
|
+
// "data": [
|
|
1382
|
+
// {
|
|
1383
|
+
// "id": "2477098",
|
|
1384
|
+
// "time": "1435927928618",
|
|
1385
|
+
// "type": "buy",
|
|
1386
|
+
// "price": "241.9477",
|
|
1387
|
+
// "amount": "0.02000000",
|
|
1388
|
+
// "pending": "0.02000000"
|
|
1389
|
+
// },
|
|
1390
|
+
// ...
|
|
1391
|
+
// ],
|
|
1392
|
+
// "oid": "1435927928274_9_open-orders",
|
|
1393
|
+
// "ok": "ok"
|
|
1394
|
+
// }
|
|
1395
|
+
//
|
|
1396
|
+
const data = this.safeValue(message, 'data');
|
|
1397
|
+
const messageHash = this.safeString(message, 'oid');
|
|
1398
|
+
client.resolve(data, messageHash);
|
|
1399
|
+
}
|
|
1116
1400
|
handleConnected(client, message) {
|
|
1117
1401
|
//
|
|
1118
1402
|
// {
|
|
@@ -1130,7 +1414,25 @@ export default class cex extends cexRest {
|
|
|
1130
1414
|
// "ok": "error"
|
|
1131
1415
|
// }
|
|
1132
1416
|
//
|
|
1133
|
-
|
|
1417
|
+
try {
|
|
1418
|
+
const data = this.safeValue(message, 'data', {});
|
|
1419
|
+
const error = this.safeString(data, 'error');
|
|
1420
|
+
const event = this.safeString(message, 'e', '');
|
|
1421
|
+
const feedback = this.id + ' ' + event + ' ' + error;
|
|
1422
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], error, feedback);
|
|
1423
|
+
this.throwBroadlyMatchedException(this.exceptions['broad'], error, feedback);
|
|
1424
|
+
throw new ExchangeError(feedback);
|
|
1425
|
+
}
|
|
1426
|
+
catch (error) {
|
|
1427
|
+
const messageHash = this.safeString(message, 'oid');
|
|
1428
|
+
const future = this.safeValue(client['futures'], messageHash);
|
|
1429
|
+
if (future !== undefined) {
|
|
1430
|
+
client.reject(error, messageHash);
|
|
1431
|
+
}
|
|
1432
|
+
else {
|
|
1433
|
+
throw error;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1134
1436
|
}
|
|
1135
1437
|
handleMessage(client, message) {
|
|
1136
1438
|
const ok = this.safeString(message, 'ok');
|
|
@@ -1150,11 +1452,16 @@ export default class cex extends cexRest {
|
|
|
1150
1452
|
'get-balance': this.handleBalance,
|
|
1151
1453
|
'order-book-subscribe': this.handleOrderBookSnapshot,
|
|
1152
1454
|
'md_update': this.handleOrderBookUpdate,
|
|
1153
|
-
'open-orders': this.
|
|
1455
|
+
'open-orders': this.resolveData,
|
|
1154
1456
|
'order': this.handleOrderUpdate,
|
|
1155
1457
|
'history-update': this.handleTrade,
|
|
1156
1458
|
'history': this.handleTradesSnapshot,
|
|
1157
1459
|
'tx': this.handleTransaction,
|
|
1460
|
+
'place-order': this.resolveData,
|
|
1461
|
+
'cancel-replace-order': this.resolveData,
|
|
1462
|
+
'cancel-order': this.resolveData,
|
|
1463
|
+
'mass-cancel-place-orders': this.resolveData,
|
|
1464
|
+
'get-order': this.resolveData,
|
|
1158
1465
|
};
|
|
1159
1466
|
const handler = this.safeValue(handlers, event);
|
|
1160
1467
|
if (handler !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { implicitReturnType } from '../base/types.js';
|
|
2
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
-
interface Exchange {
|
|
4
|
-
webGetCurrency(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
webGetPairs(params?: {}): Promise<implicitReturnType>;
|
|
6
|
-
webGetTickers(params?: {}): Promise<implicitReturnType>;
|
|
7
|
-
webGetOrders(params?: {}): Promise<implicitReturnType>;
|
|
8
|
-
webGetOrdershistory(params?: {}): Promise<implicitReturnType>;
|
|
9
|
-
webGetTradeData(params?: {}): Promise<implicitReturnType>;
|
|
10
|
-
webGetTradeDataId(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
publicGetInfo(params?: {}): Promise<implicitReturnType>;
|
|
12
|
-
publicGetTickerPair(params?: {}): Promise<implicitReturnType>;
|
|
13
|
-
publicGetDepthPair(params?: {}): Promise<implicitReturnType>;
|
|
14
|
-
publicGetTradesPair(params?: {}): Promise<implicitReturnType>;
|
|
15
|
-
privatePostGetInfoExt(params?: {}): Promise<implicitReturnType>;
|
|
16
|
-
privatePostGetInfo(params?: {}): Promise<implicitReturnType>;
|
|
17
|
-
privatePostTrade(params?: {}): Promise<implicitReturnType>;
|
|
18
|
-
privatePostActiveOrders(params?: {}): Promise<implicitReturnType>;
|
|
19
|
-
privatePostOrderInfo(params?: {}): Promise<implicitReturnType>;
|
|
20
|
-
privatePostCancelOrder(params?: {}): Promise<implicitReturnType>;
|
|
21
|
-
privatePostTradeHistory(params?: {}): Promise<implicitReturnType>;
|
|
22
|
-
privatePostGetDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
23
|
-
privatePostCreateWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
24
|
-
privatePostGetWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
25
|
-
}
|
|
26
|
-
declare abstract class Exchange extends _Exchange {
|
|
27
|
-
}
|
|
28
|
-
export default Exchange;
|
package/js/src/abstract/tidex.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// ----------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
-
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
-
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
-
|
|
7
|
-
// -------------------------------------------------------------------------------
|
|
8
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
-
class Exchange extends _Exchange {
|
|
10
|
-
}
|
|
11
|
-
export default Exchange;
|