ccxt 4.1.89 → 4.1.91
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 +936 -358
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +2 -2
- package/dist/cjs/src/binance.js +61 -0
- package/dist/cjs/src/bitforex.js +2 -0
- package/dist/cjs/src/bitget.js +11 -4
- package/dist/cjs/src/bitmex.js +2 -0
- package/dist/cjs/src/blockchaincom.js +0 -41
- package/dist/cjs/src/bybit.js +29 -14
- package/dist/cjs/src/coinlist.js +2 -0
- package/dist/cjs/src/coinsph.js +2 -0
- package/dist/cjs/src/cryptocom.js +2 -0
- package/dist/cjs/src/gate.js +276 -11
- package/dist/cjs/src/htx.js +264 -219
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +37 -0
- package/dist/cjs/src/kuna.js +2 -0
- package/dist/cjs/src/mexc.js +2 -0
- package/dist/cjs/src/okcoin.js +4 -1
- package/dist/cjs/src/phemex.js +160 -26
- package/dist/cjs/src/poloniex.js +28 -2
- package/dist/cjs/src/pro/binance.js +6 -6
- package/dist/cjs/src/pro/bitmart.js +19 -18
- package/dist/cjs/src/pro/poloniex.js +15 -10
- package/dist/cjs/src/tokocrypto.js +2 -0
- package/dist/cjs/src/wazirx.js +2 -0
- package/dist/cjs/src/whitebit.js +2 -0
- package/dist/cjs/src/zaif.js +2 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +2 -2
- package/js/src/binance.d.ts +3 -0
- package/js/src/binance.js +61 -0
- package/js/src/bitforex.js +2 -0
- package/js/src/bitget.js +11 -4
- package/js/src/bitmex.js +2 -0
- package/js/src/blockchaincom.d.ts +0 -2
- package/js/src/blockchaincom.js +0 -41
- package/js/src/bybit.js +29 -14
- package/js/src/coinlist.js +2 -0
- package/js/src/coinsph.js +2 -0
- package/js/src/cryptocom.js +2 -0
- package/js/src/gate.d.ts +47 -0
- package/js/src/gate.js +276 -11
- package/js/src/htx.js +264 -219
- package/js/src/kucoin.js +1 -0
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +37 -0
- package/js/src/kuna.js +2 -0
- package/js/src/mexc.js +2 -0
- package/js/src/okcoin.js +4 -1
- package/js/src/phemex.d.ts +1 -0
- package/js/src/phemex.js +160 -26
- package/js/src/poloniex.js +28 -2
- package/js/src/pro/binance.js +6 -6
- package/js/src/pro/bitmart.d.ts +1 -1
- package/js/src/pro/bitmart.js +19 -18
- package/js/src/pro/poloniex.js +16 -11
- package/js/src/tokocrypto.js +2 -0
- package/js/src/wazirx.js +2 -0
- package/js/src/whitebit.js +2 -0
- package/js/src/zaif.js +2 -3
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -10664,7 +10664,7 @@ class Exchange {
|
|
|
10664
10664
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10665
10665
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
10666
10666
|
*/
|
|
10667
|
-
if (this.
|
|
10667
|
+
if (this.has['createMarketOrderWithCost'] || (this.has['createMarketBuyOrderWithCost'] && this.has['createMarketSellOrderWithCost'])) {
|
|
10668
10668
|
return await this.createOrder(symbol, 'market', side, cost, 1, params);
|
|
10669
10669
|
}
|
|
10670
10670
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketOrderWithCost() is not supported yet');
|
|
@@ -10679,7 +10679,7 @@ class Exchange {
|
|
|
10679
10679
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10680
10680
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
10681
10681
|
*/
|
|
10682
|
-
if (this.options['createMarketBuyOrderRequiresPrice'] || this.
|
|
10682
|
+
if (this.options['createMarketBuyOrderRequiresPrice'] || this.has['createMarketBuyOrderWithCost']) {
|
|
10683
10683
|
return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
|
|
10684
10684
|
}
|
|
10685
10685
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
|
|
@@ -17122,6 +17122,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17122
17122
|
'closeAllPositions': false,
|
|
17123
17123
|
'closePosition': false,
|
|
17124
17124
|
'createDepositAddress': false,
|
|
17125
|
+
'createMarketBuyOrderWithCost': true,
|
|
17126
|
+
'createMarketOrderWithCost': true,
|
|
17127
|
+
'createMarketSellOrderWithCost': true,
|
|
17125
17128
|
'createOrder': true,
|
|
17126
17129
|
'createOrders': true,
|
|
17127
17130
|
'createPostOnlyOrder': true,
|
|
@@ -21735,6 +21738,64 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
21735
21738
|
const requestParams = this.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'test', 'type', 'newClientOrderId', 'clientOrderId', 'postOnly']);
|
|
21736
21739
|
return this.extend(request, requestParams);
|
|
21737
21740
|
}
|
|
21741
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
21742
|
+
/**
|
|
21743
|
+
* @method
|
|
21744
|
+
* @name binance#createMarketOrderWithCost
|
|
21745
|
+
* @description create a market order by providing the symbol, side and cost
|
|
21746
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
|
21747
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
21748
|
+
* @param {string} side 'buy' or 'sell'
|
|
21749
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
21750
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
21751
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
21752
|
+
*/
|
|
21753
|
+
await this.loadMarkets();
|
|
21754
|
+
const market = this.market(symbol);
|
|
21755
|
+
if (!market['spot']) {
|
|
21756
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketOrderWithCost() supports spot orders only');
|
|
21757
|
+
}
|
|
21758
|
+
params['quoteOrderQty'] = cost;
|
|
21759
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
21760
|
+
}
|
|
21761
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
21762
|
+
/**
|
|
21763
|
+
* @method
|
|
21764
|
+
* @name binance#createMarketBuyOrderWithCost
|
|
21765
|
+
* @description create a market buy order by providing the symbol and cost
|
|
21766
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
|
21767
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
21768
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
21769
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
21770
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
21771
|
+
*/
|
|
21772
|
+
await this.loadMarkets();
|
|
21773
|
+
const market = this.market(symbol);
|
|
21774
|
+
if (!market['spot']) {
|
|
21775
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
21776
|
+
}
|
|
21777
|
+
params['quoteOrderQty'] = cost;
|
|
21778
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
21779
|
+
}
|
|
21780
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
21781
|
+
/**
|
|
21782
|
+
* @method
|
|
21783
|
+
* @name binance#createMarketSellOrderWithCost
|
|
21784
|
+
* @description create a market sell order by providing the symbol and cost
|
|
21785
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
|
21786
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
21787
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
21788
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
21789
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
21790
|
+
*/
|
|
21791
|
+
await this.loadMarkets();
|
|
21792
|
+
const market = this.market(symbol);
|
|
21793
|
+
if (!market['spot']) {
|
|
21794
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
|
|
21795
|
+
}
|
|
21796
|
+
params['quoteOrderQty'] = cost;
|
|
21797
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
|
|
21798
|
+
}
|
|
21738
21799
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
21739
21800
|
/**
|
|
21740
21801
|
* @method
|
|
@@ -39418,6 +39479,8 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
39418
39479
|
'fetchWithdrawal': false,
|
|
39419
39480
|
'fetchWithdrawals': false,
|
|
39420
39481
|
'reduceMargin': false,
|
|
39482
|
+
'repayCrossMargin': false,
|
|
39483
|
+
'repayIsolatedMargin': false,
|
|
39421
39484
|
'setLeverage': false,
|
|
39422
39485
|
'setMargin': false,
|
|
39423
39486
|
'setMarginMode': false,
|
|
@@ -44059,7 +44122,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44059
44122
|
if (feeCostString !== undefined) {
|
|
44060
44123
|
// swap
|
|
44061
44124
|
fee = {
|
|
44062
|
-
'cost': feeCostString,
|
|
44125
|
+
'cost': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCostString)),
|
|
44063
44126
|
'currency': market['settle'],
|
|
44064
44127
|
};
|
|
44065
44128
|
}
|
|
@@ -44067,10 +44130,17 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44067
44130
|
if (feeDetail !== undefined) {
|
|
44068
44131
|
const parsedFeeDetail = JSON.parse(feeDetail);
|
|
44069
44132
|
const feeValues = Object.values(parsedFeeDetail);
|
|
44070
|
-
|
|
44133
|
+
let feeObject = undefined;
|
|
44134
|
+
for (let i = 0; i < feeValues.length; i++) {
|
|
44135
|
+
const feeValue = feeValues[i];
|
|
44136
|
+
if (this.safeValue(feeValue, 'feeCoinCode') !== undefined) {
|
|
44137
|
+
feeObject = feeValue;
|
|
44138
|
+
break;
|
|
44139
|
+
}
|
|
44140
|
+
}
|
|
44071
44141
|
fee = {
|
|
44072
|
-
'cost': this.safeString(
|
|
44073
|
-
'currency': this.safeCurrencyCode(this.safeString(
|
|
44142
|
+
'cost': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString(feeObject, 'totalFee'))),
|
|
44143
|
+
'currency': this.safeCurrencyCode(this.safeString(feeObject, 'feeCoinCode')),
|
|
44074
44144
|
};
|
|
44075
44145
|
}
|
|
44076
44146
|
let postOnly = undefined;
|
|
@@ -53814,6 +53884,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53814
53884
|
'cancelAllOrders': true,
|
|
53815
53885
|
'cancelOrder': true,
|
|
53816
53886
|
'cancelOrders': true,
|
|
53887
|
+
'closeAllPositions': false,
|
|
53888
|
+
'closePosition': true,
|
|
53817
53889
|
'createOrder': true,
|
|
53818
53890
|
'createReduceOnlyOrder': true,
|
|
53819
53891
|
'editOrder': true,
|
|
@@ -70860,47 +70932,6 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
|
|
|
70860
70932
|
'fee': fee,
|
|
70861
70933
|
};
|
|
70862
70934
|
}
|
|
70863
|
-
async fetchWithdrawalWhitelist(params = {}) {
|
|
70864
|
-
/**
|
|
70865
|
-
* @method
|
|
70866
|
-
* @name blockchaincom#fetchWithdrawalWhitelist
|
|
70867
|
-
* @description fetch the list of withdrawal addresses on the whitelist
|
|
70868
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70869
|
-
* @returns {object} dictionary with keys beneficiaryId, name, currency
|
|
70870
|
-
*/
|
|
70871
|
-
await this.loadMarkets();
|
|
70872
|
-
const response = await this.privateGetWhitelist();
|
|
70873
|
-
const result = [];
|
|
70874
|
-
for (let i = 0; i < response.length; i++) {
|
|
70875
|
-
const entry = response[i];
|
|
70876
|
-
result.push({
|
|
70877
|
-
'beneficiaryId': this.safeString(entry, 'whitelistId'),
|
|
70878
|
-
'name': this.safeString(entry, 'name'),
|
|
70879
|
-
'currency': this.safeString(entry, 'currency'),
|
|
70880
|
-
'info': entry,
|
|
70881
|
-
});
|
|
70882
|
-
}
|
|
70883
|
-
return result;
|
|
70884
|
-
}
|
|
70885
|
-
async fetchWithdrawalWhitelistByCurrency(code, params = {}) {
|
|
70886
|
-
await this.loadMarkets();
|
|
70887
|
-
const currency = this.currency(code);
|
|
70888
|
-
const request = {
|
|
70889
|
-
'currency': currency['id'],
|
|
70890
|
-
};
|
|
70891
|
-
const response = await this.privateGetWhitelistCurrency(this.extend(request, params));
|
|
70892
|
-
const result = [];
|
|
70893
|
-
for (let i = 0; i < response.length; i++) {
|
|
70894
|
-
const entry = response[i];
|
|
70895
|
-
result.push({
|
|
70896
|
-
'beneficiaryId': this.safeString(entry, 'whitelistId'),
|
|
70897
|
-
'name': this.safeString(entry, 'name'),
|
|
70898
|
-
'currency': this.safeString(entry, 'currency'),
|
|
70899
|
-
'info': entry,
|
|
70900
|
-
});
|
|
70901
|
-
}
|
|
70902
|
-
return result;
|
|
70903
|
-
}
|
|
70904
70935
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
70905
70936
|
/**
|
|
70906
70937
|
* @method
|
|
@@ -75811,6 +75842,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75811
75842
|
},
|
|
75812
75843
|
'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_2__/* .TICK_SIZE */ .sh,
|
|
75813
75844
|
'options': {
|
|
75845
|
+
'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
|
|
75814
75846
|
'enableUnifiedMargin': undefined,
|
|
75815
75847
|
'enableUnifiedAccount': undefined,
|
|
75816
75848
|
'createMarketBuyOrderRequiresPrice': true,
|
|
@@ -76316,21 +76348,35 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76316
76348
|
if (this.options['adjustForTimeDifference']) {
|
|
76317
76349
|
await this.loadTimeDifference();
|
|
76318
76350
|
}
|
|
76319
|
-
const promisesUnresolved = [
|
|
76320
|
-
|
|
76321
|
-
|
|
76322
|
-
|
|
76323
|
-
|
|
76324
|
-
|
|
76325
|
-
|
|
76326
|
-
|
|
76351
|
+
const promisesUnresolved = [];
|
|
76352
|
+
const fetchMarkets = this.safeValue(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
|
|
76353
|
+
for (let i = 0; i < fetchMarkets.length; i++) {
|
|
76354
|
+
const marketType = fetchMarkets[i];
|
|
76355
|
+
if (marketType === 'spot') {
|
|
76356
|
+
promisesUnresolved.push(this.fetchSpotMarkets(params));
|
|
76357
|
+
}
|
|
76358
|
+
else if (marketType === 'linear') {
|
|
76359
|
+
promisesUnresolved.push(this.fetchFutureMarkets({ 'category': 'linear' }));
|
|
76360
|
+
}
|
|
76361
|
+
else if (marketType === 'inverse') {
|
|
76362
|
+
promisesUnresolved.push(this.fetchFutureMarkets({ 'category': 'inverse' }));
|
|
76363
|
+
}
|
|
76364
|
+
else if (marketType === 'option') {
|
|
76365
|
+
promisesUnresolved.push(this.fetchOptionMarkets({ 'baseCoin': 'BTC' }));
|
|
76366
|
+
promisesUnresolved.push(this.fetchOptionMarkets({ 'baseCoin': 'ETH' }));
|
|
76367
|
+
promisesUnresolved.push(this.fetchOptionMarkets({ 'baseCoin': 'SOL' }));
|
|
76368
|
+
}
|
|
76369
|
+
else {
|
|
76370
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' fetchMarkets() this.options fetchMarkets "' + marketType + '" is not a supported market type');
|
|
76371
|
+
}
|
|
76372
|
+
}
|
|
76327
76373
|
const promises = await Promise.all(promisesUnresolved);
|
|
76328
|
-
const spotMarkets = promises[
|
|
76329
|
-
const linearMarkets = promises[
|
|
76330
|
-
const inverseMarkets = promises[
|
|
76331
|
-
const btcOptionMarkets = promises[
|
|
76332
|
-
const ethOptionMarkets = promises[
|
|
76333
|
-
const solOptionMarkets = promises[
|
|
76374
|
+
const spotMarkets = this.safeValue(promises, 0, []);
|
|
76375
|
+
const linearMarkets = this.safeValue(promises, 1, []);
|
|
76376
|
+
const inverseMarkets = this.safeValue(promises, 2, []);
|
|
76377
|
+
const btcOptionMarkets = this.safeValue(promises, 3, []);
|
|
76378
|
+
const ethOptionMarkets = this.safeValue(promises, 4, []);
|
|
76379
|
+
const solOptionMarkets = this.safeValue(promises, 5, []);
|
|
76334
76380
|
const futureMarkets = this.arrayConcat(linearMarkets, inverseMarkets);
|
|
76335
76381
|
let optionMarkets = this.arrayConcat(btcOptionMarkets, ethOptionMarkets);
|
|
76336
76382
|
optionMarkets = this.arrayConcat(optionMarkets, solOptionMarkets);
|
|
@@ -95645,6 +95691,8 @@ class coinlist extends _abstract_coinlist_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95645
95691
|
'fetchWithdrawals': false,
|
|
95646
95692
|
'fetchWithdrawalWhitelist': false,
|
|
95647
95693
|
'reduceMargin': false,
|
|
95694
|
+
'repayCrossMargin': false,
|
|
95695
|
+
'repayIsolatedMargin': false,
|
|
95648
95696
|
'setLeverage': false,
|
|
95649
95697
|
'setMargin': false,
|
|
95650
95698
|
'setMarginMode': false,
|
|
@@ -99928,6 +99976,8 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99928
99976
|
'fetchWithdrawals': true,
|
|
99929
99977
|
'fetchWithdrawalWhitelist': false,
|
|
99930
99978
|
'reduceMargin': false,
|
|
99979
|
+
'repayCrossMargin': false,
|
|
99980
|
+
'repayIsolatedMargin': false,
|
|
99931
99981
|
'setLeverage': false,
|
|
99932
99982
|
'setMargin': false,
|
|
99933
99983
|
'setMarginMode': false,
|
|
@@ -102398,6 +102448,8 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
102398
102448
|
'fetchVolatilityHistory': false,
|
|
102399
102449
|
'fetchWithdrawals': true,
|
|
102400
102450
|
'reduceMargin': false,
|
|
102451
|
+
'repayCrossMargin': false,
|
|
102452
|
+
'repayIsolatedMargin': false,
|
|
102401
102453
|
'setLeverage': false,
|
|
102402
102454
|
'setMarginMode': false,
|
|
102403
102455
|
'setPositionMode': false,
|
|
@@ -120982,9 +121034,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120982
121034
|
'future': true,
|
|
120983
121035
|
'option': true,
|
|
120984
121036
|
'addMargin': true,
|
|
121037
|
+
'borrowCrossMargin': true,
|
|
121038
|
+
'borrowIsolatedMargin': true,
|
|
120985
121039
|
'cancelAllOrders': true,
|
|
120986
121040
|
'cancelOrder': true,
|
|
121041
|
+
'createMarketBuyOrderWithCost': true,
|
|
120987
121042
|
'createMarketOrder': true,
|
|
121043
|
+
'createMarketOrderWithCost': false,
|
|
121044
|
+
'createMarketSellOrderWithCost': false,
|
|
120988
121045
|
'createOrder': true,
|
|
120989
121046
|
'createOrders': true,
|
|
120990
121047
|
'createPostOnlyOrder': true,
|
|
@@ -121046,6 +121103,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121046
121103
|
'fetchVolatilityHistory': false,
|
|
121047
121104
|
'fetchWithdrawals': true,
|
|
121048
121105
|
'reduceMargin': true,
|
|
121106
|
+
'repayCrossMargin': true,
|
|
121107
|
+
'repayIsolatedMargin': true,
|
|
121049
121108
|
'setLeverage': true,
|
|
121050
121109
|
'setMarginMode': false,
|
|
121051
121110
|
'setPositionMode': true,
|
|
@@ -124664,6 +124723,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124664
124723
|
* @param {bool} [params.close] *contract only* Set as true to close the position, with size set to 0
|
|
124665
124724
|
* @param {bool} [params.auto_size] *contract only* Set side to close dual-mode position, close_long closes the long side, while close_short the short one, size also needs to be set to 0
|
|
124666
124725
|
* @param {int} [params.price_type] *contract only* 0 latest deal price, 1 mark price, 2 index price
|
|
124726
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
124667
124727
|
* @returns {object|undefined} [An order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
124668
124728
|
*/
|
|
124669
124729
|
await this.loadMarkets();
|
|
@@ -124861,9 +124921,15 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124861
124921
|
}
|
|
124862
124922
|
}
|
|
124863
124923
|
if (contract) {
|
|
124864
|
-
const
|
|
124865
|
-
|
|
124866
|
-
|
|
124924
|
+
const isClose = this.safeValue(params, 'close');
|
|
124925
|
+
if (isClose) {
|
|
124926
|
+
amount = 0;
|
|
124927
|
+
}
|
|
124928
|
+
else {
|
|
124929
|
+
const amountToPrecision = this.amountToPrecision(symbol, amount);
|
|
124930
|
+
const signedAmount = (side === 'sell') ? _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(amountToPrecision) : amountToPrecision;
|
|
124931
|
+
amount = parseInt(signedAmount);
|
|
124932
|
+
}
|
|
124867
124933
|
}
|
|
124868
124934
|
let request = undefined;
|
|
124869
124935
|
const nonTriggerOrder = !isStopOrder && (trigger === undefined);
|
|
@@ -124911,24 +124977,30 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124911
124977
|
// 'auto_borrow': false, // used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough
|
|
124912
124978
|
// 'auto_repay': false, // automatic repayment for automatic borrow loan generated by cross margin order, diabled by default
|
|
124913
124979
|
};
|
|
124914
|
-
const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
124915
124980
|
if (isMarketOrder && (side === 'buy')) {
|
|
124916
|
-
|
|
124981
|
+
let quoteAmount = undefined;
|
|
124982
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
124983
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
124984
|
+
const cost = this.safeNumber(params, 'cost');
|
|
124985
|
+
params = this.omit(params, 'cost');
|
|
124986
|
+
if (cost !== undefined) {
|
|
124987
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
124988
|
+
}
|
|
124989
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
124917
124990
|
if (price === undefined) {
|
|
124918
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires price argument for market buy orders
|
|
124991
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
|
|
124919
124992
|
}
|
|
124920
124993
|
else {
|
|
124921
124994
|
const amountString = this.numberToString(amount);
|
|
124922
124995
|
const priceString = this.numberToString(price);
|
|
124923
|
-
const
|
|
124924
|
-
|
|
124996
|
+
const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
124997
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
124925
124998
|
}
|
|
124926
124999
|
}
|
|
124927
125000
|
else {
|
|
124928
|
-
|
|
124929
|
-
params = this.omit(params, 'cost');
|
|
124930
|
-
request['amount'] = this.costToPrecision(symbol, cost);
|
|
125001
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
124931
125002
|
}
|
|
125003
|
+
request['amount'] = quoteAmount;
|
|
124932
125004
|
}
|
|
124933
125005
|
else {
|
|
124934
125006
|
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
@@ -125058,6 +125130,25 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
125058
125130
|
}
|
|
125059
125131
|
return this.extend(request, params);
|
|
125060
125132
|
}
|
|
125133
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
125134
|
+
/**
|
|
125135
|
+
* @method
|
|
125136
|
+
* @name gate#createMarketBuyOrderWithCost
|
|
125137
|
+
* @description create a market buy order by providing the symbol and cost
|
|
125138
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-an-order
|
|
125139
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
125140
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
125141
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
125142
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
125143
|
+
*/
|
|
125144
|
+
await this.loadMarkets();
|
|
125145
|
+
const market = this.market(symbol);
|
|
125146
|
+
if (!market['spot']) {
|
|
125147
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
125148
|
+
}
|
|
125149
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
125150
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
125151
|
+
}
|
|
125061
125152
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
125062
125153
|
/**
|
|
125063
125154
|
* @method
|
|
@@ -126643,6 +126734,210 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126643
126734
|
}
|
|
126644
126735
|
return tiers;
|
|
126645
126736
|
}
|
|
126737
|
+
async repayIsolatedMargin(symbol, code, amount, params = {}) {
|
|
126738
|
+
/**
|
|
126739
|
+
* @method
|
|
126740
|
+
* @name gate#repayMargin
|
|
126741
|
+
* @description repay borrowed margin and interest
|
|
126742
|
+
* @see https://www.gate.io/docs/apiv4/en/#repay-a-loan
|
|
126743
|
+
* @param {string} symbol unified market symbol
|
|
126744
|
+
* @param {string} code unified currency code of the currency to repay
|
|
126745
|
+
* @param {float} amount the amount to repay
|
|
126746
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
126747
|
+
* @param {string} [params.mode] 'all' or 'partial' payment mode, extra parameter required for isolated margin
|
|
126748
|
+
* @param {string} [params.id] '34267567' loan id, extra parameter required for isolated margin
|
|
126749
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
126750
|
+
*/
|
|
126751
|
+
await this.loadMarkets();
|
|
126752
|
+
const currency = this.currency(code);
|
|
126753
|
+
const request = {
|
|
126754
|
+
'currency': currency['id'].toUpperCase(),
|
|
126755
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
126756
|
+
};
|
|
126757
|
+
const market = this.market(symbol);
|
|
126758
|
+
request['currency_pair'] = market['id'];
|
|
126759
|
+
request['type'] = 'repay';
|
|
126760
|
+
const response = await this.privateMarginPostUniLoans(this.extend(request, params));
|
|
126761
|
+
//
|
|
126762
|
+
// empty response
|
|
126763
|
+
//
|
|
126764
|
+
return this.parseMarginLoan(response, currency);
|
|
126765
|
+
}
|
|
126766
|
+
async repayCrossMargin(code, amount, params = {}) {
|
|
126767
|
+
/**
|
|
126768
|
+
* @method
|
|
126769
|
+
* @name gate#repayCrossMargin
|
|
126770
|
+
* @description repay cross margin borrowed margin and interest
|
|
126771
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cross-margin-repayments
|
|
126772
|
+
* @param {string} code unified currency code of the currency to repay
|
|
126773
|
+
* @param {float} amount the amount to repay
|
|
126774
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
126775
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
126776
|
+
* @param {string} [params.mode] 'all' or 'partial' payment mode, extra parameter required for isolated margin
|
|
126777
|
+
* @param {string} [params.id] '34267567' loan id, extra parameter required for isolated margin
|
|
126778
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
126779
|
+
*/
|
|
126780
|
+
await this.loadMarkets();
|
|
126781
|
+
const currency = this.currency(code);
|
|
126782
|
+
const request = {
|
|
126783
|
+
'currency': currency['id'].toUpperCase(),
|
|
126784
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
126785
|
+
};
|
|
126786
|
+
let response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
|
|
126787
|
+
//
|
|
126788
|
+
// [
|
|
126789
|
+
// {
|
|
126790
|
+
// "id": "17",
|
|
126791
|
+
// "create_time": 1620381696159,
|
|
126792
|
+
// "update_time": 1620381696159,
|
|
126793
|
+
// "currency": "EOS",
|
|
126794
|
+
// "amount": "110.553635",
|
|
126795
|
+
// "text": "web",
|
|
126796
|
+
// "status": 2,
|
|
126797
|
+
// "repaid": "110.506649705159",
|
|
126798
|
+
// "repaid_interest": "0.046985294841",
|
|
126799
|
+
// "unpaid_interest": "0.0000074393366667"
|
|
126800
|
+
// }
|
|
126801
|
+
// ]
|
|
126802
|
+
//
|
|
126803
|
+
response = this.safeValue(response, 0);
|
|
126804
|
+
return this.parseMarginLoan(response, currency);
|
|
126805
|
+
}
|
|
126806
|
+
async borrowIsolatedMargin(symbol, code, amount, params = {}) {
|
|
126807
|
+
/**
|
|
126808
|
+
* @method
|
|
126809
|
+
* @name gate#borrowMargin
|
|
126810
|
+
* @description create a loan to borrow margin
|
|
126811
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#marginuni
|
|
126812
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
126813
|
+
* @param {float} amount the amount to borrow
|
|
126814
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
126815
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
126816
|
+
* @param {string} [params.rate] '0.0002' or '0.002' extra parameter required for isolated margin
|
|
126817
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
126818
|
+
*/
|
|
126819
|
+
await this.loadMarkets();
|
|
126820
|
+
const currency = this.currency(code);
|
|
126821
|
+
const request = {
|
|
126822
|
+
'currency': currency['id'].toUpperCase(),
|
|
126823
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
126824
|
+
};
|
|
126825
|
+
let response = undefined;
|
|
126826
|
+
const market = this.market(symbol);
|
|
126827
|
+
request['currency_pair'] = market['id'];
|
|
126828
|
+
request['type'] = 'borrow';
|
|
126829
|
+
response = await this.privateMarginPostUniLoans(this.extend(request, params));
|
|
126830
|
+
//
|
|
126831
|
+
// {
|
|
126832
|
+
// "id": "34267567",
|
|
126833
|
+
// "create_time": "1656394778",
|
|
126834
|
+
// "expire_time": "1657258778",
|
|
126835
|
+
// "status": "loaned",
|
|
126836
|
+
// "side": "borrow",
|
|
126837
|
+
// "currency": "USDT",
|
|
126838
|
+
// "rate": "0.0002",
|
|
126839
|
+
// "amount": "100",
|
|
126840
|
+
// "days": 10,
|
|
126841
|
+
// "auto_renew": false,
|
|
126842
|
+
// "currency_pair": "LTC_USDT",
|
|
126843
|
+
// "left": "0",
|
|
126844
|
+
// "repaid": "0",
|
|
126845
|
+
// "paid_interest": "0",
|
|
126846
|
+
// "unpaid_interest": "0.003333333333"
|
|
126847
|
+
// }
|
|
126848
|
+
//
|
|
126849
|
+
return this.parseMarginLoan(response, currency);
|
|
126850
|
+
}
|
|
126851
|
+
async borrowCrossMargin(code, amount, params = {}) {
|
|
126852
|
+
/**
|
|
126853
|
+
* @method
|
|
126854
|
+
* @name gate#borrowMargin
|
|
126855
|
+
* @description create a loan to borrow margin
|
|
126856
|
+
* @see https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
|
|
126857
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
126858
|
+
* @param {float} amount the amount to borrow
|
|
126859
|
+
* @param {string} symbol unified market symbol, required for isolated margin
|
|
126860
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
126861
|
+
* @param {string} [params.rate] '0.0002' or '0.002' extra parameter required for isolated margin
|
|
126862
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
126863
|
+
*/
|
|
126864
|
+
await this.loadMarkets();
|
|
126865
|
+
const currency = this.currency(code);
|
|
126866
|
+
const request = {
|
|
126867
|
+
'currency': currency['id'].toUpperCase(),
|
|
126868
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
126869
|
+
};
|
|
126870
|
+
const response = await this.privateMarginPostCrossLoans(this.extend(request, params));
|
|
126871
|
+
//
|
|
126872
|
+
// {
|
|
126873
|
+
// "id": "17",
|
|
126874
|
+
// "create_time": 1620381696159,
|
|
126875
|
+
// "update_time": 1620381696159,
|
|
126876
|
+
// "currency": "EOS",
|
|
126877
|
+
// "amount": "110.553635",
|
|
126878
|
+
// "text": "web",
|
|
126879
|
+
// "status": 2,
|
|
126880
|
+
// "repaid": "110.506649705159",
|
|
126881
|
+
// "repaid_interest": "0.046985294841",
|
|
126882
|
+
// "unpaid_interest": "0.0000074393366667"
|
|
126883
|
+
// }
|
|
126884
|
+
//
|
|
126885
|
+
return this.parseMarginLoan(response, currency);
|
|
126886
|
+
}
|
|
126887
|
+
parseMarginLoan(info, currency = undefined) {
|
|
126888
|
+
//
|
|
126889
|
+
// Cross
|
|
126890
|
+
//
|
|
126891
|
+
// {
|
|
126892
|
+
// "id": "17",
|
|
126893
|
+
// "create_time": 1620381696159,
|
|
126894
|
+
// "update_time": 1620381696159,
|
|
126895
|
+
// "currency": "EOS",
|
|
126896
|
+
// "amount": "110.553635",
|
|
126897
|
+
// "text": "web",
|
|
126898
|
+
// "status": 2,
|
|
126899
|
+
// "repaid": "110.506649705159",
|
|
126900
|
+
// "repaid_interest": "0.046985294841",
|
|
126901
|
+
// "unpaid_interest": "0.0000074393366667"
|
|
126902
|
+
// }
|
|
126903
|
+
//
|
|
126904
|
+
// Isolated
|
|
126905
|
+
//
|
|
126906
|
+
// {
|
|
126907
|
+
// "id": "34267567",
|
|
126908
|
+
// "create_time": "1656394778",
|
|
126909
|
+
// "expire_time": "1657258778",
|
|
126910
|
+
// "status": "loaned",
|
|
126911
|
+
// "side": "borrow",
|
|
126912
|
+
// "currency": "USDT",
|
|
126913
|
+
// "rate": "0.0002",
|
|
126914
|
+
// "amount": "100",
|
|
126915
|
+
// "days": 10,
|
|
126916
|
+
// "auto_renew": false,
|
|
126917
|
+
// "currency_pair": "LTC_USDT",
|
|
126918
|
+
// "left": "0",
|
|
126919
|
+
// "repaid": "0",
|
|
126920
|
+
// "paid_interest": "0",
|
|
126921
|
+
// "unpaid_interest": "0.003333333333"
|
|
126922
|
+
// }
|
|
126923
|
+
//
|
|
126924
|
+
const marginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
|
|
126925
|
+
let timestamp = this.safeInteger(info, 'create_time');
|
|
126926
|
+
if (marginMode === 'isolated') {
|
|
126927
|
+
timestamp = this.safeTimestamp(info, 'create_time');
|
|
126928
|
+
}
|
|
126929
|
+
const currencyId = this.safeString(info, 'currency');
|
|
126930
|
+
const marketId = this.safeString(info, 'currency_pair');
|
|
126931
|
+
return {
|
|
126932
|
+
'id': this.safeInteger(info, 'id'),
|
|
126933
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
126934
|
+
'amount': this.safeNumber(info, 'amount'),
|
|
126935
|
+
'symbol': this.safeSymbol(marketId, undefined, '_', 'margin'),
|
|
126936
|
+
'timestamp': timestamp,
|
|
126937
|
+
'datetime': this.iso8601(timestamp),
|
|
126938
|
+
'info': info,
|
|
126939
|
+
};
|
|
126940
|
+
}
|
|
126646
126941
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
126647
126942
|
const authentication = api[0]; // public, private
|
|
126648
126943
|
const type = api[1]; // spot, margin, future, delivery
|
|
@@ -127652,6 +127947,28 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
127652
127947
|
'info': greeks,
|
|
127653
127948
|
};
|
|
127654
127949
|
}
|
|
127950
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
127951
|
+
/**
|
|
127952
|
+
* @method
|
|
127953
|
+
* @name gate#closePositions
|
|
127954
|
+
* @description closes open positions for a market
|
|
127955
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
|
127956
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
127957
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
|
|
127958
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
127959
|
+
* @param {string} side 'buy' or 'sell'
|
|
127960
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
127961
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
127962
|
+
*/
|
|
127963
|
+
const request = {
|
|
127964
|
+
'close': true,
|
|
127965
|
+
};
|
|
127966
|
+
params = this.extend(request, params);
|
|
127967
|
+
if (side === undefined) {
|
|
127968
|
+
side = ''; // side is not used but needs to be present, otherwise crashes in php
|
|
127969
|
+
}
|
|
127970
|
+
return await this.createOrder(symbol, 'market', side, 0, undefined, params);
|
|
127971
|
+
}
|
|
127655
127972
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
127656
127973
|
if (response === undefined) {
|
|
127657
127974
|
return undefined;
|
|
@@ -136290,30 +136607,32 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
136290
136607
|
await this.loadMarkets();
|
|
136291
136608
|
let marketType = undefined;
|
|
136292
136609
|
[marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', undefined, params);
|
|
136293
|
-
let
|
|
136610
|
+
let response = undefined;
|
|
136294
136611
|
if (marketType !== 'spot') {
|
|
136295
136612
|
const subType = this.safeString(params, 'subType', this.options['defaultSubType']);
|
|
136296
136613
|
if (marketType === 'swap') {
|
|
136297
136614
|
if (subType === 'linear') {
|
|
136298
|
-
|
|
136615
|
+
response = await this.statusPublicSwapLinearGetApiV2SummaryJson();
|
|
136299
136616
|
}
|
|
136300
136617
|
else if (subType === 'inverse') {
|
|
136301
|
-
|
|
136618
|
+
response = await this.statusPublicSwapInverseGetApiV2SummaryJson();
|
|
136302
136619
|
}
|
|
136303
136620
|
}
|
|
136304
136621
|
else if (marketType === 'future') {
|
|
136305
136622
|
if (subType === 'linear') {
|
|
136306
|
-
|
|
136623
|
+
response = await this.statusPublicFutureLinearGetApiV2SummaryJson();
|
|
136307
136624
|
}
|
|
136308
136625
|
else if (subType === 'inverse') {
|
|
136309
|
-
|
|
136626
|
+
response = await this.statusPublicFutureInverseGetApiV2SummaryJson();
|
|
136310
136627
|
}
|
|
136311
136628
|
}
|
|
136312
136629
|
else if (marketType === 'contract') {
|
|
136313
|
-
|
|
136630
|
+
response = await this.contractPublicGetHeartbeat();
|
|
136314
136631
|
}
|
|
136315
136632
|
}
|
|
136316
|
-
|
|
136633
|
+
else {
|
|
136634
|
+
response = await this.statusPublicSpotGetApiV2SummaryJson();
|
|
136635
|
+
}
|
|
136317
136636
|
//
|
|
136318
136637
|
// statusPublicSpotGetApiV2SummaryJson, statusPublicSwapInverseGetApiV2SummaryJson, statusPublicFutureLinearGetApiV2SummaryJson, statusPublicFutureInverseGetApiV2SummaryJson
|
|
136319
136638
|
//
|
|
@@ -136478,7 +136797,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
136478
136797
|
let status = undefined;
|
|
136479
136798
|
let updated = undefined;
|
|
136480
136799
|
let url = undefined;
|
|
136481
|
-
if (
|
|
136800
|
+
if (marketType === 'contract') {
|
|
136482
136801
|
const statusRaw = this.safeString(response, 'status');
|
|
136483
136802
|
status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
|
|
136484
136803
|
updated = this.safeString(response, 'ts');
|
|
@@ -136512,11 +136831,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
136512
136831
|
const defaultType = this.safeString(this.options, 'defaultType', 'spot');
|
|
136513
136832
|
let type = this.safeString(options, 'type', defaultType);
|
|
136514
136833
|
type = this.safeString(params, 'type', type);
|
|
136515
|
-
let
|
|
136834
|
+
let response = undefined;
|
|
136516
136835
|
if ((type === 'future') || (type === 'swap')) {
|
|
136517
|
-
|
|
136836
|
+
response = await this.contractPublicGetApiV1Timestamp(params);
|
|
136837
|
+
}
|
|
136838
|
+
else {
|
|
136839
|
+
response = await this.spotPublicGetV1CommonTimestamp(params);
|
|
136518
136840
|
}
|
|
136519
|
-
const response = await this[method](params);
|
|
136520
136841
|
//
|
|
136521
136842
|
// spot
|
|
136522
136843
|
//
|
|
@@ -136684,7 +137005,6 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
136684
137005
|
return allMarkets;
|
|
136685
137006
|
}
|
|
136686
137007
|
async fetchMarketsByTypeAndSubType(type, subType, params = {}) {
|
|
136687
|
-
let method = 'spotPublicGetV1CommonSymbols';
|
|
136688
137008
|
const query = this.omit(params, ['type', 'subType']);
|
|
136689
137009
|
const spot = (type === 'spot');
|
|
136690
137010
|
const contract = (type !== 'spot');
|
|
@@ -136693,25 +137013,28 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
136693
137013
|
let linear = undefined;
|
|
136694
137014
|
let inverse = undefined;
|
|
136695
137015
|
const request = {};
|
|
137016
|
+
let response = undefined;
|
|
136696
137017
|
if (contract) {
|
|
136697
137018
|
linear = (subType === 'linear');
|
|
136698
137019
|
inverse = (subType === 'inverse');
|
|
136699
137020
|
if (linear) {
|
|
136700
|
-
method = 'contractPublicGetLinearSwapApiV1SwapContractInfo';
|
|
136701
137021
|
if (future) {
|
|
136702
137022
|
request['business_type'] = 'futures';
|
|
136703
137023
|
}
|
|
137024
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapContractInfo(this.extend(request, query));
|
|
136704
137025
|
}
|
|
136705
137026
|
else if (inverse) {
|
|
136706
137027
|
if (future) {
|
|
136707
|
-
|
|
137028
|
+
response = await this.contractPublicGetApiV1ContractContractInfo(this.extend(request, query));
|
|
136708
137029
|
}
|
|
136709
137030
|
else if (swap) {
|
|
136710
|
-
|
|
137031
|
+
response = await this.contractPublicGetSwapApiV1SwapContractInfo(this.extend(request, query));
|
|
136711
137032
|
}
|
|
136712
137033
|
}
|
|
136713
137034
|
}
|
|
136714
|
-
|
|
137035
|
+
else {
|
|
137036
|
+
response = await this.spotPublicGetV1CommonSymbols(this.extend(request, query));
|
|
137037
|
+
}
|
|
136715
137038
|
//
|
|
136716
137039
|
// spot
|
|
136717
137040
|
//
|
|
@@ -137098,23 +137421,25 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137098
137421
|
await this.loadMarkets();
|
|
137099
137422
|
const market = this.market(symbol);
|
|
137100
137423
|
const request = {};
|
|
137101
|
-
let
|
|
137102
|
-
let method = 'spotPublicGetMarketDetailMerged';
|
|
137424
|
+
let response = undefined;
|
|
137103
137425
|
if (market['linear']) {
|
|
137104
|
-
|
|
137105
|
-
|
|
137426
|
+
request['contract_code'] = market['id'];
|
|
137427
|
+
response = await this.contractPublicGetLinearSwapExMarketDetailMerged(this.extend(request, params));
|
|
137106
137428
|
}
|
|
137107
137429
|
else if (market['inverse']) {
|
|
137108
137430
|
if (market['future']) {
|
|
137109
|
-
|
|
137431
|
+
request['symbol'] = market['id'];
|
|
137432
|
+
response = await this.contractPublicGetMarketDetailMerged(this.extend(request, params));
|
|
137110
137433
|
}
|
|
137111
137434
|
else if (market['swap']) {
|
|
137112
|
-
|
|
137113
|
-
|
|
137435
|
+
request['contract_code'] = market['id'];
|
|
137436
|
+
response = await this.contractPublicGetSwapExMarketDetailMerged(this.extend(request, params));
|
|
137114
137437
|
}
|
|
137115
137438
|
}
|
|
137116
|
-
|
|
137117
|
-
|
|
137439
|
+
else {
|
|
137440
|
+
request['symbol'] = market['id'];
|
|
137441
|
+
response = await this.spotPublicGetMarketDetailMerged(this.extend(request, params));
|
|
137442
|
+
}
|
|
137118
137443
|
//
|
|
137119
137444
|
// spot
|
|
137120
137445
|
//
|
|
@@ -137187,7 +137512,6 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137187
137512
|
}
|
|
137188
137513
|
let type = undefined;
|
|
137189
137514
|
let subType = undefined;
|
|
137190
|
-
let method = 'spotPublicGetMarketTickers';
|
|
137191
137515
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
137192
137516
|
[subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
|
|
137193
137517
|
const request = {};
|
|
@@ -137195,24 +137519,27 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137195
137519
|
const swap = (type === 'swap');
|
|
137196
137520
|
const linear = (subType === 'linear');
|
|
137197
137521
|
const inverse = (subType === 'inverse');
|
|
137522
|
+
params = this.omit(params, ['type', 'subType']);
|
|
137523
|
+
let response = undefined;
|
|
137198
137524
|
if (future || swap) {
|
|
137199
137525
|
if (linear) {
|
|
137200
|
-
method = 'contractPublicGetLinearSwapExMarketDetailBatchMerged';
|
|
137201
137526
|
if (future) {
|
|
137202
137527
|
request['business_type'] = 'futures';
|
|
137203
137528
|
}
|
|
137529
|
+
response = await this.contractPublicGetLinearSwapExMarketDetailBatchMerged(this.extend(request, params));
|
|
137204
137530
|
}
|
|
137205
137531
|
else if (inverse) {
|
|
137206
137532
|
if (future) {
|
|
137207
|
-
|
|
137533
|
+
response = await this.contractPublicGetMarketDetailBatchMerged(this.extend(request, params));
|
|
137208
137534
|
}
|
|
137209
137535
|
else if (swap) {
|
|
137210
|
-
|
|
137536
|
+
response = await this.contractPublicGetSwapExMarketDetailBatchMerged(this.extend(request, params));
|
|
137211
137537
|
}
|
|
137212
137538
|
}
|
|
137213
137539
|
}
|
|
137214
|
-
|
|
137215
|
-
|
|
137540
|
+
else {
|
|
137541
|
+
response = await this.spotPublicGetMarketTickers(this.extend(request, params));
|
|
137542
|
+
}
|
|
137216
137543
|
//
|
|
137217
137544
|
// spot
|
|
137218
137545
|
//
|
|
@@ -137345,19 +137672,19 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137345
137672
|
// 'symbol': market['id'], // spot, future
|
|
137346
137673
|
// 'contract_code': market['id'], // swap
|
|
137347
137674
|
};
|
|
137348
|
-
let
|
|
137349
|
-
let method = 'spotPublicGetMarketDepth';
|
|
137675
|
+
let response = undefined;
|
|
137350
137676
|
if (market['linear']) {
|
|
137351
|
-
|
|
137352
|
-
|
|
137677
|
+
request['contract_code'] = market['id'];
|
|
137678
|
+
response = await this.contractPublicGetLinearSwapExMarketDepth(this.extend(request, params));
|
|
137353
137679
|
}
|
|
137354
137680
|
else if (market['inverse']) {
|
|
137355
137681
|
if (market['future']) {
|
|
137356
|
-
|
|
137682
|
+
request['symbol'] = market['id'];
|
|
137683
|
+
response = await this.contractPublicGetMarketDepth(this.extend(request, params));
|
|
137357
137684
|
}
|
|
137358
137685
|
else if (market['swap']) {
|
|
137359
|
-
|
|
137360
|
-
|
|
137686
|
+
request['contract_code'] = market['id'];
|
|
137687
|
+
response = await this.contractPublicGetSwapExMarketDepth(this.extend(request, params));
|
|
137361
137688
|
}
|
|
137362
137689
|
}
|
|
137363
137690
|
else {
|
|
@@ -137373,9 +137700,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137373
137700
|
request['depth'] = limit;
|
|
137374
137701
|
}
|
|
137375
137702
|
}
|
|
137703
|
+
request['symbol'] = market['id'];
|
|
137704
|
+
response = await this.spotPublicGetMarketDepth(this.extend(request, params));
|
|
137376
137705
|
}
|
|
137377
|
-
request[fieldName] = market['id'];
|
|
137378
|
-
const response = await this[method](this.extend(request, params));
|
|
137379
137706
|
//
|
|
137380
137707
|
// spot, future, swap
|
|
137381
137708
|
//
|
|
@@ -137626,7 +137953,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137626
137953
|
// 'direct': 'prev', // next, prev
|
|
137627
137954
|
// 'size': limit, // default 20, max 50
|
|
137628
137955
|
};
|
|
137629
|
-
let
|
|
137956
|
+
let response = undefined;
|
|
137630
137957
|
if (marketType === 'spot') {
|
|
137631
137958
|
if (symbol !== undefined) {
|
|
137632
137959
|
market = this.market(symbol);
|
|
@@ -137640,7 +137967,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137640
137967
|
// request['end-time'] = this.sum (since, 172800000); // 48 hours window
|
|
137641
137968
|
}
|
|
137642
137969
|
[request, params] = this.handleUntilOption('end-time', request, params);
|
|
137643
|
-
|
|
137970
|
+
response = await this.spotPrivateGetV1OrderMatchresults(this.extend(request, params));
|
|
137644
137971
|
}
|
|
137645
137972
|
else {
|
|
137646
137973
|
if (symbol === undefined) {
|
|
@@ -137661,26 +137988,25 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137661
137988
|
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
137662
137989
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
137663
137990
|
if (marginMode === 'isolated') {
|
|
137664
|
-
|
|
137991
|
+
response = await this.contractPrivatePostLinearSwapApiV3SwapMatchresultsExact(this.extend(request, params));
|
|
137665
137992
|
}
|
|
137666
137993
|
else if (marginMode === 'cross') {
|
|
137667
|
-
|
|
137994
|
+
response = await this.contractPrivatePostLinearSwapApiV3SwapCrossMatchresultsExact(this.extend(request, params));
|
|
137668
137995
|
}
|
|
137669
137996
|
}
|
|
137670
137997
|
else if (market['inverse']) {
|
|
137671
137998
|
if (marketType === 'future') {
|
|
137672
|
-
method = 'contractPrivatePostApiV3ContractMatchresultsExact';
|
|
137673
137999
|
request['symbol'] = market['settleId'];
|
|
138000
|
+
response = await this.contractPrivatePostApiV3ContractMatchresultsExact(this.extend(request, params));
|
|
137674
138001
|
}
|
|
137675
138002
|
else if (marketType === 'swap') {
|
|
137676
|
-
|
|
138003
|
+
response = await this.contractPrivatePostSwapApiV3SwapMatchresultsExact(this.extend(request, params));
|
|
137677
138004
|
}
|
|
137678
138005
|
else {
|
|
137679
138006
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchMyTrades() does not support ' + marketType + ' markets');
|
|
137680
138007
|
}
|
|
137681
138008
|
}
|
|
137682
138009
|
}
|
|
137683
|
-
const response = await this[method](this.extend(request, params));
|
|
137684
138010
|
//
|
|
137685
138011
|
// spot
|
|
137686
138012
|
//
|
|
@@ -137774,31 +138100,33 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137774
138100
|
// 'symbol': market['id'], // spot, future
|
|
137775
138101
|
// 'contract_code': market['id'], // swap
|
|
137776
138102
|
};
|
|
137777
|
-
|
|
137778
|
-
|
|
138103
|
+
if (limit !== undefined) {
|
|
138104
|
+
request['size'] = Math.min(limit, 2000); // max 2000
|
|
138105
|
+
}
|
|
138106
|
+
let response = undefined;
|
|
137779
138107
|
if (market['future']) {
|
|
137780
138108
|
if (market['inverse']) {
|
|
137781
|
-
|
|
138109
|
+
request['symbol'] = market['id'];
|
|
138110
|
+
response = await this.contractPublicGetMarketHistoryTrade(this.extend(request, params));
|
|
137782
138111
|
}
|
|
137783
138112
|
else if (market['linear']) {
|
|
137784
|
-
|
|
137785
|
-
|
|
138113
|
+
request['contract_code'] = market['id'];
|
|
138114
|
+
response = await this.contractPublicGetLinearSwapExMarketHistoryTrade(this.extend(request, params));
|
|
137786
138115
|
}
|
|
137787
138116
|
}
|
|
137788
138117
|
else if (market['swap']) {
|
|
138118
|
+
request['contract_code'] = market['id'];
|
|
137789
138119
|
if (market['inverse']) {
|
|
137790
|
-
|
|
138120
|
+
response = await this.contractPublicGetSwapExMarketHistoryTrade(this.extend(request, params));
|
|
137791
138121
|
}
|
|
137792
138122
|
else if (market['linear']) {
|
|
137793
|
-
|
|
138123
|
+
response = await this.contractPublicGetLinearSwapExMarketHistoryTrade(this.extend(request, params));
|
|
137794
138124
|
}
|
|
137795
|
-
fieldName = 'contract_code';
|
|
137796
138125
|
}
|
|
137797
|
-
|
|
137798
|
-
|
|
137799
|
-
|
|
138126
|
+
else {
|
|
138127
|
+
request['symbol'] = market['id'];
|
|
138128
|
+
response = await this.spotPublicGetMarketHistoryTrade(this.extend(request, params));
|
|
137800
138129
|
}
|
|
137801
|
-
const response = await this[method](this.extend(request, params));
|
|
137802
138130
|
//
|
|
137803
138131
|
// {
|
|
137804
138132
|
// "status": "ok",
|
|
@@ -137889,109 +138217,111 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
137889
138217
|
// 'from': parseInt ((since / 1000).toString ()), spot only
|
|
137890
138218
|
// 'to': this.seconds (), spot only
|
|
137891
138219
|
};
|
|
137892
|
-
let fieldName = 'symbol';
|
|
137893
138220
|
const price = this.safeString(params, 'price');
|
|
137894
138221
|
params = this.omit(params, 'price');
|
|
137895
|
-
|
|
137896
|
-
|
|
137897
|
-
|
|
137898
|
-
//
|
|
137899
|
-
// https://github.com/ccxt/ccxt/issues/18006
|
|
137900
|
-
method = 'spotPublicGetMarketHistoryKline';
|
|
138222
|
+
if (market['contract']) {
|
|
138223
|
+
if (limit !== undefined) {
|
|
138224
|
+
request['size'] = limit; // when using limit from and to are ignored
|
|
138225
|
+
// https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
|
|
137901
138226
|
}
|
|
137902
|
-
|
|
137903
|
-
|
|
138227
|
+
else {
|
|
138228
|
+
limit = 2000; // only used for from/to calculation
|
|
137904
138229
|
}
|
|
137905
|
-
if (
|
|
137906
|
-
|
|
138230
|
+
if (price === undefined) {
|
|
138231
|
+
const duration = this.parseTimeframe(timeframe);
|
|
138232
|
+
if (since === undefined) {
|
|
138233
|
+
const now = this.seconds();
|
|
138234
|
+
request['from'] = now - duration * (limit - 1);
|
|
138235
|
+
request['to'] = now;
|
|
138236
|
+
}
|
|
138237
|
+
else {
|
|
138238
|
+
const start = this.parseToInt(since / 1000);
|
|
138239
|
+
request['from'] = start;
|
|
138240
|
+
request['to'] = this.sum(start, duration * (limit - 1));
|
|
138241
|
+
}
|
|
137907
138242
|
}
|
|
137908
138243
|
}
|
|
137909
|
-
|
|
138244
|
+
let response = undefined;
|
|
138245
|
+
if (market['future']) {
|
|
137910
138246
|
if (market['inverse']) {
|
|
138247
|
+
request['symbol'] = market['id'];
|
|
137911
138248
|
if (price === 'mark') {
|
|
137912
|
-
|
|
138249
|
+
response = await this.contractPublicGetIndexMarketHistoryMarkPriceKline(this.extend(request, params));
|
|
137913
138250
|
}
|
|
137914
138251
|
else if (price === 'index') {
|
|
137915
|
-
|
|
138252
|
+
response = await this.contractPublicGetIndexMarketHistoryIndex(this.extend(request, params));
|
|
137916
138253
|
}
|
|
137917
138254
|
else if (price === 'premiumIndex') {
|
|
137918
138255
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
|
|
137919
138256
|
}
|
|
137920
138257
|
else {
|
|
137921
|
-
|
|
138258
|
+
response = await this.contractPublicGetMarketHistoryKline(this.extend(request, params));
|
|
137922
138259
|
}
|
|
137923
138260
|
}
|
|
137924
138261
|
else if (market['linear']) {
|
|
138262
|
+
request['contract_code'] = market['id'];
|
|
137925
138263
|
if (price === 'mark') {
|
|
137926
|
-
|
|
138264
|
+
response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
|
|
137927
138265
|
}
|
|
137928
138266
|
else if (price === 'index') {
|
|
137929
138267
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
|
|
137930
138268
|
}
|
|
137931
138269
|
else if (price === 'premiumIndex') {
|
|
137932
|
-
|
|
138270
|
+
response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
|
|
137933
138271
|
}
|
|
137934
138272
|
else {
|
|
137935
|
-
|
|
138273
|
+
response = await this.contractPublicGetLinearSwapExMarketHistoryKline(this.extend(request, params));
|
|
137936
138274
|
}
|
|
137937
|
-
fieldName = 'contract_code';
|
|
137938
138275
|
}
|
|
137939
138276
|
}
|
|
137940
138277
|
else if (market['swap']) {
|
|
138278
|
+
request['contract_code'] = market['id'];
|
|
137941
138279
|
if (market['inverse']) {
|
|
137942
138280
|
if (price === 'mark') {
|
|
137943
|
-
|
|
138281
|
+
response = await this.contractPublicGetIndexMarketHistorySwapMarkPriceKline(this.extend(request, params));
|
|
137944
138282
|
}
|
|
137945
138283
|
else if (price === 'index') {
|
|
137946
138284
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
|
|
137947
138285
|
}
|
|
137948
138286
|
else if (price === 'premiumIndex') {
|
|
137949
|
-
|
|
138287
|
+
response = await this.contractPublicGetIndexMarketHistorySwapPremiumIndexKline(this.extend(request, params));
|
|
137950
138288
|
}
|
|
137951
138289
|
else {
|
|
137952
|
-
|
|
138290
|
+
response = await this.contractPublicGetSwapExMarketHistoryKline(this.extend(request, params));
|
|
137953
138291
|
}
|
|
137954
138292
|
}
|
|
137955
138293
|
else if (market['linear']) {
|
|
137956
138294
|
if (price === 'mark') {
|
|
137957
|
-
|
|
138295
|
+
response = await this.contractPublicGetIndexMarketHistoryLinearSwapMarkPriceKline(this.extend(request, params));
|
|
137958
138296
|
}
|
|
137959
138297
|
else if (price === 'index') {
|
|
137960
138298
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' ' + market['type'] + ' has no api endpoint for ' + price + ' kline data');
|
|
137961
138299
|
}
|
|
137962
138300
|
else if (price === 'premiumIndex') {
|
|
137963
|
-
|
|
138301
|
+
response = await this.contractPublicGetIndexMarketHistoryLinearSwapPremiumIndexKline(this.extend(request, params));
|
|
137964
138302
|
}
|
|
137965
138303
|
else {
|
|
137966
|
-
|
|
138304
|
+
response = await this.contractPublicGetLinearSwapExMarketHistoryKline(this.extend(request, params));
|
|
137967
138305
|
}
|
|
137968
138306
|
}
|
|
137969
|
-
fieldName = 'contract_code';
|
|
137970
138307
|
}
|
|
137971
|
-
|
|
138308
|
+
else {
|
|
138309
|
+
if (since !== undefined) {
|
|
138310
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
138311
|
+
}
|
|
137972
138312
|
if (limit !== undefined) {
|
|
137973
|
-
request['size'] = limit; //
|
|
137974
|
-
// https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data
|
|
138313
|
+
request['size'] = limit; // max 2000
|
|
137975
138314
|
}
|
|
137976
|
-
|
|
137977
|
-
|
|
138315
|
+
request['symbol'] = market['id'];
|
|
138316
|
+
if (timeframe === '1M' || timeframe === '1y') {
|
|
138317
|
+
// for some reason 1M and 1Y does not work with the regular endpoint
|
|
138318
|
+
// https://github.com/ccxt/ccxt/issues/18006
|
|
138319
|
+
response = await this.spotPublicGetMarketHistoryKline(this.extend(request, params));
|
|
137978
138320
|
}
|
|
137979
|
-
|
|
137980
|
-
|
|
137981
|
-
if (since === undefined) {
|
|
137982
|
-
const now = this.seconds();
|
|
137983
|
-
request['from'] = now - duration * (limit - 1);
|
|
137984
|
-
request['to'] = now;
|
|
137985
|
-
}
|
|
137986
|
-
else {
|
|
137987
|
-
const start = this.parseToInt(since / 1000);
|
|
137988
|
-
request['from'] = start;
|
|
137989
|
-
request['to'] = this.sum(start, duration * (limit - 1));
|
|
137990
|
-
}
|
|
138321
|
+
else {
|
|
138322
|
+
response = await this.spotPublicGetMarketHistoryCandles(this.extend(request, params));
|
|
137991
138323
|
}
|
|
137992
138324
|
}
|
|
137993
|
-
request[fieldName] = market['id'];
|
|
137994
|
-
const response = await this[method](this.extend(request, params));
|
|
137995
138325
|
//
|
|
137996
138326
|
// {
|
|
137997
138327
|
// "status":"ok",
|
|
@@ -138608,58 +138938,57 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
138608
138938
|
// 'pair': 'BTC-USDT',
|
|
138609
138939
|
// 'contract_type': 'this_week', // swap, this_week, next_week, quarter, next_ quarter
|
|
138610
138940
|
};
|
|
138611
|
-
let
|
|
138941
|
+
let response = undefined;
|
|
138612
138942
|
if (marketType === 'spot') {
|
|
138613
138943
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
138614
|
-
method = 'spotPrivateGetV1OrderOrdersOrderId';
|
|
138615
138944
|
if (clientOrderId !== undefined) {
|
|
138616
|
-
method = 'spotPrivateGetV1OrderOrdersGetClientOrder';
|
|
138617
138945
|
// will be filled below in extend ()
|
|
138618
138946
|
// they expect clientOrderId instead of client-order-id
|
|
138619
138947
|
// request['clientOrderId'] = clientOrderId;
|
|
138948
|
+
response = await this.spotPrivateGetV1OrderOrdersGetClientOrder(this.extend(request, params));
|
|
138620
138949
|
}
|
|
138621
138950
|
else {
|
|
138622
138951
|
request['order-id'] = id;
|
|
138952
|
+
response = await this.spotPrivateGetV1OrderOrdersOrderId(this.extend(request, params));
|
|
138623
138953
|
}
|
|
138624
138954
|
}
|
|
138625
138955
|
else {
|
|
138626
138956
|
if (symbol === undefined) {
|
|
138627
138957
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
138628
138958
|
}
|
|
138959
|
+
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
138960
|
+
if (clientOrderId === undefined) {
|
|
138961
|
+
request['order_id'] = id;
|
|
138962
|
+
}
|
|
138963
|
+
else {
|
|
138964
|
+
request['client_order_id'] = clientOrderId;
|
|
138965
|
+
params = this.omit(params, ['client_order_id', 'clientOrderId']);
|
|
138966
|
+
}
|
|
138629
138967
|
request['contract_code'] = market['id'];
|
|
138630
138968
|
if (market['linear']) {
|
|
138631
138969
|
let marginMode = undefined;
|
|
138632
138970
|
[marginMode, params] = this.handleMarginModeAndParams('fetchOrder', params);
|
|
138633
138971
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
138634
138972
|
if (marginMode === 'isolated') {
|
|
138635
|
-
|
|
138973
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapOrderInfo(this.extend(request, params));
|
|
138636
138974
|
}
|
|
138637
138975
|
else if (marginMode === 'cross') {
|
|
138638
|
-
|
|
138976
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossOrderInfo(this.extend(request, params));
|
|
138639
138977
|
}
|
|
138640
138978
|
}
|
|
138641
138979
|
else if (market['inverse']) {
|
|
138642
138980
|
if (marketType === 'future') {
|
|
138643
|
-
method = 'contractPrivatePostApiV1ContractOrderInfo';
|
|
138644
138981
|
request['symbol'] = market['settleId'];
|
|
138982
|
+
response = await this.contractPrivatePostApiV1ContractOrderInfo(this.extend(request, params));
|
|
138645
138983
|
}
|
|
138646
138984
|
else if (marketType === 'swap') {
|
|
138647
|
-
|
|
138985
|
+
response = await this.contractPrivatePostSwapApiV1SwapOrderInfo(this.extend(request, params));
|
|
138648
138986
|
}
|
|
138649
138987
|
else {
|
|
138650
138988
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrder() does not support ' + marketType + ' markets');
|
|
138651
138989
|
}
|
|
138652
138990
|
}
|
|
138653
|
-
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
138654
|
-
if (clientOrderId === undefined) {
|
|
138655
|
-
request['order_id'] = id;
|
|
138656
|
-
}
|
|
138657
|
-
else {
|
|
138658
|
-
request['client_order_id'] = clientOrderId;
|
|
138659
|
-
params = this.omit(params, ['client_order_id', 'clientOrderId']);
|
|
138660
|
-
}
|
|
138661
138991
|
}
|
|
138662
|
-
const response = await this[method](this.extend(request, params));
|
|
138663
138992
|
//
|
|
138664
138993
|
// spot
|
|
138665
138994
|
//
|
|
@@ -141358,7 +141687,6 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141358
141687
|
};
|
|
141359
141688
|
let subType = undefined;
|
|
141360
141689
|
[subType, params] = this.handleSubTypeAndParams('transfer', undefined, params);
|
|
141361
|
-
let method = undefined;
|
|
141362
141690
|
let fromAccountId = this.convertTypeToAccount(fromAccount);
|
|
141363
141691
|
let toAccountId = this.convertTypeToAccount(toAccount);
|
|
141364
141692
|
const toCross = toAccountId === 'cross';
|
|
@@ -141371,28 +141699,28 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141371
141699
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' transfer () cannot make a transfer between ' + fromAccount + ' and ' + toAccount);
|
|
141372
141700
|
}
|
|
141373
141701
|
const fromOrToFuturesAccount = (fromAccountId === 'futures') || (toAccountId === 'futures');
|
|
141702
|
+
let response = undefined;
|
|
141374
141703
|
if (fromOrToFuturesAccount) {
|
|
141375
141704
|
let type = fromAccountId + '-to-' + toAccountId;
|
|
141376
141705
|
type = this.safeString(params, 'type', type);
|
|
141377
141706
|
request['type'] = type;
|
|
141378
|
-
|
|
141707
|
+
response = await this.spotPrivatePostV1FuturesTransfer(this.extend(request, params));
|
|
141379
141708
|
}
|
|
141380
141709
|
else if (fromSpot && toCross) {
|
|
141381
|
-
|
|
141710
|
+
response = await this.privatePostCrossMarginTransferIn(this.extend(request, params));
|
|
141382
141711
|
}
|
|
141383
141712
|
else if (fromCross && toSpot) {
|
|
141384
|
-
|
|
141713
|
+
response = await this.privatePostCrossMarginTransferOut(this.extend(request, params));
|
|
141385
141714
|
}
|
|
141386
141715
|
else if (fromSpot && toIsolated) {
|
|
141387
141716
|
request['symbol'] = toAccountId;
|
|
141388
|
-
|
|
141717
|
+
response = await this.privatePostDwTransferInMargin(this.extend(request, params));
|
|
141389
141718
|
}
|
|
141390
141719
|
else if (fromIsolated && toSpot) {
|
|
141391
141720
|
request['symbol'] = fromAccountId;
|
|
141392
|
-
|
|
141721
|
+
response = await this.privatePostDwTransferOutMargin(this.extend(request, params));
|
|
141393
141722
|
}
|
|
141394
141723
|
else {
|
|
141395
|
-
method = 'v2PrivatePostAccountTransfer';
|
|
141396
141724
|
if (subType === 'linear') {
|
|
141397
141725
|
if ((fromAccountId === 'swap') || (fromAccount === 'linear-swap')) {
|
|
141398
141726
|
fromAccountId = 'linear-swap';
|
|
@@ -141413,8 +141741,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141413
141741
|
}
|
|
141414
141742
|
request['from'] = fromSpot ? 'spot' : fromAccountId;
|
|
141415
141743
|
request['to'] = toSpot ? 'spot' : toAccountId;
|
|
141744
|
+
response = await this.v2PrivatePostAccountTransfer(this.extend(request, params));
|
|
141416
141745
|
}
|
|
141417
|
-
const response = await this[method](this.extend(request, params));
|
|
141418
141746
|
//
|
|
141419
141747
|
// {
|
|
141420
141748
|
// "code": "200",
|
|
@@ -141541,17 +141869,16 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141541
141869
|
const request = {
|
|
141542
141870
|
'contract_code': market['id'],
|
|
141543
141871
|
};
|
|
141544
|
-
let
|
|
141872
|
+
let response = undefined;
|
|
141545
141873
|
if (market['inverse']) {
|
|
141546
|
-
|
|
141874
|
+
response = await this.contractPublicGetSwapApiV1SwapHistoricalFundingRate(this.extend(request, params));
|
|
141547
141875
|
}
|
|
141548
141876
|
else if (market['linear']) {
|
|
141549
|
-
|
|
141877
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapHistoricalFundingRate(this.extend(request, params));
|
|
141550
141878
|
}
|
|
141551
141879
|
else {
|
|
141552
141880
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingRateHistory() supports inverse and linear swaps only');
|
|
141553
141881
|
}
|
|
141554
|
-
const response = await this[method](this.extend(request, params));
|
|
141555
141882
|
//
|
|
141556
141883
|
// {
|
|
141557
141884
|
// "status": "ok",
|
|
@@ -141647,20 +141974,19 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141647
141974
|
*/
|
|
141648
141975
|
await this.loadMarkets();
|
|
141649
141976
|
const market = this.market(symbol);
|
|
141650
|
-
|
|
141977
|
+
const request = {
|
|
141978
|
+
'contract_code': market['id'],
|
|
141979
|
+
};
|
|
141980
|
+
let response = undefined;
|
|
141651
141981
|
if (market['inverse']) {
|
|
141652
|
-
|
|
141982
|
+
response = await this.contractPublicGetSwapApiV1SwapFundingRate(this.extend(request, params));
|
|
141653
141983
|
}
|
|
141654
141984
|
else if (market['linear']) {
|
|
141655
|
-
|
|
141985
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapFundingRate(this.extend(request, params));
|
|
141656
141986
|
}
|
|
141657
141987
|
else {
|
|
141658
141988
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingRate() supports inverse and linear swaps only');
|
|
141659
141989
|
}
|
|
141660
|
-
const request = {
|
|
141661
|
-
'contract_code': market['id'],
|
|
141662
|
-
};
|
|
141663
|
-
const response = await this[method](this.extend(request, params));
|
|
141664
141990
|
//
|
|
141665
141991
|
// {
|
|
141666
141992
|
// "status": "ok",
|
|
@@ -141697,12 +142023,17 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141697
142023
|
const request = {
|
|
141698
142024
|
// 'contract_code': market['id'],
|
|
141699
142025
|
};
|
|
141700
|
-
const method = this.getSupportedMapping(subType, {
|
|
141701
|
-
'linear': 'contractPublicGetLinearSwapApiV1SwapBatchFundingRate',
|
|
141702
|
-
'inverse': 'contractPublicGetSwapApiV1SwapBatchFundingRate',
|
|
141703
|
-
});
|
|
141704
142026
|
params = this.omit(params, 'subType');
|
|
141705
|
-
|
|
142027
|
+
let response = undefined;
|
|
142028
|
+
if (subType === 'linear') {
|
|
142029
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapBatchFundingRate(this.extend(request, params));
|
|
142030
|
+
}
|
|
142031
|
+
else if (subType === 'inverse') {
|
|
142032
|
+
response = await this.contractPublicGetSwapApiV1SwapBatchFundingRate(this.extend(request, params));
|
|
142033
|
+
}
|
|
142034
|
+
else {
|
|
142035
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingRates() not support this market type');
|
|
142036
|
+
}
|
|
141706
142037
|
//
|
|
141707
142038
|
// {
|
|
141708
142039
|
// "status": "ok",
|
|
@@ -141749,22 +142080,21 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
141749
142080
|
request['size'] = limit;
|
|
141750
142081
|
}
|
|
141751
142082
|
let market = undefined;
|
|
141752
|
-
let
|
|
142083
|
+
let response = undefined;
|
|
141753
142084
|
if (marginMode === 'isolated') {
|
|
141754
|
-
method = 'privateGetMarginLoanOrders';
|
|
141755
142085
|
if (symbol !== undefined) {
|
|
141756
142086
|
market = this.market(symbol);
|
|
141757
142087
|
request['symbol'] = market['id'];
|
|
141758
142088
|
}
|
|
142089
|
+
response = await this.privateGetMarginLoanOrders(this.extend(request, params));
|
|
141759
142090
|
}
|
|
141760
142091
|
else { // Cross
|
|
141761
|
-
method = 'privateGetCrossMarginLoanOrders';
|
|
141762
142092
|
if (code !== undefined) {
|
|
141763
142093
|
const currency = this.currency(code);
|
|
141764
142094
|
request['currency'] = currency['id'];
|
|
141765
142095
|
}
|
|
142096
|
+
response = await this.privateGetCrossMarginLoanOrders(this.extend(request, params));
|
|
141766
142097
|
}
|
|
141767
|
-
const response = await this[method](this.extend(request, params));
|
|
141768
142098
|
//
|
|
141769
142099
|
// {
|
|
141770
142100
|
// "status":"ok",
|
|
@@ -142027,17 +142357,16 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142027
142357
|
await this.loadMarkets();
|
|
142028
142358
|
const market = this.market(symbol);
|
|
142029
142359
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchFundingHistory', market, params);
|
|
142030
|
-
let method = undefined;
|
|
142031
142360
|
const request = {
|
|
142032
142361
|
'type': '30,31',
|
|
142033
142362
|
};
|
|
142034
142363
|
if (since !== undefined) {
|
|
142035
142364
|
request['start_date'] = since;
|
|
142036
142365
|
}
|
|
142366
|
+
let response = undefined;
|
|
142037
142367
|
if (marketType === 'swap') {
|
|
142038
142368
|
request['contract'] = market['id'];
|
|
142039
142369
|
if (market['linear']) {
|
|
142040
|
-
method = 'contractPrivatePostLinearSwapApiV3SwapFinancialRecordExact';
|
|
142041
142370
|
//
|
|
142042
142371
|
// {
|
|
142043
142372
|
// "status": "ok",
|
|
@@ -142069,9 +142398,9 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142069
142398
|
else {
|
|
142070
142399
|
request['mar_acct'] = market['quoteId'];
|
|
142071
142400
|
}
|
|
142401
|
+
response = await this.contractPrivatePostLinearSwapApiV3SwapFinancialRecordExact(this.extend(request, query));
|
|
142072
142402
|
}
|
|
142073
142403
|
else {
|
|
142074
|
-
method = 'contractPrivatePostSwapApiV3SwapFinancialRecordExact';
|
|
142075
142404
|
//
|
|
142076
142405
|
// {
|
|
142077
142406
|
// "code": 200,
|
|
@@ -142092,13 +142421,13 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142092
142421
|
// "ts": 1604312615051
|
|
142093
142422
|
// }
|
|
142094
142423
|
//
|
|
142424
|
+
response = await this.contractPrivatePostSwapApiV3SwapFinancialRecordExact(this.extend(request, query));
|
|
142095
142425
|
}
|
|
142096
142426
|
}
|
|
142097
142427
|
else {
|
|
142098
|
-
method = 'contractPrivatePostApiV3ContractFinancialRecordExact';
|
|
142099
142428
|
request['symbol'] = market['id'];
|
|
142429
|
+
response = await this.contractPrivatePostApiV3ContractFinancialRecordExact(this.extend(request, query));
|
|
142100
142430
|
}
|
|
142101
|
-
const response = await this[method](this.extend(request, query));
|
|
142102
142431
|
const data = this.safeValue(response, 'data', []);
|
|
142103
142432
|
return this.parseIncomes(data, market, since, limit);
|
|
142104
142433
|
}
|
|
@@ -142118,15 +142447,29 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142118
142447
|
await this.loadMarkets();
|
|
142119
142448
|
const market = this.market(symbol);
|
|
142120
142449
|
const [marketType, query] = this.handleMarketTypeAndParams('setLeverage', market, params);
|
|
142121
|
-
|
|
142450
|
+
const request = {
|
|
142451
|
+
'lever_rate': leverage,
|
|
142452
|
+
};
|
|
142453
|
+
if (marketType === 'future' && market['inverse']) {
|
|
142454
|
+
request['symbol'] = market['settleId'];
|
|
142455
|
+
}
|
|
142456
|
+
else {
|
|
142457
|
+
request['contract_code'] = market['id'];
|
|
142458
|
+
}
|
|
142459
|
+
let response = undefined;
|
|
142122
142460
|
if (market['linear']) {
|
|
142123
142461
|
let marginMode = undefined;
|
|
142124
142462
|
[marginMode, params] = this.handleMarginModeAndParams('setLeverage', params);
|
|
142125
142463
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
142126
|
-
|
|
142127
|
-
|
|
142128
|
-
|
|
142129
|
-
|
|
142464
|
+
if (marginMode === 'isolated') {
|
|
142465
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapSwitchLeverRate(this.extend(request, query));
|
|
142466
|
+
}
|
|
142467
|
+
else if (marginMode === 'cross') {
|
|
142468
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossSwitchLeverRate(this.extend(request, query));
|
|
142469
|
+
}
|
|
142470
|
+
else {
|
|
142471
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setLeverage() not support this market type');
|
|
142472
|
+
}
|
|
142130
142473
|
//
|
|
142131
142474
|
// {
|
|
142132
142475
|
// "status": "ok",
|
|
@@ -142140,10 +142483,15 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142140
142483
|
//
|
|
142141
142484
|
}
|
|
142142
142485
|
else {
|
|
142143
|
-
|
|
142144
|
-
|
|
142145
|
-
|
|
142146
|
-
|
|
142486
|
+
if (marketType === 'future') {
|
|
142487
|
+
response = await this.contractPrivatePostApiV1ContractSwitchLeverRate(this.extend(request, query));
|
|
142488
|
+
}
|
|
142489
|
+
else if (marketType === 'swap') {
|
|
142490
|
+
response = await this.contractPrivatePostSwapApiV1SwapSwitchLeverRate(this.extend(request, query));
|
|
142491
|
+
}
|
|
142492
|
+
else {
|
|
142493
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setLeverage() not support this market type');
|
|
142494
|
+
}
|
|
142147
142495
|
//
|
|
142148
142496
|
// future
|
|
142149
142497
|
// {
|
|
@@ -142161,16 +142509,6 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142161
142509
|
// }
|
|
142162
142510
|
//
|
|
142163
142511
|
}
|
|
142164
|
-
const request = {
|
|
142165
|
-
'lever_rate': leverage,
|
|
142166
|
-
};
|
|
142167
|
-
if (marketType === 'future' && market['inverse']) {
|
|
142168
|
-
request['symbol'] = market['settleId'];
|
|
142169
|
-
}
|
|
142170
|
-
else {
|
|
142171
|
-
request['contract_code'] = market['id'];
|
|
142172
|
-
}
|
|
142173
|
-
const response = await this[method](this.extend(request, query));
|
|
142174
142512
|
return response;
|
|
142175
142513
|
}
|
|
142176
142514
|
parseIncome(income, market = undefined) {
|
|
@@ -142318,12 +142656,17 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142318
142656
|
if (marketType === 'spot') {
|
|
142319
142657
|
marketType = 'future';
|
|
142320
142658
|
}
|
|
142321
|
-
let
|
|
142659
|
+
let response = undefined;
|
|
142322
142660
|
if (subType === 'linear') {
|
|
142323
|
-
|
|
142324
|
-
|
|
142325
|
-
|
|
142326
|
-
|
|
142661
|
+
if (marginMode === 'isolated') {
|
|
142662
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapPositionInfo(params);
|
|
142663
|
+
}
|
|
142664
|
+
else if (marginMode === 'cross') {
|
|
142665
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossPositionInfo(params);
|
|
142666
|
+
}
|
|
142667
|
+
else {
|
|
142668
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPositions() not support this market type');
|
|
142669
|
+
}
|
|
142327
142670
|
//
|
|
142328
142671
|
// {
|
|
142329
142672
|
// "status": "ok",
|
|
@@ -142353,10 +142696,15 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142353
142696
|
//
|
|
142354
142697
|
}
|
|
142355
142698
|
else {
|
|
142356
|
-
|
|
142357
|
-
|
|
142358
|
-
|
|
142359
|
-
|
|
142699
|
+
if (marketType === 'future') {
|
|
142700
|
+
response = await this.contractPrivatePostApiV1ContractPositionInfo(params);
|
|
142701
|
+
}
|
|
142702
|
+
else if (marketType === 'swap') {
|
|
142703
|
+
response = await this.contractPrivatePostSwapApiV1SwapPositionInfo(params);
|
|
142704
|
+
}
|
|
142705
|
+
else {
|
|
142706
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPositions() not support this market type');
|
|
142707
|
+
}
|
|
142360
142708
|
//
|
|
142361
142709
|
// future
|
|
142362
142710
|
// {
|
|
@@ -142408,7 +142756,6 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142408
142756
|
// }
|
|
142409
142757
|
//
|
|
142410
142758
|
}
|
|
142411
|
-
const response = await this[method](params);
|
|
142412
142759
|
const data = this.safeValue(response, 'data', []);
|
|
142413
142760
|
const timestamp = this.safeInteger(response, 'ts');
|
|
142414
142761
|
const result = [];
|
|
@@ -142437,12 +142784,27 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142437
142784
|
[marginMode, params] = this.handleMarginModeAndParams('fetchPosition', params);
|
|
142438
142785
|
marginMode = (marginMode === undefined) ? 'cross' : marginMode;
|
|
142439
142786
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchPosition', market, params);
|
|
142440
|
-
|
|
142787
|
+
const request = {};
|
|
142788
|
+
if (market['future'] && market['inverse']) {
|
|
142789
|
+
request['symbol'] = market['settleId'];
|
|
142790
|
+
}
|
|
142791
|
+
else {
|
|
142792
|
+
if (marginMode === 'cross') {
|
|
142793
|
+
request['margin_account'] = 'USDT'; // only allowed value
|
|
142794
|
+
}
|
|
142795
|
+
request['contract_code'] = market['id'];
|
|
142796
|
+
}
|
|
142797
|
+
let response = undefined;
|
|
142441
142798
|
if (market['linear']) {
|
|
142442
|
-
|
|
142443
|
-
|
|
142444
|
-
|
|
142445
|
-
|
|
142799
|
+
if (marginMode === 'isolated') {
|
|
142800
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapAccountPositionInfo(this.extend(request, query));
|
|
142801
|
+
}
|
|
142802
|
+
else if (marginMode === 'cross') {
|
|
142803
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossAccountPositionInfo(this.extend(request, query));
|
|
142804
|
+
}
|
|
142805
|
+
else {
|
|
142806
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPosition() not support this market type');
|
|
142807
|
+
}
|
|
142446
142808
|
//
|
|
142447
142809
|
// isolated
|
|
142448
142810
|
//
|
|
@@ -142562,10 +142924,15 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142562
142924
|
//
|
|
142563
142925
|
}
|
|
142564
142926
|
else {
|
|
142565
|
-
|
|
142566
|
-
|
|
142567
|
-
|
|
142568
|
-
|
|
142927
|
+
if (marketType === 'future') {
|
|
142928
|
+
response = await this.contractPrivatePostApiV1ContractAccountPositionInfo(this.extend(request, query));
|
|
142929
|
+
}
|
|
142930
|
+
else if (marketType === 'swap') {
|
|
142931
|
+
response = await this.contractPrivatePostSwapApiV1SwapAccountPositionInfo(this.extend(request, query));
|
|
142932
|
+
}
|
|
142933
|
+
else {
|
|
142934
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setLeverage() not support this market type');
|
|
142935
|
+
}
|
|
142569
142936
|
//
|
|
142570
142937
|
// future, swap
|
|
142571
142938
|
//
|
|
@@ -142636,17 +143003,6 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142636
143003
|
// }
|
|
142637
143004
|
//
|
|
142638
143005
|
}
|
|
142639
|
-
const request = {};
|
|
142640
|
-
if (market['future'] && market['inverse']) {
|
|
142641
|
-
request['symbol'] = market['settleId'];
|
|
142642
|
-
}
|
|
142643
|
-
else {
|
|
142644
|
-
if (marginMode === 'cross') {
|
|
142645
|
-
request['margin_account'] = 'USDT'; // only allowed value
|
|
142646
|
-
}
|
|
142647
|
-
request['contract_code'] = market['id'];
|
|
142648
|
-
}
|
|
142649
|
-
const response = await this[method](this.extend(request, query));
|
|
142650
143006
|
const data = this.safeValue(response, 'data');
|
|
142651
143007
|
let account = undefined;
|
|
142652
143008
|
if (marginMode === 'cross') {
|
|
@@ -142977,26 +143333,28 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
142977
143333
|
'period': timeframes[timeframe],
|
|
142978
143334
|
'amount_type': amountType,
|
|
142979
143335
|
};
|
|
142980
|
-
|
|
143336
|
+
if (limit !== undefined) {
|
|
143337
|
+
request['size'] = limit;
|
|
143338
|
+
}
|
|
143339
|
+
let response = undefined;
|
|
142981
143340
|
if (market['future']) {
|
|
142982
143341
|
request['contract_type'] = this.safeString(market['info'], 'contract_type');
|
|
142983
143342
|
request['symbol'] = market['baseId']; // currency code on coin-m futures
|
|
142984
|
-
|
|
143343
|
+
// coin-m futures
|
|
143344
|
+
response = await this.contractPublicGetApiV1ContractHisOpenInterest(this.extend(request, params));
|
|
142985
143345
|
}
|
|
142986
143346
|
else if (market['linear']) {
|
|
142987
143347
|
request['contract_type'] = 'swap';
|
|
142988
143348
|
request['contract_code'] = market['id'];
|
|
142989
143349
|
request['contract_code'] = market['id'];
|
|
142990
|
-
|
|
143350
|
+
// USDT-M
|
|
143351
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapHisOpenInterest(this.extend(request, params));
|
|
142991
143352
|
}
|
|
142992
143353
|
else {
|
|
142993
143354
|
request['contract_code'] = market['id'];
|
|
142994
|
-
|
|
142995
|
-
|
|
142996
|
-
if (limit !== undefined) {
|
|
142997
|
-
request['size'] = limit;
|
|
143355
|
+
// coin-m swaps
|
|
143356
|
+
response = await this.contractPublicGetSwapApiV1SwapHisOpenInterest(this.extend(request, params));
|
|
142998
143357
|
}
|
|
142999
|
-
const response = await this[method](this.extend(request, params));
|
|
143000
143358
|
//
|
|
143001
143359
|
// contractPublicGetlinearSwapApiV1SwapHisOpenInterest
|
|
143002
143360
|
// {
|
|
@@ -143084,20 +143442,22 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143084
143442
|
const request = {
|
|
143085
143443
|
'contract_code': market['id'],
|
|
143086
143444
|
};
|
|
143087
|
-
let
|
|
143445
|
+
let response = undefined;
|
|
143088
143446
|
if (market['future']) {
|
|
143089
143447
|
request['contract_type'] = this.safeString(market['info'], 'contract_type');
|
|
143090
143448
|
request['symbol'] = market['baseId'];
|
|
143091
|
-
|
|
143449
|
+
// COIN-M futures
|
|
143450
|
+
response = await this.contractPublicGetApiV1ContractOpenInterest(this.extend(request, params));
|
|
143092
143451
|
}
|
|
143093
143452
|
else if (market['linear']) {
|
|
143094
143453
|
request['contract_type'] = 'swap';
|
|
143095
|
-
|
|
143454
|
+
// USDT-M
|
|
143455
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapOpenInterest(this.extend(request, params));
|
|
143096
143456
|
}
|
|
143097
143457
|
else {
|
|
143098
|
-
|
|
143458
|
+
// COIN-M swaps
|
|
143459
|
+
response = await this.contractPublicGetSwapApiV1SwapOpenInterest(this.extend(request, params));
|
|
143099
143460
|
}
|
|
143100
|
-
const response = await this[method](this.extend(request, params));
|
|
143101
143461
|
//
|
|
143102
143462
|
// USDT-M contractPublicGetLinearSwapApiV1SwapOpenInterest
|
|
143103
143463
|
//
|
|
@@ -143447,16 +143807,18 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
143447
143807
|
if (until !== undefined) {
|
|
143448
143808
|
request['end_at'] = until;
|
|
143449
143809
|
}
|
|
143450
|
-
let
|
|
143810
|
+
let response = undefined;
|
|
143451
143811
|
if (market['swap']) {
|
|
143452
143812
|
if (market['linear']) {
|
|
143453
|
-
|
|
143813
|
+
response = await this.contractPublicGetLinearSwapApiV1SwapSettlementRecords(this.extend(request, params));
|
|
143454
143814
|
}
|
|
143455
143815
|
else {
|
|
143456
|
-
|
|
143816
|
+
response = await this.contractPublicGetSwapApiV1SwapSettlementRecords(this.extend(request, params));
|
|
143457
143817
|
}
|
|
143458
143818
|
}
|
|
143459
|
-
|
|
143819
|
+
else {
|
|
143820
|
+
response = await this.contractPublicGetApiV1ContractSettlementRecords(this.extend(request, params));
|
|
143821
|
+
}
|
|
143460
143822
|
//
|
|
143461
143823
|
// linear swap, coin-m swap
|
|
143462
143824
|
//
|
|
@@ -155165,6 +155527,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
155165
155527
|
'commonCurrencies': {
|
|
155166
155528
|
'BIFI': 'BIFIF',
|
|
155167
155529
|
'VAI': 'VAIOT',
|
|
155530
|
+
'WAX': 'WAXP',
|
|
155168
155531
|
},
|
|
155169
155532
|
'options': {
|
|
155170
155533
|
'version': 'v1',
|
|
@@ -159113,6 +159476,8 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159113
159476
|
'createStopLimitOrder': true,
|
|
159114
159477
|
'createStopMarketOrder': true,
|
|
159115
159478
|
'createStopOrder': true,
|
|
159479
|
+
'closePosition': true,
|
|
159480
|
+
'closePositions': false,
|
|
159116
159481
|
'fetchAccounts': true,
|
|
159117
159482
|
'fetchBalance': true,
|
|
159118
159483
|
'fetchBorrowRateHistories': false,
|
|
@@ -161490,6 +161855,41 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
161490
161855
|
'datetime': this.iso8601(timestamp),
|
|
161491
161856
|
};
|
|
161492
161857
|
}
|
|
161858
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
161859
|
+
/**
|
|
161860
|
+
* @method
|
|
161861
|
+
* @name kucoinfutures#closePosition
|
|
161862
|
+
* @description closes open positions for a market
|
|
161863
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
|
|
161864
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
161865
|
+
* @param {string} side not used by kucoinfutures closePositions
|
|
161866
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
161867
|
+
* @param {string} [params.clientOrderId] client order id of the order
|
|
161868
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
161869
|
+
*/
|
|
161870
|
+
await this.loadMarkets();
|
|
161871
|
+
const market = this.market(symbol);
|
|
161872
|
+
let clientOrderId = this.safeString(params, 'clientOrderId');
|
|
161873
|
+
const testOrder = this.safeValue(params, 'test', false);
|
|
161874
|
+
params = this.omit(params, ['test', 'clientOrderId']);
|
|
161875
|
+
if (clientOrderId === undefined) {
|
|
161876
|
+
clientOrderId = this.numberToString(this.nonce());
|
|
161877
|
+
}
|
|
161878
|
+
const request = {
|
|
161879
|
+
'symbol': market['id'],
|
|
161880
|
+
'closeOrder': true,
|
|
161881
|
+
'clientOid': clientOrderId,
|
|
161882
|
+
'type': 'market',
|
|
161883
|
+
};
|
|
161884
|
+
let response = undefined;
|
|
161885
|
+
if (testOrder) {
|
|
161886
|
+
response = await this.futuresPrivatePostOrdersTest(this.extend(request, params));
|
|
161887
|
+
}
|
|
161888
|
+
else {
|
|
161889
|
+
response = await this.futuresPrivatePostOrders(this.extend(request, params));
|
|
161890
|
+
}
|
|
161891
|
+
return this.parseOrder(response, market);
|
|
161892
|
+
}
|
|
161493
161893
|
}
|
|
161494
161894
|
|
|
161495
161895
|
|
|
@@ -161600,6 +162000,8 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
161600
162000
|
'fetchWithdrawal': true,
|
|
161601
162001
|
'fetchWithdrawals': true,
|
|
161602
162002
|
'reduceMargin': false,
|
|
162003
|
+
'repayCrossMargin': false,
|
|
162004
|
+
'repayIsolatedMargin': false,
|
|
161603
162005
|
'setLeverage': false,
|
|
161604
162006
|
'setMargin': false,
|
|
161605
162007
|
'setMarginMode': false,
|
|
@@ -171404,6 +171806,8 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
171404
171806
|
'fetchWithdrawal': undefined,
|
|
171405
171807
|
'fetchWithdrawals': true,
|
|
171406
171808
|
'reduceMargin': true,
|
|
171809
|
+
'repayCrossMargin': false,
|
|
171810
|
+
'repayIsolatedMargin': false,
|
|
171407
171811
|
'setLeverage': true,
|
|
171408
171812
|
'setMarginMode': undefined,
|
|
171409
171813
|
'setPositionMode': true,
|
|
@@ -183138,7 +183542,7 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
183138
183542
|
}
|
|
183139
183543
|
if (isMarketOrder || marketIOC) {
|
|
183140
183544
|
request['ordType'] = 'market';
|
|
183141
|
-
if (
|
|
183545
|
+
if (side === 'buy') {
|
|
183142
183546
|
// spot market buy: "sz" can refer either to base currency units or to quote currency units
|
|
183143
183547
|
// see documentation: https://www.okx.com/docs-v5/en/#rest-api-trade-place-order
|
|
183144
183548
|
if (tgtCcy === 'quote_ccy') {
|
|
@@ -183171,6 +183575,9 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
183171
183575
|
request['sz'] = this.amountToPrecision(symbol, amount);
|
|
183172
183576
|
}
|
|
183173
183577
|
}
|
|
183578
|
+
else {
|
|
183579
|
+
request['sz'] = this.amountToPrecision(symbol, amount);
|
|
183580
|
+
}
|
|
183174
183581
|
}
|
|
183175
183582
|
else {
|
|
183176
183583
|
request['sz'] = this.amountToPrecision(symbol, amount);
|
|
@@ -194067,7 +194474,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194067
194474
|
'setMarginMode': true,
|
|
194068
194475
|
'setPositionMode': true,
|
|
194069
194476
|
'transfer': true,
|
|
194070
|
-
'withdraw':
|
|
194477
|
+
'withdraw': true,
|
|
194071
194478
|
},
|
|
194072
194479
|
'urls': {
|
|
194073
194480
|
'logo': 'https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg',
|
|
@@ -194206,6 +194613,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194206
194613
|
'assets/spots/sub-accounts/transfer': 5,
|
|
194207
194614
|
'assets/futures/sub-accounts/transfer': 5,
|
|
194208
194615
|
'assets/quote': 5, // ?fromCurrency=<currency>&toCurrency=<currency>&amountEv=<amount>
|
|
194616
|
+
// deposit/withdraw
|
|
194209
194617
|
},
|
|
194210
194618
|
'post': {
|
|
194211
194619
|
// spot
|
|
@@ -194440,6 +194848,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194440
194848
|
'networks': {
|
|
194441
194849
|
'TRC20': 'TRX',
|
|
194442
194850
|
'ERC20': 'ETH',
|
|
194851
|
+
'BEP20': 'BNB',
|
|
194443
194852
|
},
|
|
194444
194853
|
'defaultNetworks': {
|
|
194445
194854
|
'USDT': 'ETH',
|
|
@@ -194449,6 +194858,16 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
194449
194858
|
'spot': 'spot',
|
|
194450
194859
|
'swap': 'future',
|
|
194451
194860
|
},
|
|
194861
|
+
'stableCoins': [
|
|
194862
|
+
'BUSD',
|
|
194863
|
+
'FEI',
|
|
194864
|
+
'TUSD',
|
|
194865
|
+
'USD',
|
|
194866
|
+
'USDC',
|
|
194867
|
+
'USDD',
|
|
194868
|
+
'USDP',
|
|
194869
|
+
'USDT',
|
|
194870
|
+
],
|
|
194452
194871
|
'transfer': {
|
|
194453
194872
|
'fillResponseFromRequest': true,
|
|
194454
194873
|
},
|
|
@@ -197368,6 +197787,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197368
197787
|
const statuses = {
|
|
197369
197788
|
'Success': 'ok',
|
|
197370
197789
|
'Succeed': 'ok',
|
|
197790
|
+
'Rejected': 'failed',
|
|
197791
|
+
'Security check failed': 'failed',
|
|
197792
|
+
'SecurityCheckFailed': 'failed',
|
|
197793
|
+
'Expired': 'failed',
|
|
197794
|
+
'Address Risk': 'failed',
|
|
197795
|
+
'Security Checking': 'pending',
|
|
197796
|
+
'SecurityChecking': 'pending',
|
|
197797
|
+
'Pending Review': 'pending',
|
|
197798
|
+
'Pending Transfer': 'pending',
|
|
197799
|
+
'AmlCsApporve': 'pending',
|
|
197800
|
+
'New': 'pending',
|
|
197801
|
+
'Confirmed': 'pending',
|
|
197802
|
+
'Cancelled': 'canceled',
|
|
197371
197803
|
};
|
|
197372
197804
|
return this.safeString(statuses, status, status);
|
|
197373
197805
|
}
|
|
@@ -197375,36 +197807,68 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197375
197807
|
//
|
|
197376
197808
|
// withdraw
|
|
197377
197809
|
//
|
|
197378
|
-
//
|
|
197810
|
+
// {
|
|
197811
|
+
// "id": "10000001",
|
|
197812
|
+
// "freezeId": null,
|
|
197813
|
+
// "address": "44exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
197814
|
+
// "amountRv": "100",
|
|
197815
|
+
// "chainCode": "11",
|
|
197816
|
+
// "chainName": "TRX",
|
|
197817
|
+
// "currency": "USDT",
|
|
197818
|
+
// "currencyCode": 3,
|
|
197819
|
+
// "email": "abc@gmail.com",
|
|
197820
|
+
// "expiredTime": "0",
|
|
197821
|
+
// "feeRv": "1",
|
|
197822
|
+
// "nickName": null,
|
|
197823
|
+
// "phone": null,
|
|
197824
|
+
// "rejectReason": "",
|
|
197825
|
+
// "submitedAt": "1670000000000",
|
|
197826
|
+
// "submittedAt": "1670000000000",
|
|
197827
|
+
// "txHash": null,
|
|
197828
|
+
// "userId": "10000001",
|
|
197829
|
+
// "status": "Success"
|
|
197379
197830
|
//
|
|
197380
197831
|
// fetchDeposits
|
|
197381
197832
|
//
|
|
197382
197833
|
// {
|
|
197383
|
-
// "id":29200,
|
|
197384
|
-
// "currency":"USDT",
|
|
197385
|
-
// "currencyCode":3,
|
|
197386
|
-
// "
|
|
197387
|
-
// "
|
|
197388
|
-
// "
|
|
197389
|
-
// "
|
|
197390
|
-
// "
|
|
197391
|
-
// "
|
|
197392
|
-
// "
|
|
197834
|
+
// "id": "29200",
|
|
197835
|
+
// "currency": "USDT",
|
|
197836
|
+
// "currencyCode": "3",
|
|
197837
|
+
// "chainName": "ETH",
|
|
197838
|
+
// "chainCode": "4",
|
|
197839
|
+
// "txHash": "0x0bdbdc47807769a03b158d5753f54dfc58b92993d2f5e818db21863e01238e5d",
|
|
197840
|
+
// "address": "0x5bfbf60e0fa7f63598e6cfd8a7fd3ffac4ccc6ad",
|
|
197841
|
+
// "amountEv": "3000000000",
|
|
197842
|
+
// "confirmations": "13",
|
|
197843
|
+
// "type": "Deposit",
|
|
197844
|
+
// "status": "Success",
|
|
197845
|
+
// "createdAt": "1592722565000",
|
|
197393
197846
|
// }
|
|
197394
197847
|
//
|
|
197395
197848
|
// fetchWithdrawals
|
|
197396
197849
|
//
|
|
197397
197850
|
// {
|
|
197398
|
-
// "
|
|
197399
|
-
// "
|
|
197400
|
-
// "
|
|
197401
|
-
// "
|
|
197402
|
-
// "
|
|
197403
|
-
// "
|
|
197404
|
-
// "
|
|
197405
|
-
// "
|
|
197406
|
-
// "
|
|
197407
|
-
// "withdrawStatus: ""
|
|
197851
|
+
// "id": "10000001",
|
|
197852
|
+
// "userId": "10000001",
|
|
197853
|
+
// "freezeId": "10000002",
|
|
197854
|
+
// "phone": null,
|
|
197855
|
+
// "email": "abc@gmail.com",
|
|
197856
|
+
// "nickName": null,
|
|
197857
|
+
// "currency": "USDT",
|
|
197858
|
+
// "currencyCode": "3",
|
|
197859
|
+
// "status": "Succeed",
|
|
197860
|
+
// "withdrawStatus": "Succeed",
|
|
197861
|
+
// "amountEv": "8800000000",
|
|
197862
|
+
// "feeEv": "1200000000",
|
|
197863
|
+
// "address": "0x5xxxad",
|
|
197864
|
+
// "txHash: "0x0xxxx5d",
|
|
197865
|
+
// "submitedAt": "1702571922000",
|
|
197866
|
+
// "submittedAt": "1702571922000",
|
|
197867
|
+
// "expiredTime": "0",
|
|
197868
|
+
// "rejectReason": null,
|
|
197869
|
+
// "chainName": "ETH",
|
|
197870
|
+
// "chainCode": "4",
|
|
197871
|
+
// "proxyAddress": null
|
|
197408
197872
|
// }
|
|
197409
197873
|
//
|
|
197410
197874
|
const id = this.safeString(transaction, 'id');
|
|
@@ -197414,9 +197878,13 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197414
197878
|
const currencyId = this.safeString(transaction, 'currency');
|
|
197415
197879
|
currency = this.safeCurrency(currencyId, currency);
|
|
197416
197880
|
const code = currency['code'];
|
|
197417
|
-
const
|
|
197881
|
+
const networkId = this.safeString(transaction, 'chainName');
|
|
197882
|
+
const timestamp = this.safeIntegerN(transaction, ['createdAt', 'submitedAt', 'submittedAt']);
|
|
197418
197883
|
let type = this.safeStringLower(transaction, 'type');
|
|
197419
|
-
|
|
197884
|
+
let feeCost = this.parseNumber(this.fromEn(this.safeString(transaction, 'feeEv'), currency['valueScale']));
|
|
197885
|
+
if (feeCost === undefined) {
|
|
197886
|
+
feeCost = this.safeNumber(transaction, 'feeRv');
|
|
197887
|
+
}
|
|
197420
197888
|
let fee = undefined;
|
|
197421
197889
|
if (feeCost !== undefined) {
|
|
197422
197890
|
type = 'withdrawal';
|
|
@@ -197426,14 +197894,17 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
197426
197894
|
};
|
|
197427
197895
|
}
|
|
197428
197896
|
const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
197429
|
-
|
|
197897
|
+
let amount = this.parseNumber(this.fromEn(this.safeString(transaction, 'amountEv'), currency['valueScale']));
|
|
197898
|
+
if (amount === undefined) {
|
|
197899
|
+
amount = this.safeNumber(transaction, 'amountRv');
|
|
197900
|
+
}
|
|
197430
197901
|
return {
|
|
197431
197902
|
'info': transaction,
|
|
197432
197903
|
'id': id,
|
|
197433
197904
|
'txid': txid,
|
|
197434
197905
|
'timestamp': timestamp,
|
|
197435
197906
|
'datetime': this.iso8601(timestamp),
|
|
197436
|
-
'network':
|
|
197907
|
+
'network': this.networkIdToCode(networkId),
|
|
197437
197908
|
'address': address,
|
|
197438
197909
|
'addressTo': address,
|
|
197439
197910
|
'addressFrom': undefined,
|
|
@@ -198538,6 +199009,76 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
198538
199009
|
const sorted = this.sortBy(result, 'timestamp');
|
|
198539
199010
|
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
198540
199011
|
}
|
|
199012
|
+
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
199013
|
+
/**
|
|
199014
|
+
* @method
|
|
199015
|
+
* @name phemex#withdraw
|
|
199016
|
+
* @description make a withdrawal
|
|
199017
|
+
* @see https://phemex-docs.github.io/#create-withdraw-request
|
|
199018
|
+
* @param {string} code unified currency code
|
|
199019
|
+
* @param {float} amount the amount to withdraw
|
|
199020
|
+
* @param {string} address the address to withdraw to
|
|
199021
|
+
* @param {string} tag
|
|
199022
|
+
* @param {object} [params] extra parameters specific to the phemex api endpoint
|
|
199023
|
+
* @param {string} [params.network] unified network code
|
|
199024
|
+
* @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
199025
|
+
*/
|
|
199026
|
+
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
199027
|
+
await this.loadMarkets();
|
|
199028
|
+
this.checkAddress(address);
|
|
199029
|
+
const currency = this.currency(code);
|
|
199030
|
+
let networkCode = undefined;
|
|
199031
|
+
[networkCode, params] = this.handleNetworkCodeAndParams(params);
|
|
199032
|
+
let networkId = this.networkCodeToId(networkCode);
|
|
199033
|
+
const stableCoins = this.safeValue(this.options, 'stableCoins');
|
|
199034
|
+
if (networkId === undefined) {
|
|
199035
|
+
if (!(this.inArray(code, stableCoins))) {
|
|
199036
|
+
networkId = currency['id'];
|
|
199037
|
+
}
|
|
199038
|
+
else {
|
|
199039
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' withdraw () requires an extra argument params["network"]');
|
|
199040
|
+
}
|
|
199041
|
+
}
|
|
199042
|
+
const request = {
|
|
199043
|
+
'currency': currency['id'],
|
|
199044
|
+
'address': address,
|
|
199045
|
+
'amount': amount,
|
|
199046
|
+
'chainName': networkId.toUpperCase(),
|
|
199047
|
+
};
|
|
199048
|
+
if (tag !== undefined) {
|
|
199049
|
+
request['addressTag'] = tag;
|
|
199050
|
+
}
|
|
199051
|
+
const response = await this.privatePostPhemexWithdrawWalletsApiCreateWithdraw(this.extend(request, params));
|
|
199052
|
+
//
|
|
199053
|
+
// {
|
|
199054
|
+
// "code": 0,
|
|
199055
|
+
// "msg": "OK",
|
|
199056
|
+
// "data": {
|
|
199057
|
+
// "id": "10000001",
|
|
199058
|
+
// "freezeId": null,
|
|
199059
|
+
// "address": "44exxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
199060
|
+
// "amountRv": "100",
|
|
199061
|
+
// "chainCode": "11",
|
|
199062
|
+
// "chainName": "TRX",
|
|
199063
|
+
// "currency": "USDT",
|
|
199064
|
+
// "currencyCode": 3,
|
|
199065
|
+
// "email": "abc@gmail.com",
|
|
199066
|
+
// "expiredTime": "0",
|
|
199067
|
+
// "feeRv": "1",
|
|
199068
|
+
// "nickName": null,
|
|
199069
|
+
// "phone": null,
|
|
199070
|
+
// "rejectReason": "",
|
|
199071
|
+
// "submitedAt": "1670000000000",
|
|
199072
|
+
// "submittedAt": "1670000000000",
|
|
199073
|
+
// "txHash": null,
|
|
199074
|
+
// "userId": "10000001",
|
|
199075
|
+
// "status": "Success"
|
|
199076
|
+
// }
|
|
199077
|
+
// }
|
|
199078
|
+
//
|
|
199079
|
+
const data = this.safeValue(response, 'data', {});
|
|
199080
|
+
return this.parseTransaction(data, currency);
|
|
199081
|
+
}
|
|
198541
199082
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
198542
199083
|
if (response === undefined) {
|
|
198543
199084
|
return undefined; // fallback to default error handler
|
|
@@ -198606,6 +199147,9 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
198606
199147
|
'cancelAllOrders': true,
|
|
198607
199148
|
'cancelOrder': true,
|
|
198608
199149
|
'createDepositAddress': true,
|
|
199150
|
+
'createMarketBuyOrderWithCost': true,
|
|
199151
|
+
'createMarketOrderWithCost': false,
|
|
199152
|
+
'createMarketSellOrderWithCost': false,
|
|
198609
199153
|
'createOrder': true,
|
|
198610
199154
|
'editOrder': true,
|
|
198611
199155
|
'fetchBalance': true,
|
|
@@ -198799,6 +199343,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
198799
199343
|
'UST': 'USTC',
|
|
198800
199344
|
},
|
|
198801
199345
|
'options': {
|
|
199346
|
+
'createMarketBuyOrderRequiresPrice': true,
|
|
198802
199347
|
'networks': {
|
|
198803
199348
|
'BEP20': 'BSC',
|
|
198804
199349
|
'ERC20': 'ETH',
|
|
@@ -199822,6 +200367,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
199822
200367
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
199823
200368
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
199824
200369
|
* @param {float} [params.triggerPrice] *spot only* The price at which a trigger order is triggered at
|
|
200370
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
199825
200371
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
199826
200372
|
*/
|
|
199827
200373
|
await this.loadMarkets();
|
|
@@ -199857,7 +200403,6 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
199857
200403
|
return this.parseOrder(response, market);
|
|
199858
200404
|
}
|
|
199859
200405
|
orderRequest(symbol, type, side, amount, request, price = undefined, params = {}) {
|
|
199860
|
-
const market = this.market(symbol);
|
|
199861
200406
|
let upperCaseType = type.toUpperCase();
|
|
199862
200407
|
const isMarket = upperCaseType === 'MARKET';
|
|
199863
200408
|
const isPostOnly = this.isPostOnly(isMarket, upperCaseType === 'LIMIT_MAKER', params);
|
|
@@ -199873,7 +200418,29 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
199873
200418
|
request['type'] = upperCaseType;
|
|
199874
200419
|
if (isMarket) {
|
|
199875
200420
|
if (side === 'buy') {
|
|
199876
|
-
|
|
200421
|
+
let quoteAmount = undefined;
|
|
200422
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
200423
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
200424
|
+
const cost = this.safeNumber(params, 'cost');
|
|
200425
|
+
params = this.omit(params, 'cost');
|
|
200426
|
+
if (cost !== undefined) {
|
|
200427
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
200428
|
+
}
|
|
200429
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
200430
|
+
if (price === undefined) {
|
|
200431
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
|
|
200432
|
+
}
|
|
200433
|
+
else {
|
|
200434
|
+
const amountString = this.numberToString(amount);
|
|
200435
|
+
const priceString = this.numberToString(price);
|
|
200436
|
+
const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
200437
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
200438
|
+
}
|
|
200439
|
+
}
|
|
200440
|
+
else {
|
|
200441
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
200442
|
+
}
|
|
200443
|
+
request['amount'] = quoteAmount;
|
|
199877
200444
|
}
|
|
199878
200445
|
else {
|
|
199879
200446
|
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
@@ -204918,7 +205485,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
204918
205485
|
const subscribe = {
|
|
204919
205486
|
'id': requestId,
|
|
204920
205487
|
};
|
|
204921
|
-
const trades = await this.
|
|
205488
|
+
const trades = await this.watchMultiple(url, subParams, this.extend(request, query), subParams, subscribe);
|
|
204922
205489
|
if (this.newUpdates) {
|
|
204923
205490
|
const first = this.safeValue(trades, 0);
|
|
204924
205491
|
const tradeSymbol = this.safeString(first, 'symbol');
|
|
@@ -206398,11 +206965,11 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206398
206965
|
this.setBalanceCache(client, type);
|
|
206399
206966
|
this.setPositionsCache(client, type);
|
|
206400
206967
|
const message = undefined;
|
|
206401
|
-
const
|
|
206968
|
+
const orders = await this.watch(url, messageHash, message, type);
|
|
206402
206969
|
if (this.newUpdates) {
|
|
206403
|
-
|
|
206970
|
+
limit = orders.getLimit(symbol, limit);
|
|
206404
206971
|
}
|
|
206405
|
-
return this.filterBySymbolSinceLimit(
|
|
206972
|
+
return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
|
|
206406
206973
|
}
|
|
206407
206974
|
parseWsOrder(order, market = undefined) {
|
|
206408
206975
|
//
|
|
@@ -207063,8 +207630,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
207063
207630
|
cachedOrders.append(parsed);
|
|
207064
207631
|
const messageHash = 'orders';
|
|
207065
207632
|
const symbolSpecificMessageHash = 'orders:' + symbol;
|
|
207066
|
-
client.resolve(
|
|
207067
|
-
client.resolve(
|
|
207633
|
+
client.resolve(cachedOrders, messageHash);
|
|
207634
|
+
client.resolve(cachedOrders, symbolSpecificMessageHash);
|
|
207068
207635
|
}
|
|
207069
207636
|
}
|
|
207070
207637
|
handleAcountUpdate(client, message) {
|
|
@@ -211896,7 +212463,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
211896
212463
|
'defaultType': 'spot',
|
|
211897
212464
|
'watchBalance': {
|
|
211898
212465
|
'fetchBalanceSnapshot': true,
|
|
211899
|
-
'awaitBalanceSnapshot':
|
|
212466
|
+
'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
|
|
211900
212467
|
},
|
|
211901
212468
|
'watchOrderBook': {
|
|
211902
212469
|
'depth': 'depth50', // depth5, depth20, depth50
|
|
@@ -211976,30 +212543,31 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
211976
212543
|
const messageHash = 'balance:' + type;
|
|
211977
212544
|
const url = this.implodeHostname(this.urls['api']['ws'][type]['private']);
|
|
211978
212545
|
const client = this.client(url);
|
|
211979
|
-
this.setBalanceCache(client, type);
|
|
211980
|
-
|
|
211981
|
-
|
|
212546
|
+
this.setBalanceCache(client, type, messageHash);
|
|
212547
|
+
let fetchBalanceSnapshot = undefined;
|
|
212548
|
+
let awaitBalanceSnapshot = undefined;
|
|
212549
|
+
[fetchBalanceSnapshot, params] = this.handleOptionAndParams(this.options, 'watchBalance', 'fetchBalanceSnapshot', true);
|
|
212550
|
+
[awaitBalanceSnapshot, params] = this.handleOptionAndParams(this.options, 'watchBalance', 'awaitBalanceSnapshot', false);
|
|
211982
212551
|
if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
|
|
211983
212552
|
await client.future(type + ':fetchBalanceSnapshot');
|
|
211984
212553
|
}
|
|
211985
212554
|
return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
211986
212555
|
}
|
|
211987
|
-
setBalanceCache(client, type) {
|
|
211988
|
-
if (
|
|
211989
|
-
return
|
|
212556
|
+
setBalanceCache(client, type, subscribeHash) {
|
|
212557
|
+
if (subscribeHash in client.subscriptions) {
|
|
212558
|
+
return;
|
|
211990
212559
|
}
|
|
211991
212560
|
const options = this.safeValue(this.options, 'watchBalance');
|
|
211992
|
-
const
|
|
211993
|
-
if (
|
|
211994
|
-
const messageHash = type + ':fetchBalanceSnapshot';
|
|
212561
|
+
const snapshot = this.safeValue(options, 'fetchBalanceSnapshot', true);
|
|
212562
|
+
if (snapshot) {
|
|
212563
|
+
const messageHash = type + ':' + 'fetchBalanceSnapshot';
|
|
211995
212564
|
if (!(messageHash in client.futures)) {
|
|
211996
212565
|
client.future(messageHash);
|
|
211997
212566
|
this.spawn(this.loadBalanceSnapshot, client, messageHash, type);
|
|
211998
212567
|
}
|
|
211999
212568
|
}
|
|
212000
|
-
|
|
212001
|
-
|
|
212002
|
-
}
|
|
212569
|
+
this.balance[type] = {};
|
|
212570
|
+
// without this comment, transpilation breaks for some reason...
|
|
212003
212571
|
}
|
|
212004
212572
|
async loadBalanceSnapshot(client, messageHash, type) {
|
|
212005
212573
|
const response = await this.fetchBalance({ 'type': type });
|
|
@@ -212046,15 +212614,15 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212046
212614
|
}
|
|
212047
212615
|
const isSpot = (channel.indexOf('spot') >= 0);
|
|
212048
212616
|
const type = isSpot ? 'spot' : 'swap';
|
|
212049
|
-
this.balance['info'] = message;
|
|
212617
|
+
this.balance[type]['info'] = message;
|
|
212050
212618
|
if (isSpot) {
|
|
212051
212619
|
if (!Array.isArray(data)) {
|
|
212052
212620
|
return;
|
|
212053
212621
|
}
|
|
212054
212622
|
for (let i = 0; i < data.length; i++) {
|
|
212055
212623
|
const timestamp = this.safeInteger(message, 'event_time');
|
|
212056
|
-
this.balance['timestamp'] = timestamp;
|
|
212057
|
-
this.balance['datetime'] = this.iso8601(timestamp);
|
|
212624
|
+
this.balance[type]['timestamp'] = timestamp;
|
|
212625
|
+
this.balance[type]['datetime'] = this.iso8601(timestamp);
|
|
212058
212626
|
const balanceDetails = this.safeValue(data[i], 'balance_details', []);
|
|
212059
212627
|
for (let ii = 0; ii < balanceDetails.length; ii++) {
|
|
212060
212628
|
const rawBalance = balanceDetails[i];
|
|
@@ -212062,8 +212630,8 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212062
212630
|
const currencyId = this.safeString(rawBalance, 'ccy');
|
|
212063
212631
|
const code = this.safeCurrencyCode(currencyId);
|
|
212064
212632
|
account['free'] = this.safeString(rawBalance, 'av_bal');
|
|
212065
|
-
account['
|
|
212066
|
-
this.balance[code] = account;
|
|
212633
|
+
account['used'] = this.safeString(rawBalance, 'fz_bal');
|
|
212634
|
+
this.balance[type][code] = account;
|
|
212067
212635
|
}
|
|
212068
212636
|
}
|
|
212069
212637
|
}
|
|
@@ -247136,6 +247704,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
247136
247704
|
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
247137
247705
|
* @param {string} [params.timeInForce] GTC (default), IOC, FOK
|
|
247138
247706
|
* @param {string} [params.clientOrderId] Maximum 64-character length.*
|
|
247707
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
247139
247708
|
*
|
|
247140
247709
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
247141
247710
|
* @param {string} [params.amount] quote units for the order
|
|
@@ -247159,25 +247728,29 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
247159
247728
|
'type': type.toUpperCase(),
|
|
247160
247729
|
};
|
|
247161
247730
|
if ((uppercaseType === 'MARKET') && (uppercaseSide === 'BUY')) {
|
|
247162
|
-
let quoteAmount =
|
|
247163
|
-
|
|
247164
|
-
|
|
247165
|
-
|
|
247166
|
-
|
|
247167
|
-
|
|
247731
|
+
let quoteAmount = undefined;
|
|
247732
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
247733
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
247734
|
+
const cost = this.safeNumber(params, 'cost');
|
|
247735
|
+
params = this.omit(params, 'cost');
|
|
247736
|
+
if (cost !== undefined) {
|
|
247737
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
247738
|
+
}
|
|
247739
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
247740
|
+
if (price === undefined) {
|
|
247741
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
|
|
247168
247742
|
}
|
|
247169
247743
|
else {
|
|
247170
247744
|
const amountString = this.numberToString(amount);
|
|
247171
247745
|
const priceString = this.numberToString(price);
|
|
247172
|
-
const
|
|
247173
|
-
|
|
247174
|
-
quoteAmount = this.costToPrecision(symbol, amount);
|
|
247746
|
+
const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
247747
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
247175
247748
|
}
|
|
247176
247749
|
}
|
|
247177
247750
|
else {
|
|
247178
247751
|
quoteAmount = this.costToPrecision(symbol, amount);
|
|
247179
247752
|
}
|
|
247180
|
-
request['amount'] =
|
|
247753
|
+
request['amount'] = quoteAmount;
|
|
247181
247754
|
}
|
|
247182
247755
|
else {
|
|
247183
247756
|
request['quantity'] = this.amountToPrecision(market['symbol'], amount);
|
|
@@ -265041,6 +265614,8 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
|
|
|
265041
265614
|
'fetchWithdrawals': true,
|
|
265042
265615
|
'fetchWithdrawalWhitelist': false,
|
|
265043
265616
|
'reduceMargin': false,
|
|
265617
|
+
'repayCrossMargin': false,
|
|
265618
|
+
'repayIsolatedMargin': false,
|
|
265044
265619
|
'setLeverage': false,
|
|
265045
265620
|
'setMargin': false,
|
|
265046
265621
|
'setMarginMode': false,
|
|
@@ -272046,6 +272621,8 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
272046
272621
|
'fetchTransfers': false,
|
|
272047
272622
|
'fetchWithdrawals': false,
|
|
272048
272623
|
'reduceMargin': false,
|
|
272624
|
+
'repayCrossMargin': false,
|
|
272625
|
+
'repayIsolatedMargin': false,
|
|
272049
272626
|
'setLeverage': false,
|
|
272050
272627
|
'setMargin': false,
|
|
272051
272628
|
'setMarginMode': false,
|
|
@@ -272993,6 +273570,8 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
272993
273570
|
'fetchTradingFee': false,
|
|
272994
273571
|
'fetchTradingFees': true,
|
|
272995
273572
|
'fetchTransactionFees': true,
|
|
273573
|
+
'repayCrossMargin': false,
|
|
273574
|
+
'repayIsolatedMargin': false,
|
|
272996
273575
|
'setLeverage': true,
|
|
272997
273576
|
'transfer': true,
|
|
272998
273577
|
'withdraw': true,
|
|
@@ -279534,15 +280113,14 @@ class zaif extends _abstract_zaif_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
279534
280113
|
// }
|
|
279535
280114
|
//
|
|
279536
280115
|
const symbol = this.safeSymbol(undefined, market);
|
|
279537
|
-
const timestamp = this.milliseconds();
|
|
279538
280116
|
const vwap = this.safeString(ticker, 'vwap');
|
|
279539
280117
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
279540
280118
|
const quoteVolume = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(baseVolume, vwap);
|
|
279541
280119
|
const last = this.safeString(ticker, 'last');
|
|
279542
280120
|
return this.safeTicker({
|
|
279543
280121
|
'symbol': symbol,
|
|
279544
|
-
'timestamp':
|
|
279545
|
-
'datetime':
|
|
280122
|
+
'timestamp': undefined,
|
|
280123
|
+
'datetime': undefined,
|
|
279546
280124
|
'high': this.safeString(ticker, 'high'),
|
|
279547
280125
|
'low': this.safeString(ticker, 'low'),
|
|
279548
280126
|
'bid': this.safeString(ticker, 'bid'),
|
|
@@ -287416,7 +287994,7 @@ SOFTWARE.
|
|
|
287416
287994
|
|
|
287417
287995
|
//-----------------------------------------------------------------------------
|
|
287418
287996
|
// this is updated by vss.js when building
|
|
287419
|
-
const version = '4.1.
|
|
287997
|
+
const version = '4.1.91';
|
|
287420
287998
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
287421
287999
|
//-----------------------------------------------------------------------------
|
|
287422
288000
|
|