ccxt 4.1.70 → 4.1.72

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
@@ -173,7 +173,7 @@ var woo$1 = require('./src/pro/woo.js');
173
173
 
174
174
  //-----------------------------------------------------------------------------
175
175
  // this is updated by vss.js when building
176
- const version = '4.1.70';
176
+ const version = '4.1.72';
177
177
  Exchange["default"].ccxtVersion = version;
178
178
  const exchanges = {
179
179
  'ace': ace,
@@ -359,6 +359,8 @@ class Exchange {
359
359
  'createLimitOrder': true,
360
360
  'createMarketOrder': true,
361
361
  'createOrder': true,
362
+ 'createMarketBuyOrderWithCost': undefined,
363
+ 'createMarketSellOrderWithCost': undefined,
362
364
  'createOrders': undefined,
363
365
  'createPostOnlyOrder': undefined,
364
366
  'createReduceOnlyOrder': undefined,
@@ -3558,6 +3560,30 @@ class Exchange {
3558
3560
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3559
3561
  throw new errors.NotSupported(this.id + ' createOrder() is not supported yet');
3560
3562
  }
3563
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
3564
+ /**
3565
+ * @method
3566
+ * @name createMarketBuyWithCost
3567
+ * @description create a market buy order by providing the symbol and cost
3568
+ * @param {string} symbol unified symbol of the market to create an order in
3569
+ * @param {float} cost how much you want to trade in units of the quote currency
3570
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3571
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3572
+ */
3573
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
3574
+ }
3575
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
3576
+ /**
3577
+ * @method
3578
+ * @name createMarketSellOrderWithCost
3579
+ * @description create a market buy order by providing the symbol and cost
3580
+ * @param {string} symbol unified symbol of the market to create an order in
3581
+ * @param {float} cost how much you want to trade in units of the quote currency
3582
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3583
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3584
+ */
3585
+ throw new errors.NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
3586
+ }
3561
3587
  async createOrders(orders, params = {}) {
3562
3588
  throw new errors.NotSupported(this.id + ' createOrders() is not supported yet');
3563
3589
  }
@@ -591,6 +591,7 @@ class binance extends binance$1 {
591
591
  'sapiV2': {
592
592
  'get': {
593
593
  'sub-account/futures/account': 0.1,
594
+ 'sub-account/futures/accountSummary': 1,
594
595
  'sub-account/futures/positionRisk': 0.1,
595
596
  },
596
597
  'post': {
@@ -1963,15 +1963,17 @@ class bingx extends bingx$1 {
1963
1963
  // "symbol": "XRP-USDT",
1964
1964
  // "orderId": 1514073325788200960,
1965
1965
  // "price": "0.5",
1966
+ // "StopPrice": "0",
1966
1967
  // "origQty": "20",
1967
- // "executedQty": "0",
1968
- // "cummulativeQuoteQty": "0",
1968
+ // "executedQty": "10",
1969
+ // "cummulativeQuoteQty": "5",
1969
1970
  // "status": "PENDING",
1970
1971
  // "type": "LIMIT",
1971
1972
  // "side": "BUY",
1972
1973
  // "time": 1649818185647,
1973
1974
  // "updateTime": 1649818185647,
1974
1975
  // "origQuoteOrderQty": "0"
1976
+ // "fee": "-0.01"
1975
1977
  // }
1976
1978
  //
1977
1979
  //
@@ -2031,9 +2033,24 @@ class bingx extends bingx$1 {
2031
2033
  const amount = this.safeString2(order, 'origQty', 'q');
2032
2034
  const filled = this.safeString2(order, 'executedQty', 'z');
2033
2035
  const statusId = this.safeString2(order, 'status', 'X');
2036
+ let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
2037
+ const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
2038
+ if ((feeCurrencyCode === undefined)) {
2039
+ if (market['spot']) {
2040
+ if (side === 'buy') {
2041
+ feeCurrencyCode = market['base'];
2042
+ }
2043
+ else {
2044
+ feeCurrencyCode = market['quote'];
2045
+ }
2046
+ }
2047
+ else {
2048
+ feeCurrencyCode = market['quote'];
2049
+ }
2050
+ }
2034
2051
  const fee = {
2035
- 'currency': this.safeString2(order, 'feeAsset', 'N'),
2036
- 'rate': this.safeStringN(order, ['fee', 'commission', 'n']),
2052
+ 'currency': feeCurrencyCode,
2053
+ 'cost': Precise["default"].stringAbs(feeCost),
2037
2054
  };
2038
2055
  const clientOrderId = this.safeString2(order, 'clientOrderId', 'c');
2039
2056
  return this.safeOrder({
@@ -195,12 +195,15 @@ class coinbase extends coinbase$1 {
195
195
  'brokerage/transaction_summary',
196
196
  'brokerage/product_book',
197
197
  'brokerage/best_bid_ask',
198
+ 'brokerage/convert/trade/{trade_id}',
198
199
  ],
199
200
  'post': [
200
201
  'brokerage/orders',
201
202
  'brokerage/orders/batch_cancel',
202
203
  'brokerage/orders/edit',
203
204
  'brokerage/orders/edit_preview',
205
+ 'brokerage/convert/quote',
206
+ 'brokerage/convert/trade/{trade_id}',
204
207
  ],
205
208
  },
206
209
  },
@@ -45,6 +45,7 @@ class coinex extends coinex$1 {
45
45
  'cancelOrders': true,
46
46
  'createDepositAddress': true,
47
47
  'createOrder': true,
48
+ 'createMarketBuyOrderWithCost': true,
48
49
  'createOrders': true,
49
50
  'createReduceOnlyOrder': true,
50
51
  'editOrder': true,
@@ -1883,6 +1884,19 @@ class coinex extends coinex$1 {
1883
1884
  'info': order,
1884
1885
  }, market);
1885
1886
  }
1887
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1888
+ /**
1889
+ * @method
1890
+ * @name coinex#createMarketBuyWithCost
1891
+ * @description create a market buy order by providing the symbol and cost
1892
+ * @param {string} symbol unified symbol of the market to create an order in
1893
+ * @param {float} cost how much you want to trade in units of the quote currency
1894
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1895
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1896
+ */
1897
+ params['createMarketBuyOrderRequiresPrice'] = false;
1898
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1899
+ }
1886
1900
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
1887
1901
  const market = this.market(symbol);
1888
1902
  const swap = market['swap'];
@@ -1983,16 +1997,20 @@ class coinex extends coinex$1 {
1983
1997
  else {
1984
1998
  request['type'] = side;
1985
1999
  if ((type === 'market') && (side === 'buy')) {
1986
- if (this.options['createMarketBuyOrderRequiresPrice']) {
1987
- if (price === undefined) {
1988
- 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)");
2000
+ let createMarketBuyOrderRequiresPrice = true;
2001
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2002
+ const cost = this.safeNumber(params, 'cost');
2003
+ params = this.omit(params, 'cost');
2004
+ if (createMarketBuyOrderRequiresPrice) {
2005
+ if ((price === undefined) && (cost === undefined)) {
2006
+ 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');
1989
2007
  }
1990
2008
  else {
1991
- const amountString = this.amountToPrecision(symbol, amount);
1992
- const priceString = this.priceToPrecision(symbol, price);
1993
- const costString = Precise["default"].stringMul(amountString, priceString);
1994
- const costNumber = this.parseNumber(costString);
1995
- request['amount'] = this.costToPrecision(symbol, costNumber);
2009
+ const amountString = this.numberToString(amount);
2010
+ const priceString = this.numberToString(price);
2011
+ const quoteAmount = this.parseToNumeric(Precise["default"].stringMul(amountString, priceString));
2012
+ const costRequest = (cost !== undefined) ? cost : quoteAmount;
2013
+ request['amount'] = this.costToPrecision(symbol, costRequest);
1996
2014
  }
1997
2015
  }
1998
2016
  else {