ccxt 4.1.77 → 4.1.78
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 +500 -176
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +3 -2
- 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 +12 -3
- package/dist/cjs/src/coinex.js +7 -11
- 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/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 +3 -2
- 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 +12 -3
- package/js/src/coinex.js +7 -11
- 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,
|
|
@@ -28285,7 +28285,8 @@ 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', ''); // priceChangePercent: '5.66%',
|
|
28289
|
+
percentage = percentage.replace('%', '');
|
|
28289
28290
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
28290
28291
|
const datetime = this.iso8601(ts);
|
|
28291
28292
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -40299,6 +40300,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40299
40300
|
'cancelAllOrders': true,
|
|
40300
40301
|
'cancelOrder': true,
|
|
40301
40302
|
'cancelOrders': true,
|
|
40303
|
+
'closeAllPositions': true,
|
|
40304
|
+
'closePosition': false,
|
|
40302
40305
|
'createOrder': true,
|
|
40303
40306
|
'createOrders': true,
|
|
40304
40307
|
'createReduceOnlyOrder': false,
|
|
@@ -45711,6 +45714,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45711
45714
|
// "utime": "1689300238205"
|
|
45712
45715
|
// }
|
|
45713
45716
|
//
|
|
45717
|
+
// closeAllPositions
|
|
45718
|
+
//
|
|
45719
|
+
// {
|
|
45720
|
+
// "symbol": "XRPUSDT_UMCBL",
|
|
45721
|
+
// "orderId": "1111861847410757635",
|
|
45722
|
+
// "clientOid": "1111861847410757637"
|
|
45723
|
+
// }
|
|
45724
|
+
//
|
|
45714
45725
|
const marketId = this.safeString(position, 'symbol');
|
|
45715
45726
|
market = this.safeMarket(marketId, market);
|
|
45716
45727
|
const symbol = market['symbol'];
|
|
@@ -47261,6 +47272,67 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
47261
47272
|
'info': info,
|
|
47262
47273
|
};
|
|
47263
47274
|
}
|
|
47275
|
+
async closeAllPositions(params = {}) {
|
|
47276
|
+
/**
|
|
47277
|
+
* @method
|
|
47278
|
+
* @name bitget#closePositions
|
|
47279
|
+
* @description closes open positions for a market
|
|
47280
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
|
|
47281
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
47282
|
+
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
47283
|
+
* @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
|
|
47284
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
47285
|
+
*/
|
|
47286
|
+
await this.loadMarkets();
|
|
47287
|
+
let subType = undefined;
|
|
47288
|
+
let settle = undefined;
|
|
47289
|
+
[subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
|
|
47290
|
+
settle = this.safeString(params, 'settle', 'USDT');
|
|
47291
|
+
params = this.omit(params, ['settle']);
|
|
47292
|
+
const productType = this.safeString(params, 'productType');
|
|
47293
|
+
const request = {};
|
|
47294
|
+
if (productType === undefined) {
|
|
47295
|
+
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
47296
|
+
let localProductType = undefined;
|
|
47297
|
+
if (subType === 'inverse') {
|
|
47298
|
+
localProductType = 'dmcbl';
|
|
47299
|
+
}
|
|
47300
|
+
else {
|
|
47301
|
+
if (settle === 'USDT') {
|
|
47302
|
+
localProductType = 'umcbl';
|
|
47303
|
+
}
|
|
47304
|
+
else if (settle === 'USDC') {
|
|
47305
|
+
localProductType = 'cmcbl';
|
|
47306
|
+
}
|
|
47307
|
+
}
|
|
47308
|
+
if (sandboxMode) {
|
|
47309
|
+
localProductType = 's' + localProductType;
|
|
47310
|
+
}
|
|
47311
|
+
request['productType'] = localProductType;
|
|
47312
|
+
}
|
|
47313
|
+
const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
|
|
47314
|
+
//
|
|
47315
|
+
// {
|
|
47316
|
+
// "code": "00000",
|
|
47317
|
+
// "msg": "success",
|
|
47318
|
+
// "requestTime": 1700814442466,
|
|
47319
|
+
// "data": {
|
|
47320
|
+
// "orderInfo": [
|
|
47321
|
+
// {
|
|
47322
|
+
// "symbol": "XRPUSDT_UMCBL",
|
|
47323
|
+
// "orderId": "1111861847410757635",
|
|
47324
|
+
// "clientOid": "1111861847410757637"
|
|
47325
|
+
// },
|
|
47326
|
+
// ],
|
|
47327
|
+
// "failure": [],
|
|
47328
|
+
// "result": true
|
|
47329
|
+
// }
|
|
47330
|
+
// }
|
|
47331
|
+
//
|
|
47332
|
+
const data = this.safeValue(response, 'data', {});
|
|
47333
|
+
const orderInfo = this.safeValue(data, 'orderInfo', []);
|
|
47334
|
+
return this.parsePositions(orderInfo, undefined, params);
|
|
47335
|
+
}
|
|
47264
47336
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
47265
47337
|
if (!response) {
|
|
47266
47338
|
return undefined; // fallback to default error handler
|
|
@@ -51804,19 +51876,15 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51804
51876
|
};
|
|
51805
51877
|
}
|
|
51806
51878
|
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
|
-
//
|
|
51879
|
+
/**
|
|
51880
|
+
* @method
|
|
51881
|
+
* @name bitmart#fetchIsolatedBorrowRate
|
|
51882
|
+
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
51883
|
+
* @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
|
51884
|
+
* @param {string} symbol unified symbol of the market to fetch the borrow rate for
|
|
51885
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
51886
|
+
* @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
51887
|
+
*/
|
|
51820
51888
|
await this.loadMarkets();
|
|
51821
51889
|
const market = this.market(symbol);
|
|
51822
51890
|
const request = {
|
|
@@ -76500,6 +76568,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76500
76568
|
'v5/lending/account': 5,
|
|
76501
76569
|
// broker
|
|
76502
76570
|
'v5/broker/earning-record': 5,
|
|
76571
|
+
'v5/broker/earnings-info': 5,
|
|
76572
|
+
'v5/broker/account-info': 5,
|
|
76503
76573
|
},
|
|
76504
76574
|
'post': {
|
|
76505
76575
|
// Legacy option USDC
|
|
@@ -86363,7 +86433,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86363
86433
|
else {
|
|
86364
86434
|
cost = costString;
|
|
86365
86435
|
}
|
|
86366
|
-
|
|
86436
|
+
let feeCurrencyId = this.safeString(feeObject, 'currency');
|
|
86437
|
+
const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
|
|
86438
|
+
if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
|
|
86439
|
+
feeCurrencyId = market['quote'];
|
|
86440
|
+
}
|
|
86367
86441
|
const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
|
|
86368
86442
|
const side = this.safeStringLower2(trade, 'resource', 'side');
|
|
86369
86443
|
const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
|
|
@@ -86381,7 +86455,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86381
86455
|
'amount': amountString,
|
|
86382
86456
|
'cost': cost,
|
|
86383
86457
|
'fee': {
|
|
86384
|
-
'cost':
|
|
86458
|
+
'cost': feeCost,
|
|
86385
86459
|
'currency': this.safeCurrencyCode(feeCurrencyId),
|
|
86386
86460
|
},
|
|
86387
86461
|
});
|
|
@@ -87831,6 +87905,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87831
87905
|
amount = this.safeString(marketIOC, 'base_size');
|
|
87832
87906
|
}
|
|
87833
87907
|
const datetime = this.safeString(order, 'created_time');
|
|
87908
|
+
const totalFees = this.safeString(order, 'total_fees');
|
|
87909
|
+
let currencyFee = undefined;
|
|
87910
|
+
if ((totalFees !== undefined) && (market !== undefined)) {
|
|
87911
|
+
currencyFee = market['quote'];
|
|
87912
|
+
}
|
|
87834
87913
|
return this.safeOrder({
|
|
87835
87914
|
'info': order,
|
|
87836
87915
|
'id': this.safeString(order, 'order_id'),
|
|
@@ -87854,7 +87933,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87854
87933
|
'status': this.parseOrderStatus(this.safeString(order, 'status')),
|
|
87855
87934
|
'fee': {
|
|
87856
87935
|
'cost': this.safeString(order, 'total_fees'),
|
|
87857
|
-
'currency':
|
|
87936
|
+
'currency': currencyFee,
|
|
87858
87937
|
},
|
|
87859
87938
|
'trades': undefined,
|
|
87860
87939
|
}, market);
|
|
@@ -96311,17 +96390,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96311
96390
|
return this.parseIsolatedBorrowRate(data, market);
|
|
96312
96391
|
}
|
|
96313
96392
|
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
|
-
//
|
|
96393
|
+
/**
|
|
96394
|
+
* @method
|
|
96395
|
+
* @name coinex#fetchIsolatedBorrowRates
|
|
96396
|
+
* @description fetch the borrow interest rates of all currencies
|
|
96397
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
96398
|
+
* @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
96399
|
+
*/
|
|
96325
96400
|
await this.loadMarkets();
|
|
96326
96401
|
const response = await this.privateGetMarginConfig(params);
|
|
96327
96402
|
//
|
|
@@ -122026,6 +122101,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122026
122101
|
'spot': 'https://api.gateio.ws/api/v4',
|
|
122027
122102
|
'options': 'https://api.gateio.ws/api/v4',
|
|
122028
122103
|
'subAccounts': 'https://api.gateio.ws/api/v4',
|
|
122104
|
+
'portfolio': 'https://api.gateio.ws/api/v4',
|
|
122029
122105
|
'rebate': 'https://api.gateio.ws/api/v4',
|
|
122030
122106
|
'earn': 'https://api.gateio.ws/api/v4',
|
|
122031
122107
|
'account': 'https://api.gateio.ws/api/v4',
|
|
@@ -122463,10 +122539,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122463
122539
|
},
|
|
122464
122540
|
'earn': {
|
|
122465
122541
|
'get': {
|
|
122542
|
+
'uni/currencies': 20 / 15,
|
|
122543
|
+
'uni/currencies/{currency}': 20 / 15,
|
|
122466
122544
|
'uni/lends': 20 / 15,
|
|
122467
122545
|
'uni/lend_records': 20 / 15,
|
|
122468
122546
|
'uni/interests/{currency}': 20 / 15,
|
|
122469
122547
|
'uni/interest_records': 20 / 15,
|
|
122548
|
+
'uni/interest_status/{currency}': 20 / 15,
|
|
122470
122549
|
},
|
|
122471
122550
|
'post': {
|
|
122472
122551
|
'uni/lends': 20 / 15,
|
|
@@ -131443,6 +131522,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131443
131522
|
* @method
|
|
131444
131523
|
* @name hitbtc#fetchMarkets
|
|
131445
131524
|
* @description retrieves data on all markets for hitbtc
|
|
131525
|
+
* @see https://api.hitbtc.com/#symbols
|
|
131446
131526
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131447
131527
|
* @returns {object[]} an array of objects representing market data
|
|
131448
131528
|
*/
|
|
@@ -131586,6 +131666,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131586
131666
|
* @method
|
|
131587
131667
|
* @name hitbtc#fetchCurrencies
|
|
131588
131668
|
* @description fetches all available currencies on an exchange
|
|
131669
|
+
* @see https://api.hitbtc.com/#currencies
|
|
131589
131670
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131590
131671
|
* @returns {object} an associative dictionary of currencies
|
|
131591
131672
|
*/
|
|
@@ -131706,6 +131787,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131706
131787
|
* @method
|
|
131707
131788
|
* @name hitbtc#createDepositAddress
|
|
131708
131789
|
* @description create a currency deposit address
|
|
131790
|
+
* @see https://api.hitbtc.com/#generate-deposit-crypto-address
|
|
131709
131791
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
131710
131792
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131711
131793
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -131742,6 +131824,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131742
131824
|
* @method
|
|
131743
131825
|
* @name hitbtc#fetchDepositAddress
|
|
131744
131826
|
* @description fetch the deposit address for a currency associated with this account
|
|
131827
|
+
* @see https://api.hitbtc.com/#get-deposit-crypto-address
|
|
131745
131828
|
* @param {string} code unified currency code
|
|
131746
131829
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131747
131830
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -131796,6 +131879,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131796
131879
|
* @method
|
|
131797
131880
|
* @name hitbtc#fetchBalance
|
|
131798
131881
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
131882
|
+
* @see https://api.hitbtc.com/#wallet-balance
|
|
131883
|
+
* @see https://api.hitbtc.com/#get-spot-trading-balance
|
|
131884
|
+
* @see https://api.hitbtc.com/#get-trading-balance
|
|
131799
131885
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
131800
131886
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
131801
131887
|
*/
|
|
@@ -131998,6 +132084,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
131998
132084
|
* @method
|
|
131999
132085
|
* @name hitbtc#fetchMyTrades
|
|
132000
132086
|
* @description fetch all trades made by the user
|
|
132087
|
+
* @see https://api.hitbtc.com/#spot-trades-history
|
|
132088
|
+
* @see https://api.hitbtc.com/#futures-trades-history
|
|
132089
|
+
* @see https://api.hitbtc.com/#margin-trades-history
|
|
132001
132090
|
* @param {string} symbol unified market symbol
|
|
132002
132091
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
132003
132092
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -132020,17 +132109,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132020
132109
|
request['from'] = since;
|
|
132021
132110
|
}
|
|
132022
132111
|
let marketType = undefined;
|
|
132112
|
+
let marginMode = undefined;
|
|
132113
|
+
let response = undefined;
|
|
132023
132114
|
[marketType, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
|
|
132024
|
-
|
|
132025
|
-
|
|
132026
|
-
'swap': 'privateGetFuturesHistoryTrade',
|
|
132027
|
-
'margin': 'privateGetMarginHistoryTrade',
|
|
132028
|
-
});
|
|
132029
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
132115
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
132116
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132030
132117
|
if (marginMode !== undefined) {
|
|
132031
|
-
|
|
132118
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132119
|
+
}
|
|
132120
|
+
else {
|
|
132121
|
+
if (marketType === 'spot') {
|
|
132122
|
+
response = await this.privateGetSpotHistoryTrade(this.extend(request, params));
|
|
132123
|
+
}
|
|
132124
|
+
else if (marketType === 'swap') {
|
|
132125
|
+
response = await this.privateGetFuturesHistoryTrade(this.extend(request, params));
|
|
132126
|
+
}
|
|
132127
|
+
else if (marketType === 'margin') {
|
|
132128
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132129
|
+
}
|
|
132130
|
+
else {
|
|
132131
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() not support this market type');
|
|
132132
|
+
}
|
|
132032
132133
|
}
|
|
132033
|
-
const response = await this[method](this.extend(request, query));
|
|
132034
132134
|
return this.parseTrades(response, market, since, limit);
|
|
132035
132135
|
}
|
|
132036
132136
|
parseTrade(trade, market = undefined) {
|
|
@@ -132284,6 +132384,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132284
132384
|
* @method
|
|
132285
132385
|
* @name hitbtc#fetchDepositsWithdrawals
|
|
132286
132386
|
* @description fetch history of deposits and withdrawals
|
|
132387
|
+
* @see https://api.hitbtc.com/#get-transactions-history
|
|
132287
132388
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
132288
132389
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
132289
132390
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -132297,6 +132398,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132297
132398
|
* @method
|
|
132298
132399
|
* @name hitbtc#fetchDeposits
|
|
132299
132400
|
* @description fetch all deposits made to an account
|
|
132401
|
+
* @see https://api.hitbtc.com/#get-transactions-history
|
|
132300
132402
|
* @param {string} code unified currency code
|
|
132301
132403
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
132302
132404
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -132310,6 +132412,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132310
132412
|
* @method
|
|
132311
132413
|
* @name hitbtc#fetchWithdrawals
|
|
132312
132414
|
* @description fetch all withdrawals made from an account
|
|
132415
|
+
* @see https://api.hitbtc.com/#get-transactions-history
|
|
132313
132416
|
* @param {string} code unified currency code
|
|
132314
132417
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
132315
132418
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -132397,6 +132500,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132397
132500
|
* @method
|
|
132398
132501
|
* @name hitbtc#fetchTradingFee
|
|
132399
132502
|
* @description fetch the trading fees for a market
|
|
132503
|
+
* @see https://api.hitbtc.com/#get-trading-commission
|
|
132504
|
+
* @see https://api.hitbtc.com/#get-trading-commission-2
|
|
132400
132505
|
* @param {string} symbol unified market symbol
|
|
132401
132506
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132402
132507
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -132406,11 +132511,16 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132406
132511
|
const request = {
|
|
132407
132512
|
'symbol': market['id'],
|
|
132408
132513
|
};
|
|
132409
|
-
|
|
132410
|
-
|
|
132411
|
-
|
|
132412
|
-
}
|
|
132413
|
-
|
|
132514
|
+
let response = undefined;
|
|
132515
|
+
if (market['type'] === 'spot') {
|
|
132516
|
+
response = await this.privateGetSpotFeeSymbol(this.extend(request, params));
|
|
132517
|
+
}
|
|
132518
|
+
else if (market['type'] === 'swap') {
|
|
132519
|
+
response = await this.privateGetFuturesFeeSymbol(this.extend(request, params));
|
|
132520
|
+
}
|
|
132521
|
+
else {
|
|
132522
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTradingFee() not support this market type');
|
|
132523
|
+
}
|
|
132414
132524
|
//
|
|
132415
132525
|
// {
|
|
132416
132526
|
// "take_rate":"0.0009",
|
|
@@ -132424,16 +132534,23 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132424
132534
|
* @method
|
|
132425
132535
|
* @name hitbtc#fetchTradingFees
|
|
132426
132536
|
* @description fetch the trading fees for multiple markets
|
|
132537
|
+
* @see https://api.hitbtc.com/#get-all-trading-commissions
|
|
132538
|
+
* @see https://api.hitbtc.com/#get-all-trading-commissions-2
|
|
132427
132539
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132428
132540
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
132429
132541
|
*/
|
|
132430
132542
|
await this.loadMarkets();
|
|
132431
132543
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchTradingFees', undefined, params);
|
|
132432
|
-
|
|
132433
|
-
|
|
132434
|
-
|
|
132435
|
-
}
|
|
132436
|
-
|
|
132544
|
+
let response = undefined;
|
|
132545
|
+
if (marketType === 'spot') {
|
|
132546
|
+
response = await this.privateGetSpotFee(query);
|
|
132547
|
+
}
|
|
132548
|
+
else if (marketType === 'swap') {
|
|
132549
|
+
response = await this.privateGetFuturesFee(query);
|
|
132550
|
+
}
|
|
132551
|
+
else {
|
|
132552
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTradingFees() not support this market type');
|
|
132553
|
+
}
|
|
132437
132554
|
//
|
|
132438
132555
|
// [
|
|
132439
132556
|
// {
|
|
@@ -132569,6 +132686,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132569
132686
|
* @method
|
|
132570
132687
|
* @name hitbtc#fetchClosedOrders
|
|
132571
132688
|
* @description fetches information on multiple closed orders made by the user
|
|
132689
|
+
* @see https://api.hitbtc.com/#spot-orders-history
|
|
132690
|
+
* @see https://api.hitbtc.com/#futures-orders-history
|
|
132691
|
+
* @see https://api.hitbtc.com/#margin-orders-history
|
|
132572
132692
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
132573
132693
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
132574
132694
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -132591,17 +132711,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132591
132711
|
request['limit'] = limit;
|
|
132592
132712
|
}
|
|
132593
132713
|
let marketType = undefined;
|
|
132714
|
+
let marginMode = undefined;
|
|
132594
132715
|
[marketType, params] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
132595
|
-
|
|
132596
|
-
|
|
132597
|
-
|
|
132598
|
-
'margin': 'privateGetMarginHistoryOrder',
|
|
132599
|
-
});
|
|
132600
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchClosedOrders', params);
|
|
132716
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchClosedOrders', params);
|
|
132717
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132718
|
+
let response = undefined;
|
|
132601
132719
|
if (marginMode !== undefined) {
|
|
132602
|
-
|
|
132720
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132721
|
+
}
|
|
132722
|
+
else {
|
|
132723
|
+
if (marketType === 'spot') {
|
|
132724
|
+
response = await this.privateGetSpotHistoryOrder(this.extend(request, params));
|
|
132725
|
+
}
|
|
132726
|
+
else if (marketType === 'swap') {
|
|
132727
|
+
response = await this.privateGetFuturesHistoryOrder(this.extend(request, params));
|
|
132728
|
+
}
|
|
132729
|
+
else if (marketType === 'margin') {
|
|
132730
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132731
|
+
}
|
|
132732
|
+
else {
|
|
132733
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchClosedOrders() not support this market type');
|
|
132734
|
+
}
|
|
132603
132735
|
}
|
|
132604
|
-
const response = await this[method](this.extend(request, query));
|
|
132605
132736
|
const parsed = this.parseOrders(response, market, since, limit);
|
|
132606
132737
|
return this.filterByArray(parsed, 'status', ['closed', 'canceled'], false);
|
|
132607
132738
|
}
|
|
@@ -132610,6 +132741,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132610
132741
|
* @method
|
|
132611
132742
|
* @name hitbtc#fetchOrder
|
|
132612
132743
|
* @description fetches information on an order made by the user
|
|
132744
|
+
* @see https://api.hitbtc.com/#spot-orders-history
|
|
132745
|
+
* @see https://api.hitbtc.com/#futures-orders-history
|
|
132746
|
+
* @see https://api.hitbtc.com/#margin-orders-history
|
|
132613
132747
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
132614
132748
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132615
132749
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
|
|
@@ -132621,21 +132755,32 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132621
132755
|
if (symbol !== undefined) {
|
|
132622
132756
|
market = this.market(symbol);
|
|
132623
132757
|
}
|
|
132758
|
+
const request = {
|
|
132759
|
+
'client_order_id': id,
|
|
132760
|
+
};
|
|
132624
132761
|
let marketType = undefined;
|
|
132762
|
+
let marginMode = undefined;
|
|
132625
132763
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
132626
|
-
|
|
132627
|
-
|
|
132628
|
-
|
|
132629
|
-
'margin': 'privateGetMarginHistoryOrder',
|
|
132630
|
-
});
|
|
132631
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOrder', params);
|
|
132764
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrder', params);
|
|
132765
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132766
|
+
let response = undefined;
|
|
132632
132767
|
if (marginMode !== undefined) {
|
|
132633
|
-
|
|
132768
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132769
|
+
}
|
|
132770
|
+
else {
|
|
132771
|
+
if (marketType === 'spot') {
|
|
132772
|
+
response = await this.privateGetSpotHistoryOrder(this.extend(request, params));
|
|
132773
|
+
}
|
|
132774
|
+
else if (marketType === 'swap') {
|
|
132775
|
+
response = await this.privateGetFuturesHistoryOrder(this.extend(request, params));
|
|
132776
|
+
}
|
|
132777
|
+
else if (marketType === 'margin') {
|
|
132778
|
+
response = await this.privateGetMarginHistoryOrder(this.extend(request, params));
|
|
132779
|
+
}
|
|
132780
|
+
else {
|
|
132781
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrder() not support this market type');
|
|
132782
|
+
}
|
|
132634
132783
|
}
|
|
132635
|
-
const request = {
|
|
132636
|
-
'client_order_id': id,
|
|
132637
|
-
};
|
|
132638
|
-
const response = await this[method](this.extend(request, query));
|
|
132639
132784
|
//
|
|
132640
132785
|
// [
|
|
132641
132786
|
// {
|
|
@@ -132663,6 +132808,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132663
132808
|
* @method
|
|
132664
132809
|
* @name hitbtc#fetchOrderTrades
|
|
132665
132810
|
* @description fetch all the trades made from a single order
|
|
132811
|
+
* @see https://api.hitbtc.com/#spot-trades-history
|
|
132812
|
+
* @see https://api.hitbtc.com/#futures-trades-history
|
|
132813
|
+
* @see https://api.hitbtc.com/#margin-trades-history
|
|
132666
132814
|
* @param {string} id order id
|
|
132667
132815
|
* @param {string} symbol unified market symbol
|
|
132668
132816
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -132681,17 +132829,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132681
132829
|
'order_id': id, // exchange assigned order id as oppose to the client order id
|
|
132682
132830
|
};
|
|
132683
132831
|
let marketType = undefined;
|
|
132832
|
+
let marginMode = undefined;
|
|
132684
132833
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOrderTrades', market, params);
|
|
132685
|
-
|
|
132686
|
-
|
|
132687
|
-
|
|
132688
|
-
'margin': 'privateGetMarginHistoryTrade',
|
|
132689
|
-
});
|
|
132690
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOrderTrades', params);
|
|
132834
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrderTrades', params);
|
|
132835
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132836
|
+
let response = undefined;
|
|
132691
132837
|
if (marginMode !== undefined) {
|
|
132692
|
-
|
|
132838
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132839
|
+
}
|
|
132840
|
+
else {
|
|
132841
|
+
if (marketType === 'spot') {
|
|
132842
|
+
response = await this.privateGetSpotHistoryTrade(this.extend(request, params));
|
|
132843
|
+
}
|
|
132844
|
+
else if (marketType === 'swap') {
|
|
132845
|
+
response = await this.privateGetFuturesHistoryTrade(this.extend(request, params));
|
|
132846
|
+
}
|
|
132847
|
+
else if (marketType === 'margin') {
|
|
132848
|
+
response = await this.privateGetMarginHistoryTrade(this.extend(request, params));
|
|
132849
|
+
}
|
|
132850
|
+
else {
|
|
132851
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrderTrades() not support this market type');
|
|
132852
|
+
}
|
|
132693
132853
|
}
|
|
132694
|
-
const response = await this[method](this.extend(request, query));
|
|
132695
132854
|
//
|
|
132696
132855
|
// Spot
|
|
132697
132856
|
//
|
|
@@ -132737,6 +132896,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132737
132896
|
* @method
|
|
132738
132897
|
* @name hitbtc#fetchOpenOrders
|
|
132739
132898
|
* @description fetch all unfilled currently open orders
|
|
132899
|
+
* @see https://api.hitbtc.com/#get-all-active-spot-orders
|
|
132900
|
+
* @see https://api.hitbtc.com/#get-active-futures-orders
|
|
132901
|
+
* @see https://api.hitbtc.com/#get-active-margin-orders
|
|
132740
132902
|
* @param {string} symbol unified market symbol
|
|
132741
132903
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
132742
132904
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -132753,17 +132915,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132753
132915
|
request['symbol'] = market['id'];
|
|
132754
132916
|
}
|
|
132755
132917
|
let marketType = undefined;
|
|
132918
|
+
let marginMode = undefined;
|
|
132756
132919
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
132757
|
-
|
|
132758
|
-
|
|
132759
|
-
|
|
132760
|
-
'margin': 'privateGetMarginOrder',
|
|
132761
|
-
});
|
|
132762
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
132920
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
132921
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132922
|
+
let response = undefined;
|
|
132763
132923
|
if (marginMode !== undefined) {
|
|
132764
|
-
|
|
132924
|
+
response = await this.privateGetMarginOrder(this.extend(request, params));
|
|
132925
|
+
}
|
|
132926
|
+
else {
|
|
132927
|
+
if (marketType === 'spot') {
|
|
132928
|
+
response = await this.privateGetSpotOrder(this.extend(request, params));
|
|
132929
|
+
}
|
|
132930
|
+
else if (marketType === 'swap') {
|
|
132931
|
+
response = await this.privateGetFuturesOrder(this.extend(request, params));
|
|
132932
|
+
}
|
|
132933
|
+
else if (marketType === 'margin') {
|
|
132934
|
+
response = await this.privateGetMarginOrder(this.extend(request, params));
|
|
132935
|
+
}
|
|
132936
|
+
else {
|
|
132937
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrders() not support this market type');
|
|
132938
|
+
}
|
|
132765
132939
|
}
|
|
132766
|
-
const response = await this[method](this.extend(request, query));
|
|
132767
132940
|
//
|
|
132768
132941
|
// [
|
|
132769
132942
|
// {
|
|
@@ -132790,6 +132963,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132790
132963
|
* @method
|
|
132791
132964
|
* @name hitbtc#fetchOpenOrder
|
|
132792
132965
|
* @description fetch an open order by it's id
|
|
132966
|
+
* @see https://api.hitbtc.com/#get-active-spot-order
|
|
132967
|
+
* @see https://api.hitbtc.com/#get-active-futures-order
|
|
132968
|
+
* @see https://api.hitbtc.com/#get-active-margin-order
|
|
132793
132969
|
* @param {string} id order id
|
|
132794
132970
|
* @param {string} symbol unified market symbol, default is undefined
|
|
132795
132971
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -132802,21 +132978,32 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132802
132978
|
if (symbol !== undefined) {
|
|
132803
132979
|
market = this.market(symbol);
|
|
132804
132980
|
}
|
|
132981
|
+
const request = {
|
|
132982
|
+
'client_order_id': id,
|
|
132983
|
+
};
|
|
132805
132984
|
let marketType = undefined;
|
|
132985
|
+
let marginMode = undefined;
|
|
132806
132986
|
[marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrder', market, params);
|
|
132807
|
-
|
|
132808
|
-
|
|
132809
|
-
|
|
132810
|
-
'margin': 'privateGetMarginOrderClientOrderId',
|
|
132811
|
-
});
|
|
132812
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrder', params);
|
|
132987
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrder', params);
|
|
132988
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
132989
|
+
let response = undefined;
|
|
132813
132990
|
if (marginMode !== undefined) {
|
|
132814
|
-
|
|
132991
|
+
response = await this.privateGetMarginOrderClientOrderId(this.extend(request, params));
|
|
132992
|
+
}
|
|
132993
|
+
else {
|
|
132994
|
+
if (marketType === 'spot') {
|
|
132995
|
+
response = await this.privateGetSpotOrderClientOrderId(this.extend(request, params));
|
|
132996
|
+
}
|
|
132997
|
+
else if (marketType === 'swap') {
|
|
132998
|
+
response = await this.privateGetFuturesOrderClientOrderId(this.extend(request, params));
|
|
132999
|
+
}
|
|
133000
|
+
else if (marketType === 'margin') {
|
|
133001
|
+
response = await this.privateGetMarginOrderClientOrderId(this.extend(request, params));
|
|
133002
|
+
}
|
|
133003
|
+
else {
|
|
133004
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrder() not support this market type');
|
|
133005
|
+
}
|
|
132815
133006
|
}
|
|
132816
|
-
const request = {
|
|
132817
|
-
'client_order_id': id,
|
|
132818
|
-
};
|
|
132819
|
-
const response = await this[method](this.extend(request, query));
|
|
132820
133007
|
return this.parseOrder(response, market);
|
|
132821
133008
|
}
|
|
132822
133009
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -132824,6 +133011,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132824
133011
|
* @method
|
|
132825
133012
|
* @name hitbtc#cancelAllOrders
|
|
132826
133013
|
* @description cancel all open orders
|
|
133014
|
+
* @see https://api.hitbtc.com/#cancel-all-spot-orders
|
|
133015
|
+
* @see https://api.hitbtc.com/#cancel-futures-orders
|
|
133016
|
+
* @see https://api.hitbtc.com/#cancel-all-margin-orders
|
|
132827
133017
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
132828
133018
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132829
133019
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
|
|
@@ -132838,17 +133028,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132838
133028
|
request['symbol'] = market['id'];
|
|
132839
133029
|
}
|
|
132840
133030
|
let marketType = undefined;
|
|
133031
|
+
let marginMode = undefined;
|
|
132841
133032
|
[marketType, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
132842
|
-
|
|
132843
|
-
|
|
132844
|
-
|
|
132845
|
-
'margin': 'privateDeleteMarginOrder',
|
|
132846
|
-
});
|
|
132847
|
-
const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
133033
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
133034
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133035
|
+
let response = undefined;
|
|
132848
133036
|
if (marginMode !== undefined) {
|
|
132849
|
-
|
|
133037
|
+
response = await this.privateDeleteMarginOrder(this.extend(request, params));
|
|
133038
|
+
}
|
|
133039
|
+
else {
|
|
133040
|
+
if (marketType === 'spot') {
|
|
133041
|
+
response = await this.privateDeleteSpotOrder(this.extend(request, params));
|
|
133042
|
+
}
|
|
133043
|
+
else if (marketType === 'swap') {
|
|
133044
|
+
response = await this.privateDeleteFuturesOrder(this.extend(request, params));
|
|
133045
|
+
}
|
|
133046
|
+
else if (marketType === 'margin') {
|
|
133047
|
+
response = await this.privateDeleteMarginOrder(this.extend(request, params));
|
|
133048
|
+
}
|
|
133049
|
+
else {
|
|
133050
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelAllOrders() not support this market type');
|
|
133051
|
+
}
|
|
132850
133052
|
}
|
|
132851
|
-
const response = await this[method](this.extend(request, query));
|
|
132852
133053
|
return this.parseOrders(response, market);
|
|
132853
133054
|
}
|
|
132854
133055
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -132856,6 +133057,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132856
133057
|
* @method
|
|
132857
133058
|
* @name hitbtc#cancelOrder
|
|
132858
133059
|
* @description cancels an open order
|
|
133060
|
+
* @see https://api.hitbtc.com/#cancel-spot-order
|
|
133061
|
+
* @see https://api.hitbtc.com/#cancel-futures-order
|
|
133062
|
+
* @see https://api.hitbtc.com/#cancel-margin-order
|
|
132859
133063
|
* @param {string} id order id
|
|
132860
133064
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
132861
133065
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -132872,17 +133076,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132872
133076
|
market = this.market(symbol);
|
|
132873
133077
|
}
|
|
132874
133078
|
let marketType = undefined;
|
|
133079
|
+
let marginMode = undefined;
|
|
132875
133080
|
[marketType, params] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
132876
|
-
|
|
132877
|
-
|
|
132878
|
-
|
|
132879
|
-
'margin': 'privateDeleteMarginOrderClientOrderId',
|
|
132880
|
-
});
|
|
132881
|
-
const [marginMode, query] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
133081
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
133082
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133083
|
+
let response = undefined;
|
|
132882
133084
|
if (marginMode !== undefined) {
|
|
132883
|
-
|
|
133085
|
+
response = await this.privateDeleteMarginOrderClientOrderId(this.extend(request, params));
|
|
133086
|
+
}
|
|
133087
|
+
else {
|
|
133088
|
+
if (marketType === 'spot') {
|
|
133089
|
+
response = await this.privateDeleteSpotOrderClientOrderId(this.extend(request, params));
|
|
133090
|
+
}
|
|
133091
|
+
else if (marketType === 'swap') {
|
|
133092
|
+
response = await this.privateDeleteFuturesOrderClientOrderId(this.extend(request, params));
|
|
133093
|
+
}
|
|
133094
|
+
else if (marketType === 'margin') {
|
|
133095
|
+
response = await this.privateDeleteMarginOrderClientOrderId(this.extend(request, params));
|
|
133096
|
+
}
|
|
133097
|
+
else {
|
|
133098
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelOrder() not support this market type');
|
|
133099
|
+
}
|
|
132884
133100
|
}
|
|
132885
|
-
const response = await this[method](this.extend(request, query));
|
|
132886
133101
|
return this.parseOrder(response, market);
|
|
132887
133102
|
}
|
|
132888
133103
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -132902,17 +133117,28 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132902
133117
|
market = this.market(symbol);
|
|
132903
133118
|
}
|
|
132904
133119
|
let marketType = undefined;
|
|
133120
|
+
let marginMode = undefined;
|
|
132905
133121
|
[marketType, params] = this.handleMarketTypeAndParams('editOrder', market, params);
|
|
132906
|
-
|
|
132907
|
-
|
|
132908
|
-
|
|
132909
|
-
'margin': 'privatePatchMarginOrderClientOrderId',
|
|
132910
|
-
});
|
|
132911
|
-
const [marginMode, query] = this.handleMarginModeAndParams('editOrder', params);
|
|
133122
|
+
[marginMode, params] = this.handleMarginModeAndParams('editOrder', params);
|
|
133123
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133124
|
+
let response = undefined;
|
|
132912
133125
|
if (marginMode !== undefined) {
|
|
132913
|
-
|
|
133126
|
+
response = await this.privatePatchMarginOrderClientOrderId(this.extend(request, params));
|
|
133127
|
+
}
|
|
133128
|
+
else {
|
|
133129
|
+
if (marketType === 'spot') {
|
|
133130
|
+
response = await this.privatePatchSpotOrderClientOrderId(this.extend(request, params));
|
|
133131
|
+
}
|
|
133132
|
+
else if (marketType === 'swap') {
|
|
133133
|
+
response = await this.privatePatchFuturesOrderClientOrderId(this.extend(request, params));
|
|
133134
|
+
}
|
|
133135
|
+
else if (marketType === 'margin') {
|
|
133136
|
+
response = await this.privatePatchMarginOrderClientOrderId(this.extend(request, params));
|
|
133137
|
+
}
|
|
133138
|
+
else {
|
|
133139
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' editOrder() not support this market type');
|
|
133140
|
+
}
|
|
132914
133141
|
}
|
|
132915
|
-
const response = await this[method](this.extend(request, query));
|
|
132916
133142
|
return this.parseOrder(response, market);
|
|
132917
133143
|
}
|
|
132918
133144
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -133241,6 +133467,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133241
133467
|
* @method
|
|
133242
133468
|
* @name hitbtc#transfer
|
|
133243
133469
|
* @description transfer currency internally between wallets on the same account
|
|
133470
|
+
* @see https://api.hitbtc.com/#transfer-between-wallet-and-exchange
|
|
133244
133471
|
* @param {string} code unified currency code
|
|
133245
133472
|
* @param {float} amount amount to transfer
|
|
133246
133473
|
* @param {string} fromAccount account to transfer from
|
|
@@ -133328,6 +133555,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133328
133555
|
* @method
|
|
133329
133556
|
* @name hitbtc#withdraw
|
|
133330
133557
|
* @description make a withdrawal
|
|
133558
|
+
* @see https://api.hitbtc.com/#withdraw-crypto
|
|
133331
133559
|
* @param {string} code unified currency code
|
|
133332
133560
|
* @param {float} amount the amount to withdraw
|
|
133333
133561
|
* @param {string} address the address to withdraw to
|
|
@@ -133509,6 +133737,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133509
133737
|
* @method
|
|
133510
133738
|
* @name hitbtc#fetchPositions
|
|
133511
133739
|
* @description fetch all open positions
|
|
133740
|
+
* @see https://api.hitbtc.com/#get-futures-margin-accounts
|
|
133741
|
+
* @see https://api.hitbtc.com/#get-all-margin-accounts
|
|
133512
133742
|
* @param {string[]|undefined} symbols not used by hitbtc fetchPositions ()
|
|
133513
133743
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
133514
133744
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
|
|
@@ -133518,16 +133748,25 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133518
133748
|
await this.loadMarkets();
|
|
133519
133749
|
const request = {};
|
|
133520
133750
|
let marketType = undefined;
|
|
133751
|
+
let marginMode = undefined;
|
|
133521
133752
|
[marketType, params] = this.handleMarketTypeAndParams('fetchPositions', undefined, params);
|
|
133522
|
-
|
|
133523
|
-
|
|
133524
|
-
|
|
133525
|
-
});
|
|
133526
|
-
const [marginMode, query] = this.handleMarginModeAndParams('fetchPositions', params);
|
|
133753
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params);
|
|
133754
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133755
|
+
let response = undefined;
|
|
133527
133756
|
if (marginMode !== undefined) {
|
|
133528
|
-
|
|
133757
|
+
response = await this.privateGetMarginAccount(this.extend(request, params));
|
|
133758
|
+
}
|
|
133759
|
+
else {
|
|
133760
|
+
if (marketType === 'swap') {
|
|
133761
|
+
response = await this.privateGetFuturesAccount(this.extend(request, params));
|
|
133762
|
+
}
|
|
133763
|
+
else if (marketType === 'margin') {
|
|
133764
|
+
response = await this.privateGetMarginAccount(this.extend(request, params));
|
|
133765
|
+
}
|
|
133766
|
+
else {
|
|
133767
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPositions() not support this market type');
|
|
133768
|
+
}
|
|
133529
133769
|
}
|
|
133530
|
-
const response = await this[method](this.extend(request, query));
|
|
133531
133770
|
//
|
|
133532
133771
|
// [
|
|
133533
133772
|
// {
|
|
@@ -133571,6 +133810,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133571
133810
|
* @method
|
|
133572
133811
|
* @name hitbtc#fetchPosition
|
|
133573
133812
|
* @description fetch data on a single open contract trade position
|
|
133813
|
+
* @see https://api.hitbtc.com/#get-futures-margin-account
|
|
133814
|
+
* @see https://api.hitbtc.com/#get-isolated-margin-account
|
|
133574
133815
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
133575
133816
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
133576
133817
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set
|
|
@@ -133578,21 +133819,30 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133578
133819
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
133579
133820
|
*/
|
|
133580
133821
|
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
133822
|
const market = this.market(symbol);
|
|
133592
133823
|
const request = {
|
|
133593
133824
|
'symbol': market['id'],
|
|
133594
133825
|
};
|
|
133595
|
-
|
|
133826
|
+
let marketType = undefined;
|
|
133827
|
+
let marginMode = undefined;
|
|
133828
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchPosition', undefined, params);
|
|
133829
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchPosition', params);
|
|
133830
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
133831
|
+
let response = undefined;
|
|
133832
|
+
if (marginMode !== undefined) {
|
|
133833
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
133834
|
+
}
|
|
133835
|
+
else {
|
|
133836
|
+
if (marketType === 'swap') {
|
|
133837
|
+
response = await this.privateGetFuturesAccountIsolatedSymbol(this.extend(request, params));
|
|
133838
|
+
}
|
|
133839
|
+
else if (marketType === 'margin') {
|
|
133840
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
133841
|
+
}
|
|
133842
|
+
else {
|
|
133843
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchPosition() not support this market type');
|
|
133844
|
+
}
|
|
133845
|
+
}
|
|
133596
133846
|
//
|
|
133597
133847
|
// [
|
|
133598
133848
|
// {
|
|
@@ -133859,7 +134109,12 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133859
134109
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' modifyMarginHelper() requires a leverage parameter for swap markets');
|
|
133860
134110
|
}
|
|
133861
134111
|
}
|
|
133862
|
-
amount
|
|
134112
|
+
if (amount !== 0) {
|
|
134113
|
+
amount = this.amountToPrecision(symbol, amount);
|
|
134114
|
+
}
|
|
134115
|
+
else {
|
|
134116
|
+
amount = '0';
|
|
134117
|
+
}
|
|
133863
134118
|
const request = {
|
|
133864
134119
|
'symbol': market['id'],
|
|
133865
134120
|
'margin_balance': amount, // swap and margin
|
|
@@ -133870,16 +134125,25 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133870
134125
|
request['leverage'] = leverage;
|
|
133871
134126
|
}
|
|
133872
134127
|
let marketType = undefined;
|
|
133873
|
-
|
|
133874
|
-
|
|
133875
|
-
|
|
133876
|
-
|
|
133877
|
-
|
|
133878
|
-
const [marginMode, query] = this.handleMarginModeAndParams('modifyMarginHelper', params);
|
|
134128
|
+
let marginMode = undefined;
|
|
134129
|
+
[marketType, params] = this.handleMarketTypeAndParams('modifyMarginHelper', market, params);
|
|
134130
|
+
[marginMode, params] = this.handleMarginModeAndParams('modifyMarginHelper', params);
|
|
134131
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
134132
|
+
let response = undefined;
|
|
133879
134133
|
if (marginMode !== undefined) {
|
|
133880
|
-
|
|
134134
|
+
response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134135
|
+
}
|
|
134136
|
+
else {
|
|
134137
|
+
if (marketType === 'swap') {
|
|
134138
|
+
response = await this.privatePutFuturesAccountIsolatedSymbol(this.extend(request, params));
|
|
134139
|
+
}
|
|
134140
|
+
else if (marketType === 'margin') {
|
|
134141
|
+
response = await this.privatePutMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134142
|
+
}
|
|
134143
|
+
else {
|
|
134144
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' modifyMarginHelper() not support this market type');
|
|
134145
|
+
}
|
|
133881
134146
|
}
|
|
133882
|
-
const response = await this[method](this.extend(request, query));
|
|
133883
134147
|
//
|
|
133884
134148
|
// {
|
|
133885
134149
|
// "symbol": "BTCUSDT_PERP",
|
|
@@ -133920,6 +134184,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133920
134184
|
* @method
|
|
133921
134185
|
* @name hitbtc#reduceMargin
|
|
133922
134186
|
* @description remove margin from a position
|
|
134187
|
+
* @see https://api.hitbtc.com/#create-update-margin-account-2
|
|
134188
|
+
* @see https://api.hitbtc.com/#create-update-margin-account
|
|
133923
134189
|
* @param {string} symbol unified market symbol
|
|
133924
134190
|
* @param {float} amount the amount of margin to remove
|
|
133925
134191
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -133937,6 +134203,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133937
134203
|
* @method
|
|
133938
134204
|
* @name hitbtc#addMargin
|
|
133939
134205
|
* @description add margin
|
|
134206
|
+
* @see https://api.hitbtc.com/#create-update-margin-account-2
|
|
134207
|
+
* @see https://api.hitbtc.com/#create-update-margin-account
|
|
133940
134208
|
* @param {string} symbol unified market symbol
|
|
133941
134209
|
* @param {float} amount amount of margin to add
|
|
133942
134210
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -133951,6 +134219,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133951
134219
|
* @method
|
|
133952
134220
|
* @name hitbtc#fetchLeverage
|
|
133953
134221
|
* @description fetch the set leverage for a market
|
|
134222
|
+
* @see https://api.hitbtc.com/#get-futures-margin-account
|
|
134223
|
+
* @see https://api.hitbtc.com/#get-isolated-margin-account
|
|
133954
134224
|
* @param {string} symbol unified market symbol
|
|
133955
134225
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
133956
134226
|
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if this is set
|
|
@@ -133962,16 +134232,27 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133962
134232
|
const request = {
|
|
133963
134233
|
'symbol': market['id'],
|
|
133964
134234
|
};
|
|
133965
|
-
let
|
|
133966
|
-
|
|
133967
|
-
|
|
133968
|
-
|
|
133969
|
-
});
|
|
133970
|
-
const [marginMode, query] = this.handleMarginModeAndParams('modifyMarginHelper', params);
|
|
134235
|
+
let marginMode = undefined;
|
|
134236
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params);
|
|
134237
|
+
params = this.omit(params, ['marginMode', 'margin']);
|
|
134238
|
+
let response = undefined;
|
|
133971
134239
|
if (marginMode !== undefined) {
|
|
133972
|
-
|
|
134240
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134241
|
+
}
|
|
134242
|
+
else {
|
|
134243
|
+
if (market['type'] === 'spot') {
|
|
134244
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134245
|
+
}
|
|
134246
|
+
else if (market['type'] === 'swap') {
|
|
134247
|
+
response = await this.privateGetFuturesAccountIsolatedSymbol(this.extend(request, params));
|
|
134248
|
+
}
|
|
134249
|
+
else if (market['type'] === 'margin') {
|
|
134250
|
+
response = await this.privateGetMarginAccountIsolatedSymbol(this.extend(request, params));
|
|
134251
|
+
}
|
|
134252
|
+
else {
|
|
134253
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverage() not support this market type');
|
|
134254
|
+
}
|
|
133973
134255
|
}
|
|
133974
|
-
const response = await this[method](this.extend(request, query));
|
|
133975
134256
|
//
|
|
133976
134257
|
// {
|
|
133977
134258
|
// "symbol": "BTCUSDT",
|
|
@@ -134009,6 +134290,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
134009
134290
|
* @method
|
|
134010
134291
|
* @name hitbtc#setLeverage
|
|
134011
134292
|
* @description set the level of leverage for a market
|
|
134293
|
+
* @see https://api.hitbtc.com/#create-update-margin-account-2
|
|
134012
134294
|
* @param {float} leverage the rate of leverage
|
|
134013
134295
|
* @param {string} symbol unified market symbol
|
|
134014
134296
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -148396,7 +148678,16 @@ class idex extends _abstract_idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
148396
148678
|
// ]
|
|
148397
148679
|
const method = params['method'];
|
|
148398
148680
|
params = this.omit(params, 'method');
|
|
148399
|
-
|
|
148681
|
+
let response = undefined;
|
|
148682
|
+
if (method === 'privateGetDeposits') {
|
|
148683
|
+
response = await this.privateGetDeposits(this.extend(request, params));
|
|
148684
|
+
}
|
|
148685
|
+
else if (method === 'privateGetWithdrawals') {
|
|
148686
|
+
response = await this.privateGetWithdrawals(this.extend(request, params));
|
|
148687
|
+
}
|
|
148688
|
+
else {
|
|
148689
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTransactionsHelper() not support this method');
|
|
148690
|
+
}
|
|
148400
148691
|
return this.parseTransactions(response, currency, since, limit);
|
|
148401
148692
|
}
|
|
148402
148693
|
parseTransactionStatus(status) {
|
|
@@ -172318,6 +172609,9 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
172318
172609
|
'closeAllPositions': false,
|
|
172319
172610
|
'closePosition': false,
|
|
172320
172611
|
'createDepositAddress': true,
|
|
172612
|
+
'createMarketBuyOrderWithCost': true,
|
|
172613
|
+
'createMarketOrderWithCost': false,
|
|
172614
|
+
'createMarketSellOrderWithCost': false,
|
|
172321
172615
|
'createOrder': true,
|
|
172322
172616
|
'createOrders': true,
|
|
172323
172617
|
'createReduceOnlyOrder': true,
|
|
@@ -174340,11 +174634,33 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
174340
174634
|
}
|
|
174341
174635
|
return this.parseTickers(tickers, symbols);
|
|
174342
174636
|
}
|
|
174637
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
174638
|
+
/**
|
|
174639
|
+
* @method
|
|
174640
|
+
* @name mexc#createMarketBuyOrderWithCost
|
|
174641
|
+
* @description create a market buy order by providing the symbol and cost
|
|
174642
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
|
174643
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
174644
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
174645
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
174646
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
174647
|
+
*/
|
|
174648
|
+
await this.loadMarkets();
|
|
174649
|
+
const market = this.market(symbol);
|
|
174650
|
+
if (!market['spot']) {
|
|
174651
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
174652
|
+
}
|
|
174653
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
174654
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
174655
|
+
}
|
|
174343
174656
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
174344
174657
|
/**
|
|
174345
174658
|
* @method
|
|
174346
174659
|
* @name mexc3#createOrder
|
|
174347
174660
|
* @description create a trade order
|
|
174661
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
|
174662
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
|
|
174663
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
|
|
174348
174664
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
174349
174665
|
* @param {string} type 'market' or 'limit'
|
|
174350
174666
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -174373,13 +174689,16 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
174373
174689
|
'type': type.toUpperCase(),
|
|
174374
174690
|
};
|
|
174375
174691
|
if (orderSide === 'BUY' && type === 'market') {
|
|
174376
|
-
|
|
174377
|
-
|
|
174378
|
-
|
|
174692
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
174693
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
174694
|
+
const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
|
|
174695
|
+
params = this.omit(params, 'cost');
|
|
174696
|
+
if (cost !== undefined) {
|
|
174697
|
+
amount = cost;
|
|
174379
174698
|
}
|
|
174380
|
-
else if (
|
|
174699
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
174381
174700
|
if (price === undefined) {
|
|
174382
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id +
|
|
174701
|
+
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
174702
|
}
|
|
174384
174703
|
else {
|
|
174385
174704
|
const amountString = this.numberToString(amount);
|
|
@@ -185960,6 +186279,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
185960
186279
|
'asset/convert/currencies': 5 / 3,
|
|
185961
186280
|
'asset/convert/currency-pair': 5 / 3,
|
|
185962
186281
|
'asset/convert/history': 5 / 3,
|
|
186282
|
+
'asset/monthly-statement': 2,
|
|
185963
186283
|
// account
|
|
185964
186284
|
'account/balance': 2,
|
|
185965
186285
|
'account/positions': 2,
|
|
@@ -186093,6 +186413,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
186093
186413
|
'asset/convert-dust-assets': 10,
|
|
186094
186414
|
'asset/convert/estimate-quote': 1,
|
|
186095
186415
|
'asset/convert/trade': 1,
|
|
186416
|
+
'asset/monthly-statement': 1,
|
|
186096
186417
|
// account
|
|
186097
186418
|
'account/set-position-mode': 4,
|
|
186098
186419
|
'account/set-leverage': 1,
|
|
@@ -186726,14 +187047,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
186726
187047
|
'commonCurrencies': {
|
|
186727
187048
|
// the exchange refers to ERC20 version of Aeternity (AEToken)
|
|
186728
187049
|
'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
|
|
187050
|
+
'WIN': 'WINTOKEN', // https://github.com/ccxt/ccxt/issues/5701
|
|
186737
187051
|
},
|
|
186738
187052
|
});
|
|
186739
187053
|
}
|
|
@@ -188759,6 +189073,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
188759
189073
|
* @param {string[]} ids order ids
|
|
188760
189074
|
* @param {string} symbol unified market symbol
|
|
188761
189075
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
189076
|
+
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
188762
189077
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
188763
189078
|
*/
|
|
188764
189079
|
// 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 +189088,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
188773
189088
|
let method = this.safeString(params, 'method', defaultMethod);
|
|
188774
189089
|
const clientOrderIds = this.parseIds(this.safeValue2(params, 'clOrdId', 'clientOrderId'));
|
|
188775
189090
|
const algoIds = this.parseIds(this.safeValue(params, 'algoId'));
|
|
188776
|
-
const stop = this.
|
|
189091
|
+
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
188777
189092
|
if (stop) {
|
|
188778
189093
|
method = 'privatePostTradeCancelAlgos';
|
|
188779
189094
|
}
|
|
@@ -206734,18 +207049,26 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206734
207049
|
const url = this.urls['api']['ws']['ws'];
|
|
206735
207050
|
const requestId = this.requestId(url);
|
|
206736
207051
|
const messageHash = requestId.toString();
|
|
207052
|
+
const sor = this.safeValue2(params, 'sor', 'SOR', false);
|
|
207053
|
+
params = this.omit(params, 'sor', 'SOR');
|
|
206737
207054
|
const payload = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
206738
207055
|
let returnRateLimits = false;
|
|
206739
207056
|
[returnRateLimits, params] = this.handleOptionAndParams(params, 'createOrderWs', 'returnRateLimits', false);
|
|
206740
207057
|
payload['returnRateLimits'] = returnRateLimits;
|
|
207058
|
+
const test = this.safeValue(params, 'test', false);
|
|
207059
|
+
params = this.omit(params, 'test');
|
|
206741
207060
|
const message = {
|
|
206742
207061
|
'id': messageHash,
|
|
206743
207062
|
'method': 'order.place',
|
|
206744
207063
|
'params': this.signParams(this.extend(payload, params)),
|
|
206745
207064
|
};
|
|
206746
|
-
const test = this.safeValue(params, 'test', false);
|
|
206747
207065
|
if (test) {
|
|
206748
|
-
|
|
207066
|
+
if (sor) {
|
|
207067
|
+
message['method'] = 'sor.order.test';
|
|
207068
|
+
}
|
|
207069
|
+
else {
|
|
207070
|
+
message['method'] = 'order.test';
|
|
207071
|
+
}
|
|
206749
207072
|
}
|
|
206750
207073
|
const subscription = {
|
|
206751
207074
|
'method': this.handleOrderWs,
|
|
@@ -208072,6 +208395,7 @@ class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
208072
208395
|
'spot': 'wss://stream.binance.us:9443/ws',
|
|
208073
208396
|
},
|
|
208074
208397
|
'web': 'https://www.binance.us',
|
|
208398
|
+
'sapi': 'https://api.binance.us/sapi/v1',
|
|
208075
208399
|
'wapi': 'https://api.binance.us/wapi/v3',
|
|
208076
208400
|
'public': 'https://api.binance.us/api/v1',
|
|
208077
208401
|
'private': 'https://api.binance.us/api/v3',
|
|
@@ -229378,7 +229702,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229378
229702
|
const marketId = market['id'];
|
|
229379
229703
|
const url = this.getUrlByMarket(market);
|
|
229380
229704
|
const messageType = this.getTypeByMarket(market);
|
|
229381
|
-
const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', '
|
|
229705
|
+
const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
|
|
229382
229706
|
const channel = messageType + '.' + topic;
|
|
229383
229707
|
const messageHash = 'ticker:' + symbol;
|
|
229384
229708
|
const payload = [marketId];
|
|
@@ -270112,6 +270436,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
270112
270436
|
/**
|
|
270113
270437
|
* @method
|
|
270114
270438
|
* @name upbit#withdraw
|
|
270439
|
+
* @see https://docs.upbit.com/reference/디지털자산-출금하기
|
|
270115
270440
|
* @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
270441
|
* @description make a withdrawal
|
|
270117
270442
|
* @param {string} code unified currency code
|
|
@@ -270122,14 +270447,14 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
270122
270447
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
270123
270448
|
*/
|
|
270124
270449
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
270125
|
-
this.checkAddress(address);
|
|
270126
270450
|
await this.loadMarkets();
|
|
270127
270451
|
const currency = this.currency(code);
|
|
270128
270452
|
const request = {
|
|
270129
270453
|
'amount': amount,
|
|
270130
270454
|
};
|
|
270131
|
-
let
|
|
270455
|
+
let response = undefined;
|
|
270132
270456
|
if (code !== 'KRW') {
|
|
270457
|
+
this.checkAddress(address);
|
|
270133
270458
|
// 2023-05-23 Change to required parameters for digital assets
|
|
270134
270459
|
const network = this.safeStringUpper2(params, 'network', 'net_type');
|
|
270135
270460
|
if (network === undefined) {
|
|
@@ -270137,18 +270462,17 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
270137
270462
|
}
|
|
270138
270463
|
params = this.omit(params, ['network']);
|
|
270139
270464
|
request['net_type'] = network;
|
|
270140
|
-
method += 'Coin';
|
|
270141
270465
|
request['currency'] = currency['id'];
|
|
270142
270466
|
request['address'] = address;
|
|
270143
270467
|
if (tag !== undefined) {
|
|
270144
270468
|
request['secondary_address'] = tag;
|
|
270145
270469
|
}
|
|
270146
270470
|
params = this.omit(params, 'network');
|
|
270471
|
+
response = await this.privatePostWithdrawsCoin(this.extend(request, params));
|
|
270147
270472
|
}
|
|
270148
270473
|
else {
|
|
270149
|
-
|
|
270474
|
+
response = await this.privatePostWithdrawsKrw(this.extend(request, params));
|
|
270150
270475
|
}
|
|
270151
|
-
const response = await this[method](this.extend(request, params));
|
|
270152
270476
|
//
|
|
270153
270477
|
// {
|
|
270154
270478
|
// "type": "withdraw",
|
|
@@ -288265,7 +288589,7 @@ SOFTWARE.
|
|
|
288265
288589
|
|
|
288266
288590
|
//-----------------------------------------------------------------------------
|
|
288267
288591
|
// this is updated by vss.js when building
|
|
288268
|
-
const version = '4.1.
|
|
288592
|
+
const version = '4.1.78';
|
|
288269
288593
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288270
288594
|
//-----------------------------------------------------------------------------
|
|
288271
288595
|
|