ccxt 4.3.68 → 4.3.69

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 (47) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +359 -353
  5. package/dist/cjs/src/bingx.js +134 -75
  6. package/dist/cjs/src/btcbox.js +2 -1
  7. package/dist/cjs/src/coinbaseinternational.js +79 -1
  8. package/dist/cjs/src/hyperliquid.js +0 -3
  9. package/dist/cjs/src/kucoin.js +12 -5
  10. package/dist/cjs/src/oxfun.js +2 -2
  11. package/dist/cjs/src/poloniex.js +33 -33
  12. package/dist/cjs/src/poloniexfutures.js +26 -26
  13. package/dist/cjs/src/pro/poloniex.js +13 -13
  14. package/dist/cjs/src/pro/poloniexfutures.js +5 -5
  15. package/js/ccxt.d.ts +3 -3
  16. package/js/ccxt.js +1 -1
  17. package/js/src/base/Exchange.d.ts +107 -82
  18. package/js/src/base/Exchange.js +359 -353
  19. package/js/src/base/types.d.ts +0 -2
  20. package/js/src/binance.d.ts +2 -2
  21. package/js/src/bingx.d.ts +2 -2
  22. package/js/src/bingx.js +134 -75
  23. package/js/src/bitget.d.ts +2 -2
  24. package/js/src/bitmart.d.ts +2 -2
  25. package/js/src/bitrue.d.ts +2 -2
  26. package/js/src/btcbox.js +2 -1
  27. package/js/src/bybit.d.ts +2 -2
  28. package/js/src/coinbaseinternational.d.ts +11 -0
  29. package/js/src/coinbaseinternational.js +79 -1
  30. package/js/src/coinex.d.ts +2 -2
  31. package/js/src/coinlist.d.ts +2 -2
  32. package/js/src/deribit.d.ts +2 -2
  33. package/js/src/digifinex.d.ts +2 -2
  34. package/js/src/hyperliquid.js +0 -3
  35. package/js/src/kucoin.js +12 -5
  36. package/js/src/latoken.d.ts +2 -2
  37. package/js/src/mexc.d.ts +2 -2
  38. package/js/src/okx.d.ts +2 -2
  39. package/js/src/oxfun.d.ts +1 -1
  40. package/js/src/oxfun.js +2 -2
  41. package/js/src/phemex.d.ts +2 -2
  42. package/js/src/poloniex.js +33 -33
  43. package/js/src/poloniexfutures.js +26 -26
  44. package/js/src/pro/poloniex.js +13 -13
  45. package/js/src/pro/poloniexfutures.js +5 -5
  46. package/js/src/woo.d.ts +2 -2
  47. package/package.json +1 -1
@@ -527,8 +527,6 @@ export interface IsolatedBorrowRates extends Dictionary<IsolatedBorrowRates> {
527
527
  }
528
528
  export interface CrossBorrowRates extends Dictionary<CrossBorrowRates> {
529
529
  }
530
- export interface TransferEntries extends Dictionary<TransferEntry> {
531
- }
532
530
  export interface LeverageTiers extends Dictionary<LeverageTier[]> {
533
531
  }
534
532
  /** [ timestamp, open, high, low, close, volume ] */
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, TransferEntries, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @augments Exchange
@@ -107,7 +107,7 @@ export default class binance extends Exchange {
107
107
  amount: number;
108
108
  };
109
109
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
110
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
110
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
111
111
  fetchDepositAddress(code: string, params?: {}): Promise<{
112
112
  currency: string;
113
113
  address: string;
package/js/src/bingx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bingx.js';
2
- import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict, Leverage, MarginMode, Num, MarginModification, Currencies, TransferEntries, int, TradingFeeInterface } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict, Leverage, MarginMode, Num, MarginModification, Currencies, int, TradingFeeInterface } from './base/types.js';
3
3
  /**
4
4
  * @class bingx
5
5
  * @augments Exchange
@@ -89,7 +89,7 @@ export default class bingx extends Exchange {
89
89
  fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
90
90
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
91
91
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
92
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
92
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
93
93
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
94
94
  fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
95
95
  fetchDepositAddress(code: string, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
package/js/src/bingx.js CHANGED
@@ -1135,7 +1135,27 @@ export default class bingx extends Exchange {
1135
1135
  // "s": "BTC-USDT"
1136
1136
  // }
1137
1137
  //
1138
- let time = this.safeIntegerN(trade, ['time', 'filledTm', 'T']);
1138
+ // inverse swap fetchMyTrades
1139
+ //
1140
+ // {
1141
+ // "orderId": "1817441228670648320",
1142
+ // "symbol": "SOL-USD",
1143
+ // "type": "MARKET",
1144
+ // "side": "BUY",
1145
+ // "positionSide": "LONG",
1146
+ // "tradeId": "97244554",
1147
+ // "volume": "2",
1148
+ // "tradePrice": "182.652",
1149
+ // "amount": "20.00000000",
1150
+ // "realizedPnl": "0.00000000",
1151
+ // "commission": "-0.00005475",
1152
+ // "currency": "SOL",
1153
+ // "buyer": true,
1154
+ // "maker": false,
1155
+ // "tradeTime": 1722146730000
1156
+ // }
1157
+ //
1158
+ let time = this.safeIntegerN(trade, ['time', 'filledTm', 'T', 'tradeTime']);
1139
1159
  const datetimeId = this.safeString(trade, 'filledTm');
1140
1160
  if (datetimeId !== undefined) {
1141
1161
  time = this.parse8601(datetimeId);
@@ -1148,8 +1168,8 @@ export default class bingx extends Exchange {
1148
1168
  const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
1149
1169
  const currencyCode = this.safeCurrencyCode(currencyId);
1150
1170
  const m = this.safeBool(trade, 'm');
1151
- const marketId = this.safeString(trade, 's');
1152
- const isBuyerMaker = this.safeBool2(trade, 'buyerMaker', 'isBuyerMaker');
1171
+ const marketId = this.safeString2(trade, 's', 'symbol');
1172
+ const isBuyerMaker = this.safeBoolN(trade, ['buyerMaker', 'isBuyerMaker', 'maker']);
1153
1173
  let takeOrMaker = undefined;
1154
1174
  if ((isBuyerMaker !== undefined) || (m !== undefined)) {
1155
1175
  takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
@@ -1186,7 +1206,7 @@ export default class bingx extends Exchange {
1186
1206
  'type': this.safeStringLower(trade, 'o'),
1187
1207
  'side': this.parseOrderSide(side),
1188
1208
  'takerOrMaker': takeOrMaker,
1189
- 'price': this.safeString2(trade, 'price', 'p'),
1209
+ 'price': this.safeStringN(trade, ['price', 'p', 'tradePrice']),
1190
1210
  'amount': amount,
1191
1211
  'cost': cost,
1192
1212
  'fee': {
@@ -4899,14 +4919,16 @@ export default class bingx extends Exchange {
4899
4919
  * @method
4900
4920
  * @name bingx#fetchMyTrades
4901
4921
  * @description fetch all trades made by the user
4902
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
4903
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
4922
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20transaction%20details
4923
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20orders
4924
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order%20Trade%20Detail
4904
4925
  * @param {string} [symbol] unified market symbol
4905
4926
  * @param {int} [since] the earliest time in ms to fetch trades for
4906
4927
  * @param {int} [limit] the maximum number of trades structures to retrieve
4907
4928
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4908
4929
  * @param {int} [params.until] timestamp in ms for the ending date filter, default is undefined
4909
4930
  * @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
4931
+ * @param {string} params.orderId the order id required for inverse swap
4910
4932
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
4911
4933
  */
4912
4934
  if (symbol === undefined) {
@@ -4914,84 +4936,121 @@ export default class bingx extends Exchange {
4914
4936
  }
4915
4937
  await this.loadMarkets();
4916
4938
  const market = this.market(symbol);
4917
- const now = this.milliseconds();
4918
- let response = undefined;
4919
- const request = {
4920
- 'symbol': market['id'],
4921
- };
4922
- if (since !== undefined) {
4923
- const startTimeReq = market['spot'] ? 'startTime' : 'startTs';
4924
- request[startTimeReq] = since;
4925
- }
4926
- else if (market['swap']) {
4927
- request['startTs'] = now - 7776000000; // 90 days
4928
- }
4929
- const until = this.safeInteger(params, 'until');
4930
- params = this.omit(params, 'until');
4931
- if (until !== undefined) {
4932
- const endTimeReq = market['spot'] ? 'endTime' : 'endTs';
4933
- request[endTimeReq] = until;
4934
- }
4935
- else if (market['swap']) {
4936
- request['endTs'] = now;
4937
- }
4939
+ const request = {};
4938
4940
  let fills = undefined;
4939
- if (market['spot']) {
4940
- response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
4941
- const data = this.safeDict(response, 'data', {});
4942
- fills = this.safeList(data, 'fills', []);
4941
+ let response = undefined;
4942
+ let subType = undefined;
4943
+ [subType, params] = this.handleSubTypeAndParams('fetchMyTrades', market, params);
4944
+ if (subType === 'inverse') {
4945
+ const orderId = this.safeString(params, 'orderId');
4946
+ if (orderId === undefined) {
4947
+ throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires an orderId argument for inverse swap trades');
4948
+ }
4949
+ response = await this.cswapV1PrivateGetTradeAllFillOrders(this.extend(request, params));
4950
+ fills = this.safeList(response, 'data', []);
4943
4951
  //
4944
4952
  // {
4945
4953
  // "code": 0,
4946
4954
  // "msg": "",
4947
- // "debugMsg": "",
4948
- // "data": {
4949
- // "fills": [
4950
- // {
4951
- // "symbol": "LTC-USDT",
4952
- // "id": 36237072,
4953
- // "orderId": 1674069326895775744,
4954
- // "price": "85.891",
4955
- // "qty": "0.0582",
4956
- // "quoteQty": "4.9988562000000005",
4957
- // "commission": -0.00005820000000000001,
4958
- // "commissionAsset": "LTC",
4959
- // "time": 1687964205000,
4960
- // "isBuyer": true,
4961
- // "isMaker": false
4962
- // }
4963
- // ]
4964
- // }
4955
+ // "timestamp": 1722147756019,
4956
+ // "data": [
4957
+ // {
4958
+ // "orderId": "1817441228670648320",
4959
+ // "symbol": "SOL-USD",
4960
+ // "type": "MARKET",
4961
+ // "side": "BUY",
4962
+ // "positionSide": "LONG",
4963
+ // "tradeId": "97244554",
4964
+ // "volume": "2",
4965
+ // "tradePrice": "182.652",
4966
+ // "amount": "20.00000000",
4967
+ // "realizedPnl": "0.00000000",
4968
+ // "commission": "-0.00005475",
4969
+ // "currency": "SOL",
4970
+ // "buyer": true,
4971
+ // "maker": false,
4972
+ // "tradeTime": 1722146730000
4973
+ // }
4974
+ // ]
4965
4975
  // }
4966
4976
  //
4967
4977
  }
4968
4978
  else {
4969
- const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
4970
- params = this.omit(params, 'tradingUnit');
4971
- request['tradingUnit'] = tradingUnit;
4972
- response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
4973
- const data = this.safeDict(response, 'data', {});
4974
- fills = this.safeList(data, 'fill_orders', []);
4975
- //
4976
- // {
4977
- // "code": "0",
4978
- // "msg": '',
4979
- // "data": { fill_orders: [
4980
- // {
4981
- // "volume": "0.1",
4982
- // "price": "106.75",
4983
- // "amount": "10.6750",
4984
- // "commission": "-0.0053",
4985
- // "currency": "USDT",
4986
- // "orderId": "1676213270274379776",
4987
- // "liquidatedPrice": "0.00",
4988
- // "liquidatedMarginRatio": "0.00",
4989
- // "filledTime": "2023-07-04T20:56:01.000+0800"
4990
- // }
4991
- // ]
4992
- // }
4993
- // }
4994
- //
4979
+ request['symbol'] = market['id'];
4980
+ const now = this.milliseconds();
4981
+ if (since !== undefined) {
4982
+ const startTimeReq = market['spot'] ? 'startTime' : 'startTs';
4983
+ request[startTimeReq] = since;
4984
+ }
4985
+ else if (market['swap']) {
4986
+ request['startTs'] = now - 7776000000; // 90 days
4987
+ }
4988
+ const until = this.safeInteger(params, 'until');
4989
+ params = this.omit(params, 'until');
4990
+ if (until !== undefined) {
4991
+ const endTimeReq = market['spot'] ? 'endTime' : 'endTs';
4992
+ request[endTimeReq] = until;
4993
+ }
4994
+ else if (market['swap']) {
4995
+ request['endTs'] = now;
4996
+ }
4997
+ if (market['spot']) {
4998
+ response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
4999
+ const data = this.safeDict(response, 'data', {});
5000
+ fills = this.safeList(data, 'fills', []);
5001
+ //
5002
+ // {
5003
+ // "code": 0,
5004
+ // "msg": "",
5005
+ // "debugMsg": "",
5006
+ // "data": {
5007
+ // "fills": [
5008
+ // {
5009
+ // "symbol": "LTC-USDT",
5010
+ // "id": 36237072,
5011
+ // "orderId": 1674069326895775744,
5012
+ // "price": "85.891",
5013
+ // "qty": "0.0582",
5014
+ // "quoteQty": "4.9988562000000005",
5015
+ // "commission": -0.00005820000000000001,
5016
+ // "commissionAsset": "LTC",
5017
+ // "time": 1687964205000,
5018
+ // "isBuyer": true,
5019
+ // "isMaker": false
5020
+ // }
5021
+ // ]
5022
+ // }
5023
+ // }
5024
+ //
5025
+ }
5026
+ else {
5027
+ const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
5028
+ params = this.omit(params, 'tradingUnit');
5029
+ request['tradingUnit'] = tradingUnit;
5030
+ response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
5031
+ const data = this.safeDict(response, 'data', {});
5032
+ fills = this.safeList(data, 'fill_orders', []);
5033
+ //
5034
+ // {
5035
+ // "code": "0",
5036
+ // "msg": '',
5037
+ // "data": { fill_orders: [
5038
+ // {
5039
+ // "volume": "0.1",
5040
+ // "price": "106.75",
5041
+ // "amount": "10.6750",
5042
+ // "commission": "-0.0053",
5043
+ // "currency": "USDT",
5044
+ // "orderId": "1676213270274379776",
5045
+ // "liquidatedPrice": "0.00",
5046
+ // "liquidatedMarginRatio": "0.00",
5047
+ // "filledTime": "2023-07-04T20:56:01.000+0800"
5048
+ // }
5049
+ // ]
5050
+ // }
5051
+ // }
5052
+ //
5053
+ }
4995
5054
  }
4996
5055
  return this.parseTrades(fills, market, since, limit, params);
4997
5056
  }
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitget.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Liquidation, TransferEntry, Leverage, MarginMode, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRate, Dict, TransferEntries, LeverageTier, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Liquidation, TransferEntry, Leverage, MarginMode, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRate, Dict, LeverageTier, int } from './base/types.js';
3
3
  /**
4
4
  * @class bitget
5
5
  * @augments Exchange
@@ -154,7 +154,7 @@ export default class bitget extends Exchange {
154
154
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
155
155
  fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
156
156
  parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
157
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
157
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
158
158
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
159
159
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
160
160
  parseTransferStatus(status: Str): Str;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitmart.js';
2
- import type { Int, OrderSide, Balances, OrderType, OHLCV, Order, Str, Trade, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, TransferEntry, Num, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, Dict, TransferEntries, OrderRequest, int } from './base/types.js';
2
+ import type { Int, OrderSide, Balances, OrderType, OHLCV, Order, Str, Trade, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, TransferEntry, Num, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, Dict, OrderRequest, int } from './base/types.js';
3
3
  /**
4
4
  * @class bitmart
5
5
  * @augments Exchange
@@ -109,7 +109,7 @@ export default class bitmart extends Exchange {
109
109
  parseTransferToAccount(type: any): string;
110
110
  parseTransferFromAccount(type: any): string;
111
111
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
112
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
112
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
113
113
  fetchBorrowInterest(code?: Str, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
114
114
  parseBorrowInterest(info: Dict, market?: Market): {
115
115
  symbol: string;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitrue.js';
2
- import type { Balances, Currencies, Currency, Dict, Int, MarginModification, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntries, TransferEntry, int } from './base/types.js';
2
+ import type { Balances, Currencies, Currency, Dict, Int, MarginModification, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, int } from './base/types.js';
3
3
  /**
4
4
  * @class bitrue
5
5
  * @augments Exchange
@@ -59,7 +59,7 @@ export default class bitrue extends Exchange {
59
59
  toAccount: any;
60
60
  status: string;
61
61
  };
62
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
62
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
63
63
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
64
64
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
65
65
  parseMarginModification(data: any, market?: any): MarginModification;
package/js/src/btcbox.js CHANGED
@@ -10,6 +10,7 @@ import { ExchangeError, InsufficientFunds, InvalidOrder, AuthenticationError, Pe
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { TICK_SIZE } from './base/functions/number.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
+ import { md5 } from './static_dependencies/noble-hashes/md5.js';
13
14
  // ---------------------------------------------------------------------------
14
15
  /**
15
16
  * @class btcbox
@@ -679,7 +680,7 @@ export default class btcbox extends Exchange {
679
680
  'nonce': nonce,
680
681
  }, params);
681
682
  const request = this.urlencode(query);
682
- const secret = this.hash(this.encode(this.secret), sha256);
683
+ const secret = this.hash(this.encode(this.secret), md5);
683
684
  query['signature'] = this.hmac(this.encode(request), this.encode(secret), sha256);
684
685
  body = this.urlencode(query);
685
686
  headers = {
package/js/src/bybit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bybit.js';
2
- import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, TransferEntries, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
3
3
  /**
4
4
  * @class bybit
5
5
  * @augments Exchange
@@ -161,7 +161,7 @@ export default class bybit extends Exchange {
161
161
  info: Dict;
162
162
  };
163
163
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
164
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
164
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
165
165
  borrowCrossMargin(code: string, amount: number, params?: {}): Promise<any>;
166
166
  repayCrossMargin(code: string, amount: any, params?: {}): Promise<any>;
167
167
  parseMarginLoan(info: any, currency?: Currency): {
@@ -36,6 +36,17 @@ export default class coinbaseinternational extends Exchange {
36
36
  previousFundingTimestamp: any;
37
37
  previousFundingDatetime: any;
38
38
  };
39
+ fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;
40
+ parseIncome(income: any, market?: Market): {
41
+ info: any;
42
+ symbol: string;
43
+ code: string;
44
+ timestamp: number;
45
+ datetime: string;
46
+ id: string;
47
+ amount: number;
48
+ rate: any;
49
+ };
39
50
  createDepositAddress(code: string, params?: {}): Promise<{
40
51
  currency: string;
41
52
  tag: string;
@@ -68,7 +68,7 @@ export default class coinbaseinternational extends Exchange {
68
68
  'fetchCrossBorrowRates': false,
69
69
  'fetchCurrencies': true,
70
70
  'fetchDeposits': true,
71
- 'fetchFundingHistory': false,
71
+ 'fetchFundingHistory': true,
72
72
  'fetchFundingRate': false,
73
73
  'fetchFundingRateHistory': true,
74
74
  'fetchFundingRates': false,
@@ -442,6 +442,84 @@ export default class coinbaseinternational extends Exchange {
442
442
  'previousFundingDatetime': undefined,
443
443
  };
444
444
  }
445
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
446
+ /**
447
+ * @method
448
+ * @name coinbaseinternational#fetchFundingHistory
449
+ * @description fetch the history of funding payments paid and received on this account
450
+ * @see https://docs.cdp.coinbase.com/intx/reference/gettransfers
451
+ * @param {string} [symbol] unified market symbol
452
+ * @param {int} [since] the earliest time in ms to fetch funding history for
453
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
454
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
455
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
456
+ */
457
+ await this.loadMarkets();
458
+ const request = {
459
+ 'type': 'FUNDING',
460
+ };
461
+ let market = undefined;
462
+ if (symbol !== undefined) {
463
+ market = this.market(symbol);
464
+ }
465
+ let portfolios = undefined;
466
+ [portfolios, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'portfolios');
467
+ if (portfolios !== undefined) {
468
+ request['portfolios'] = portfolios;
469
+ }
470
+ if (since !== undefined) {
471
+ request['time_from'] = this.iso8601(since);
472
+ }
473
+ if (limit !== undefined) {
474
+ request['result_limit'] = limit;
475
+ }
476
+ else {
477
+ request['result_limit'] = 100;
478
+ }
479
+ const response = await this.v1PrivateGetTransfers(this.extend(request, params));
480
+ const fundings = this.safeList(response, 'results', []);
481
+ return this.parseIncomes(fundings, market, since, limit);
482
+ }
483
+ parseIncome(income, market = undefined) {
484
+ //
485
+ // {
486
+ // "amount":"0.0008",
487
+ // "asset":"USDC",
488
+ // "created_at":"2024-02-22T16:00:00Z",
489
+ // "from_portfolio":{
490
+ // "id":"13yuk1fs-1-0",
491
+ // "name":"Eng Test Portfolio - 2",
492
+ // "uuid":"018712f2-5ff9-7de3-9010-xxxxxxxxx"
493
+ // },
494
+ // "instrument_id":"149264164756389888",
495
+ // "instrument_symbol":"ETH-PERP",
496
+ // "position_id":"1xy4v51m-1-2",
497
+ // "status":"PROCESSED",
498
+ // "to_portfolio":{
499
+ // "name":"CB_FUND"
500
+ // },
501
+ // "transfer_type":"FUNDING",
502
+ // "transfer_uuid":"a6b708df-2c44-32c5-bb98-xxxxxxxxxx",
503
+ // "updated_at":"2024-02-22T16:00:00Z"
504
+ // }
505
+ //
506
+ const marketId = this.safeString(income, 'symbol');
507
+ market = this.safeMarket(marketId, market, undefined, 'contract');
508
+ const datetime = this.safeInteger(income, 'created_at');
509
+ const timestamp = this.parse8601(datetime);
510
+ const currencyId = this.safeString(income, 'asset');
511
+ const code = this.safeCurrencyCode(currencyId);
512
+ return {
513
+ 'info': income,
514
+ 'symbol': market['symbol'],
515
+ 'code': code,
516
+ 'timestamp': timestamp,
517
+ 'datetime': this.iso8601(timestamp),
518
+ 'id': this.safeString(income, 'transfer_uuid'),
519
+ 'amount': this.safeNumber(income, 'amount'),
520
+ 'rate': undefined,
521
+ };
522
+ }
445
523
  async createDepositAddress(code, params = {}) {
446
524
  /**
447
525
  * @method
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinex.js';
2
- import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, TransferEntries, LeverageTiers, LeverageTier, int } from './base/types.js';
2
+ import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, IsolatedBorrowRate, Dict, LeverageTiers, LeverageTier, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinex
5
5
  * @augments Exchange
@@ -123,7 +123,7 @@ export default class coinex extends Exchange {
123
123
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
124
124
  parseTransferStatus(status: any): string;
125
125
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
126
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
126
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
127
127
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
128
128
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
129
129
  parseIsolatedBorrowRate(info: Dict, market?: Market): IsolatedBorrowRate;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinlist.js';
2
- import type { Account, Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntries, TransferEntry, int } from './base/types.js';
2
+ import type { Account, Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, int } from './base/types.js';
3
3
  /**
4
4
  * @class coinlist
5
5
  * @augments Exchange
@@ -49,7 +49,7 @@ export default class coinlist extends Exchange {
49
49
  parseOrderStatus(status: Str): string;
50
50
  parseOrderType(status: any): string;
51
51
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
52
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
52
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
53
53
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
54
54
  parseTransferStatus(status: Str): Str;
55
55
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/deribit.js';
2
- import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account, Option, OptionChain, Currencies, TradingFees, Dict, TransferEntries, int } from './base/types.js';
2
+ import type { Balances, Currency, FundingRateHistory, Greeks, Int, Liquidation, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, MarketInterface, Num, Account, Option, OptionChain, Currencies, TradingFees, Dict, int } from './base/types.js';
3
3
  /**
4
4
  * @class deribit
5
5
  * @augments Exchange
@@ -71,7 +71,7 @@ export default class deribit extends Exchange {
71
71
  fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
72
72
  fetchVolatilityHistory(code: string, params?: {}): Promise<any[]>;
73
73
  parseVolatilityHistory(volatility: any): any[];
74
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
74
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
75
75
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
76
76
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
77
77
  parseTransferStatus(status: Str): Str;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/digifinex.js';
2
- import type { FundingRateHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Trade, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, TransferEntry, Num, MarginModification, TradingFeeInterface, Currencies, CrossBorrowRate, CrossBorrowRates, Dict, TransferEntries, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { FundingRateHistory, Int, OHLCV, Order, OrderSide, OrderType, OrderRequest, Trade, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, TransferEntry, Num, MarginModification, TradingFeeInterface, Currencies, CrossBorrowRate, CrossBorrowRates, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
3
3
  /**
4
4
  * @class digifinex
5
5
  * @augments Exchange
@@ -127,7 +127,7 @@ export default class digifinex extends Exchange {
127
127
  fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
128
128
  parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
129
129
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
130
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
130
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
131
131
  fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<LeverageTiers>;
132
132
  fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<LeverageTier[]>;
133
133
  parseMarketLeverageTiers(info: any, market?: Market): LeverageTier[];
@@ -832,9 +832,6 @@ export default class hyperliquid extends Exchange {
832
832
  if (since === undefined) {
833
833
  since = 0;
834
834
  }
835
- if (limit === undefined) {
836
- limit = 500;
837
- }
838
835
  params = this.omit(params, ['until']);
839
836
  const request = {
840
837
  'type': 'candleSnapshot',
package/js/src/kucoin.js CHANGED
@@ -1524,21 +1524,28 @@ export default class kucoin extends Exchange {
1524
1524
  },
1525
1525
  'networks': {},
1526
1526
  };
1527
- const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled');
1527
+ const isWithdrawEnabled = this.safeBool(fee, 'isWithdrawEnabled', true);
1528
+ let minFee = undefined;
1528
1529
  if (isWithdrawEnabled) {
1529
- result['withdraw']['fee'] = this.safeNumber2(fee, 'withdrawalMinFee', 'withdrawMinFee');
1530
1530
  result['withdraw']['percentage'] = false;
1531
- const networkId = this.safeString(fee, 'chain');
1532
- if (networkId) {
1531
+ const chains = this.safeList(fee, 'chains', []);
1532
+ for (let i = 0; i < chains.length; i++) {
1533
+ const chain = chains[i];
1534
+ const networkId = this.safeString(chain, 'chainId');
1533
1535
  const networkCode = this.networkIdToCode(networkId, this.safeString(currency, 'code'));
1536
+ const withdrawFee = this.safeString(chain, 'withdrawalMinFee');
1537
+ if (minFee === undefined || (Precise.stringLt(withdrawFee, minFee))) {
1538
+ minFee = withdrawFee;
1539
+ }
1534
1540
  result['networks'][networkCode] = {
1535
- 'withdraw': result['withdraw'],
1541
+ 'withdraw': this.parseNumber(withdrawFee),
1536
1542
  'deposit': {
1537
1543
  'fee': undefined,
1538
1544
  'percentage': undefined,
1539
1545
  },
1540
1546
  };
1541
1547
  }
1548
+ result['withdraw']['fee'] = this.parseNumber(minFee);
1542
1549
  }
1543
1550
  return result;
1544
1551
  }