ccxt 4.2.22 → 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 +587 -60
- 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 +186 -0
- package/dist/cjs/src/bitget.js +9 -9
- package/dist/cjs/src/coinbasepro.js +1 -1
- package/dist/cjs/src/coinex.js +23 -2
- package/dist/cjs/src/okx.js +81 -31
- package/dist/cjs/src/phemex.js +12 -3
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bitopro.js +146 -1
- package/dist/cjs/src/pro/hitbtc.js +6 -0
- package/dist/cjs/src/pro/okx.js +11 -3
- 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 -1
- package/js/src/bitfinex2.js +186 -0
- package/js/src/bitget.js +9 -9
- package/js/src/coinbasepro.js +1 -1
- package/js/src/coinex.js +23 -2
- package/js/src/okx.js +81 -31
- package/js/src/phemex.js +12 -3
- package/js/src/poloniex.js +1 -1
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bitopro.d.ts +4 -1
- package/js/src/pro/bitopro.js +147 -2
- package/js/src/pro/hitbtc.js +6 -0
- package/js/src/pro/okx.js +11 -3
- package/package.json +1 -1
- package/skip-tests.json +1 -0
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,
|
|
@@ -36689,6 +36791,8 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
36689
36791
|
'fetchMarkOHLCV': false,
|
|
36690
36792
|
'fetchMyTrades': true,
|
|
36691
36793
|
'fetchOHLCV': true,
|
|
36794
|
+
'fetchOpenInterest': true,
|
|
36795
|
+
'fetchOpenInterestHistory': true,
|
|
36692
36796
|
'fetchOpenOrder': true,
|
|
36693
36797
|
'fetchOpenOrders': true,
|
|
36694
36798
|
'fetchOrder': true,
|
|
@@ -39620,6 +39724,190 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39620
39724
|
'previousFundingDatetime': undefined,
|
|
39621
39725
|
};
|
|
39622
39726
|
}
|
|
39727
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
39728
|
+
/**
|
|
39729
|
+
* @method
|
|
39730
|
+
* @name bitfinex2#fetchOpenInterest
|
|
39731
|
+
* @description retrieves the open interest of a contract trading pair
|
|
39732
|
+
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
|
39733
|
+
* @param {string} symbol unified CCXT market symbol
|
|
39734
|
+
* @param {object} [params] exchange specific parameters
|
|
39735
|
+
* @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
39736
|
+
*/
|
|
39737
|
+
await this.loadMarkets();
|
|
39738
|
+
const market = this.market(symbol);
|
|
39739
|
+
const request = {
|
|
39740
|
+
'keys': market['id'],
|
|
39741
|
+
};
|
|
39742
|
+
const response = await this.publicGetStatusDeriv(this.extend(request, params));
|
|
39743
|
+
//
|
|
39744
|
+
// [
|
|
39745
|
+
// [
|
|
39746
|
+
// "tXRPF0:USTF0", // market id
|
|
39747
|
+
// 1706256986000, // millisecond timestamp
|
|
39748
|
+
// null,
|
|
39749
|
+
// 0.512705, // derivative mid price
|
|
39750
|
+
// 0.512395, // underlying spot mid price
|
|
39751
|
+
// null,
|
|
39752
|
+
// 37671483.04, // insurance fund balance
|
|
39753
|
+
// null,
|
|
39754
|
+
// 1706284800000, // timestamp of next funding
|
|
39755
|
+
// 0.00002353, // accrued funding for next period
|
|
39756
|
+
// 317, // next funding step
|
|
39757
|
+
// null,
|
|
39758
|
+
// 0, // current funding
|
|
39759
|
+
// null,
|
|
39760
|
+
// null,
|
|
39761
|
+
// 0.5123016, // mark price
|
|
39762
|
+
// null,
|
|
39763
|
+
// null,
|
|
39764
|
+
// 2233562.03115, // open interest in contracts
|
|
39765
|
+
// null,
|
|
39766
|
+
// null,
|
|
39767
|
+
// null,
|
|
39768
|
+
// 0.0005, // average spread without funding payment
|
|
39769
|
+
// 0.0025 // funding payment cap
|
|
39770
|
+
// ]
|
|
39771
|
+
// ]
|
|
39772
|
+
//
|
|
39773
|
+
return this.parseOpenInterest(response[0], market);
|
|
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
|
+
}
|
|
39839
|
+
parseOpenInterest(interest, market = undefined) {
|
|
39840
|
+
//
|
|
39841
|
+
// fetchOpenInterest:
|
|
39842
|
+
//
|
|
39843
|
+
// [
|
|
39844
|
+
// "tXRPF0:USTF0", // market id
|
|
39845
|
+
// 1706256986000, // millisecond timestamp
|
|
39846
|
+
// null,
|
|
39847
|
+
// 0.512705, // derivative mid price
|
|
39848
|
+
// 0.512395, // underlying spot mid price
|
|
39849
|
+
// null,
|
|
39850
|
+
// 37671483.04, // insurance fund balance
|
|
39851
|
+
// null,
|
|
39852
|
+
// 1706284800000, // timestamp of next funding
|
|
39853
|
+
// 0.00002353, // accrued funding for next period
|
|
39854
|
+
// 317, // next funding step
|
|
39855
|
+
// null,
|
|
39856
|
+
// 0, // current funding
|
|
39857
|
+
// null,
|
|
39858
|
+
// null,
|
|
39859
|
+
// 0.5123016, // mark price
|
|
39860
|
+
// null,
|
|
39861
|
+
// null,
|
|
39862
|
+
// 2233562.03115, // open interest in contracts
|
|
39863
|
+
// null,
|
|
39864
|
+
// null,
|
|
39865
|
+
// null,
|
|
39866
|
+
// 0.0005, // average spread without funding payment
|
|
39867
|
+
// 0.0025 // funding payment cap
|
|
39868
|
+
// ]
|
|
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;
|
|
39900
|
+
const timestamp = this.safeInteger(interest, 1);
|
|
39901
|
+
const marketId = this.safeString(interest, 0);
|
|
39902
|
+
return this.safeOpenInterest({
|
|
39903
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
39904
|
+
'openInterestAmount': this.safeNumber(interest, openInterestIndex),
|
|
39905
|
+
'openInterestValue': undefined,
|
|
39906
|
+
'timestamp': timestamp,
|
|
39907
|
+
'datetime': this.iso8601(timestamp),
|
|
39908
|
+
'info': interest,
|
|
39909
|
+
}, market);
|
|
39910
|
+
}
|
|
39623
39911
|
}
|
|
39624
39912
|
|
|
39625
39913
|
|
|
@@ -41595,16 +41883,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41595
41883
|
'createOrder': true,
|
|
41596
41884
|
'createOrders': true,
|
|
41597
41885
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
41598
|
-
'createReduceOnlyOrder': false,
|
|
41599
|
-
'createStopLossOrder': true,
|
|
41600
|
-
'createTakeProfitOrder': true,
|
|
41601
41886
|
'createPostOnlyOrder': true,
|
|
41602
|
-
'
|
|
41887
|
+
'createReduceOnlyOrder': false,
|
|
41603
41888
|
'createStopLimitOrder': true,
|
|
41889
|
+
'createStopLossOrder': true,
|
|
41604
41890
|
'createStopMarketOrder': true,
|
|
41891
|
+
'createStopOrder': true,
|
|
41892
|
+
'createTakeProfitOrder': true,
|
|
41893
|
+
'createTrailingAmountOrder': false,
|
|
41605
41894
|
'createTrailingPercentOrder': true,
|
|
41606
41895
|
'createTriggerOrder': true,
|
|
41607
|
-
'signIn': false,
|
|
41608
41896
|
'editOrder': true,
|
|
41609
41897
|
'fetchAccounts': false,
|
|
41610
41898
|
'fetchBalance': true,
|
|
@@ -41620,12 +41908,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41620
41908
|
'fetchDepositAddress': true,
|
|
41621
41909
|
'fetchDepositAddresses': false,
|
|
41622
41910
|
'fetchDeposits': true,
|
|
41911
|
+
'fetchDepositsWithdrawals': false,
|
|
41623
41912
|
'fetchDepositWithdrawFee': 'emulated',
|
|
41624
41913
|
'fetchDepositWithdrawFees': true,
|
|
41625
|
-
'fetchDepositsWithdrawals': false,
|
|
41626
41914
|
'fetchFundingHistory': true,
|
|
41627
|
-
'fetchWithdrawAddresses': false,
|
|
41628
|
-
'fetchTransactions': false,
|
|
41629
41915
|
'fetchFundingRate': true,
|
|
41630
41916
|
'fetchFundingRateHistory': true,
|
|
41631
41917
|
'fetchFundingRates': false,
|
|
@@ -41649,7 +41935,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41649
41935
|
'fetchOrder': true,
|
|
41650
41936
|
'fetchOrderBook': true,
|
|
41651
41937
|
'fetchOrders': false,
|
|
41652
|
-
'createTrailingAmountOrder': false,
|
|
41653
41938
|
'fetchOrderTrades': false,
|
|
41654
41939
|
'fetchPosition': true,
|
|
41655
41940
|
'fetchPositionMode': false,
|
|
@@ -41662,8 +41947,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41662
41947
|
'fetchTrades': true,
|
|
41663
41948
|
'fetchTradingFee': true,
|
|
41664
41949
|
'fetchTradingFees': true,
|
|
41950
|
+
'fetchTransactions': false,
|
|
41665
41951
|
'fetchTransfer': false,
|
|
41666
41952
|
'fetchTransfers': true,
|
|
41953
|
+
'fetchWithdrawAddresses': false,
|
|
41667
41954
|
'fetchWithdrawal': false,
|
|
41668
41955
|
'fetchWithdrawals': true,
|
|
41669
41956
|
'reduceMargin': true,
|
|
@@ -41672,6 +41959,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41672
41959
|
'setLeverage': true,
|
|
41673
41960
|
'setMarginMode': true,
|
|
41674
41961
|
'setPositionMode': true,
|
|
41962
|
+
'signIn': false,
|
|
41675
41963
|
'transfer': true,
|
|
41676
41964
|
'withdraw': true,
|
|
41677
41965
|
},
|
|
@@ -89883,8 +90171,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
89883
90171
|
'fetchDepositAddress': false,
|
|
89884
90172
|
'fetchDeposits': true,
|
|
89885
90173
|
'fetchDepositsWithdrawals': true,
|
|
89886
|
-
'fetchLedger': true,
|
|
89887
90174
|
'fetchFundingRate': false,
|
|
90175
|
+
'fetchLedger': true,
|
|
89888
90176
|
'fetchMarginMode': false,
|
|
89889
90177
|
'fetchMarkets': true,
|
|
89890
90178
|
'fetchMyTrades': true,
|
|
@@ -96086,11 +96374,17 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96086
96374
|
* @name coinex#fetchPositions
|
|
96087
96375
|
* @description fetch all open positions
|
|
96088
96376
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
|
96089
|
-
* @
|
|
96377
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
|
|
96378
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
96090
96379
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
96380
|
+
* @param {string} [params.method] the method to use 'perpetualPrivateGetPositionPending' or 'perpetualPrivateGetPositionFinished' default is 'perpetualPrivateGetPositionPending'
|
|
96381
|
+
* @param {int} [params.side] *history endpoint only* 0: All, 1: Sell, 2: Buy, default is 0
|
|
96091
96382
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
96092
96383
|
*/
|
|
96093
96384
|
await this.loadMarkets();
|
|
96385
|
+
let defaultMethod = undefined;
|
|
96386
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'perpetualPrivateGetPositionPending');
|
|
96387
|
+
const isHistory = (defaultMethod === 'perpetualPrivateGetPositionFinished');
|
|
96094
96388
|
symbols = this.marketSymbols(symbols);
|
|
96095
96389
|
const request = {};
|
|
96096
96390
|
let market = undefined;
|
|
@@ -96109,7 +96403,22 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96109
96403
|
market = this.market(symbol);
|
|
96110
96404
|
request['market'] = market['id'];
|
|
96111
96405
|
}
|
|
96112
|
-
|
|
96406
|
+
else {
|
|
96407
|
+
if (isHistory) {
|
|
96408
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchPositions() requires a symbol argument for closed positions');
|
|
96409
|
+
}
|
|
96410
|
+
}
|
|
96411
|
+
if (isHistory) {
|
|
96412
|
+
request['limit'] = 100;
|
|
96413
|
+
request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
|
|
96414
|
+
}
|
|
96415
|
+
let response = undefined;
|
|
96416
|
+
if (defaultMethod === 'perpetualPrivateGetPositionPending') {
|
|
96417
|
+
response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
|
|
96418
|
+
}
|
|
96419
|
+
else {
|
|
96420
|
+
response = await this.perpetualPrivateGetPositionFinished(this.extend(request, params));
|
|
96421
|
+
}
|
|
96113
96422
|
//
|
|
96114
96423
|
// {
|
|
96115
96424
|
// "code": 0,
|
|
@@ -191858,12 +192167,26 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191858
192167
|
const request = {
|
|
191859
192168
|
'instId': market['id'],
|
|
191860
192169
|
};
|
|
192170
|
+
let isAlgoOrder = undefined;
|
|
192171
|
+
if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
192172
|
+
isAlgoOrder = true;
|
|
192173
|
+
}
|
|
191861
192174
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
191862
192175
|
if (clientOrderId !== undefined) {
|
|
191863
|
-
|
|
192176
|
+
if (isAlgoOrder) {
|
|
192177
|
+
request['algoClOrdId'] = clientOrderId;
|
|
192178
|
+
}
|
|
192179
|
+
else {
|
|
192180
|
+
request['clOrdId'] = clientOrderId;
|
|
192181
|
+
}
|
|
191864
192182
|
}
|
|
191865
192183
|
else {
|
|
191866
|
-
|
|
192184
|
+
if (isAlgoOrder) {
|
|
192185
|
+
request['algoId'] = id;
|
|
192186
|
+
}
|
|
192187
|
+
else {
|
|
192188
|
+
request['ordId'] = id;
|
|
192189
|
+
}
|
|
191867
192190
|
}
|
|
191868
192191
|
let stopLossTriggerPrice = this.safeValue2(params, 'stopLossPrice', 'newSlTriggerPx');
|
|
191869
192192
|
let stopLossPrice = this.safeValue(params, 'newSlOrdPx');
|
|
@@ -191875,37 +192198,62 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191875
192198
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
191876
192199
|
const stopLossDefined = (stopLoss !== undefined);
|
|
191877
192200
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
191878
|
-
if (
|
|
191879
|
-
|
|
191880
|
-
|
|
191881
|
-
|
|
191882
|
-
|
|
191883
|
-
|
|
191884
|
-
|
|
191885
|
-
|
|
191886
|
-
|
|
191887
|
-
|
|
191888
|
-
|
|
191889
|
-
|
|
191890
|
-
|
|
191891
|
-
|
|
191892
|
-
|
|
191893
|
-
|
|
191894
|
-
|
|
191895
|
-
|
|
191896
|
-
|
|
191897
|
-
|
|
191898
|
-
|
|
191899
|
-
|
|
191900
|
-
|
|
191901
|
-
|
|
191902
|
-
|
|
192201
|
+
if (isAlgoOrder) {
|
|
192202
|
+
if ((stopLossTriggerPrice === undefined) && (takeProfitTriggerPrice === undefined)) {
|
|
192203
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a stopLossPrice or takeProfitPrice parameter for editing an algo order');
|
|
192204
|
+
}
|
|
192205
|
+
if (stopLossTriggerPrice !== undefined) {
|
|
192206
|
+
if (stopLossPrice === undefined) {
|
|
192207
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a newSlOrdPx parameter for editing an algo order');
|
|
192208
|
+
}
|
|
192209
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
192210
|
+
request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
192211
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
192212
|
+
}
|
|
192213
|
+
if (takeProfitTriggerPrice !== undefined) {
|
|
192214
|
+
if (takeProfitPrice === undefined) {
|
|
192215
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a newTpOrdPx parameter for editing an algo order');
|
|
192216
|
+
}
|
|
192217
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
192218
|
+
request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
192219
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
192220
|
+
}
|
|
192221
|
+
}
|
|
192222
|
+
else {
|
|
192223
|
+
if (stopLossTriggerPrice !== undefined) {
|
|
192224
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
192225
|
+
request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
192226
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
192227
|
+
}
|
|
192228
|
+
if (takeProfitTriggerPrice !== undefined) {
|
|
192229
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
192230
|
+
request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
192231
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
192232
|
+
}
|
|
192233
|
+
if (stopLossDefined) {
|
|
192234
|
+
stopLossTriggerPrice = this.safeValue(stopLoss, 'triggerPrice');
|
|
192235
|
+
stopLossPrice = this.safeValue(stopLoss, 'price');
|
|
192236
|
+
const stopLossType = this.safeString(stopLoss, 'type');
|
|
192237
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
192238
|
+
request['newSlOrdPx'] = (stopLossType === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
192239
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
192240
|
+
}
|
|
192241
|
+
if (takeProfitDefined) {
|
|
192242
|
+
takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
|
|
192243
|
+
takeProfitPrice = this.safeValue(takeProfit, 'price');
|
|
192244
|
+
const takeProfitType = this.safeString(takeProfit, 'type');
|
|
192245
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
192246
|
+
request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
192247
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
192248
|
+
}
|
|
191903
192249
|
}
|
|
191904
192250
|
if (amount !== undefined) {
|
|
191905
192251
|
request['newSz'] = this.amountToPrecision(symbol, amount);
|
|
191906
192252
|
}
|
|
191907
|
-
if (
|
|
191908
|
-
|
|
192253
|
+
if (!isAlgoOrder) {
|
|
192254
|
+
if (price !== undefined) {
|
|
192255
|
+
request['newPx'] = this.priceToPrecision(symbol, price);
|
|
192256
|
+
}
|
|
191909
192257
|
}
|
|
191910
192258
|
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
|
|
191911
192259
|
return this.extend(request, params);
|
|
@@ -191915,7 +192263,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191915
192263
|
* @method
|
|
191916
192264
|
* @name okx#editOrder
|
|
191917
192265
|
* @description edit a trade order
|
|
191918
|
-
* @see https://www.okx.com/docs-v5/en/#
|
|
192266
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
192267
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
191919
192268
|
* @param {string} id order id
|
|
191920
192269
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
191921
192270
|
* @param {string} type 'market' or 'limit'
|
|
@@ -191943,7 +192292,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191943
192292
|
await this.loadMarkets();
|
|
191944
192293
|
const market = this.market(symbol);
|
|
191945
192294
|
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
191946
|
-
|
|
192295
|
+
let isAlgoOrder = undefined;
|
|
192296
|
+
if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
192297
|
+
isAlgoOrder = true;
|
|
192298
|
+
}
|
|
192299
|
+
let response = undefined;
|
|
192300
|
+
if (isAlgoOrder) {
|
|
192301
|
+
response = await this.privatePostTradeAmendAlgos(this.extend(request, params));
|
|
192302
|
+
}
|
|
192303
|
+
else {
|
|
192304
|
+
response = await this.privatePostTradeAmendOrder(this.extend(request, params));
|
|
192305
|
+
}
|
|
191947
192306
|
//
|
|
191948
192307
|
// {
|
|
191949
192308
|
// "code": "0",
|
|
@@ -203682,8 +204041,10 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
203682
204041
|
* @description fetch all open positions
|
|
203683
204042
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
|
|
203684
204043
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
|
|
203685
|
-
* @
|
|
204044
|
+
* @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
|
|
204045
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
203686
204046
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
204047
|
+
* @param {string} [param.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
|
|
203687
204048
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
203688
204049
|
*/
|
|
203689
204050
|
await this.loadMarkets();
|
|
@@ -203718,7 +204079,14 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
203718
204079
|
};
|
|
203719
204080
|
let response = undefined;
|
|
203720
204081
|
if (isUSDTSettled) {
|
|
203721
|
-
|
|
204082
|
+
let method = undefined;
|
|
204083
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'privateGetGAccountsAccountPositions');
|
|
204084
|
+
if (method === 'privateGetGAccountsAccountPositions') {
|
|
204085
|
+
response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
|
|
204086
|
+
}
|
|
204087
|
+
else {
|
|
204088
|
+
response = await this.privateGetAccountsPositions(this.extend(request, params));
|
|
204089
|
+
}
|
|
203722
204090
|
}
|
|
203723
204091
|
else {
|
|
203724
204092
|
response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
|
|
@@ -203894,7 +204262,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
203894
204262
|
const contracts = this.safeString(position, 'size');
|
|
203895
204263
|
const contractSize = this.safeValue(market, 'contractSize');
|
|
203896
204264
|
const contractSizeString = this.numberToString(contractSize);
|
|
203897
|
-
const leverage = this.
|
|
204265
|
+
const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.safeString2(position, 'leverage', 'leverageRr'))));
|
|
203898
204266
|
const entryPriceString = this.safeString2(position, 'avgEntryPrice', 'avgEntryPriceRp');
|
|
203899
204267
|
const rawSide = this.safeString(position, 'side');
|
|
203900
204268
|
let side = undefined;
|
|
@@ -204921,6 +205289,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
204921
205289
|
'fetchDepositsWithdrawals': true,
|
|
204922
205290
|
'fetchDepositWithdrawFee': 'emulated',
|
|
204923
205291
|
'fetchDepositWithdrawFees': true,
|
|
205292
|
+
'fetchFundingRate': false,
|
|
204924
205293
|
'fetchMarginMode': false,
|
|
204925
205294
|
'fetchMarkets': true,
|
|
204926
205295
|
'fetchMyTrades': true,
|
|
@@ -204931,7 +205300,6 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
204931
205300
|
'fetchOrder': true,
|
|
204932
205301
|
'fetchOrderBook': true,
|
|
204933
205302
|
'fetchOrderBooks': false,
|
|
204934
|
-
'fetchFundingRate': false,
|
|
204935
205303
|
'fetchOrderTrades': true,
|
|
204936
205304
|
'fetchPosition': false,
|
|
204937
205305
|
'fetchPositionMode': false,
|
|
@@ -211770,7 +212138,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
211770
212138
|
}
|
|
211771
212139
|
else {
|
|
211772
212140
|
// take the timestamp of the closing price for candlestick streams
|
|
211773
|
-
timestamp = this.
|
|
212141
|
+
timestamp = this.safeInteger2(message, 'C', 'E');
|
|
211774
212142
|
}
|
|
211775
212143
|
const marketId = this.safeString(message, 's');
|
|
211776
212144
|
const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
|
|
@@ -221416,7 +221784,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221416
221784
|
'has': {
|
|
221417
221785
|
'ws': true,
|
|
221418
221786
|
'watchBalance': true,
|
|
221419
|
-
'watchMyTrades':
|
|
221787
|
+
'watchMyTrades': true,
|
|
221420
221788
|
'watchOHLCV': false,
|
|
221421
221789
|
'watchOrderBook': true,
|
|
221422
221790
|
'watchOrders': false,
|
|
@@ -221577,6 +221945,150 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221577
221945
|
this.trades[symbol] = tradesCache;
|
|
221578
221946
|
client.resolve(tradesCache, messageHash);
|
|
221579
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
|
+
}
|
|
221580
222092
|
async watchTicker(symbol, params = {}) {
|
|
221581
222093
|
/**
|
|
221582
222094
|
* @method
|
|
@@ -221719,6 +222231,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221719
222231
|
'TICKER': this.handleTicker,
|
|
221720
222232
|
'ORDER_BOOK': this.handleOrderBook,
|
|
221721
222233
|
'ACCOUNT_BALANCE': this.handleBalance,
|
|
222234
|
+
'USER_TRADE': this.handleMyTrade,
|
|
221722
222235
|
};
|
|
221723
222236
|
const event = this.safeString(message, 'event');
|
|
221724
222237
|
const method = this.safeValue(methods, event);
|
|
@@ -236756,6 +237269,12 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
236756
237269
|
'private': 'wss://api.hitbtc.com/api/3/ws/trading',
|
|
236757
237270
|
},
|
|
236758
237271
|
},
|
|
237272
|
+
'test': {
|
|
237273
|
+
'ws': {
|
|
237274
|
+
'public': 'wss://api.demo.hitbtc.com/api/3/ws/public',
|
|
237275
|
+
'private': 'wss://api.demo.hitbtc.com/api/3/ws/trading',
|
|
237276
|
+
},
|
|
237277
|
+
},
|
|
236759
237278
|
},
|
|
236760
237279
|
'options': {
|
|
236761
237280
|
'tradesLimit': 1000,
|
|
@@ -252202,13 +252721,15 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
252202
252721
|
/**
|
|
252203
252722
|
* @method
|
|
252204
252723
|
* @name okx#watchMyTrades
|
|
252205
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
252206
252724
|
* @description watches information on multiple trades made by the user
|
|
252725
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
252207
252726
|
* @param {string} [symbol] unified market symbol of the market trades were made in
|
|
252208
252727
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
252209
252728
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
252210
252729
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
252211
252730
|
* @param {bool} [params.stop] true if fetching trigger or conditional trades
|
|
252731
|
+
* @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
|
|
252732
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
|
|
252212
252733
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
|
|
252213
252734
|
*/
|
|
252214
252735
|
// By default, receive order updates from any instrument type
|
|
@@ -252230,7 +252751,14 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
252230
252751
|
if (type === 'future') {
|
|
252231
252752
|
type = 'futures';
|
|
252232
252753
|
}
|
|
252233
|
-
|
|
252754
|
+
let uppercaseType = type.toUpperCase();
|
|
252755
|
+
let marginMode = undefined;
|
|
252756
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchMyTrades', params);
|
|
252757
|
+
if (uppercaseType === 'SPOT') {
|
|
252758
|
+
if (marginMode !== undefined) {
|
|
252759
|
+
uppercaseType = 'MARGIN';
|
|
252760
|
+
}
|
|
252761
|
+
}
|
|
252234
252762
|
const request = {
|
|
252235
252763
|
'instType': uppercaseType,
|
|
252236
252764
|
};
|
|
@@ -252376,7 +252904,6 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
252376
252904
|
*/
|
|
252377
252905
|
let type = undefined;
|
|
252378
252906
|
// By default, receive order updates from any instrument type
|
|
252379
|
-
[type, params] = this.handleOptionAndParams(params, 'watchOrders', 'defaultType');
|
|
252380
252907
|
[type, params] = this.handleOptionAndParams(params, 'watchOrders', 'type', 'ANY');
|
|
252381
252908
|
const isStop = this.safeValue2(params, 'stop', 'trigger', false);
|
|
252382
252909
|
params = this.omit(params, ['stop', 'trigger']);
|
|
@@ -296581,7 +297108,7 @@ SOFTWARE.
|
|
|
296581
297108
|
|
|
296582
297109
|
//-----------------------------------------------------------------------------
|
|
296583
297110
|
// this is updated by vss.js when building
|
|
296584
|
-
const version = '4.2.
|
|
297111
|
+
const version = '4.2.24';
|
|
296585
297112
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
296586
297113
|
//-----------------------------------------------------------------------------
|
|
296587
297114
|
|