ccxt 4.1.72 → 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.
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var cex$1 = require('../cex.js');
4
+ var sha256 = require('../static_dependencies/noble-hashes/sha256.js');
4
5
  var errors = require('../base/errors.js');
5
6
  var Precise = require('../base/Precise.js');
6
7
  var Cache = require('../base/ws/Cache.js');
7
- var sha256 = require('../static_dependencies/noble-hashes/sha256.js');
8
8
 
9
9
  // ---------------------------------------------------------------------------
10
10
  // ---------------------------------------------------------------------------
@@ -22,6 +22,14 @@ class cex extends cex$1 {
22
22
  'watchOrderBook': true,
23
23
  'watchOHLCV': true,
24
24
  'watchPosition': undefined,
25
+ 'createOrderWs': true,
26
+ 'editOrderWs': true,
27
+ 'cancelOrderWs': true,
28
+ 'cancelOrdersWs': true,
29
+ 'fetchOrderWs': true,
30
+ 'fetchOpenOrdersWs': true,
31
+ 'fetchTickerWs': true,
32
+ 'fetchBalanceWs': true,
25
33
  },
26
34
  'urls': {
27
35
  'api': {
@@ -38,7 +46,7 @@ class cex extends cex$1 {
38
46
  requestId() {
39
47
  const requestId = this.sum(this.safeInteger(this.options, 'requestId', 0), 1);
40
48
  this.options['requestId'] = requestId;
41
- return requestId;
49
+ return requestId.toString();
42
50
  }
43
51
  async watchBalance(params = {}) {
44
52
  /**
@@ -50,7 +58,7 @@ class cex extends cex$1 {
50
58
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
51
59
  */
52
60
  await this.authenticate(params);
53
- const messageHash = 'balance';
61
+ const messageHash = this.requestId();
54
62
  const url = this.urls['api']['ws'];
55
63
  const subscribe = {
56
64
  'e': 'get-balance',
@@ -97,7 +105,8 @@ class cex extends cex$1 {
97
105
  result[code] = account;
98
106
  }
99
107
  this.balance = this.safeBalance(result);
100
- client.resolve(this.balance, 'balance');
108
+ const messageHash = this.safeString(message, 'oid');
109
+ client.resolve(this.balance, messageHash);
101
110
  }
102
111
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
103
112
  /**
@@ -287,6 +296,27 @@ class cex extends cex$1 {
287
296
  }
288
297
  return this.filterByArray(this.tickers, 'symbol', symbols);
289
298
  }
299
+ async fetchTickerWs(symbol, params = {}) {
300
+ /**
301
+ * @method
302
+ * @name cex#fetchTickerWs
303
+ * @see https://docs.cex.io/#ws-api-ticker-deprecated
304
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
305
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
306
+ * @param {object} [params] extra parameters specific to the cex api endpoint
307
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
308
+ */
309
+ await this.loadMarkets();
310
+ const market = this.market(symbol);
311
+ const url = this.urls['api']['ws'];
312
+ const messageHash = this.requestId();
313
+ const request = this.extend({
314
+ 'e': 'ticker',
315
+ 'oid': messageHash,
316
+ 'data': [market['base'], market['quote']],
317
+ }, params);
318
+ return await this.watch(url, messageHash, request, messageHash);
319
+ }
290
320
  handleTicker(client, message) {
291
321
  //
292
322
  // {
@@ -303,10 +333,12 @@ class cex extends cex$1 {
303
333
  const data = this.safeValue(message, 'data', {});
304
334
  const ticker = this.parseWsTicker(data);
305
335
  const symbol = ticker['symbol'];
306
- const messageHash = 'ticker:' + symbol;
307
336
  this.tickers[symbol] = ticker;
337
+ let messageHash = 'ticker:' + symbol;
308
338
  client.resolve(ticker, messageHash);
309
339
  client.resolve(ticker, 'tickers');
340
+ messageHash = this.safeString(message, 'oid');
341
+ client.resolve(ticker, messageHash);
310
342
  }
311
343
  parseWsTicker(ticker, market = undefined) {
312
344
  //
@@ -371,6 +403,25 @@ class cex extends cex$1 {
371
403
  'info': ticker,
372
404
  }, market);
373
405
  }
406
+ async fetchBalanceWs(params = {}) {
407
+ /**
408
+ * @method
409
+ * @name cex#fetchBalanceWs
410
+ * @see https://docs.cex.io/#ws-api-get-balance
411
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
412
+ * @param {object} [params] extra parameters specific to the cex api endpoint
413
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure}
414
+ */
415
+ await this.loadMarkets();
416
+ await this.authenticate();
417
+ const url = this.urls['api']['ws'];
418
+ const messageHash = this.requestId();
419
+ const request = this.extend({
420
+ 'e': 'get-balance',
421
+ 'oid': messageHash,
422
+ }, params);
423
+ return await this.watch(url, messageHash, request, messageHash);
424
+ }
374
425
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
375
426
  /**
376
427
  * @method
@@ -659,7 +710,8 @@ class cex extends cex$1 {
659
710
  const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
660
711
  this.orders = new Cache.ArrayCacheBySymbolById(limit);
661
712
  }
662
- const ordersBySymbol = this.safeValue(this.orders['hashmap'], symbol, {});
713
+ const storedOrders = this.orders;
714
+ const ordersBySymbol = this.safeValue(storedOrders.hashmap, symbol, {});
663
715
  let order = this.safeValue(ordersBySymbol, orderId);
664
716
  if (order === undefined) {
665
717
  order = this.parseWsOrderUpdate(data, market);
@@ -684,7 +736,6 @@ class cex extends cex$1 {
684
736
  order['timestamp'] = timestamp;
685
737
  order['datetime'] = this.iso8601(timestamp);
686
738
  order = this.safeOrder(order);
687
- const storedOrders = this.orders;
688
739
  storedOrders.append(order);
689
740
  const messageHash = 'orders:' + symbol;
690
741
  client.resolve(storedOrders, messageHash);
@@ -745,7 +796,10 @@ class cex extends cex$1 {
745
796
  }
746
797
  const base = this.safeCurrencyCode(baseId);
747
798
  const quote = this.safeCurrencyCode(quoteId);
748
- const symbol = base + '/' + quote;
799
+ let symbol = undefined;
800
+ if (base !== undefined && quote !== undefined) {
801
+ symbol = base + '/' + quote;
802
+ }
749
803
  market = this.safeMarket(symbol, market);
750
804
  const time = this.safeInteger(order, 'time', this.milliseconds());
751
805
  let timestamp = time;
@@ -1110,6 +1164,236 @@ class cex extends cex$1 {
1110
1164
  client.resolve(stored, messageHash);
1111
1165
  }
1112
1166
  }
1167
+ async fetchOrderWs(id, symbol = undefined, params = {}) {
1168
+ /**
1169
+ * @method
1170
+ * @name cex#fetchOrderWs
1171
+ * @description fetches information on an order made by the user
1172
+ * @see https://docs.cex.io/#ws-api-get-order
1173
+ * @param {string} symbol not used by cex fetchOrder
1174
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1175
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1176
+ */
1177
+ await this.loadMarkets();
1178
+ await this.authenticate();
1179
+ let market = undefined;
1180
+ if (symbol !== undefined) {
1181
+ market = this.market(symbol);
1182
+ }
1183
+ const data = this.extend({
1184
+ 'order_id': id.toString(),
1185
+ }, params);
1186
+ const url = this.urls['api']['ws'];
1187
+ const messageHash = this.requestId();
1188
+ const request = {
1189
+ 'e': 'get-order',
1190
+ 'oid': messageHash,
1191
+ 'data': data,
1192
+ };
1193
+ const response = await this.watch(url, messageHash, request, messageHash);
1194
+ return this.parseOrder(response, market);
1195
+ }
1196
+ async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1197
+ /**
1198
+ * @method
1199
+ * @name cex#fetchOpenOrdersWs
1200
+ * @see https://docs.cex.io/#ws-api-open-orders
1201
+ * @description fetch all unfilled currently open orders
1202
+ * @param {string} symbol unified market symbol
1203
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1204
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1205
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1206
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1207
+ */
1208
+ if (symbol === undefined) {
1209
+ throw new errors.ArgumentsRequired(this.id + 'fetchOpenOrdersWs requires a symbol.');
1210
+ }
1211
+ await this.loadMarkets();
1212
+ await this.authenticate();
1213
+ const market = this.market(symbol);
1214
+ const url = this.urls['api']['ws'];
1215
+ const messageHash = this.requestId();
1216
+ const data = this.extend({
1217
+ 'pair': [market['baseId'], market['quoteId']],
1218
+ }, params);
1219
+ const request = {
1220
+ 'e': 'open-orders',
1221
+ 'oid': messageHash,
1222
+ 'data': data,
1223
+ };
1224
+ const response = await this.watch(url, messageHash, request, messageHash);
1225
+ return this.parseOrders(response, market, since, limit, params);
1226
+ }
1227
+ async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
1228
+ /**
1229
+ * @method
1230
+ * @name cex#createOrderWs
1231
+ * @see https://docs.cex.io/#ws-api-order-placement
1232
+ * @description create a trade order
1233
+ * @param {string} symbol unified symbol of the market to create an order in
1234
+ * @param {string} type 'market' or 'limit'
1235
+ * @param {string} side 'buy' or 'sell'
1236
+ * @param {float} amount how much of currency you want to trade in units of base currency
1237
+ * @param {float} price the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1238
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
1239
+ * @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"
1240
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
1241
+ */
1242
+ if (price === undefined) {
1243
+ throw new errors.BadRequest(this.id + ' createOrderWs requires a price argument');
1244
+ }
1245
+ await this.loadMarkets();
1246
+ await this.authenticate();
1247
+ const market = this.market(symbol);
1248
+ const url = this.urls['api']['ws'];
1249
+ const messageHash = this.requestId();
1250
+ const data = this.extend({
1251
+ 'pair': [market['baseId'], market['quoteId']],
1252
+ 'amount': amount,
1253
+ 'price': price,
1254
+ 'type': side,
1255
+ }, params);
1256
+ const request = {
1257
+ 'e': 'place-order',
1258
+ 'oid': messageHash,
1259
+ 'data': data,
1260
+ };
1261
+ const rawOrder = await this.watch(url, messageHash, request, messageHash);
1262
+ return this.parseOrder(rawOrder, market);
1263
+ }
1264
+ async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1265
+ /**
1266
+ * @method
1267
+ * @name cex#editOrderWs
1268
+ * @description edit a trade order
1269
+ * @see https://docs.cex.io/#ws-api-cancel-replace
1270
+ * @param {string} id order id
1271
+ * @param {string} symbol unified symbol of the market to create an order in
1272
+ * @param {string} type 'market' or 'limit'
1273
+ * @param {string} side 'buy' or 'sell'
1274
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
1275
+ * @param {float|undefined} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1276
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1277
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
1278
+ */
1279
+ if (amount === undefined) {
1280
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a amount argument');
1281
+ }
1282
+ if (price === undefined) {
1283
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a price argument');
1284
+ }
1285
+ await this.loadMarkets();
1286
+ await this.authenticate();
1287
+ const market = this.market(symbol);
1288
+ const data = this.extend({
1289
+ 'pair': [market['baseId'], market['quoteId']],
1290
+ 'type': side,
1291
+ 'amount': amount,
1292
+ 'price': price,
1293
+ 'order_id': id,
1294
+ }, params);
1295
+ const messageHash = this.requestId();
1296
+ const url = this.urls['api']['ws'];
1297
+ const request = {
1298
+ 'e': 'cancel-replace-order',
1299
+ 'oid': messageHash,
1300
+ 'data': data,
1301
+ };
1302
+ const response = await this.watch(url, messageHash, request, messageHash, messageHash);
1303
+ return this.parseOrder(response, market);
1304
+ }
1305
+ async cancelOrderWs(id, symbol = undefined, params = {}) {
1306
+ /**
1307
+ * @method
1308
+ * @name cex#cancelOrderWs
1309
+ * @see https://docs.cex.io/#ws-api-order-cancel
1310
+ * @description cancels an open order
1311
+ * @param {string} id order id
1312
+ * @param {string} symbol not used by cex cancelOrder ()
1313
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1314
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1315
+ */
1316
+ await this.loadMarkets();
1317
+ await this.authenticate();
1318
+ let market = undefined;
1319
+ if (symbol !== undefined) {
1320
+ market = this.market(symbol);
1321
+ }
1322
+ const data = this.extend({
1323
+ 'order_id': id,
1324
+ }, params);
1325
+ const messageHash = this.requestId();
1326
+ const url = this.urls['api']['ws'];
1327
+ const request = {
1328
+ 'e': 'cancel-order',
1329
+ 'oid': messageHash,
1330
+ 'data': data,
1331
+ };
1332
+ const response = await this.watch(url, messageHash, request, messageHash, messageHash);
1333
+ return this.parseOrder(response, market);
1334
+ }
1335
+ async cancelOrdersWs(ids, symbol = undefined, params = {}) {
1336
+ /**
1337
+ * @method
1338
+ * @name cex#cancelOrdersWs
1339
+ * @description cancel multiple orders
1340
+ * @see https://docs.cex.io/#ws-api-mass-cancel-place
1341
+ * @param {string[]} ids order ids
1342
+ * @param {string} symbol not used by cex cancelOrders()
1343
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1344
+ * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1345
+ */
1346
+ if (symbol !== undefined) {
1347
+ throw new errors.BadRequest(this.id + ' cancelOrderWs does not allow filtering by symbol');
1348
+ }
1349
+ await this.loadMarkets();
1350
+ await this.authenticate();
1351
+ const messageHash = this.requestId();
1352
+ const data = this.extend({
1353
+ 'cancel-orders': ids,
1354
+ }, params);
1355
+ const url = this.urls['api']['ws'];
1356
+ const request = {
1357
+ 'e': 'mass-cancel-place-orders',
1358
+ 'oid': messageHash,
1359
+ 'data': data,
1360
+ };
1361
+ const response = await this.watch(url, messageHash, request, messageHash, messageHash);
1362
+ //
1363
+ // {
1364
+ // "cancel-orders": [{
1365
+ // "order_id": 69202557979,
1366
+ // "fremains": "0.15000000"
1367
+ // }],
1368
+ // "place-orders": [],
1369
+ // "placed-cancelled": []
1370
+ // }
1371
+ //
1372
+ const canceledOrders = this.safeValue(response, 'cancel-orders');
1373
+ return this.parseOrders(canceledOrders, undefined, undefined, undefined, params);
1374
+ }
1375
+ resolveData(client, message) {
1376
+ //
1377
+ // "e": "open-orders",
1378
+ // "data": [
1379
+ // {
1380
+ // "id": "2477098",
1381
+ // "time": "1435927928618",
1382
+ // "type": "buy",
1383
+ // "price": "241.9477",
1384
+ // "amount": "0.02000000",
1385
+ // "pending": "0.02000000"
1386
+ // },
1387
+ // ...
1388
+ // ],
1389
+ // "oid": "1435927928274_9_open-orders",
1390
+ // "ok": "ok"
1391
+ // }
1392
+ //
1393
+ const data = this.safeValue(message, 'data');
1394
+ const messageHash = this.safeString(message, 'oid');
1395
+ client.resolve(data, messageHash);
1396
+ }
1113
1397
  handleConnected(client, message) {
1114
1398
  //
1115
1399
  // {
@@ -1127,7 +1411,25 @@ class cex extends cex$1 {
1127
1411
  // "ok": "error"
1128
1412
  // }
1129
1413
  //
1130
- throw new errors.ExchangeError(this.id + ' ' + this.json(message));
1414
+ try {
1415
+ const data = this.safeValue(message, 'data', {});
1416
+ const error = this.safeString(data, 'error');
1417
+ const event = this.safeString(message, 'e', '');
1418
+ const feedback = this.id + ' ' + event + ' ' + error;
1419
+ this.throwExactlyMatchedException(this.exceptions['exact'], error, feedback);
1420
+ this.throwBroadlyMatchedException(this.exceptions['broad'], error, feedback);
1421
+ throw new errors.ExchangeError(feedback);
1422
+ }
1423
+ catch (error) {
1424
+ const messageHash = this.safeString(message, 'oid');
1425
+ const future = this.safeValue(client['futures'], messageHash);
1426
+ if (future !== undefined) {
1427
+ client.reject(error, messageHash);
1428
+ }
1429
+ else {
1430
+ throw error;
1431
+ }
1432
+ }
1131
1433
  }
1132
1434
  handleMessage(client, message) {
1133
1435
  const ok = this.safeString(message, 'ok');
@@ -1147,11 +1449,16 @@ class cex extends cex$1 {
1147
1449
  'get-balance': this.handleBalance,
1148
1450
  'order-book-subscribe': this.handleOrderBookSnapshot,
1149
1451
  'md_update': this.handleOrderBookUpdate,
1150
- 'open-orders': this.handleOrdersSnapshot,
1452
+ 'open-orders': this.resolveData,
1151
1453
  'order': this.handleOrderUpdate,
1152
1454
  'history-update': this.handleTrade,
1153
1455
  'history': this.handleTradesSnapshot,
1154
1456
  'tx': this.handleTransaction,
1457
+ 'place-order': this.resolveData,
1458
+ 'cancel-replace-order': this.resolveData,
1459
+ 'cancel-order': this.resolveData,
1460
+ 'mass-cancel-place-orders': this.resolveData,
1461
+ 'get-order': this.resolveData,
1155
1462
  };
1156
1463
  const handler = this.safeValue(handlers, event);
1157
1464
  if (handler !== undefined) {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.71";
7
+ declare const version = "4.1.73";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -94,7 +94,6 @@ import phemex from './src/phemex.js';
94
94
  import poloniex from './src/poloniex.js';
95
95
  import poloniexfutures from './src/poloniexfutures.js';
96
96
  import probit from './src/probit.js';
97
- import tidex from './src/tidex.js';
98
97
  import timex from './src/timex.js';
99
98
  import tokocrypto from './src/tokocrypto.js';
100
99
  import upbit from './src/upbit.js';
@@ -253,7 +252,6 @@ declare const exchanges: {
253
252
  poloniex: typeof poloniex;
254
253
  poloniexfutures: typeof poloniexfutures;
255
254
  probit: typeof probit;
256
- tidex: typeof tidex;
257
255
  timex: typeof timex;
258
256
  tokocrypto: typeof tokocrypto;
259
257
  upbit: typeof upbit;
@@ -480,7 +478,6 @@ declare const ccxt: {
480
478
  poloniex: typeof poloniex;
481
479
  poloniexfutures: typeof poloniexfutures;
482
480
  probit: typeof probit;
483
- tidex: typeof tidex;
484
481
  timex: typeof timex;
485
482
  tokocrypto: typeof tokocrypto;
486
483
  upbit: typeof upbit;
@@ -492,5 +489,5 @@ declare const ccxt: {
492
489
  zaif: typeof zaif;
493
490
  zonda: typeof zonda;
494
491
  } & typeof functions & typeof errors;
495
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinlist, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, p2b, paymium, phemex, poloniex, poloniexfutures, probit, tidex, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
492
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinlist, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
496
493
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.72';
41
+ const version = '4.1.74';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -130,7 +130,6 @@ import phemex from './src/phemex.js';
130
130
  import poloniex from './src/poloniex.js';
131
131
  import poloniexfutures from './src/poloniexfutures.js';
132
132
  import probit from './src/probit.js';
133
- import tidex from './src/tidex.js';
134
133
  import timex from './src/timex.js';
135
134
  import tokocrypto from './src/tokocrypto.js';
136
135
  import upbit from './src/upbit.js';
@@ -290,7 +289,6 @@ const exchanges = {
290
289
  'poloniex': poloniex,
291
290
  'poloniexfutures': poloniexfutures,
292
291
  'probit': probit,
293
- 'tidex': tidex,
294
292
  'timex': timex,
295
293
  'tokocrypto': tokocrypto,
296
294
  'upbit': upbit,
@@ -374,6 +372,6 @@ pro.exchanges = Object.keys(pro);
374
372
  pro['Exchange'] = Exchange; // now the same for rest and ts
375
373
  //-----------------------------------------------------------------------------
376
374
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
377
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinlist, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, p2b, paymium, phemex, poloniex, poloniexfutures, probit, tidex, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
375
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bittrex, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseprime, coinbasepro, coincheck, coinex, coinlist, coinmate, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
378
376
  export default ccxt;
379
377
  //-----------------------------------------------------------------------------
@@ -42,6 +42,8 @@ interface Exchange {
42
42
  privatePostWithdraw(params?: {}): Promise<implicitReturnType>;
43
43
  privatePostWithdrawCancel(params?: {}): Promise<implicitReturnType>;
44
44
  privatePostWithdrawInfo(params?: {}): Promise<implicitReturnType>;
45
+ privatePostWithdrawMethods(params?: {}): Promise<implicitReturnType>;
46
+ privatePostWithdrawAddresses(params?: {}): Promise<implicitReturnType>;
45
47
  privatePostWithdrawStatus(params?: {}): Promise<implicitReturnType>;
46
48
  privatePostWalletTransfer(params?: {}): Promise<implicitReturnType>;
47
49
  privatePostCreateSubaccount(params?: {}): Promise<implicitReturnType>;
@@ -296,6 +296,7 @@ export default class Exchange {
296
296
  createMarketOrder: boolean;
297
297
  createOrder: boolean;
298
298
  createMarketBuyOrderWithCost: any;
299
+ createMarketOrderWithCost: any;
299
300
  createMarketSellOrderWithCost: any;
300
301
  createOrders: any;
301
302
  createPostOnlyOrder: any;
@@ -759,6 +760,7 @@ export default class Exchange {
759
760
  fetchOrderStatus(id: string, symbol?: string, params?: {}): Promise<string>;
760
761
  fetchUnifiedOrder(order: any, params?: {}): Promise<Order>;
761
762
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
763
+ createMarketOrderWithCost(symbol: string, side: OrderSide, cost: any, params?: {}): Promise<Order>;
762
764
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
763
765
  createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
764
766
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
@@ -783,8 +785,8 @@ export default class Exchange {
783
785
  fetchOHLCVWs(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
784
786
  fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
785
787
  fetchDepositsWithdrawals(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
786
- fetchDeposits(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
787
- fetchWithdrawals(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
788
+ fetchDeposits(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
789
+ fetchWithdrawals(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
788
790
  fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
789
791
  fetchFundingRateHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
790
792
  fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
@@ -354,6 +354,7 @@ export default class Exchange {
354
354
  'createMarketOrder': true,
355
355
  'createOrder': true,
356
356
  'createMarketBuyOrderWithCost': undefined,
357
+ 'createMarketOrderWithCost': undefined,
357
358
  'createMarketSellOrderWithCost': undefined,
358
359
  'createOrders': undefined,
359
360
  'createPostOnlyOrder': undefined,
@@ -3556,28 +3557,50 @@ export default class Exchange {
3556
3557
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3557
3558
  throw new NotSupported(this.id + ' createOrder() is not supported yet');
3558
3559
  }
3560
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
3561
+ /**
3562
+ * @method
3563
+ * @name createMarketOrderWithCost
3564
+ * @description create a market order by providing the symbol, side and cost
3565
+ * @param {string} symbol unified symbol of the market to create an order in
3566
+ * @param {string} side 'buy' or 'sell'
3567
+ * @param {float} cost how much you want to trade in units of the quote currency
3568
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3569
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3570
+ */
3571
+ if (this.options['createMarketOrderWithCost'] || (this.options['createMarketBuyOrderWithCost'] && this.options['createMarketSellOrderWithCost'])) {
3572
+ return await this.createOrder(symbol, 'market', side, cost, 1, params);
3573
+ }
3574
+ throw new NotSupported(this.id + ' createMarketOrderWithCost() is not supported yet');
3575
+ }
3559
3576
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
3560
3577
  /**
3561
3578
  * @method
3562
- * @name createMarketBuyWithCost
3579
+ * @name createMarketBuyOrderWithCost
3563
3580
  * @description create a market buy order by providing the symbol and cost
3564
3581
  * @param {string} symbol unified symbol of the market to create an order in
3565
3582
  * @param {float} cost how much you want to trade in units of the quote currency
3566
3583
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3567
3584
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3568
3585
  */
3586
+ if (this.options['createMarketBuyOrderRequiresPrice'] || this.options['createMarketBuyOrderWithCost']) {
3587
+ return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
3588
+ }
3569
3589
  throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
3570
3590
  }
3571
3591
  async createMarketSellOrderWithCost(symbol, cost, params = {}) {
3572
3592
  /**
3573
3593
  * @method
3574
3594
  * @name createMarketSellOrderWithCost
3575
- * @description create a market buy order by providing the symbol and cost
3595
+ * @description create a market sell order by providing the symbol and cost
3576
3596
  * @param {string} symbol unified symbol of the market to create an order in
3577
3597
  * @param {float} cost how much you want to trade in units of the quote currency
3578
3598
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3579
3599
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3580
3600
  */
3601
+ if (this.options['createMarketSellOrderRequiresPrice'] || this.options['createMarketSellOrderWithCost']) {
3602
+ return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
3603
+ }
3581
3604
  throw new NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
3582
3605
  }
3583
3606
  async createOrders(orders, params = {}) {
@@ -3656,10 +3679,10 @@ export default class Exchange {
3656
3679
  */
3657
3680
  throw new NotSupported(this.id + ' fetchDepositsWithdrawals() is not supported yet');
3658
3681
  }
3659
- async fetchDeposits(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3682
+ async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
3660
3683
  throw new NotSupported(this.id + ' fetchDeposits() is not supported yet');
3661
3684
  }
3662
- async fetchWithdrawals(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3685
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
3663
3686
  throw new NotSupported(this.id + ' fetchWithdrawals() is not supported yet');
3664
3687
  }
3665
3688
  async fetchOpenInterest(symbol, params = {}) {
package/js/src/bybit.d.ts CHANGED
@@ -58,6 +58,7 @@ export default class bybit extends Exchange {
58
58
  parseTimeInForce(timeInForce: any): string;
59
59
  parseOrder(order: any, market?: Market): Order;
60
60
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
61
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
61
62
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
62
63
  createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
63
64
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;