ccxt 4.1.71 → 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.71';
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
  }
@@ -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({
@@ -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 {
@@ -3620,7 +3620,14 @@ class gate extends gate$1 {
3620
3620
  'PEND': 'pending',
3621
3621
  'REQUEST': 'pending',
3622
3622
  'DMOVE': 'pending',
3623
- 'CANCEL': 'failed',
3623
+ 'MANUAL': 'pending',
3624
+ 'VERIFY': 'pending',
3625
+ 'PROCES': 'pending',
3626
+ 'EXTPEND': 'pending',
3627
+ 'SPLITPEND': 'pending',
3628
+ 'CANCEL': 'canceled',
3629
+ 'FAIL': 'failed',
3630
+ 'INVALID': 'failed',
3624
3631
  'DONE': 'ok',
3625
3632
  'BCODE': 'ok', // GateCode withdrawal
3626
3633
  };
@@ -2083,7 +2083,7 @@ class mexc extends mexc$1 {
2083
2083
  }
2084
2084
  createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2085
2085
  const symbol = market['symbol'];
2086
- const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
2086
+ const orderSide = side.toUpperCase();
2087
2087
  const request = {
2088
2088
  'symbol': market['id'],
2089
2089
  'side': orderSide,
@@ -2102,10 +2102,10 @@ class mexc extends mexc$1 {
2102
2102
  const amountString = this.numberToString(amount);
2103
2103
  const priceString = this.numberToString(price);
2104
2104
  const quoteAmount = Precise["default"].stringMul(amountString, priceString);
2105
- amount = this.parseNumber(quoteAmount);
2105
+ amount = quoteAmount;
2106
2106
  }
2107
2107
  }
2108
- request['quoteOrderQty'] = amount;
2108
+ request['quoteOrderQty'] = this.costToPrecision(symbol, amount);
2109
2109
  }
2110
2110
  else {
2111
2111
  request['quantity'] = this.amountToPrecision(symbol, amount);
@@ -2305,7 +2305,7 @@ class mexc extends mexc$1 {
2305
2305
  ordersRequests.push(orderRequest);
2306
2306
  }
2307
2307
  const request = {
2308
- 'batchOrders': ordersRequests,
2308
+ 'batchOrders': this.json(ordersRequests),
2309
2309
  };
2310
2310
  const response = await this.spotPrivatePostBatchOrders(request);
2311
2311
  //
@@ -2393,6 +2393,9 @@ class binance extends binance$1 {
2393
2393
  return this.filterBySymbolsSinceLimit(cache, symbols, since, limit, true);
2394
2394
  }
2395
2395
  setPositionsCache(client, type, symbols = undefined) {
2396
+ if (type === 'spot') {
2397
+ return;
2398
+ }
2396
2399
  if (this.positions === undefined) {
2397
2400
  this.positions = {};
2398
2401
  }
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.70";
7
+ declare const version = "4.1.71";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
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.71';
41
+ const version = '4.1.72';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -295,6 +295,8 @@ export default class Exchange {
295
295
  createLimitOrder: boolean;
296
296
  createMarketOrder: boolean;
297
297
  createOrder: boolean;
298
+ createMarketBuyOrderWithCost: any;
299
+ createMarketSellOrderWithCost: any;
298
300
  createOrders: any;
299
301
  createPostOnlyOrder: any;
300
302
  createReduceOnlyOrder: any;
@@ -757,6 +759,8 @@ export default class Exchange {
757
759
  fetchOrderStatus(id: string, symbol?: string, params?: {}): Promise<string>;
758
760
  fetchUnifiedOrder(order: any, params?: {}): Promise<Order>;
759
761
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
762
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
763
+ createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
760
764
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
761
765
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
762
766
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<any>;
@@ -353,6 +353,8 @@ export default class Exchange {
353
353
  'createLimitOrder': true,
354
354
  'createMarketOrder': true,
355
355
  'createOrder': true,
356
+ 'createMarketBuyOrderWithCost': undefined,
357
+ 'createMarketSellOrderWithCost': undefined,
356
358
  'createOrders': undefined,
357
359
  'createPostOnlyOrder': undefined,
358
360
  'createReduceOnlyOrder': undefined,
@@ -3554,6 +3556,30 @@ export default class Exchange {
3554
3556
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3555
3557
  throw new NotSupported(this.id + ' createOrder() is not supported yet');
3556
3558
  }
3559
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
3560
+ /**
3561
+ * @method
3562
+ * @name createMarketBuyWithCost
3563
+ * @description create a market buy order by providing the symbol and cost
3564
+ * @param {string} symbol unified symbol of the market to create an order in
3565
+ * @param {float} cost how much you want to trade in units of the quote currency
3566
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3567
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3568
+ */
3569
+ throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
3570
+ }
3571
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
3572
+ /**
3573
+ * @method
3574
+ * @name createMarketSellOrderWithCost
3575
+ * @description create a market buy order by providing the symbol and cost
3576
+ * @param {string} symbol unified symbol of the market to create an order in
3577
+ * @param {float} cost how much you want to trade in units of the quote currency
3578
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3579
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3580
+ */
3581
+ throw new NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
3582
+ }
3557
3583
  async createOrders(orders, params = {}) {
3558
3584
  throw new NotSupported(this.id + ' createOrders() is not supported yet');
3559
3585
  }
package/js/src/bingx.js CHANGED
@@ -1966,15 +1966,17 @@ export default class bingx extends Exchange {
1966
1966
  // "symbol": "XRP-USDT",
1967
1967
  // "orderId": 1514073325788200960,
1968
1968
  // "price": "0.5",
1969
+ // "StopPrice": "0",
1969
1970
  // "origQty": "20",
1970
- // "executedQty": "0",
1971
- // "cummulativeQuoteQty": "0",
1971
+ // "executedQty": "10",
1972
+ // "cummulativeQuoteQty": "5",
1972
1973
  // "status": "PENDING",
1973
1974
  // "type": "LIMIT",
1974
1975
  // "side": "BUY",
1975
1976
  // "time": 1649818185647,
1976
1977
  // "updateTime": 1649818185647,
1977
1978
  // "origQuoteOrderQty": "0"
1979
+ // "fee": "-0.01"
1978
1980
  // }
1979
1981
  //
1980
1982
  //
@@ -2034,9 +2036,24 @@ export default class bingx extends Exchange {
2034
2036
  const amount = this.safeString2(order, 'origQty', 'q');
2035
2037
  const filled = this.safeString2(order, 'executedQty', 'z');
2036
2038
  const statusId = this.safeString2(order, 'status', 'X');
2039
+ let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
2040
+ const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
2041
+ if ((feeCurrencyCode === undefined)) {
2042
+ if (market['spot']) {
2043
+ if (side === 'buy') {
2044
+ feeCurrencyCode = market['base'];
2045
+ }
2046
+ else {
2047
+ feeCurrencyCode = market['quote'];
2048
+ }
2049
+ }
2050
+ else {
2051
+ feeCurrencyCode = market['quote'];
2052
+ }
2053
+ }
2037
2054
  const fee = {
2038
- 'currency': this.safeString2(order, 'feeAsset', 'N'),
2039
- 'rate': this.safeStringN(order, ['fee', 'commission', 'n']),
2055
+ 'currency': feeCurrencyCode,
2056
+ 'cost': Precise.stringAbs(feeCost),
2040
2057
  };
2041
2058
  const clientOrderId = this.safeString2(order, 'clientOrderId', 'c');
2042
2059
  return this.safeOrder({
@@ -43,6 +43,7 @@ export default class coinex extends Exchange {
43
43
  fetchBalance(params?: {}): Promise<Balances>;
44
44
  parseOrderStatus(status: any): string;
45
45
  parseOrder(order: any, market?: Market): Order;
46
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
46
47
  createOrderRequest(symbol: any, type: any, side: any, amount: any, price?: any, params?: {}): any;
47
48
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
48
49
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
package/js/src/coinex.js CHANGED
@@ -48,6 +48,7 @@ export default class coinex extends Exchange {
48
48
  'cancelOrders': true,
49
49
  'createDepositAddress': true,
50
50
  'createOrder': true,
51
+ 'createMarketBuyOrderWithCost': true,
51
52
  'createOrders': true,
52
53
  'createReduceOnlyOrder': true,
53
54
  'editOrder': true,
@@ -1886,6 +1887,19 @@ export default class coinex extends Exchange {
1886
1887
  'info': order,
1887
1888
  }, market);
1888
1889
  }
1890
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1891
+ /**
1892
+ * @method
1893
+ * @name coinex#createMarketBuyWithCost
1894
+ * @description create a market buy order by providing the symbol and cost
1895
+ * @param {string} symbol unified symbol of the market to create an order in
1896
+ * @param {float} cost how much you want to trade in units of the quote currency
1897
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1898
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1899
+ */
1900
+ params['createMarketBuyOrderRequiresPrice'] = false;
1901
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1902
+ }
1889
1903
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
1890
1904
  const market = this.market(symbol);
1891
1905
  const swap = market['swap'];
@@ -1986,16 +2000,20 @@ export default class coinex extends Exchange {
1986
2000
  else {
1987
2001
  request['type'] = side;
1988
2002
  if ((type === 'market') && (side === 'buy')) {
1989
- if (this.options['createMarketBuyOrderRequiresPrice']) {
1990
- if (price === undefined) {
1991
- throw new 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)");
2003
+ let createMarketBuyOrderRequiresPrice = true;
2004
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2005
+ const cost = this.safeNumber(params, 'cost');
2006
+ params = this.omit(params, 'cost');
2007
+ if (createMarketBuyOrderRequiresPrice) {
2008
+ if ((price === undefined) && (cost === undefined)) {
2009
+ throw new 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');
1992
2010
  }
1993
2011
  else {
1994
- const amountString = this.amountToPrecision(symbol, amount);
1995
- const priceString = this.priceToPrecision(symbol, price);
1996
- const costString = Precise.stringMul(amountString, priceString);
1997
- const costNumber = this.parseNumber(costString);
1998
- request['amount'] = this.costToPrecision(symbol, costNumber);
2012
+ const amountString = this.numberToString(amount);
2013
+ const priceString = this.numberToString(price);
2014
+ const quoteAmount = this.parseToNumeric(Precise.stringMul(amountString, priceString));
2015
+ const costRequest = (cost !== undefined) ? cost : quoteAmount;
2016
+ request['amount'] = this.costToPrecision(symbol, costRequest);
1999
2017
  }
2000
2018
  }
2001
2019
  else {
package/js/src/gate.js CHANGED
@@ -3623,7 +3623,14 @@ export default class gate extends Exchange {
3623
3623
  'PEND': 'pending',
3624
3624
  'REQUEST': 'pending',
3625
3625
  'DMOVE': 'pending',
3626
- 'CANCEL': 'failed',
3626
+ 'MANUAL': 'pending',
3627
+ 'VERIFY': 'pending',
3628
+ 'PROCES': 'pending',
3629
+ 'EXTPEND': 'pending',
3630
+ 'SPLITPEND': 'pending',
3631
+ 'CANCEL': 'canceled',
3632
+ 'FAIL': 'failed',
3633
+ 'INVALID': 'failed',
3627
3634
  'DONE': 'ok',
3628
3635
  'BCODE': 'ok', // GateCode withdrawal
3629
3636
  };
package/js/src/mexc.js CHANGED
@@ -2086,7 +2086,7 @@ export default class mexc extends Exchange {
2086
2086
  }
2087
2087
  createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2088
2088
  const symbol = market['symbol'];
2089
- const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
2089
+ const orderSide = side.toUpperCase();
2090
2090
  const request = {
2091
2091
  'symbol': market['id'],
2092
2092
  'side': orderSide,
@@ -2105,10 +2105,10 @@ export default class mexc extends Exchange {
2105
2105
  const amountString = this.numberToString(amount);
2106
2106
  const priceString = this.numberToString(price);
2107
2107
  const quoteAmount = Precise.stringMul(amountString, priceString);
2108
- amount = this.parseNumber(quoteAmount);
2108
+ amount = quoteAmount;
2109
2109
  }
2110
2110
  }
2111
- request['quoteOrderQty'] = amount;
2111
+ request['quoteOrderQty'] = this.costToPrecision(symbol, amount);
2112
2112
  }
2113
2113
  else {
2114
2114
  request['quantity'] = this.amountToPrecision(symbol, amount);
@@ -2308,7 +2308,7 @@ export default class mexc extends Exchange {
2308
2308
  ordersRequests.push(orderRequest);
2309
2309
  }
2310
2310
  const request = {
2311
- 'batchOrders': ordersRequests,
2311
+ 'batchOrders': this.json(ordersRequests),
2312
2312
  };
2313
2313
  const response = await this.spotPrivatePostBatchOrders(request);
2314
2314
  //
@@ -2396,6 +2396,9 @@ export default class binance extends binanceRest {
2396
2396
  return this.filterBySymbolsSinceLimit(cache, symbols, since, limit, true);
2397
2397
  }
2398
2398
  setPositionsCache(client, type, symbols = undefined) {
2399
+ if (type === 'spot') {
2400
+ return;
2401
+ }
2399
2402
  if (this.positions === undefined) {
2400
2403
  this.positions = {};
2401
2404
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.71",
3
+ "version": "4.1.72",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -119,6 +119,7 @@
119
119
  "devDependencies": {
120
120
  "@rollup/plugin-commonjs": "^21.0.3",
121
121
  "@rollup/plugin-json": "^4.1.0",
122
+ "@rollup/plugin-node-resolve": "^15.2.3",
122
123
  "@types/node": "^18.15.11",
123
124
  "@typescript-eslint/eslint-plugin": "^5.30.5",
124
125
  "@typescript-eslint/parser": "^5.30.5",
package/rollup.config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import commonjs from "@rollup/plugin-commonjs";
2
2
  import json from "@rollup/plugin-json";
3
3
  import execute from 'rollup-plugin-execute';
4
+ import nodeResolve from '@rollup/plugin-node-resolve'
4
5
 
5
6
  export default [
6
7
  {
@@ -13,6 +14,9 @@ export default [
13
14
  }
14
15
  ],
15
16
  plugins: [
17
+ nodeResolve({
18
+ preferBuiltins: true,
19
+ }),
16
20
  json(),
17
21
  commonjs({
18
22
  transformMixedEsModules: true,
@@ -24,6 +28,11 @@ export default [
24
28
  if ( warning.message.indexOf('is implicitly using "default" export mode') > -1 ) return;
25
29
  next( warning );
26
30
  },
31
+ external: [
32
+ 'socks-proxy-agent',
33
+ // node resolve generate dist/cjs/js directory, treat ws, debug as external
34
+ 'ws', 'debug'
35
+ ]
27
36
  },
28
37
  {
29
38
  inlineDynamicImports: true,
@@ -35,11 +44,15 @@ export default [
35
44
  },
36
45
  ],
37
46
  plugins: [
47
+ nodeResolve({ preferBuiltins: true }),
38
48
  json(),
39
49
  commonjs({
40
50
  transformMixedEsModules: true,
41
51
  dynamicRequireTargets: ["**/js/src/static_dependencies/**/*.cjs"],
42
52
  }),
43
53
  ],
54
+ external: [
55
+ 'socks-proxy-agent'
56
+ ]
44
57
  }
45
58
  ];