ccxt 4.2.23 → 4.2.24
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 +355 -11
- 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 +98 -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 +4 -3
- package/js/src/bitfinex2.js +98 -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.24/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.2.24/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.24/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,
|
|
@@ -36690,6 +36792,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
36690
36792
|
'fetchMyTrades': true,
|
|
36691
36793
|
'fetchOHLCV': true,
|
|
36692
36794
|
'fetchOpenInterest': true,
|
|
36795
|
+
'fetchOpenInterestHistory': true,
|
|
36693
36796
|
'fetchOpenOrder': true,
|
|
36694
36797
|
'fetchOpenOrders': true,
|
|
36695
36798
|
'fetchOrder': true,
|
|
@@ -39669,7 +39772,73 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39669
39772
|
//
|
|
39670
39773
|
return this.parseOpenInterest(response[0], market);
|
|
39671
39774
|
}
|
|
39775
|
+
async fetchOpenInterestHistory(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
39776
|
+
/**
|
|
39777
|
+
* @method
|
|
39778
|
+
* @name bitfinex2#fetchOpenInterestHistory
|
|
39779
|
+
* @description retrieves the open interest history of a currency
|
|
39780
|
+
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status-history
|
|
39781
|
+
* @param {string} symbol unified CCXT market symbol
|
|
39782
|
+
* @param {string} timeframe the time period of each row of data, not used by bitfinex2
|
|
39783
|
+
* @param {int} [since] the time in ms of the earliest record to retrieve as a unix timestamp
|
|
39784
|
+
* @param {int} [limit] the number of records in the response
|
|
39785
|
+
* @param {object} [params] exchange specific parameters
|
|
39786
|
+
* @param {int} [params.until] the time in ms of the latest record to retrieve as a unix timestamp
|
|
39787
|
+
* @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)
|
|
39788
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
39789
|
+
*/
|
|
39790
|
+
await this.loadMarkets();
|
|
39791
|
+
let paginate = false;
|
|
39792
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate');
|
|
39793
|
+
if (paginate) {
|
|
39794
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, '8h', params, 5000);
|
|
39795
|
+
}
|
|
39796
|
+
const market = this.market(symbol);
|
|
39797
|
+
let request = {
|
|
39798
|
+
'symbol': market['id'],
|
|
39799
|
+
};
|
|
39800
|
+
if (since !== undefined) {
|
|
39801
|
+
request['start'] = since;
|
|
39802
|
+
}
|
|
39803
|
+
if (limit !== undefined) {
|
|
39804
|
+
request['limit'] = limit;
|
|
39805
|
+
}
|
|
39806
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
39807
|
+
const response = await this.publicGetStatusDerivSymbolHist(this.extend(request, params));
|
|
39808
|
+
//
|
|
39809
|
+
// [
|
|
39810
|
+
// [
|
|
39811
|
+
// 1706295191000, // timestamp
|
|
39812
|
+
// null,
|
|
39813
|
+
// 42152.425382, // derivative mid price
|
|
39814
|
+
// 42133, // spot mid price
|
|
39815
|
+
// null,
|
|
39816
|
+
// 37671589.7853521, // insurance fund balance
|
|
39817
|
+
// null,
|
|
39818
|
+
// 1706313600000, // timestamp of next funding
|
|
39819
|
+
// 0.00018734, // accrued funding for next period
|
|
39820
|
+
// 3343, // next funding step
|
|
39821
|
+
// null,
|
|
39822
|
+
// 0.00007587, // current funding
|
|
39823
|
+
// null,
|
|
39824
|
+
// null,
|
|
39825
|
+
// 42134.1, // mark price
|
|
39826
|
+
// null,
|
|
39827
|
+
// null,
|
|
39828
|
+
// 5775.20348804, // open interest number of contracts
|
|
39829
|
+
// null,
|
|
39830
|
+
// null,
|
|
39831
|
+
// null,
|
|
39832
|
+
// 0.0005, // average spread without funding payment
|
|
39833
|
+
// 0.0025 // funding payment cap
|
|
39834
|
+
// ],
|
|
39835
|
+
// ]
|
|
39836
|
+
//
|
|
39837
|
+
return this.parseOpenInterests(response, market, since, limit);
|
|
39838
|
+
}
|
|
39672
39839
|
parseOpenInterest(interest, market = undefined) {
|
|
39840
|
+
//
|
|
39841
|
+
// fetchOpenInterest:
|
|
39673
39842
|
//
|
|
39674
39843
|
// [
|
|
39675
39844
|
// "tXRPF0:USTF0", // market id
|
|
@@ -39698,11 +39867,41 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39698
39867
|
// 0.0025 // funding payment cap
|
|
39699
39868
|
// ]
|
|
39700
39869
|
//
|
|
39870
|
+
// fetchOpenInterestHistory:
|
|
39871
|
+
//
|
|
39872
|
+
// [
|
|
39873
|
+
// 1706295191000, // timestamp
|
|
39874
|
+
// null,
|
|
39875
|
+
// 42152.425382, // derivative mid price
|
|
39876
|
+
// 42133, // spot mid price
|
|
39877
|
+
// null,
|
|
39878
|
+
// 37671589.7853521, // insurance fund balance
|
|
39879
|
+
// null,
|
|
39880
|
+
// 1706313600000, // timestamp of next funding
|
|
39881
|
+
// 0.00018734, // accrued funding for next period
|
|
39882
|
+
// 3343, // next funding step
|
|
39883
|
+
// null,
|
|
39884
|
+
// 0.00007587, // current funding
|
|
39885
|
+
// null,
|
|
39886
|
+
// null,
|
|
39887
|
+
// 42134.1, // mark price
|
|
39888
|
+
// null,
|
|
39889
|
+
// null,
|
|
39890
|
+
// 5775.20348804, // open interest number of contracts
|
|
39891
|
+
// null,
|
|
39892
|
+
// null,
|
|
39893
|
+
// null,
|
|
39894
|
+
// 0.0005, // average spread without funding payment
|
|
39895
|
+
// 0.0025 // funding payment cap
|
|
39896
|
+
// ]
|
|
39897
|
+
//
|
|
39898
|
+
const interestLength = interest.length;
|
|
39899
|
+
const openInterestIndex = (interestLength === 23) ? 17 : 18;
|
|
39701
39900
|
const timestamp = this.safeInteger(interest, 1);
|
|
39702
39901
|
const marketId = this.safeString(interest, 0);
|
|
39703
39902
|
return this.safeOpenInterest({
|
|
39704
39903
|
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
39705
|
-
'openInterestAmount': this.safeNumber(interest,
|
|
39904
|
+
'openInterestAmount': this.safeNumber(interest, openInterestIndex),
|
|
39706
39905
|
'openInterestValue': undefined,
|
|
39707
39906
|
'timestamp': timestamp,
|
|
39708
39907
|
'datetime': this.iso8601(timestamp),
|
|
@@ -204063,7 +204262,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
204063
204262
|
const contracts = this.safeString(position, 'size');
|
|
204064
204263
|
const contractSize = this.safeValue(market, 'contractSize');
|
|
204065
204264
|
const contractSizeString = this.numberToString(contractSize);
|
|
204066
|
-
const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.
|
|
204265
|
+
const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.safeString2(position, 'leverage', 'leverageRr'))));
|
|
204067
204266
|
const entryPriceString = this.safeString2(position, 'avgEntryPrice', 'avgEntryPriceRp');
|
|
204068
204267
|
const rawSide = this.safeString(position, 'side');
|
|
204069
204268
|
let side = undefined;
|
|
@@ -221585,7 +221784,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221585
221784
|
'has': {
|
|
221586
221785
|
'ws': true,
|
|
221587
221786
|
'watchBalance': true,
|
|
221588
|
-
'watchMyTrades':
|
|
221787
|
+
'watchMyTrades': true,
|
|
221589
221788
|
'watchOHLCV': false,
|
|
221590
221789
|
'watchOrderBook': true,
|
|
221591
221790
|
'watchOrders': false,
|
|
@@ -221746,6 +221945,150 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221746
221945
|
this.trades[symbol] = tradesCache;
|
|
221747
221946
|
client.resolve(tradesCache, messageHash);
|
|
221748
221947
|
}
|
|
221948
|
+
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
221949
|
+
/**
|
|
221950
|
+
* @method
|
|
221951
|
+
* @name bitopro#watchMyTrades
|
|
221952
|
+
* @description watches information on multiple trades made by the user
|
|
221953
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/matches_stream.md
|
|
221954
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
221955
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
221956
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
221957
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
221958
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
|
|
221959
|
+
*/
|
|
221960
|
+
this.checkRequiredCredentials();
|
|
221961
|
+
await this.loadMarkets();
|
|
221962
|
+
let messageHash = 'USER_TRADE';
|
|
221963
|
+
if (symbol !== undefined) {
|
|
221964
|
+
const market = this.market(symbol);
|
|
221965
|
+
messageHash = messageHash + ':' + market['symbol'];
|
|
221966
|
+
}
|
|
221967
|
+
const url = this.urls['ws']['private'] + '/' + 'user-trades';
|
|
221968
|
+
this.authenticate(url);
|
|
221969
|
+
const trades = await this.watch(url, messageHash, undefined, messageHash);
|
|
221970
|
+
if (this.newUpdates) {
|
|
221971
|
+
limit = trades.getLimit(symbol, limit);
|
|
221972
|
+
}
|
|
221973
|
+
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
221974
|
+
}
|
|
221975
|
+
handleMyTrade(client, message) {
|
|
221976
|
+
//
|
|
221977
|
+
// {
|
|
221978
|
+
// "event": "USER_TRADE",
|
|
221979
|
+
// "timestamp": 1694667358782,
|
|
221980
|
+
// "datetime": "2023-09-14T12:55:58.782Z",
|
|
221981
|
+
// "data": {
|
|
221982
|
+
// "base": "usdt",
|
|
221983
|
+
// "quote": "twd",
|
|
221984
|
+
// "side": "ask",
|
|
221985
|
+
// "price": "32.039",
|
|
221986
|
+
// "volume": "1",
|
|
221987
|
+
// "fee": "6407800",
|
|
221988
|
+
// "feeCurrency": "twd",
|
|
221989
|
+
// "transactionTimestamp": 1694667358,
|
|
221990
|
+
// "eventTimestamp": 1694667358,
|
|
221991
|
+
// "orderID": 390733918,
|
|
221992
|
+
// "orderType": "LIMIT",
|
|
221993
|
+
// "matchID": "bd07673a-94b1-419e-b5ee-d7b723261a5d",
|
|
221994
|
+
// "isMarket": false,
|
|
221995
|
+
// "isMaker": false
|
|
221996
|
+
// }
|
|
221997
|
+
// }
|
|
221998
|
+
//
|
|
221999
|
+
const data = this.safeValue(message, 'data', {});
|
|
222000
|
+
const baseId = this.safeString(data, 'base');
|
|
222001
|
+
const quoteId = this.safeString(data, 'quote');
|
|
222002
|
+
const base = this.safeCurrencyCode(baseId);
|
|
222003
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
222004
|
+
const symbol = this.symbol(base + '/' + quote);
|
|
222005
|
+
const messageHash = this.safeString(message, 'event');
|
|
222006
|
+
if (this.myTrades === undefined) {
|
|
222007
|
+
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
222008
|
+
this.myTrades = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolById */ .hl(limit);
|
|
222009
|
+
}
|
|
222010
|
+
const trades = this.myTrades;
|
|
222011
|
+
const parsed = this.parseWsTrade(data);
|
|
222012
|
+
trades.append(parsed);
|
|
222013
|
+
client.resolve(trades, messageHash);
|
|
222014
|
+
client.resolve(trades, messageHash + ':' + symbol);
|
|
222015
|
+
}
|
|
222016
|
+
parseWsTrade(trade, market = undefined) {
|
|
222017
|
+
//
|
|
222018
|
+
// {
|
|
222019
|
+
// "base": "usdt",
|
|
222020
|
+
// "quote": "twd",
|
|
222021
|
+
// "side": "ask",
|
|
222022
|
+
// "price": "32.039",
|
|
222023
|
+
// "volume": "1",
|
|
222024
|
+
// "fee": "6407800",
|
|
222025
|
+
// "feeCurrency": "twd",
|
|
222026
|
+
// "transactionTimestamp": 1694667358,
|
|
222027
|
+
// "eventTimestamp": 1694667358,
|
|
222028
|
+
// "orderID": 390733918,
|
|
222029
|
+
// "orderType": "LIMIT",
|
|
222030
|
+
// "matchID": "bd07673a-94b1-419e-b5ee-d7b723261a5d",
|
|
222031
|
+
// "isMarket": false,
|
|
222032
|
+
// "isMaker": false
|
|
222033
|
+
// }
|
|
222034
|
+
//
|
|
222035
|
+
const id = this.safeString(trade, 'matchID');
|
|
222036
|
+
const orderId = this.safeString(trade, 'orderID');
|
|
222037
|
+
const timestamp = this.safeTimestamp(trade, 'transactionTimestamp');
|
|
222038
|
+
const baseId = this.safeString(trade, 'base');
|
|
222039
|
+
const quoteId = this.safeString(trade, 'quote');
|
|
222040
|
+
const base = this.safeCurrencyCode(baseId);
|
|
222041
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
222042
|
+
const symbol = this.symbol(base + '/' + quote);
|
|
222043
|
+
market = this.safeMarket(symbol, market);
|
|
222044
|
+
const price = this.safeString(trade, 'price');
|
|
222045
|
+
const type = this.safeStringLower(trade, 'orderType');
|
|
222046
|
+
let side = this.safeString(trade, 'side');
|
|
222047
|
+
if (side !== undefined) {
|
|
222048
|
+
if (side === 'ask') {
|
|
222049
|
+
side = 'sell';
|
|
222050
|
+
}
|
|
222051
|
+
else if (side === 'bid') {
|
|
222052
|
+
side = 'buy';
|
|
222053
|
+
}
|
|
222054
|
+
}
|
|
222055
|
+
const amount = this.safeString(trade, 'volume');
|
|
222056
|
+
let fee = undefined;
|
|
222057
|
+
const feeAmount = this.safeString(trade, 'fee');
|
|
222058
|
+
const feeSymbol = this.safeCurrencyCode(this.safeString(trade, 'feeCurrency'));
|
|
222059
|
+
if (feeAmount !== undefined) {
|
|
222060
|
+
fee = {
|
|
222061
|
+
'cost': feeAmount,
|
|
222062
|
+
'currency': feeSymbol,
|
|
222063
|
+
'rate': undefined,
|
|
222064
|
+
};
|
|
222065
|
+
}
|
|
222066
|
+
const isMaker = this.safeValue(trade, 'isMaker');
|
|
222067
|
+
let takerOrMaker = undefined;
|
|
222068
|
+
if (isMaker !== undefined) {
|
|
222069
|
+
if (isMaker) {
|
|
222070
|
+
takerOrMaker = 'maker';
|
|
222071
|
+
}
|
|
222072
|
+
else {
|
|
222073
|
+
takerOrMaker = 'taker';
|
|
222074
|
+
}
|
|
222075
|
+
}
|
|
222076
|
+
return this.safeTrade({
|
|
222077
|
+
'id': id,
|
|
222078
|
+
'info': trade,
|
|
222079
|
+
'order': orderId,
|
|
222080
|
+
'timestamp': timestamp,
|
|
222081
|
+
'datetime': this.iso8601(timestamp),
|
|
222082
|
+
'symbol': symbol,
|
|
222083
|
+
'takerOrMaker': takerOrMaker,
|
|
222084
|
+
'type': type,
|
|
222085
|
+
'side': side,
|
|
222086
|
+
'price': price,
|
|
222087
|
+
'amount': amount,
|
|
222088
|
+
'cost': undefined,
|
|
222089
|
+
'fee': fee,
|
|
222090
|
+
}, market);
|
|
222091
|
+
}
|
|
221749
222092
|
async watchTicker(symbol, params = {}) {
|
|
221750
222093
|
/**
|
|
221751
222094
|
* @method
|
|
@@ -221888,6 +222231,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221888
222231
|
'TICKER': this.handleTicker,
|
|
221889
222232
|
'ORDER_BOOK': this.handleOrderBook,
|
|
221890
222233
|
'ACCOUNT_BALANCE': this.handleBalance,
|
|
222234
|
+
'USER_TRADE': this.handleMyTrade,
|
|
221891
222235
|
};
|
|
221892
222236
|
const event = this.safeString(message, 'event');
|
|
221893
222237
|
const method = this.safeValue(methods, event);
|
|
@@ -296764,7 +297108,7 @@ SOFTWARE.
|
|
|
296764
297108
|
|
|
296765
297109
|
//-----------------------------------------------------------------------------
|
|
296766
297110
|
// this is updated by vss.js when building
|
|
296767
|
-
const version = '4.2.
|
|
297111
|
+
const version = '4.2.24';
|
|
296768
297112
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
296769
297113
|
//-----------------------------------------------------------------------------
|
|
296770
297114
|
|