ccxt 4.2.23 → 4.2.25
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.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +447 -12
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binanceus.js +108 -6
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bitfinex2.js +189 -1
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/bitopro.js +146 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binanceus.d.ts +52 -1
- package/js/src/binanceus.js +108 -6
- package/js/src/bingx.js +2 -2
- package/js/src/bitfinex2.d.ts +6 -3
- package/js/src/bitfinex2.js +189 -1
- package/js/src/gate.js +1 -1
- package/js/src/phemex.js +1 -1
- package/js/src/pro/bitopro.d.ts +4 -1
- package/js/src/pro/bitopro.js +147 -2
- package/package.json +1 -1
- package/skip-tests.json +1 -0
package/README.md
CHANGED
|
@@ -209,13 +209,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
209
209
|
|
|
210
210
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
211
211
|
|
|
212
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
213
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
212
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.25/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.2.25/dist/ccxt.browser.js
|
|
214
214
|
|
|
215
215
|
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.
|
|
216
216
|
|
|
217
217
|
```HTML
|
|
218
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
218
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.25/dist/ccxt.browser.js"></script>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -27687,6 +27687,7 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
27687
27687
|
'id': 'binanceus',
|
|
27688
27688
|
'name': 'Binance US',
|
|
27689
27689
|
'countries': ['US'],
|
|
27690
|
+
'hostname': 'binance.us',
|
|
27690
27691
|
'rateLimit': 50,
|
|
27691
27692
|
'certified': false,
|
|
27692
27693
|
'pro': true,
|
|
@@ -27694,10 +27695,11 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
27694
27695
|
'logo': 'https://user-images.githubusercontent.com/1294454/65177307-217b7c80-da5f-11e9-876e-0b748ba0a358.jpg',
|
|
27695
27696
|
'api': {
|
|
27696
27697
|
'web': 'https://www.binance.us',
|
|
27697
|
-
'sapi': 'https://api.binance.us/sapi/v1',
|
|
27698
|
-
'wapi': 'https://api.binance.us/wapi/v3',
|
|
27699
27698
|
'public': 'https://api.binance.us/api/v3',
|
|
27700
27699
|
'private': 'https://api.binance.us/api/v3',
|
|
27700
|
+
'sapi': 'https://api.binance.us/sapi/v1',
|
|
27701
|
+
'sapiV2': 'https://api.binance.us/sapi/v2',
|
|
27702
|
+
'sapiV3': 'https://api.binance.us/sapi/v3',
|
|
27701
27703
|
},
|
|
27702
27704
|
'www': 'https://www.binance.us',
|
|
27703
27705
|
'referral': 'https://www.binance.us/?ref=35005074',
|
|
@@ -27758,13 +27760,13 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
27758
27760
|
'api': {
|
|
27759
27761
|
'public': {
|
|
27760
27762
|
'get': {
|
|
27761
|
-
'exchangeInfo': 10,
|
|
27762
27763
|
'ping': 1,
|
|
27763
27764
|
'time': 1,
|
|
27764
|
-
'
|
|
27765
|
+
'exchangeInfo': 10,
|
|
27765
27766
|
'trades': 1,
|
|
27766
|
-
'aggTrades': 1,
|
|
27767
27767
|
'historicalTrades': 5,
|
|
27768
|
+
'aggTrades': 1,
|
|
27769
|
+
'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]] },
|
|
27768
27770
|
'klines': 1,
|
|
27769
27771
|
'ticker/price': { 'cost': 1, 'noSymbol': 2 },
|
|
27770
27772
|
'avgPrice': 1,
|
|
@@ -27775,7 +27777,107 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
27775
27777
|
},
|
|
27776
27778
|
'private': {
|
|
27777
27779
|
'get': {
|
|
27778
|
-
'
|
|
27780
|
+
'account': 10,
|
|
27781
|
+
'rateLimit/order': 20,
|
|
27782
|
+
'order': 2,
|
|
27783
|
+
'openOrders': { 'cost': 3, 'noSymbol': 40 },
|
|
27784
|
+
'myTrades': 10,
|
|
27785
|
+
'myPreventedMatches': 10,
|
|
27786
|
+
'allOrders': 10,
|
|
27787
|
+
'orderList': 2,
|
|
27788
|
+
'allOrderList': 10,
|
|
27789
|
+
'openOrderList': 3,
|
|
27790
|
+
},
|
|
27791
|
+
'post': {
|
|
27792
|
+
'order': 1,
|
|
27793
|
+
'order/test': 1,
|
|
27794
|
+
'order/cancelReplace': 1,
|
|
27795
|
+
'order/oco': 1,
|
|
27796
|
+
},
|
|
27797
|
+
'delete': {
|
|
27798
|
+
'order': 1,
|
|
27799
|
+
'openOrders': 1,
|
|
27800
|
+
'orderList': 1,
|
|
27801
|
+
},
|
|
27802
|
+
},
|
|
27803
|
+
'sapi': {
|
|
27804
|
+
'get': {
|
|
27805
|
+
'system/status': 1,
|
|
27806
|
+
'asset/assetDistributionHistory': 1,
|
|
27807
|
+
'asset/query/trading-fee': 1,
|
|
27808
|
+
'asset/query/trading-volume': 1,
|
|
27809
|
+
'sub-account/spotSummary': 1,
|
|
27810
|
+
'sub-account/status': 1,
|
|
27811
|
+
'otc/coinPairs': 1,
|
|
27812
|
+
'otc/orders/{orderId}': 1,
|
|
27813
|
+
'otc/orders': 1,
|
|
27814
|
+
'ocbs/orders': 1,
|
|
27815
|
+
'capital/config/getall': 1,
|
|
27816
|
+
'capital/withdraw/history': 1,
|
|
27817
|
+
'fiatpayment/query/withdraw/history': 1,
|
|
27818
|
+
'capital/deposit/address': 1,
|
|
27819
|
+
'capital/deposit/hisrec': 1,
|
|
27820
|
+
'fiatpayment/query/deposit/history': 1,
|
|
27821
|
+
'capital/sub-account/deposit/address': 1,
|
|
27822
|
+
'capital/sub-account/deposit/history': 1,
|
|
27823
|
+
'asset/query/dust-logs': 1,
|
|
27824
|
+
'asset/query/dust-assets': 1,
|
|
27825
|
+
'marketing/referral/reward/history': 1,
|
|
27826
|
+
'staking/asset': 1,
|
|
27827
|
+
'staking/stakingBalance': 1,
|
|
27828
|
+
'staking/history': 1,
|
|
27829
|
+
'staking/stakingRewardsHistory': 1,
|
|
27830
|
+
'custodian/balance': 1,
|
|
27831
|
+
'custodian/supportedAssetList': 1,
|
|
27832
|
+
'custodian/walletTransferHistory': 1,
|
|
27833
|
+
'custodian/custodianTransferHistory': 1,
|
|
27834
|
+
'custodian/openOrders': 1,
|
|
27835
|
+
'custodian/order': 1,
|
|
27836
|
+
'custodian/orderHistory': 1,
|
|
27837
|
+
'custodian/tradeHistory': 1,
|
|
27838
|
+
'custodian/settlementSetting': 1,
|
|
27839
|
+
'custodian/settlementHistory': 1,
|
|
27840
|
+
'cl/transferHistory': 1,
|
|
27841
|
+
'apipartner/checkEligibility': 1,
|
|
27842
|
+
'apipartner/rebateHistory': 1,
|
|
27843
|
+
},
|
|
27844
|
+
'post': {
|
|
27845
|
+
'otc/quotes': 1,
|
|
27846
|
+
'otc/orders': 1,
|
|
27847
|
+
'fiatpayment/withdraw/apply': 1,
|
|
27848
|
+
'capital/withdraw/apply': 1,
|
|
27849
|
+
'asset/dust': 10,
|
|
27850
|
+
'staking/stake': 1,
|
|
27851
|
+
'staking/unstake': 1,
|
|
27852
|
+
'custodian/walletTransfer': 1,
|
|
27853
|
+
'custodian/custodianTransfer': 1,
|
|
27854
|
+
'custodian/undoTransfer': 1,
|
|
27855
|
+
'custodian/order': 1,
|
|
27856
|
+
'custodian/ocoOrder': 1,
|
|
27857
|
+
'cl/transfer': 1,
|
|
27858
|
+
},
|
|
27859
|
+
'delete': {
|
|
27860
|
+
'custodian/cancelOrder': 1,
|
|
27861
|
+
'custodian/cancelOrdersBySymbol': 1,
|
|
27862
|
+
'custodian/cancelOcoOrder': 1,
|
|
27863
|
+
},
|
|
27864
|
+
},
|
|
27865
|
+
'sapiV2': {
|
|
27866
|
+
'get': {
|
|
27867
|
+
'cl/account': 10,
|
|
27868
|
+
'cl/alertHistory': 1,
|
|
27869
|
+
},
|
|
27870
|
+
},
|
|
27871
|
+
'sapiV3': {
|
|
27872
|
+
'get': {
|
|
27873
|
+
'accountStatus': 1,
|
|
27874
|
+
'apiTradingStatus': 1,
|
|
27875
|
+
'sub-account/list': 1,
|
|
27876
|
+
'sub-account/transfer/history': 1,
|
|
27877
|
+
'sub-account/assets': 1,
|
|
27878
|
+
},
|
|
27879
|
+
'post': {
|
|
27880
|
+
'sub-account/transfer': 1,
|
|
27779
27881
|
},
|
|
27780
27882
|
},
|
|
27781
27883
|
},
|
|
@@ -28221,7 +28323,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28221
28323
|
'100500': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
28222
28324
|
'100503': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
28223
28325
|
'80001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
28224
|
-
'80012': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.
|
|
28326
|
+
'80012': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
28225
28327
|
'80014': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
28226
28328
|
'80016': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
28227
28329
|
'80017': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
@@ -36685,11 +36787,13 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
36685
36787
|
'fetchFundingRates': true,
|
|
36686
36788
|
'fetchIndexOHLCV': false,
|
|
36687
36789
|
'fetchLedger': true,
|
|
36790
|
+
'fetchLiquidations': true,
|
|
36688
36791
|
'fetchMarginMode': false,
|
|
36689
36792
|
'fetchMarkOHLCV': false,
|
|
36690
36793
|
'fetchMyTrades': true,
|
|
36691
36794
|
'fetchOHLCV': true,
|
|
36692
36795
|
'fetchOpenInterest': true,
|
|
36796
|
+
'fetchOpenInterestHistory': true,
|
|
36693
36797
|
'fetchOpenOrder': true,
|
|
36694
36798
|
'fetchOpenOrders': true,
|
|
36695
36799
|
'fetchOrder': true,
|
|
@@ -39669,7 +39773,73 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39669
39773
|
//
|
|
39670
39774
|
return this.parseOpenInterest(response[0], market);
|
|
39671
39775
|
}
|
|
39776
|
+
async fetchOpenInterestHistory(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
39777
|
+
/**
|
|
39778
|
+
* @method
|
|
39779
|
+
* @name bitfinex2#fetchOpenInterestHistory
|
|
39780
|
+
* @description retrieves the open interest history of a currency
|
|
39781
|
+
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status-history
|
|
39782
|
+
* @param {string} symbol unified CCXT market symbol
|
|
39783
|
+
* @param {string} timeframe the time period of each row of data, not used by bitfinex2
|
|
39784
|
+
* @param {int} [since] the time in ms of the earliest record to retrieve as a unix timestamp
|
|
39785
|
+
* @param {int} [limit] the number of records in the response
|
|
39786
|
+
* @param {object} [params] exchange specific parameters
|
|
39787
|
+
* @param {int} [params.until] the time in ms of the latest record to retrieve as a unix timestamp
|
|
39788
|
+
* @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)
|
|
39789
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
39790
|
+
*/
|
|
39791
|
+
await this.loadMarkets();
|
|
39792
|
+
let paginate = false;
|
|
39793
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate');
|
|
39794
|
+
if (paginate) {
|
|
39795
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, '8h', params, 5000);
|
|
39796
|
+
}
|
|
39797
|
+
const market = this.market(symbol);
|
|
39798
|
+
let request = {
|
|
39799
|
+
'symbol': market['id'],
|
|
39800
|
+
};
|
|
39801
|
+
if (since !== undefined) {
|
|
39802
|
+
request['start'] = since;
|
|
39803
|
+
}
|
|
39804
|
+
if (limit !== undefined) {
|
|
39805
|
+
request['limit'] = limit;
|
|
39806
|
+
}
|
|
39807
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
39808
|
+
const response = await this.publicGetStatusDerivSymbolHist(this.extend(request, params));
|
|
39809
|
+
//
|
|
39810
|
+
// [
|
|
39811
|
+
// [
|
|
39812
|
+
// 1706295191000, // timestamp
|
|
39813
|
+
// null,
|
|
39814
|
+
// 42152.425382, // derivative mid price
|
|
39815
|
+
// 42133, // spot mid price
|
|
39816
|
+
// null,
|
|
39817
|
+
// 37671589.7853521, // insurance fund balance
|
|
39818
|
+
// null,
|
|
39819
|
+
// 1706313600000, // timestamp of next funding
|
|
39820
|
+
// 0.00018734, // accrued funding for next period
|
|
39821
|
+
// 3343, // next funding step
|
|
39822
|
+
// null,
|
|
39823
|
+
// 0.00007587, // current funding
|
|
39824
|
+
// null,
|
|
39825
|
+
// null,
|
|
39826
|
+
// 42134.1, // mark price
|
|
39827
|
+
// null,
|
|
39828
|
+
// null,
|
|
39829
|
+
// 5775.20348804, // open interest number of contracts
|
|
39830
|
+
// null,
|
|
39831
|
+
// null,
|
|
39832
|
+
// null,
|
|
39833
|
+
// 0.0005, // average spread without funding payment
|
|
39834
|
+
// 0.0025 // funding payment cap
|
|
39835
|
+
// ],
|
|
39836
|
+
// ]
|
|
39837
|
+
//
|
|
39838
|
+
return this.parseOpenInterests(response, market, since, limit);
|
|
39839
|
+
}
|
|
39672
39840
|
parseOpenInterest(interest, market = undefined) {
|
|
39841
|
+
//
|
|
39842
|
+
// fetchOpenInterest:
|
|
39673
39843
|
//
|
|
39674
39844
|
// [
|
|
39675
39845
|
// "tXRPF0:USTF0", // market id
|
|
@@ -39698,17 +39868,137 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39698
39868
|
// 0.0025 // funding payment cap
|
|
39699
39869
|
// ]
|
|
39700
39870
|
//
|
|
39871
|
+
// fetchOpenInterestHistory:
|
|
39872
|
+
//
|
|
39873
|
+
// [
|
|
39874
|
+
// 1706295191000, // timestamp
|
|
39875
|
+
// null,
|
|
39876
|
+
// 42152.425382, // derivative mid price
|
|
39877
|
+
// 42133, // spot mid price
|
|
39878
|
+
// null,
|
|
39879
|
+
// 37671589.7853521, // insurance fund balance
|
|
39880
|
+
// null,
|
|
39881
|
+
// 1706313600000, // timestamp of next funding
|
|
39882
|
+
// 0.00018734, // accrued funding for next period
|
|
39883
|
+
// 3343, // next funding step
|
|
39884
|
+
// null,
|
|
39885
|
+
// 0.00007587, // current funding
|
|
39886
|
+
// null,
|
|
39887
|
+
// null,
|
|
39888
|
+
// 42134.1, // mark price
|
|
39889
|
+
// null,
|
|
39890
|
+
// null,
|
|
39891
|
+
// 5775.20348804, // open interest number of contracts
|
|
39892
|
+
// null,
|
|
39893
|
+
// null,
|
|
39894
|
+
// null,
|
|
39895
|
+
// 0.0005, // average spread without funding payment
|
|
39896
|
+
// 0.0025 // funding payment cap
|
|
39897
|
+
// ]
|
|
39898
|
+
//
|
|
39899
|
+
const interestLength = interest.length;
|
|
39900
|
+
const openInterestIndex = (interestLength === 23) ? 17 : 18;
|
|
39701
39901
|
const timestamp = this.safeInteger(interest, 1);
|
|
39702
39902
|
const marketId = this.safeString(interest, 0);
|
|
39703
39903
|
return this.safeOpenInterest({
|
|
39704
39904
|
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
39705
|
-
'openInterestAmount': this.safeNumber(interest,
|
|
39905
|
+
'openInterestAmount': this.safeNumber(interest, openInterestIndex),
|
|
39706
39906
|
'openInterestValue': undefined,
|
|
39707
39907
|
'timestamp': timestamp,
|
|
39708
39908
|
'datetime': this.iso8601(timestamp),
|
|
39709
39909
|
'info': interest,
|
|
39710
39910
|
}, market);
|
|
39711
39911
|
}
|
|
39912
|
+
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
39913
|
+
/**
|
|
39914
|
+
* @method
|
|
39915
|
+
* @name bitfinex2#fetchLiquidations
|
|
39916
|
+
* @description retrieves the public liquidations of a trading pair
|
|
39917
|
+
* @see https://docs.bitfinex.com/reference/rest-public-liquidations
|
|
39918
|
+
* @param {string} symbol unified CCXT market symbol
|
|
39919
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
39920
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
39921
|
+
* @param {object} [params] exchange specific parameters
|
|
39922
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
39923
|
+
* @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)
|
|
39924
|
+
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
39925
|
+
*/
|
|
39926
|
+
await this.loadMarkets();
|
|
39927
|
+
let paginate = false;
|
|
39928
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLiquidations', 'paginate');
|
|
39929
|
+
if (paginate) {
|
|
39930
|
+
return await this.fetchPaginatedCallDeterministic('fetchLiquidations', symbol, since, limit, '8h', params, 500);
|
|
39931
|
+
}
|
|
39932
|
+
const market = this.market(symbol);
|
|
39933
|
+
let request = {};
|
|
39934
|
+
if (since !== undefined) {
|
|
39935
|
+
request['start'] = since;
|
|
39936
|
+
}
|
|
39937
|
+
if (limit !== undefined) {
|
|
39938
|
+
request['limit'] = limit;
|
|
39939
|
+
}
|
|
39940
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
39941
|
+
const response = await this.publicGetLiquidationsHist(this.extend(request, params));
|
|
39942
|
+
//
|
|
39943
|
+
// [
|
|
39944
|
+
// [
|
|
39945
|
+
// [
|
|
39946
|
+
// "pos",
|
|
39947
|
+
// 171085137,
|
|
39948
|
+
// 1706395919788,
|
|
39949
|
+
// null,
|
|
39950
|
+
// "tAVAXF0:USTF0",
|
|
39951
|
+
// -8,
|
|
39952
|
+
// 32.868,
|
|
39953
|
+
// null,
|
|
39954
|
+
// 1,
|
|
39955
|
+
// 1,
|
|
39956
|
+
// null,
|
|
39957
|
+
// 33.255
|
|
39958
|
+
// ]
|
|
39959
|
+
// ],
|
|
39960
|
+
// ]
|
|
39961
|
+
//
|
|
39962
|
+
return this.parseLiquidations(response, market, since, limit);
|
|
39963
|
+
}
|
|
39964
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
39965
|
+
//
|
|
39966
|
+
// [
|
|
39967
|
+
// [
|
|
39968
|
+
// "pos",
|
|
39969
|
+
// 171085137, // position id
|
|
39970
|
+
// 1706395919788, // timestamp
|
|
39971
|
+
// null,
|
|
39972
|
+
// "tAVAXF0:USTF0", // market id
|
|
39973
|
+
// -8, // amount in contracts
|
|
39974
|
+
// 32.868, // base price
|
|
39975
|
+
// null,
|
|
39976
|
+
// 1,
|
|
39977
|
+
// 1,
|
|
39978
|
+
// null,
|
|
39979
|
+
// 33.255 // acquired price
|
|
39980
|
+
// ]
|
|
39981
|
+
// ]
|
|
39982
|
+
//
|
|
39983
|
+
const entry = liquidation[0];
|
|
39984
|
+
const timestamp = this.safeInteger(entry, 2);
|
|
39985
|
+
const marketId = this.safeString(entry, 4);
|
|
39986
|
+
const contracts = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString(entry, 5));
|
|
39987
|
+
const contractSize = this.safeString(market, 'contractSize');
|
|
39988
|
+
const baseValue = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(contracts, contractSize);
|
|
39989
|
+
const price = this.safeString(entry, 11);
|
|
39990
|
+
return this.safeLiquidation({
|
|
39991
|
+
'info': entry,
|
|
39992
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
39993
|
+
'contracts': this.parseNumber(contracts),
|
|
39994
|
+
'contractSize': this.parseNumber(contractSize),
|
|
39995
|
+
'price': this.parseNumber(price),
|
|
39996
|
+
'baseValue': this.parseNumber(baseValue),
|
|
39997
|
+
'quoteValue': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(baseValue, price)),
|
|
39998
|
+
'timestamp': timestamp,
|
|
39999
|
+
'datetime': this.iso8601(timestamp),
|
|
40000
|
+
});
|
|
40001
|
+
}
|
|
39712
40002
|
}
|
|
39713
40003
|
|
|
39714
40004
|
|
|
@@ -127441,7 +127731,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
127441
127731
|
// "price": "333"
|
|
127442
127732
|
// }
|
|
127443
127733
|
//
|
|
127444
|
-
const id = this.
|
|
127734
|
+
const id = this.safeString2(trade, 'id', 'trade_id');
|
|
127445
127735
|
let timestamp = this.safeTimestamp2(trade, 'time', 'create_time');
|
|
127446
127736
|
timestamp = this.safeInteger(trade, 'create_time_ms', timestamp);
|
|
127447
127737
|
const marketId = this.safeString2(trade, 'currency_pair', 'contract');
|
|
@@ -204063,7 +204353,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
204063
204353
|
const contracts = this.safeString(position, 'size');
|
|
204064
204354
|
const contractSize = this.safeValue(market, 'contractSize');
|
|
204065
204355
|
const contractSizeString = this.numberToString(contractSize);
|
|
204066
|
-
const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.
|
|
204356
|
+
const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.safeString2(position, 'leverage', 'leverageRr'))));
|
|
204067
204357
|
const entryPriceString = this.safeString2(position, 'avgEntryPrice', 'avgEntryPriceRp');
|
|
204068
204358
|
const rawSide = this.safeString(position, 'side');
|
|
204069
204359
|
let side = undefined;
|
|
@@ -221585,7 +221875,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221585
221875
|
'has': {
|
|
221586
221876
|
'ws': true,
|
|
221587
221877
|
'watchBalance': true,
|
|
221588
|
-
'watchMyTrades':
|
|
221878
|
+
'watchMyTrades': true,
|
|
221589
221879
|
'watchOHLCV': false,
|
|
221590
221880
|
'watchOrderBook': true,
|
|
221591
221881
|
'watchOrders': false,
|
|
@@ -221746,6 +222036,150 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221746
222036
|
this.trades[symbol] = tradesCache;
|
|
221747
222037
|
client.resolve(tradesCache, messageHash);
|
|
221748
222038
|
}
|
|
222039
|
+
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
222040
|
+
/**
|
|
222041
|
+
* @method
|
|
222042
|
+
* @name bitopro#watchMyTrades
|
|
222043
|
+
* @description watches information on multiple trades made by the user
|
|
222044
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/matches_stream.md
|
|
222045
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
222046
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
222047
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
222048
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
222049
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
|
|
222050
|
+
*/
|
|
222051
|
+
this.checkRequiredCredentials();
|
|
222052
|
+
await this.loadMarkets();
|
|
222053
|
+
let messageHash = 'USER_TRADE';
|
|
222054
|
+
if (symbol !== undefined) {
|
|
222055
|
+
const market = this.market(symbol);
|
|
222056
|
+
messageHash = messageHash + ':' + market['symbol'];
|
|
222057
|
+
}
|
|
222058
|
+
const url = this.urls['ws']['private'] + '/' + 'user-trades';
|
|
222059
|
+
this.authenticate(url);
|
|
222060
|
+
const trades = await this.watch(url, messageHash, undefined, messageHash);
|
|
222061
|
+
if (this.newUpdates) {
|
|
222062
|
+
limit = trades.getLimit(symbol, limit);
|
|
222063
|
+
}
|
|
222064
|
+
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
222065
|
+
}
|
|
222066
|
+
handleMyTrade(client, message) {
|
|
222067
|
+
//
|
|
222068
|
+
// {
|
|
222069
|
+
// "event": "USER_TRADE",
|
|
222070
|
+
// "timestamp": 1694667358782,
|
|
222071
|
+
// "datetime": "2023-09-14T12:55:58.782Z",
|
|
222072
|
+
// "data": {
|
|
222073
|
+
// "base": "usdt",
|
|
222074
|
+
// "quote": "twd",
|
|
222075
|
+
// "side": "ask",
|
|
222076
|
+
// "price": "32.039",
|
|
222077
|
+
// "volume": "1",
|
|
222078
|
+
// "fee": "6407800",
|
|
222079
|
+
// "feeCurrency": "twd",
|
|
222080
|
+
// "transactionTimestamp": 1694667358,
|
|
222081
|
+
// "eventTimestamp": 1694667358,
|
|
222082
|
+
// "orderID": 390733918,
|
|
222083
|
+
// "orderType": "LIMIT",
|
|
222084
|
+
// "matchID": "bd07673a-94b1-419e-b5ee-d7b723261a5d",
|
|
222085
|
+
// "isMarket": false,
|
|
222086
|
+
// "isMaker": false
|
|
222087
|
+
// }
|
|
222088
|
+
// }
|
|
222089
|
+
//
|
|
222090
|
+
const data = this.safeValue(message, 'data', {});
|
|
222091
|
+
const baseId = this.safeString(data, 'base');
|
|
222092
|
+
const quoteId = this.safeString(data, 'quote');
|
|
222093
|
+
const base = this.safeCurrencyCode(baseId);
|
|
222094
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
222095
|
+
const symbol = this.symbol(base + '/' + quote);
|
|
222096
|
+
const messageHash = this.safeString(message, 'event');
|
|
222097
|
+
if (this.myTrades === undefined) {
|
|
222098
|
+
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
222099
|
+
this.myTrades = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
222100
|
+
}
|
|
222101
|
+
const trades = this.myTrades;
|
|
222102
|
+
const parsed = this.parseWsTrade(data);
|
|
222103
|
+
trades.append(parsed);
|
|
222104
|
+
client.resolve(trades, messageHash);
|
|
222105
|
+
client.resolve(trades, messageHash + ':' + symbol);
|
|
222106
|
+
}
|
|
222107
|
+
parseWsTrade(trade, market = undefined) {
|
|
222108
|
+
//
|
|
222109
|
+
// {
|
|
222110
|
+
// "base": "usdt",
|
|
222111
|
+
// "quote": "twd",
|
|
222112
|
+
// "side": "ask",
|
|
222113
|
+
// "price": "32.039",
|
|
222114
|
+
// "volume": "1",
|
|
222115
|
+
// "fee": "6407800",
|
|
222116
|
+
// "feeCurrency": "twd",
|
|
222117
|
+
// "transactionTimestamp": 1694667358,
|
|
222118
|
+
// "eventTimestamp": 1694667358,
|
|
222119
|
+
// "orderID": 390733918,
|
|
222120
|
+
// "orderType": "LIMIT",
|
|
222121
|
+
// "matchID": "bd07673a-94b1-419e-b5ee-d7b723261a5d",
|
|
222122
|
+
// "isMarket": false,
|
|
222123
|
+
// "isMaker": false
|
|
222124
|
+
// }
|
|
222125
|
+
//
|
|
222126
|
+
const id = this.safeString(trade, 'matchID');
|
|
222127
|
+
const orderId = this.safeString(trade, 'orderID');
|
|
222128
|
+
const timestamp = this.safeTimestamp(trade, 'transactionTimestamp');
|
|
222129
|
+
const baseId = this.safeString(trade, 'base');
|
|
222130
|
+
const quoteId = this.safeString(trade, 'quote');
|
|
222131
|
+
const base = this.safeCurrencyCode(baseId);
|
|
222132
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
222133
|
+
const symbol = this.symbol(base + '/' + quote);
|
|
222134
|
+
market = this.safeMarket(symbol, market);
|
|
222135
|
+
const price = this.safeString(trade, 'price');
|
|
222136
|
+
const type = this.safeStringLower(trade, 'orderType');
|
|
222137
|
+
let side = this.safeString(trade, 'side');
|
|
222138
|
+
if (side !== undefined) {
|
|
222139
|
+
if (side === 'ask') {
|
|
222140
|
+
side = 'sell';
|
|
222141
|
+
}
|
|
222142
|
+
else if (side === 'bid') {
|
|
222143
|
+
side = 'buy';
|
|
222144
|
+
}
|
|
222145
|
+
}
|
|
222146
|
+
const amount = this.safeString(trade, 'volume');
|
|
222147
|
+
let fee = undefined;
|
|
222148
|
+
const feeAmount = this.safeString(trade, 'fee');
|
|
222149
|
+
const feeSymbol = this.safeCurrencyCode(this.safeString(trade, 'feeCurrency'));
|
|
222150
|
+
if (feeAmount !== undefined) {
|
|
222151
|
+
fee = {
|
|
222152
|
+
'cost': feeAmount,
|
|
222153
|
+
'currency': feeSymbol,
|
|
222154
|
+
'rate': undefined,
|
|
222155
|
+
};
|
|
222156
|
+
}
|
|
222157
|
+
const isMaker = this.safeValue(trade, 'isMaker');
|
|
222158
|
+
let takerOrMaker = undefined;
|
|
222159
|
+
if (isMaker !== undefined) {
|
|
222160
|
+
if (isMaker) {
|
|
222161
|
+
takerOrMaker = 'maker';
|
|
222162
|
+
}
|
|
222163
|
+
else {
|
|
222164
|
+
takerOrMaker = 'taker';
|
|
222165
|
+
}
|
|
222166
|
+
}
|
|
222167
|
+
return this.safeTrade({
|
|
222168
|
+
'id': id,
|
|
222169
|
+
'info': trade,
|
|
222170
|
+
'order': orderId,
|
|
222171
|
+
'timestamp': timestamp,
|
|
222172
|
+
'datetime': this.iso8601(timestamp),
|
|
222173
|
+
'symbol': symbol,
|
|
222174
|
+
'takerOrMaker': takerOrMaker,
|
|
222175
|
+
'type': type,
|
|
222176
|
+
'side': side,
|
|
222177
|
+
'price': price,
|
|
222178
|
+
'amount': amount,
|
|
222179
|
+
'cost': undefined,
|
|
222180
|
+
'fee': fee,
|
|
222181
|
+
}, market);
|
|
222182
|
+
}
|
|
221749
222183
|
async watchTicker(symbol, params = {}) {
|
|
221750
222184
|
/**
|
|
221751
222185
|
* @method
|
|
@@ -221888,6 +222322,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221888
222322
|
'TICKER': this.handleTicker,
|
|
221889
222323
|
'ORDER_BOOK': this.handleOrderBook,
|
|
221890
222324
|
'ACCOUNT_BALANCE': this.handleBalance,
|
|
222325
|
+
'USER_TRADE': this.handleMyTrade,
|
|
221891
222326
|
};
|
|
221892
222327
|
const event = this.safeString(message, 'event');
|
|
221893
222328
|
const method = this.safeValue(methods, event);
|
|
@@ -296764,7 +297199,7 @@ SOFTWARE.
|
|
|
296764
297199
|
|
|
296765
297200
|
//-----------------------------------------------------------------------------
|
|
296766
297201
|
// this is updated by vss.js when building
|
|
296767
|
-
const version = '4.2.
|
|
297202
|
+
const version = '4.2.25';
|
|
296768
297203
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
296769
297204
|
//-----------------------------------------------------------------------------
|
|
296770
297205
|
|