ccxt 4.2.78 → 4.2.79

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 (50) hide show
  1. package/README.md +5 -5
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +241 -52
  4. package/dist/ccxt.browser.min.js +2 -2
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/bingx.js +39 -5
  7. package/dist/cjs/src/bitstamp.js +21 -26
  8. package/dist/cjs/src/bybit.js +101 -0
  9. package/dist/cjs/src/coinbaseinternational.js +2 -2
  10. package/dist/cjs/src/gate.js +3 -1
  11. package/dist/cjs/src/pro/alpaca.js +1 -1
  12. package/dist/cjs/src/pro/bitfinex2.js +1 -1
  13. package/dist/cjs/src/pro/bitget.js +1 -1
  14. package/dist/cjs/src/pro/bitmart.js +1 -1
  15. package/dist/cjs/src/pro/bitmex.js +1 -1
  16. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  17. package/dist/cjs/src/pro/bybit.js +16 -1
  18. package/dist/cjs/src/pro/cex.js +9 -5
  19. package/dist/cjs/src/pro/cryptocom.js +1 -1
  20. package/dist/cjs/src/pro/hitbtc.js +1 -1
  21. package/dist/cjs/src/pro/htx.js +1 -1
  22. package/dist/cjs/src/pro/okcoin.js +1 -1
  23. package/dist/cjs/src/pro/onetrading.js +1 -1
  24. package/dist/cjs/src/pro/woo.js +38 -0
  25. package/js/ccxt.d.ts +1 -1
  26. package/js/ccxt.js +1 -1
  27. package/js/src/abstract/bingx.d.ts +1 -0
  28. package/js/src/abstract/gate.d.ts +1 -0
  29. package/js/src/abstract/gateio.d.ts +1 -0
  30. package/js/src/bingx.js +39 -5
  31. package/js/src/bitstamp.js +21 -26
  32. package/js/src/bybit.d.ts +12 -1
  33. package/js/src/bybit.js +101 -0
  34. package/js/src/coinbaseinternational.js +2 -2
  35. package/js/src/gate.js +3 -1
  36. package/js/src/pro/alpaca.js +1 -1
  37. package/js/src/pro/bitfinex2.js +1 -1
  38. package/js/src/pro/bitget.js +1 -1
  39. package/js/src/pro/bitmart.js +1 -1
  40. package/js/src/pro/bitmex.js +1 -1
  41. package/js/src/pro/blockchaincom.js +1 -1
  42. package/js/src/pro/bybit.js +16 -1
  43. package/js/src/pro/cex.js +9 -5
  44. package/js/src/pro/cryptocom.js +1 -1
  45. package/js/src/pro/hitbtc.js +1 -1
  46. package/js/src/pro/htx.js +1 -1
  47. package/js/src/pro/okcoin.js +1 -1
  48. package/js/src/pro/onetrading.js +1 -1
  49. package/js/src/pro/woo.js +38 -0
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -42,7 +42,7 @@ Current feature list:
42
42
  | [![bitmart](https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with BitMart using CCXT's referral link for a 30% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d30%25&color=orange)](http://www.bitmart.com/?r=rQCFLh) |
43
43
  | [![bitmex](https://github.com/ccxt/ccxt/assets/43336371/cea9cfe5-c57e-4b84-b2ac-77b960b04445)](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.bitmex.com/app/apiOverview) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with BitMEX using CCXT's referral link for a 10% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d10%25&color=orange)](https://www.bitmex.com/app/register/NZTR1q) |
44
44
  | [![bybit](https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
45
- | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbaseinternational.com/intx/docs) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
45
+ | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
46
46
  | [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://viabtc.github.io/coinex_api_en_doc) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
47
47
  | [![cryptocom](https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg)](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with Crypto.com using CCXT's referral link for a 15% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d15%25&color=orange)](https://crypto.com/exch/kdacthrnxt) |
48
48
  | [![gate](https://user-images.githubusercontent.com/1294454/31784029-0313c702-b509-11e7-9ccc-bc0da6a0e435.jpg)](https://www.gate.io/signup/2436035) | gate | [Gate.io](https://www.gate.io/signup/2436035) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://www.gate.io/docs/developers/apiv4/en/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with Gate.io using CCXT's referral link for a 20% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d20%25&color=orange)](https://www.gate.io/signup/2436035) |
@@ -95,7 +95,7 @@ The CCXT library currently supports the following 97 cryptocurrency exchange mar
95
95
  | [![bybit](https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
96
96
  | [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://cex.io/cex-api) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
97
97
  | [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
98
- | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbaseinternational.com/intx/docs) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
98
+ | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
99
99
  | [![coinbasepro](https://user-images.githubusercontent.com/1294454/41764625-63b7ffde-760a-11e8-996d-a6328fa9347a.jpg)](https://pro.coinbase.com/) | coinbasepro | [Coinbase Pro](https://pro.coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.pro.coinbase.com) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
100
100
  | [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | | |
101
101
  | [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://viabtc.github.io/coinex_api_en_doc) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.78/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.2.78/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.79/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.2.79/dist/ccxt.browser.js
218
218
 
219
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.78/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.79/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
package/build.sh CHANGED
@@ -76,7 +76,7 @@ build_and_test_all () {
76
76
  # cd python
77
77
  # if ! tox run-parallel; then
78
78
  # exit 1
79
- # fi
79
+ # fi
80
80
  # cd ..
81
81
  # fi
82
82
  fi
@@ -31354,6 +31354,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31354
31354
  'post': {
31355
31355
  'trade/cancelReplace': 1,
31356
31356
  'positionSide/dual': 1,
31357
+ 'trade/closePosition': 1,
31357
31358
  },
31358
31359
  },
31359
31360
  },
@@ -33335,6 +33336,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
33335
33336
  'SELL': 'sell',
33336
33337
  'SHORT': 'sell',
33337
33338
  'LONG': 'buy',
33339
+ 'ask': 'sell',
33340
+ 'bid': 'buy',
33338
33341
  };
33339
33342
  return this.safeString(sides, side, side);
33340
33343
  }
@@ -35082,14 +35085,45 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
35082
35085
  * @param {string} symbol Unified CCXT market symbol
35083
35086
  * @param {string} [side] not used by bingx
35084
35087
  * @param {object} [params] extra parameters specific to the bingx api endpoint
35088
+ * @param {string|undefined} [params.positionId] it is recommended to fill in this parameter when closing a position
35085
35089
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
35086
35090
  */
35087
35091
  await this.loadMarkets();
35088
- const market = this.market(symbol);
35089
- const request = {
35090
- 'symbol': market['id'],
35091
- };
35092
- const response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
35092
+ const positionId = this.safeString(params, 'positionId');
35093
+ params = this.omit(params, 'positionId');
35094
+ let response = undefined;
35095
+ if (positionId !== undefined) {
35096
+ const request = {
35097
+ 'positionId': positionId,
35098
+ };
35099
+ response = await this.swapV1PrivatePostTradeClosePosition(this.extend(request, params));
35100
+ }
35101
+ else {
35102
+ const market = this.market(symbol);
35103
+ const request = {
35104
+ 'symbol': market['id'],
35105
+ };
35106
+ response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
35107
+ }
35108
+ //
35109
+ // swapV1PrivatePostTradeClosePosition
35110
+ //
35111
+ // {
35112
+ // "code": 0,
35113
+ // "msg": "",
35114
+ // "timestamp": 1710992264190,
35115
+ // "data": {
35116
+ // "orderId": 1770656007907930112,
35117
+ // "positionId": "1751667128353910784",
35118
+ // "symbol": "LTC-USDT",
35119
+ // "side": "Ask",
35120
+ // "type": "MARKET",
35121
+ // "positionSide": "Long",
35122
+ // "origQty": "0.2"
35123
+ // }
35124
+ // }
35125
+ //
35126
+ // swapV2PrivatePostTradeCloseAllPositions
35093
35127
  //
35094
35128
  // {
35095
35129
  // "code": 0,
@@ -70180,16 +70214,18 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70180
70214
  'timestamp': undefined,
70181
70215
  'datetime': undefined,
70182
70216
  };
70183
- const codes = Object.keys(this.currencies);
70184
- for (let i = 0; i < codes.length; i++) {
70185
- const code = codes[i];
70186
- const currency = this.currency(code);
70187
- const currencyId = currency['id'];
70217
+ if (response === undefined) {
70218
+ response = [];
70219
+ }
70220
+ for (let i = 0; i < response.length; i++) {
70221
+ const currencyBalance = response[i];
70222
+ const currencyId = this.safeString(currencyBalance, 'currency');
70223
+ const currencyCode = this.safeCurrencyCode(currencyId);
70188
70224
  const account = this.account();
70189
- account['free'] = this.safeString(response, currencyId + '_available');
70190
- account['used'] = this.safeString(response, currencyId + '_reserved');
70191
- account['total'] = this.safeString(response, currencyId + '_balance');
70192
- result[code] = account;
70225
+ account['free'] = this.safeString(currencyBalance, 'available');
70226
+ account['used'] = this.safeString(currencyBalance, 'reserved');
70227
+ account['total'] = this.safeString(currencyBalance, 'total');
70228
+ result[currencyCode] = account;
70193
70229
  }
70194
70230
  return this.safeBalance(result);
70195
70231
  }
@@ -70203,24 +70239,17 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
70203
70239
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
70204
70240
  */
70205
70241
  await this.loadMarkets();
70206
- const response = await this.privatePostBalance(params);
70242
+ const response = await this.privatePostAccountBalances(params);
70207
70243
  //
70208
- // {
70209
- // "aave_available": "0.00000000",
70210
- // "aave_balance": "0.00000000",
70211
- // "aave_reserved": "0.00000000",
70212
- // "aave_withdrawal_fee": "0.07000000",
70213
- // "aavebtc_fee": "0.000",
70214
- // "aaveeur_fee": "0.000",
70215
- // "aaveusd_fee": "0.000",
70216
- // "bat_available": "0.00000000",
70217
- // "bat_balance": "0.00000000",
70218
- // "bat_reserved": "0.00000000",
70219
- // "bat_withdrawal_fee": "5.00000000",
70220
- // "batbtc_fee": "0.000",
70221
- // "bateur_fee": "0.000",
70222
- // "batusd_fee": "0.000",
70223
- // }
70244
+ // [
70245
+ // {
70246
+ // "currency": "usdt",
70247
+ // "total": "7.00000",
70248
+ // "available": "7.00000",
70249
+ // "reserved": "0.00000"
70250
+ // },
70251
+ // ...
70252
+ // ]
70224
70253
  //
70225
70254
  return this.parseBalance(response);
70226
70255
  }
@@ -83586,6 +83615,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
83586
83615
  'fetchUnderlyingAssets': false,
83587
83616
  'fetchVolatilityHistory': true,
83588
83617
  'fetchWithdrawals': true,
83618
+ 'fetchFundingHistory': true,
83589
83619
  'repayCrossMargin': true,
83590
83620
  'setLeverage': true,
83591
83621
  'setMarginMode': true,
@@ -91586,6 +91616,106 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
91586
91616
  }
91587
91617
  return tiers;
91588
91618
  }
91619
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
91620
+ /**
91621
+ * @method
91622
+ * @name bybit#fetchFundingHistory
91623
+ * @description fetch the history of funding payments paid and received on this account
91624
+ * @see https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
91625
+ * @param {string} [symbol] unified market symbol
91626
+ * @param {int} [since] the earliest time in ms to fetch funding history for
91627
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
91628
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
91629
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
91630
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
91631
+ */
91632
+ await this.loadMarkets();
91633
+ let paginate = false;
91634
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
91635
+ if (paginate) {
91636
+ return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 100);
91637
+ }
91638
+ let request = {
91639
+ 'execType': 'Funding',
91640
+ };
91641
+ let market = undefined;
91642
+ if (symbol !== undefined) {
91643
+ market = this.market(symbol);
91644
+ request['symbol'] = market['id'];
91645
+ }
91646
+ let type = undefined;
91647
+ [type, params] = this.getBybitType('fetchFundingHistory', market, params);
91648
+ request['category'] = type;
91649
+ if (symbol !== undefined) {
91650
+ request['symbol'] = market['id'];
91651
+ }
91652
+ if (since !== undefined) {
91653
+ request['startTime'] = since;
91654
+ }
91655
+ if (limit !== undefined) {
91656
+ request['size'] = limit;
91657
+ }
91658
+ else {
91659
+ request['size'] = 100;
91660
+ }
91661
+ [request, params] = this.handleUntilOption('endTime', request, params);
91662
+ const response = await this.privateGetV5ExecutionList(this.extend(request, params));
91663
+ const fundings = this.addPaginationCursorToResult(response);
91664
+ return this.parseIncomes(fundings, market, since, limit);
91665
+ }
91666
+ parseIncome(income, market = undefined) {
91667
+ //
91668
+ // {
91669
+ // "symbol": "XMRUSDT",
91670
+ // "orderType": "UNKNOWN",
91671
+ // "underlyingPrice": "",
91672
+ // "orderLinkId": "",
91673
+ // "orderId": "a11e5fe2-1dbf-4bab-a9b2-af80a14efc5d",
91674
+ // "stopOrderType": "UNKNOWN",
91675
+ // "execTime": "1710950400000",
91676
+ // "feeCurrency": "",
91677
+ // "createType": "",
91678
+ // "feeRate": "-0.000761",
91679
+ // "tradeIv": "",
91680
+ // "blockTradeId": "",
91681
+ // "markPrice": "136.79",
91682
+ // "execPrice": "137.11",
91683
+ // "markIv": "",
91684
+ // "orderQty": "0",
91685
+ // "orderPrice": "0",
91686
+ // "execValue": "134.3678",
91687
+ // "closedSize": "0",
91688
+ // "execType": "Funding",
91689
+ // "seq": "28097658790",
91690
+ // "side": "Sell",
91691
+ // "indexPrice": "",
91692
+ // "leavesQty": "0",
91693
+ // "isMaker": false,
91694
+ // "execFee": "-0.10232512",
91695
+ // "execId": "8d1ef156-4ec6-4445-9a6c-1c0c24dbd046",
91696
+ // "marketUnit": "",
91697
+ // "execQty": "0.98",
91698
+ // "nextPageCursor": "5774437%3A0%2C5771289%3A0"
91699
+ // }
91700
+ //
91701
+ const marketId = this.safeString(income, 'symbol');
91702
+ market = this.safeMarket(marketId, market, undefined, 'contract');
91703
+ let code = 'USDT';
91704
+ if (market['inverse']) {
91705
+ code = market['quote'];
91706
+ }
91707
+ const timestamp = this.safeInteger(income, 'execTime');
91708
+ return {
91709
+ 'info': income,
91710
+ 'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
91711
+ 'code': code,
91712
+ 'timestamp': timestamp,
91713
+ 'datetime': this.iso8601(timestamp),
91714
+ 'id': this.safeString(income, 'execId'),
91715
+ 'amount': this.safeNumber(income, 'execQty'),
91716
+ 'rate': this.safeNumber(income, 'feeRate'),
91717
+ };
91718
+ }
91589
91719
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
91590
91720
  let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
91591
91721
  if (api === 'public') {
@@ -97476,10 +97606,10 @@ class coinbaseinternational extends _abstract_coinbaseinternational_js__WEBPACK_
97476
97606
  },
97477
97607
  'www': 'https://international.coinbase.com',
97478
97608
  'doc': [
97479
- 'https://docs.cloud.coinbaseinternational.com/intx/docs',
97609
+ 'https://docs.cloud.coinbase.com/intx/docs',
97480
97610
  ],
97481
97611
  'fees': [
97482
- 'https://help.coinbaseinternational.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
97612
+ 'https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees',
97483
97613
  ],
97484
97614
  'referral': '',
97485
97615
  },
@@ -136141,6 +136271,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
136141
136271
  'loan_records': 20 / 15,
136142
136272
  'interest_records': 20 / 15,
136143
136273
  'estimate_rate': 20 / 15,
136274
+ 'currency_discount_tiers': 20 / 15,
136144
136275
  },
136145
136276
  'post': {
136146
136277
  'account_mode': 20 / 15,
@@ -140061,7 +140192,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
140061
140192
  'account': account,
140062
140193
  };
140063
140194
  if (amount !== undefined) {
140064
- request['amount'] = this.amountToPrecision(symbol, amount);
140195
+ const amountKey = (market['spot']) ? 'amount' : 'size';
140196
+ request[amountKey] = this.amountToPrecision(symbol, amount);
140065
140197
  }
140066
140198
  if (price !== undefined) {
140067
140199
  request['price'] = this.priceToPrecision(symbol, price);
@@ -225407,7 +225539,7 @@ class alpaca extends _alpaca_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
225407
225539
  }
225408
225540
  this.watch(url, messageHash, request, messageHash, future);
225409
225541
  }
225410
- return future;
225542
+ return await future;
225411
225543
  }
225412
225544
  handleErrorMessage(client, message) {
225413
225545
  //
@@ -232496,7 +232628,7 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
232496
232628
  const message = this.extend(request, params);
232497
232629
  this.watch(url, messageHash, message, messageHash);
232498
232630
  }
232499
- return future;
232631
+ return await future;
232500
232632
  }
232501
232633
  handleAuthenticationMessage(client, message) {
232502
232634
  const messageHash = 'authenticated';
@@ -234410,7 +234542,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
234410
234542
  const message = this.extend(request, params);
234411
234543
  this.watch(url, messageHash, message, messageHash);
234412
234544
  }
234413
- return future;
234545
+ return await future;
234414
234546
  }
234415
234547
  async watchPrivate(messageHash, subscriptionHash, args, params = {}) {
234416
234548
  await this.authenticate();
@@ -235975,7 +236107,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
235975
236107
  const message = this.extend(request, params);
235976
236108
  this.watch(url, messageHash, message, messageHash);
235977
236109
  }
235978
- return future;
236110
+ return await future;
235979
236111
  }
235980
236112
  handleSubscriptionStatus(client, message) {
235981
236113
  //
@@ -236745,7 +236877,7 @@ class bitmex extends _bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
236745
236877
  const message = this.extend(request, params);
236746
236878
  this.watch(url, messageHash, message, messageHash);
236747
236879
  }
236748
- return future;
236880
+ return await future;
236749
236881
  }
236750
236882
  handleAuthenticationMessage(client, message) {
236751
236883
  const authenticated = this.safeBool(message, 'success', false);
@@ -241419,7 +241551,7 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
241419
241551
  };
241420
241552
  return this.watch(url, messageHash, this.extend(request, params), messageHash);
241421
241553
  }
241422
- return future;
241554
+ return await future;
241423
241555
  }
241424
241556
  }
241425
241557
 
@@ -242472,8 +242604,23 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
242472
242604
  for (let i = 0; i < rawPositions.length; i++) {
242473
242605
  const rawPosition = rawPositions[i];
242474
242606
  const position = this.parsePosition(rawPosition);
242607
+ const side = this.safeString(position, 'side');
242608
+ // hacky solution to handle closing positions
242609
+ // without crashing, we should handle this properly later
242475
242610
  newPositions.push(position);
242476
- cache.append(position);
242611
+ if (side === undefined || side === '') {
242612
+ // closing update, adding both sides to "reset" both sides
242613
+ // since we don't know which side is being closed
242614
+ position['side'] = 'long';
242615
+ cache.append(position);
242616
+ position['side'] = 'short';
242617
+ cache.append(position);
242618
+ position['side'] = undefined;
242619
+ }
242620
+ else {
242621
+ // regular update
242622
+ cache.append(position);
242623
+ }
242477
242624
  }
242478
242625
  const messageHashes = this.findMessageHashes(client, 'positions::');
242479
242626
  for (let i = 0; i < messageHashes.length; i++) {
@@ -243459,16 +243606,20 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
243459
243606
  // {
243460
243607
  // "e": "history",
243461
243608
  // "data": [
243462
- // "sell:1665467367741:3888551:19058.8:14541219",
243463
- // "buy:1665467367741:1059339:19071.5:14541218",
243609
+ // 'buy:1710255706095:444444:71222.2:14892622'
243610
+ // 'sell:1710255658251:42530:71300:14892621'
243611
+ // 'buy:1710252424241:87913:72800:14892620'
243612
+ // ... timestamp descending
243464
243613
  // ]
243465
243614
  // }
243466
243615
  //
243467
- const data = this.safeValue(message, 'data', []);
243616
+ const data = this.safeList(message, 'data', []);
243468
243617
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
243469
243618
  const stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCache */ .ZL(limit);
243470
- for (let i = 0; i < data.length; i++) {
243471
- const rawTrade = data[i];
243619
+ const dataLength = data.length;
243620
+ for (let i = 0; i < dataLength; i++) {
243621
+ const index = dataLength - 1 - i;
243622
+ const rawTrade = data[index];
243472
243623
  const parsed = this.parseWsOldTrade(rawTrade);
243473
243624
  stored.append(parsed);
243474
243625
  }
@@ -249782,7 +249933,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
249782
249933
  const message = this.extend(request, params);
249783
249934
  this.watch(url, messageHash, message, messageHash);
249784
249935
  }
249785
- return future;
249936
+ return await future;
249786
249937
  }
249787
249938
  handlePing(client, message) {
249788
249939
  this.spawn(this.pong, client, message);
@@ -254432,7 +254583,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
254432
254583
  // }
254433
254584
  //
254434
254585
  }
254435
- return future;
254586
+ return await future;
254436
254587
  }
254437
254588
  async subscribePublic(name, messageHashPrefix, symbols = undefined, params = {}) {
254438
254589
  /**
@@ -258620,7 +258771,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
258620
258771
  };
258621
258772
  this.watch(url, messageHash, request, messageHash, subscription);
258622
258773
  }
258623
- return future;
258774
+ return await future;
258624
258775
  }
258625
258776
  }
258626
258777
 
@@ -269277,7 +269428,7 @@ class okcoin extends _okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
269277
269428
  };
269278
269429
  this.spawn(this.watch, url, messageHash, request, messageHash, future);
269279
269430
  }
269280
- return future;
269431
+ return await future;
269281
269432
  }
269282
269433
  async watchBalance(params = {}) {
269283
269434
  /**
@@ -272541,7 +272692,7 @@ class onetrading extends _onetrading_js__WEBPACK_IMPORTED_MODULE_0__/* ["default
272541
272692
  };
272542
272693
  this.watch(url, messageHash, this.extend(request, params), messageHash);
272543
272694
  }
272544
- return future;
272695
+ return await future;
272545
272696
  }
272546
272697
  }
272547
272698
 
@@ -279473,6 +279624,15 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279473
279624
  return await this.watch(url, messageHash, request, messageHash, subscribe);
279474
279625
  }
279475
279626
  async watchOrderBook(symbol, limit = undefined, params = {}) {
279627
+ /**
279628
+ * @method
279629
+ * @name woo#watchOrderBook
279630
+ * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
279631
+ * @param {string} symbol unified symbol of the market to fetch the order book for
279632
+ * @param {int} [limit] the maximum amount of order book entries to return.
279633
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279634
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
279635
+ */
279476
279636
  await this.loadMarkets();
279477
279637
  const name = 'orderbook';
279478
279638
  const market = this.market(symbol);
@@ -279522,9 +279682,18 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279522
279682
  client.resolve(orderbook, topic);
279523
279683
  }
279524
279684
  async watchTicker(symbol, params = {}) {
279685
+ /**
279686
+ * @method
279687
+ * @name woo#watchTicker
279688
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
279689
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
279690
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279691
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
279692
+ */
279525
279693
  await this.loadMarkets();
279526
279694
  const name = 'ticker';
279527
279695
  const market = this.market(symbol);
279696
+ symbol = market['symbol'];
279528
279697
  const topic = market['id'] + '@' + name;
279529
279698
  const request = {
279530
279699
  'event': 'subscribe',
@@ -279599,7 +279768,16 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279599
279768
  return message;
279600
279769
  }
279601
279770
  async watchTickers(symbols = undefined, params = {}) {
279771
+ /**
279772
+ * @method
279773
+ * @name woo#watchTickers
279774
+ * @description n watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
279775
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
279776
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279777
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
279778
+ */
279602
279779
  await this.loadMarkets();
279780
+ symbols = this.marketSymbols(symbols);
279603
279781
  const name = 'tickers';
279604
279782
  const topic = name;
279605
279783
  const request = {
@@ -279718,8 +279896,19 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
279718
279896
  client.resolve(stored, topic);
279719
279897
  }
279720
279898
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
279899
+ /**
279900
+ * @method
279901
+ * @name woo#watchTrades
279902
+ * @description watches information on multiple trades made in a market
279903
+ * @param {string} symbol unified market symbol of the market trades were made in
279904
+ * @param {int} [since] the earliest time in ms to fetch trades for
279905
+ * @param {int} [limit] the maximum number of trade structures to retrieve
279906
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
279907
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
279908
+ */
279721
279909
  await this.loadMarkets();
279722
279910
  const market = this.market(symbol);
279911
+ symbol = market['symbol'];
279723
279912
  const topic = market['id'] + '@trade';
279724
279913
  const request = {
279725
279914
  'event': 'subscribe',
@@ -322090,7 +322279,7 @@ SOFTWARE.
322090
322279
 
322091
322280
  //-----------------------------------------------------------------------------
322092
322281
  // this is updated by vss.js when building
322093
- const version = '4.2.78';
322282
+ const version = '4.2.79';
322094
322283
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
322095
322284
  //-----------------------------------------------------------------------------
322096
322285