ccxt 4.1.77 → 4.1.79
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 +4 -4
- package/dist/ccxt.browser.js +508 -177
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +6 -3
- package/dist/cjs/src/bitget.js +71 -0
- package/dist/cjs/src/bitmart.js +9 -13
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/coinbase.js +13 -3
- package/dist/cjs/src/coinex.js +7 -11
- package/dist/cjs/src/cryptocom.js +4 -0
- package/dist/cjs/src/gate.js +4 -0
- package/dist/cjs/src/hitbtc.js +326 -123
- package/dist/cjs/src/idex.js +10 -1
- package/dist/cjs/src/mexc.js +33 -5
- package/dist/cjs/src/okx.js +5 -9
- package/dist/cjs/src/pro/binance.js +10 -2
- package/dist/cjs/src/pro/binanceus.js +1 -0
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/upbit.js +5 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/abstract/coinbase.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +4 -0
- package/js/src/abstract/gate.d.ts +3 -0
- package/js/src/abstract/gateio.d.ts +3 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/bingx.js +6 -3
- package/js/src/bitget.d.ts +5 -4
- package/js/src/bitget.js +71 -0
- package/js/src/bitmart.js +9 -13
- package/js/src/bybit.js +2 -0
- package/js/src/coinbase.js +13 -3
- package/js/src/coinex.js +7 -11
- package/js/src/cryptocom.js +4 -0
- package/js/src/gate.js +4 -0
- package/js/src/hitbtc.js +326 -123
- package/js/src/idex.js +10 -1
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +33 -5
- package/js/src/okx.js +5 -9
- package/js/src/pro/binance.js +10 -2
- package/js/src/pro/binanceus.js +1 -0
- package/js/src/pro/gate.js +1 -1
- package/js/src/upbit.js +5 -5
- package/package.json +1 -1
- package/skip-tests.json +2 -1
- package/js/src/huobipro.d.ts +0 -4
- package/js/src/huobipro.js +0 -20
- package/js/src/mexc3.d.ts +0 -4
- package/js/src/mexc3.js +0 -17
- package/js/src/okex.d.ts +0 -4
- package/js/src/okex.js +0 -17
- package/js/src/okex5.d.ts +0 -4
- package/js/src/okex5.js +0 -17
- package/js/src/tidex.d.ts +0 -36
- package/js/src/tidex.js +0 -1068
package/dist/ccxt.browser.js
CHANGED
|
@@ -26939,7 +26939,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26939
26939
|
'cancelAllOrders': true,
|
|
26940
26940
|
'cancelOrder': true,
|
|
26941
26941
|
'cancelOrders': true,
|
|
26942
|
-
'
|
|
26942
|
+
'closeAllPositions': true,
|
|
26943
26943
|
'closePosition': false,
|
|
26944
26944
|
'createMarketBuyOrderWithCost': true,
|
|
26945
26945
|
'createMarketOrderWithCost': true,
|
|
@@ -28254,7 +28254,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28254
28254
|
// {
|
|
28255
28255
|
// "symbol": "BTC-USDT",
|
|
28256
28256
|
// "priceChange": "52.5",
|
|
28257
|
-
// "priceChangePercent": "0.31",
|
|
28257
|
+
// "priceChangePercent": "0.31%", // they started to add the percent sign in value
|
|
28258
28258
|
// "lastPrice": "16880.5",
|
|
28259
28259
|
// "lastQty": "2.2238",
|
|
28260
28260
|
// "highPrice": "16897.5",
|
|
@@ -28285,7 +28285,10 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28285
28285
|
const close = this.safeString(ticker, 'lastPrice');
|
|
28286
28286
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
28287
28287
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
28288
|
-
|
|
28288
|
+
let percentage = this.safeString(ticker, 'priceChangePercent');
|
|
28289
|
+
if (percentage !== undefined) {
|
|
28290
|
+
percentage = percentage.replace('%', '');
|
|
28291
|
+
}
|
|
28289
28292
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
28290
28293
|
const datetime = this.iso8601(ts);
|
|
28291
28294
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -40299,6 +40302,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40299
40302
|
'cancelAllOrders': true,
|
|
40300
40303
|
'cancelOrder': true,
|
|
40301
40304
|
'cancelOrders': true,
|
|
40305
|
+
'closeAllPositions': true,
|
|
40306
|
+
'closePosition': false,
|
|
40302
40307
|
'createOrder': true,
|
|
40303
40308
|
'createOrders': true,
|
|
40304
40309
|
'createReduceOnlyOrder': false,
|
|
@@ -45711,6 +45716,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45711
45716
|
// "utime": "1689300238205"
|
|
45712
45717
|
// }
|
|
45713
45718
|
//
|
|
45719
|
+
// closeAllPositions
|
|
45720
|
+
//
|
|
45721
|
+
// {
|
|
45722
|
+
// "symbol": "XRPUSDT_UMCBL",
|
|
45723
|
+
// "orderId": "1111861847410757635",
|
|
45724
|
+
// "clientOid": "1111861847410757637"
|
|
45725
|
+
// }
|
|
45726
|
+
//
|
|
45714
45727
|
const marketId = this.safeString(position, 'symbol');
|
|
45715
45728
|
market = this.safeMarket(marketId, market);
|
|
45716
45729
|
const symbol = market['symbol'];
|
|
@@ -47261,6 +47274,67 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
47261
47274
|
'info': info,
|
|
47262
47275
|
};
|
|
47263
47276
|
}
|
|
47277
|
+
async closeAllPositions(params = {}) {
|
|
47278
|
+
/**
|
|
47279
|
+
* @method
|
|
47280
|
+
* @name bitget#closePositions
|
|
47281
|
+
* @description closes open positions for a market
|
|
47282
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
|
|
47283
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
47284
|
+
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
47285
|
+
* @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
|
|
47286
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
47287
|
+
*/
|
|
47288
|
+
await this.loadMarkets();
|
|
47289
|
+
let subType = undefined;
|
|
47290
|
+
let settle = undefined;
|
|
47291
|
+
[subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
|
|
47292
|
+
settle = this.safeString(params, 'settle', 'USDT');
|
|
47293
|
+
params = this.omit(params, ['settle']);
|
|
47294
|
+
const productType = this.safeString(params, 'productType');
|
|
47295
|
+
const request = {};
|
|
47296
|
+
if (productType === undefined) {
|
|
47297
|
+
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
47298
|
+
let localProductType = undefined;
|
|
47299
|
+
if (subType === 'inverse') {
|
|
47300
|
+
localProductType = 'dmcbl';
|
|
47301
|
+
}
|
|
47302
|
+
else {
|
|
47303
|
+
if (settle === 'USDT') {
|
|
47304
|
+
localProductType = 'umcbl';
|
|
47305
|
+
}
|
|
47306
|
+
else if (settle === 'USDC') {
|
|
47307
|
+
localProductType = 'cmcbl';
|
|
47308
|
+
}
|
|
47309
|
+
}
|
|
47310
|
+
if (sandboxMode) {
|
|
47311
|
+
localProductType = 's' + localProductType;
|
|
47312
|
+
}
|
|
47313
|
+
request['productType'] = localProductType;
|
|
47314
|
+
}
|
|
47315
|
+
const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
|
|
47316
|
+
//
|
|
47317
|
+
// {
|
|
47318
|
+
// "code": "00000",
|
|
47319
|
+
// "msg": "success",
|
|
47320
|
+
// "requestTime": 1700814442466,
|
|
47321
|
+
// "data": {
|
|
47322
|
+
// "orderInfo": [
|
|
47323
|
+
// {
|
|
47324
|
+
// "symbol": "XRPUSDT_UMCBL",
|
|
47325
|
+
// "orderId": "1111861847410757635",
|
|
47326
|
+
// "clientOid": "1111861847410757637"
|
|
47327
|
+
// },
|
|
47328
|
+
// ],
|
|
47329
|
+
// "failure": [],
|
|
47330
|
+
// "result": true
|
|
47331
|
+
// }
|
|
47332
|
+
// }
|
|
47333
|
+
//
|
|
47334
|
+
const data = this.safeValue(response, 'data', {});
|
|
47335
|
+
const orderInfo = this.safeValue(data, 'orderInfo', []);
|
|
47336
|
+
return this.parsePositions(orderInfo, undefined, params);
|
|
47337
|
+
}
|
|
47264
47338
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
47265
47339
|
if (!response) {
|
|
47266
47340
|
return undefined; // fallback to default error handler
|
|
@@ -51804,19 +51878,15 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51804
51878
|
};
|
|
51805
51879
|
}
|
|
51806
51880
|
async fetchIsolatedBorrowRate(symbol, params = {}) {
|
|
51807
|
-
|
|
51808
|
-
|
|
51809
|
-
|
|
51810
|
-
|
|
51811
|
-
|
|
51812
|
-
|
|
51813
|
-
|
|
51814
|
-
|
|
51815
|
-
|
|
51816
|
-
// =======
|
|
51817
|
-
// @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
51818
|
-
// >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
|
|
51819
|
-
//
|
|
51881
|
+
/**
|
|
51882
|
+
* @method
|
|
51883
|
+
* @name bitmart#fetchIsolatedBorrowRate
|
|
51884
|
+
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
51885
|
+
* @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
|
51886
|
+
* @param {string} symbol unified symbol of the market to fetch the borrow rate for
|
|
51887
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
51888
|
+
* @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
51889
|
+
*/
|
|
51820
51890
|
await this.loadMarkets();
|
|
51821
51891
|
const market = this.market(symbol);
|
|
51822
51892
|
const request = {
|
|
@@ -76500,6 +76570,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76500
76570
|
'v5/lending/account': 5,
|
|
76501
76571
|
// broker
|
|
76502
76572
|
'v5/broker/earning-record': 5,
|
|
76573
|
+
'v5/broker/earnings-info': 5,
|
|
76574
|
+
'v5/broker/account-info': 5,
|
|
76503
76575
|
},
|
|
76504
76576
|
'post': {
|
|
76505
76577
|
// Legacy option USDC
|
|
@@ -85657,6 +85729,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85657
85729
|
'brokerage/product_book',
|
|
85658
85730
|
'brokerage/best_bid_ask',
|
|
85659
85731
|
'brokerage/convert/trade/{trade_id}',
|
|
85732
|
+
'brokerage/time',
|
|
85660
85733
|
],
|
|
85661
85734
|
'post': [
|
|
85662
85735
|
'brokerage/orders',
|
|
@@ -86363,7 +86436,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86363
86436
|
else {
|
|
86364
86437
|
cost = costString;
|
|
86365
86438
|
}
|
|
86366
|
-
|
|
86439
|
+
let feeCurrencyId = this.safeString(feeObject, 'currency');
|
|
86440
|
+
const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
|
|
86441
|
+
if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
|
|
86442
|
+
feeCurrencyId = market['quote'];
|
|
86443
|
+
}
|
|
86367
86444
|
const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
|
|
86368
86445
|
const side = this.safeStringLower2(trade, 'resource', 'side');
|
|
86369
86446
|
const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
|
|
@@ -86381,7 +86458,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86381
86458
|
'amount': amountString,
|
|
86382
86459
|
'cost': cost,
|
|
86383
86460
|
'fee': {
|
|
86384
|
-
'cost':
|
|
86461
|
+
'cost': feeCost,
|
|
86385
86462
|
'currency': this.safeCurrencyCode(feeCurrencyId),
|
|
86386
86463
|
},
|
|
86387
86464
|
});
|
|
@@ -87831,6 +87908,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87831
87908
|
amount = this.safeString(marketIOC, 'base_size');
|
|
87832
87909
|
}
|
|
87833
87910
|
const datetime = this.safeString(order, 'created_time');
|
|
87911
|
+
const totalFees = this.safeString(order, 'total_fees');
|
|
87912
|
+
let currencyFee = undefined;
|
|
87913
|
+
if ((totalFees !== undefined) && (market !== undefined)) {
|
|
87914
|
+
currencyFee = market['quote'];
|
|
87915
|
+
}
|
|
87834
87916
|
return this.safeOrder({
|
|
87835
87917
|
'info': order,
|
|
87836
87918
|
'id': this.safeString(order, 'order_id'),
|
|
@@ -87854,7 +87936,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87854
87936
|
'status': this.parseOrderStatus(this.safeString(order, 'status')),
|
|
87855
87937
|
'fee': {
|
|
87856
87938
|
'cost': this.safeString(order, 'total_fees'),
|
|
87857
|
-
'currency':
|
|
87939
|
+
'currency': currencyFee,
|
|
87858
87940
|
},
|
|
87859
87941
|
'trades': undefined,
|
|
87860
87942
|
}, market);
|
|
@@ -96311,17 +96393,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96311
96393
|
return this.parseIsolatedBorrowRate(data, market);
|
|
96312
96394
|
}
|
|
96313
96395
|
async fetchIsolatedBorrowRates(params = {}) {
|
|
96314
|
-
|
|
96315
|
-
|
|
96316
|
-
|
|
96317
|
-
|
|
96318
|
-
|
|
96319
|
-
|
|
96320
|
-
|
|
96321
|
-
// =======
|
|
96322
|
-
// @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
96323
|
-
// >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
|
|
96324
|
-
//
|
|
96396
|
+
/**
|
|
96397
|
+
* @method
|
|
96398
|
+
* @name coinex#fetchIsolatedBorrowRates
|
|
96399
|
+
* @description fetch the borrow interest rates of all currencies
|
|
96400
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
96401
|
+
* @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
96402
|
+
*/
|
|
96325
96403
|
await this.loadMarkets();
|
|
96326
96404
|
const response = await this.privateGetMarginConfig(params);
|
|
96327
96405
|
//
|
|
@@ -103735,6 +103813,9 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
103735
103813
|
'private/get-currency-networks': 10 / 3,
|
|
103736
103814
|
'private/get-deposit-history': 10 / 3,
|
|
103737
103815
|
'private/get-deposit-address': 10 / 3,
|
|
103816
|
+
'private/export/create-export-request': 10 / 3,
|
|
103817
|
+
'private/export/get-export-requests': 10 / 3,
|
|
103818
|
+
'private/export/download-export-output': 10 / 3,
|
|
103738
103819
|
'private/get-account-summary': 10 / 3,
|
|
103739
103820
|
'private/create-order': 2 / 3,
|
|
103740
103821
|
'private/cancel-order': 2 / 3,
|
|
@@ -103753,6 +103834,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
103753
103834
|
'private/otc/accept-quote': 100,
|
|
103754
103835
|
'private/otc/get-quote-history': 10 / 3,
|
|
103755
103836
|
'private/otc/get-trade-history': 10 / 3,
|
|
103837
|
+
'private/otc/create-order': 10 / 3,
|
|
103756
103838
|
},
|
|
103757
103839
|
},
|
|
103758
103840
|
},
|
|
@@ -122026,6 +122108,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122026
122108
|
'spot': 'https://api.gateio.ws/api/v4',
|
|
122027
122109
|
'options': 'https://api.gateio.ws/api/v4',
|
|
122028
122110
|
'subAccounts': 'https://api.gateio.ws/api/v4',
|
|
122111
|
+
'portfolio': 'https://api.gateio.ws/api/v4',
|
|
122029
122112
|
'rebate': 'https://api.gateio.ws/api/v4',
|
|
122030
122113
|
'earn': 'https://api.gateio.ws/api/v4',
|
|
122031
122114
|
'account': 'https://api.gateio.ws/api/v4',
|
|
@@ -122463,10 +122546,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122463
122546
|
},
|
|
122464
122547
|
'earn': {
|
|
122465
122548
|
'get': {
|
|
122549
|
+
'uni/currencies': 20 / 15,
|
|
122550
|
+
'uni/currencies/{currency}': 20 / 15,
|
|
122466
122551
|
'uni/lends': 20 / 15,
|
|
122467
122552
|
'uni/lend_records': 20 / 15,
|
|
122468
122553
|
'uni/interests/{currency}': 20 / 15,
|
|
122469
122554
|
'uni/interest_records': 20 / 15,
|
|
122555
|
+
'uni/interest_status/{currency}': 20 / 15,
|
|
122470
122556
|
},
|
|
122471
122557
|
'post': {
|
|
122472
122558
|
'uni/lends': 20 / 15,
|
|
@@ -131443,6 +131529,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131443
131529
|
* @method
|
|
131444
131530
|
* @name hitbtc#fetchMarkets
|
|
131445
131531
|
* @description retrieves data on all markets for hitbtc
|
|
131532
|
+
* @see https://api.hitbtc.com/#symbols
|
|
131446
131533
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131447
131534
|
* @returns {object[]} an array of objects representing market data
|
|
131448
131535
|
*/
|
|
@@ -131586,6 +131673,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131586
131673
|
* @method
|
|
131587
131674
|
* @name hitbtc#fetchCurrencies
|
|
131588
131675
|
* @description fetches all available currencies on an exchange
|
|
131676
|
+
* @see https://api.hitbtc.com/#currencies
|
|
131589
131677
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131590
131678
|
* @returns {object} an associative dictionary of currencies
|
|
131591
131679
|
*/
|
|
@@ -131706,6 +131794,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131706
131794
|
* @method
|
|
131707
131795
|
* @name hitbtc#createDepositAddress
|
|
131708
131796
|
* @description create a currency deposit address
|
|
131797
|
+
* @see https://api.hitbtc.com/#generate-deposit-crypto-address
|
|
131709
131798
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
131710
131799
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131711
131800
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -131742,6 +131831,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131742
131831
|
* @method
|
|
131743
131832
|
* @name hitbtc#fetchDepositAddress
|
|
131744
131833
|
* @description fetch the deposit address for a currency associated with this account
|
|
131834
|
+
* @see https://api.hitbtc.com/#get-deposit-crypto-address
|
|
131745
131835
|
* @param {string} code unified currency code
|
|
131746
131836
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131747
131837
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -131796,6 +131886,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131796
131886
|
* @method
|
|
131797
131887
|
* @name hitbtc#fetchBalance
|
|
131798
131888
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
131889
|
+
* @see https://api.hitbtc.com/#wallet-balance
|
|
131890
|
+
* @see https://api.hitbtc.com/#get-spot-trading-balance
|
|
131891
|
+
* @see https://api.hitbtc.com/#get-trading-balance
|
|
131799
131892
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131800
131893
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
131801
131894
|
*/
|
|
@@ -131998,6 +132091,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131998
132091
|
* @method
|
|
131999
132092
|
* @name hitbtc#fetchMyTrades
|
|
132000
132093
|
* @description fetch all trades made by the user
|
|
132094
|
+
* @see https://api.hitbtc.com/#spot-trades-history
|
|
132095
|
+
* @see https://api.hitbtc.com/#futures-trades-history
|
|
132096
|
+
* @see https://api.hitbtc.com/#margin-trades-history
|
|
132001
132097
|
* @param {string} symbol unified market symbol
|
|
132002
132098
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
132003
132099
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -132020,17 +132116,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132020
132116
|
request['from'] = since;
|
|
132021
132117
|
}
|
|
132022
132118
|
let marketType = undefined;
|
|
132119
|
+
let marginMode = undefined;
|
|
132120
|
+
let response = undefined;
|
|
132023
132121
|
[marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
132024
|
-
|
|
132025
|
-
|
|
132026
|
-
'swap': 'privateGetFuturesHistoryTrade',
|
|
132027
|
-
'margin': 'privateGetMarginHistoryTrade',
|
|
132028
|
-
});
|
|
132029
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
132122
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
132123
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132030
132124
|
if (marginMode !== undefined) {
|
|
132031
|
-
|
|
132125
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132126
|
+
}
|
|
132127
|
+
else {
|
|
132128
|
+
if (marketType === 'spot') {
|
|
132129
|
+
response = await this.privateGetSpotHistoryTrade(this.extend(request, params));
|
|
132130
|
+
}
|
|
132131
|
+
else if (marketType === 'swap') {
|
|
132132
|
+
response = await this.privateGetFuturesHistoryTrade(this.extend(request, params));
|
|
132133
|
+
}
|
|
132134
|
+
else if (marketType === 'margin') {
|
|
132135
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132136
|
+
}
|
|
132137
|
+
else {
|
|
132138
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() not support this market type');
|
|
132139
|
+
}
|
|
132032
132140
|
}
|
|
132033
|
-
const response = await this[method](this.extend(request, query));
|
|
132034
132141
|
return this.parseTrades(response, market, since, limit);
|
|
132035
132142
|
}
|
|
132036
132143
|
parseTrade(trade, market = undefined) {
|
|
@@ -132284,6 +132391,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132284
132391
|
* @method
|
|
132285
132392
|
* @name hitbtc#fetchDepositsWithdrawals
|
|
132286
132393
|
* @description fetch history of deposits and withdrawals
|
|
132394
|
+
* @see https://api.hitbtc.com/#get-transactions-history
|
|
132287
132395
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
132288
132396
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
132289
132397
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -132297,6 +132405,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132297
132405
|
* @method
|
|
132298
132406
|
* @name hitbtc#fetchDeposits
|
|
132299
132407
|
* @description fetch all deposits made to an account
|
|
132408
|
+
* @see https://api.hitbtc.com/#get-transactions-history
|
|
132300
132409
|
* @param {string} code unified currency code
|
|
132301
132410
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
132302
132411
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -132310,6 +132419,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132310
132419
|
* @method
|
|
132311
132420
|
* @name hitbtc#fetchWithdrawals
|
|
132312
132421
|
* @description fetch all withdrawals made from an account
|
|
132422
|
+
* @see https://api.hitbtc.com/#get-transactions-history
|
|
132313
132423
|
* @param {string} code unified currency code
|
|
132314
132424
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
132315
132425
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -132397,6 +132507,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132397
132507
|
* @method
|
|
132398
132508
|
* @name hitbtc#fetchTradingFee
|
|
132399
132509
|
* @description fetch the trading fees for a market
|
|
132510
|
+
* @see https://api.hitbtc.com/#get-trading-commission
|
|
132511
|
+
* @see https://api.hitbtc.com/#get-trading-commission-2
|
|
132400
132512
|
* @param {string} symbol unified market symbol
|
|
132401
132513
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132402
132514
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -132406,11 +132518,16 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132406
132518
|
const request = {
|
|
132407
132519
|
'symbol': market['id'],
|
|
132408
132520
|
};
|
|
132409
|
-
|
|
132410
|
-
|
|
132411
|
-
|
|
132412
|
-
}
|
|
132413
|
-
|
|
132521
|
+
let response = undefined;
|
|
132522
|
+
if (market['type'] === 'spot') {
|
|
132523
|
+
response = await this.privateGetSpotFeeSymbol(this.extend(request, params));
|
|
132524
|
+
}
|
|
132525
|
+
else if (market['type'] === 'swap') {
|
|
132526
|
+
response = await this.privateGetFuturesFeeSymbol(this.extend(request, params));
|
|
132527
|
+
}
|
|
132528
|
+
else {
|
|
132529
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTradingFee() not support this market type');
|
|
132530
|
+
}
|
|
132414
132531
|
//
|
|
132415
132532
|
// {
|
|
132416
132533
|
// "take_rate":"0.0009",
|
|
@@ -132424,16 +132541,23 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132424
132541
|
* @method
|
|
132425
132542
|
* @name hitbtc#fetchTradingFees
|
|
132426
132543
|
* @description fetch the trading fees for multiple markets
|
|
132544
|
+
* @see https://api.hitbtc.com/#get-all-trading-commissions
|
|
132545
|
+
* @see https://api.hitbtc.com/#get-all-trading-commissions-2
|
|
132427
132546
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132428
132547
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
132429
132548
|
*/
|
|
132430
132549
|
await this.loadMarkets();
|
|
132431
132550
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
132432
|
-
|
|
132433
|
-
|
|
132434
|
-
|
|
132435
|
-
}
|
|
132436
|
-
|
|
132551
|
+
let response = undefined;
|
|
132552
|
+
if (marketType === 'spot') {
|
|
132553
|
+
response = await this.privateGetSpotFee(query);
|
|
132554
|
+
}
|
|
132555
|
+
else if (marketType === 'swap') {
|
|
132556
|
+
response = await this.privateGetFuturesFee(query);
|
|
132557
|
+
}
|
|
132558
|
+
else {
|
|
132559
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTradingFees() not support this market type');
|
|
132560
|
+
}
|
|
132437
132561
|
//
|
|
132438
132562
|
// [
|
|
132439
132563
|
// {
|
|
@@ -132569,6 +132693,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132569
132693
|
* @method
|
|
132570
132694
|
* @name hitbtc#fetchClosedOrders
|
|
132571
132695
|
* @description fetches information on multiple closed orders made by the user
|
|
132696
|
+
* @see https://api.hitbtc.com/#spot-orders-history
|
|
132697
|
+
* @see https://api.hitbtc.com/#futures-orders-history
|
|
132698
|
+
* @see https://api.hitbtc.com/#margin-orders-history
|
|
132572
132699
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
132573
132700
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
132574
132701
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -132591,17 +132718,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132591
132718
|
request['limit'] = limit;
|
|
132592
132719
|
}
|
|
132593
132720
|
let marketType = undefined;
|
|
132721
|
+
let marginMode = undefined;
|
|
132594
132722
|
[marketType, params] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
132595
|
-
|
|
132596
|
-
|
|
132597
|
-
|
|
132598
|
-
'margin': 'privateGetMarginHistoryOrder',
|
|
132599
|
-
});
|
|
132600
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchClosedOrders', params);
|
|
132723
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchClosedOrders', params);
|
|
132724
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132725
|
+
let response = undefined;
|
|
132601
132726
|
if (marginMode !== undefined) {
|
|
132602
|
-
|
|
132727
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132728
|
+
}
|
|
132729
|
+
else {
|
|
132730
|
+
if (marketType === 'spot') {
|
|
132731
|
+
response = await this.privateGetSpotHistoryOrder(this.extend(request, params));
|
|
132732
|
+
}
|
|
132733
|
+
else if (marketType === 'swap') {
|
|
132734
|
+
response = await this.privateGetFuturesHistoryOrder(this.extend(request, params));
|
|
132735
|
+
}
|
|
132736
|
+
else if (marketType === 'margin') {
|
|
132737
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132738
|
+
}
|
|
132739
|
+
else {
|
|
132740
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchClosedOrders() not support this market type');
|
|
132741
|
+
}
|
|
132603
132742
|
}
|
|
132604
|
-
const response = await this[method](this.extend(request, query));
|
|
132605
132743
|
const parsed = this.parseOrders(response, market, since, limit);
|
|
132606
132744
|
return this.filterByArray(parsed, 'status', ['closed', 'canceled'], false);
|
|
132607
132745
|
}
|
|
@@ -132610,6 +132748,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132610
132748
|
* @method
|
|
132611
132749
|
* @name hitbtc#fetchOrder
|
|
132612
132750
|
* @description fetches information on an order made by the user
|
|
132751
|
+
* @see https://api.hitbtc.com/#spot-orders-history
|
|
132752
|
+
* @see https://api.hitbtc.com/#futures-orders-history
|
|
132753
|
+
* @see https://api.hitbtc.com/#margin-orders-history
|
|
132613
132754
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
132614
132755
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132615
132756
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
|
|
@@ -132621,21 +132762,32 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132621
132762
|
if (symbol !== undefined) {
|
|
132622
132763
|
market = this.market(symbol);
|
|
132623
132764
|
}
|
|
132765
|
+
const request = {
|
|
132766
|
+
'client_order_id': id,
|
|
132767
|
+
};
|
|
132624
132768
|
let marketType = undefined;
|
|
132769
|
+
let marginMode = undefined;
|
|
132625
132770
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
132626
|
-
|
|
132627
|
-
|
|
132628
|
-
|
|
132629
|
-
'margin': 'privateGetMarginHistoryOrder',
|
|
132630
|
-
});
|
|
132631
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOrder', params);
|
|
132771
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrder', params);
|
|
132772
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132773
|
+
let response = undefined;
|
|
132632
132774
|
if (marginMode !== undefined) {
|
|
132633
|
-
|
|
132775
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132776
|
+
}
|
|
132777
|
+
else {
|
|
132778
|
+
if (marketType === 'spot') {
|
|
132779
|
+
response = await this.privateGetSpotHistoryOrder(this.extend(request, params));
|
|
132780
|
+
}
|
|
132781
|
+
else if (marketType === 'swap') {
|
|
132782
|
+
response = await this.privateGetFuturesHistoryOrder(this.extend(request, params));
|
|
132783
|
+
}
|
|
132784
|
+
else if (marketType === 'margin') {
|
|
132785
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132786
|
+
}
|
|
132787
|
+
else {
|
|
132788
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrder() not support this market type');
|
|
132789
|
+
}
|
|
132634
132790
|
}
|
|
132635
|
-
const request = {
|
|
132636
|
-
'client_order_id': id,
|
|
132637
|
-
};
|
|
132638
|
-
const response = await this[method](this.extend(request, query));
|
|
132639
132791
|
//
|
|
132640
132792
|
// [
|
|
132641
132793
|
// {
|
|
@@ -132663,6 +132815,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132663
132815
|
* @method
|
|
132664
132816
|
* @name hitbtc#fetchOrderTrades
|
|
132665
132817
|
* @description fetch all the trades made from a single order
|
|
132818
|
+
* @see https://api.hitbtc.com/#spot-trades-history
|
|
132819
|
+
* @see https://api.hitbtc.com/#futures-trades-history
|
|
132820
|
+
* @see https://api.hitbtc.com/#margin-trades-history
|
|
132666
132821
|
* @param {string} id order id
|
|
132667
132822
|
* @param {string} symbol unified market symbol
|
|
132668
132823
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -132681,17 +132836,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132681
132836
|
'order_id': id, // exchange assigned order id as oppose to the client order id
|
|
132682
132837
|
};
|
|
132683
132838
|
let marketType = undefined;
|
|
132839
|
+
let marginMode = undefined;
|
|
132684
132840
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOrderTrades', market, params);
|
|
132685
|
-
|
|
132686
|
-
|
|
132687
|
-
|
|
132688
|
-
'margin': 'privateGetMarginHistoryTrade',
|
|
132689
|
-
});
|
|
132690
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOrderTrades', params);
|
|
132841
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrderTrades', params);
|
|
132842
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132843
|
+
let response = undefined;
|
|
132691
132844
|
if (marginMode !== undefined) {
|
|
132692
|
-
|
|
132845
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132846
|
+
}
|
|
132847
|
+
else {
|
|
132848
|
+
if (marketType === 'spot') {
|
|
132849
|
+
response = await this.privateGetSpotHistoryTrade(this.extend(request, params));
|
|
132850
|
+
}
|
|
132851
|
+
else if (marketType === 'swap') {
|
|
132852
|
+
response = await this.privateGetFuturesHistoryTrade(this.extend(request, params));
|
|
132853
|
+
}
|
|
132854
|
+
else if (marketType === 'margin') {
|
|
132855
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132856
|
+
}
|
|
132857
|
+
else {
|
|
132858
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrderTrades() not support this market type');
|
|
132859
|
+
}
|
|
132693
132860
|
}
|
|
132694
|
-
const response = await this[method](this.extend(request, query));
|
|
132695
132861
|
//
|
|
132696
132862
|
// Spot
|
|
132697
132863
|
//
|
|
@@ -132737,6 +132903,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132737
132903
|
* @method
|
|
132738
132904
|
* @name hitbtc#fetchOpenOrders
|
|
132739
132905
|
* @description fetch all unfilled currently open orders
|
|
132906
|
+
* @see https://api.hitbtc.com/#get-all-active-spot-orders
|
|
132907
|
+
* @see https://api.hitbtc.com/#get-active-futures-orders
|
|
132908
|
+
* @see https://api.hitbtc.com/#get-active-margin-orders
|
|
132740
132909
|
* @param {string} symbol unified market symbol
|
|
132741
132910
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
132742
132911
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -132753,17 +132922,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132753
132922
|
request['symbol'] = market['id'];
|
|
132754
132923
|
}
|
|
132755
132924
|
let marketType = undefined;
|
|
132925
|
+
let marginMode = undefined;
|
|
132756
132926
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
132757
|
-
|
|
132758
|
-
|
|
132759
|
-
|
|
132760
|
-
'margin': 'privateGetMarginOrder',
|
|
132761
|
-
});
|
|
132762
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
132927
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
132928
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132929
|
+
let response = undefined;
|
|
132763
132930
|
if (marginMode !== undefined) {
|
|
132764
|
-
|
|
132931
|
+
response = await this.privateGetMarginOrder(this.extend(request, params));
|
|
132932
|
+
}
|
|
132933
|
+
else {
|
|
132934
|
+
if (marketType === 'spot') {
|
|
132935
|
+
response = await this.privateGetSpotOrder(this.extend(request, params));
|
|
132936
|
+
}
|
|
132937
|
+
else if (marketType === 'swap') {
|
|
132938
|
+
response = await this.privateGetFuturesOrder(this.extend(request, params));
|
|
132939
|
+
}
|
|
132940
|
+
else if (marketType === 'margin') {
|
|
132941
|
+
response = await this.privateGetMarginOrder(this.extend(request, params));
|
|
132942
|
+
}
|
|
132943
|
+
else {
|
|
132944
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrders() not support this market type');
|
|
132945
|
+
}
|
|
132765
132946
|
}
|
|
132766
|
-
const response = await this[method](this.extend(request, query));
|
|
132767
132947
|
//
|
|
132768
132948
|
// [
|
|
132769
132949
|
// {
|
|
@@ -132790,6 +132970,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132790
132970
|
* @method
|
|
132791
132971
|
* @name hitbtc#fetchOpenOrder
|
|
132792
132972
|
* @description fetch an open order by it's id
|
|
132973
|
+
* @see https://api.hitbtc.com/#get-active-spot-order
|
|
132974
|
+
* @see https://api.hitbtc.com/#get-active-futures-order
|
|
132975
|
+
* @see https://api.hitbtc.com/#get-active-margin-order
|
|
132793
132976
|
* @param {string} id order id
|
|
132794
132977
|
* @param {string} symbol unified market symbol, default is undefined
|
|
132795
132978
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -132802,21 +132985,32 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132802
132985
|
if (symbol !== undefined) {
|
|
132803
132986
|
market = this.market(symbol);
|
|
132804
132987
|
}
|
|
132988
|
+
const request = {
|
|
132989
|
+
'client_order_id': id,
|
|
132990
|
+
};
|
|
132805
132991
|
let marketType = undefined;
|
|
132992
|
+
let marginMode = undefined;
|
|
132806
132993
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrder', market, params);
|
|
132807
|
-
|
|
132808
|
-
|
|
132809
|
-
|
|
132810
|
-
'margin': 'privateGetMarginOrderClientOrderId',
|
|
132811
|
-
});
|
|
132812
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrder', params);
|
|
132994
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrder', params);
|
|
132995
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132996
|
+
let response = undefined;
|
|
132813
132997
|
if (marginMode !== undefined) {
|
|
132814
|
-
|
|
132998
|
+
response = await this.privateGetMarginOrderClientOrderId(this.extend(request, params));
|
|
132999
|
+
}
|
|
133000
|
+
else {
|
|
133001
|
+
if (marketType === 'spot') {
|
|
133002
|
+
response = await this.privateGetSpotOrderClientOrderId(this.extend(request, params));
|
|
133003
|
+
}
|
|
133004
|
+
else if (marketType === 'swap') {
|
|
133005
|
+
response = await this.privateGetFuturesOrderClientOrderId(this.extend(request, params));
|
|
133006
|
+
}
|
|
133007
|
+
else if (marketType === 'margin') {
|
|
133008
|
+
response = await this.privateGetMarginOrderClientOrderId(this.extend(request, params));
|
|
133009
|
+
}
|
|
133010
|
+
else {
|
|
133011
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrder() not support this market type');
|
|
133012
|
+
}
|
|
132815
133013
|
}
|
|
132816
|
-
const request = {
|
|
132817
|
-
'client_order_id': id,
|
|
132818
|
-
};
|
|
132819
|
-
const response = await this[method](this.extend(request, query));
|
|
132820
133014
|
return this.parseOrder(response, market);
|
|
132821
133015
|
}
|
|
132822
133016
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -132824,6 +133018,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132824
133018
|
* @method
|
|
132825
133019
|
* @name hitbtc#cancelAllOrders
|
|
132826
133020
|
* @description cancel all open orders
|
|
133021
|
+
* @see https://api.hitbtc.com/#cancel-all-spot-orders
|
|
133022
|
+
* @see https://api.hitbtc.com/#cancel-futures-orders
|
|
133023
|
+
* @see https://api.hitbtc.com/#cancel-all-margin-orders
|
|
132827
133024
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
132828
133025
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132829
133026
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
|
|
@@ -132838,17 +133035,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132838
133035
|
request['symbol'] = market['id'];
|
|
132839
133036
|
}
|
|
132840
133037
|
let marketType = undefined;
|
|
133038
|
+
let marginMode = undefined;
|
|
132841
133039
|
[marketType, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
132842
|
-
|
|
132843
|
-
|
|
132844
|
-
|
|
132845
|
-
'margin': 'privateDeleteMarginOrder',
|
|
132846
|
-
});
|
|
132847
|
-
const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
133040
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
133041
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133042
|
+
let response = undefined;
|
|
132848
133043
|
if (marginMode !== undefined) {
|
|
132849
|
-
|
|
133044
|
+
response = await this.privateDeleteMarginOrder(this.extend(request, params));
|
|
133045
|
+
}
|
|
133046
|
+
else {
|
|
133047
|
+
if (marketType === 'spot') {
|
|
133048
|
+
response = await this.privateDeleteSpotOrder(this.extend(request, params));
|
|
133049
|
+
}
|
|
133050
|
+
else if (marketType === 'swap') {
|
|
133051
|
+
response = await this.privateDeleteFuturesOrder(this.extend(request, params));
|
|
133052
|
+
}
|
|
133053
|
+
else if (marketType === 'margin') {
|
|
133054
|
+
response = await this.privateDeleteMarginOrder(this.extend(request, params));
|
|
133055
|
+
}
|
|
133056
|
+
else {
|
|
133057
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelAllOrders() not support this market type');
|
|
133058
|
+
}
|
|
132850
133059
|
}
|
|
132851
|
-
const response = await this[method](this.extend(request, query));
|
|
132852
133060
|
return this.parseOrders(response, market);
|
|
132853
133061
|
}
|
|
132854
133062
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -132856,6 +133064,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132856
133064
|
* @method
|
|
132857
133065
|
* @name hitbtc#cancelOrder
|
|
132858
133066
|
* @description cancels an open order
|
|
133067
|
+
* @see https://api.hitbtc.com/#cancel-spot-order
|
|
133068
|
+
* @see https://api.hitbtc.com/#cancel-futures-order
|
|
133069
|
+
* @see https://api.hitbtc.com/#cancel-margin-order
|
|
132859
133070
|
* @param {string} id order id
|
|
132860
133071
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
132861
133072
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -132872,17 +133083,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132872
133083
|
market = this.market(symbol);
|
|
132873
133084
|
}
|
|
132874
133085
|
let marketType = undefined;
|
|
133086
|
+
let marginMode = undefined;
|
|
132875
133087
|
[marketType, params] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
132876
|
-
|
|
132877
|
-
|
|
132878
|
-
|
|
132879
|
-
'margin': 'privateDeleteMarginOrderClientOrderId',
|
|
132880
|
-
});
|
|
132881
|
-
const [marginMode, query] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
133088
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
133089
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133090
|
+
let response = undefined;
|
|
132882
133091
|
if (marginMode !== undefined) {
|
|
132883
|
-
|
|
133092
|
+
response = await this.privateDeleteMarginOrderClientOrderId(this.extend(request, params));
|
|
133093
|
+
}
|
|
133094
|
+
else {
|
|
133095
|
+
if (marketType === 'spot') {
|
|
133096
|
+
response = await this.privateDeleteSpotOrderClientOrderId(this.extend(request, params));
|
|
133097
|
+
}
|
|
133098
|
+
else if (marketType === 'swap') {
|
|
133099
|
+
response = await this.privateDeleteFuturesOrderClientOrderId(this.extend(request, params));
|
|
133100
|
+
}
|
|
133101
|
+
else if (marketType === 'margin') {
|
|
133102
|
+
response = await this.privateDeleteMarginOrderClientOrderId(this.extend(request, params));
|
|
133103
|
+
}
|
|
133104
|
+
else {
|
|
133105
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelOrder() not support this market type');
|
|
133106
|
+
}
|
|
132884
133107
|
}
|
|
132885
|
-
const response = await this[method](this.extend(request, query));
|
|
132886
133108
|
return this.parseOrder(response, market);
|
|
132887
133109
|
}
|
|
132888
133110
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -132902,17 +133124,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132902
133124
|
market = this.market(symbol);
|
|
132903
133125
|
}
|
|
132904
133126
|
let marketType = undefined;
|
|
133127
|
+
let marginMode = undefined;
|
|
132905
133128
|
[marketType, params] = this.handleMarketTypeAndParams('editOrder', market, params);
|
|
132906
|
-
|
|
132907
|
-
|
|
132908
|
-
|
|
132909
|
-
'margin': 'privatePatchMarginOrderClientOrderId',
|
|
132910
|
-
});
|
|
132911
|
-
const [marginMode, query] = this.handleMarginModeAndParams('editOrder', params);
|
|
133129
|
+
[marginMode, params] = this.handleMarginModeAndParams('editOrder', params);
|
|
133130
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133131
|
+
let response = undefined;
|
|
132912
133132
|
if (marginMode !== undefined) {
|
|
132913
|
-
|
|
133133
|
+
response = await this.privatePatchMarginOrderClientOrderId(this.extend(request, params));
|
|
133134
|
+
}
|
|
133135
|
+
else {
|
|
133136
|
+
if (marketType === 'spot') {
|
|
133137
|
+
response = await this.privatePatchSpotOrderClientOrderId(this.extend(request, params));
|
|
133138
|
+
}
|
|
133139
|
+
else if (marketType === 'swap') {
|
|
133140
|
+
response = await this.privatePatchFuturesOrderClientOrderId(this.extend(request, params));
|
|
133141
|
+
}
|
|
133142
|
+
else if (marketType === 'margin') {
|
|
133143
|
+
response = await this.privatePatchMarginOrderClientOrderId(this.extend(request, params));
|
|
133144
|
+
}
|
|
133145
|
+
else {
|
|
133146
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' editOrder() not support this market type');
|
|
133147
|
+
}
|
|
132914
133148
|
}
|
|
132915
|
-
const response = await this[method](this.extend(request, query));
|
|
132916
133149
|
return this.parseOrder(response, market);
|
|
132917
133150
|
}
|
|
132918
133151
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -133241,6 +133474,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133241
133474
|
* @method
|
|
133242
133475
|
* @name hitbtc#transfer
|
|
133243
133476
|
* @description transfer currency internally between wallets on the same account
|
|
133477
|
+
* @see https://api.hitbtc.com/#transfer-between-wallet-and-exchange
|
|
133244
133478
|
* @param {string} code unified currency code
|
|
133245
133479
|
* @param {float} amount amount to transfer
|
|
133246
133480
|
* @param {string} fromAccount account to transfer from
|
|
@@ -133328,6 +133562,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133328
133562
|
* @method
|
|
133329
133563
|
* @name hitbtc#withdraw
|
|
133330
133564
|
* @description make a withdrawal
|
|
133565
|
+
* @see https://api.hitbtc.com/#withdraw-crypto
|
|
133331
133566
|
* @param {string} code unified currency code
|
|
133332
133567
|
* @param {float} amount the amount to withdraw
|
|
133333
133568
|
* @param {string} address the address to withdraw to
|
|
@@ -133509,6 +133744,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133509
133744
|
* @method
|
|
133510
133745
|
* @name hitbtc#fetchPositions
|
|
133511
133746
|
* @description fetch all open positions
|
|
133747
|
+
* @see https://api.hitbtc.com/#get-futures-margin-accounts
|
|
133748
|
+
* @see https://api.hitbtc.com/#get-all-margin-accounts
|
|
133512
133749
|
* @param {string[]|undefined} symbols not used by hitbtc fetchPositions ()
|
|
133513
133750
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
133514
133751
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
|
|
@@ -133518,16 +133755,25 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133518
133755
|
await this.loadMarkets();
|
|
133519
133756
|
const request = {};
|
|
133520
133757
|
let marketType = undefined;
|
|
133758
|
+
let marginMode = undefined;
|
|
133521
133759
|
[marketType, params] = this.handleMarketTypeAndParams('fetchPositions', undefined, params);
|
|
133522
|
-
|
|
133523
|
-
|
|
133524
|
-
|
|
133525
|
-
});
|
|
133526
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchPositions', params);
|
|
133760
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params);
|
|
133761
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133762
|
+
let response = undefined;
|
|
133527
133763
|
if (marginMode !== undefined) {
|
|
133528
|
-
|
|
133764
|
+
response = await this.privateGetMarginAccount(this.extend(request, params));
|
|
133765
|
+
}
|
|
133766
|
+
else {
|
|
133767
|
+
if (marketType === 'swap') {
|
|
133768
|
+
response = await this.privateGetFuturesAccount(this.extend(request, params));
|
|
133769
|
+
}
|
|
133770
|
+
else if (marketType === 'margin') {
|
|
133771
|
+
response = await this.privateGetMarginAccount(this.extend(request, params));
|
|
133772
|
+
}
|
|
133773
|
+
else {
|
|
133774
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() not support this market type');
|
|
133775
|
+
}
|
|
133529
133776
|
}
|
|
133530
|
-
const response = await this[method](this.extend(request, query));
|
|
133531
133777
|
//
|
|
133532
133778
|
// [
|
|
133533
133779
|
// {
|
|
@@ -133571,6 +133817,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133571
133817
|
* @method
|
|
133572
133818
|
* @name hitbtc#fetchPosition
|
|
133573
133819
|
* @description fetch data on a single open contract trade position
|
|
133820
|
+
* @see https://api.hitbtc.com/#get-futures-margin-account
|
|
133821
|
+
* @see https://api.hitbtc.com/#get-isolated-margin-account
|
|
133574
133822
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
133575
133823
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
133576
133824
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
|
|
@@ -133578,21 +133826,30 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133578
133826
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
133579
133827
|
*/
|
|
133580
133828
|
await this.loadMarkets();
|
|
133581
|
-
let marketType = undefined;
|
|
133582
|
-
[marketType, params] = this.handleMarketTypeAndParams('fetchPosition', undefined, params);
|
|
133583
|
-
let method = this.getSupportedMapping(marketType, {
|
|
133584
|
-
'swap': 'privateGetFuturesAccountIsolatedSymbol',
|
|
133585
|
-
'margin': 'privateGetMarginAccountIsolatedSymbol',
|
|
133586
|
-
});
|
|
133587
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchPosition', params);
|
|
133588
|
-
if (marginMode !== undefined) {
|
|
133589
|
-
method = 'privateGetMarginAccountIsolatedSymbol';
|
|
133590
|
-
}
|
|
133591
133829
|
const market = this.market(symbol);
|
|
133592
133830
|
const request = {
|
|
133593
133831
|
'symbol': market['id'],
|
|
133594
133832
|
};
|
|
133595
|
-
|
|
133833
|
+
let marketType = undefined;
|
|
133834
|
+
let marginMode = undefined;
|
|
133835
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchPosition', undefined, params);
|
|
133836
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchPosition', params);
|
|
133837
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133838
|
+
let response = undefined;
|
|
133839
|
+
if (marginMode !== undefined) {
|
|
133840
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
133841
|
+
}
|
|
133842
|
+
else {
|
|
133843
|
+
if (marketType === 'swap') {
|
|
133844
|
+
response = await this.privateGetFuturesAccountIsolatedSymbol(this.extend(request, params));
|
|
133845
|
+
}
|
|
133846
|
+
else if (marketType === 'margin') {
|
|
133847
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
133848
|
+
}
|
|
133849
|
+
else {
|
|
133850
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPosition() not support this market type');
|
|
133851
|
+
}
|
|
133852
|
+
}
|
|
133596
133853
|
//
|
|
133597
133854
|
// [
|
|
133598
133855
|
// {
|
|
@@ -133859,7 +134116,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133859
134116
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' modifyMarginHelper() requires a leverage parameter for swap markets');
|
|
133860
134117
|
}
|
|
133861
134118
|
}
|
|
133862
|
-
amount
|
|
134119
|
+
if (amount !== 0) {
|
|
134120
|
+
amount = this.amountToPrecision(symbol, amount);
|
|
134121
|
+
}
|
|
134122
|
+
else {
|
|
134123
|
+
amount = '0';
|
|
134124
|
+
}
|
|
133863
134125
|
const request = {
|
|
133864
134126
|
'symbol': market['id'],
|
|
133865
134127
|
'margin_balance': amount, // swap and margin
|
|
@@ -133870,16 +134132,25 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133870
134132
|
request['leverage'] = leverage;
|
|
133871
134133
|
}
|
|
133872
134134
|
let marketType = undefined;
|
|
133873
|
-
|
|
133874
|
-
|
|
133875
|
-
|
|
133876
|
-
|
|
133877
|
-
|
|
133878
|
-
const [marginMode, query] = this.handleMarginModeAndParams('modifyMarginHelper', params);
|
|
134135
|
+
let marginMode = undefined;
|
|
134136
|
+
[marketType, params] = this.handleMarketTypeAndParams('modifyMarginHelper', market, params);
|
|
134137
|
+
[marginMode, params] = this.handleMarginModeAndParams('modifyMarginHelper', params);
|
|
134138
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
134139
|
+
let response = undefined;
|
|
133879
134140
|
if (marginMode !== undefined) {
|
|
133880
|
-
|
|
134141
|
+
response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134142
|
+
}
|
|
134143
|
+
else {
|
|
134144
|
+
if (marketType === 'swap') {
|
|
134145
|
+
response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
|
|
134146
|
+
}
|
|
134147
|
+
else if (marketType === 'margin') {
|
|
134148
|
+
response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134149
|
+
}
|
|
134150
|
+
else {
|
|
134151
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' modifyMarginHelper() not support this market type');
|
|
134152
|
+
}
|
|
133881
134153
|
}
|
|
133882
|
-
const response = await this[method](this.extend(request, query));
|
|
133883
134154
|
//
|
|
133884
134155
|
// {
|
|
133885
134156
|
// "symbol": "BTCUSDT_PERP",
|
|
@@ -133920,6 +134191,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133920
134191
|
* @method
|
|
133921
134192
|
* @name hitbtc#reduceMargin
|
|
133922
134193
|
* @description remove margin from a position
|
|
134194
|
+
* @see https://api.hitbtc.com/#create-update-margin-account-2
|
|
134195
|
+
* @see https://api.hitbtc.com/#create-update-margin-account
|
|
133923
134196
|
* @param {string} symbol unified market symbol
|
|
133924
134197
|
* @param {float} amount the amount of margin to remove
|
|
133925
134198
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -133937,6 +134210,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133937
134210
|
* @method
|
|
133938
134211
|
* @name hitbtc#addMargin
|
|
133939
134212
|
* @description add margin
|
|
134213
|
+
* @see https://api.hitbtc.com/#create-update-margin-account-2
|
|
134214
|
+
* @see https://api.hitbtc.com/#create-update-margin-account
|
|
133940
134215
|
* @param {string} symbol unified market symbol
|
|
133941
134216
|
* @param {float} amount amount of margin to add
|
|
133942
134217
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -133951,6 +134226,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133951
134226
|
* @method
|
|
133952
134227
|
* @name hitbtc#fetchLeverage
|
|
133953
134228
|
* @description fetch the set leverage for a market
|
|
134229
|
+
* @see https://api.hitbtc.com/#get-futures-margin-account
|
|
134230
|
+
* @see https://api.hitbtc.com/#get-isolated-margin-account
|
|
133954
134231
|
* @param {string} symbol unified market symbol
|
|
133955
134232
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
133956
134233
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if this is set
|
|
@@ -133962,16 +134239,27 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133962
134239
|
const request = {
|
|
133963
134240
|
'symbol': market['id'],
|
|
133964
134241
|
};
|
|
133965
|
-
let
|
|
133966
|
-
|
|
133967
|
-
|
|
133968
|
-
|
|
133969
|
-
});
|
|
133970
|
-
const [marginMode, query] = this.handleMarginModeAndParams('modifyMarginHelper', params);
|
|
134242
|
+
let marginMode = undefined;
|
|
134243
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params);
|
|
134244
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
134245
|
+
let response = undefined;
|
|
133971
134246
|
if (marginMode !== undefined) {
|
|
133972
|
-
|
|
134247
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134248
|
+
}
|
|
134249
|
+
else {
|
|
134250
|
+
if (market['type'] === 'spot') {
|
|
134251
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134252
|
+
}
|
|
134253
|
+
else if (market['type'] === 'swap') {
|
|
134254
|
+
response = await this.privateGetFuturesAccountIsolatedSymbol(this.extend(request, params));
|
|
134255
|
+
}
|
|
134256
|
+
else if (market['type'] === 'margin') {
|
|
134257
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134258
|
+
}
|
|
134259
|
+
else {
|
|
134260
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverage() not support this market type');
|
|
134261
|
+
}
|
|
133973
134262
|
}
|
|
133974
|
-
const response = await this[method](this.extend(request, query));
|
|
133975
134263
|
//
|
|
133976
134264
|
// {
|
|
133977
134265
|
// "symbol": "BTCUSDT",
|
|
@@ -134009,6 +134297,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
134009
134297
|
* @method
|
|
134010
134298
|
* @name hitbtc#setLeverage
|
|
134011
134299
|
* @description set the level of leverage for a market
|
|
134300
|
+
* @see https://api.hitbtc.com/#create-update-margin-account-2
|
|
134012
134301
|
* @param {float} leverage the rate of leverage
|
|
134013
134302
|
* @param {string} symbol unified market symbol
|
|
134014
134303
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -148396,7 +148685,16 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
148396
148685
|
// ]
|
|
148397
148686
|
const method = params['method'];
|
|
148398
148687
|
params = this.omit(params, 'method');
|
|
148399
|
-
|
|
148688
|
+
let response = undefined;
|
|
148689
|
+
if (method === 'privateGetDeposits') {
|
|
148690
|
+
response = await this.privateGetDeposits(this.extend(request, params));
|
|
148691
|
+
}
|
|
148692
|
+
else if (method === 'privateGetWithdrawals') {
|
|
148693
|
+
response = await this.privateGetWithdrawals(this.extend(request, params));
|
|
148694
|
+
}
|
|
148695
|
+
else {
|
|
148696
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTransactionsHelper() not support this method');
|
|
148697
|
+
}
|
|
148400
148698
|
return this.parseTransactions(response, currency, since, limit);
|
|
148401
148699
|
}
|
|
148402
148700
|
parseTransactionStatus(status) {
|
|
@@ -172318,6 +172616,9 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
172318
172616
|
'closeAllPositions': false,
|
|
172319
172617
|
'closePosition': false,
|
|
172320
172618
|
'createDepositAddress': true,
|
|
172619
|
+
'createMarketBuyOrderWithCost': true,
|
|
172620
|
+
'createMarketOrderWithCost': false,
|
|
172621
|
+
'createMarketSellOrderWithCost': false,
|
|
172321
172622
|
'createOrder': true,
|
|
172322
172623
|
'createOrders': true,
|
|
172323
172624
|
'createReduceOnlyOrder': true,
|
|
@@ -174340,11 +174641,33 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
174340
174641
|
}
|
|
174341
174642
|
return this.parseTickers(tickers, symbols);
|
|
174342
174643
|
}
|
|
174644
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
174645
|
+
/**
|
|
174646
|
+
* @method
|
|
174647
|
+
* @name mexc#createMarketBuyOrderWithCost
|
|
174648
|
+
* @description create a market buy order by providing the symbol and cost
|
|
174649
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
|
174650
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
174651
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
174652
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
174653
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
174654
|
+
*/
|
|
174655
|
+
await this.loadMarkets();
|
|
174656
|
+
const market = this.market(symbol);
|
|
174657
|
+
if (!market['spot']) {
|
|
174658
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
174659
|
+
}
|
|
174660
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
174661
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
174662
|
+
}
|
|
174343
174663
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
174344
174664
|
/**
|
|
174345
174665
|
* @method
|
|
174346
174666
|
* @name mexc3#createOrder
|
|
174347
174667
|
* @description create a trade order
|
|
174668
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
|
174669
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
|
|
174670
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
|
|
174348
174671
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
174349
174672
|
* @param {string} type 'market' or 'limit'
|
|
174350
174673
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -174373,13 +174696,16 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
174373
174696
|
'type': type.toUpperCase(),
|
|
174374
174697
|
};
|
|
174375
174698
|
if (orderSide === 'BUY' && type === 'market') {
|
|
174376
|
-
|
|
174377
|
-
|
|
174378
|
-
|
|
174699
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
174700
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
174701
|
+
const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
|
|
174702
|
+
params = this.omit(params, 'cost');
|
|
174703
|
+
if (cost !== undefined) {
|
|
174704
|
+
amount = cost;
|
|
174379
174705
|
}
|
|
174380
|
-
else if (
|
|
174706
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
174381
174707
|
if (price === undefined) {
|
|
174382
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id +
|
|
174708
|
+
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 in the amount argument');
|
|
174383
174709
|
}
|
|
174384
174710
|
else {
|
|
174385
174711
|
const amountString = this.numberToString(amount);
|
|
@@ -185960,6 +186286,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
185960
186286
|
'asset/convert/currencies': 5 / 3,
|
|
185961
186287
|
'asset/convert/currency-pair': 5 / 3,
|
|
185962
186288
|
'asset/convert/history': 5 / 3,
|
|
186289
|
+
'asset/monthly-statement': 2,
|
|
185963
186290
|
// account
|
|
185964
186291
|
'account/balance': 2,
|
|
185965
186292
|
'account/positions': 2,
|
|
@@ -186093,6 +186420,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
186093
186420
|
'asset/convert-dust-assets': 10,
|
|
186094
186421
|
'asset/convert/estimate-quote': 1,
|
|
186095
186422
|
'asset/convert/trade': 1,
|
|
186423
|
+
'asset/monthly-statement': 1,
|
|
186096
186424
|
// account
|
|
186097
186425
|
'account/set-position-mode': 4,
|
|
186098
186426
|
'account/set-leverage': 1,
|
|
@@ -186726,14 +187054,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
186726
187054
|
'commonCurrencies': {
|
|
186727
187055
|
// the exchange refers to ERC20 version of Aeternity (AEToken)
|
|
186728
187056
|
'AE': 'AET',
|
|
186729
|
-
'
|
|
186730
|
-
'HOT': 'Hydro Protocol',
|
|
186731
|
-
'HSR': 'HC',
|
|
186732
|
-
'MAG': 'Maggie',
|
|
186733
|
-
'SBTC': 'Super Bitcoin',
|
|
186734
|
-
'TRADE': 'Unitrade',
|
|
186735
|
-
'YOYO': 'YOYOW',
|
|
186736
|
-
'WIN': 'WinToken', // https://github.com/ccxt/ccxt/issues/5701
|
|
187057
|
+
'WIN': 'WINTOKEN', // https://github.com/ccxt/ccxt/issues/5701
|
|
186737
187058
|
},
|
|
186738
187059
|
});
|
|
186739
187060
|
}
|
|
@@ -188759,6 +189080,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
188759
189080
|
* @param {string[]} ids order ids
|
|
188760
189081
|
* @param {string} symbol unified market symbol
|
|
188761
189082
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
189083
|
+
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
188762
189084
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
188763
189085
|
*/
|
|
188764
189086
|
// TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
|
|
@@ -188773,7 +189095,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
188773
189095
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
188774
189096
|
const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
|
|
188775
189097
|
const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
|
|
188776
|
-
const stop = this.
|
|
189098
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
188777
189099
|
if (stop) {
|
|
188778
189100
|
method = 'privatePostTradeCancelAlgos';
|
|
188779
189101
|
}
|
|
@@ -206734,18 +207056,26 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206734
207056
|
const url = this.urls['api']['ws']['ws'];
|
|
206735
207057
|
const requestId = this.requestId(url);
|
|
206736
207058
|
const messageHash = requestId.toString();
|
|
207059
|
+
const sor = this.safeValue2(params, 'sor', 'SOR', false);
|
|
207060
|
+
params = this.omit(params, 'sor', 'SOR');
|
|
206737
207061
|
const payload = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
206738
207062
|
let returnRateLimits = false;
|
|
206739
207063
|
[returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
|
|
206740
207064
|
payload['returnRateLimits'] = returnRateLimits;
|
|
207065
|
+
const test = this.safeValue(params, 'test', false);
|
|
207066
|
+
params = this.omit(params, 'test');
|
|
206741
207067
|
const message = {
|
|
206742
207068
|
'id': messageHash,
|
|
206743
207069
|
'method': 'order.place',
|
|
206744
207070
|
'params': this.signParams(this.extend(payload, params)),
|
|
206745
207071
|
};
|
|
206746
|
-
const test = this.safeValue(params, 'test', false);
|
|
206747
207072
|
if (test) {
|
|
206748
|
-
|
|
207073
|
+
if (sor) {
|
|
207074
|
+
message['method'] = 'sor.order.test';
|
|
207075
|
+
}
|
|
207076
|
+
else {
|
|
207077
|
+
message['method'] = 'order.test';
|
|
207078
|
+
}
|
|
206749
207079
|
}
|
|
206750
207080
|
const subscription = {
|
|
206751
207081
|
'method': this.handleOrderWs,
|
|
@@ -208072,6 +208402,7 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
208072
208402
|
'spot': 'wss://stream.binance.us:9443/ws',
|
|
208073
208403
|
},
|
|
208074
208404
|
'web': 'https://www.binance.us',
|
|
208405
|
+
'sapi': 'https://api.binance.us/sapi/v1',
|
|
208075
208406
|
'wapi': 'https://api.binance.us/wapi/v3',
|
|
208076
208407
|
'public': 'https://api.binance.us/api/v1',
|
|
208077
208408
|
'private': 'https://api.binance.us/api/v3',
|
|
@@ -229378,7 +229709,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229378
229709
|
const marketId = market['id'];
|
|
229379
229710
|
const url = this.getUrlByMarket(market);
|
|
229380
229711
|
const messageType = this.getTypeByMarket(market);
|
|
229381
|
-
const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', '
|
|
229712
|
+
const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
|
|
229382
229713
|
const channel = messageType + '.' + topic;
|
|
229383
229714
|
const messageHash = 'ticker:' + symbol;
|
|
229384
229715
|
const payload = [marketId];
|
|
@@ -270112,6 +270443,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
270112
270443
|
/**
|
|
270113
270444
|
* @method
|
|
270114
270445
|
* @name upbit#withdraw
|
|
270446
|
+
* @see https://docs.upbit.com/reference/디지털자산-출금하기
|
|
270115
270447
|
* @see https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
|
|
270116
270448
|
* @description make a withdrawal
|
|
270117
270449
|
* @param {string} code unified currency code
|
|
@@ -270122,14 +270454,14 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
270122
270454
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
270123
270455
|
*/
|
|
270124
270456
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
270125
|
-
this.checkAddress(address);
|
|
270126
270457
|
await this.loadMarkets();
|
|
270127
270458
|
const currency = this.currency(code);
|
|
270128
270459
|
const request = {
|
|
270129
270460
|
'amount': amount,
|
|
270130
270461
|
};
|
|
270131
|
-
let
|
|
270462
|
+
let response = undefined;
|
|
270132
270463
|
if (code !== 'KRW') {
|
|
270464
|
+
this.checkAddress(address);
|
|
270133
270465
|
// 2023-05-23 Change to required parameters for digital assets
|
|
270134
270466
|
const network = this.safeStringUpper2(params, 'network', 'net_type');
|
|
270135
270467
|
if (network === undefined) {
|
|
@@ -270137,18 +270469,17 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
270137
270469
|
}
|
|
270138
270470
|
params = this.omit(params, ['network']);
|
|
270139
270471
|
request['net_type'] = network;
|
|
270140
|
-
method += 'Coin';
|
|
270141
270472
|
request['currency'] = currency['id'];
|
|
270142
270473
|
request['address'] = address;
|
|
270143
270474
|
if (tag !== undefined) {
|
|
270144
270475
|
request['secondary_address'] = tag;
|
|
270145
270476
|
}
|
|
270146
270477
|
params = this.omit(params, 'network');
|
|
270478
|
+
response = await this.privatePostWithdrawsCoin(this.extend(request, params));
|
|
270147
270479
|
}
|
|
270148
270480
|
else {
|
|
270149
|
-
|
|
270481
|
+
response = await this.privatePostWithdrawsKrw(this.extend(request, params));
|
|
270150
270482
|
}
|
|
270151
|
-
const response = await this[method](this.extend(request, params));
|
|
270152
270483
|
//
|
|
270153
270484
|
// {
|
|
270154
270485
|
// "type": "withdraw",
|
|
@@ -288265,7 +288596,7 @@ SOFTWARE.
|
|
|
288265
288596
|
|
|
288266
288597
|
//-----------------------------------------------------------------------------
|
|
288267
288598
|
// this is updated by vss.js when building
|
|
288268
|
-
const version = '4.1.
|
|
288599
|
+
const version = '4.1.79';
|
|
288269
288600
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288270
288601
|
//-----------------------------------------------------------------------------
|
|
288271
288602
|
|