ccxt 4.4.68 → 4.4.70

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 (51) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +0 -1
  5. package/dist/cjs/src/binance.js +20 -3
  6. package/dist/cjs/src/bitget.js +49 -335
  7. package/dist/cjs/src/bitstamp.js +2 -3
  8. package/dist/cjs/src/bybit.js +7 -0
  9. package/dist/cjs/src/coinbase.js +25 -9
  10. package/dist/cjs/src/cryptomus.js +214 -116
  11. package/dist/cjs/src/hyperliquid.js +19 -8
  12. package/dist/cjs/src/okx.js +4 -0
  13. package/dist/cjs/src/paradex.js +172 -4
  14. package/dist/cjs/src/phemex.js +2 -2
  15. package/dist/cjs/src/pro/bitget.js +40 -7
  16. package/dist/cjs/src/pro/bybit.js +86 -38
  17. package/dist/cjs/src/tradeogre.js +34 -11
  18. package/dist/cjs/src/whitebit.js +211 -1
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/abstract/bybit.d.ts +4 -0
  22. package/js/src/abstract/myokx.d.ts +3 -0
  23. package/js/src/abstract/okx.d.ts +3 -0
  24. package/js/src/abstract/paradex.d.ts +23 -0
  25. package/js/src/abstract/tradeogre.d.ts +2 -1
  26. package/js/src/base/Exchange.js +0 -1
  27. package/js/src/base/types.d.ts +2 -2
  28. package/js/src/binance.js +20 -3
  29. package/js/src/bitget.d.ts +0 -1
  30. package/js/src/bitget.js +49 -335
  31. package/js/src/bitstamp.js +2 -3
  32. package/js/src/bybit.js +7 -0
  33. package/js/src/coinbase.d.ts +0 -5
  34. package/js/src/coinbase.js +25 -9
  35. package/js/src/cryptomus.d.ts +127 -1
  36. package/js/src/cryptomus.js +214 -116
  37. package/js/src/hyperliquid.js +19 -8
  38. package/js/src/okx.d.ts +1 -0
  39. package/js/src/okx.js +4 -0
  40. package/js/src/paradex.d.ts +48 -1
  41. package/js/src/paradex.js +172 -4
  42. package/js/src/phemex.d.ts +1 -1
  43. package/js/src/phemex.js +2 -2
  44. package/js/src/pro/bitget.js +40 -7
  45. package/js/src/pro/bybit.d.ts +1 -0
  46. package/js/src/pro/bybit.js +86 -38
  47. package/js/src/tradeogre.d.ts +1 -0
  48. package/js/src/tradeogre.js +34 -11
  49. package/js/src/whitebit.d.ts +35 -1
  50. package/js/src/whitebit.js +211 -1
  51. package/package.json +1 -1
@@ -16,7 +16,7 @@ export default class cryptomus extends Exchange {
16
16
  'name': 'Cryptomus',
17
17
  'countries': ['CA'],
18
18
  'rateLimit': 100,
19
- 'version': 'v1',
19
+ 'version': 'v2',
20
20
  'certified': false,
21
21
  'pro': false,
22
22
  'has': {
@@ -98,7 +98,7 @@ export default class cryptomus extends Exchange {
98
98
  'fetchTime': false,
99
99
  'fetchTrades': true,
100
100
  'fetchTradingFee': false,
101
- 'fetchTradingFees': false,
101
+ 'fetchTradingFees': true,
102
102
  'fetchTransactions': false,
103
103
  'fetchTransfers': false,
104
104
  'fetchWithdrawals': false,
@@ -221,15 +221,15 @@ export default class cryptomus extends Exchange {
221
221
  'features': {},
222
222
  });
223
223
  }
224
+ /**
225
+ * @method
226
+ * @name cryptomus#fetchMarkets
227
+ * @description retrieves data on all markets for the exchange
228
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
229
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
230
+ * @returns {object[]} an array of objects representing market data
231
+ */
224
232
  async fetchMarkets(params = {}) {
225
- /**
226
- * @method
227
- * @name cryptomus#fetchMarkets
228
- * @description retrieves data on all markets for the exchange
229
- * @see https://doc.cryptomus.com/personal/market-cap/tickers
230
- * @param {object} [params] extra parameters specific to the exchange API endpoint
231
- * @returns {object[]} an array of objects representing market data
232
- */
233
233
  const response = await this.publicGetV2UserApiExchangeMarkets(params);
234
234
  //
235
235
  // {
@@ -331,15 +331,15 @@ export default class cryptomus extends Exchange {
331
331
  'info': market,
332
332
  });
333
333
  }
334
+ /**
335
+ * @method
336
+ * @name cryptomus#fetchCurrencies
337
+ * @description fetches all available currencies on an exchange
338
+ * @see https://doc.cryptomus.com/personal/market-cap/assets
339
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
340
+ * @returns {object} an associative dictionary of currencies
341
+ */
334
342
  async fetchCurrencies(params = {}) {
335
- /**
336
- * @method
337
- * @name cryptomus#fetchCurrencies
338
- * @description fetches all available currencies on an exchange
339
- * @see https://doc.cryptomus.com/personal/market-cap/assets
340
- * @param {object} [params] extra parameters specific to the exchange API endpoint
341
- * @returns {object} an associative dictionary of currencies
342
- */
343
343
  const response = await this.publicGetV1ExchangeMarketAssets(params);
344
344
  //
345
345
  // {
@@ -471,16 +471,16 @@ export default class cryptomus extends Exchange {
471
471
  }
472
472
  return result;
473
473
  }
474
+ /**
475
+ * @method
476
+ * @name cryptomus#fetchTickers
477
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
478
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
479
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
480
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
481
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
482
+ */
474
483
  async fetchTickers(symbols = undefined, params = {}) {
475
- /**
476
- * @method
477
- * @name cryptomus#fetchTickers
478
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
479
- * @see https://doc.cryptomus.com/personal/market-cap/tickers
480
- * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
481
- * @param {object} [params] extra parameters specific to the exchange API endpoint
482
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
483
- */
484
484
  await this.loadMarkets();
485
485
  symbols = this.marketSymbols(symbols);
486
486
  const response = await this.publicGetV1ExchangeMarketTickers(params);
@@ -535,18 +535,18 @@ export default class cryptomus extends Exchange {
535
535
  'info': ticker,
536
536
  }, market);
537
537
  }
538
+ /**
539
+ * @method
540
+ * @name cryptomus#fetchOrderBook
541
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
542
+ * @see https://doc.cryptomus.com/personal/market-cap/orderbook
543
+ * @param {string} symbol unified symbol of the market to fetch the order book for
544
+ * @param {int} [limit] the maximum amount of order book entries to return
545
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
546
+ * @param {int} [params.level] 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
547
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
548
+ */
538
549
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
539
- /**
540
- * @method
541
- * @name cryptomus#fetchOrderBook
542
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
543
- * @see https://doc.cryptomus.com/personal/market-cap/orderbook
544
- * @param {string} symbol unified symbol of the market to fetch the order book for
545
- * @param {int} [limit] the maximum amount of order book entries to return
546
- * @param {object} [params] extra parameters specific to the exchange API endpoint
547
- * @param {int} [params.level] 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
548
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
549
- */
550
550
  await this.loadMarkets();
551
551
  const market = this.market(symbol);
552
552
  const request = {
@@ -579,18 +579,18 @@ export default class cryptomus extends Exchange {
579
579
  const timestamp = this.safeTimestamp(data, 'timestamp');
580
580
  return this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks', 'price', 'quantity');
581
581
  }
582
+ /**
583
+ * @method
584
+ * @name cryptomus#fetchTrades
585
+ * @description get the list of most recent trades for a particular symbol
586
+ * @see https://doc.cryptomus.com/personal/market-cap/trades
587
+ * @param {string} symbol unified symbol of the market to fetch trades for
588
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
589
+ * @param {int} [limit] the maximum amount of trades to fetch (maximum value is 100)
590
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
591
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
592
+ */
582
593
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
583
- /**
584
- * @method
585
- * @name cryptomus#fetchTrades
586
- * @description get the list of most recent trades for a particular symbol
587
- * @see https://doc.cryptomus.com/personal/market-cap/trades
588
- * @param {string} symbol unified symbol of the market to fetch trades for
589
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
590
- * @param {int} [limit] the maximum amount of trades to fetch (maximum value is 100)
591
- * @param {object} [params] extra parameters specific to the exchange API endpoint
592
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
593
- */
594
594
  await this.loadMarkets();
595
595
  const market = this.market(symbol);
596
596
  const request = {
@@ -645,15 +645,15 @@ export default class cryptomus extends Exchange {
645
645
  'info': trade,
646
646
  }, market);
647
647
  }
648
+ /**
649
+ * @method
650
+ * @name cryptomus#fetchBalance
651
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
652
+ * @see https://doc.cryptomus.com/personal/converts/balance
653
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
654
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
655
+ */
648
656
  async fetchBalance(params = {}) {
649
- /**
650
- * @method
651
- * @name cryptomus#fetchBalance
652
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
653
- * @see https://doc.cryptomus.com/personal/converts/balance
654
- * @param {object} [params] extra parameters specific to the exchange API endpoint
655
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
656
- */
657
657
  await this.loadMarkets();
658
658
  const request = {};
659
659
  const response = await this.privateGetV2UserApiExchangeAccountBalance(this.extend(request, params));
@@ -693,24 +693,23 @@ export default class cryptomus extends Exchange {
693
693
  }
694
694
  return this.safeBalance(result);
695
695
  }
696
+ /**
697
+ * @method
698
+ * @name cryptomus#createOrder
699
+ * @description create a trade order
700
+ * @see https://doc.cryptomus.com/personal/exchange/market-order-creation
701
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-creation
702
+ * @param {string} symbol unified symbol of the market to create an order in
703
+ * @param {string} type 'market' or 'limit' or for spot
704
+ * @param {string} side 'buy' or 'sell'
705
+ * @param {float} amount how much of you want to trade in units of the base currency
706
+ * @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders)
707
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
708
+ * @param {float} [params.cost] *market buy only* the quote quantity that can be used as an alternative for the amount
709
+ * @param {string} [params.clientOrderId] a unique identifier for the order (optional)
710
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
711
+ */
696
712
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
697
- /**
698
- * @method
699
- * @name cryptomus#createOrder
700
- * @description create a trade order
701
- * @see https://doc.cryptomus.com/personal/exchange/market-order-creation
702
- * @see https://doc.cryptomus.com/personal/exchange/limit-order-creation
703
- * @param {string} symbol unified symbol of the market to create an order in
704
- * @param {string} type 'market' or 'limit' or for spot
705
- * @param {string} side 'buy' or 'sell'
706
- * @param {float} amount how much of you want to trade in units of the base currency
707
- * @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders)
708
- * @param {object} [params] extra parameters specific to the exchange API endpoint
709
- * @param {float} [params.cost] *market buy only* the quote quantity that can be used as an alternative for the amount
710
- * @param {object} [params] extra parameters specific to the exchange API endpoint
711
- * @param {string} [params.clientOrderId] a unique identifier for the order (optional)
712
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
713
- */
714
713
  await this.loadMarkets();
715
714
  const market = this.market(symbol);
716
715
  const request = {
@@ -769,17 +768,17 @@ export default class cryptomus extends Exchange {
769
768
  //
770
769
  return this.parseOrder(response, market);
771
770
  }
771
+ /**
772
+ * @method
773
+ * @name cryptomus#cancelOrder
774
+ * @description cancels an open limit order
775
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
776
+ * @param {string} id order id
777
+ * @param {string} symbol unified symbol of the market the order was made in (not used in cryptomus)
778
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
779
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
780
+ */
772
781
  async cancelOrder(id, symbol = undefined, params = {}) {
773
- /**
774
- * @method
775
- * @name cryptomus#cancelOrder
776
- * @description cancels an open limit order
777
- * @see https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
778
- * @param {string} id order id
779
- * @param {string} symbol unified symbol of the market the order was made in (not used in cryptomus)
780
- * @param {object} [params] extra parameters specific to the exchange API endpoint
781
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
782
- */
783
782
  await this.loadMarkets();
784
783
  const request = {};
785
784
  request['orderId'] = id;
@@ -791,23 +790,23 @@ export default class cryptomus extends Exchange {
791
790
  //
792
791
  return response;
793
792
  }
793
+ /**
794
+ * @method
795
+ * @name cryptomus#fetchOrders
796
+ * @description fetches information on multiple orders made by the user
797
+ * @see https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
798
+ * @param {string} symbol unified market symbol of the market orders were made in (not used in cryptomus)
799
+ * @param {int} [since] the earliest time in ms to fetch orders for (not used in cryptomus)
800
+ * @param {int} [limit] the maximum number of order structures to retrieve (not used in cryptomus)
801
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
802
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
803
+ * @param {string} [params.order_id] order id
804
+ * @param {string} [params.client_order_id] client order id
805
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
806
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
807
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
808
+ */
794
809
  async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
795
- /**
796
- * @method
797
- * @name cryptomus#fetchOrders
798
- * @description fetches information on multiple orders made by the user
799
- * @see https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
800
- * @param {string} symbol unified market symbol of the market orders were made in (not used in cryptomus)
801
- * @param {int} [since] the earliest time in ms to fetch orders for (not used in cryptomus)
802
- * @param {int} [limit] the maximum number of order structures to retrieve (not used in cryptomus)
803
- * @param {object} [params] extra parameters specific to the exchange API endpoint
804
- * @param {string} [params.direction] order direction 'buy' or 'sell'
805
- * @param {string} [params.order_id] order id
806
- * @param {string} [params.client_order_id] client order id
807
- * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
808
- * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
809
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
810
- */
811
810
  await this.loadMarkets();
812
811
  const request = {};
813
812
  let market = undefined;
@@ -866,23 +865,23 @@ export default class cryptomus extends Exchange {
866
865
  }
867
866
  return orders;
868
867
  }
868
+ /**
869
+ * @method
870
+ * @name cryptomus#fetchOpenOrders
871
+ * @description fetch all unfilled currently open orders
872
+ * @see https://doc.cryptomus.com/personal/exchange/list-of-active-orders
873
+ * @param {string} symbol unified market symbol
874
+ * @param {int} [since] the earliest time in ms to fetch open orders for (not used in cryptomus)
875
+ * @param {int} [limit] the maximum number of open orders structures to retrieve (not used in cryptomus)
876
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
877
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
878
+ * @param {string} [params.order_id] order id
879
+ * @param {string} [params.client_order_id] client order id
880
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
881
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
882
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
883
+ */
869
884
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
870
- /**
871
- * @method
872
- * @name cryptomus#fetchOpenOrders
873
- * @description fetch all unfilled currently open orders
874
- * @see https://doc.cryptomus.com/personal/exchange/list-of-active-orders
875
- * @param {string} symbol unified market symbol
876
- * @param {int} [since] the earliest time in ms to fetch open orders for (not used in cryptomus)
877
- * @param {int} [limit] the maximum number of open orders structures to retrieve (not used in cryptomus)
878
- * @param {object} [params] extra parameters specific to the exchange API endpoint
879
- * @param {string} [params.direction] order direction 'buy' or 'sell'
880
- * @param {string} [params.order_id] order id
881
- * @param {string} [params.client_order_id] client order id
882
- * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
883
- * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
884
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
885
- */
886
885
  await this.loadMarkets();
887
886
  let market = undefined;
888
887
  if (symbol !== undefined) {
@@ -1035,6 +1034,105 @@ export default class cryptomus extends Exchange {
1035
1034
  };
1036
1035
  return this.safeString(statuses, status, status);
1037
1036
  }
1037
+ /**
1038
+ * @method
1039
+ * @name cryptomus#fetchTradingFees
1040
+ * @description fetch the trading fees for multiple markets
1041
+ * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fees
1042
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1043
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
1044
+ */
1045
+ async fetchTradingFees(params = {}) {
1046
+ const response = await this.privateGetV2UserApiExchangeAccountTariffs(params);
1047
+ //
1048
+ // {
1049
+ // result: {
1050
+ // equivalent_currency_code: 'USD',
1051
+ // current_tariff_step: {
1052
+ // step: '0',
1053
+ // from_turnover: '0.00000000',
1054
+ // maker_percent: '0.08',
1055
+ // taker_percent: '0.1'
1056
+ // },
1057
+ // tariff_steps: [
1058
+ // {
1059
+ // step: '0',
1060
+ // from_turnover: '0.00000000',
1061
+ // maker_percent: '0.08',
1062
+ // taker_percent: '0.1'
1063
+ // },
1064
+ // {
1065
+ // step: '1',
1066
+ // from_turnover: '100001.00000000',
1067
+ // maker_percent: '0.06',
1068
+ // taker_percent: '0.095'
1069
+ // },
1070
+ // {
1071
+ // step: '2',
1072
+ // from_turnover: '250001.00000000',
1073
+ // maker_percent: '0.055',
1074
+ // taker_percent: '0.085'
1075
+ // },
1076
+ // {
1077
+ // step: '3',
1078
+ // from_turnover: '500001.00000000',
1079
+ // maker_percent: '0.05',
1080
+ // taker_percent: '0.075'
1081
+ // },
1082
+ // {
1083
+ // step: '4',
1084
+ // from_turnover: '2500001.00000000',
1085
+ // maker_percent: '0.04',
1086
+ // taker_percent: '0.07'
1087
+ // }
1088
+ // ],
1089
+ // daily_turnover: '0.00000000',
1090
+ // monthly_turnover: '77.52062617',
1091
+ // circulation_funds: '25.48900443'
1092
+ // }
1093
+ // }
1094
+ //
1095
+ const data = this.safeDict(response, 'result', {});
1096
+ const currentFeeTier = this.safeDict(data, 'current_tariff_step', {});
1097
+ let makerFee = this.safeString(currentFeeTier, 'maker_percent');
1098
+ let takerFee = this.safeString(currentFeeTier, 'taker_percent');
1099
+ makerFee = Precise.stringDiv(makerFee, '100');
1100
+ takerFee = Precise.stringDiv(takerFee, '100');
1101
+ const feeTiers = this.safeList(data, 'tariff_steps', []);
1102
+ const result = {};
1103
+ const tiers = this.parseFeeTiers(feeTiers);
1104
+ for (let i = 0; i < this.symbols.length; i++) {
1105
+ const symbol = this.symbols[i];
1106
+ result[symbol] = {
1107
+ 'info': response,
1108
+ 'symbol': symbol,
1109
+ 'maker': this.parseNumber(makerFee),
1110
+ 'taker': this.parseNumber(takerFee),
1111
+ 'percentage': true,
1112
+ 'tierBased': true,
1113
+ 'tiers': tiers,
1114
+ };
1115
+ }
1116
+ return result;
1117
+ }
1118
+ parseFeeTiers(feeTiers, market = undefined) {
1119
+ const takerFees = [];
1120
+ const makerFees = [];
1121
+ for (let i = 0; i < feeTiers.length; i++) {
1122
+ const tier = feeTiers[i];
1123
+ const turnover = this.safeNumber(tier, 'from_turnover');
1124
+ let taker = this.safeString(tier, 'taker_percent');
1125
+ let maker = this.safeString(tier, 'maker_percent');
1126
+ maker = Precise.stringDiv(maker, '100');
1127
+ taker = Precise.stringDiv(taker, '100');
1128
+ makerFees.push([turnover, this.parseNumber(maker)]);
1129
+ takerFees.push([turnover, this.parseNumber(taker)]);
1130
+ }
1131
+ return {
1132
+ 'maker': makerFees,
1133
+ 'taker': takerFees,
1134
+ };
1135
+ }
1038
1136
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1039
1137
  const endpoint = this.implodeParams(path, params);
1040
1138
  params = this.omit(params, this.extractParams(path));
@@ -837,7 +837,7 @@ export default class hyperliquid extends Exchange {
837
837
  'info': response,
838
838
  'USDC': {
839
839
  'total': this.safeNumber(data, 'accountValue'),
840
- 'free': this.safeNumber(response, 'withdrawable'),
840
+ 'used': this.safeNumber(data, 'totalMarginUsed'),
841
841
  },
842
842
  };
843
843
  const timestamp = this.safeInteger(response, 'time');
@@ -1807,12 +1807,13 @@ export default class hyperliquid extends Exchange {
1807
1807
  const isTrigger = (stopLossPrice || takeProfitPrice);
1808
1808
  const reduceOnly = this.safeBool(orderParams, 'reduceOnly', false);
1809
1809
  orderParams = this.omit(orderParams, ['slippage', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'clientOrderId', 'client_id', 'postOnly', 'reduceOnly']);
1810
- let px = price.toString();
1810
+ let px = this.numberToString(price);
1811
1811
  if (isMarket) {
1812
- px = (isBuy) ? Precise.stringMul(price.toString(), Precise.stringAdd('1', slippage)) : Precise.stringMul(price.toString(), Precise.stringSub('1', slippage));
1812
+ px = (isBuy) ? Precise.stringMul(px, Precise.stringAdd('1', slippage)) : Precise.stringMul(px, Precise.stringSub('1', slippage));
1813
+ px = this.priceToPrecision(symbol, px);
1813
1814
  }
1814
1815
  else {
1815
- px = this.priceToPrecision(symbol, price.toString());
1816
+ px = this.priceToPrecision(symbol, px);
1816
1817
  }
1817
1818
  const sz = this.amountToPrecision(symbol, amount);
1818
1819
  const orderType = {};
@@ -2324,6 +2325,11 @@ export default class hyperliquid extends Exchange {
2324
2325
  }
2325
2326
  const totalAmount = this.safeString2(entry, 'origSz', 'totalSz');
2326
2327
  const remaining = this.safeString(entry, 'sz');
2328
+ const tif = this.safeStringUpper(entry, 'tif');
2329
+ let postOnly = undefined;
2330
+ if (tif !== undefined) {
2331
+ postOnly = (tif === 'ALO');
2332
+ }
2327
2333
  return this.safeOrder({
2328
2334
  'info': order,
2329
2335
  'id': this.safeString(entry, 'oid'),
@@ -2334,8 +2340,8 @@ export default class hyperliquid extends Exchange {
2334
2340
  'lastUpdateTimestamp': this.safeInteger(order, 'statusTimestamp'),
2335
2341
  'symbol': symbol,
2336
2342
  'type': this.parseOrderType(this.safeStringLower(entry, 'orderType')),
2337
- 'timeInForce': this.safeStringUpper(entry, 'tif'),
2338
- 'postOnly': undefined,
2343
+ 'timeInForce': tif,
2344
+ 'postOnly': postOnly,
2339
2345
  'reduceOnly': this.safeBool(entry, 'reduceOnly'),
2340
2346
  'side': side,
2341
2347
  'price': this.safeString(entry, 'limitPx'),
@@ -2457,6 +2463,11 @@ export default class hyperliquid extends Exchange {
2457
2463
  side = (side === 'A') ? 'sell' : 'buy';
2458
2464
  }
2459
2465
  const fee = this.safeString(trade, 'fee');
2466
+ let takerOrMaker = undefined;
2467
+ const crossed = this.safeBool(trade, 'crossed');
2468
+ if (crossed !== undefined) {
2469
+ takerOrMaker = crossed ? 'taker' : 'maker';
2470
+ }
2460
2471
  return this.safeTrade({
2461
2472
  'info': trade,
2462
2473
  'timestamp': timestamp,
@@ -2466,7 +2477,7 @@ export default class hyperliquid extends Exchange {
2466
2477
  'order': this.safeString(trade, 'oid'),
2467
2478
  'type': undefined,
2468
2479
  'side': side,
2469
- 'takerOrMaker': undefined,
2480
+ 'takerOrMaker': takerOrMaker,
2470
2481
  'price': price,
2471
2482
  'amount': amount,
2472
2483
  'cost': undefined,
@@ -3040,7 +3051,7 @@ export default class hyperliquid extends Exchange {
3040
3051
  'tagTo': undefined,
3041
3052
  'tagFrom': undefined,
3042
3053
  'type': undefined,
3043
- 'amount': this.safeInteger(delta, 'usdc'),
3054
+ 'amount': this.safeNumber(delta, 'usdc'),
3044
3055
  'currency': undefined,
3045
3056
  'status': this.safeString(transaction, 'status'),
3046
3057
  'updated': undefined,
package/js/src/okx.d.ts CHANGED
@@ -237,6 +237,7 @@ export default class okx extends Exchange {
237
237
  * @param {string} [params.trailingPercent] the percent to trail away from the current market price
238
238
  * @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
239
239
  * @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
240
+ * @param {string} [params.marginMode] 'cross' or 'isolated', the default is 'cross'
240
241
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
241
242
  */
242
243
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/okx.js CHANGED
@@ -304,7 +304,9 @@ export default class okx extends Exchange {
304
304
  'trade/easy-convert-currency-list': 20,
305
305
  'trade/easy-convert-history': 20,
306
306
  'trade/one-click-repay-currency-list': 20,
307
+ 'trade/one-click-repay-currency-list-v2': 20,
307
308
  'trade/one-click-repay-history': 20,
309
+ 'trade/one-click-repay-history-v2': 20,
308
310
  'trade/account-rate-limit': 1,
309
311
  // asset
310
312
  'asset/currencies': 5 / 3,
@@ -461,6 +463,7 @@ export default class okx extends Exchange {
461
463
  'trade/cancel-advance-algos': 1,
462
464
  'trade/easy-convert': 20,
463
465
  'trade/one-click-repay': 20,
466
+ 'trade/one-click-repay-v2': 20,
464
467
  'trade/mass-cancel': 4,
465
468
  'trade/cancel-all-after': 10,
466
469
  // asset
@@ -3156,6 +3159,7 @@ export default class okx extends Exchange {
3156
3159
  * @param {string} [params.trailingPercent] the percent to trail away from the current market price
3157
3160
  * @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
3158
3161
  * @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
3162
+ * @param {string} [params.marginMode] 'cross' or 'isolated', the default is 'cross'
3159
3163
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3160
3164
  */
3161
3165
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/paradex.js';
2
- import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int } from './base/types.js';
2
+ import type { Str, Num, Dict, Int, Market, OrderType, OrderSide, Order, OrderBook, Strings, Ticker, Tickers, Trade, Balances, Currency, Transaction, OHLCV, Position, int, MarginMode, Leverage } from './base/types.js';
3
3
  /**
4
4
  * @class paradex
5
5
  * @description Paradex is a decentralized exchange built on the StarkWare layer 2 scaling solution. To access private methods you can either use the ETH public key and private key by setting (exchange.privateKey and exchange.walletAddress)
@@ -311,6 +311,53 @@ export default class paradex extends Exchange {
311
311
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
312
312
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
313
313
  parseTransactionStatus(status: Str): string;
314
+ /**
315
+ * @method
316
+ * @name paradex#fetchMarginMode
317
+ * @description fetches the margin mode of a specific symbol
318
+ * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration
319
+ * @param {string} symbol unified symbol of the market the order was made in
320
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
321
+ * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
322
+ */
323
+ fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
324
+ parseMarginMode(rawMarginMode: Dict, market?: any): MarginMode;
325
+ /**
326
+ * @method
327
+ * @name paradex#setMarginMode
328
+ * @description set margin mode to 'cross' or 'isolated'
329
+ * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration
330
+ * @param {string} marginMode 'cross' or 'isolated'
331
+ * @param {string} symbol unified market symbol
332
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
333
+ * @param {float} [params.leverage] the rate of leverage
334
+ * @returns {object} response from the exchange
335
+ */
336
+ setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
337
+ /**
338
+ * @method
339
+ * @name paradex#fetchLeverage
340
+ * @description fetch the set leverage for a market
341
+ * @see https://docs.api.testnet.paradex.trade/#get-account-margin-configuration
342
+ * @param {string} symbol unified market symbol
343
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
344
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
345
+ */
346
+ fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
347
+ parseLeverage(leverage: Dict, market?: Market): Leverage;
348
+ encodeMarginMode(mode: any): string;
349
+ /**
350
+ * @method
351
+ * @name paradex#setLeverage
352
+ * @description set the level of leverage for a market
353
+ * @see https://docs.api.testnet.paradex.trade/#set-margin-configuration
354
+ * @param {float} leverage the rate of leverage
355
+ * @param {string} [symbol] unified market symbol (is mandatory for swap markets)
356
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
357
+ * @param {string} [params.marginMode] 'cross' or 'isolated'
358
+ * @returns {object} response from the exchange
359
+ */
360
+ setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
314
361
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
315
362
  url: string;
316
363
  method: string;