ccxt 4.2.76 → 4.2.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 (74) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1181 -643
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +6 -0
  6. package/dist/cjs/src/binance.js +502 -443
  7. package/dist/cjs/src/bingx.js +1 -1
  8. package/dist/cjs/src/blofin.js +14 -2
  9. package/dist/cjs/src/bybit.js +106 -60
  10. package/dist/cjs/src/coinbase.js +23 -10
  11. package/dist/cjs/src/delta.js +66 -49
  12. package/dist/cjs/src/gate.js +1 -0
  13. package/dist/cjs/src/htx.js +36 -27
  14. package/dist/cjs/src/hyperliquid.js +7 -5
  15. package/dist/cjs/src/kraken.js +8 -8
  16. package/dist/cjs/src/kucoin.js +204 -5
  17. package/dist/cjs/src/okcoin.js +27 -1
  18. package/dist/cjs/src/okx.js +18 -0
  19. package/dist/cjs/src/pro/ascendex.js +1 -1
  20. package/dist/cjs/src/pro/bitvavo.js +1 -1
  21. package/dist/cjs/src/pro/coinex.js +20 -14
  22. package/dist/cjs/src/pro/deribit.js +1 -1
  23. package/dist/cjs/src/pro/exmo.js +1 -1
  24. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  25. package/dist/cjs/src/pro/phemex.js +1 -1
  26. package/dist/cjs/src/pro/poloniex.js +1 -1
  27. package/dist/cjs/src/pro/probit.js +1 -1
  28. package/dist/cjs/src/pro/woo.js +61 -6
  29. package/dist/cjs/src/woo.js +72 -3
  30. package/js/ccxt.d.ts +1 -1
  31. package/js/ccxt.js +1 -1
  32. package/js/src/abstract/kucoin.d.ts +1 -0
  33. package/js/src/abstract/kucoinfutures.d.ts +1 -0
  34. package/js/src/base/Exchange.d.ts +3 -3
  35. package/js/src/base/Exchange.js +6 -0
  36. package/js/src/base/types.d.ts +3 -3
  37. package/js/src/binance.d.ts +2 -2
  38. package/js/src/binance.js +502 -443
  39. package/js/src/bingx.js +1 -1
  40. package/js/src/bitflyer.d.ts +2 -2
  41. package/js/src/bithumb.d.ts +2 -2
  42. package/js/src/blofin.js +14 -2
  43. package/js/src/bybit.d.ts +1 -1
  44. package/js/src/bybit.js +106 -60
  45. package/js/src/coinbase.d.ts +2 -2
  46. package/js/src/coinbase.js +23 -10
  47. package/js/src/delta.d.ts +2 -1
  48. package/js/src/delta.js +66 -49
  49. package/js/src/deribit.d.ts +1 -1
  50. package/js/src/gate.d.ts +1 -1
  51. package/js/src/gate.js +1 -0
  52. package/js/src/htx.js +36 -27
  53. package/js/src/hyperliquid.js +7 -5
  54. package/js/src/kraken.js +8 -8
  55. package/js/src/kucoin.d.ts +4 -1
  56. package/js/src/kucoin.js +204 -5
  57. package/js/src/okcoin.js +27 -1
  58. package/js/src/okx.d.ts +1 -1
  59. package/js/src/okx.js +18 -0
  60. package/js/src/pro/ascendex.js +1 -1
  61. package/js/src/pro/bitvavo.js +1 -1
  62. package/js/src/pro/coinex.js +20 -14
  63. package/js/src/pro/deribit.js +1 -1
  64. package/js/src/pro/exmo.js +1 -1
  65. package/js/src/pro/krakenfutures.js +1 -1
  66. package/js/src/pro/phemex.js +1 -1
  67. package/js/src/pro/poloniex.js +1 -1
  68. package/js/src/pro/probit.js +1 -1
  69. package/js/src/pro/woo.d.ts +1 -0
  70. package/js/src/pro/woo.js +61 -6
  71. package/js/src/woo.d.ts +2 -0
  72. package/js/src/woo.js +72 -3
  73. package/package.json +1 -1
  74. package/skip-tests.json +6 -3
package/js/src/bingx.js CHANGED
@@ -2471,7 +2471,7 @@ export default class bingx extends Exchange {
2471
2471
  'FILLED': 'closed',
2472
2472
  'CANCELED': 'canceled',
2473
2473
  'CANCELLED': 'canceled',
2474
- 'FAILED': 'failed',
2474
+ 'FAILED': 'canceled',
2475
2475
  };
2476
2476
  return this.safeString(statuses, status, status);
2477
2477
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitflyer.js';
2
- import type { Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, Transaction } from './base/types.js';
3
3
  /**
4
4
  * @class bitflyer
5
5
  * @augments Exchange
@@ -7,7 +7,7 @@ import type { Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide,
7
7
  export default class bitflyer extends Exchange {
8
8
  describe(): any;
9
9
  parseExpiryDate(expiry: any): number;
10
- safeMarket(marketId?: any, market?: any, delimiter?: any, marketType?: any): import("./base/types.js").MarketInterface;
10
+ safeMarket(marketId?: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
11
11
  fetchMarkets(params?: {}): Promise<any[]>;
12
12
  parseBalance(response: any): Balances;
13
13
  fetchBalance(params?: {}): Promise<Balances>;
@@ -1,12 +1,12 @@
1
1
  import Exchange from './abstract/bithumb.js';
2
- import type { Balances, Currency, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
2
+ import type { Balances, Currency, Int, Market, MarketInterface, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
3
3
  /**
4
4
  * @class bithumb
5
5
  * @augments Exchange
6
6
  */
7
7
  export default class bithumb extends Exchange {
8
8
  describe(): any;
9
- safeMarket(marketId?: any, market?: any, delimiter?: any, marketType?: any): import("./base/types.js").MarketInterface;
9
+ safeMarket(marketId?: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
10
10
  amountToPrecision(symbol: any, amount: any): any;
11
11
  fetchMarkets(params?: {}): Promise<any[]>;
12
12
  parseBalance(response: any): Balances;
package/js/src/blofin.js CHANGED
@@ -1254,6 +1254,7 @@ export default class blofin extends Exchange {
1254
1254
  * @param {string} id order id
1255
1255
  * @param {string} symbol unified symbol of the market the order was made in
1256
1256
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1257
+ * @param {boolean} [params.trigger] True if cancelling a trigger/conditional order/tp sl orders
1257
1258
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1258
1259
  */
1259
1260
  if (symbol === undefined) {
@@ -1264,14 +1265,25 @@ export default class blofin extends Exchange {
1264
1265
  const request = {
1265
1266
  'instId': market['id'],
1266
1267
  };
1268
+ const isTrigger = this.safeBoolN(params, ['stop', 'trigger', 'tpsl'], false);
1267
1269
  const clientOrderId = this.safeString(params, 'clientOrderId');
1268
1270
  if (clientOrderId !== undefined) {
1269
1271
  request['clientOrderId'] = clientOrderId;
1270
1272
  }
1271
1273
  else {
1272
- request['orderId'] = id;
1274
+ if (!isTrigger) {
1275
+ request['orderId'] = id.toString();
1276
+ }
1277
+ else {
1278
+ request['tpslId'] = id.toString();
1279
+ }
1280
+ }
1281
+ const query = this.omit(params, ['orderId', 'clientOrderId', 'stop', 'trigger', 'tpsl']);
1282
+ if (isTrigger) {
1283
+ const tpslResponse = await this.cancelOrders([id], symbol, params);
1284
+ const first = this.safeDict(tpslResponse, 0);
1285
+ return first;
1273
1286
  }
1274
- const query = this.omit(params, ['orderId', 'clientOrderId']);
1275
1287
  const response = await this.privatePostTradeCancelOrder(this.extend(request, query));
1276
1288
  const data = this.safeList(response, 'data', []);
1277
1289
  const order = this.safeDict(data, 0);
package/js/src/bybit.d.ts CHANGED
@@ -14,7 +14,7 @@ export default class bybit extends Exchange {
14
14
  convertExpireDateToMarketIdDate(date: any): any;
15
15
  convertMarketIdExpireDate(date: any): string;
16
16
  createExpiredOptionMarket(symbol: string): MarketInterface;
17
- safeMarket(marketId?: any, market?: any, delimiter?: any, marketType?: any): MarketInterface;
17
+ safeMarket(marketId?: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
18
18
  getBybitType(method: any, market: any, params?: {}): any[];
19
19
  fetchTime(params?: {}): Promise<number>;
20
20
  fetchCurrencies(params?: {}): Promise<{}>;
package/js/src/bybit.js CHANGED
@@ -966,6 +966,9 @@ export default class bybit extends Exchange {
966
966
  'precisionMode': TICK_SIZE,
967
967
  'options': {
968
968
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
969
+ 'createOrder': {
970
+ 'method': 'privatePostV5OrderCreate', // 'privatePostV5PositionTradingStop'
971
+ },
969
972
  'enableUnifiedMargin': undefined,
970
973
  'enableUnifiedAccount': undefined,
971
974
  'createMarketBuyOrderRequiresPrice': true,
@@ -3534,8 +3537,10 @@ export default class bybit extends Exchange {
3534
3537
  const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3535
3538
  const isTrailingAmountOrder = trailingAmount !== undefined;
3536
3539
  const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
3540
+ const options = this.safeValue(this.options, 'createOrder', {});
3541
+ const defaultMethod = this.safeString(options, 'method', 'privatePostV5OrderCreate');
3537
3542
  let response = undefined;
3538
- if (isTrailingAmountOrder) {
3543
+ if (isTrailingAmountOrder || (defaultMethod === 'privatePostV5PositionTradingStop')) {
3539
3544
  response = await this.privatePostV5PositionTradingStop(orderRequest);
3540
3545
  }
3541
3546
  else {
@@ -3563,10 +3568,12 @@ export default class bybit extends Exchange {
3563
3568
  if ((price === undefined) && (lowerCaseType === 'limit')) {
3564
3569
  throw new ArgumentsRequired(this.id + ' createOrder requires a price argument for limit orders');
3565
3570
  }
3571
+ let defaultMethod = undefined;
3572
+ [defaultMethod, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostV5OrderCreate');
3566
3573
  const request = {
3567
3574
  'symbol': market['id'],
3568
- 'side': this.capitalize(side),
3569
- 'orderType': this.capitalize(lowerCaseType), // limit or market
3575
+ // 'side': this.capitalize (side),
3576
+ // 'orderType': this.capitalize (lowerCaseType), // limit or market
3570
3577
  // 'timeInForce': 'GTC', // IOC, FOK, PostOnly
3571
3578
  // 'takeProfit': 123.45, // take profit price, only take effect upon opening the position
3572
3579
  // 'stopLoss': 123.45, // stop loss price, only take effect upon opening the position
@@ -3588,6 +3595,87 @@ export default class bybit extends Exchange {
3588
3595
  // Valid for option only.
3589
3596
  // 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
3590
3597
  };
3598
+ let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
3599
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
3600
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
3601
+ const stopLoss = this.safeValue(params, 'stopLoss');
3602
+ const takeProfit = this.safeValue(params, 'takeProfit');
3603
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', this.numberToString(price));
3604
+ const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3605
+ const isTrailingAmountOrder = trailingAmount !== undefined;
3606
+ const isTriggerOrder = triggerPrice !== undefined;
3607
+ const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
3608
+ const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
3609
+ const isStopLoss = stopLoss !== undefined;
3610
+ const isTakeProfit = takeProfit !== undefined;
3611
+ const isMarket = lowerCaseType === 'market';
3612
+ const isLimit = lowerCaseType === 'limit';
3613
+ const isBuy = side === 'buy';
3614
+ const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
3615
+ if (isTrailingAmountOrder || isAlternativeEndpoint) {
3616
+ if (isStopLoss || isTakeProfit || isTriggerOrder || market['spot']) {
3617
+ throw new InvalidOrder(this.id + ' the API endpoint used only supports contract trailingAmount, stopLossPrice and takeProfitPrice orders');
3618
+ }
3619
+ if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
3620
+ if (isStopLossTriggerOrder) {
3621
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
3622
+ if (isLimit) {
3623
+ request['tpslMode'] = 'Partial';
3624
+ request['slOrderType'] = 'Limit';
3625
+ request['slLimitPrice'] = this.priceToPrecision(symbol, price);
3626
+ request['slSize'] = this.amountToPrecision(symbol, amount);
3627
+ }
3628
+ }
3629
+ else if (isTakeProfitTriggerOrder) {
3630
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
3631
+ if (isLimit) {
3632
+ request['tpslMode'] = 'Partial';
3633
+ request['tpOrderType'] = 'Limit';
3634
+ request['tpLimitPrice'] = this.priceToPrecision(symbol, price);
3635
+ request['tpSize'] = this.amountToPrecision(symbol, amount);
3636
+ }
3637
+ }
3638
+ }
3639
+ }
3640
+ else {
3641
+ request['side'] = this.capitalize(side);
3642
+ request['orderType'] = this.capitalize(lowerCaseType);
3643
+ const timeInForce = this.safeStringLower(params, 'timeInForce'); // this is same as exchange specific param
3644
+ let postOnly = undefined;
3645
+ [postOnly, params] = this.handlePostOnly(isMarket, timeInForce === 'postonly', params);
3646
+ if (postOnly) {
3647
+ request['timeInForce'] = 'PostOnly';
3648
+ }
3649
+ else if (timeInForce === 'gtc') {
3650
+ request['timeInForce'] = 'GTC';
3651
+ }
3652
+ else if (timeInForce === 'fok') {
3653
+ request['timeInForce'] = 'FOK';
3654
+ }
3655
+ else if (timeInForce === 'ioc') {
3656
+ request['timeInForce'] = 'IOC';
3657
+ }
3658
+ if (market['spot']) {
3659
+ // only works for spot market
3660
+ if (triggerPrice !== undefined) {
3661
+ request['orderFilter'] = 'StopOrder';
3662
+ }
3663
+ else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
3664
+ request['orderFilter'] = 'tpslOrder';
3665
+ }
3666
+ }
3667
+ const clientOrderId = this.safeString(params, 'clientOrderId');
3668
+ if (clientOrderId !== undefined) {
3669
+ request['orderLinkId'] = clientOrderId;
3670
+ }
3671
+ else if (market['option']) {
3672
+ // mandatory field for options
3673
+ request['orderLinkId'] = this.uuid16();
3674
+ }
3675
+ if (isLimit) {
3676
+ request['price'] = this.priceToPrecision(symbol, price);
3677
+ }
3678
+ }
3591
3679
  if (market['spot']) {
3592
3680
  request['category'] = 'spot';
3593
3681
  }
@@ -3647,48 +3735,17 @@ export default class bybit extends Exchange {
3647
3735
  }
3648
3736
  }
3649
3737
  else {
3650
- request['qty'] = this.amountToPrecision(symbol, amount);
3651
- }
3652
- const isMarket = lowerCaseType === 'market';
3653
- const isLimit = lowerCaseType === 'limit';
3654
- if (isLimit) {
3655
- request['price'] = this.priceToPrecision(symbol, price);
3656
- }
3657
- const timeInForce = this.safeStringLower(params, 'timeInForce'); // this is same as exchange specific param
3658
- let postOnly = undefined;
3659
- [postOnly, params] = this.handlePostOnly(isMarket, timeInForce === 'postonly', params);
3660
- if (postOnly) {
3661
- request['timeInForce'] = 'PostOnly';
3662
- }
3663
- else if (timeInForce === 'gtc') {
3664
- request['timeInForce'] = 'GTC';
3665
- }
3666
- else if (timeInForce === 'fok') {
3667
- request['timeInForce'] = 'FOK';
3668
- }
3669
- else if (timeInForce === 'ioc') {
3670
- request['timeInForce'] = 'IOC';
3738
+ if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
3739
+ request['qty'] = this.amountToPrecision(symbol, amount);
3740
+ }
3671
3741
  }
3672
- let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
3673
- const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
3674
- const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
3675
- const stopLoss = this.safeValue(params, 'stopLoss');
3676
- const takeProfit = this.safeValue(params, 'takeProfit');
3677
- const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', this.numberToString(price));
3678
- const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3679
- const isTrailingAmountOrder = trailingAmount !== undefined;
3680
- const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
3681
- const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
3682
- const isStopLoss = stopLoss !== undefined;
3683
- const isTakeProfit = takeProfit !== undefined;
3684
- const isBuy = side === 'buy';
3685
3742
  if (isTrailingAmountOrder) {
3686
3743
  if (trailingTriggerPrice !== undefined) {
3687
3744
  request['activePrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
3688
3745
  }
3689
3746
  request['trailingStop'] = trailingAmount;
3690
3747
  }
3691
- else if (triggerPrice !== undefined) {
3748
+ else if (isTriggerOrder && !isAlternativeEndpoint) {
3692
3749
  const triggerDirection = this.safeString(params, 'triggerDirection');
3693
3750
  params = this.omit(params, ['triggerPrice', 'stopPrice', 'triggerDirection']);
3694
3751
  if (market['spot']) {
@@ -3705,7 +3762,7 @@ export default class bybit extends Exchange {
3705
3762
  }
3706
3763
  request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
3707
3764
  }
3708
- else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
3765
+ else if ((isStopLossTriggerOrder || isTakeProfitTriggerOrder) && !isAlternativeEndpoint) {
3709
3766
  if (isBuy) {
3710
3767
  request['triggerDirection'] = isStopLossTriggerOrder ? 1 : 2;
3711
3768
  }
@@ -3716,7 +3773,7 @@ export default class bybit extends Exchange {
3716
3773
  request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
3717
3774
  request['reduceOnly'] = true;
3718
3775
  }
3719
- if (isStopLoss || isTakeProfit) {
3776
+ if ((isStopLoss || isTakeProfit) && !isAlternativeEndpoint) {
3720
3777
  if (isStopLoss) {
3721
3778
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
3722
3779
  request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
@@ -3738,23 +3795,6 @@ export default class bybit extends Exchange {
3738
3795
  }
3739
3796
  }
3740
3797
  }
3741
- if (market['spot']) {
3742
- // only works for spot market
3743
- if (triggerPrice !== undefined) {
3744
- request['orderFilter'] = 'StopOrder';
3745
- }
3746
- else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
3747
- request['orderFilter'] = 'tpslOrder';
3748
- }
3749
- }
3750
- const clientOrderId = this.safeString(params, 'clientOrderId');
3751
- if (clientOrderId !== undefined) {
3752
- request['orderLinkId'] = clientOrderId;
3753
- }
3754
- else if (market['option']) {
3755
- // mandatory field for options
3756
- request['orderLinkId'] = this.uuid16();
3757
- }
3758
3798
  params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice']);
3759
3799
  return this.extend(request, params);
3760
3800
  }
@@ -5217,7 +5257,9 @@ export default class bybit extends Exchange {
5217
5257
  }
5218
5258
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
5219
5259
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
5220
- let request = {};
5260
+ let request = {
5261
+ 'execType': 'Trade',
5262
+ };
5221
5263
  let market = undefined;
5222
5264
  let isUsdcSettled = false;
5223
5265
  if (symbol !== undefined) {
@@ -8055,11 +8097,15 @@ export default class bybit extends Exchange {
8055
8097
  const tier = info[i];
8056
8098
  const marketId = this.safeString(info, 'symbol');
8057
8099
  market = this.safeMarket(marketId);
8100
+ let minNotional = this.parseNumber('0');
8101
+ if (i !== 0) {
8102
+ minNotional = this.safeNumber(info[i - 1], 'riskLimitValue');
8103
+ }
8058
8104
  tiers.push({
8059
8105
  'tier': this.safeInteger(tier, 'id'),
8060
8106
  'currency': market['settle'],
8061
- 'minNotional': undefined,
8062
- 'maxNotional': undefined,
8107
+ 'minNotional': minNotional,
8108
+ 'maxNotional': this.safeNumber(tier, 'riskLimitValue'),
8063
8109
  'maintenanceMarginRate': this.safeNumber(tier, 'maintenanceMargin'),
8064
8110
  'maxLeverage': this.safeNumber(tier, 'maxLeverage'),
8065
8111
  'info': tier,
@@ -30,7 +30,7 @@ export default class coinbase extends Exchange {
30
30
  parseTransactionStatus(status: any): string;
31
31
  parseTransaction(transaction: any, currency?: Currency): Transaction;
32
32
  parseTrade(trade: any, market?: Market): Trade;
33
- fetchMarkets(params?: {}): Promise<any>;
33
+ fetchMarkets(params?: {}): Promise<any[]>;
34
34
  fetchMarketsV2(params?: {}): Promise<any[]>;
35
35
  fetchMarketsV3(params?: {}): Promise<any[]>;
36
36
  fetchCurrenciesFromCache(params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
@@ -64,7 +64,7 @@ export default class coinbase extends Exchange {
64
64
  status: string;
65
65
  fee: any;
66
66
  };
67
- findAccountId(code: any): Promise<any>;
67
+ findAccountId(code: any, params?: {}): Promise<any>;
68
68
  prepareAccountRequest(limit?: Int, params?: {}): {
69
69
  account_id: string;
70
70
  };
@@ -1072,7 +1072,10 @@ export default class coinbase extends Exchange {
1072
1072
  * @returns {object[]} an array of objects representing market data
1073
1073
  */
1074
1074
  const method = this.safeString(this.options, 'fetchMarkets', 'fetchMarketsV3');
1075
- return await this[method](params);
1075
+ if (method === 'fetchMarketsV3') {
1076
+ return await this.fetchMarketsV3(params);
1077
+ }
1078
+ return await this.fetchMarketsV2(params);
1076
1079
  }
1077
1080
  async fetchMarketsV2(params = {}) {
1078
1081
  const response = await this.fetchCurrenciesFromCache(params);
@@ -1147,7 +1150,13 @@ export default class coinbase extends Exchange {
1147
1150
  return result;
1148
1151
  }
1149
1152
  async fetchMarketsV3(params = {}) {
1150
- const response = await this.v3PrivateGetBrokerageProducts(params);
1153
+ const promisesUnresolved = [
1154
+ this.v3PrivateGetBrokerageProducts(params),
1155
+ this.v3PrivateGetBrokerageTransactionSummary(params),
1156
+ ];
1157
+ // const response = await this.v3PrivateGetBrokerageProducts (params);
1158
+ const promises = await Promise.all(promisesUnresolved);
1159
+ const response = this.safeDict(promises, 0, {});
1151
1160
  //
1152
1161
  // [
1153
1162
  // {
@@ -1182,7 +1191,8 @@ export default class coinbase extends Exchange {
1182
1191
  // ...
1183
1192
  // ]
1184
1193
  //
1185
- const fees = await this.v3PrivateGetBrokerageTransactionSummary(params);
1194
+ // const fees = await this.v3PrivateGetBrokerageTransactionSummary (params);
1195
+ const fees = this.safeDict(promises, 1, {});
1186
1196
  //
1187
1197
  // {
1188
1198
  // "total_volume": 0,
@@ -1899,6 +1909,9 @@ export default class coinbase extends Exchange {
1899
1909
  const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
1900
1910
  const ledger = this.parseLedger(response['data'], currency, since, limit);
1901
1911
  const length = ledger.length;
1912
+ if (length === 0) {
1913
+ return ledger;
1914
+ }
1902
1915
  const lastIndex = length - 1;
1903
1916
  const last = this.safeDict(ledger, lastIndex);
1904
1917
  const pagination = this.safeDict(response, 'pagination', {});
@@ -2238,9 +2251,9 @@ export default class coinbase extends Exchange {
2238
2251
  'fee': fee,
2239
2252
  };
2240
2253
  }
2241
- async findAccountId(code) {
2254
+ async findAccountId(code, params = {}) {
2242
2255
  await this.loadMarkets();
2243
- await this.loadAccounts();
2256
+ await this.loadAccounts(false, params);
2244
2257
  for (let i = 0; i < this.accounts.length; i++) {
2245
2258
  const account = this.accounts[i];
2246
2259
  if (account['code'] === code) {
@@ -2269,7 +2282,7 @@ export default class coinbase extends Exchange {
2269
2282
  if (code === undefined) {
2270
2283
  throw new ArgumentsRequired(this.id + ' prepareAccountRequestWithCurrencyCode() method requires an account_id (or accountId) parameter OR a currency code argument');
2271
2284
  }
2272
- accountId = await this.findAccountId(code);
2285
+ accountId = await this.findAccountId(code, params);
2273
2286
  if (accountId === undefined) {
2274
2287
  throw new ExchangeError(this.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code);
2275
2288
  }
@@ -2886,7 +2899,7 @@ export default class coinbase extends Exchange {
2886
2899
  let paginate = false;
2887
2900
  [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
2888
2901
  if (paginate) {
2889
- return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 100);
2902
+ return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 1000);
2890
2903
  }
2891
2904
  let market = undefined;
2892
2905
  if (symbol !== undefined) {
@@ -3413,7 +3426,7 @@ export default class coinbase extends Exchange {
3413
3426
  if (code === undefined) {
3414
3427
  throw new ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
3415
3428
  }
3416
- accountId = await this.findAccountId(code);
3429
+ accountId = await this.findAccountId(code, params);
3417
3430
  if (accountId === undefined) {
3418
3431
  throw new ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
3419
3432
  }
@@ -3638,7 +3651,7 @@ export default class coinbase extends Exchange {
3638
3651
  if (code === undefined) {
3639
3652
  throw new ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
3640
3653
  }
3641
- accountId = await this.findAccountId(code);
3654
+ accountId = await this.findAccountId(code, params);
3642
3655
  if (accountId === undefined) {
3643
3656
  throw new ExchangeError(this.id + ' deposit() could not find account id for ' + code);
3644
3657
  }
@@ -3708,7 +3721,7 @@ export default class coinbase extends Exchange {
3708
3721
  if (code === undefined) {
3709
3722
  throw new ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
3710
3723
  }
3711
- accountId = await this.findAccountId(code);
3724
+ accountId = await this.findAccountId(code, params);
3712
3725
  if (accountId === undefined) {
3713
3726
  throw new ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
3714
3727
  }
package/js/src/delta.d.ts CHANGED
@@ -8,7 +8,7 @@ export default class delta extends Exchange {
8
8
  describe(): any;
9
9
  convertExpireDate(date: any): string;
10
10
  createExpiredOptionMarket(symbol: string): MarketInterface;
11
- safeMarket(marketId?: any, market?: any, delimiter?: any, marketType?: any): MarketInterface;
11
+ safeMarket(marketId?: Str, market?: Market, delimiter?: Str, marketType?: Str): MarketInterface;
12
12
  fetchTime(params?: {}): Promise<number>;
13
13
  fetchStatus(params?: {}): Promise<{
14
14
  status: string;
@@ -19,6 +19,7 @@ export default class delta extends Exchange {
19
19
  }>;
20
20
  fetchCurrencies(params?: {}): Promise<{}>;
21
21
  loadMarkets(reload?: boolean, params?: {}): Promise<import("./base/types.js").Dictionary<MarketInterface>>;
22
+ indexByStringifiedNumericId(input: any): {};
22
23
  fetchMarkets(params?: {}): Promise<any[]>;
23
24
  parseTicker(ticker: any, market?: Market): Ticker;
24
25
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;