ccxt 4.1.77 → 4.1.78

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.
Files changed (55) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +500 -176
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bingx.js +3 -2
  6. package/dist/cjs/src/bitget.js +71 -0
  7. package/dist/cjs/src/bitmart.js +9 -13
  8. package/dist/cjs/src/bybit.js +2 -0
  9. package/dist/cjs/src/coinbase.js +12 -3
  10. package/dist/cjs/src/coinex.js +7 -11
  11. package/dist/cjs/src/gate.js +4 -0
  12. package/dist/cjs/src/hitbtc.js +326 -123
  13. package/dist/cjs/src/idex.js +10 -1
  14. package/dist/cjs/src/mexc.js +33 -5
  15. package/dist/cjs/src/okx.js +5 -9
  16. package/dist/cjs/src/pro/binance.js +10 -2
  17. package/dist/cjs/src/pro/binanceus.js +1 -0
  18. package/dist/cjs/src/pro/gate.js +1 -1
  19. package/dist/cjs/src/upbit.js +5 -5
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/bybit.d.ts +2 -0
  23. package/js/src/abstract/gate.d.ts +3 -0
  24. package/js/src/abstract/gateio.d.ts +3 -0
  25. package/js/src/abstract/okx.d.ts +2 -0
  26. package/js/src/base/Exchange.d.ts +1 -1
  27. package/js/src/bingx.js +3 -2
  28. package/js/src/bitget.d.ts +5 -4
  29. package/js/src/bitget.js +71 -0
  30. package/js/src/bitmart.js +9 -13
  31. package/js/src/bybit.js +2 -0
  32. package/js/src/coinbase.js +12 -3
  33. package/js/src/coinex.js +7 -11
  34. package/js/src/gate.js +4 -0
  35. package/js/src/hitbtc.js +326 -123
  36. package/js/src/idex.js +10 -1
  37. package/js/src/mexc.d.ts +1 -0
  38. package/js/src/mexc.js +33 -5
  39. package/js/src/okx.js +5 -9
  40. package/js/src/pro/binance.js +10 -2
  41. package/js/src/pro/binanceus.js +1 -0
  42. package/js/src/pro/gate.js +1 -1
  43. package/js/src/upbit.js +5 -5
  44. package/package.json +1 -1
  45. package/skip-tests.json +2 -1
  46. package/js/src/huobipro.d.ts +0 -4
  47. package/js/src/huobipro.js +0 -20
  48. package/js/src/mexc3.d.ts +0 -4
  49. package/js/src/mexc3.js +0 -17
  50. package/js/src/okex.d.ts +0 -4
  51. package/js/src/okex.js +0 -17
  52. package/js/src/okex5.d.ts +0 -4
  53. package/js/src/okex5.js +0 -17
  54. package/js/src/tidex.d.ts +0 -36
  55. package/js/src/tidex.js +0 -1068
package/js/src/idex.js CHANGED
@@ -1591,7 +1591,16 @@ export default class idex extends Exchange {
1591
1591
  // ]
1592
1592
  const method = params['method'];
1593
1593
  params = this.omit(params, 'method');
1594
- const response = await this[method](this.extend(request, params));
1594
+ let response = undefined;
1595
+ if (method === 'privateGetDeposits') {
1596
+ response = await this.privateGetDeposits(this.extend(request, params));
1597
+ }
1598
+ else if (method === 'privateGetWithdrawals') {
1599
+ response = await this.privateGetWithdrawals(this.extend(request, params));
1600
+ }
1601
+ else {
1602
+ throw new NotSupported(this.id + ' fetchTransactionsHelper() not support this method');
1603
+ }
1595
1604
  return this.parseTransactions(response, currency, since, limit);
1596
1605
  }
1597
1606
  parseTransactionStatus(status) {
package/js/src/mexc.d.ts CHANGED
@@ -30,6 +30,7 @@ export default class mexc extends Exchange {
30
30
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
31
31
  parseTicker(ticker: any, market?: Market): Ticker;
32
32
  fetchBidsAsks(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
33
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
33
34
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
34
35
  createSpotOrderRequest(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): any;
35
36
  createSpotOrder(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): Promise<Order>;
package/js/src/mexc.js CHANGED
@@ -40,6 +40,9 @@ export default class mexc extends Exchange {
40
40
  'closeAllPositions': false,
41
41
  'closePosition': false,
42
42
  'createDepositAddress': true,
43
+ 'createMarketBuyOrderWithCost': true,
44
+ 'createMarketOrderWithCost': false,
45
+ 'createMarketSellOrderWithCost': false,
43
46
  'createOrder': true,
44
47
  'createOrders': true,
45
48
  'createReduceOnlyOrder': true,
@@ -2062,11 +2065,33 @@ export default class mexc extends Exchange {
2062
2065
  }
2063
2066
  return this.parseTickers(tickers, symbols);
2064
2067
  }
2068
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
2069
+ /**
2070
+ * @method
2071
+ * @name mexc#createMarketBuyOrderWithCost
2072
+ * @description create a market buy order by providing the symbol and cost
2073
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2074
+ * @param {string} symbol unified symbol of the market to create an order in
2075
+ * @param {float} cost how much you want to trade in units of the quote currency
2076
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2077
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2078
+ */
2079
+ await this.loadMarkets();
2080
+ const market = this.market(symbol);
2081
+ if (!market['spot']) {
2082
+ throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
2083
+ }
2084
+ params['createMarketBuyOrderRequiresPrice'] = false;
2085
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
2086
+ }
2065
2087
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2066
2088
  /**
2067
2089
  * @method
2068
2090
  * @name mexc3#createOrder
2069
2091
  * @description create a trade order
2092
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
2093
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
2094
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
2070
2095
  * @param {string} symbol unified symbol of the market to create an order in
2071
2096
  * @param {string} type 'market' or 'limit'
2072
2097
  * @param {string} side 'buy' or 'sell'
@@ -2095,13 +2120,16 @@ export default class mexc extends Exchange {
2095
2120
  'type': type.toUpperCase(),
2096
2121
  };
2097
2122
  if (orderSide === 'BUY' && type === 'market') {
2098
- const quoteOrderQty = this.safeNumber(params, 'quoteOrderQty');
2099
- if (quoteOrderQty !== undefined) {
2100
- amount = quoteOrderQty;
2123
+ let createMarketBuyOrderRequiresPrice = true;
2124
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2125
+ const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
2126
+ params = this.omit(params, 'cost');
2127
+ if (cost !== undefined) {
2128
+ amount = cost;
2101
2129
  }
2102
- else if (this.options['createMarketBuyOrderRequiresPrice']) {
2130
+ else if (createMarketBuyOrderRequiresPrice) {
2103
2131
  if (price === undefined) {
2104
- 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)");
2132
+ 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');
2105
2133
  }
2106
2134
  else {
2107
2135
  const amountString = this.numberToString(amount);
package/js/src/okx.js CHANGED
@@ -291,6 +291,7 @@ export default class okx extends Exchange {
291
291
  'asset/convert/currencies': 5 / 3,
292
292
  'asset/convert/currency-pair': 5 / 3,
293
293
  'asset/convert/history': 5 / 3,
294
+ 'asset/monthly-statement': 2,
294
295
  // account
295
296
  'account/balance': 2,
296
297
  'account/positions': 2,
@@ -424,6 +425,7 @@ export default class okx extends Exchange {
424
425
  'asset/convert-dust-assets': 10,
425
426
  'asset/convert/estimate-quote': 1,
426
427
  'asset/convert/trade': 1,
428
+ 'asset/monthly-statement': 1,
427
429
  // account
428
430
  'account/set-position-mode': 4,
429
431
  'account/set-leverage': 1,
@@ -1057,14 +1059,7 @@ export default class okx extends Exchange {
1057
1059
  'commonCurrencies': {
1058
1060
  // the exchange refers to ERC20 version of Aeternity (AEToken)
1059
1061
  'AE': 'AET',
1060
- 'BOX': 'DefiBox',
1061
- 'HOT': 'Hydro Protocol',
1062
- 'HSR': 'HC',
1063
- 'MAG': 'Maggie',
1064
- 'SBTC': 'Super Bitcoin',
1065
- 'TRADE': 'Unitrade',
1066
- 'YOYO': 'YOYOW',
1067
- 'WIN': 'WinToken', // https://github.com/ccxt/ccxt/issues/5701
1062
+ 'WIN': 'WINTOKEN', // https://github.com/ccxt/ccxt/issues/5701
1068
1063
  },
1069
1064
  });
1070
1065
  }
@@ -3090,6 +3085,7 @@ export default class okx extends Exchange {
3090
3085
  * @param {string[]} ids order ids
3091
3086
  * @param {string} symbol unified market symbol
3092
3087
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3088
+ * @param {boolean} [params.trigger] whether the order is a stop/trigger order
3093
3089
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3094
3090
  */
3095
3091
  // TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
@@ -3104,7 +3100,7 @@ export default class okx extends Exchange {
3104
3100
  let method = this.safeString(params, 'method', defaultMethod);
3105
3101
  const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
3106
3102
  const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
3107
- const stop = this.safeValue(params, 'stop');
3103
+ const stop = this.safeValue2(params, 'stop', 'trigger');
3108
3104
  if (stop) {
3109
3105
  method = 'privatePostTradeCancelAlgos';
3110
3106
  }
@@ -1649,18 +1649,26 @@ export default class binance extends binanceRest {
1649
1649
  const url = this.urls['api']['ws']['ws'];
1650
1650
  const requestId = this.requestId(url);
1651
1651
  const messageHash = requestId.toString();
1652
+ const sor = this.safeValue2(params, 'sor', 'SOR', false);
1653
+ params = this.omit(params, 'sor', 'SOR');
1652
1654
  const payload = this.createOrderRequest(symbol, type, side, amount, price, params);
1653
1655
  let returnRateLimits = false;
1654
1656
  [returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
1655
1657
  payload['returnRateLimits'] = returnRateLimits;
1658
+ const test = this.safeValue(params, 'test', false);
1659
+ params = this.omit(params, 'test');
1656
1660
  const message = {
1657
1661
  'id': messageHash,
1658
1662
  'method': 'order.place',
1659
1663
  'params': this.signParams(this.extend(payload, params)),
1660
1664
  };
1661
- const test = this.safeValue(params, 'test', false);
1662
1665
  if (test) {
1663
- message['method'] = 'order.test';
1666
+ if (sor) {
1667
+ message['method'] = 'sor.order.test';
1668
+ }
1669
+ else {
1670
+ message['method'] = 'order.test';
1671
+ }
1664
1672
  }
1665
1673
  const subscription = {
1666
1674
  'method': this.handleOrderWs,
@@ -21,6 +21,7 @@ export default class binanceus extends binance {
21
21
  'spot': 'wss://stream.binance.us:9443/ws',
22
22
  },
23
23
  'web': 'https://www.binance.us',
24
+ 'sapi': 'https://api.binance.us/sapi/v1',
24
25
  'wapi': 'https://api.binance.us/wapi/v3',
25
26
  'public': 'https://api.binance.us/api/v1',
26
27
  'private': 'https://api.binance.us/api/v3',
@@ -286,7 +286,7 @@ export default class gate extends gateRest {
286
286
  const marketId = market['id'];
287
287
  const url = this.getUrlByMarket(market);
288
288
  const messageType = this.getTypeByMarket(market);
289
- const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'method', 'tickers');
289
+ const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
290
290
  const channel = messageType + '.' + topic;
291
291
  const messageHash = 'ticker:' + symbol;
292
292
  const payload = [marketId];
package/js/src/upbit.js CHANGED
@@ -1713,6 +1713,7 @@ export default class upbit extends Exchange {
1713
1713
  /**
1714
1714
  * @method
1715
1715
  * @name upbit#withdraw
1716
+ * @see https://docs.upbit.com/reference/디지털자산-출금하기
1716
1717
  * @see https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
1717
1718
  * @description make a withdrawal
1718
1719
  * @param {string} code unified currency code
@@ -1723,14 +1724,14 @@ export default class upbit extends Exchange {
1723
1724
  * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1724
1725
  */
1725
1726
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1726
- this.checkAddress(address);
1727
1727
  await this.loadMarkets();
1728
1728
  const currency = this.currency(code);
1729
1729
  const request = {
1730
1730
  'amount': amount,
1731
1731
  };
1732
- let method = 'privatePostWithdraws';
1732
+ let response = undefined;
1733
1733
  if (code !== 'KRW') {
1734
+ this.checkAddress(address);
1734
1735
  // 2023-05-23 Change to required parameters for digital assets
1735
1736
  const network = this.safeStringUpper2(params, 'network', 'net_type');
1736
1737
  if (network === undefined) {
@@ -1738,18 +1739,17 @@ export default class upbit extends Exchange {
1738
1739
  }
1739
1740
  params = this.omit(params, ['network']);
1740
1741
  request['net_type'] = network;
1741
- method += 'Coin';
1742
1742
  request['currency'] = currency['id'];
1743
1743
  request['address'] = address;
1744
1744
  if (tag !== undefined) {
1745
1745
  request['secondary_address'] = tag;
1746
1746
  }
1747
1747
  params = this.omit(params, 'network');
1748
+ response = await this.privatePostWithdrawsCoin(this.extend(request, params));
1748
1749
  }
1749
1750
  else {
1750
- method += 'Krw';
1751
+ response = await this.privatePostWithdrawsKrw(this.extend(request, params));
1751
1752
  }
1752
- const response = await this[method](this.extend(request, params));
1753
1753
  //
1754
1754
  // {
1755
1755
  // "type": "withdraw",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.77",
3
+ "version": "4.1.78",
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",
package/skip-tests.json CHANGED
@@ -77,7 +77,8 @@
77
77
  "fetchTicker": {
78
78
  "quoteVolume": "quoteVolume >= baseVolume * low is failing",
79
79
  "baseVolume": "quoteVolume >= baseVolume * low is failing"
80
- }
80
+ },
81
+ "fetchStatus": "private endpoints"
81
82
  }
82
83
  },
83
84
  "binancecoinm": {
@@ -1,4 +0,0 @@
1
- import huobi from './huobi.js';
2
- export default class huobipro extends huobi {
3
- describe(): any;
4
- }
@@ -1,20 +0,0 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
- // ---------------------------------------------------------------------------
8
- import huobi from './huobi.js';
9
- // ---------------------------------------------------------------------------
10
- export default class huobipro extends huobi {
11
- describe() {
12
- // this is an alias for backward-compatibility
13
- // to be removed soon
14
- return this.deepExtend(super.describe(), {
15
- 'id': 'huobipro',
16
- 'alias': true,
17
- 'name': 'Huobi Pro',
18
- });
19
- }
20
- }
package/js/src/mexc3.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import mexc from './mexc.js';
2
- export default class mexc3 extends mexc {
3
- describe(): any;
4
- }
package/js/src/mexc3.js DELETED
@@ -1,17 +0,0 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
- // ---------------------------------------------------------------------------
8
- import mexc from './mexc.js';
9
- // ---------------------------------------------------------------------------
10
- export default class mexc3 extends mexc {
11
- describe() {
12
- return this.deepExtend(super.describe(), {
13
- 'id': 'mexc3',
14
- 'alias': true,
15
- });
16
- }
17
- }
package/js/src/okex.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import okx from './okx.js';
2
- export default class okex extends okx {
3
- describe(): any;
4
- }
package/js/src/okex.js DELETED
@@ -1,17 +0,0 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
- // ---------------------------------------------------------------------------
8
- import okx from './okx.js';
9
- // ---------------------------------------------------------------------------
10
- export default class okex extends okx {
11
- describe() {
12
- return this.deepExtend(super.describe(), {
13
- 'id': 'okex',
14
- 'alias': true,
15
- });
16
- }
17
- }
package/js/src/okex5.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import okex from './okex.js';
2
- export default class okex5 extends okex {
3
- describe(): any;
4
- }
package/js/src/okex5.js DELETED
@@ -1,17 +0,0 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
- // ---------------------------------------------------------------------------
8
- import okex from './okex.js';
9
- // ---------------------------------------------------------------------------
10
- export default class okex5 extends okex {
11
- describe() {
12
- return this.deepExtend(super.describe(), {
13
- 'id': 'okex5',
14
- 'alias': true,
15
- });
16
- }
17
- }
package/js/src/tidex.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import Exchange from './abstract/tidex.js';
2
- import { Balances, Currency, Dictionary, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
3
- /**
4
- * @class tidex
5
- * @extends Exchange
6
- */
7
- export default class tidex extends Exchange {
8
- describe(): any;
9
- fetchCurrencies(params?: {}): Promise<{}>;
10
- fetchMarkets(params?: {}): Promise<any[]>;
11
- parseBalance(response: any): Balances;
12
- fetchBalance(params?: {}): Promise<Balances>;
13
- fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
14
- fetchOrderBooks(symbols?: Strings, limit?: Int, params?: {}): Promise<Dictionary<OrderBook>>;
15
- parseTicker(ticker: any, market?: Market): Ticker;
16
- fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
17
- fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
18
- parseTrade(trade: any, market?: Market): Trade;
19
- fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
20
- createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
21
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
22
- parseOrderStatus(status: any): string;
23
- parseOrder(order: any, market?: Market): Order;
24
- fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
25
- fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
26
- fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
27
- withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<Transaction>;
28
- parseTransaction(transaction: any, currency?: Currency): Transaction;
29
- sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
30
- url: any;
31
- method: string;
32
- body: any;
33
- headers: any;
34
- };
35
- handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
36
- }