ccxt 4.1.62 → 4.1.64

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 (40) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +678 -201
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/alpaca.js +209 -48
  6. package/dist/cjs/src/binance.js +3 -3
  7. package/dist/cjs/src/binanceus.js +33 -4
  8. package/dist/cjs/src/kraken.js +20 -2
  9. package/dist/cjs/src/krakenfutures.js +7 -7
  10. package/dist/cjs/src/kucoinfutures.js +34 -13
  11. package/dist/cjs/src/luno.js +10 -11
  12. package/dist/cjs/src/phemex.js +130 -91
  13. package/dist/cjs/src/pro/krakenfutures.js +4 -1
  14. package/dist/cjs/src/pro/poloniex.js +205 -2
  15. package/dist/cjs/src/tokocrypto.js +1 -3
  16. package/dist/cjs/src/wazirx.js +7 -1
  17. package/doc/manual.rst +1 -1
  18. package/doc/readme.rst +1 -1
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/abstract/binance.d.ts +3 -3
  22. package/js/src/abstract/binancecoinm.d.ts +3 -3
  23. package/js/src/abstract/binanceus.d.ts +3 -3
  24. package/js/src/abstract/binanceusdm.d.ts +3 -3
  25. package/js/src/alpaca.d.ts +4 -0
  26. package/js/src/alpaca.js +209 -48
  27. package/js/src/binance.js +3 -3
  28. package/js/src/binanceus.js +33 -4
  29. package/js/src/kraken.js +20 -2
  30. package/js/src/krakenfutures.js +7 -7
  31. package/js/src/kucoinfutures.js +34 -13
  32. package/js/src/luno.js +10 -11
  33. package/js/src/phemex.js +130 -91
  34. package/js/src/pro/krakenfutures.js +4 -1
  35. package/js/src/pro/poloniex.d.ts +8 -1
  36. package/js/src/pro/poloniex.js +206 -3
  37. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  38. package/js/src/tokocrypto.js +1 -3
  39. package/js/src/wazirx.js +7 -1
  40. package/package.json +1 -1
@@ -96,12 +96,6 @@ class kucoinfutures extends kucoinfutures$1 {
96
96
  'futuresPublic': 'https://api-futures.kucoin.com',
97
97
  'webExchange': 'https://futures.kucoin.com/_api/web-front',
98
98
  },
99
- 'test': {
100
- 'public': 'https://openapi-sandbox.kucoin.com',
101
- 'private': 'https://openapi-sandbox.kucoin.com',
102
- 'futuresPrivate': 'https://api-sandbox-futures.kucoin.com',
103
- 'futuresPublic': 'https://api-sandbox-futures.kucoin.com',
104
- },
105
99
  },
106
100
  'requiredCredentials': {
107
101
  'apiKey': true,
@@ -326,6 +320,7 @@ class kucoinfutures extends kucoinfutures$1 {
326
320
  * @method
327
321
  * @name kucoinfutures#fetchStatus
328
322
  * @description the latest known information on the availability of the exchange API
323
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-service-status
329
324
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
330
325
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
331
326
  */
@@ -354,6 +349,7 @@ class kucoinfutures extends kucoinfutures$1 {
354
349
  * @method
355
350
  * @name kucoinfutures#fetchMarkets
356
351
  * @description retrieves data on all markets for kucoinfutures
352
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
357
353
  * @param {object} [params] extra parameters specific to the exchange api endpoint
358
354
  * @returns {object[]} an array of objects representing market data
359
355
  */
@@ -518,6 +514,7 @@ class kucoinfutures extends kucoinfutures$1 {
518
514
  * @method
519
515
  * @name kucoinfutures#fetchTime
520
516
  * @description fetches the current integer timestamp in milliseconds from the exchange server
517
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-server-time
521
518
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
522
519
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
523
520
  */
@@ -535,6 +532,7 @@ class kucoinfutures extends kucoinfutures$1 {
535
532
  * @method
536
533
  * @name kucoinfutures#fetchOHLCV
537
534
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
535
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-klines
538
536
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
539
537
  * @param {string} timeframe the length of time each candle represents
540
538
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -615,6 +613,7 @@ class kucoinfutures extends kucoinfutures$1 {
615
613
  * @method
616
614
  * @name kucoinfutures#fetchDepositAddress
617
615
  * @description fetch the deposit address for a currency associated with this account
616
+ * @see https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-address
618
617
  * @param {string} code unified currency code
619
618
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
620
619
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -654,6 +653,7 @@ class kucoinfutures extends kucoinfutures$1 {
654
653
  * @method
655
654
  * @name kucoinfutures#fetchOrderBook
656
655
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
656
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-part-order-book-level-2
657
657
  * @param {string} symbol unified symbol of the market to fetch the order book for
658
658
  * @param {int} [limit] the maximum amount of order book entries to return
659
659
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
@@ -712,6 +712,7 @@ class kucoinfutures extends kucoinfutures$1 {
712
712
  * @method
713
713
  * @name kucoinfutures#fetchTicker
714
714
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
715
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-ticker
715
716
  * @param {string} symbol unified symbol of the market to fetch the ticker for
716
717
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
717
718
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -793,6 +794,7 @@ class kucoinfutures extends kucoinfutures$1 {
793
794
  * @method
794
795
  * @name kucoinfutures#fetchFundingHistory
795
796
  * @description fetch the history of funding payments paid and received on this account
797
+ * @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-funding-history
796
798
  * @param {string} symbol unified market symbol
797
799
  * @param {int} [since] the earliest time in ms to fetch funding history for
798
800
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -1229,6 +1231,7 @@ class kucoinfutures extends kucoinfutures$1 {
1229
1231
  * @method
1230
1232
  * @name kucoinfutures#cancelOrder
1231
1233
  * @description cancels an open order
1234
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-futures-order-by-orderid
1232
1235
  * @param {string} id order id
1233
1236
  * @param {string} symbol unified symbol of the market the order was made in
1234
1237
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
@@ -1256,6 +1259,8 @@ class kucoinfutures extends kucoinfutures$1 {
1256
1259
  * @method
1257
1260
  * @name kucoinfutures#cancelAllOrders
1258
1261
  * @description cancel all open orders
1262
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-limit-orders
1263
+ * @see https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders
1259
1264
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1260
1265
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
1261
1266
  * @param {object} [params.stop] When true, all the trigger orders will be cancelled
@@ -1267,8 +1272,14 @@ class kucoinfutures extends kucoinfutures$1 {
1267
1272
  request['symbol'] = this.marketId(symbol);
1268
1273
  }
1269
1274
  const stop = this.safeValue(params, 'stop');
1270
- const method = stop ? 'futuresPrivateDeleteStopOrders' : 'futuresPrivateDeleteOrders';
1271
- const response = await this[method](this.extend(request, params));
1275
+ params = this.omit(params, 'stop');
1276
+ let response = undefined;
1277
+ if (stop) {
1278
+ response = await this.futuresPrivateDeleteStopOrders(this.extend(request, params));
1279
+ }
1280
+ else {
1281
+ response = await this.futuresPrivateDeleteOrders(this.extend(request, params));
1282
+ }
1272
1283
  //
1273
1284
  // {
1274
1285
  // "code": "200000",
@@ -1286,6 +1297,7 @@ class kucoinfutures extends kucoinfutures$1 {
1286
1297
  * @method
1287
1298
  * @name kucoinfutures#addMargin
1288
1299
  * @description add margin
1300
+ * @see https://www.kucoin.com/docs/rest/futures-trading/positions/add-margin-manually
1289
1301
  * @param {string} symbol unified market symbol
1290
1302
  * @param {float} amount amount of margin to add
1291
1303
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
@@ -1469,8 +1481,13 @@ class kucoinfutures extends kucoinfutures$1 {
1469
1481
  if (until !== undefined) {
1470
1482
  request['endAt'] = until;
1471
1483
  }
1472
- const method = stop ? 'futuresPrivateGetStopOrders' : 'futuresPrivateGetOrders';
1473
- const response = await this[method](this.extend(request, params));
1484
+ let response = undefined;
1485
+ if (stop) {
1486
+ response = await this.futuresPrivateGetStopOrders(this.extend(request, params));
1487
+ }
1488
+ else {
1489
+ response = await this.futuresPrivateGetOrders(this.extend(request, params));
1490
+ }
1474
1491
  //
1475
1492
  // {
1476
1493
  // "code": "200000",
@@ -1562,20 +1579,20 @@ class kucoinfutures extends kucoinfutures$1 {
1562
1579
  */
1563
1580
  await this.loadMarkets();
1564
1581
  const request = {};
1565
- let method = 'futuresPrivateGetOrdersOrderId';
1582
+ let response = undefined;
1566
1583
  if (id === undefined) {
1567
1584
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
1568
1585
  if (clientOrderId === undefined) {
1569
1586
  throw new errors.InvalidOrder(this.id + ' fetchOrder() requires parameter id or params.clientOid');
1570
1587
  }
1571
1588
  request['clientOid'] = clientOrderId;
1572
- method = 'futuresPrivateGetOrdersByClientOid';
1573
1589
  params = this.omit(params, ['clientOid', 'clientOrderId']);
1590
+ response = await this.futuresPrivateGetOrdersByClientOid(this.extend(request, params));
1574
1591
  }
1575
1592
  else {
1576
1593
  request['orderId'] = id;
1594
+ response = await this.futuresPrivateGetOrdersOrderId(this.extend(request, params));
1577
1595
  }
1578
- const response = await this[method](this.extend(request, params));
1579
1596
  //
1580
1597
  // {
1581
1598
  // "code": "200000",
@@ -1740,6 +1757,7 @@ class kucoinfutures extends kucoinfutures$1 {
1740
1757
  * @method
1741
1758
  * @name kucoinfutures#fetchFundingRate
1742
1759
  * @description fetch the current funding rate
1760
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-funding-rate
1743
1761
  * @param {string} symbol unified market symbol
1744
1762
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
1745
1763
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -1805,6 +1823,7 @@ class kucoinfutures extends kucoinfutures$1 {
1805
1823
  * @method
1806
1824
  * @name kucoinfutures#fetchBalance
1807
1825
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1826
+ * @see https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-futures
1808
1827
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
1809
1828
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1810
1829
  */
@@ -1982,6 +2001,7 @@ class kucoinfutures extends kucoinfutures$1 {
1982
2001
  * @method
1983
2002
  * @name kucoinfutures#fetchTrades
1984
2003
  * @description get the list of most recent trades for a particular symbol
2004
+ * @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-transaction-history
1985
2005
  * @param {string} symbol unified symbol of the market to fetch trades for
1986
2006
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1987
2007
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -2264,6 +2284,7 @@ class kucoinfutures extends kucoinfutures$1 {
2264
2284
  * @method
2265
2285
  * @name kucoinfutures#fetchMarketLeverageTiers
2266
2286
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
2287
+ * @see https://www.kucoin.com/docs/rest/futures-trading/risk-limit/get-futures-risk-limit-level
2267
2288
  * @param {string} symbol unified market symbol
2268
2289
  * @param {object} [params] extra parameters specific to the kucoinfutures api endpoint
2269
2290
  * @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
@@ -334,17 +334,17 @@ class luno extends luno$1 {
334
334
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
335
335
  */
336
336
  await this.loadMarkets();
337
- let method = 'publicGetOrderbook';
338
- if (limit !== undefined) {
339
- if (limit <= 100) {
340
- method += 'Top'; // get just the top of the orderbook when limit is low
341
- }
342
- }
343
337
  const market = this.market(symbol);
344
338
  const request = {
345
339
  'pair': market['id'],
346
340
  };
347
- const response = await this[method](this.extend(request, params));
341
+ let response = undefined;
342
+ if (limit !== undefined && limit <= 100) {
343
+ response = await this.publicGetOrderbookTop(this.extend(request, params));
344
+ }
345
+ else {
346
+ response = await this.publicGetOrderbook(this.extend(request, params));
347
+ }
348
348
  const timestamp = this.safeInteger(response, 'timestamp');
349
349
  return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'volume');
350
350
  }
@@ -812,13 +812,12 @@ class luno extends luno$1 {
812
812
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
813
813
  */
814
814
  await this.loadMarkets();
815
- let method = 'privatePost';
816
815
  const market = this.market(symbol);
817
816
  const request = {
818
817
  'pair': market['id'],
819
818
  };
819
+ let response = undefined;
820
820
  if (type === 'market') {
821
- method += 'Marketorder';
822
821
  request['type'] = side.toUpperCase();
823
822
  // todo add createMarketBuyOrderRequires price logic as it is implemented in the other exchanges
824
823
  if (side === 'buy') {
@@ -827,14 +826,14 @@ class luno extends luno$1 {
827
826
  else {
828
827
  request['base_volume'] = this.amountToPrecision(market['symbol'], amount);
829
828
  }
829
+ response = await this.privatePostMarketorder(this.extend(request, params));
830
830
  }
831
831
  else {
832
- method += 'Postorder';
833
832
  request['volume'] = this.amountToPrecision(market['symbol'], amount);
834
833
  request['price'] = this.priceToPrecision(market['symbol'], price);
835
834
  request['type'] = (side === 'buy') ? 'BID' : 'ASK';
835
+ response = await this.privatePostPostorder(this.extend(request, params));
836
836
  }
837
- const response = await this[method](this.extend(request, params));
838
837
  return this.safeOrder({
839
838
  'info': response,
840
839
  'id': response['order_id'],