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/dist/cjs/ccxt.js CHANGED
@@ -101,7 +101,6 @@ var phemex = require('./src/phemex.js');
101
101
  var poloniex = require('./src/poloniex.js');
102
102
  var poloniexfutures = require('./src/poloniexfutures.js');
103
103
  var probit = require('./src/probit.js');
104
- var tidex = require('./src/tidex.js');
105
104
  var timex = require('./src/timex.js');
106
105
  var tokocrypto = require('./src/tokocrypto.js');
107
106
  var upbit = require('./src/upbit.js');
@@ -173,7 +172,7 @@ var woo$1 = require('./src/pro/woo.js');
173
172
 
174
173
  //-----------------------------------------------------------------------------
175
174
  // this is updated by vss.js when building
176
- const version = '4.1.73';
175
+ const version = '4.1.74';
177
176
  Exchange["default"].ccxtVersion = version;
178
177
  const exchanges = {
179
178
  'ace': ace,
@@ -265,7 +264,6 @@ const exchanges = {
265
264
  'poloniex': poloniex,
266
265
  'poloniexfutures': poloniexfutures,
267
266
  'probit': probit,
268
- 'tidex': tidex,
269
267
  'timex': timex,
270
268
  'tokocrypto': tokocrypto,
271
269
  'upbit': upbit,
@@ -467,7 +465,6 @@ exports.phemex = phemex;
467
465
  exports.poloniex = poloniex;
468
466
  exports.poloniexfutures = poloniexfutures;
469
467
  exports.probit = probit;
470
- exports.tidex = tidex;
471
468
  exports.timex = timex;
472
469
  exports.tokocrypto = tokocrypto;
473
470
  exports.upbit = upbit;
@@ -360,6 +360,7 @@ class Exchange {
360
360
  'createMarketOrder': true,
361
361
  'createOrder': true,
362
362
  'createMarketBuyOrderWithCost': undefined,
363
+ 'createMarketOrderWithCost': undefined,
363
364
  'createMarketSellOrderWithCost': undefined,
364
365
  'createOrders': undefined,
365
366
  'createPostOnlyOrder': undefined,
@@ -3560,28 +3561,50 @@ class Exchange {
3560
3561
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3561
3562
  throw new errors.NotSupported(this.id + ' createOrder() is not supported yet');
3562
3563
  }
3564
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
3565
+ /**
3566
+ * @method
3567
+ * @name createMarketOrderWithCost
3568
+ * @description create a market order by providing the symbol, side and cost
3569
+ * @param {string} symbol unified symbol of the market to create an order in
3570
+ * @param {string} side 'buy' or 'sell'
3571
+ * @param {float} cost how much you want to trade in units of the quote currency
3572
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3573
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3574
+ */
3575
+ if (this.options['createMarketOrderWithCost'] || (this.options['createMarketBuyOrderWithCost'] && this.options['createMarketSellOrderWithCost'])) {
3576
+ return await this.createOrder(symbol, 'market', side, cost, 1, params);
3577
+ }
3578
+ throw new errors.NotSupported(this.id + ' createMarketOrderWithCost() is not supported yet');
3579
+ }
3563
3580
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
3564
3581
  /**
3565
3582
  * @method
3566
- * @name createMarketBuyWithCost
3583
+ * @name createMarketBuyOrderWithCost
3567
3584
  * @description create a market buy order by providing the symbol and cost
3568
3585
  * @param {string} symbol unified symbol of the market to create an order in
3569
3586
  * @param {float} cost how much you want to trade in units of the quote currency
3570
3587
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3571
3588
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3572
3589
  */
3590
+ if (this.options['createMarketBuyOrderRequiresPrice'] || this.options['createMarketBuyOrderWithCost']) {
3591
+ return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
3592
+ }
3573
3593
  throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
3574
3594
  }
3575
3595
  async createMarketSellOrderWithCost(symbol, cost, params = {}) {
3576
3596
  /**
3577
3597
  * @method
3578
3598
  * @name createMarketSellOrderWithCost
3579
- * @description create a market buy order by providing the symbol and cost
3599
+ * @description create a market sell order by providing the symbol and cost
3580
3600
  * @param {string} symbol unified symbol of the market to create an order in
3581
3601
  * @param {float} cost how much you want to trade in units of the quote currency
3582
3602
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3583
3603
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3584
3604
  */
3605
+ if (this.options['createMarketSellOrderRequiresPrice'] || this.options['createMarketSellOrderWithCost']) {
3606
+ return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
3607
+ }
3585
3608
  throw new errors.NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
3586
3609
  }
3587
3610
  async createOrders(orders, params = {}) {
@@ -35,6 +35,8 @@ class bybit extends bybit$1 {
35
35
  'borrowCrossMargin': true,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'createMarketBuyOrderWithCost': true,
39
+ 'createMarketSellOrderWithCost': false,
38
40
  'createOrder': true,
39
41
  'createOrders': true,
40
42
  'createPostOnlyOrder': true,
@@ -3446,6 +3448,25 @@ class bybit extends bybit$1 {
3446
3448
  }
3447
3449
  return this.safeValue(result, 0);
3448
3450
  }
3451
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
3452
+ /**
3453
+ * @method
3454
+ * @name bybit#createMarketBuyOrderWithCost
3455
+ * @see https://bybit-exchange.github.io/docs/v5/order/create-order
3456
+ * @description create a market buy order by providing the symbol and cost
3457
+ * @param {string} symbol unified symbol of the market to create an order in
3458
+ * @param {float} cost how much you want to trade in units of the quote currency
3459
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3460
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3461
+ */
3462
+ await this.loadMarkets();
3463
+ const market = this.market(symbol);
3464
+ if (!market['spot']) {
3465
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
3466
+ }
3467
+ params['createMarketBuyOrderRequiresPrice'] = false;
3468
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
3469
+ }
3449
3470
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3450
3471
  /**
3451
3472
  * @method
@@ -3546,18 +3567,20 @@ class bybit extends bybit$1 {
3546
3567
  }
3547
3568
  if (market['spot'] && (type === 'market') && (side === 'buy')) {
3548
3569
  // for market buy it requires the amount of quote currency to spend
3549
- if (this.options['createMarketBuyOrderRequiresPrice']) {
3550
- const cost = this.safeNumber(params, 'cost');
3551
- params = this.omit(params, 'cost');
3552
- if (price === undefined && cost === undefined) {
3553
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
3570
+ let createMarketBuyOrderRequiresPrice = true;
3571
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
3572
+ const cost = this.safeNumber(params, 'cost');
3573
+ params = this.omit(params, 'cost');
3574
+ if (createMarketBuyOrderRequiresPrice) {
3575
+ if ((price === undefined) && (cost === undefined)) {
3576
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
3554
3577
  }
3555
3578
  else {
3556
3579
  const amountString = this.numberToString(amount);
3557
3580
  const priceString = this.numberToString(price);
3558
3581
  const quoteAmount = Precise["default"].stringMul(amountString, priceString);
3559
- amount = (cost !== undefined) ? cost : this.parseNumber(quoteAmount);
3560
- request['qty'] = this.costToPrecision(symbol, amount);
3582
+ const costRequest = (cost !== undefined) ? cost : quoteAmount;
3583
+ request['qty'] = this.costToPrecision(symbol, costRequest);
3561
3584
  }
3562
3585
  }
3563
3586
  else {
@@ -28,6 +28,7 @@ class cex extends cex$1 {
28
28
  'future': false,
29
29
  'option': false,
30
30
  'addMargin': false,
31
+ 'cancelAllOrders': true,
31
32
  'cancelOrder': true,
32
33
  'cancelOrders': false,
33
34
  'createDepositAddress': false,
@@ -463,6 +464,7 @@ class cex extends cex$1 {
463
464
  /**
464
465
  * @method
465
466
  * @name cex#fetchBalance
467
+ * @see https://docs.cex.io/#account-balance
466
468
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
467
469
  * @param {object} [params] extra parameters specific to the exchange API endpoint
468
470
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
@@ -475,6 +477,7 @@ class cex extends cex$1 {
475
477
  /**
476
478
  * @method
477
479
  * @name cex#fetchOrderBook
480
+ * @see https://docs.cex.io/#orderbook
478
481
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
479
482
  * @param {string} symbol unified symbol of the market to fetch the order book for
480
483
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -517,6 +520,7 @@ class cex extends cex$1 {
517
520
  /**
518
521
  * @method
519
522
  * @name cex#fetchOHLCV
523
+ * @see https://docs.cex.io/#historical-ohlcv-chart
520
524
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
521
525
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
522
526
  * @param {string} timeframe the length of time each candle represents
@@ -622,6 +626,7 @@ class cex extends cex$1 {
622
626
  /**
623
627
  * @method
624
628
  * @name cex#fetchTicker
629
+ * @see https://docs.cex.io/#ticker
625
630
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
626
631
  * @param {string} symbol unified symbol of the market to fetch the ticker for
627
632
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -674,6 +679,7 @@ class cex extends cex$1 {
674
679
  /**
675
680
  * @method
676
681
  * @name cex#fetchTrades
682
+ * @see https://docs.cex.io/#trade-history
677
683
  * @description get the list of most recent trades for a particular symbol
678
684
  * @param {string} symbol unified symbol of the market to fetch trades for
679
685
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -693,6 +699,7 @@ class cex extends cex$1 {
693
699
  /**
694
700
  * @method
695
701
  * @name cex#fetchTradingFees
702
+ * @see https://docs.cex.io/#get-my-fee
696
703
  * @description fetch the trading fees for multiple markets
697
704
  * @param {object} [params] extra parameters specific to the exchange API endpoint
698
705
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
@@ -734,6 +741,7 @@ class cex extends cex$1 {
734
741
  /**
735
742
  * @method
736
743
  * @name cex#createOrder
744
+ * @see https://docs.cex.io/#place-order
737
745
  * @description create a trade order
738
746
  * @see https://cex.io/rest-api#place-order
739
747
  * @param {string} symbol unified symbol of the market to create an order in
@@ -817,6 +825,7 @@ class cex extends cex$1 {
817
825
  /**
818
826
  * @method
819
827
  * @name cex#cancelOrder
828
+ * @see https://docs.cex.io/#cancel-order
820
829
  * @description cancels an open order
821
830
  * @param {string} id order id
822
831
  * @param {string} symbol not used by cex cancelOrder ()
@@ -831,6 +840,36 @@ class cex extends cex$1 {
831
840
  // 'true'
832
841
  return this.extend(this.parseOrder({}), { 'info': response, 'type': undefined, 'id': id, 'status': 'canceled' });
833
842
  }
843
+ async cancelAllOrders(symbol = undefined, params = {}) {
844
+ /**
845
+ * @method
846
+ * @name cex#cancelAllOrders
847
+ * @see https://docs.cex.io/#cancel-all-orders-for-given-pair
848
+ * @description cancel all open orders in a market
849
+ * @param {string} symbol unified market symbol of the market to cancel orders in
850
+ * @param {object} [params] extra parameters specific to the cex api endpoint
851
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
852
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
853
+ */
854
+ if (symbol === undefined) {
855
+ throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders requires a symbol.');
856
+ }
857
+ await this.loadMarkets();
858
+ const market = this.market(symbol);
859
+ const request = {
860
+ 'pair': market['id'],
861
+ };
862
+ const orders = await this.privatePostCancelOrdersPair(this.extend(request, params));
863
+ //
864
+ // {
865
+ // "e":"cancel_orders",
866
+ // "ok":"ok",
867
+ // "data":[
868
+ // ]
869
+ // }
870
+ //
871
+ return orders;
872
+ }
834
873
  parseOrder(order, market = undefined) {
835
874
  // Depending on the call, 'time' can be a unix int, unix string or ISO string
836
875
  // Yes, really
@@ -844,9 +883,9 @@ class cex extends cex$1 {
844
883
  timestamp = parseInt(timestamp);
845
884
  }
846
885
  let symbol = undefined;
847
- if (market === undefined) {
848
- const baseId = this.safeString(order, 'symbol1');
849
- const quoteId = this.safeString(order, 'symbol2');
886
+ const baseId = this.safeString(order, 'symbol1');
887
+ const quoteId = this.safeString(order, 'symbol2');
888
+ if (market === undefined && baseId !== undefined && quoteId !== undefined) {
850
889
  const base = this.safeCurrencyCode(baseId);
851
890
  const quote = this.safeCurrencyCode(quoteId);
852
891
  if ((base !== undefined) && (quote !== undefined)) {
@@ -1101,6 +1140,7 @@ class cex extends cex$1 {
1101
1140
  /**
1102
1141
  * @method
1103
1142
  * @name cex#fetchOpenOrders
1143
+ * @see https://docs.cex.io/#open-orders
1104
1144
  * @description fetch all unfilled currently open orders
1105
1145
  * @param {string} symbol unified market symbol
1106
1146
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -1127,6 +1167,7 @@ class cex extends cex$1 {
1127
1167
  /**
1128
1168
  * @method
1129
1169
  * @name cex#fetchClosedOrders
1170
+ * @see https://docs.cex.io/#archived-orders
1130
1171
  * @description fetches information on multiple closed orders made by the user
1131
1172
  * @param {string} symbol unified market symbol of the market orders were made in
1132
1173
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1148,6 +1189,7 @@ class cex extends cex$1 {
1148
1189
  /**
1149
1190
  * @method
1150
1191
  * @name cex#fetchOrder
1192
+ * @see https://docs.cex.io/?python#get-order-details
1151
1193
  * @description fetches information on an order made by the user
1152
1194
  * @param {string} symbol not used by cex fetchOrder
1153
1195
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1265,6 +1307,7 @@ class cex extends cex$1 {
1265
1307
  /**
1266
1308
  * @method
1267
1309
  * @name cex#fetchOrders
1310
+ * @see https://docs.cex.io/#archived-orders
1268
1311
  * @description fetches information on multiple orders made by the user
1269
1312
  * @param {string} symbol unified market symbol of the market orders were made in
1270
1313
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1487,6 +1530,20 @@ class cex extends cex$1 {
1487
1530
  return this.safeString(this.options['order']['status'], status, status);
1488
1531
  }
1489
1532
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1533
+ /**
1534
+ * @method
1535
+ * @name cex#editOrderWs
1536
+ * @description edit a trade order
1537
+ * @see https://docs.cex.io/#cancel-replace-order
1538
+ * @param {string} id order id
1539
+ * @param {string} symbol unified symbol of the market to create an order in
1540
+ * @param {string} type 'market' or 'limit'
1541
+ * @param {string} side 'buy' or 'sell'
1542
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
1543
+ * @param {float|undefined} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1544
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1545
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
1546
+ */
1490
1547
  if (amount === undefined) {
1491
1548
  throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a amount argument');
1492
1549
  }
@@ -1510,6 +1567,7 @@ class cex extends cex$1 {
1510
1567
  /**
1511
1568
  * @method
1512
1569
  * @name cex#fetchDepositAddress
1570
+ * @see https://docs.cex.io/#get-crypto-address
1513
1571
  * @description fetch the deposit address for a currency associated with this account
1514
1572
  * @param {string} code unified currency code
1515
1573
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -237,14 +237,13 @@ class exmo extends exmo$1 {
237
237
  'position_id': market['id'],
238
238
  'quantity': amount,
239
239
  };
240
- let method = undefined;
240
+ let response = undefined;
241
241
  if (type === 'add') {
242
- method = 'privatePostMarginUserPositionMarginAdd';
242
+ response = await this.privatePostMarginUserPositionMarginAdd(this.extend(request, params));
243
243
  }
244
244
  else if (type === 'reduce') {
245
- method = 'privatePostMarginUserPositionMarginReduce';
245
+ response = await this.privatePostMarginUserPositionMarginRemove(this.extend(request, params));
246
246
  }
247
- const response = await this[method](this.extend(request, params));
248
247
  //
249
248
  // {}
250
249
  //
@@ -303,13 +302,16 @@ class exmo extends exmo$1 {
303
302
  * @param {object} [params] extra parameters specific to the exchange API endpoint
304
303
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
305
304
  */
306
- let method = this.safeString(params, 'method');
305
+ const options = this.safeValue(this.options, 'fetchTradingFees', {});
306
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTradingFees');
307
+ const method = this.safeString(params, 'method', defaultMethod);
307
308
  params = this.omit(params, 'method');
308
- if (method === undefined) {
309
- const options = this.safeValue(this.options, 'fetchTradingFees', {});
310
- method = this.safeString(options, 'method', 'fetchPrivateTradingFees');
309
+ if (method === 'fetchPrivateTradingFees') {
310
+ return await this.fetchPrivateTradingFees(params);
311
+ }
312
+ else {
313
+ return await this.fetchPublicTradingFees(params);
311
314
  }
312
- return await this[method](params);
313
315
  }
314
316
  async fetchPrivateTradingFees(params = {}) {
315
317
  await this.loadMarkets();
@@ -1422,7 +1424,6 @@ class exmo extends exmo$1 {
1422
1424
  // 'client_id': 123, // optional, must be a positive integer
1423
1425
  // 'comment': '', // up to 50 latin symbols, whitespaces, underscores
1424
1426
  };
1425
- let method = isSpot ? 'privatePostOrderCreate' : 'privatePostMarginUserOrderCreate';
1426
1427
  let clientOrderId = this.safeValue2(params, 'client_id', 'clientOrderId');
1427
1428
  if (clientOrderId !== undefined) {
1428
1429
  clientOrderId = this.safeInteger2(params, 'client_id', 'clientOrderId');
@@ -1438,32 +1439,22 @@ class exmo extends exmo$1 {
1438
1439
  throw new errors.ArgumentsRequired(this.id + ' createOrder requires an extra param params["leverage"] for margin orders');
1439
1440
  }
1440
1441
  params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId']);
1441
- if (triggerPrice !== undefined) {
1442
- if (isSpot) {
1442
+ if (price !== undefined) {
1443
+ request['price'] = this.priceToPrecision(market['symbol'], price);
1444
+ }
1445
+ let response = undefined;
1446
+ if (isSpot) {
1447
+ if (triggerPrice !== undefined) {
1443
1448
  if (type === 'limit') {
1444
1449
  throw new errors.BadRequest(this.id + ' createOrder () cannot create stop limit orders for spot, only stop market');
1445
1450
  }
1446
1451
  else {
1447
- method = 'privatePostStopMarketOrderCreate';
1448
1452
  request['type'] = side;
1449
1453
  request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
1450
1454
  }
1455
+ response = await this.privatePostStopMarketOrderCreate(this.extend(request, params));
1451
1456
  }
1452
1457
  else {
1453
- request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1454
- if (type === 'limit') {
1455
- request['type'] = 'stop_limit_' + side;
1456
- }
1457
- else if (type === 'market') {
1458
- request['type'] = 'stop_' + side;
1459
- }
1460
- else {
1461
- request['type'] = type;
1462
- }
1463
- }
1464
- }
1465
- else {
1466
- if (isSpot) {
1467
1458
  const execType = this.safeString(params, 'exec_type');
1468
1459
  let isPostOnly = undefined;
1469
1460
  [isPostOnly, params] = this.handlePostOnly(type === 'market', execType === 'post_only', params);
@@ -1481,6 +1472,21 @@ class exmo extends exmo$1 {
1481
1472
  else if (timeInForce !== undefined) {
1482
1473
  request['exec_type'] = timeInForce;
1483
1474
  }
1475
+ response = await this.privatePostOrderCreate(this.extend(request, params));
1476
+ }
1477
+ }
1478
+ else {
1479
+ if (triggerPrice !== undefined) {
1480
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1481
+ if (type === 'limit') {
1482
+ request['type'] = 'stop_limit_' + side;
1483
+ }
1484
+ else if (type === 'market') {
1485
+ request['type'] = 'stop_' + side;
1486
+ }
1487
+ else {
1488
+ request['type'] = type;
1489
+ }
1484
1490
  }
1485
1491
  else {
1486
1492
  if (type === 'limit' || type === 'market') {
@@ -1490,11 +1496,8 @@ class exmo extends exmo$1 {
1490
1496
  request['type'] = type;
1491
1497
  }
1492
1498
  }
1499
+ response = await this.privatePostMarginUserOrderCreate(this.extend(request, params));
1493
1500
  }
1494
- if (price !== undefined) {
1495
- request['price'] = this.priceToPrecision(market['symbol'], price);
1496
- }
1497
- const response = await this[method](this.extend(request, params));
1498
1501
  return this.parseOrder(response, market);
1499
1502
  }
1500
1503
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -193,6 +193,8 @@ class kraken extends kraken$1 {
193
193
  'Withdraw': 3,
194
194
  'WithdrawCancel': 3,
195
195
  'WithdrawInfo': 3,
196
+ 'WithdrawMethods': 3,
197
+ 'WithdrawAddresses': 3,
196
198
  'WithdrawStatus': 3,
197
199
  'WalletTransfer': 3,
198
200
  // sub accounts
@@ -35,6 +35,8 @@ class okx extends okx$1 {
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': true,
37
37
  'createDepositAddress': false,
38
+ 'createMarketBuyOrderWithCost': true,
39
+ 'createMarketSellOrderWithCost': true,
38
40
  'createOrder': true,
39
41
  'createOrders': true,
40
42
  'createPostOnlyOrder': true,
@@ -2489,6 +2491,46 @@ class okx extends okx$1 {
2489
2491
  //
2490
2492
  return this.parseBalanceByType(marketType, response);
2491
2493
  }
2494
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
2495
+ /**
2496
+ * @method
2497
+ * @name okx#createMarketBuyOrderWithCost
2498
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
2499
+ * @description create a market buy order by providing the symbol and cost
2500
+ * @param {string} symbol unified symbol of the market to create an order in
2501
+ * @param {float} cost how much you want to trade in units of the quote currency
2502
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2503
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2504
+ */
2505
+ await this.loadMarkets();
2506
+ const market = this.market(symbol);
2507
+ if (!market['spot']) {
2508
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot markets only');
2509
+ }
2510
+ params['createMarketBuyOrderRequiresPrice'] = false;
2511
+ params['tgtCcy'] = 'quote_ccy';
2512
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
2513
+ }
2514
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
2515
+ /**
2516
+ * @method
2517
+ * @name okx#createMarketSellOrderWithCost
2518
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
2519
+ * @description create a market buy order by providing the symbol and cost
2520
+ * @param {string} symbol unified symbol of the market to create an order in
2521
+ * @param {float} cost how much you want to trade in units of the quote currency
2522
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2523
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2524
+ */
2525
+ await this.loadMarkets();
2526
+ const market = this.market(symbol);
2527
+ if (!market['spot']) {
2528
+ throw new errors.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot markets only');
2529
+ }
2530
+ params['createMarketBuyOrderRequiresPrice'] = false;
2531
+ params['tgtCcy'] = 'quote_ccy';
2532
+ return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
2533
+ }
2492
2534
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
2493
2535
  const market = this.market(symbol);
2494
2536
  const request = {
@@ -2582,8 +2624,10 @@ class okx extends okx$1 {
2582
2624
  // see documentation: https://www.okx.com/docs-v5/en/#rest-api-trade-place-order
2583
2625
  if (tgtCcy === 'quote_ccy') {
2584
2626
  // quote_ccy: sz refers to units of quote currency
2627
+ let createMarketBuyOrderRequiresPrice = true;
2628
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2585
2629
  let notional = this.safeNumber2(params, 'cost', 'sz');
2586
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
2630
+ params = this.omit(params, ['cost', 'sz']);
2587
2631
  if (createMarketBuyOrderRequiresPrice) {
2588
2632
  if (price !== undefined) {
2589
2633
  if (notional === undefined) {
@@ -2601,7 +2645,6 @@ class okx extends okx$1 {
2601
2645
  notional = (notional === undefined) ? amount : notional;
2602
2646
  }
2603
2647
  request['sz'] = this.costToPrecision(symbol, notional);
2604
- params = this.omit(params, ['cost', 'sz']);
2605
2648
  }
2606
2649
  }
2607
2650
  if (marketIOC && contract) {