ccxt 4.3.68 → 4.3.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 (76) hide show
  1. package/README.md +6 -6
  2. package/dist/ccxt.browser.min.js +5 -5
  3. package/dist/cjs/ccxt.js +3 -1
  4. package/dist/cjs/src/ascendex.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +365 -353
  6. package/dist/cjs/src/binance.js +1 -1
  7. package/dist/cjs/src/bingx.js +134 -75
  8. package/dist/cjs/src/blofin.js +63 -6
  9. package/dist/cjs/src/btcbox.js +2 -1
  10. package/dist/cjs/src/bybit.js +1 -1
  11. package/dist/cjs/src/coinbaseinternational.js +247 -3
  12. package/dist/cjs/src/cryptocom.js +9 -1
  13. package/dist/cjs/src/hitbtc.js +1 -1
  14. package/dist/cjs/src/hyperliquid.js +0 -3
  15. package/dist/cjs/src/kucoin.js +12 -5
  16. package/dist/cjs/src/oxfun.js +2 -2
  17. package/dist/cjs/src/poloniex.js +34 -33
  18. package/dist/cjs/src/poloniexfutures.js +26 -26
  19. package/dist/cjs/src/pro/blofin.js +665 -0
  20. package/dist/cjs/src/pro/coinbaseinternational.js +154 -9
  21. package/dist/cjs/src/pro/cryptocom.js +3 -1
  22. package/dist/cjs/src/pro/hitbtc.js +26 -8
  23. package/dist/cjs/src/pro/okx.js +7 -0
  24. package/dist/cjs/src/pro/poloniex.js +50 -25
  25. package/dist/cjs/src/pro/poloniexfutures.js +5 -5
  26. package/dist/cjs/src/pro/woo.js +5 -4
  27. package/js/ccxt.d.ts +6 -3
  28. package/js/ccxt.js +3 -1
  29. package/js/src/abstract/coinbaseinternational.d.ts +1 -1
  30. package/js/src/ascendex.js +1 -1
  31. package/js/src/base/Exchange.d.ts +108 -82
  32. package/js/src/base/Exchange.js +365 -353
  33. package/js/src/base/types.d.ts +0 -2
  34. package/js/src/binance.d.ts +2 -2
  35. package/js/src/binance.js +1 -1
  36. package/js/src/bingx.d.ts +2 -2
  37. package/js/src/bingx.js +134 -75
  38. package/js/src/bitget.d.ts +2 -2
  39. package/js/src/bitmart.d.ts +2 -2
  40. package/js/src/bitrue.d.ts +2 -2
  41. package/js/src/blofin.d.ts +1 -1
  42. package/js/src/blofin.js +63 -6
  43. package/js/src/btcbox.js +2 -1
  44. package/js/src/bybit.d.ts +2 -2
  45. package/js/src/bybit.js +1 -1
  46. package/js/src/coinbaseinternational.d.ts +17 -1
  47. package/js/src/coinbaseinternational.js +247 -3
  48. package/js/src/coinex.d.ts +2 -2
  49. package/js/src/coinlist.d.ts +2 -2
  50. package/js/src/cryptocom.js +10 -2
  51. package/js/src/deribit.d.ts +2 -2
  52. package/js/src/digifinex.d.ts +2 -2
  53. package/js/src/hitbtc.js +1 -1
  54. package/js/src/hyperliquid.js +0 -3
  55. package/js/src/kucoin.js +12 -5
  56. package/js/src/latoken.d.ts +2 -2
  57. package/js/src/mexc.d.ts +2 -2
  58. package/js/src/okx.d.ts +2 -2
  59. package/js/src/oxfun.d.ts +1 -1
  60. package/js/src/oxfun.js +2 -2
  61. package/js/src/phemex.d.ts +2 -2
  62. package/js/src/poloniex.js +34 -33
  63. package/js/src/poloniexfutures.js +26 -26
  64. package/js/src/pro/blofin.d.ts +39 -0
  65. package/js/src/pro/blofin.js +668 -0
  66. package/js/src/pro/coinbaseinternational.d.ts +5 -1
  67. package/js/src/pro/coinbaseinternational.js +155 -10
  68. package/js/src/pro/cryptocom.js +4 -2
  69. package/js/src/pro/hitbtc.d.ts +1 -1
  70. package/js/src/pro/hitbtc.js +26 -8
  71. package/js/src/pro/okx.js +7 -0
  72. package/js/src/pro/poloniex.js +50 -25
  73. package/js/src/pro/poloniexfutures.js +5 -5
  74. package/js/src/pro/woo.js +5 -4
  75. package/js/src/woo.d.ts +2 -2
  76. 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/binance.js CHANGED
@@ -12639,7 +12639,7 @@ export default class binance extends Exchange {
12639
12639
  async fetchMarginModes(symbols = undefined, params = {}) {
12640
12640
  /**
12641
12641
  * @method
12642
- * @name binance#fetchMarginMode
12642
+ * @name binance#fetchMarginModes
12643
12643
  * @description fetches margin modes ("isolated" or "cross") that the market for the symbol in in, with symbol=undefined all markets for a subType (linear/inverse) are returned
12644
12644
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
12645
12645
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
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;
@@ -56,7 +56,7 @@ export default class blofin extends Exchange {
56
56
  previousFundingDatetime: any;
57
57
  }>;
58
58
  parseBalanceByType(type: any, response: any): Balances;
59
- parseTradingBalance(response: any): Balances;
59
+ parseBalance(response: any): Balances;
60
60
  parseFundingBalance(response: any): Balances;
61
61
  parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
62
62
  fetchBalance(params?: {}): Promise<Balances>;
package/js/src/blofin.js CHANGED
@@ -23,6 +23,7 @@ export default class blofin extends Exchange {
23
23
  'countries': ['US'],
24
24
  'version': 'v1',
25
25
  'rateLimit': 100,
26
+ 'pro': true,
26
27
  'has': {
27
28
  'CORS': undefined,
28
29
  'spot': false,
@@ -97,7 +98,7 @@ export default class blofin extends Exchange {
97
98
  'fetchOpenInterestHistory': false,
98
99
  'fetchOpenOrder': undefined,
99
100
  'fetchOpenOrders': true,
100
- 'fetchOrder': true,
101
+ 'fetchOrder': undefined,
101
102
  'fetchOrderBook': true,
102
103
  'fetchOrderBooks': false,
103
104
  'fetchOrders': false,
@@ -147,11 +148,12 @@ export default class blofin extends Exchange {
147
148
  '2h': '2H',
148
149
  '4h': '4H',
149
150
  '6h': '6H',
151
+ '8h': '8H',
150
152
  '12h': '12H',
151
153
  '1d': '1D',
154
+ '3d': '3D',
152
155
  '1w': '1W',
153
156
  '1M': '1M',
154
- '3M': '3M',
155
157
  },
156
158
  'hostname': 'www.blofin.com',
157
159
  'urls': {
@@ -492,6 +494,25 @@ export default class blofin extends Exchange {
492
494
  return this.parseOrderBook(first, symbol, timestamp);
493
495
  }
494
496
  parseTicker(ticker, market = undefined) {
497
+ //
498
+ // response similar for REST & WS
499
+ //
500
+ // {
501
+ // instId: "ADA-USDT",
502
+ // ts: "1707736811486",
503
+ // last: "0.5315",
504
+ // lastSize: "4",
505
+ // askPrice: "0.5318",
506
+ // askSize: "248",
507
+ // bidPrice: "0.5315",
508
+ // bidSize: "63",
509
+ // open24h: "0.5555",
510
+ // high24h: "0.5563",
511
+ // low24h: "0.5315",
512
+ // volCurrency24h: "198560100",
513
+ // vol24h: "1985601",
514
+ // }
515
+ //
495
516
  const timestamp = this.safeInteger(ticker, 'ts');
496
517
  const marketId = this.safeString(ticker, 'instId');
497
518
  market = this.safeMarket(marketId, market, '-');
@@ -564,7 +585,8 @@ export default class blofin extends Exchange {
564
585
  }
565
586
  parseTrade(trade, market = undefined) {
566
587
  //
567
- // fetch trades
588
+ // fetch trades (response similar for REST & WS)
589
+ //
568
590
  // {
569
591
  // "tradeId": "3263934920",
570
592
  // "instId": "LTC-USDT",
@@ -573,6 +595,7 @@ export default class blofin extends Exchange {
573
595
  // "side": "buy",
574
596
  // "ts": "1707232020854"
575
597
  // }
598
+ //
576
599
  // my trades
577
600
  // {
578
601
  // "instId": "LTC-USDT",
@@ -851,10 +874,12 @@ export default class blofin extends Exchange {
851
874
  return this.parseFundingBalance(response);
852
875
  }
853
876
  else {
854
- return this.parseTradingBalance(response);
877
+ return this.parseBalance(response);
855
878
  }
856
879
  }
857
- parseTradingBalance(response) {
880
+ parseBalance(response) {
881
+ //
882
+ // "data" similar for REST & WS
858
883
  //
859
884
  // {
860
885
  // "code": "0",
@@ -876,7 +901,8 @@ export default class blofin extends Exchange {
876
901
  // "orderFrozen": "14920.994472632597427761",
877
902
  // "equityUsd": "10011254.077985990315787910",
878
903
  // "isolatedUnrealizedPnl": "-22.151999999999999999952",
879
- // "bonus": "0"
904
+ // "bonus": "0" // present only in REST
905
+ // "unrealizedPnl": "0" // present only in WS
880
906
  // }
881
907
  // ]
882
908
  // }
@@ -1038,6 +1064,8 @@ export default class blofin extends Exchange {
1038
1064
  return this.safeString(statuses, status, status);
1039
1065
  }
1040
1066
  parseOrder(order, market = undefined) {
1067
+ //
1068
+ // response similar for REST & WS
1041
1069
  //
1042
1070
  // {
1043
1071
  // "orderId": "2075628533",
@@ -1066,6 +1094,9 @@ export default class blofin extends Exchange {
1066
1094
  // "cancelSource": "not_canceled",
1067
1095
  // "cancelSourceReason": null,
1068
1096
  // "brokerId": "ec6dd3a7dd982d0b"
1097
+ // "filled_amount": "1.000000000000000000", // filledAmount in "ws" watchOrders
1098
+ // "cancelSource": "", // only in WS
1099
+ // "instType": "SWAP", // only in WS
1069
1100
  // }
1070
1101
  //
1071
1102
  const id = this.safeString2(order, 'tpslId', 'orderId');
@@ -1815,6 +1846,32 @@ export default class blofin extends Exchange {
1815
1846
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
1816
1847
  }
1817
1848
  parsePosition(position, market = undefined) {
1849
+ //
1850
+ // response similar for REST & WS
1851
+ //
1852
+ // {
1853
+ // instType: 'SWAP',
1854
+ // instId: 'LTC-USDT',
1855
+ // marginMode: 'cross',
1856
+ // positionId: '644159',
1857
+ // positionSide: 'net',
1858
+ // positions: '1',
1859
+ // availablePositions: '1',
1860
+ // averagePrice: '68.16',
1861
+ // unrealizedPnl: '0.80631223',
1862
+ // unrealizedPnlRatio: '0.03548909463028169',
1863
+ // leverage: '3',
1864
+ // liquidationPrice: '10.116655172370356435',
1865
+ // markPrice: '68.96',
1866
+ // initialMargin: '22.988770743333333333',
1867
+ // margin: '', // this field might not exist in rest response
1868
+ // marginRatio: '152.523509620342499273',
1869
+ // maintenanceMargin: '0.34483156115',
1870
+ // adl: '4',
1871
+ // createTime: '1707235776528',
1872
+ // updateTime: '1707235776528'
1873
+ // }
1874
+ //
1818
1875
  const marketId = this.safeString(position, 'instId');
1819
1876
  market = this.safeMarket(marketId, market);
1820
1877
  const symbol = market['symbol'];
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): {
package/js/src/bybit.js CHANGED
@@ -8205,7 +8205,7 @@ export default class bybit extends Exchange {
8205
8205
  const quoteValueString = Precise.stringMul(baseValueString, priceString);
8206
8206
  return this.safeLiquidation({
8207
8207
  'info': liquidation,
8208
- 'symbol': this.safeSymbol(marketId, market),
8208
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
8209
8209
  'contracts': this.parseNumber(contractsString),
8210
8210
  'contractSize': this.parseNumber(contractSizeString),
8211
8211
  'price': this.parseNumber(priceString),
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinbaseinternational.js';
2
- import type { Int, OrderSide, OrderType, Order, Trade, Ticker, Str, Transaction, Balances, Tickers, Strings, Market, Currency, TransferEntry, Position, FundingRateHistory, Currencies, Dict, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Order, Trade, Ticker, Str, Transaction, Balances, Tickers, Strings, Market, Currency, TransferEntry, Position, FundingRateHistory, Currencies, Dict, int, OHLCV } from './base/types.js';
3
3
  /**
4
4
  * @class coinbaseinternational
5
5
  * @augments Exchange
@@ -15,6 +15,8 @@ export default class coinbaseinternational extends Exchange {
15
15
  code: any;
16
16
  info: any;
17
17
  };
18
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
19
+ parseOHLCV(ohlcv: any, market?: Market): OHLCV;
18
20
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
19
21
  parseFundingRateHistory(info: any, market?: Market): FundingRateHistory;
20
22
  parseFundingRate(contract: any, market?: Market): {
@@ -36,6 +38,20 @@ export default class coinbaseinternational extends Exchange {
36
38
  previousFundingTimestamp: any;
37
39
  previousFundingDatetime: any;
38
40
  };
41
+ fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;
42
+ parseIncome(income: any, market?: Market): {
43
+ info: any;
44
+ symbol: string;
45
+ code: string;
46
+ timestamp: number;
47
+ datetime: string;
48
+ id: string;
49
+ amount: number;
50
+ rate: any;
51
+ };
52
+ fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
53
+ parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
54
+ parseTransferStatus(status: Str): Str;
39
55
  createDepositAddress(code: string, params?: {}): Promise<{
40
56
  currency: string;
41
57
  tag: string;