ccxt 4.1.59 → 4.1.60
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 +261 -214
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +7 -7
- package/dist/cjs/src/base/ws/Client.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/coinbasepro.js +15 -0
- package/dist/cjs/src/kucoin.js +126 -128
- package/dist/cjs/src/mexc.js +18 -13
- package/dist/cjs/src/okx.js +15 -1
- package/dist/cjs/src/pro/htx.js +70 -56
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +2 -2
- package/js/src/base/Exchange.js +7 -7
- package/js/src/base/ws/Client.js +1 -1
- package/js/src/binance.js +1 -0
- package/js/src/coinbasepro.js +15 -0
- package/js/src/kucoin.js +126 -128
- package/js/src/mexc.js +18 -13
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +15 -1
- package/js/src/pro/htx.d.ts +2 -2
- package/js/src/pro/htx.js +70 -56
- package/package.json +1 -1
- package/skip-tests.json +0 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -7119,7 +7119,7 @@ class Exchange {
|
|
|
7119
7119
|
'fetchPermissions': undefined,
|
|
7120
7120
|
'fetchPosition': undefined,
|
|
7121
7121
|
'fetchPositions': undefined,
|
|
7122
|
-
'
|
|
7122
|
+
'fetchPositionsForSymbol': undefined,
|
|
7123
7123
|
'fetchPositionsRisk': undefined,
|
|
7124
7124
|
'fetchPremiumIndexOHLCV': undefined,
|
|
7125
7125
|
'fetchStatus': 'emulated',
|
|
@@ -9729,16 +9729,16 @@ class Exchange {
|
|
|
9729
9729
|
async watchPositionForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9730
9730
|
return this.watchPositions(symbols, since, limit, params);
|
|
9731
9731
|
}
|
|
9732
|
-
async
|
|
9732
|
+
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
9733
9733
|
/**
|
|
9734
9734
|
* @method
|
|
9735
|
-
* @name exchange#
|
|
9736
|
-
* @description
|
|
9737
|
-
* @param {string} symbol unified market symbol
|
|
9735
|
+
* @name exchange#fetchPositionsForSymbol
|
|
9736
|
+
* @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for ony-market purposes, because of less rate-limit consumption and speed
|
|
9737
|
+
* @param {string} symbol unified market symbol
|
|
9738
9738
|
* @param {object} params extra parameters specific to the endpoint
|
|
9739
|
-
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - one position for "one-way" mode, and two positions (long & short) for "two-way" (a.k.a. hedge) mode
|
|
9739
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
|
|
9740
9740
|
*/
|
|
9741
|
-
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + '
|
|
9741
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
|
|
9742
9742
|
}
|
|
9743
9743
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
9744
9744
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositions() is not supported yet');
|
|
@@ -13656,8 +13656,8 @@ class ArrayCacheBySymbolBySide extends ArrayCache {
|
|
|
13656
13656
|
/* harmony import */ var _static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7348);
|
|
13657
13657
|
/* harmony import */ var _Future_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2367);
|
|
13658
13658
|
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(927);
|
|
13659
|
-
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
13660
|
-
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
|
|
13659
|
+
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1621);
|
|
13660
|
+
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9125);
|
|
13661
13661
|
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1237);
|
|
13662
13662
|
/* harmony import */ var _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9651);
|
|
13663
13663
|
|
|
@@ -13766,7 +13766,7 @@ class Client {
|
|
|
13766
13766
|
if (!this.isOpen()) {
|
|
13767
13767
|
const error = new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout('Connection to ' + this.url + ' failed due to a connection timeout');
|
|
13768
13768
|
this.onError(error);
|
|
13769
|
-
this.connection.close(
|
|
13769
|
+
this.connection.close(1006);
|
|
13770
13770
|
}
|
|
13771
13771
|
}
|
|
13772
13772
|
setConnectionTimeout() {
|
|
@@ -13793,7 +13793,7 @@ class Client {
|
|
|
13793
13793
|
}
|
|
13794
13794
|
onPingInterval() {
|
|
13795
13795
|
if (this.keepAlive && this.isOpen()) {
|
|
13796
|
-
const now = (0,
|
|
13796
|
+
const now = (0,_base_functions_js__WEBPACK_IMPORTED_MODULE_4__/* .milliseconds */ .m)();
|
|
13797
13797
|
this.lastPong = this.lastPong || now;
|
|
13798
13798
|
if ((this.lastPong + this.keepAlive * this.maxPingPongMisses) < now) {
|
|
13799
13799
|
this.onError(new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout('Connection to ' + this.url + ' timed out due to a ping-pong keepalive missing on time'));
|
|
@@ -13802,7 +13802,7 @@ class Client {
|
|
|
13802
13802
|
if (this.ping) {
|
|
13803
13803
|
this.send(this.ping(this));
|
|
13804
13804
|
}
|
|
13805
|
-
else if (
|
|
13805
|
+
else if (_base_functions_js__WEBPACK_IMPORTED_MODULE_5__/* .isNode */ .UG) {
|
|
13806
13806
|
// can't do this inside browser
|
|
13807
13807
|
// https://stackoverflow.com/questions/10585355/sending-websocket-ping-pong-frame-from-browser
|
|
13808
13808
|
this.connection.ping();
|
|
@@ -13821,7 +13821,7 @@ class Client {
|
|
|
13821
13821
|
if (this.verbose) {
|
|
13822
13822
|
this.log(new Date(), 'onOpen');
|
|
13823
13823
|
}
|
|
13824
|
-
this.connectionEstablished = (0,
|
|
13824
|
+
this.connectionEstablished = (0,_base_functions_js__WEBPACK_IMPORTED_MODULE_4__/* .milliseconds */ .m)();
|
|
13825
13825
|
this.isConnected = true;
|
|
13826
13826
|
this.connected.resolve(this.url);
|
|
13827
13827
|
// this.connection.terminate () // debugging
|
|
@@ -13838,7 +13838,7 @@ class Client {
|
|
|
13838
13838
|
}
|
|
13839
13839
|
}
|
|
13840
13840
|
onPong() {
|
|
13841
|
-
this.lastPong = (0,
|
|
13841
|
+
this.lastPong = (0,_base_functions_js__WEBPACK_IMPORTED_MODULE_4__/* .milliseconds */ .m)();
|
|
13842
13842
|
if (this.verbose) {
|
|
13843
13843
|
this.log(new Date(), 'onPong');
|
|
13844
13844
|
}
|
|
@@ -13881,7 +13881,7 @@ class Client {
|
|
|
13881
13881
|
}
|
|
13882
13882
|
message = (typeof message === 'string') ? message : JSON.stringify(message);
|
|
13883
13883
|
const future = (0,_Future_js__WEBPACK_IMPORTED_MODULE_2__/* .createFuture */ .N)();
|
|
13884
|
-
if (
|
|
13884
|
+
if (_base_functions_js__WEBPACK_IMPORTED_MODULE_5__/* .isNode */ .UG) {
|
|
13885
13885
|
function onSendComplete(error) {
|
|
13886
13886
|
if (error) {
|
|
13887
13887
|
future.reject(error);
|
|
@@ -16709,6 +16709,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
16709
16709
|
'margin/capital-flow': 10,
|
|
16710
16710
|
'margin/delist-schedule': 10,
|
|
16711
16711
|
'margin/available-inventory': 0.3334,
|
|
16712
|
+
'margin/leverageBracket': 0.1,
|
|
16712
16713
|
'loan/vip/loanable/data': 40,
|
|
16713
16714
|
'loan/vip/collateral/data': 40,
|
|
16714
16715
|
'loan/vip/request/data': 2.6668,
|
|
@@ -86791,6 +86792,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
86791
86792
|
* @method
|
|
86792
86793
|
* @name coinbasepro#fetchCurrencies
|
|
86793
86794
|
* @description fetches all available currencies on an exchange
|
|
86795
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getcurrencies
|
|
86794
86796
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
86795
86797
|
* @returns {object} an associative dictionary of currencies
|
|
86796
86798
|
*/
|
|
@@ -86861,6 +86863,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
86861
86863
|
* @method
|
|
86862
86864
|
* @name coinbasepro#fetchMarkets
|
|
86863
86865
|
* @description retrieves data on all markets for coinbasepro
|
|
86866
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducts
|
|
86864
86867
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
86865
86868
|
* @returns {object[]} an array of objects representing market data
|
|
86866
86869
|
*/
|
|
@@ -86981,6 +86984,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
86981
86984
|
* @method
|
|
86982
86985
|
* @name coinbasepro#fetchAccounts
|
|
86983
86986
|
* @description fetch all the accounts associated with a profile
|
|
86987
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts
|
|
86984
86988
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
86985
86989
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
86986
86990
|
*/
|
|
@@ -87046,6 +87050,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87046
87050
|
* @method
|
|
87047
87051
|
* @name coinbasepro#fetchBalance
|
|
87048
87052
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
87053
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts
|
|
87049
87054
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
87050
87055
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
87051
87056
|
*/
|
|
@@ -87178,6 +87183,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87178
87183
|
* @method
|
|
87179
87184
|
* @name coinbasepro#fetchTickers
|
|
87180
87185
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
87186
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproduct
|
|
87181
87187
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
87182
87188
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
87183
87189
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -87413,6 +87419,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87413
87419
|
* @method
|
|
87414
87420
|
* @name coinbasepro#fetchTradingFees
|
|
87415
87421
|
* @description fetch the trading fees for multiple markets
|
|
87422
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfees
|
|
87416
87423
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
87417
87424
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
87418
87425
|
*/
|
|
@@ -87911,6 +87918,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87911
87918
|
* @method
|
|
87912
87919
|
* @name coinbasepro#deposit
|
|
87913
87920
|
* @description Creates a new deposit address, as required by coinbasepro
|
|
87921
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositpaymentmethod
|
|
87922
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositcoinbaseaccount
|
|
87914
87923
|
* @param {string} code Unified CCXT currency code (e.g. `"USDT"`)
|
|
87915
87924
|
* @param {float} amount The amount of currency to send in the deposit (e.g. `20`)
|
|
87916
87925
|
* @param {string} address Not used by coinbasepro
|
|
@@ -87952,6 +87961,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
87952
87961
|
* @method
|
|
87953
87962
|
* @name coinbasepro#withdraw
|
|
87954
87963
|
* @description make a withdrawal
|
|
87964
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawpaymentmethod
|
|
87965
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawcoinbaseaccount
|
|
87955
87966
|
* @param {string} code unified currency code
|
|
87956
87967
|
* @param {float} amount the amount to withdraw
|
|
87957
87968
|
* @param {string} address the address to withdraw to
|
|
@@ -88235,6 +88246,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
88235
88246
|
* @method
|
|
88236
88247
|
* @name coinbasepro#fetchDeposits
|
|
88237
88248
|
* @description fetch all deposits made to an account
|
|
88249
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
|
|
88250
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers
|
|
88238
88251
|
* @param {string} code unified currency code
|
|
88239
88252
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
88240
88253
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -88248,6 +88261,8 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
88248
88261
|
* @method
|
|
88249
88262
|
* @name coinbasepro#fetchWithdrawals
|
|
88250
88263
|
* @description fetch all withdrawals made from an account
|
|
88264
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
|
|
88265
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers
|
|
88251
88266
|
* @param {string} code unified currency code
|
|
88252
88267
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
88253
88268
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -88358,6 +88373,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
88358
88373
|
* @method
|
|
88359
88374
|
* @name coinbasepro#createDepositAddress
|
|
88360
88375
|
* @description create a currency deposit address
|
|
88376
|
+
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
|
|
88361
88377
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
88362
88378
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
88363
88379
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -155202,17 +155218,20 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155202
155218
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' cancelAllOrders does not support isolated margin for stop orders');
|
|
155203
155219
|
}
|
|
155204
155220
|
}
|
|
155205
|
-
let
|
|
155221
|
+
let response = undefined;
|
|
155206
155222
|
if (stop) {
|
|
155207
|
-
|
|
155223
|
+
response = await this.privateDeleteStopOrderCancel(this.extend(request, query));
|
|
155208
155224
|
}
|
|
155209
155225
|
else if (hf) {
|
|
155210
155226
|
if (symbol === undefined) {
|
|
155211
155227
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol parameter for hf orders');
|
|
155212
155228
|
}
|
|
155213
|
-
|
|
155229
|
+
response = await this.privateDeleteHfOrders(this.extend(request, query));
|
|
155230
|
+
}
|
|
155231
|
+
else {
|
|
155232
|
+
response = await this.privateDeleteOrders(this.extend(request, query));
|
|
155214
155233
|
}
|
|
155215
|
-
return
|
|
155234
|
+
return response;
|
|
155216
155235
|
}
|
|
155217
155236
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
155218
155237
|
/**
|
|
@@ -155269,20 +155288,22 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155269
155288
|
if (until) {
|
|
155270
155289
|
request['endAt'] = until;
|
|
155271
155290
|
}
|
|
155272
|
-
|
|
155291
|
+
request['tradeType'] = this.safeString(this.options['marginModes'], marginMode, 'TRADE');
|
|
155292
|
+
let response = undefined;
|
|
155273
155293
|
if (stop) {
|
|
155274
|
-
|
|
155294
|
+
response = await this.privateGetStopOrder(this.extend(request, query));
|
|
155275
155295
|
}
|
|
155276
155296
|
else if (hf) {
|
|
155277
155297
|
if (lowercaseStatus === 'active') {
|
|
155278
|
-
|
|
155298
|
+
response = await this.privateGetHfOrdersActive(this.extend(request, query));
|
|
155279
155299
|
}
|
|
155280
155300
|
else if (lowercaseStatus === 'done') {
|
|
155281
|
-
|
|
155301
|
+
response = await this.privateGetHfOrdersDone(this.extend(request, query));
|
|
155282
155302
|
}
|
|
155283
155303
|
}
|
|
155284
|
-
|
|
155285
|
-
|
|
155304
|
+
else {
|
|
155305
|
+
response = await this.privateGetOrders(this.extend(request, query));
|
|
155306
|
+
}
|
|
155286
155307
|
//
|
|
155287
155308
|
// {
|
|
155288
155309
|
// "code": "200000",
|
|
@@ -155427,21 +155448,21 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155427
155448
|
}
|
|
155428
155449
|
request['symbol'] = market['id'];
|
|
155429
155450
|
}
|
|
155430
|
-
params = this.omit(params, ['stop', 'hf']);
|
|
155431
|
-
let
|
|
155451
|
+
params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId']);
|
|
155452
|
+
let response = undefined;
|
|
155432
155453
|
if (clientOrderId !== undefined) {
|
|
155433
155454
|
request['clientOid'] = clientOrderId;
|
|
155434
155455
|
if (stop) {
|
|
155435
|
-
method = 'privateGetStopOrderQueryOrderByClientOid';
|
|
155436
155456
|
if (symbol !== undefined) {
|
|
155437
155457
|
request['symbol'] = market['id'];
|
|
155438
155458
|
}
|
|
155459
|
+
response = await this.privateGetStopOrderQueryOrderByClientOid(this.extend(request, params));
|
|
155439
155460
|
}
|
|
155440
155461
|
else if (hf) {
|
|
155441
|
-
|
|
155462
|
+
response = await this.privateGetHfOrdersClientOrderClientOid(this.extend(request, params));
|
|
155442
155463
|
}
|
|
155443
155464
|
else {
|
|
155444
|
-
|
|
155465
|
+
response = await this.privateGetOrderClientOrderClientOid(this.extend(request, params));
|
|
155445
155466
|
}
|
|
155446
155467
|
}
|
|
155447
155468
|
else {
|
|
@@ -155451,18 +155472,19 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155451
155472
|
if (id === undefined) {
|
|
155452
155473
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' fetchOrder() requires an order id');
|
|
155453
155474
|
}
|
|
155475
|
+
request['orderId'] = id;
|
|
155454
155476
|
if (stop) {
|
|
155455
|
-
|
|
155477
|
+
response = await this.privateGetStopOrderOrderId(this.extend(request, params));
|
|
155456
155478
|
}
|
|
155457
155479
|
else if (hf) {
|
|
155458
|
-
|
|
155480
|
+
response = await this.privateGetHfOrdersOrderId(this.extend(request, params));
|
|
155481
|
+
}
|
|
155482
|
+
else {
|
|
155483
|
+
response = await this.privateGetOrdersOrderId(this.extend(request, params));
|
|
155459
155484
|
}
|
|
155460
|
-
request['orderId'] = id;
|
|
155461
155485
|
}
|
|
155462
|
-
params = this.omit(params, ['clientOid', 'clientOrderId']);
|
|
155463
|
-
const response = await this[method](this.extend(request, params));
|
|
155464
155486
|
let responseData = this.safeValue(response, 'data');
|
|
155465
|
-
if (
|
|
155487
|
+
if (Array.isArray(responseData)) {
|
|
155466
155488
|
responseData = this.safeValue(responseData, 0);
|
|
155467
155489
|
}
|
|
155468
155490
|
return this.parseOrder(responseData, market);
|
|
@@ -155704,10 +155726,12 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155704
155726
|
if (limit !== undefined) {
|
|
155705
155727
|
request['pageSize'] = limit;
|
|
155706
155728
|
}
|
|
155707
|
-
|
|
155729
|
+
const method = this.options['fetchMyTradesMethod'];
|
|
155708
155730
|
let parseResponseData = false;
|
|
155731
|
+
let response = undefined;
|
|
155732
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
155709
155733
|
if (hf) {
|
|
155710
|
-
|
|
155734
|
+
response = await this.privateGetHfFills(this.extend(request, params));
|
|
155711
155735
|
}
|
|
155712
155736
|
else if (method === 'private_get_fills') {
|
|
155713
155737
|
// does not return trades earlier than 2019-02-18T00:00:00Z
|
|
@@ -155715,26 +155739,18 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155715
155739
|
// only returns trades up to one week after the since param
|
|
155716
155740
|
request['startAt'] = since;
|
|
155717
155741
|
}
|
|
155742
|
+
response = await this.privateGetFills(this.extend(request, params));
|
|
155718
155743
|
}
|
|
155719
155744
|
else if (method === 'private_get_limit_fills') {
|
|
155720
155745
|
// does not return trades earlier than 2019-02-18T00:00:00Z
|
|
155721
155746
|
// takes no params
|
|
155722
155747
|
// only returns first 1000 trades (not only "in the last 24 hours" as stated in the docs)
|
|
155723
155748
|
parseResponseData = true;
|
|
155724
|
-
|
|
155725
|
-
else if (method === 'private_get_hist_orders') {
|
|
155726
|
-
// despite that this endpoint is called `HistOrders`
|
|
155727
|
-
// it returns historical trades instead of orders
|
|
155728
|
-
// returns trades earlier than 2019-02-18T00:00:00Z only
|
|
155729
|
-
if (since !== undefined) {
|
|
155730
|
-
request['startAt'] = this.parseToInt(since / 1000);
|
|
155731
|
-
}
|
|
155749
|
+
response = await this.privateGetLimitFills(this.extend(request, params));
|
|
155732
155750
|
}
|
|
155733
155751
|
else {
|
|
155734
155752
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
|
|
155735
155753
|
}
|
|
155736
|
-
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
155737
|
-
const response = await this[method](this.extend(request, params));
|
|
155738
155754
|
//
|
|
155739
155755
|
// {
|
|
155740
155756
|
// "currentPage": 1,
|
|
@@ -156177,8 +156193,6 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156177
156193
|
/**
|
|
156178
156194
|
* @method
|
|
156179
156195
|
* @name kucoin#fetchDeposits
|
|
156180
|
-
* @see https://docs.kucoin.com/#get-deposit-list
|
|
156181
|
-
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
156182
156196
|
* @description fetch all deposits made to an account
|
|
156183
156197
|
* @see https://docs.kucoin.com/#get-deposit-list
|
|
156184
156198
|
* @see https://docs.kucoin.com/#get-v1-historical-deposits-list
|
|
@@ -156205,19 +156219,19 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156205
156219
|
if (limit !== undefined) {
|
|
156206
156220
|
request['pageSize'] = limit;
|
|
156207
156221
|
}
|
|
156208
|
-
|
|
156209
|
-
|
|
156222
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156223
|
+
let response = undefined;
|
|
156224
|
+
if (since !== undefined && since < 1550448000000) {
|
|
156210
156225
|
// if since is earlier than 2019-02-18T00:00:00Z
|
|
156211
|
-
|
|
156212
|
-
|
|
156213
|
-
|
|
156214
|
-
|
|
156215
|
-
|
|
156226
|
+
request['startAt'] = this.parseToInt(since / 1000);
|
|
156227
|
+
response = await this.privateGetHistDeposits(this.extend(request, params));
|
|
156228
|
+
}
|
|
156229
|
+
else {
|
|
156230
|
+
if (since !== undefined) {
|
|
156216
156231
|
request['startAt'] = since;
|
|
156217
156232
|
}
|
|
156233
|
+
response = await this.privateGetDeposits(this.extend(request, params));
|
|
156218
156234
|
}
|
|
156219
|
-
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156220
|
-
const response = await this[method](this.extend(request, params));
|
|
156221
156235
|
//
|
|
156222
156236
|
// {
|
|
156223
156237
|
// "code": "200000",
|
|
@@ -156289,19 +156303,19 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156289
156303
|
if (limit !== undefined) {
|
|
156290
156304
|
request['pageSize'] = limit;
|
|
156291
156305
|
}
|
|
156292
|
-
|
|
156293
|
-
|
|
156306
|
+
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156307
|
+
let response = undefined;
|
|
156308
|
+
if (since !== undefined && since < 1550448000000) {
|
|
156294
156309
|
// if since is earlier than 2019-02-18T00:00:00Z
|
|
156295
|
-
|
|
156296
|
-
|
|
156297
|
-
|
|
156298
|
-
|
|
156299
|
-
|
|
156310
|
+
request['startAt'] = this.parseToInt(since / 1000);
|
|
156311
|
+
response = await this.privateGetHistWithdrawals(this.extend(request, params));
|
|
156312
|
+
}
|
|
156313
|
+
else {
|
|
156314
|
+
if (since !== undefined) {
|
|
156300
156315
|
request['startAt'] = since;
|
|
156301
156316
|
}
|
|
156317
|
+
response = await this.privateGetWithdrawals(this.extend(request, params));
|
|
156302
156318
|
}
|
|
156303
|
-
[request, params] = this.handleUntilOption('endAt', request, params);
|
|
156304
|
-
const response = await this[method](this.extend(request, params));
|
|
156305
156319
|
//
|
|
156306
156320
|
// {
|
|
156307
156321
|
// "code": "200000",
|
|
@@ -156378,26 +156392,26 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156378
156392
|
const type = this.safeString(accountsByType, requestedType, requestedType);
|
|
156379
156393
|
params = this.omit(params, 'type');
|
|
156380
156394
|
const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
156381
|
-
let
|
|
156395
|
+
let response = undefined;
|
|
156382
156396
|
const request = {};
|
|
156383
156397
|
const isolated = (marginMode === 'isolated') || (type === 'isolated');
|
|
156384
156398
|
const cross = (marginMode === 'cross') || (type === 'cross');
|
|
156385
156399
|
if (isolated) {
|
|
156386
|
-
method = 'privateGetIsolatedAccounts';
|
|
156387
156400
|
if (currency !== undefined) {
|
|
156388
156401
|
request['balanceCurrency'] = currency['id'];
|
|
156389
156402
|
}
|
|
156403
|
+
response = await this.privateGetIsolatedAccounts(this.extend(request, query));
|
|
156390
156404
|
}
|
|
156391
156405
|
else if (cross) {
|
|
156392
|
-
|
|
156406
|
+
response = await this.privateGetMarginAccount(this.extend(request, query));
|
|
156393
156407
|
}
|
|
156394
156408
|
else {
|
|
156395
156409
|
if (currency !== undefined) {
|
|
156396
156410
|
request['currency'] = currency['id'];
|
|
156397
156411
|
}
|
|
156398
156412
|
request['type'] = type;
|
|
156413
|
+
response = await this.privateGetAccounts(this.extend(request, query));
|
|
156399
156414
|
}
|
|
156400
|
-
const response = await this[method](this.extend(request, query));
|
|
156401
156415
|
//
|
|
156402
156416
|
// Spot and Cross
|
|
156403
156417
|
//
|
|
@@ -156937,43 +156951,37 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156937
156951
|
marginMode = 'cross'; // cross as default marginMode
|
|
156938
156952
|
}
|
|
156939
156953
|
const request = {};
|
|
156940
|
-
let
|
|
156954
|
+
let response = undefined;
|
|
156955
|
+
if (code !== undefined) {
|
|
156956
|
+
const currency = this.currency(code);
|
|
156957
|
+
request['quoteCurrency'] = currency['id'];
|
|
156958
|
+
}
|
|
156941
156959
|
if (marginMode === 'isolated') {
|
|
156942
|
-
|
|
156943
|
-
const currency = this.currency(code);
|
|
156944
|
-
request['balanceCurrency'] = currency['id'];
|
|
156945
|
-
}
|
|
156946
|
-
method = 'privateGetIsolatedAccounts';
|
|
156960
|
+
response = await this.privateGetIsolatedAccounts(this.extend(request, params));
|
|
156947
156961
|
}
|
|
156948
156962
|
else {
|
|
156949
|
-
|
|
156950
|
-
const currency = this.currency(code);
|
|
156951
|
-
request['currency'] = currency['id'];
|
|
156952
|
-
}
|
|
156963
|
+
response = await this.privateGetMarginAccounts(this.extend(request, params));
|
|
156953
156964
|
}
|
|
156954
|
-
const response = await this[method](this.extend(request, params));
|
|
156955
156965
|
//
|
|
156956
156966
|
// Cross
|
|
156957
156967
|
//
|
|
156958
156968
|
// {
|
|
156959
156969
|
// "code": "200000",
|
|
156960
156970
|
// "data": {
|
|
156961
|
-
// "
|
|
156962
|
-
// "
|
|
156963
|
-
// "
|
|
156964
|
-
// "
|
|
156965
|
-
// "
|
|
156971
|
+
// "totalAssetOfQuoteCurrency": "0",
|
|
156972
|
+
// "totalLiabilityOfQuoteCurrency": "0",
|
|
156973
|
+
// "debtRatio": "0",
|
|
156974
|
+
// "status": "EFFECTIVE",
|
|
156975
|
+
// "accounts": [
|
|
156966
156976
|
// {
|
|
156967
|
-
// "
|
|
156968
|
-
// "
|
|
156969
|
-
// "
|
|
156970
|
-
// "
|
|
156971
|
-
// "liability": "
|
|
156972
|
-
// "
|
|
156973
|
-
// "
|
|
156974
|
-
// "
|
|
156975
|
-
// "createdAt": 1658970912000,
|
|
156976
|
-
// "maturityTime": 1659575713000
|
|
156977
|
+
// "currency": "1INCH",
|
|
156978
|
+
// "total": "0",
|
|
156979
|
+
// "available": "0",
|
|
156980
|
+
// "hold": "0",
|
|
156981
|
+
// "liability": "0",
|
|
156982
|
+
// "maxBorrowSize": "0",
|
|
156983
|
+
// "borrowEnabled": true,
|
|
156984
|
+
// "transferInEnabled": true
|
|
156977
156985
|
// }
|
|
156978
156986
|
// ]
|
|
156979
156987
|
// }
|
|
@@ -156988,34 +156996,38 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
156988
156996
|
// "liabilityConversionBalance": "0.01480001",
|
|
156989
156997
|
// "assets": [
|
|
156990
156998
|
// {
|
|
156991
|
-
// "symbol": "
|
|
156992
|
-
// "status": "CLEAR",
|
|
156999
|
+
// "symbol": "MANA-USDT",
|
|
156993
157000
|
// "debtRatio": "0",
|
|
157001
|
+
// "status": "BORROW",
|
|
156994
157002
|
// "baseAsset": {
|
|
156995
|
-
// "currency": "
|
|
156996
|
-
// "
|
|
156997
|
-
// "
|
|
156998
|
-
// "
|
|
156999
|
-
// "
|
|
157000
|
-
// "
|
|
157001
|
-
// "
|
|
157003
|
+
// "currency": "MANA",
|
|
157004
|
+
// "borrowEnabled": true,
|
|
157005
|
+
// "repayEnabled": true,
|
|
157006
|
+
// "transferEnabled": true,
|
|
157007
|
+
// "borrowed": "0",
|
|
157008
|
+
// "totalAsset": "0",
|
|
157009
|
+
// "available": "0",
|
|
157010
|
+
// "hold": "0",
|
|
157011
|
+
// "maxBorrowSize": "1000"
|
|
157002
157012
|
// },
|
|
157003
157013
|
// "quoteAsset": {
|
|
157004
157014
|
// "currency": "USDT",
|
|
157005
|
-
// "
|
|
157006
|
-
// "
|
|
157007
|
-
// "
|
|
157008
|
-
// "
|
|
157009
|
-
// "
|
|
157010
|
-
// "
|
|
157015
|
+
// "borrowEnabled": true,
|
|
157016
|
+
// "repayEnabled": true,
|
|
157017
|
+
// "transferEnabled": true,
|
|
157018
|
+
// "borrowed": "0",
|
|
157019
|
+
// "totalAsset": "0",
|
|
157020
|
+
// "available": "0",
|
|
157021
|
+
// "hold": "0",
|
|
157022
|
+
// "maxBorrowSize": "50000"
|
|
157011
157023
|
// }
|
|
157012
|
-
// }
|
|
157024
|
+
// }
|
|
157013
157025
|
// ]
|
|
157014
157026
|
// }
|
|
157015
157027
|
// }
|
|
157016
157028
|
//
|
|
157017
157029
|
const data = this.safeValue(response, 'data', {});
|
|
157018
|
-
const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, '
|
|
157030
|
+
const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, 'accounts', []);
|
|
157019
157031
|
return this.parseBorrowInterests(assets, undefined);
|
|
157020
157032
|
}
|
|
157021
157033
|
parseBorrowInterest(info, market = undefined) {
|
|
@@ -157023,43 +157035,45 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157023
157035
|
// Cross
|
|
157024
157036
|
//
|
|
157025
157037
|
// {
|
|
157026
|
-
// "
|
|
157027
|
-
// "
|
|
157028
|
-
// "
|
|
157029
|
-
// "
|
|
157030
|
-
// "liability": "
|
|
157031
|
-
// "
|
|
157032
|
-
// "
|
|
157033
|
-
// "
|
|
157034
|
-
//
|
|
157035
|
-
// "maturityTime": 1659575713000
|
|
157036
|
-
// },
|
|
157038
|
+
// "currency": "1INCH",
|
|
157039
|
+
// "total": "0",
|
|
157040
|
+
// "available": "0",
|
|
157041
|
+
// "hold": "0",
|
|
157042
|
+
// "liability": "0",
|
|
157043
|
+
// "maxBorrowSize": "0",
|
|
157044
|
+
// "borrowEnabled": true,
|
|
157045
|
+
// "transferInEnabled": true
|
|
157046
|
+
// }
|
|
157037
157047
|
//
|
|
157038
157048
|
// Isolated
|
|
157039
157049
|
//
|
|
157040
157050
|
// {
|
|
157041
|
-
// "symbol": "
|
|
157042
|
-
// "status": "CLEAR",
|
|
157051
|
+
// "symbol": "MANA-USDT",
|
|
157043
157052
|
// "debtRatio": "0",
|
|
157053
|
+
// "status": "BORROW",
|
|
157044
157054
|
// "baseAsset": {
|
|
157045
|
-
// "currency": "
|
|
157046
|
-
// "
|
|
157047
|
-
// "
|
|
157048
|
-
// "
|
|
157049
|
-
// "
|
|
157050
|
-
// "
|
|
157051
|
-
// "
|
|
157055
|
+
// "currency": "MANA",
|
|
157056
|
+
// "borrowEnabled": true,
|
|
157057
|
+
// "repayEnabled": true,
|
|
157058
|
+
// "transferEnabled": true,
|
|
157059
|
+
// "borrowed": "0",
|
|
157060
|
+
// "totalAsset": "0",
|
|
157061
|
+
// "available": "0",
|
|
157062
|
+
// "hold": "0",
|
|
157063
|
+
// "maxBorrowSize": "1000"
|
|
157052
157064
|
// },
|
|
157053
157065
|
// "quoteAsset": {
|
|
157054
157066
|
// "currency": "USDT",
|
|
157055
|
-
// "
|
|
157056
|
-
// "
|
|
157057
|
-
// "
|
|
157058
|
-
// "
|
|
157059
|
-
// "
|
|
157060
|
-
// "
|
|
157067
|
+
// "borrowEnabled": true,
|
|
157068
|
+
// "repayEnabled": true,
|
|
157069
|
+
// "transferEnabled": true,
|
|
157070
|
+
// "borrowed": "0",
|
|
157071
|
+
// "totalAsset": "0",
|
|
157072
|
+
// "available": "0",
|
|
157073
|
+
// "hold": "0",
|
|
157074
|
+
// "maxBorrowSize": "50000"
|
|
157061
157075
|
// }
|
|
157062
|
-
// }
|
|
157076
|
+
// }
|
|
157063
157077
|
//
|
|
157064
157078
|
const marketId = this.safeString(info, 'symbol');
|
|
157065
157079
|
const marginMode = (marketId === undefined) ? 'cross' : 'isolated';
|
|
@@ -157076,7 +157090,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
157076
157090
|
currencyId = this.safeString(isolatedBase, 'currency');
|
|
157077
157091
|
}
|
|
157078
157092
|
else {
|
|
157079
|
-
amountBorrowed = this.safeNumber(info, '
|
|
157093
|
+
amountBorrowed = this.safeNumber(info, 'liability');
|
|
157080
157094
|
interest = this.safeNumber(info, 'accruedInterest');
|
|
157081
157095
|
currencyId = this.safeString(info, 'currency');
|
|
157082
157096
|
}
|
|
@@ -169978,18 +169992,18 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
169978
169992
|
'networks': {
|
|
169979
169993
|
'BTC': 'BTC',
|
|
169980
169994
|
'BCH': 'BCH',
|
|
169981
|
-
'TRC20': 'TRC20',
|
|
169982
|
-
'ERC20': 'ERC20',
|
|
169983
|
-
'BEP20': 'BEP20
|
|
169984
|
-
'OPTIMISM': 'OP',
|
|
169985
|
-
'SOL': 'SOL',
|
|
169995
|
+
'TRC20': 'Tron(TRC20)',
|
|
169996
|
+
'ERC20': 'Ethereum(ERC20)',
|
|
169997
|
+
'BEP20': 'BNBSmartChain(BEP20)',
|
|
169998
|
+
'OPTIMISM': 'Optimism(OP)',
|
|
169999
|
+
'SOL': 'Solana(SOL)',
|
|
169986
170000
|
'CRC20': 'CRONOS',
|
|
169987
|
-
'ALGO': 'ALGO',
|
|
170001
|
+
'ALGO': 'Algorand(ALGO)',
|
|
169988
170002
|
'XRP': 'XRP',
|
|
169989
|
-
'MATIC': 'MATIC',
|
|
170003
|
+
'MATIC': 'Polygon(MATIC)',
|
|
169990
170004
|
'AVAXX': 'AVAX_XCHAIN',
|
|
169991
|
-
'AVAXC': '
|
|
169992
|
-
'ARBONE': '
|
|
170005
|
+
'AVAXC': 'AvalancheCChain(AVAXCCHAIN)',
|
|
170006
|
+
'ARBONE': 'ArbitrumOne(ARB)',
|
|
169993
170007
|
'ARBNOVA': 'ARBNOVA',
|
|
169994
170008
|
'FTM': 'FTM',
|
|
169995
170009
|
'WAVES': 'WAVES',
|
|
@@ -170574,10 +170588,15 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
170574
170588
|
networkId = parts.join('');
|
|
170575
170589
|
networkId = networkId.replace('-20', '20');
|
|
170576
170590
|
const networksById = {
|
|
170577
|
-
'
|
|
170578
|
-
'
|
|
170579
|
-
'
|
|
170580
|
-
'
|
|
170591
|
+
'Ethereum(ERC20)': 'ERC20',
|
|
170592
|
+
'Algorand(ALGO)': 'ALGO',
|
|
170593
|
+
'ArbitrumOne(ARB)': 'ARBONE',
|
|
170594
|
+
'AvalancheCChain(AVAXCCHAIN)': 'AVAXC',
|
|
170595
|
+
'BNBSmartChain(BEP20)': 'BEP20',
|
|
170596
|
+
'Polygon(MATIC)': 'MATIC',
|
|
170597
|
+
'Optimism(OP)': 'OPTIMISM',
|
|
170598
|
+
'Solana(SOL)': 'SOL',
|
|
170599
|
+
'Tron(TRC20)': 'TRC20',
|
|
170581
170600
|
};
|
|
170582
170601
|
return this.safeString(networksById, networkId, networkId);
|
|
170583
170602
|
}
|
|
@@ -183018,6 +183037,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
183018
183037
|
'fetchPermissions': undefined,
|
|
183019
183038
|
'fetchPosition': true,
|
|
183020
183039
|
'fetchPositions': true,
|
|
183040
|
+
'fetchPositionsForSymbol': true,
|
|
183021
183041
|
'fetchPositionsRisk': false,
|
|
183022
183042
|
'fetchPremiumIndexOHLCV': false,
|
|
183023
183043
|
'fetchSettlementHistory': true,
|
|
@@ -187942,7 +187962,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
187942
187962
|
if (position === undefined) {
|
|
187943
187963
|
return undefined;
|
|
187944
187964
|
}
|
|
187945
|
-
return this.parsePosition(position);
|
|
187965
|
+
return this.parsePosition(position, market);
|
|
187946
187966
|
}
|
|
187947
187967
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
187948
187968
|
/**
|
|
@@ -188029,6 +188049,19 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
188029
188049
|
}
|
|
188030
188050
|
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
|
188031
188051
|
}
|
|
188052
|
+
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
188053
|
+
/**
|
|
188054
|
+
* @method
|
|
188055
|
+
* @name okx#fetchPositions
|
|
188056
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
188057
|
+
* @description fetch all open positions for specific symbol
|
|
188058
|
+
* @param {string} symbol unified market symbol
|
|
188059
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
188060
|
+
* @param {string} [params.instType] MARGIN (if needed)
|
|
188061
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
188062
|
+
*/
|
|
188063
|
+
return await this.fetchPositions([symbol], params);
|
|
188064
|
+
}
|
|
188032
188065
|
parsePosition(position, market = undefined) {
|
|
188033
188066
|
//
|
|
188034
188067
|
// {
|
|
@@ -229797,6 +229830,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229797
229830
|
'spot': {
|
|
229798
229831
|
'public': 'wss://{hostname}/ws',
|
|
229799
229832
|
'private': 'wss://{hostname}/ws/v2',
|
|
229833
|
+
'feed': 'wss://{hostname}/feed',
|
|
229800
229834
|
},
|
|
229801
229835
|
'future': {
|
|
229802
229836
|
'linear': {
|
|
@@ -229824,6 +229858,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229824
229858
|
'spot': {
|
|
229825
229859
|
'public': 'wss://api-aws.huobi.pro/ws',
|
|
229826
229860
|
'private': 'wss://api-aws.huobi.pro/ws/v2',
|
|
229861
|
+
'feed': 'wss://{hostname}/feed',
|
|
229827
229862
|
},
|
|
229828
229863
|
'future': {
|
|
229829
229864
|
'linear': {
|
|
@@ -230090,13 +230125,13 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230090
230125
|
await this.loadMarkets();
|
|
230091
230126
|
const market = this.market(symbol);
|
|
230092
230127
|
symbol = market['symbol'];
|
|
230093
|
-
const
|
|
230094
|
-
|
|
230095
|
-
|
|
230096
|
-
|
|
230097
|
-
|
|
230098
|
-
|
|
230099
|
-
if (!
|
|
230128
|
+
const allowedLimits = [20, 150];
|
|
230129
|
+
// 2) 5-level/20-level incremental MBP is a tick by tick feed,
|
|
230130
|
+
// which means whenever there is an order book change at that level, it pushes an update;
|
|
230131
|
+
// 150-levels/400-level incremental MBP feed is based on the gap
|
|
230132
|
+
// between two snapshots at 100ms interval.
|
|
230133
|
+
limit = (limit === undefined) ? 20 : limit;
|
|
230134
|
+
if (!this.inArray(limit, allowedLimits)) {
|
|
230100
230135
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' watchOrderBook swap market accepts limits of 20 and 150 only');
|
|
230101
230136
|
}
|
|
230102
230137
|
let messageHash = undefined;
|
|
@@ -230106,7 +230141,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230106
230141
|
else {
|
|
230107
230142
|
messageHash = 'market.' + market['id'] + '.depth.size_' + limit.toString() + '.high_freq';
|
|
230108
230143
|
}
|
|
230109
|
-
const url = this.getUrlByMarketType(market['type'], market['linear']);
|
|
230144
|
+
const url = this.getUrlByMarketType(market['type'], market['linear'], false, true);
|
|
230110
230145
|
let method = this.handleOrderBookSubscription;
|
|
230111
230146
|
if (!market['spot']) {
|
|
230112
230147
|
params = this.extend(params);
|
|
@@ -230141,6 +230176,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230141
230176
|
const symbol = this.safeString(subscription, 'symbol');
|
|
230142
230177
|
const messageHash = this.safeString(subscription, 'messageHash');
|
|
230143
230178
|
const id = this.safeString(message, 'id');
|
|
230179
|
+
const lastTimestamp = this.safeInteger(subscription, 'lastTimestamp');
|
|
230144
230180
|
try {
|
|
230145
230181
|
const orderbook = this.orderbooks[symbol];
|
|
230146
230182
|
const data = this.safeValue(message, 'data');
|
|
@@ -230148,16 +230184,15 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230148
230184
|
const firstMessage = this.safeValue(messages, 0, {});
|
|
230149
230185
|
const snapshot = this.parseOrderBook(data, symbol);
|
|
230150
230186
|
const tick = this.safeValue(firstMessage, 'tick');
|
|
230151
|
-
const sequence = this.safeInteger(tick, '
|
|
230187
|
+
const sequence = this.safeInteger(tick, 'prevSeqNum');
|
|
230152
230188
|
const nonce = this.safeInteger(data, 'seqNum');
|
|
230153
230189
|
snapshot['nonce'] = nonce;
|
|
230154
|
-
const
|
|
230155
|
-
|
|
230156
|
-
snapshot['datetime'] = this.iso8601(timestamp);
|
|
230190
|
+
const snapshotTimestamp = this.safeInteger(message, 'ts');
|
|
230191
|
+
subscription['lastTimestamp'] = snapshotTimestamp;
|
|
230157
230192
|
const snapshotLimit = this.safeInteger(subscription, 'limit');
|
|
230158
230193
|
const snapshotOrderBook = this.orderBook(snapshot, snapshotLimit);
|
|
230159
230194
|
client.resolve(snapshotOrderBook, id);
|
|
230160
|
-
if ((sequence
|
|
230195
|
+
if ((sequence === undefined) || (nonce < sequence)) {
|
|
230161
230196
|
const maxAttempts = this.handleOption('watchOrderBook', 'maxRetries', 3);
|
|
230162
230197
|
let numAttempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
230163
230198
|
// retry to synchronize if we have not reached maxAttempts yet
|
|
@@ -230165,9 +230200,10 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230165
230200
|
// safety guard
|
|
230166
230201
|
if (messageHash in client.subscriptions) {
|
|
230167
230202
|
numAttempts = this.sum(numAttempts, 1);
|
|
230203
|
+
const delayTime = this.sum(1000, lastTimestamp - snapshotTimestamp);
|
|
230168
230204
|
subscription['numAttempts'] = numAttempts;
|
|
230169
230205
|
client.subscriptions[messageHash] = subscription;
|
|
230170
|
-
this.
|
|
230206
|
+
this.delay(delayTime, this.watchOrderBookSnapshot, client, message, subscription);
|
|
230171
230207
|
}
|
|
230172
230208
|
}
|
|
230173
230209
|
else {
|
|
@@ -230179,8 +230215,9 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230179
230215
|
orderbook.reset(snapshot);
|
|
230180
230216
|
// unroll the accumulated deltas
|
|
230181
230217
|
for (let i = 0; i < messages.length; i++) {
|
|
230182
|
-
this.handleOrderBookMessage(client, messages[i]
|
|
230218
|
+
this.handleOrderBookMessage(client, messages[i]);
|
|
230183
230219
|
}
|
|
230220
|
+
orderbook.cache = [];
|
|
230184
230221
|
this.orderbooks[symbol] = orderbook;
|
|
230185
230222
|
client.resolve(orderbook, messageHash);
|
|
230186
230223
|
}
|
|
@@ -230191,29 +230228,31 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230191
230228
|
}
|
|
230192
230229
|
async watchOrderBookSnapshot(client, message, subscription) {
|
|
230193
230230
|
const messageHash = this.safeString(subscription, 'messageHash');
|
|
230231
|
+
const symbol = this.safeString(subscription, 'symbol');
|
|
230232
|
+
const limit = this.safeInteger(subscription, 'limit');
|
|
230233
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
230234
|
+
const params = this.safeValue(subscription, 'params');
|
|
230235
|
+
const attempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
230236
|
+
const market = this.market(symbol);
|
|
230237
|
+
const url = this.getUrlByMarketType(market['type'], market['linear'], false, true);
|
|
230238
|
+
const requestId = this.requestId();
|
|
230239
|
+
const request = {
|
|
230240
|
+
'req': messageHash,
|
|
230241
|
+
'id': requestId,
|
|
230242
|
+
};
|
|
230243
|
+
// this is a temporary subscription by a specific requestId
|
|
230244
|
+
// it has a very short lifetime until the snapshot is received over ws
|
|
230245
|
+
const snapshotSubscription = {
|
|
230246
|
+
'id': requestId,
|
|
230247
|
+
'messageHash': messageHash,
|
|
230248
|
+
'symbol': symbol,
|
|
230249
|
+
'limit': limit,
|
|
230250
|
+
'params': params,
|
|
230251
|
+
'numAttempts': attempts,
|
|
230252
|
+
'lastTimestamp': timestamp,
|
|
230253
|
+
'method': this.handleOrderBookSnapshot,
|
|
230254
|
+
};
|
|
230194
230255
|
try {
|
|
230195
|
-
const symbol = this.safeString(subscription, 'symbol');
|
|
230196
|
-
const limit = this.safeInteger(subscription, 'limit');
|
|
230197
|
-
const params = this.safeValue(subscription, 'params');
|
|
230198
|
-
const attempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
230199
|
-
const market = this.market(symbol);
|
|
230200
|
-
const url = this.getUrlByMarketType(market['type'], market['linear']);
|
|
230201
|
-
const requestId = this.requestId();
|
|
230202
|
-
const request = {
|
|
230203
|
-
'req': messageHash,
|
|
230204
|
-
'id': requestId,
|
|
230205
|
-
};
|
|
230206
|
-
// this is a temporary subscription by a specific requestId
|
|
230207
|
-
// it has a very short lifetime until the snapshot is received over ws
|
|
230208
|
-
const snapshotSubscription = {
|
|
230209
|
-
'id': requestId,
|
|
230210
|
-
'messageHash': messageHash,
|
|
230211
|
-
'symbol': symbol,
|
|
230212
|
-
'limit': limit,
|
|
230213
|
-
'params': params,
|
|
230214
|
-
'numAttempts': attempts,
|
|
230215
|
-
'method': this.handleOrderBookSnapshot,
|
|
230216
|
-
};
|
|
230217
230256
|
const orderbook = await this.watch(url, requestId, request, requestId, snapshotSubscription);
|
|
230218
230257
|
return orderbook.limit();
|
|
230219
230258
|
}
|
|
@@ -230232,7 +230271,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230232
230271
|
this.handleDelta(bookside, deltas[i]);
|
|
230233
230272
|
}
|
|
230234
230273
|
}
|
|
230235
|
-
handleOrderBookMessage(client, message
|
|
230274
|
+
handleOrderBookMessage(client, message) {
|
|
230236
230275
|
// spot markets
|
|
230237
230276
|
//
|
|
230238
230277
|
// {
|
|
@@ -230302,30 +230341,34 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230302
230341
|
const ch = this.safeValue(message, 'ch');
|
|
230303
230342
|
const parts = ch.split('.');
|
|
230304
230343
|
const marketId = this.safeString(parts, 1);
|
|
230305
|
-
const
|
|
230344
|
+
const market = this.safeMarket(marketId);
|
|
230345
|
+
const symbol = market['symbol'];
|
|
230346
|
+
const orderbook = this.orderbooks[symbol];
|
|
230306
230347
|
const tick = this.safeValue(message, 'tick', {});
|
|
230307
|
-
const seqNum = this.
|
|
230348
|
+
const seqNum = this.safeInteger(tick, 'seqNum');
|
|
230308
230349
|
const prevSeqNum = this.safeInteger(tick, 'prevSeqNum');
|
|
230309
230350
|
const event = this.safeString(tick, 'event');
|
|
230351
|
+
const version = this.safeInteger(tick, 'version');
|
|
230310
230352
|
const timestamp = this.safeInteger(message, 'ts');
|
|
230311
230353
|
if (event === 'snapshot') {
|
|
230312
230354
|
const snapshot = this.parseOrderBook(tick, symbol, timestamp);
|
|
230313
230355
|
orderbook.reset(snapshot);
|
|
230314
|
-
orderbook['nonce'] =
|
|
230356
|
+
orderbook['nonce'] = version;
|
|
230315
230357
|
}
|
|
230316
|
-
if (prevSeqNum !== undefined && prevSeqNum > orderbook['nonce']) {
|
|
230358
|
+
if ((prevSeqNum !== undefined) && prevSeqNum > orderbook['nonce']) {
|
|
230317
230359
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidNonce(this.id + ' watchOrderBook() received a mesage out of order');
|
|
230318
230360
|
}
|
|
230319
|
-
|
|
230361
|
+
const spotConditon = market['spot'] && (prevSeqNum === orderbook['nonce']);
|
|
230362
|
+
const nonSpotCondition = market['contract'] && (version - 1 === orderbook['nonce']);
|
|
230363
|
+
if (spotConditon || nonSpotCondition) {
|
|
230320
230364
|
const asks = this.safeValue(tick, 'asks', []);
|
|
230321
230365
|
const bids = this.safeValue(tick, 'bids', []);
|
|
230322
230366
|
this.handleDeltas(orderbook['asks'], asks);
|
|
230323
230367
|
this.handleDeltas(orderbook['bids'], bids);
|
|
230324
|
-
orderbook['nonce'] = seqNum;
|
|
230368
|
+
orderbook['nonce'] = spotConditon ? seqNum : version;
|
|
230325
230369
|
orderbook['timestamp'] = timestamp;
|
|
230326
230370
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
230327
230371
|
}
|
|
230328
|
-
return orderbook;
|
|
230329
230372
|
}
|
|
230330
230373
|
handleOrderBook(client, message) {
|
|
230331
230374
|
//
|
|
@@ -230373,9 +230416,9 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230373
230416
|
// "ts":1645023376098
|
|
230374
230417
|
// }
|
|
230375
230418
|
//
|
|
230376
|
-
const tick = this.safeValue(message, 'tick', {});
|
|
230377
|
-
const event = this.safeString(tick, 'event');
|
|
230378
230419
|
const messageHash = this.safeString(message, 'ch');
|
|
230420
|
+
const tick = this.safeValue(message, 'tick');
|
|
230421
|
+
const event = this.safeString(tick, 'event');
|
|
230379
230422
|
const ch = this.safeValue(message, 'ch');
|
|
230380
230423
|
const parts = ch.split('.');
|
|
230381
230424
|
const marketId = this.safeString(parts, 1);
|
|
@@ -230386,23 +230429,22 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
230386
230429
|
const sizeParts = size.split('_');
|
|
230387
230430
|
const limit = this.safeInteger(sizeParts, 1);
|
|
230388
230431
|
orderbook = this.orderBook({}, limit);
|
|
230432
|
+
this.orderbooks[symbol] = orderbook;
|
|
230389
230433
|
}
|
|
230390
|
-
if (orderbook['nonce'] === undefined) {
|
|
230434
|
+
if ((event === undefined) && (orderbook['nonce'] === undefined)) {
|
|
230391
230435
|
orderbook.cache.push(message);
|
|
230392
230436
|
}
|
|
230393
|
-
|
|
230394
|
-
this.
|
|
230437
|
+
else {
|
|
230438
|
+
this.handleOrderBookMessage(client, message);
|
|
230395
230439
|
client.resolve(orderbook, messageHash);
|
|
230396
230440
|
}
|
|
230397
230441
|
}
|
|
230398
230442
|
handleOrderBookSubscription(client, message, subscription) {
|
|
230399
230443
|
const symbol = this.safeString(subscription, 'symbol');
|
|
230444
|
+
const market = this.market(symbol);
|
|
230400
230445
|
const limit = this.safeInteger(subscription, 'limit');
|
|
230401
|
-
if (symbol in this.orderbooks) {
|
|
230402
|
-
delete this.orderbooks[symbol];
|
|
230403
|
-
}
|
|
230404
230446
|
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
230405
|
-
if (
|
|
230447
|
+
if (market['spot']) {
|
|
230406
230448
|
this.spawn(this.watchOrderBookSnapshot, client, message, subscription);
|
|
230407
230449
|
}
|
|
230408
230450
|
}
|
|
@@ -231975,7 +232017,7 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
231975
232017
|
'fee': fee,
|
|
231976
232018
|
}, market);
|
|
231977
232019
|
}
|
|
231978
|
-
getUrlByMarketType(type, isLinear = true, isPrivate = false) {
|
|
232020
|
+
getUrlByMarketType(type, isLinear = true, isPrivate = false, isFeed = false) {
|
|
231979
232021
|
const api = this.safeString(this.options, 'api', 'api');
|
|
231980
232022
|
const hostname = { 'hostname': this.hostname };
|
|
231981
232023
|
let hostnameURL = undefined;
|
|
@@ -231985,7 +232027,12 @@ class htx extends _htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
231985
232027
|
hostnameURL = this.urls['api']['ws'][api]['spot']['private'];
|
|
231986
232028
|
}
|
|
231987
232029
|
else {
|
|
231988
|
-
|
|
232030
|
+
if (isFeed) {
|
|
232031
|
+
hostnameURL = this.urls['api']['ws'][api]['spot']['feed'];
|
|
232032
|
+
}
|
|
232033
|
+
else {
|
|
232034
|
+
hostnameURL = this.urls['api']['ws'][api]['spot']['public'];
|
|
232035
|
+
}
|
|
231989
232036
|
}
|
|
231990
232037
|
url = this.implodeParams(hostnameURL, hostname);
|
|
231991
232038
|
}
|
|
@@ -285863,7 +285910,7 @@ SOFTWARE.
|
|
|
285863
285910
|
|
|
285864
285911
|
//-----------------------------------------------------------------------------
|
|
285865
285912
|
// this is updated by vss.js when building
|
|
285866
|
-
const version = '4.1.
|
|
285913
|
+
const version = '4.1.60';
|
|
285867
285914
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
285868
285915
|
//-----------------------------------------------------------------------------
|
|
285869
285916
|
|