ccxt 4.2.75 → 4.2.77

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 (78) hide show
  1. package/README.md +5 -5
  2. package/build.sh +2 -2
  3. package/dist/ccxt.browser.js +1004 -616
  4. package/dist/ccxt.browser.min.js +7 -7
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +6 -0
  7. package/dist/cjs/src/binance.js +504 -443
  8. package/dist/cjs/src/bingx.js +13 -15
  9. package/dist/cjs/src/blofin.js +14 -2
  10. package/dist/cjs/src/bybit.js +102 -59
  11. package/dist/cjs/src/coinbase.js +19 -3
  12. package/dist/cjs/src/coinbaseinternational.js +1 -1
  13. package/dist/cjs/src/delta.js +66 -49
  14. package/dist/cjs/src/gate.js +1 -0
  15. package/dist/cjs/src/htx.js +1 -0
  16. package/dist/cjs/src/hyperliquid.js +1 -1
  17. package/dist/cjs/src/kraken.js +8 -8
  18. package/dist/cjs/src/kucoin.js +152 -5
  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/coinbaseinternational.js +1 -1
  22. package/dist/cjs/src/pro/coinex.js +20 -14
  23. package/dist/cjs/src/pro/deribit.js +1 -1
  24. package/dist/cjs/src/pro/exmo.js +1 -1
  25. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  26. package/dist/cjs/src/pro/phemex.js +1 -1
  27. package/dist/cjs/src/pro/poloniex.js +1 -1
  28. package/dist/cjs/src/pro/probit.js +1 -1
  29. package/dist/cjs/src/pro/woo.js +61 -6
  30. package/dist/cjs/src/woo.js +25 -0
  31. package/js/ccxt.d.ts +1 -1
  32. package/js/ccxt.js +1 -1
  33. package/js/src/abstract/binance.d.ts +1 -0
  34. package/js/src/abstract/binancecoinm.d.ts +1 -0
  35. package/js/src/abstract/binanceus.d.ts +1 -0
  36. package/js/src/abstract/binanceusdm.d.ts +1 -0
  37. package/js/src/abstract/bingx.d.ts +2 -0
  38. package/js/src/abstract/kucoin.d.ts +1 -0
  39. package/js/src/abstract/kucoinfutures.d.ts +1 -0
  40. package/js/src/base/Exchange.d.ts +3 -3
  41. package/js/src/base/Exchange.js +6 -0
  42. package/js/src/base/types.d.ts +1 -1
  43. package/js/src/binance.d.ts +2 -2
  44. package/js/src/binance.js +504 -443
  45. package/js/src/bingx.js +13 -15
  46. package/js/src/bitflyer.d.ts +2 -2
  47. package/js/src/bithumb.d.ts +2 -2
  48. package/js/src/blofin.js +14 -2
  49. package/js/src/bybit.d.ts +1 -1
  50. package/js/src/bybit.js +102 -59
  51. package/js/src/coinbase.js +19 -3
  52. package/js/src/coinbaseinternational.js +1 -1
  53. package/js/src/delta.d.ts +2 -1
  54. package/js/src/delta.js +66 -49
  55. package/js/src/deribit.d.ts +1 -1
  56. package/js/src/gate.d.ts +1 -1
  57. package/js/src/gate.js +1 -0
  58. package/js/src/htx.js +1 -0
  59. package/js/src/hyperliquid.js +1 -1
  60. package/js/src/kraken.js +8 -8
  61. package/js/src/kucoin.d.ts +4 -1
  62. package/js/src/kucoin.js +152 -5
  63. package/js/src/okx.d.ts +1 -1
  64. package/js/src/pro/ascendex.js +1 -1
  65. package/js/src/pro/bitvavo.js +1 -1
  66. package/js/src/pro/coinbaseinternational.js +1 -1
  67. package/js/src/pro/coinex.js +20 -14
  68. package/js/src/pro/deribit.js +1 -1
  69. package/js/src/pro/exmo.js +1 -1
  70. package/js/src/pro/krakenfutures.js +1 -1
  71. package/js/src/pro/phemex.js +1 -1
  72. package/js/src/pro/poloniex.js +1 -1
  73. package/js/src/pro/probit.js +1 -1
  74. package/js/src/pro/woo.d.ts +1 -0
  75. package/js/src/pro/woo.js +61 -6
  76. package/js/src/woo.js +25 -0
  77. package/package.json +1 -1
  78. package/skip-tests.json +1 -2
package/js/src/bingx.js CHANGED
@@ -127,6 +127,7 @@ export default class bingx extends Exchange {
127
127
  'v1': {
128
128
  'public': {
129
129
  'get': {
130
+ 'server/time': 3,
130
131
  'common/symbols': 3,
131
132
  'market/trades': 3,
132
133
  'market/depth': 3,
@@ -150,6 +151,7 @@ export default class bingx extends Exchange {
150
151
  'trade/order/cancelReplace': 3,
151
152
  'trade/cancelOrders': 3,
152
153
  'trade/cancelOpenOrders': 3,
154
+ 'trade/cancelAllAfter': 1,
153
155
  },
154
156
  },
155
157
  },
@@ -1812,15 +1814,18 @@ export default class bingx extends Exchange {
1812
1814
  request[exchangeClientOrderId] = clientOrderId;
1813
1815
  }
1814
1816
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
1815
- if (timeInForce === 'IOC') {
1817
+ [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
1818
+ if (postOnly || (timeInForce === 'PostOnly')) {
1819
+ request['timeInForce'] = 'PostOnly';
1820
+ }
1821
+ else if (timeInForce === 'IOC') {
1816
1822
  request['timeInForce'] = 'IOC';
1817
1823
  }
1824
+ else if (timeInForce === 'GTC') {
1825
+ request['timeInForce'] = 'GTC';
1826
+ }
1818
1827
  const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
1819
1828
  if (isSpot) {
1820
- [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'POC', params);
1821
- if (postOnly || (timeInForce === 'POC')) {
1822
- request['timeInForce'] = 'POC';
1823
- }
1824
1829
  const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
1825
1830
  params = this.omit(params, 'cost');
1826
1831
  if (cost !== undefined) {
@@ -1853,14 +1858,7 @@ export default class bingx extends Exchange {
1853
1858
  }
1854
1859
  }
1855
1860
  else {
1856
- [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
1857
- if (postOnly || (timeInForce === 'PostOnly')) {
1858
- request['timeInForce'] = 'PostOnly';
1859
- }
1860
- else if (timeInForce === 'GTC') {
1861
- request['timeInForce'] = 'GTC';
1862
- }
1863
- else if (timeInForce === 'FOK') {
1861
+ if (timeInForce === 'FOK') {
1864
1862
  request['timeInForce'] = 'FOK';
1865
1863
  }
1866
1864
  const stopLossPrice = this.safeString(params, 'stopLossPrice');
@@ -1988,7 +1986,7 @@ export default class bingx extends Exchange {
1988
1986
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1989
1987
  * @param {string} [params.clientOrderId] a unique id for the order
1990
1988
  * @param {bool} [params.postOnly] true to place a post only order
1991
- * @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
1989
+ * @param {string} [params.timeInForce] spot supports 'PO', 'GTC' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
1992
1990
  * @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
1993
1991
  * @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
1994
1992
  * @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
@@ -2473,7 +2471,7 @@ export default class bingx extends Exchange {
2473
2471
  'FILLED': 'closed',
2474
2472
  'CANCELED': 'canceled',
2475
2473
  'CANCELLED': 'canceled',
2476
- 'FAILED': 'failed',
2474
+ 'FAILED': 'canceled',
2477
2475
  };
2478
2476
  return this.safeString(statuses, status, status);
2479
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,
@@ -2653,7 +2656,7 @@ export default class bybit extends Exchange {
2653
2656
  //
2654
2657
  const id = this.safeStringN(trade, ['execId', 'id', 'tradeId']);
2655
2658
  const marketId = this.safeString(trade, 'symbol');
2656
- let marketType = 'contract';
2659
+ let marketType = ('createType' in trade) ? 'contract' : 'spot';
2657
2660
  if (market !== undefined) {
2658
2661
  marketType = market['type'];
2659
2662
  }
@@ -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) {
@@ -6792,6 +6834,7 @@ export default class bybit extends Exchange {
6792
6834
  * @param {int} [since] Not used by Bybit
6793
6835
  * @param {int} [limit] The number of open interest structures to return. Max 200, default 50
6794
6836
  * @param {object} [params] Exchange specific parameters
6837
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6795
6838
  * @returns An array of open interest structures
6796
6839
  */
6797
6840
  if (timeframe === '1m') {
@@ -1326,7 +1326,7 @@ export default class coinbase extends Exchange {
1326
1326
  * @returns {object} an associative dictionary of currencies
1327
1327
  */
1328
1328
  const response = await this.fetchCurrenciesFromCache(params);
1329
- const currencies = this.safeDict(response, 'currencies', {});
1329
+ const currencies = this.safeList(response, 'currencies', []);
1330
1330
  //
1331
1331
  // fiat
1332
1332
  //
@@ -1878,9 +1878,15 @@ export default class coinbase extends Exchange {
1878
1878
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1879
1879
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
1880
1880
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1881
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1881
1882
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1882
1883
  */
1883
1884
  await this.loadMarkets();
1885
+ let paginate = false;
1886
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
1887
+ if (paginate) {
1888
+ return await this.fetchPaginatedCallCursor('fetchLedger', code, since, limit, params, 'next_starting_after', 'starting_after', undefined, 100);
1889
+ }
1884
1890
  let currency = undefined;
1885
1891
  if (code !== undefined) {
1886
1892
  currency = this.currency(code);
@@ -1891,7 +1897,17 @@ export default class coinbase extends Exchange {
1891
1897
  // the value for the next page can be obtained from the result of the previous call in the 'pagination' field
1892
1898
  // eg: instance.last_json_response.pagination.next_starting_after
1893
1899
  const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
1894
- return this.parseLedger(response['data'], currency, since, limit);
1900
+ const ledger = this.parseLedger(response['data'], currency, since, limit);
1901
+ const length = ledger.length;
1902
+ const lastIndex = length - 1;
1903
+ const last = this.safeDict(ledger, lastIndex);
1904
+ const pagination = this.safeDict(response, 'pagination', {});
1905
+ const cursor = this.safeString(pagination, 'next_starting_after');
1906
+ if ((cursor !== undefined) && (cursor !== '')) {
1907
+ last['next_starting_after'] = cursor;
1908
+ ledger[lastIndex] = last;
1909
+ }
1910
+ return ledger;
1895
1911
  }
1896
1912
  parseLedgerEntryStatus(status) {
1897
1913
  const types = {
@@ -2870,7 +2886,7 @@ export default class coinbase extends Exchange {
2870
2886
  let paginate = false;
2871
2887
  [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
2872
2888
  if (paginate) {
2873
- return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 100);
2889
+ return await this.fetchPaginatedCallCursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', undefined, 1000);
2874
2890
  }
2875
2891
  let market = undefined;
2876
2892
  if (symbol !== undefined) {
@@ -19,7 +19,7 @@ export default class coinbaseinternational extends Exchange {
19
19
  describe() {
20
20
  return this.deepExtend(super.describe(), {
21
21
  'id': 'coinbaseinternational',
22
- 'name': 'coinbase International',
22
+ 'name': 'Coinbase International',
23
23
  'countries': ['US'],
24
24
  'certified': true,
25
25
  'pro': true,
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>;