ccxt 4.2.88 → 4.2.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build.sh +2 -2
- package/dist/ccxt.browser.js +1062 -241
- package/dist/ccxt.browser.min.js +6 -4
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +3 -0
- package/dist/cjs/src/base/Exchange.js +53 -7
- package/dist/cjs/src/base/functions/crypto.js +37 -0
- package/dist/cjs/src/base/functions/rsa.js +19 -4
- package/dist/cjs/src/binance.js +92 -9
- package/dist/cjs/src/bingx.js +101 -1
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bitflyer.js +2 -0
- package/dist/cjs/src/bitget.js +9 -1
- package/dist/cjs/src/bitmart.js +2 -0
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bitstamp.js +83 -99
- package/dist/cjs/src/blofin.js +2 -0
- package/dist/cjs/src/bybit.js +63 -0
- package/dist/cjs/src/coinbase.js +48 -24
- package/dist/cjs/src/coinbaseinternational.js +1 -0
- package/dist/cjs/src/coinex.js +102 -8
- package/dist/cjs/src/coinsph.js +2 -0
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/digifinex.js +3 -0
- package/dist/cjs/src/exmo.js +1 -0
- package/dist/cjs/src/gate.js +4 -0
- package/dist/cjs/src/gemini.js +10 -9
- package/dist/cjs/src/hitbtc.js +3 -0
- package/dist/cjs/src/htx.js +3 -0
- package/dist/cjs/src/hyperliquid.js +1 -0
- package/dist/cjs/src/kucoin.js +40 -15
- package/dist/cjs/src/kucoinfutures.js +34 -3
- package/dist/cjs/src/latoken.js +4 -0
- package/dist/cjs/src/lbank.js +3 -1
- package/dist/cjs/src/luno.js +2 -0
- package/dist/cjs/src/mexc.js +55 -6
- package/dist/cjs/src/okx.js +159 -8
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/pro/bitget.js +2 -0
- package/dist/cjs/src/static_dependencies/noble-curves/p256.js +48 -0
- package/dist/cjs/src/timex.js +2 -0
- package/dist/cjs/src/woo.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/ascendex.js +3 -0
- package/js/src/base/Exchange.d.ts +13 -8
- package/js/src/base/Exchange.js +53 -7
- package/js/src/base/functions/crypto.js +37 -0
- package/js/src/base/functions/rsa.d.ts +1 -1
- package/js/src/base/functions/rsa.js +21 -5
- package/js/src/base/types.d.ts +35 -1
- package/js/src/bigone.d.ts +2 -2
- package/js/src/binance.d.ts +6 -15
- package/js/src/binance.js +92 -9
- package/js/src/bingx.d.ts +3 -2
- package/js/src/bingx.js +101 -1
- package/js/src/bit2c.d.ts +2 -2
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitfinex.d.ts +2 -2
- package/js/src/bitfinex2.d.ts +3 -3
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bitflyer.d.ts +2 -7
- package/js/src/bitflyer.js +2 -0
- package/js/src/bitget.d.ts +6 -9
- package/js/src/bitget.js +9 -1
- package/js/src/bitmart.d.ts +4 -14
- package/js/src/bitmart.js +2 -0
- package/js/src/bitmex.d.ts +2 -2
- package/js/src/bitmex.js +1 -0
- package/js/src/bitopro.d.ts +3 -3
- package/js/src/bitrue.d.ts +2 -2
- package/js/src/bitrue.js +1 -0
- package/js/src/bitso.d.ts +2 -2
- package/js/src/bitstamp.d.ts +7 -19
- package/js/src/bitstamp.js +83 -99
- package/js/src/bitteam.d.ts +2 -2
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/bl3p.d.ts +2 -2
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blofin.d.ts +2 -7
- package/js/src/blofin.js +2 -0
- package/js/src/bybit.d.ts +7 -15
- package/js/src/bybit.js +63 -0
- package/js/src/cex.d.ts +3 -3
- package/js/src/coinbase.d.ts +2 -2
- package/js/src/coinbase.js +48 -24
- package/js/src/coinbaseinternational.d.ts +2 -2
- package/js/src/coinbaseinternational.js +1 -0
- package/js/src/coinbasepro.d.ts +3 -3
- package/js/src/coincheck.d.ts +2 -2
- package/js/src/coinex.d.ts +7 -19
- package/js/src/coinex.js +102 -8
- package/js/src/coinlist.d.ts +3 -3
- package/js/src/coinmate.d.ts +2 -9
- package/js/src/coinmetro.d.ts +2 -2
- package/js/src/coinone.d.ts +2 -2
- package/js/src/coinsph.d.ts +4 -14
- package/js/src/coinsph.js +2 -0
- package/js/src/cryptocom.js +1 -0
- package/js/src/currencycom.d.ts +3 -3
- package/js/src/delta.d.ts +2 -2
- package/js/src/delta.js +1 -0
- package/js/src/deribit.d.ts +3 -3
- package/js/src/digifinex.d.ts +4 -14
- package/js/src/digifinex.js +3 -0
- package/js/src/exmo.d.ts +3 -3
- package/js/src/exmo.js +1 -0
- package/js/src/gate.d.ts +6 -9
- package/js/src/gate.js +4 -0
- package/js/src/gemini.d.ts +3 -3
- package/js/src/gemini.js +10 -9
- package/js/src/hitbtc.d.ts +5 -15
- package/js/src/hitbtc.js +3 -0
- package/js/src/hollaex.d.ts +3 -3
- package/js/src/htx.d.ts +4 -14
- package/js/src/htx.js +3 -0
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/hyperliquid.d.ts +2 -2
- package/js/src/hyperliquid.js +1 -0
- package/js/src/idex.d.ts +3 -3
- package/js/src/independentreserve.d.ts +2 -2
- package/js/src/kraken.d.ts +3 -10
- package/js/src/kucoin.d.ts +3 -10
- package/js/src/kucoin.js +40 -15
- package/js/src/kucoinfutures.d.ts +2 -9
- package/js/src/kucoinfutures.js +34 -3
- package/js/src/kuna.d.ts +2 -2
- package/js/src/latoken.d.ts +7 -8
- package/js/src/latoken.js +4 -0
- package/js/src/lbank.d.ts +4 -9
- package/js/src/lbank.js +3 -1
- package/js/src/luno.d.ts +2 -7
- package/js/src/luno.js +2 -0
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mexc.d.ts +3 -3
- package/js/src/mexc.js +55 -6
- package/js/src/ndax.d.ts +2 -2
- package/js/src/oceanex.d.ts +2 -2
- package/js/src/okcoin.d.ts +2 -2
- package/js/src/okx.d.ts +5 -14
- package/js/src/okx.js +159 -8
- package/js/src/onetrading.d.ts +3 -3
- package/js/src/phemex.d.ts +2 -2
- package/js/src/phemex.js +1 -0
- package/js/src/poloniex.d.ts +3 -3
- package/js/src/pro/bitget.js +2 -0
- package/js/src/pro/bitvavo.d.ts +2 -2
- package/js/src/probit.d.ts +2 -2
- package/js/src/timex.d.ts +4 -14
- package/js/src/timex.js +2 -0
- package/js/src/upbit.d.ts +2 -9
- package/js/src/wazirx.d.ts +2 -2
- package/js/src/whitebit.d.ts +3 -3
- package/js/src/woo.d.ts +3 -3
- package/js/src/woo.js +1 -0
- package/js/src/yobit.d.ts +2 -2
- package/package.json +1 -1
- package/skip-tests.json +6 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -5171,6 +5171,8 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
5171
5171
|
'symbol': symbol,
|
|
5172
5172
|
'maker': this.safeNumber(takerMaker, 'maker'),
|
|
5173
5173
|
'taker': this.safeNumber(takerMaker, 'taker'),
|
|
5174
|
+
'percentage': undefined,
|
|
5175
|
+
'tierBased': undefined,
|
|
5174
5176
|
};
|
|
5175
5177
|
}
|
|
5176
5178
|
return result;
|
|
@@ -6574,6 +6576,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
6574
6576
|
'info': data,
|
|
6575
6577
|
'symbol': market['symbol'],
|
|
6576
6578
|
'type': undefined,
|
|
6579
|
+
'marginMode': 'isolated',
|
|
6577
6580
|
'amount': undefined,
|
|
6578
6581
|
'total': undefined,
|
|
6579
6582
|
'code': market['quote'],
|
|
@@ -7226,14 +7229,15 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
7226
7229
|
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(927);
|
|
7227
7230
|
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2116);
|
|
7228
7231
|
/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
|
|
7229
|
-
/* harmony import */ var
|
|
7232
|
+
/* harmony import */ var _Precise_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(2194);
|
|
7230
7233
|
/* harmony import */ var _ws_WsClient_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7517);
|
|
7231
7234
|
/* harmony import */ var _ws_Future_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2367);
|
|
7232
7235
|
/* harmony import */ var _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7091);
|
|
7233
7236
|
/* harmony import */ var _functions_crypto_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6890);
|
|
7234
|
-
/* harmony import */ var
|
|
7237
|
+
/* harmony import */ var _functions_totp_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(2523);
|
|
7235
7238
|
/* harmony import */ var _static_dependencies_ethers_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7090);
|
|
7236
7239
|
/* harmony import */ var _static_dependencies_ethers_hash_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7843);
|
|
7240
|
+
/* harmony import */ var _static_dependencies_jsencrypt_lib_jsbn_rng_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(2491);
|
|
7237
7241
|
// ----------------------------------------------------------------------------
|
|
7238
7242
|
/* eslint-disable */
|
|
7239
7243
|
|
|
@@ -7252,6 +7256,7 @@ const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sor
|
|
|
7252
7256
|
|
|
7253
7257
|
|
|
7254
7258
|
|
|
7259
|
+
|
|
7255
7260
|
// ----------------------------------------------------------------------------
|
|
7256
7261
|
/**
|
|
7257
7262
|
* @class Exchange
|
|
@@ -7317,7 +7322,7 @@ class Exchange {
|
|
|
7317
7322
|
this.markets_by_id = undefined;
|
|
7318
7323
|
this.symbols = undefined;
|
|
7319
7324
|
this.ids = undefined;
|
|
7320
|
-
this.currencies =
|
|
7325
|
+
this.currencies = {};
|
|
7321
7326
|
this.baseCurrencies = undefined;
|
|
7322
7327
|
this.quoteCurrencies = undefined;
|
|
7323
7328
|
this.currencies_by_id = undefined;
|
|
@@ -7655,6 +7660,7 @@ class Exchange {
|
|
|
7655
7660
|
'fetchIndexOHLCV': undefined,
|
|
7656
7661
|
'fetchIsolatedBorrowRate': undefined,
|
|
7657
7662
|
'fetchIsolatedBorrowRates': undefined,
|
|
7663
|
+
'fetchMarginAdjustmentHistory': undefined,
|
|
7658
7664
|
'fetchIsolatedPositions': undefined,
|
|
7659
7665
|
'fetchL2OrderBook': true,
|
|
7660
7666
|
'fetchL3OrderBook': undefined,
|
|
@@ -8661,6 +8667,13 @@ class Exchange {
|
|
|
8661
8667
|
createSafeDictionary() {
|
|
8662
8668
|
return {};
|
|
8663
8669
|
}
|
|
8670
|
+
randomBytes(length) {
|
|
8671
|
+
const rng = new _static_dependencies_jsencrypt_lib_jsbn_rng_js__WEBPACK_IMPORTED_MODULE_10__/* .SecureRandom */ .C();
|
|
8672
|
+
const x = [];
|
|
8673
|
+
x.length = length;
|
|
8674
|
+
rng.nextBytes(x);
|
|
8675
|
+
return Buffer.from(x).toString('hex');
|
|
8676
|
+
}
|
|
8664
8677
|
/* eslint-enable */
|
|
8665
8678
|
// ------------------------------------------------------------------------
|
|
8666
8679
|
// ########################################################################
|
|
@@ -9267,6 +9280,20 @@ class Exchange {
|
|
|
9267
9280
|
async setMargin(symbol, amount, params = {}) {
|
|
9268
9281
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' setMargin() is not supported yet');
|
|
9269
9282
|
}
|
|
9283
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
9284
|
+
/**
|
|
9285
|
+
* @method
|
|
9286
|
+
* @name exchange#fetchMarginAdjustmentHistory
|
|
9287
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
9288
|
+
* @param {string} [symbol] unified market symbol
|
|
9289
|
+
* @param {string} [type] "add" or "reduce"
|
|
9290
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
9291
|
+
* @param {int} [limit] the maximum amount of changes to fetch
|
|
9292
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
9293
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9294
|
+
*/
|
|
9295
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMarginAdjustmentHistory() is not supported yet');
|
|
9296
|
+
}
|
|
9270
9297
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
9271
9298
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' setMarginMode() is not supported yet');
|
|
9272
9299
|
}
|
|
@@ -9334,18 +9361,18 @@ class Exchange {
|
|
|
9334
9361
|
const amount = this.safeString(entry, 'amount');
|
|
9335
9362
|
if (amount !== undefined) {
|
|
9336
9363
|
if (before === undefined && after !== undefined) {
|
|
9337
|
-
before =
|
|
9364
|
+
before = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(after, amount);
|
|
9338
9365
|
}
|
|
9339
9366
|
else if (before !== undefined && after === undefined) {
|
|
9340
|
-
after =
|
|
9367
|
+
after = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(before, amount);
|
|
9341
9368
|
}
|
|
9342
9369
|
}
|
|
9343
9370
|
if (before !== undefined && after !== undefined) {
|
|
9344
9371
|
if (direction === undefined) {
|
|
9345
|
-
if (
|
|
9372
|
+
if (_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringGt(before, after)) {
|
|
9346
9373
|
direction = 'out';
|
|
9347
9374
|
}
|
|
9348
|
-
if (
|
|
9375
|
+
if (_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringGt(after, before)) {
|
|
9349
9376
|
direction = 'in';
|
|
9350
9377
|
}
|
|
9351
9378
|
}
|
|
@@ -9597,13 +9624,13 @@ class Exchange {
|
|
|
9597
9624
|
let used = this.safeString(balance[code], 'used');
|
|
9598
9625
|
const debt = this.safeString(balance[code], 'debt');
|
|
9599
9626
|
if ((total === undefined) && (free !== undefined) && (used !== undefined)) {
|
|
9600
|
-
total =
|
|
9627
|
+
total = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(free, used);
|
|
9601
9628
|
}
|
|
9602
9629
|
if ((free === undefined) && (total !== undefined) && (used !== undefined)) {
|
|
9603
|
-
free =
|
|
9630
|
+
free = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(total, used);
|
|
9604
9631
|
}
|
|
9605
9632
|
if ((used === undefined) && (total !== undefined) && (free !== undefined)) {
|
|
9606
|
-
used =
|
|
9633
|
+
used = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(total, free);
|
|
9607
9634
|
}
|
|
9608
9635
|
balance[code]['free'] = this.parseNumber(free);
|
|
9609
9636
|
balance[code]['used'] = this.parseNumber(used);
|
|
@@ -9691,11 +9718,11 @@ class Exchange {
|
|
|
9691
9718
|
const trade = trades[i];
|
|
9692
9719
|
const tradeAmount = this.safeString(trade, 'amount');
|
|
9693
9720
|
if (parseFilled && (tradeAmount !== undefined)) {
|
|
9694
|
-
filled =
|
|
9721
|
+
filled = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(filled, tradeAmount);
|
|
9695
9722
|
}
|
|
9696
9723
|
const tradeCost = this.safeString(trade, 'cost');
|
|
9697
9724
|
if (parseCost && (tradeCost !== undefined)) {
|
|
9698
|
-
cost =
|
|
9725
|
+
cost = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(cost, tradeCost);
|
|
9699
9726
|
}
|
|
9700
9727
|
if (parseSymbol) {
|
|
9701
9728
|
symbol = this.safeString(trade, 'symbol');
|
|
@@ -9756,7 +9783,7 @@ class Exchange {
|
|
|
9756
9783
|
if (amount === undefined) {
|
|
9757
9784
|
// ensure amount = filled + remaining
|
|
9758
9785
|
if (filled !== undefined && remaining !== undefined) {
|
|
9759
|
-
amount =
|
|
9786
|
+
amount = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(filled, remaining);
|
|
9760
9787
|
}
|
|
9761
9788
|
else if (status === 'closed') {
|
|
9762
9789
|
amount = filled;
|
|
@@ -9764,7 +9791,7 @@ class Exchange {
|
|
|
9764
9791
|
}
|
|
9765
9792
|
if (filled === undefined) {
|
|
9766
9793
|
if (amount !== undefined && remaining !== undefined) {
|
|
9767
|
-
filled =
|
|
9794
|
+
filled = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(amount, remaining);
|
|
9768
9795
|
}
|
|
9769
9796
|
else if (status === 'closed' && amount !== undefined) {
|
|
9770
9797
|
filled = amount;
|
|
@@ -9772,7 +9799,7 @@ class Exchange {
|
|
|
9772
9799
|
}
|
|
9773
9800
|
if (remaining === undefined) {
|
|
9774
9801
|
if (amount !== undefined && filled !== undefined) {
|
|
9775
|
-
remaining =
|
|
9802
|
+
remaining = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(amount, filled);
|
|
9776
9803
|
}
|
|
9777
9804
|
else if (status === 'closed') {
|
|
9778
9805
|
remaining = '0';
|
|
@@ -9787,13 +9814,13 @@ class Exchange {
|
|
|
9787
9814
|
// linear
|
|
9788
9815
|
// price = cost / (filled * contract size)
|
|
9789
9816
|
if (average === undefined) {
|
|
9790
|
-
if ((filled !== undefined) && (cost !== undefined) &&
|
|
9791
|
-
const filledTimesContractSize =
|
|
9817
|
+
if ((filled !== undefined) && (cost !== undefined) && _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringGt(filled, '0')) {
|
|
9818
|
+
const filledTimesContractSize = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(filled, contractSize);
|
|
9792
9819
|
if (inverse) {
|
|
9793
|
-
average =
|
|
9820
|
+
average = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(filledTimesContractSize, cost);
|
|
9794
9821
|
}
|
|
9795
9822
|
else {
|
|
9796
|
-
average =
|
|
9823
|
+
average = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(cost, filledTimesContractSize);
|
|
9797
9824
|
}
|
|
9798
9825
|
}
|
|
9799
9826
|
}
|
|
@@ -9813,17 +9840,17 @@ class Exchange {
|
|
|
9813
9840
|
multiplyPrice = average;
|
|
9814
9841
|
}
|
|
9815
9842
|
// contract trading
|
|
9816
|
-
const filledTimesContractSize =
|
|
9843
|
+
const filledTimesContractSize = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(filled, contractSize);
|
|
9817
9844
|
if (inverse) {
|
|
9818
|
-
cost =
|
|
9845
|
+
cost = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(filledTimesContractSize, multiplyPrice);
|
|
9819
9846
|
}
|
|
9820
9847
|
else {
|
|
9821
|
-
cost =
|
|
9848
|
+
cost = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(filledTimesContractSize, multiplyPrice);
|
|
9822
9849
|
}
|
|
9823
9850
|
}
|
|
9824
9851
|
// support for market orders
|
|
9825
9852
|
const orderType = this.safeValue(order, 'type');
|
|
9826
|
-
const emptyPrice = (price === undefined) ||
|
|
9853
|
+
const emptyPrice = (price === undefined) || _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringEquals(price, '0');
|
|
9827
9854
|
if (emptyPrice && (orderType === 'market')) {
|
|
9828
9855
|
price = average;
|
|
9829
9856
|
}
|
|
@@ -9974,7 +10001,7 @@ class Exchange {
|
|
|
9974
10001
|
let key = undefined;
|
|
9975
10002
|
if (useQuote) {
|
|
9976
10003
|
const priceString = this.numberToString(price);
|
|
9977
|
-
cost =
|
|
10004
|
+
cost = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(cost, priceString);
|
|
9978
10005
|
key = 'quote';
|
|
9979
10006
|
}
|
|
9980
10007
|
else {
|
|
@@ -9989,7 +10016,7 @@ class Exchange {
|
|
|
9989
10016
|
takerOrMaker = 'taker';
|
|
9990
10017
|
}
|
|
9991
10018
|
const rate = this.safeString(market, takerOrMaker);
|
|
9992
|
-
cost =
|
|
10019
|
+
cost = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(cost, rate);
|
|
9993
10020
|
return {
|
|
9994
10021
|
'type': takerOrMaker,
|
|
9995
10022
|
'currency': market[key],
|
|
@@ -10004,10 +10031,10 @@ class Exchange {
|
|
|
10004
10031
|
let baseValue = this.safeString(liquidation, 'baseValue');
|
|
10005
10032
|
let quoteValue = this.safeString(liquidation, 'quoteValue');
|
|
10006
10033
|
if ((baseValue === undefined) && (contracts !== undefined) && (contractSize !== undefined) && (price !== undefined)) {
|
|
10007
|
-
baseValue =
|
|
10034
|
+
baseValue = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(contracts, contractSize);
|
|
10008
10035
|
}
|
|
10009
10036
|
if ((quoteValue === undefined) && (baseValue !== undefined) && (price !== undefined)) {
|
|
10010
|
-
quoteValue =
|
|
10037
|
+
quoteValue = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(baseValue, price);
|
|
10011
10038
|
}
|
|
10012
10039
|
liquidation['contracts'] = this.parseNumber(contracts);
|
|
10013
10040
|
liquidation['contractSize'] = this.parseNumber(contractSize);
|
|
@@ -10027,11 +10054,11 @@ class Exchange {
|
|
|
10027
10054
|
if (contractSize !== undefined) {
|
|
10028
10055
|
const inverse = this.safeBool(market, 'inverse', false);
|
|
10029
10056
|
if (inverse) {
|
|
10030
|
-
multiplyPrice =
|
|
10057
|
+
multiplyPrice = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv('1', price);
|
|
10031
10058
|
}
|
|
10032
|
-
multiplyPrice =
|
|
10059
|
+
multiplyPrice = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(multiplyPrice, contractSize);
|
|
10033
10060
|
}
|
|
10034
|
-
cost =
|
|
10061
|
+
cost = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(multiplyPrice, amount);
|
|
10035
10062
|
}
|
|
10036
10063
|
const parseFee = this.safeValue(trade, 'fee') === undefined;
|
|
10037
10064
|
const parseFees = this.safeValue(trade, 'fees') === undefined;
|
|
@@ -10141,7 +10168,7 @@ class Exchange {
|
|
|
10141
10168
|
if (feeCurrencyCode !== undefined) {
|
|
10142
10169
|
const rate = this.safeString(fee, 'rate');
|
|
10143
10170
|
const cost = this.safeValue(fee, 'cost');
|
|
10144
|
-
if (
|
|
10171
|
+
if (_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringEq(cost, '0')) {
|
|
10145
10172
|
// omit zero cost fees
|
|
10146
10173
|
continue;
|
|
10147
10174
|
}
|
|
@@ -10150,7 +10177,7 @@ class Exchange {
|
|
|
10150
10177
|
}
|
|
10151
10178
|
const rateKey = (rate === undefined) ? '' : rate;
|
|
10152
10179
|
if (rateKey in reduced[feeCurrencyCode]) {
|
|
10153
|
-
reduced[feeCurrencyCode][rateKey]['cost'] =
|
|
10180
|
+
reduced[feeCurrencyCode][rateKey]['cost'] = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(reduced[feeCurrencyCode][rateKey]['cost'], cost);
|
|
10154
10181
|
}
|
|
10155
10182
|
else {
|
|
10156
10183
|
reduced[feeCurrencyCode][rateKey] = {
|
|
@@ -10182,7 +10209,7 @@ class Exchange {
|
|
|
10182
10209
|
const baseVolume = this.safeString(ticker, 'baseVolume');
|
|
10183
10210
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
10184
10211
|
if (vwap === undefined) {
|
|
10185
|
-
vwap =
|
|
10212
|
+
vwap = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(this.omitZero(quoteVolume), baseVolume);
|
|
10186
10213
|
}
|
|
10187
10214
|
if ((last !== undefined) && (close === undefined)) {
|
|
10188
10215
|
close = last;
|
|
@@ -10192,20 +10219,20 @@ class Exchange {
|
|
|
10192
10219
|
}
|
|
10193
10220
|
if ((last !== undefined) && (open !== undefined)) {
|
|
10194
10221
|
if (change === undefined) {
|
|
10195
|
-
change =
|
|
10222
|
+
change = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(last, open);
|
|
10196
10223
|
}
|
|
10197
10224
|
if (average === undefined) {
|
|
10198
|
-
average =
|
|
10225
|
+
average = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAdd(last, open), '2');
|
|
10199
10226
|
}
|
|
10200
10227
|
}
|
|
10201
|
-
if ((percentage === undefined) && (change !== undefined) && (open !== undefined) &&
|
|
10202
|
-
percentage =
|
|
10228
|
+
if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringGt(open, '0')) {
|
|
10229
|
+
percentage = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(change, open), '100');
|
|
10203
10230
|
}
|
|
10204
10231
|
if ((change === undefined) && (percentage !== undefined) && (open !== undefined)) {
|
|
10205
|
-
change =
|
|
10232
|
+
change = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(percentage, open), '100');
|
|
10206
10233
|
}
|
|
10207
10234
|
if ((open === undefined) && (last !== undefined) && (change !== undefined)) {
|
|
10208
|
-
open =
|
|
10235
|
+
open = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringSub(last, change);
|
|
10209
10236
|
}
|
|
10210
10237
|
// timestamp and symbol operations don't belong in safeTicker
|
|
10211
10238
|
// they should be done in the derived classes
|
|
@@ -10675,7 +10702,7 @@ class Exchange {
|
|
|
10675
10702
|
const percentage = this.safeValue(position, 'percentage');
|
|
10676
10703
|
if ((percentage === undefined) && (unrealizedPnlString !== undefined) && (initialMarginString !== undefined)) {
|
|
10677
10704
|
// as it was done in all implementations ( aax, btcex, bybit, deribit, ftx, gate, kucoinfutures, phemex )
|
|
10678
|
-
const percentageString =
|
|
10705
|
+
const percentageString = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringMul(_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringDiv(unrealizedPnlString, initialMarginString, 4), '100');
|
|
10679
10706
|
position['percentage'] = this.parseNumber(percentageString);
|
|
10680
10707
|
}
|
|
10681
10708
|
// if contractSize is undefined get from market
|
|
@@ -11004,11 +11031,11 @@ class Exchange {
|
|
|
11004
11031
|
if (currencyId !== undefined) {
|
|
11005
11032
|
code = this.commonCurrencyCode(currencyId.toUpperCase());
|
|
11006
11033
|
}
|
|
11007
|
-
return {
|
|
11034
|
+
return this.safeCurrencyStructure({
|
|
11008
11035
|
'id': currencyId,
|
|
11009
11036
|
'code': code,
|
|
11010
11037
|
'precision': undefined,
|
|
11011
|
-
};
|
|
11038
|
+
});
|
|
11012
11039
|
}
|
|
11013
11040
|
safeMarket(marketId, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
11014
11041
|
const result = this.safeMarketStructure({
|
|
@@ -11083,7 +11110,7 @@ class Exchange {
|
|
|
11083
11110
|
}
|
|
11084
11111
|
oath() {
|
|
11085
11112
|
if (this.twofa !== undefined) {
|
|
11086
|
-
return (0,
|
|
11113
|
+
return (0,_functions_totp_js__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z)(this.twofa);
|
|
11087
11114
|
}
|
|
11088
11115
|
else {
|
|
11089
11116
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' exchange.twofa has not been set for 2FA Two-Factor Authentication');
|
|
@@ -11777,11 +11804,18 @@ class Exchange {
|
|
|
11777
11804
|
'total': undefined,
|
|
11778
11805
|
};
|
|
11779
11806
|
}
|
|
11780
|
-
commonCurrencyCode(
|
|
11807
|
+
commonCurrencyCode(code) {
|
|
11781
11808
|
if (!this.substituteCommonCurrencyCodes) {
|
|
11782
|
-
return
|
|
11809
|
+
return code;
|
|
11810
|
+
}
|
|
11811
|
+
// if the provided code already exists as a value in commonCurrencies dict, then we should not again transform it
|
|
11812
|
+
// more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
|
|
11813
|
+
const commonCurrencies = Object.values(this.commonCurrencies);
|
|
11814
|
+
const exists = this.inArray(code, commonCurrencies);
|
|
11815
|
+
if (exists) {
|
|
11816
|
+
return code;
|
|
11783
11817
|
}
|
|
11784
|
-
return this.safeString(this.commonCurrencies,
|
|
11818
|
+
return this.safeString(this.commonCurrencies, code, code);
|
|
11785
11819
|
}
|
|
11786
11820
|
currency(code) {
|
|
11787
11821
|
if (this.currencies === undefined) {
|
|
@@ -11947,11 +11981,11 @@ class Exchange {
|
|
|
11947
11981
|
if (precision === undefined) {
|
|
11948
11982
|
return undefined;
|
|
11949
11983
|
}
|
|
11950
|
-
if (
|
|
11984
|
+
if (_Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringGe(precision, '0')) {
|
|
11951
11985
|
return this.parsePrecision(precision);
|
|
11952
11986
|
}
|
|
11953
11987
|
else {
|
|
11954
|
-
const positivePrecisionString =
|
|
11988
|
+
const positivePrecisionString = _Precise_js__WEBPACK_IMPORTED_MODULE_11__/* .Precise */ .O.stringAbs(precision);
|
|
11955
11989
|
const positivePrecision = parseInt(positivePrecisionString);
|
|
11956
11990
|
let parsedPrecision = '1';
|
|
11957
11991
|
for (let i = 0; i < positivePrecision - 1; i++) {
|
|
@@ -12244,7 +12278,8 @@ class Exchange {
|
|
|
12244
12278
|
if (!this.has['fetchTradingFees']) {
|
|
12245
12279
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
|
|
12246
12280
|
}
|
|
12247
|
-
|
|
12281
|
+
const fees = await this.fetchTradingFees(params);
|
|
12282
|
+
return this.safeDict(fees, symbol);
|
|
12248
12283
|
}
|
|
12249
12284
|
parseOpenInterest(interest, market = undefined) {
|
|
12250
12285
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
|
|
@@ -13022,6 +13057,21 @@ class Exchange {
|
|
|
13022
13057
|
const reconstructedDate = day + month + year;
|
|
13023
13058
|
return reconstructedDate;
|
|
13024
13059
|
}
|
|
13060
|
+
parseMarginModification(data, market = undefined) {
|
|
13061
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseMarginModification() is not supported yet');
|
|
13062
|
+
}
|
|
13063
|
+
parseMarginModifications(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
|
|
13064
|
+
const marginModifications = [];
|
|
13065
|
+
for (let i = 0; i < response.length; i++) {
|
|
13066
|
+
const info = response[i];
|
|
13067
|
+
const marketId = this.safeString(info, symbolKey);
|
|
13068
|
+
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
13069
|
+
if ((symbols === undefined) || this.inArray(market['symbol'], symbols)) {
|
|
13070
|
+
marginModifications.push(this.parseMarginModification(info, market));
|
|
13071
|
+
}
|
|
13072
|
+
}
|
|
13073
|
+
return marginModifications;
|
|
13074
|
+
}
|
|
13025
13075
|
}
|
|
13026
13076
|
|
|
13027
13077
|
|
|
@@ -13785,19 +13835,29 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13785
13835
|
/* harmony export */ kn: () => (/* binding */ crc32),
|
|
13786
13836
|
/* harmony export */ vp: () => (/* binding */ hash)
|
|
13787
13837
|
/* harmony export */ });
|
|
13788
|
-
/* harmony import */ var
|
|
13838
|
+
/* harmony import */ var _static_dependencies_noble_hashes_hmac_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(138);
|
|
13789
13839
|
/* harmony import */ var _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9651);
|
|
13790
|
-
/* harmony import */ var
|
|
13840
|
+
/* harmony import */ var _static_dependencies_jsencrypt_lib_asn1js_base64_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9285);
|
|
13841
|
+
/* harmony import */ var _static_dependencies_jsencrypt_lib_asn1js_asn1_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1728);
|
|
13842
|
+
/* harmony import */ var _static_dependencies_noble_curves_secp256k1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1339);
|
|
13843
|
+
/* harmony import */ var _static_dependencies_noble_curves_p256_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2572);
|
|
13791
13844
|
/* ------------------------------------------------------------------------ */
|
|
13792
13845
|
|
|
13793
13846
|
|
|
13794
13847
|
|
|
13848
|
+
|
|
13849
|
+
|
|
13850
|
+
|
|
13795
13851
|
/* ------------------------------------------------------------------------ */
|
|
13796
13852
|
const encoders = {
|
|
13797
13853
|
binary: x => x,
|
|
13798
13854
|
hex: _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_0__/* .base16 */ .YU.encode,
|
|
13799
13855
|
base64: _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_0__/* .base64 */ .US.encode,
|
|
13800
13856
|
};
|
|
13857
|
+
const supportedCurve = {
|
|
13858
|
+
'1.3.132.0.10': _static_dependencies_noble_curves_secp256k1_js__WEBPACK_IMPORTED_MODULE_1__/* .secp256k1 */ .kA,
|
|
13859
|
+
'1.2.840.10045.3.1.7': _static_dependencies_noble_curves_p256_js__WEBPACK_IMPORTED_MODULE_2__/* .P256 */ .lA,
|
|
13860
|
+
};
|
|
13801
13861
|
/* ............................................. */
|
|
13802
13862
|
const hash = (request, hash, digest = 'hex') => {
|
|
13803
13863
|
const binary = hash(request);
|
|
@@ -13805,7 +13865,7 @@ const hash = (request, hash, digest = 'hex') => {
|
|
|
13805
13865
|
};
|
|
13806
13866
|
/* ............................................. */
|
|
13807
13867
|
const hmac = (request, secret, hash, digest = 'hex') => {
|
|
13808
|
-
const binary = (0,
|
|
13868
|
+
const binary = (0,_static_dependencies_noble_hashes_hmac_js__WEBPACK_IMPORTED_MODULE_3__/* .hmac */ .b)(hash, secret, request);
|
|
13809
13869
|
return encoders[digest](binary);
|
|
13810
13870
|
};
|
|
13811
13871
|
/* ............................................. */
|
|
@@ -13813,6 +13873,36 @@ function ecdsa(request, secret, curve, prehash = null) {
|
|
|
13813
13873
|
if (prehash) {
|
|
13814
13874
|
request = hash(request, prehash, 'hex');
|
|
13815
13875
|
}
|
|
13876
|
+
if (typeof secret === 'string' && secret.length > 64) {
|
|
13877
|
+
// decode pem key
|
|
13878
|
+
if (secret.startsWith('-----BEGIN EC PRIVATE KEY-----')) {
|
|
13879
|
+
const der = _static_dependencies_jsencrypt_lib_asn1js_base64_js__WEBPACK_IMPORTED_MODULE_4__/* .Base64 */ .D.unarmor(secret);
|
|
13880
|
+
let asn1 = _static_dependencies_jsencrypt_lib_asn1js_asn1_js__WEBPACK_IMPORTED_MODULE_5__/* .ASN1 */ .lj.decode(der);
|
|
13881
|
+
if (asn1.sub.length === 4) {
|
|
13882
|
+
// ECPrivateKey ::= SEQUENCE {
|
|
13883
|
+
// version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
|
|
13884
|
+
// privateKey OCTET STRING,
|
|
13885
|
+
// parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
|
|
13886
|
+
// publicKey [1] BIT STRING OPTIONAL
|
|
13887
|
+
// }
|
|
13888
|
+
if (typeof asn1.sub[2].sub !== null && asn1.sub[2].sub.length > 0) {
|
|
13889
|
+
const oid = asn1.sub[2].sub[0].content(undefined);
|
|
13890
|
+
if (supportedCurve[oid] === undefined)
|
|
13891
|
+
throw new Error('Unsupported curve');
|
|
13892
|
+
curve = supportedCurve[oid];
|
|
13893
|
+
}
|
|
13894
|
+
secret = asn1.sub[1].getHexStringValue();
|
|
13895
|
+
}
|
|
13896
|
+
else {
|
|
13897
|
+
// maybe return false
|
|
13898
|
+
throw new Error('Unsupported key format');
|
|
13899
|
+
}
|
|
13900
|
+
}
|
|
13901
|
+
else {
|
|
13902
|
+
// maybe return false
|
|
13903
|
+
throw new Error('Unsupported key format');
|
|
13904
|
+
}
|
|
13905
|
+
}
|
|
13816
13906
|
const signature = curve.sign(request, secret);
|
|
13817
13907
|
return {
|
|
13818
13908
|
'r': signature.r.toString(16),
|
|
@@ -13828,7 +13918,7 @@ function axolotl(request, secret, curve) {
|
|
|
13828
13918
|
function eddsa(request, secret, curve) {
|
|
13829
13919
|
// secret is the base64 pem encoded key
|
|
13830
13920
|
// we get the last 32 bytes
|
|
13831
|
-
const privateKey = new Uint8Array(
|
|
13921
|
+
const privateKey = new Uint8Array(_static_dependencies_jsencrypt_lib_asn1js_base64_js__WEBPACK_IMPORTED_MODULE_4__/* .Base64 */ .D.unarmor(secret).slice(16));
|
|
13832
13922
|
const signature = curve.sign(request, privateKey);
|
|
13833
13923
|
return _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_0__/* .base64 */ .US.encode(signature);
|
|
13834
13924
|
}
|
|
@@ -14568,6 +14658,9 @@ const isNode = !(isBrowser || isWebWorker);
|
|
|
14568
14658
|
/* harmony import */ var _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9651);
|
|
14569
14659
|
/* harmony import */ var _encode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1237);
|
|
14570
14660
|
/* harmony import */ var _crypto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6890);
|
|
14661
|
+
/* harmony import */ var _static_dependencies_noble_curves_p256_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2572);
|
|
14662
|
+
|
|
14663
|
+
|
|
14571
14664
|
|
|
14572
14665
|
|
|
14573
14666
|
|
|
@@ -14579,9 +14672,17 @@ function rsa(request, secret, hash) {
|
|
|
14579
14672
|
const name = (hash.create()).constructor.name.toLowerCase();
|
|
14580
14673
|
return RSA.sign(request, digester, name);
|
|
14581
14674
|
}
|
|
14582
|
-
function jwt(request, secret, hash, isRSA = false) {
|
|
14583
|
-
|
|
14584
|
-
|
|
14675
|
+
function jwt(request, secret, hash, isRSA = false, opts = {}) {
|
|
14676
|
+
let alg = (isRSA ? 'RS' : 'HS') + (hash.outputLen * 8);
|
|
14677
|
+
if (opts['alg']) {
|
|
14678
|
+
alg = opts['alg'].toUpperCase();
|
|
14679
|
+
}
|
|
14680
|
+
const header = Object.assign({ 'alg': alg, 'typ': 'JWT' }, opts);
|
|
14681
|
+
if (header['iat'] !== undefined) {
|
|
14682
|
+
request['iat'] = header['iat'];
|
|
14683
|
+
delete header['iat'];
|
|
14684
|
+
}
|
|
14685
|
+
const encodedHeader = (0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .urlencodeBase64 */ .xr)((0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .stringToBase64 */ .Ne)(JSON.stringify(header)));
|
|
14585
14686
|
const encodedData = (0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .urlencodeBase64 */ .xr)((0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .stringToBase64 */ .Ne)(JSON.stringify(request)));
|
|
14586
14687
|
const token = [encodedHeader, encodedData].join('.');
|
|
14587
14688
|
const algoType = alg.slice(0, 2);
|
|
@@ -14589,9 +14690,15 @@ function jwt(request, secret, hash, isRSA = false) {
|
|
|
14589
14690
|
if (algoType === 'HS') {
|
|
14590
14691
|
signature = (0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .urlencodeBase64 */ .xr)((0,_crypto_js__WEBPACK_IMPORTED_MODULE_3__/* .hmac */ .bD)(token, secret, hash, 'base64'));
|
|
14591
14692
|
}
|
|
14592
|
-
else if (algoType === 'RS') {
|
|
14693
|
+
else if (isRSA || algoType === 'RS') {
|
|
14593
14694
|
signature = (0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .urlencodeBase64 */ .xr)(rsa(token, _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode(secret), hash));
|
|
14594
14695
|
}
|
|
14696
|
+
else if (algoType === 'ES') {
|
|
14697
|
+
const signedHash = (0,_crypto_js__WEBPACK_IMPORTED_MODULE_3__/* .ecdsa */ .bu)(token, _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode(secret), _static_dependencies_noble_curves_p256_js__WEBPACK_IMPORTED_MODULE_4__/* .P256 */ .lA, hash);
|
|
14698
|
+
const r = (signedHash.r.length === 64) ? signedHash.r : '0' + signedHash.r;
|
|
14699
|
+
const s = (signedHash.s.length === 64) ? signedHash.s : '0' + signedHash.s;
|
|
14700
|
+
signature = (0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .urlencodeBase64 */ .xr)((0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .binaryToBase64 */ .bA)((0,_encode_js__WEBPACK_IMPORTED_MODULE_2__/* .base16ToBinary */ .aj)(r + s)));
|
|
14701
|
+
}
|
|
14595
14702
|
return [token, signature].join('.');
|
|
14596
14703
|
}
|
|
14597
14704
|
|
|
@@ -18642,6 +18749,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18642
18749
|
'fetchLeverages': true,
|
|
18643
18750
|
'fetchLeverageTiers': true,
|
|
18644
18751
|
'fetchLiquidations': false,
|
|
18752
|
+
'fetchMarginAdjustmentHistory': true,
|
|
18645
18753
|
'fetchMarginMode': 'emulated',
|
|
18646
18754
|
'fetchMarginModes': true,
|
|
18647
18755
|
'fetchMarketLeverageTiers': 'emulated',
|
|
@@ -27197,6 +27305,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
27197
27305
|
'symbol': symbol,
|
|
27198
27306
|
'maker': this.safeNumber2(fee, 'makerCommission', 'makerCommissionRate'),
|
|
27199
27307
|
'taker': this.safeNumber2(fee, 'takerCommission', 'takerCommissionRate'),
|
|
27308
|
+
'percentage': undefined,
|
|
27309
|
+
'tierBased': undefined,
|
|
27200
27310
|
};
|
|
27201
27311
|
}
|
|
27202
27312
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -29770,21 +29880,37 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
29770
29880
|
// "type": 1
|
|
29771
29881
|
// }
|
|
29772
29882
|
//
|
|
29883
|
+
// fetchMarginAdjustmentHistory
|
|
29884
|
+
//
|
|
29885
|
+
// {
|
|
29886
|
+
// symbol: "XRPUSDT",
|
|
29887
|
+
// type: "1",
|
|
29888
|
+
// deltaType: "TRADE",
|
|
29889
|
+
// amount: "2.57148240",
|
|
29890
|
+
// asset: "USDT",
|
|
29891
|
+
// time: "1711046271555",
|
|
29892
|
+
// positionSide: "BOTH",
|
|
29893
|
+
// clientTranId: ""
|
|
29894
|
+
// }
|
|
29895
|
+
//
|
|
29773
29896
|
const rawType = this.safeInteger(data, 'type');
|
|
29774
|
-
const resultType = (rawType === 1) ? 'add' : 'reduce';
|
|
29775
|
-
const resultAmount = this.safeNumber(data, 'amount');
|
|
29776
29897
|
const errorCode = this.safeString(data, 'code');
|
|
29777
|
-
const
|
|
29898
|
+
const marketId = this.safeString(data, 'symbol');
|
|
29899
|
+
const timestamp = this.safeInteger(data, 'time');
|
|
29900
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
29901
|
+
const noErrorCode = errorCode === undefined;
|
|
29902
|
+
const success = errorCode === '200';
|
|
29778
29903
|
return {
|
|
29779
29904
|
'info': data,
|
|
29780
29905
|
'symbol': market['symbol'],
|
|
29781
|
-
'type':
|
|
29782
|
-
'
|
|
29906
|
+
'type': (rawType === 1) ? 'add' : 'reduce',
|
|
29907
|
+
'marginMode': 'isolated',
|
|
29908
|
+
'amount': this.safeNumber(data, 'amount'),
|
|
29909
|
+
'code': this.safeString(data, 'asset'),
|
|
29783
29910
|
'total': undefined,
|
|
29784
|
-
'
|
|
29785
|
-
'
|
|
29786
|
-
'
|
|
29787
|
-
'datetime': undefined,
|
|
29911
|
+
'status': (success || noErrorCode) ? 'ok' : 'failed',
|
|
29912
|
+
'timestamp': timestamp,
|
|
29913
|
+
'datetime': this.iso8601(timestamp),
|
|
29788
29914
|
};
|
|
29789
29915
|
}
|
|
29790
29916
|
async reduceMargin(symbol, amount, params = {}) {
|
|
@@ -31047,6 +31173,70 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
31047
31173
|
'quoteVolume': undefined,
|
|
31048
31174
|
};
|
|
31049
31175
|
}
|
|
31176
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
31177
|
+
/**
|
|
31178
|
+
* @method
|
|
31179
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
31180
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#get-position-margin-change-history-trade
|
|
31181
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#get-position-margin-change-history-trade
|
|
31182
|
+
* @param {string} symbol unified market symbol
|
|
31183
|
+
* @param {string} [type] "add" or "reduce"
|
|
31184
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
31185
|
+
* @param {int} [limit] the maximum amount of changes to fetch
|
|
31186
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
31187
|
+
* @param {int} [params.until] timestamp in ms of the latest change to fetch
|
|
31188
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
31189
|
+
*/
|
|
31190
|
+
await this.loadMarkets();
|
|
31191
|
+
if (symbol === undefined) {
|
|
31192
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory () requires a symbol argument');
|
|
31193
|
+
}
|
|
31194
|
+
const market = this.market(symbol);
|
|
31195
|
+
const until = this.safeInteger(params, 'until');
|
|
31196
|
+
params = this.omit(params, 'until');
|
|
31197
|
+
const request = {
|
|
31198
|
+
'symbol': market['id'],
|
|
31199
|
+
};
|
|
31200
|
+
if (type !== undefined) {
|
|
31201
|
+
request['type'] = (type === 'add') ? 1 : 2;
|
|
31202
|
+
}
|
|
31203
|
+
if (since !== undefined) {
|
|
31204
|
+
request['startTime'] = since;
|
|
31205
|
+
}
|
|
31206
|
+
if (limit !== undefined) {
|
|
31207
|
+
request['limit'] = limit;
|
|
31208
|
+
}
|
|
31209
|
+
if (until !== undefined) {
|
|
31210
|
+
request['endTime'] = until;
|
|
31211
|
+
}
|
|
31212
|
+
let response = undefined;
|
|
31213
|
+
if (market['linear']) {
|
|
31214
|
+
response = await this.fapiPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
31215
|
+
}
|
|
31216
|
+
else if (market['inverse']) {
|
|
31217
|
+
response = await this.dapiPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
31218
|
+
}
|
|
31219
|
+
else {
|
|
31220
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + 'fetchMarginAdjustmentHistory () is not supported for markets of type ' + market['type']);
|
|
31221
|
+
}
|
|
31222
|
+
//
|
|
31223
|
+
// [
|
|
31224
|
+
// {
|
|
31225
|
+
// symbol: "XRPUSDT",
|
|
31226
|
+
// type: "1",
|
|
31227
|
+
// deltaType: "TRADE",
|
|
31228
|
+
// amount: "2.57148240",
|
|
31229
|
+
// asset: "USDT",
|
|
31230
|
+
// time: "1711046271555",
|
|
31231
|
+
// positionSide: "BOTH",
|
|
31232
|
+
// clientTranId: ""
|
|
31233
|
+
// }
|
|
31234
|
+
// ...
|
|
31235
|
+
// ]
|
|
31236
|
+
//
|
|
31237
|
+
const modifications = this.parseMarginModifications(response);
|
|
31238
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
31239
|
+
}
|
|
31050
31240
|
}
|
|
31051
31241
|
|
|
31052
31242
|
|
|
@@ -31455,6 +31645,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31455
31645
|
'fetchFundingRates': true,
|
|
31456
31646
|
'fetchLeverage': true,
|
|
31457
31647
|
'fetchLiquidations': false,
|
|
31648
|
+
'fetchMarginAdjustmentHistory': false,
|
|
31458
31649
|
'fetchMarginMode': true,
|
|
31459
31650
|
'fetchMarkets': true,
|
|
31460
31651
|
'fetchMarkOHLCV': true,
|
|
@@ -31464,6 +31655,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31464
31655
|
'fetchOpenOrders': true,
|
|
31465
31656
|
'fetchOrder': true,
|
|
31466
31657
|
'fetchOrderBook': true,
|
|
31658
|
+
'fetchOrders': true,
|
|
31467
31659
|
'fetchPositionMode': true,
|
|
31468
31660
|
'fetchPositions': true,
|
|
31469
31661
|
'fetchTicker': true,
|
|
@@ -31575,6 +31767,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31575
31767
|
'positionSide/dual': 1,
|
|
31576
31768
|
'market/markPriceKlines': 1,
|
|
31577
31769
|
'trade/batchCancelReplace': 1,
|
|
31770
|
+
'trade/fullOrder': 1,
|
|
31578
31771
|
},
|
|
31579
31772
|
'post': {
|
|
31580
31773
|
'trade/cancelReplace': 1,
|
|
@@ -31722,6 +31915,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
31722
31915
|
'post': {
|
|
31723
31916
|
'swap/trace/closeTrackOrder': 1,
|
|
31724
31917
|
'swap/trace/setTPSL': 1,
|
|
31918
|
+
'spot/trader/sellOrder': 1,
|
|
31725
31919
|
},
|
|
31726
31920
|
},
|
|
31727
31921
|
},
|
|
@@ -34152,7 +34346,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34152
34346
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
34153
34347
|
*/
|
|
34154
34348
|
if (symbol === undefined) {
|
|
34155
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + '
|
|
34349
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
34156
34350
|
}
|
|
34157
34351
|
await this.loadMarkets();
|
|
34158
34352
|
const market = this.market(symbol);
|
|
@@ -34223,6 +34417,101 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34223
34417
|
const first = this.safeDict(data, 'order', data);
|
|
34224
34418
|
return this.parseOrder(first, market);
|
|
34225
34419
|
}
|
|
34420
|
+
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
34421
|
+
/**
|
|
34422
|
+
* @method
|
|
34423
|
+
* @name bingx#fetchOrders
|
|
34424
|
+
* @description fetches information on multiple orders made by the user
|
|
34425
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#User's%20All%20Orders
|
|
34426
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
34427
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
34428
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
34429
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
34430
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
34431
|
+
* @param {int} [params.orderId] Only return subsequent orders, and return the latest order by default
|
|
34432
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
34433
|
+
*/
|
|
34434
|
+
await this.loadMarkets();
|
|
34435
|
+
const request = {};
|
|
34436
|
+
let market = undefined;
|
|
34437
|
+
if (symbol !== undefined) {
|
|
34438
|
+
market = this.market(symbol);
|
|
34439
|
+
request['symbol'] = market['id'];
|
|
34440
|
+
}
|
|
34441
|
+
let type = undefined;
|
|
34442
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOrders', market, params);
|
|
34443
|
+
if (type !== 'swap') {
|
|
34444
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrders() is only supported for swap markets');
|
|
34445
|
+
}
|
|
34446
|
+
if (limit !== undefined) {
|
|
34447
|
+
request['limit'] = limit;
|
|
34448
|
+
}
|
|
34449
|
+
if (since !== undefined) {
|
|
34450
|
+
request['startTime'] = since;
|
|
34451
|
+
}
|
|
34452
|
+
const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
|
|
34453
|
+
const endTime = this.safeInteger(params, 'endTime', until); // exchange-specific in milliseconds
|
|
34454
|
+
params = this.omit(params, ['endTime', 'till', 'until']);
|
|
34455
|
+
if (endTime !== undefined) {
|
|
34456
|
+
request['endTime'] = endTime;
|
|
34457
|
+
}
|
|
34458
|
+
const response = await this.swapV1PrivateGetTradeFullOrder(this.extend(request, params));
|
|
34459
|
+
//
|
|
34460
|
+
// {
|
|
34461
|
+
// "code": 0,
|
|
34462
|
+
// "msg": "",
|
|
34463
|
+
// "data": {
|
|
34464
|
+
// "orders": [
|
|
34465
|
+
// {
|
|
34466
|
+
// "symbol": "PYTH-USDT",
|
|
34467
|
+
// "orderId": 1736007506620112100,
|
|
34468
|
+
// "side": "SELL",
|
|
34469
|
+
// "positionSide": "SHORT",
|
|
34470
|
+
// "type": "LIMIT",
|
|
34471
|
+
// "origQty": "33",
|
|
34472
|
+
// "price": "0.3916",
|
|
34473
|
+
// "executedQty": "33",
|
|
34474
|
+
// "avgPrice": "0.3916",
|
|
34475
|
+
// "cumQuote": "13",
|
|
34476
|
+
// "stopPrice": "",
|
|
34477
|
+
// "profit": "0.0000",
|
|
34478
|
+
// "commission": "-0.002585",
|
|
34479
|
+
// "status": "FILLED",
|
|
34480
|
+
// "time": 1702731418000,
|
|
34481
|
+
// "updateTime": 1702731470000,
|
|
34482
|
+
// "clientOrderId": "",
|
|
34483
|
+
// "leverage": "15X",
|
|
34484
|
+
// "takeProfit": {
|
|
34485
|
+
// "type": "TAKE_PROFIT",
|
|
34486
|
+
// "quantity": 0,
|
|
34487
|
+
// "stopPrice": 0,
|
|
34488
|
+
// "price": 0,
|
|
34489
|
+
// "workingType": ""
|
|
34490
|
+
// },
|
|
34491
|
+
// "stopLoss": {
|
|
34492
|
+
// "type": "STOP",
|
|
34493
|
+
// "quantity": 0,
|
|
34494
|
+
// "stopPrice": 0,
|
|
34495
|
+
// "price": 0,
|
|
34496
|
+
// "workingType": ""
|
|
34497
|
+
// },
|
|
34498
|
+
// "advanceAttr": 0,
|
|
34499
|
+
// "positionID": 0,
|
|
34500
|
+
// "takeProfitEntrustPrice": 0,
|
|
34501
|
+
// "stopLossEntrustPrice": 0,
|
|
34502
|
+
// "orderType": "",
|
|
34503
|
+
// "workingType": "MARK_PRICE",
|
|
34504
|
+
// "stopGuaranteed": false,
|
|
34505
|
+
// "triggerOrderId": 1736012449498123500
|
|
34506
|
+
// }
|
|
34507
|
+
// ]
|
|
34508
|
+
// }
|
|
34509
|
+
// }
|
|
34510
|
+
//
|
|
34511
|
+
const data = this.safeDict(response, 'data', {});
|
|
34512
|
+
const orders = this.safeList(data, 'orders', []);
|
|
34513
|
+
return this.parseOrders(orders, market, since, limit);
|
|
34514
|
+
}
|
|
34226
34515
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
34227
34516
|
/**
|
|
34228
34517
|
* @method
|
|
@@ -34923,6 +35212,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34923
35212
|
'info': data,
|
|
34924
35213
|
'symbol': this.safeString(market, 'symbol'),
|
|
34925
35214
|
'type': (type === '1') ? 'add' : 'reduce',
|
|
35215
|
+
'marginMode': 'isolated',
|
|
34926
35216
|
'amount': this.safeNumber(data, 'amount'),
|
|
34927
35217
|
'total': this.safeNumber(data, 'margin'),
|
|
34928
35218
|
'code': this.safeString(market, 'settle'),
|
|
@@ -44232,6 +44522,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
44232
44522
|
'info': data,
|
|
44233
44523
|
'symbol': market['symbol'],
|
|
44234
44524
|
'type': undefined,
|
|
44525
|
+
'marginMode': 'isolated',
|
|
44235
44526
|
'amount': undefined,
|
|
44236
44527
|
'total': undefined,
|
|
44237
44528
|
'code': undefined,
|
|
@@ -44988,6 +45279,8 @@ class bitflyer extends _abstract_bitflyer_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
44988
45279
|
'symbol': market['symbol'],
|
|
44989
45280
|
'maker': fee,
|
|
44990
45281
|
'taker': fee,
|
|
45282
|
+
'percentage': undefined,
|
|
45283
|
+
'tierBased': undefined,
|
|
44991
45284
|
};
|
|
44992
45285
|
}
|
|
44993
45286
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -45607,6 +45900,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45607
45900
|
'fetchLeverage': true,
|
|
45608
45901
|
'fetchLeverageTiers': false,
|
|
45609
45902
|
'fetchLiquidations': false,
|
|
45903
|
+
'fetchMarginAdjustmentHistory': false,
|
|
45610
45904
|
'fetchMarginMode': true,
|
|
45611
45905
|
'fetchMarketLeverageTiers': true,
|
|
45612
45906
|
'fetchMarkets': true,
|
|
@@ -48147,7 +48441,11 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48147
48441
|
//
|
|
48148
48442
|
const marketId = this.safeString(ticker, 'symbol');
|
|
48149
48443
|
const close = this.safeString(ticker, 'lastPr');
|
|
48150
|
-
const
|
|
48444
|
+
const timestampString = this.omitZero(this.safeString(ticker, 'ts')); // exchange sometimes provided 0
|
|
48445
|
+
let timestamp = undefined;
|
|
48446
|
+
if (timestampString !== undefined) {
|
|
48447
|
+
timestamp = this.parseToInt(timestampString);
|
|
48448
|
+
}
|
|
48151
48449
|
const change = this.safeString(ticker, 'change24h');
|
|
48152
48450
|
const open24 = this.safeString(ticker, 'open24');
|
|
48153
48451
|
const open = this.safeString(ticker, 'open');
|
|
@@ -48800,6 +49098,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48800
49098
|
'symbol': this.safeSymbol(marketId, market),
|
|
48801
49099
|
'maker': this.safeNumber(data, 'makerFeeRate'),
|
|
48802
49100
|
'taker': this.safeNumber(data, 'takerFeeRate'),
|
|
49101
|
+
'percentage': undefined,
|
|
49102
|
+
'tierBased': undefined,
|
|
48803
49103
|
};
|
|
48804
49104
|
}
|
|
48805
49105
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -52501,6 +52801,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
52501
52801
|
'info': data,
|
|
52502
52802
|
'symbol': market['symbol'],
|
|
52503
52803
|
'type': undefined,
|
|
52804
|
+
'marginMode': 'isolated',
|
|
52504
52805
|
'amount': undefined,
|
|
52505
52806
|
'total': undefined,
|
|
52506
52807
|
'code': market['settle'],
|
|
@@ -57281,6 +57582,8 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
57281
57582
|
'symbol': symbol,
|
|
57282
57583
|
'maker': this.safeNumber(fee, 'maker_fee_rate'),
|
|
57283
57584
|
'taker': this.safeNumber(fee, 'taker_fee_rate'),
|
|
57585
|
+
'percentage': undefined,
|
|
57586
|
+
'tierBased': undefined,
|
|
57284
57587
|
};
|
|
57285
57588
|
}
|
|
57286
57589
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -59758,6 +60061,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59758
60061
|
'fetchLeverages': true,
|
|
59759
60062
|
'fetchLeverageTiers': false,
|
|
59760
60063
|
'fetchLiquidations': true,
|
|
60064
|
+
'fetchMarginAdjustmentHistory': false,
|
|
59761
60065
|
'fetchMarketLeverageTiers': false,
|
|
59762
60066
|
'fetchMarkets': true,
|
|
59763
60067
|
'fetchMarkOHLCV': false,
|
|
@@ -67444,6 +67748,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
67444
67748
|
'info': data,
|
|
67445
67749
|
'symbol': market['symbol'],
|
|
67446
67750
|
'type': undefined,
|
|
67751
|
+
'marginMode': 'isolated',
|
|
67447
67752
|
'amount': undefined,
|
|
67448
67753
|
'total': undefined,
|
|
67449
67754
|
'code': undefined,
|
|
@@ -69872,6 +70177,30 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
69872
70177
|
'commonCurrencies': {
|
|
69873
70178
|
'UST': 'USTC',
|
|
69874
70179
|
},
|
|
70180
|
+
// exchange-specific options
|
|
70181
|
+
'options': {
|
|
70182
|
+
'networksById': {
|
|
70183
|
+
'bitcoin-cash': 'BCH',
|
|
70184
|
+
'bitcoin': 'BTC',
|
|
70185
|
+
'ethereum': 'ERC20',
|
|
70186
|
+
'litecoin': 'LTC',
|
|
70187
|
+
'stellar': 'XLM',
|
|
70188
|
+
'xrpl': 'XRP',
|
|
70189
|
+
'tron': 'TRC20',
|
|
70190
|
+
'algorand': 'ALGO',
|
|
70191
|
+
'flare': 'FLR',
|
|
70192
|
+
'hedera': 'HBAR',
|
|
70193
|
+
'cardana': 'ADA',
|
|
70194
|
+
'songbird': 'FLR',
|
|
70195
|
+
'avalanche-c-chain': 'AVAX',
|
|
70196
|
+
'solana': 'SOL',
|
|
70197
|
+
'polkadot': 'DOT',
|
|
70198
|
+
'near': 'NEAR',
|
|
70199
|
+
'doge': 'DOGE',
|
|
70200
|
+
'sui': 'SUI',
|
|
70201
|
+
'casper': 'CSRP',
|
|
70202
|
+
},
|
|
70203
|
+
},
|
|
69875
70204
|
'exceptions': {
|
|
69876
70205
|
'exact': {
|
|
69877
70206
|
'No permission found': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.PermissionDenied,
|
|
@@ -70644,6 +70973,8 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
70644
70973
|
'symbol': this.safeSymbol(marketId, market),
|
|
70645
70974
|
'maker': this.safeNumber(fees, 'maker'),
|
|
70646
70975
|
'taker': this.safeNumber(fees, 'taker'),
|
|
70976
|
+
'percentage': undefined,
|
|
70977
|
+
'tierBased': undefined,
|
|
70647
70978
|
};
|
|
70648
70979
|
}
|
|
70649
70980
|
parseTradingFees(fees) {
|
|
@@ -70689,60 +71020,41 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
70689
71020
|
* @name bitstamp#fetchTransactionFees
|
|
70690
71021
|
* @deprecated
|
|
70691
71022
|
* @description please use fetchDepositWithdrawFees instead
|
|
70692
|
-
* @see https://www.bitstamp.net/api/#
|
|
71023
|
+
* @see https://www.bitstamp.net/api/#tag/Fees
|
|
70693
71024
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
70694
71025
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70695
71026
|
* @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
70696
71027
|
*/
|
|
70697
71028
|
await this.loadMarkets();
|
|
70698
|
-
const
|
|
70699
|
-
return this.parseTransactionFees(balance);
|
|
70700
|
-
}
|
|
70701
|
-
parseTransactionFees(response, codes = undefined) {
|
|
71029
|
+
const response = await this.privatePostFeesWithdrawal(params);
|
|
70702
71030
|
//
|
|
70703
|
-
//
|
|
70704
|
-
//
|
|
70705
|
-
//
|
|
70706
|
-
//
|
|
70707
|
-
//
|
|
70708
|
-
//
|
|
70709
|
-
//
|
|
70710
|
-
//
|
|
70711
|
-
// "zrx_balance": "0.00000000",
|
|
70712
|
-
// "zrx_reserved": "0.00000000",
|
|
70713
|
-
// "zrx_withdrawal_fee": "12.00000000",
|
|
70714
|
-
// "zrxeur_fee": "0.000",
|
|
70715
|
-
// "zrxusd_fee": "0.000",
|
|
70716
|
-
// ...
|
|
70717
|
-
// }
|
|
71031
|
+
// [
|
|
71032
|
+
// {
|
|
71033
|
+
// "currency": "btc",
|
|
71034
|
+
// "fee": "0.00015000",
|
|
71035
|
+
// "network": "bitcoin"
|
|
71036
|
+
// }
|
|
71037
|
+
// ...
|
|
71038
|
+
// ]
|
|
70718
71039
|
//
|
|
70719
|
-
|
|
70720
|
-
|
|
70721
|
-
|
|
71040
|
+
return this.parseTransactionFees(response);
|
|
71041
|
+
}
|
|
71042
|
+
parseTransactionFees(response, codes = undefined) {
|
|
70722
71043
|
const result = {};
|
|
70723
|
-
|
|
70724
|
-
const ids = Object.keys(
|
|
71044
|
+
const currencies = this.indexBy(response, 'currency');
|
|
71045
|
+
const ids = Object.keys(currencies);
|
|
70725
71046
|
for (let i = 0; i < ids.length; i++) {
|
|
70726
71047
|
const id = ids[i];
|
|
70727
|
-
const
|
|
70728
|
-
const code = this.safeCurrencyCode(
|
|
70729
|
-
if (codes !== undefined && !this.inArray(code, codes)) {
|
|
71048
|
+
const fees = this.safeValue(response, i, {});
|
|
71049
|
+
const code = this.safeCurrencyCode(id);
|
|
71050
|
+
if ((codes !== undefined) && !this.inArray(code, codes)) {
|
|
70730
71051
|
continue;
|
|
70731
71052
|
}
|
|
70732
|
-
|
|
70733
|
-
|
|
70734
|
-
|
|
70735
|
-
|
|
70736
|
-
|
|
70737
|
-
'info': {},
|
|
70738
|
-
};
|
|
70739
|
-
}
|
|
70740
|
-
if (currencyId === mainCurrencyId) {
|
|
70741
|
-
result[code]['info'][id] = this.safeNumber(response, id);
|
|
70742
|
-
}
|
|
70743
|
-
if (id.indexOf('_withdrawal_fee') >= 0) {
|
|
70744
|
-
result[code]['withdraw'] = this.safeNumber(response, id);
|
|
70745
|
-
}
|
|
71053
|
+
result[code] = {
|
|
71054
|
+
'withdraw_fee': this.safeNumber(fees, 'fee'),
|
|
71055
|
+
'deposit': {},
|
|
71056
|
+
'info': this.safeDict(currencies, id),
|
|
71057
|
+
};
|
|
70746
71058
|
}
|
|
70747
71059
|
return result;
|
|
70748
71060
|
}
|
|
@@ -70757,64 +71069,41 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
70757
71069
|
* @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
70758
71070
|
*/
|
|
70759
71071
|
await this.loadMarkets();
|
|
70760
|
-
const response = await this.
|
|
71072
|
+
const response = await this.privatePostFeesWithdrawal(params);
|
|
70761
71073
|
//
|
|
70762
|
-
//
|
|
70763
|
-
//
|
|
70764
|
-
//
|
|
70765
|
-
//
|
|
70766
|
-
//
|
|
70767
|
-
//
|
|
70768
|
-
//
|
|
70769
|
-
//
|
|
70770
|
-
// "zrx_balance": "0.00000000",
|
|
70771
|
-
// "zrx_reserved": "0.00000000",
|
|
70772
|
-
// "zrx_withdrawal_fee": "12.00000000",
|
|
70773
|
-
// "zrxeur_fee": "0.000",
|
|
70774
|
-
// "zrxusd_fee": "0.000",
|
|
70775
|
-
// ...
|
|
70776
|
-
// }
|
|
71074
|
+
// [
|
|
71075
|
+
// {
|
|
71076
|
+
// "currency": "btc",
|
|
71077
|
+
// "fee": "0.00015000",
|
|
71078
|
+
// "network": "bitcoin"
|
|
71079
|
+
// }
|
|
71080
|
+
// ...
|
|
71081
|
+
// ]
|
|
70777
71082
|
//
|
|
70778
|
-
|
|
71083
|
+
const responseByCurrencyId = this.groupBy(response, 'currency');
|
|
71084
|
+
return this.parseDepositWithdrawFees(responseByCurrencyId, codes);
|
|
70779
71085
|
}
|
|
70780
|
-
|
|
70781
|
-
|
|
70782
|
-
|
|
70783
|
-
|
|
70784
|
-
|
|
70785
|
-
|
|
70786
|
-
|
|
70787
|
-
|
|
70788
|
-
|
|
70789
|
-
|
|
70790
|
-
|
|
70791
|
-
|
|
70792
|
-
|
|
70793
|
-
|
|
70794
|
-
|
|
70795
|
-
|
|
70796
|
-
|
|
70797
|
-
|
|
70798
|
-
|
|
70799
|
-
|
|
70800
|
-
|
|
70801
|
-
const id = ids[i];
|
|
70802
|
-
const currencyId = id.split('_')[0];
|
|
70803
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
70804
|
-
const dictValue = this.safeNumber(response, id);
|
|
70805
|
-
if (codes !== undefined && !this.inArray(code, codes)) {
|
|
70806
|
-
continue;
|
|
70807
|
-
}
|
|
70808
|
-
if (id.indexOf('_available') >= 0) {
|
|
70809
|
-
result[code] = this.depositWithdrawFee({});
|
|
70810
|
-
}
|
|
70811
|
-
if (id.indexOf('_withdrawal_fee') >= 0) {
|
|
70812
|
-
result[code]['withdraw']['fee'] = dictValue;
|
|
70813
|
-
}
|
|
70814
|
-
const resultValue = this.safeValue(result, code);
|
|
70815
|
-
if (resultValue !== undefined) {
|
|
70816
|
-
result[code]['info'][id] = dictValue;
|
|
70817
|
-
}
|
|
71086
|
+
parseDepositWithdrawFee(fee, currency = undefined) {
|
|
71087
|
+
const result = this.depositWithdrawFee(fee);
|
|
71088
|
+
for (let j = 0; j < fee.length; j++) {
|
|
71089
|
+
const networkEntry = fee[j];
|
|
71090
|
+
const networkId = this.safeString(networkEntry, 'network');
|
|
71091
|
+
const networkCode = this.networkIdToCode(networkId);
|
|
71092
|
+
const withdrawFee = this.safeNumber(networkEntry, 'fee');
|
|
71093
|
+
result['withdraw'] = {
|
|
71094
|
+
'fee': withdrawFee,
|
|
71095
|
+
'percentage': undefined,
|
|
71096
|
+
};
|
|
71097
|
+
result['networks'][networkCode] = {
|
|
71098
|
+
'withdraw': {
|
|
71099
|
+
'fee': withdrawFee,
|
|
71100
|
+
'percentage': undefined,
|
|
71101
|
+
},
|
|
71102
|
+
'deposit': {
|
|
71103
|
+
'fee': undefined,
|
|
71104
|
+
'percentage': undefined,
|
|
71105
|
+
},
|
|
71106
|
+
};
|
|
70818
71107
|
}
|
|
70819
71108
|
return result;
|
|
70820
71109
|
}
|
|
@@ -78810,6 +79099,8 @@ class blofin extends _abstract_blofin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
78810
79099
|
// blofin returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped
|
|
78811
79100
|
'maker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'maker', 'makerU'))),
|
|
78812
79101
|
'taker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'taker', 'takerU'))),
|
|
79102
|
+
'percentage': undefined,
|
|
79103
|
+
'tierBased': undefined,
|
|
78813
79104
|
};
|
|
78814
79105
|
}
|
|
78815
79106
|
async fetchBalance(params = {}) {
|
|
@@ -83966,6 +84257,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
83966
84257
|
'fetchLedger': true,
|
|
83967
84258
|
'fetchLeverage': true,
|
|
83968
84259
|
'fetchLeverageTiers': true,
|
|
84260
|
+
'fetchMarginAdjustmentHistory': false,
|
|
83969
84261
|
'fetchMarketLeverageTiers': true,
|
|
83970
84262
|
'fetchMarkets': true,
|
|
83971
84263
|
'fetchMarkOHLCV': true,
|
|
@@ -84036,6 +84328,13 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84036
84328
|
'public': 'https://api.{hostname}',
|
|
84037
84329
|
'private': 'https://api.{hostname}',
|
|
84038
84330
|
},
|
|
84331
|
+
'demotrading': {
|
|
84332
|
+
'spot': 'https://api-demo.{hostname}',
|
|
84333
|
+
'futures': 'https://api-demo.{hostname}',
|
|
84334
|
+
'v2': 'https://api-demo.{hostname}',
|
|
84335
|
+
'public': 'https://api-demo.{hostname}',
|
|
84336
|
+
'private': 'https://api-demo.{hostname}',
|
|
84337
|
+
},
|
|
84039
84338
|
'www': 'https://www.bybit.com',
|
|
84040
84339
|
'doc': [
|
|
84041
84340
|
'https://bybit-exchange.github.io/docs/inverse/',
|
|
@@ -84224,6 +84523,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84224
84523
|
'v5/user/get-member-type': 5,
|
|
84225
84524
|
'v5/user/aff-customer-info': 5,
|
|
84226
84525
|
'v5/user/del-submember': 5,
|
|
84526
|
+
'v5/user/submembers': 5,
|
|
84227
84527
|
// spot leverage token
|
|
84228
84528
|
'v5/spot-lever-token/order-record': 1,
|
|
84229
84529
|
// spot margin trade
|
|
@@ -84384,6 +84684,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84384
84684
|
'v5/lending/redeem-cancel': 5,
|
|
84385
84685
|
'v5/account/set-collateral-switch': 5,
|
|
84386
84686
|
'v5/account/set-collateral-switch-batch': 5,
|
|
84687
|
+
// demo trading
|
|
84688
|
+
'v5/account/demo-apply-money': 5,
|
|
84387
84689
|
},
|
|
84388
84690
|
},
|
|
84389
84691
|
},
|
|
@@ -84850,6 +85152,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84850
85152
|
},
|
|
84851
85153
|
'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_2__/* .TICK_SIZE */ .sh,
|
|
84852
85154
|
'options': {
|
|
85155
|
+
'sandboxMode': false,
|
|
85156
|
+
'enableDemoTrading': false,
|
|
84853
85157
|
'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
|
|
84854
85158
|
'createOrder': {
|
|
84855
85159
|
'method': 'privatePostV5OrderCreate', // 'privatePostV5PositionTradingStop'
|
|
@@ -84933,6 +85237,39 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84933
85237
|
},
|
|
84934
85238
|
});
|
|
84935
85239
|
}
|
|
85240
|
+
setSandboxMode(enable) {
|
|
85241
|
+
/**
|
|
85242
|
+
* @method
|
|
85243
|
+
* @name bybit#setSandboxMode
|
|
85244
|
+
* @description enables or disables sandbox mode
|
|
85245
|
+
* @param {boolean} [enable] true if demo trading should be enabled, false otherwise
|
|
85246
|
+
*/
|
|
85247
|
+
super.setSandboxMode(enable);
|
|
85248
|
+
this.options['sandboxMode'] = enable;
|
|
85249
|
+
}
|
|
85250
|
+
enableDemoTrading(enable) {
|
|
85251
|
+
/**
|
|
85252
|
+
* @method
|
|
85253
|
+
* @name bybit#enableDemoTrading
|
|
85254
|
+
* @description enables or disables demo trading mode
|
|
85255
|
+
* @see https://bybit-exchange.github.io/docs/v5/demo
|
|
85256
|
+
* @param {boolean} [enable] true if demo trading should be enabled, false otherwise
|
|
85257
|
+
*/
|
|
85258
|
+
if (this.options['sandboxMode']) {
|
|
85259
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' demo trading does not support in sandbox environment');
|
|
85260
|
+
}
|
|
85261
|
+
// enable demo trading in bybit, see: https://bybit-exchange.github.io/docs/v5/demo
|
|
85262
|
+
if (enable) {
|
|
85263
|
+
this.urls['apiBackupDemoTrading'] = this.urls['api'];
|
|
85264
|
+
this.urls['api'] = this.urls['demotrading'];
|
|
85265
|
+
}
|
|
85266
|
+
else if ('apiBackupDemoTrading' in this.urls) {
|
|
85267
|
+
this.urls['api'] = this.urls['apiBackupDemoTrading'];
|
|
85268
|
+
const newUrls = this.omit(this.urls, 'apiBackupDemoTrading');
|
|
85269
|
+
this.urls = newUrls;
|
|
85270
|
+
}
|
|
85271
|
+
this.options['enableDemoTrading'] = enable;
|
|
85272
|
+
}
|
|
84936
85273
|
nonce() {
|
|
84937
85274
|
return this.milliseconds() - this.options['timeDifference'];
|
|
84938
85275
|
}
|
|
@@ -84949,12 +85286,24 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84949
85286
|
return data;
|
|
84950
85287
|
}
|
|
84951
85288
|
async isUnifiedEnabled(params = {}) {
|
|
85289
|
+
/**
|
|
85290
|
+
* @method
|
|
85291
|
+
* @name bybit#isUnifiedEnabled
|
|
85292
|
+
* @description returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
|
|
85293
|
+
*/
|
|
84952
85294
|
// The API key of user id must own one of permissions will be allowed to call following API endpoints.
|
|
84953
85295
|
// SUB UID: "Account Transfer"
|
|
84954
85296
|
// MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
|
|
84955
85297
|
const enableUnifiedMargin = this.safeValue(this.options, 'enableUnifiedMargin');
|
|
84956
85298
|
const enableUnifiedAccount = this.safeValue(this.options, 'enableUnifiedAccount');
|
|
84957
85299
|
if (enableUnifiedMargin === undefined || enableUnifiedAccount === undefined) {
|
|
85300
|
+
if (this.options['enableDemoTrading']) {
|
|
85301
|
+
// info endpoint is not available in demo trading
|
|
85302
|
+
// so we're assuming UTA is enabled
|
|
85303
|
+
this.options['enableUnifiedMargin'] = false;
|
|
85304
|
+
this.options['enableUnifiedAccount'] = true;
|
|
85305
|
+
return [this.options['enableUnifiedMargin'], this.options['enableUnifiedAccount']];
|
|
85306
|
+
}
|
|
84958
85307
|
const response = await this.privateGetV5UserQueryApi(params);
|
|
84959
85308
|
//
|
|
84960
85309
|
// {
|
|
@@ -85124,6 +85473,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
85124
85473
|
if (!this.checkRequiredCredentials(false)) {
|
|
85125
85474
|
return undefined;
|
|
85126
85475
|
}
|
|
85476
|
+
if (this.options['enableDemoTrading']) {
|
|
85477
|
+
return undefined;
|
|
85478
|
+
}
|
|
85127
85479
|
const response = await this.privateGetV5AssetCoinQueryInfo(params);
|
|
85128
85480
|
//
|
|
85129
85481
|
// {
|
|
@@ -91153,6 +91505,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
91153
91505
|
'symbol': symbol,
|
|
91154
91506
|
'maker': this.safeNumber(fee, 'makerFeeRate'),
|
|
91155
91507
|
'taker': this.safeNumber(fee, 'takerFeeRate'),
|
|
91508
|
+
'percentage': undefined,
|
|
91509
|
+
'tierBased': undefined,
|
|
91156
91510
|
};
|
|
91157
91511
|
}
|
|
91158
91512
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -94082,13 +94436,15 @@ class cex extends _abstract_cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
94082
94436
|
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
|
|
94083
94437
|
/* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2194);
|
|
94084
94438
|
/* harmony import */ var _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9292);
|
|
94085
|
-
/* harmony import */ var
|
|
94439
|
+
/* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1372);
|
|
94440
|
+
/* harmony import */ var _base_functions_rsa_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5981);
|
|
94086
94441
|
// ----------------------------------------------------------------------------
|
|
94087
94442
|
|
|
94088
94443
|
|
|
94089
94444
|
|
|
94090
94445
|
|
|
94091
94446
|
|
|
94447
|
+
|
|
94092
94448
|
// ----------------------------------------------------------------------------
|
|
94093
94449
|
/**
|
|
94094
94450
|
* @class coinbase
|
|
@@ -97865,31 +98221,16 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
97865
98221
|
const url = this.urls['api']['rest'] + fullPath;
|
|
97866
98222
|
if (signed) {
|
|
97867
98223
|
const authorization = this.safeString(this.headers, 'Authorization');
|
|
98224
|
+
let authorizationString = undefined;
|
|
97868
98225
|
if (authorization !== undefined) {
|
|
97869
|
-
|
|
97870
|
-
'Authorization': authorization,
|
|
97871
|
-
'Content-Type': 'application/json',
|
|
97872
|
-
};
|
|
97873
|
-
if (method !== 'GET') {
|
|
97874
|
-
if (Object.keys(query).length) {
|
|
97875
|
-
body = this.json(query);
|
|
97876
|
-
}
|
|
97877
|
-
}
|
|
98226
|
+
authorizationString = authorization;
|
|
97878
98227
|
}
|
|
97879
98228
|
else if (this.token && !this.checkRequiredCredentials(false)) {
|
|
97880
|
-
|
|
97881
|
-
'Authorization': 'Bearer ' + this.token,
|
|
97882
|
-
'Content-Type': 'application/json',
|
|
97883
|
-
};
|
|
97884
|
-
if (method !== 'GET') {
|
|
97885
|
-
if (Object.keys(query).length) {
|
|
97886
|
-
body = this.json(query);
|
|
97887
|
-
}
|
|
97888
|
-
}
|
|
98229
|
+
authorizationString = 'Bearer ' + this.token;
|
|
97889
98230
|
}
|
|
97890
98231
|
else {
|
|
97891
98232
|
this.checkRequiredCredentials();
|
|
97892
|
-
const
|
|
98233
|
+
const seconds = this.seconds();
|
|
97893
98234
|
let payload = '';
|
|
97894
98235
|
if (method !== 'GET') {
|
|
97895
98236
|
if (Object.keys(query).length) {
|
|
@@ -97908,14 +98249,52 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
97908
98249
|
// https://docs.cloud.coinbase.com/advanced-trade-api/docs/auth#example-request
|
|
97909
98250
|
// v2: 'GET' require payload in the signature
|
|
97910
98251
|
// https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-key-authentication
|
|
97911
|
-
const
|
|
97912
|
-
|
|
98252
|
+
const isCloudAPiKey = (this.apiKey.indexOf('organizations/') >= 0) || (this.secret.startsWith('-----BEGIN'));
|
|
98253
|
+
if (isCloudAPiKey) {
|
|
98254
|
+
if (this.apiKey.startsWith('-----BEGIN')) {
|
|
98255
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' apiKey should contain the name (eg: organizations/3b910e93....) and not the public key');
|
|
98256
|
+
}
|
|
98257
|
+
// it may not work for v2
|
|
98258
|
+
let uri = method + ' ' + url.replace('https://', '');
|
|
98259
|
+
const quesPos = uri.indexOf('?');
|
|
98260
|
+
if (quesPos >= 0) {
|
|
98261
|
+
uri = uri.slice(0, quesPos);
|
|
98262
|
+
}
|
|
98263
|
+
const nonce = this.randomBytes(16);
|
|
98264
|
+
const request = {
|
|
98265
|
+
'aud': ['retail_rest_api_proxy'],
|
|
98266
|
+
'iss': 'coinbase-cloud',
|
|
98267
|
+
'nbf': seconds,
|
|
98268
|
+
'exp': seconds + 120,
|
|
98269
|
+
'sub': this.apiKey,
|
|
98270
|
+
'uri': uri,
|
|
98271
|
+
'iat': seconds,
|
|
98272
|
+
};
|
|
98273
|
+
const token = (0,_base_functions_rsa_js__WEBPACK_IMPORTED_MODULE_4__/* .jwt */ .F)(request, this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .J, false, { 'kid': this.apiKey, 'nonce': nonce, 'alg': 'ES256' });
|
|
98274
|
+
authorizationString = 'Bearer ' + token;
|
|
98275
|
+
}
|
|
98276
|
+
else {
|
|
98277
|
+
const timestampString = this.seconds().toString();
|
|
98278
|
+
const auth = timestampString + method + savedPath + payload;
|
|
98279
|
+
const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .J);
|
|
98280
|
+
headers = {
|
|
98281
|
+
'CB-ACCESS-KEY': this.apiKey,
|
|
98282
|
+
'CB-ACCESS-SIGN': signature,
|
|
98283
|
+
'CB-ACCESS-TIMESTAMP': timestampString,
|
|
98284
|
+
'Content-Type': 'application/json',
|
|
98285
|
+
};
|
|
98286
|
+
}
|
|
98287
|
+
}
|
|
98288
|
+
if (authorizationString !== undefined) {
|
|
97913
98289
|
headers = {
|
|
97914
|
-
'
|
|
97915
|
-
'CB-ACCESS-SIGN': signature,
|
|
97916
|
-
'CB-ACCESS-TIMESTAMP': timestampString,
|
|
98290
|
+
'Authorization': authorizationString,
|
|
97917
98291
|
'Content-Type': 'application/json',
|
|
97918
98292
|
};
|
|
98293
|
+
if (method !== 'GET') {
|
|
98294
|
+
if (Object.keys(query).length) {
|
|
98295
|
+
body = this.json(query);
|
|
98296
|
+
}
|
|
98297
|
+
}
|
|
97919
98298
|
}
|
|
97920
98299
|
}
|
|
97921
98300
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
@@ -98058,6 +98437,7 @@ class coinbaseinternational extends _abstract_coinbaseinternational_js__WEBPACK_
|
|
|
98058
98437
|
'fetchLedger': false,
|
|
98059
98438
|
'fetchLeverage': false,
|
|
98060
98439
|
'fetchLeverageTiers': false,
|
|
98440
|
+
'fetchMarginAdjustmentHistory': false,
|
|
98061
98441
|
'fetchMarginMode': false,
|
|
98062
98442
|
'fetchMarkets': true,
|
|
98063
98443
|
'fetchMarkOHLCV': false,
|
|
@@ -102834,6 +103214,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
102834
103214
|
'fetchLeverage': 'emulated',
|
|
102835
103215
|
'fetchLeverages': true,
|
|
102836
103216
|
'fetchLeverageTiers': true,
|
|
103217
|
+
'fetchMarginAdjustmentHistory': true,
|
|
102837
103218
|
'fetchMarketLeverageTiers': 'emulated',
|
|
102838
103219
|
'fetchMarkets': true,
|
|
102839
103220
|
'fetchMarkOHLCV': false,
|
|
@@ -106993,11 +107374,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
106993
107374
|
// "message":"OK"
|
|
106994
107375
|
// }
|
|
106995
107376
|
//
|
|
107377
|
+
const data = this.safeDict(response, 'data');
|
|
106996
107378
|
const status = this.safeString(response, 'message');
|
|
106997
|
-
|
|
106998
|
-
return this.extend(this.parseMarginModification(response, market), {
|
|
107379
|
+
return this.extend(this.parseMarginModification(data, market), {
|
|
106999
107380
|
'amount': this.parseNumber(amount),
|
|
107000
|
-
'type': type,
|
|
107001
107381
|
'status': status,
|
|
107002
107382
|
});
|
|
107003
107383
|
}
|
|
@@ -107057,13 +107437,34 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
107057
107437
|
// "user_id": 3620173
|
|
107058
107438
|
// }
|
|
107059
107439
|
//
|
|
107060
|
-
|
|
107440
|
+
// fetchMarginAdjustmentHistory
|
|
107441
|
+
//
|
|
107442
|
+
// {
|
|
107443
|
+
// bkr_price: '0',
|
|
107444
|
+
// leverage: '3',
|
|
107445
|
+
// liq_price: '0',
|
|
107446
|
+
// margin_amount: '5.33236666666666666666',
|
|
107447
|
+
// margin_change: '3',
|
|
107448
|
+
// market: 'XRPUSDT',
|
|
107449
|
+
// position_amount: '11',
|
|
107450
|
+
// position_id: '297155652',
|
|
107451
|
+
// position_type: '2',
|
|
107452
|
+
// settle_price: '0.6361',
|
|
107453
|
+
// time: '1711050906.382891',
|
|
107454
|
+
// type: '1',
|
|
107455
|
+
// user_id: '3685860'
|
|
107456
|
+
// }
|
|
107457
|
+
//
|
|
107458
|
+
const marketId = this.safeString(data, 'market');
|
|
107459
|
+
const type = this.safeString(data, 'type');
|
|
107460
|
+
const timestamp = this.safeIntegerProduct2(data, 'time', 'update_time', 1000);
|
|
107061
107461
|
return {
|
|
107062
107462
|
'info': data,
|
|
107063
|
-
'symbol': this.safeSymbol(undefined,
|
|
107064
|
-
'type':
|
|
107065
|
-
'
|
|
107066
|
-
'
|
|
107463
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
107464
|
+
'type': (type === '1') ? 'add' : 'reduce',
|
|
107465
|
+
'marginMode': 'isolated',
|
|
107466
|
+
'amount': this.safeNumber(data, 'margin_change'),
|
|
107467
|
+
'total': this.safeNumber(data, 'position_amount'),
|
|
107067
107468
|
'code': market['quote'],
|
|
107068
107469
|
'status': undefined,
|
|
107069
107470
|
'timestamp': timestamp,
|
|
@@ -107714,6 +108115,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
107714
108115
|
const currencyId = this.safeString(transfer, 'asset');
|
|
107715
108116
|
const currencyCode = this.safeCurrencyCode(currencyId, currency);
|
|
107716
108117
|
return {
|
|
108118
|
+
'info': transfer,
|
|
107717
108119
|
'id': this.safeInteger(transfer, 'id'),
|
|
107718
108120
|
'timestamp': timestamp,
|
|
107719
108121
|
'datetime': this.iso8601(timestamp),
|
|
@@ -108546,6 +108948,78 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
108546
108948
|
}
|
|
108547
108949
|
return undefined;
|
|
108548
108950
|
}
|
|
108951
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
108952
|
+
/**
|
|
108953
|
+
* @method
|
|
108954
|
+
* @name coinex#fetchMarginAdjustmentHistory
|
|
108955
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
108956
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http046_position_margin_history
|
|
108957
|
+
* @param {string} [symbol] unified market symbol
|
|
108958
|
+
* @param {string} [type] not used by coinex fetchMarginAdjustmentHistory
|
|
108959
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
108960
|
+
* @param {int} [limit] the maximum amount of changes to fetch, default=100, max=100
|
|
108961
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
108962
|
+
* @param {int} [params.until] timestamp in ms of the latest change to fetch
|
|
108963
|
+
*
|
|
108964
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
108965
|
+
* @param {int} [params.offset] offset
|
|
108966
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
108967
|
+
*/
|
|
108968
|
+
await this.loadMarkets();
|
|
108969
|
+
const until = this.safeInteger(params, 'until');
|
|
108970
|
+
params = this.omit(params, 'until');
|
|
108971
|
+
if (limit === undefined) {
|
|
108972
|
+
limit = 100;
|
|
108973
|
+
}
|
|
108974
|
+
const request = {
|
|
108975
|
+
'market': '',
|
|
108976
|
+
'position_id': 0,
|
|
108977
|
+
'offset': 0,
|
|
108978
|
+
'limit': limit,
|
|
108979
|
+
};
|
|
108980
|
+
if (symbol !== undefined) {
|
|
108981
|
+
const market = this.market(symbol);
|
|
108982
|
+
request['market'] = market['id'];
|
|
108983
|
+
}
|
|
108984
|
+
if (since !== undefined) {
|
|
108985
|
+
request['start_time'] = since;
|
|
108986
|
+
}
|
|
108987
|
+
if (until !== undefined) {
|
|
108988
|
+
request['end_time'] = until;
|
|
108989
|
+
}
|
|
108990
|
+
const response = await this.v1PerpetualPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
108991
|
+
//
|
|
108992
|
+
// {
|
|
108993
|
+
// code: '0',
|
|
108994
|
+
// data: {
|
|
108995
|
+
// limit: '100',
|
|
108996
|
+
// offset: '0',
|
|
108997
|
+
// records: [
|
|
108998
|
+
// {
|
|
108999
|
+
// bkr_price: '0',
|
|
109000
|
+
// leverage: '3',
|
|
109001
|
+
// liq_price: '0',
|
|
109002
|
+
// margin_amount: '5.33236666666666666666',
|
|
109003
|
+
// margin_change: '3',
|
|
109004
|
+
// market: 'XRPUSDT',
|
|
109005
|
+
// position_amount: '11',
|
|
109006
|
+
// position_id: '297155652',
|
|
109007
|
+
// position_type: '2',
|
|
109008
|
+
// settle_price: '0.6361',
|
|
109009
|
+
// time: '1711050906.382891',
|
|
109010
|
+
// type: '1',
|
|
109011
|
+
// user_id: '3685860'
|
|
109012
|
+
// }
|
|
109013
|
+
// ]
|
|
109014
|
+
// },
|
|
109015
|
+
// message: 'OK'
|
|
109016
|
+
// }
|
|
109017
|
+
//
|
|
109018
|
+
const data = this.safeDict(response, 'data', {});
|
|
109019
|
+
const records = this.safeList(data, 'records', []);
|
|
109020
|
+
const modifications = this.parseMarginModifications(records, undefined, 'market', 'swap');
|
|
109021
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
109022
|
+
}
|
|
108549
109023
|
}
|
|
108550
109024
|
|
|
108551
109025
|
|
|
@@ -116716,6 +117190,8 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
116716
117190
|
'symbol': symbol,
|
|
116717
117191
|
'maker': this.safeNumber(fee, 'makerCommission'),
|
|
116718
117192
|
'taker': this.safeNumber(fee, 'takerCommission'),
|
|
117193
|
+
'percentage': undefined,
|
|
117194
|
+
'tierBased': undefined,
|
|
116719
117195
|
};
|
|
116720
117196
|
}
|
|
116721
117197
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
@@ -117747,6 +118223,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
117747
118223
|
'fetchLedger': true,
|
|
117748
118224
|
'fetchLeverage': false,
|
|
117749
118225
|
'fetchLeverageTiers': false,
|
|
118226
|
+
'fetchMarginAdjustmentHistory': false,
|
|
117750
118227
|
'fetchMarginMode': false,
|
|
117751
118228
|
'fetchMarketLeverageTiers': false,
|
|
117752
118229
|
'fetchMarkets': true,
|
|
@@ -125420,6 +125897,7 @@ class delta extends _abstract_delta_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
125420
125897
|
'info': data,
|
|
125421
125898
|
'symbol': market['symbol'],
|
|
125422
125899
|
'type': undefined,
|
|
125900
|
+
'marginMode': 'isolated',
|
|
125423
125901
|
'amount': undefined,
|
|
125424
125902
|
'total': this.safeNumber(data, 'margin'),
|
|
125425
125903
|
'code': undefined,
|
|
@@ -133264,6 +133742,8 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
133264
133742
|
'symbol': symbol,
|
|
133265
133743
|
'maker': this.safeNumber(fee, 'maker_fee_rate'),
|
|
133266
133744
|
'taker': this.safeNumber(fee, 'taker_fee_rate'),
|
|
133745
|
+
'percentage': undefined,
|
|
133746
|
+
'tierBased': undefined,
|
|
133267
133747
|
};
|
|
133268
133748
|
}
|
|
133269
133749
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
@@ -134058,6 +134538,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
134058
134538
|
'info': data,
|
|
134059
134539
|
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
134060
134540
|
'type': (rawType === 1) ? 'add' : 'reduce',
|
|
134541
|
+
'marginMode': 'isolated',
|
|
134061
134542
|
'amount': this.safeNumber(data, 'amount'),
|
|
134062
134543
|
'total': undefined,
|
|
134063
134544
|
'code': market['settle'],
|
|
@@ -134514,6 +134995,7 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
134514
134995
|
'info': data,
|
|
134515
134996
|
'symbol': this.safeSymbol(undefined, market),
|
|
134516
134997
|
'type': undefined,
|
|
134998
|
+
'marginMode': 'isolated',
|
|
134517
134999
|
'amount': undefined,
|
|
134518
135000
|
'total': undefined,
|
|
134519
135001
|
'code': this.safeValue(market, 'quote'),
|
|
@@ -137086,6 +137568,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
137086
137568
|
'fetchLeverages': true,
|
|
137087
137569
|
'fetchLeverageTiers': true,
|
|
137088
137570
|
'fetchLiquidations': true,
|
|
137571
|
+
'fetchMarginAdjustmentHistory': false,
|
|
137089
137572
|
'fetchMarginMode': false,
|
|
137090
137573
|
'fetchMarketLeverageTiers': true,
|
|
137091
137574
|
'fetchMarkets': true,
|
|
@@ -139037,6 +139520,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
139037
139520
|
'symbol': this.safeString(market, 'symbol'),
|
|
139038
139521
|
'maker': this.safeNumber(info, makerKey),
|
|
139039
139522
|
'taker': this.safeNumber(info, takerKey),
|
|
139523
|
+
'percentage': undefined,
|
|
139524
|
+
'tierBased': undefined,
|
|
139040
139525
|
};
|
|
139041
139526
|
}
|
|
139042
139527
|
async fetchTransactionFees(codes = undefined, params = {}) {
|
|
@@ -143083,6 +143568,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
143083
143568
|
'info': data,
|
|
143084
143569
|
'symbol': market['symbol'],
|
|
143085
143570
|
'type': undefined,
|
|
143571
|
+
'marginMode': 'isolated',
|
|
143086
143572
|
'amount': undefined,
|
|
143087
143573
|
'total': total,
|
|
143088
143574
|
'code': this.safeValue(market, 'quote'),
|
|
@@ -144512,6 +144998,7 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
144512
144998
|
// https://github.com/ccxt/ccxt/issues/7874
|
|
144513
144999
|
// https://github.com/ccxt/ccxt/issues/7894
|
|
144514
145000
|
'web': 'https://docs.gemini.com',
|
|
145001
|
+
'webExchange': 'https://exchange.gemini.com',
|
|
144515
145002
|
},
|
|
144516
145003
|
'fees': [
|
|
144517
145004
|
'https://gemini.com/api-fee-schedule',
|
|
@@ -145049,7 +145536,7 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
145049
145536
|
let quoteId = undefined;
|
|
145050
145537
|
let settleId = undefined;
|
|
145051
145538
|
let tickSize = undefined;
|
|
145052
|
-
let
|
|
145539
|
+
let amountPrecision = undefined;
|
|
145053
145540
|
let minSize = undefined;
|
|
145054
145541
|
let status = undefined;
|
|
145055
145542
|
let swap = false;
|
|
@@ -145060,9 +145547,9 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
145060
145547
|
const isArray = (Array.isArray(response));
|
|
145061
145548
|
if (!isString && !isArray) {
|
|
145062
145549
|
marketId = this.safeStringLower(response, 'symbol');
|
|
145550
|
+
amountPrecision = this.safeNumber(response, 'tick_size'); // right, exchange has an imperfect naming and this turns out to be an amount-precision
|
|
145551
|
+
tickSize = this.safeNumber(response, 'quote_increment'); // this is tick-size actually
|
|
145063
145552
|
minSize = this.safeNumber(response, 'min_order_size');
|
|
145064
|
-
tickSize = this.safeNumber(response, 'tick_size');
|
|
145065
|
-
increment = this.safeNumber(response, 'quote_increment');
|
|
145066
145553
|
status = this.parseMarketActive(this.safeString(response, 'status'));
|
|
145067
145554
|
baseId = this.safeString(response, 'base_currency');
|
|
145068
145555
|
quoteId = this.safeString(response, 'quote_currency');
|
|
@@ -145075,9 +145562,9 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
145075
145562
|
}
|
|
145076
145563
|
else {
|
|
145077
145564
|
marketId = this.safeStringLower(response, 0);
|
|
145078
|
-
|
|
145079
|
-
|
|
145080
|
-
|
|
145565
|
+
tickSize = this.parseNumber(this.parsePrecision(this.safeString(response, 1))); // priceTickDecimalPlaces
|
|
145566
|
+
amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(response, 2))); // quantityTickDecimalPlaces
|
|
145567
|
+
minSize = this.safeNumber(response, 3); // quantityMinimum
|
|
145081
145568
|
}
|
|
145082
145569
|
const marketIdUpper = marketId.toUpperCase();
|
|
145083
145570
|
const isPerp = (marketIdUpper.indexOf('PERP') >= 0);
|
|
@@ -145132,8 +145619,8 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
145132
145619
|
'strike': undefined,
|
|
145133
145620
|
'optionType': undefined,
|
|
145134
145621
|
'precision': {
|
|
145135
|
-
'price':
|
|
145136
|
-
'amount':
|
|
145622
|
+
'price': tickSize,
|
|
145623
|
+
'amount': amountPrecision,
|
|
145137
145624
|
},
|
|
145138
145625
|
'limits': {
|
|
145139
145626
|
'leverage': {
|
|
@@ -146207,7 +146694,7 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
146207
146694
|
if (apiKey.indexOf('account') < 0) {
|
|
146208
146695
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError(this.id + ' sign() requires an account-key, master-keys are not-supported');
|
|
146209
146696
|
}
|
|
146210
|
-
const nonce = this.nonce();
|
|
146697
|
+
const nonce = this.nonce().toString();
|
|
146211
146698
|
const request = this.extend({
|
|
146212
146699
|
'request': url,
|
|
146213
146700
|
'nonce': nonce,
|
|
@@ -147955,6 +148442,8 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
147955
148442
|
'symbol': symbol,
|
|
147956
148443
|
'taker': taker,
|
|
147957
148444
|
'maker': maker,
|
|
148445
|
+
'percentage': undefined,
|
|
148446
|
+
'tierBased': undefined,
|
|
147958
148447
|
};
|
|
147959
148448
|
}
|
|
147960
148449
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -149649,6 +150138,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
149649
150138
|
'info': data,
|
|
149650
150139
|
'symbol': market['symbol'],
|
|
149651
150140
|
'type': undefined,
|
|
150141
|
+
'marginMode': 'isolated',
|
|
149652
150142
|
'amount': undefined,
|
|
149653
150143
|
'total': undefined,
|
|
149654
150144
|
'code': this.safeString(currencyInfo, 'code'),
|
|
@@ -152063,6 +152553,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
152063
152553
|
'fetchLeverage': false,
|
|
152064
152554
|
'fetchLeverageTiers': true,
|
|
152065
152555
|
'fetchLiquidations': true,
|
|
152556
|
+
'fetchMarginAdjustmentHistory': false,
|
|
152066
152557
|
'fetchMarketLeverageTiers': true,
|
|
152067
152558
|
'fetchMarkets': true,
|
|
152068
152559
|
'fetchMarkOHLCV': true,
|
|
@@ -153479,6 +153970,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
153479
153970
|
'symbol': this.safeSymbol(marketId, market),
|
|
153480
153971
|
'maker': this.safeNumber(fee, 'actualMakerRate'),
|
|
153481
153972
|
'taker': this.safeNumber(fee, 'actualTakerRate'),
|
|
153973
|
+
'percentage': undefined,
|
|
153974
|
+
'tierBased': undefined,
|
|
153482
153975
|
};
|
|
153483
153976
|
}
|
|
153484
153977
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -165260,6 +165753,7 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
165260
165753
|
'info': data,
|
|
165261
165754
|
'symbol': this.safeSymbol(undefined, market),
|
|
165262
165755
|
'type': undefined,
|
|
165756
|
+
'marginMode': 'isolated',
|
|
165263
165757
|
'amount': undefined,
|
|
165264
165758
|
'total': undefined,
|
|
165265
165759
|
'code': this.safeString(market, 'settle'),
|
|
@@ -175188,6 +175682,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
175188
175682
|
'fetchL3OrderBook': true,
|
|
175189
175683
|
'fetchLedger': true,
|
|
175190
175684
|
'fetchLeverageTiers': false,
|
|
175685
|
+
'fetchMarginAdjustmentHistory': false,
|
|
175191
175686
|
'fetchMarginMode': false,
|
|
175192
175687
|
'fetchMarketLeverageTiers': false,
|
|
175193
175688
|
'fetchMarkets': true,
|
|
@@ -178639,9 +179134,9 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
178639
179134
|
}
|
|
178640
179135
|
parseBalanceHelper(entry) {
|
|
178641
179136
|
const account = this.account();
|
|
178642
|
-
account['used'] = this.
|
|
178643
|
-
account['free'] = this.
|
|
178644
|
-
account['total'] = this.
|
|
179137
|
+
account['used'] = this.safeString2(entry, 'holdBalance', 'hold');
|
|
179138
|
+
account['free'] = this.safeString2(entry, 'availableBalance', 'available');
|
|
179139
|
+
account['total'] = this.safeString2(entry, 'totalBalance', 'total');
|
|
178645
179140
|
const debt = this.safeString(entry, 'liability');
|
|
178646
179141
|
const interest = this.safeString(entry, 'interest');
|
|
178647
179142
|
account['debt'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(debt, interest);
|
|
@@ -178699,7 +179194,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
178699
179194
|
response = await this.privateGetAccounts(this.extend(request, query));
|
|
178700
179195
|
}
|
|
178701
179196
|
//
|
|
178702
|
-
// Spot
|
|
179197
|
+
// Spot
|
|
178703
179198
|
//
|
|
178704
179199
|
// {
|
|
178705
179200
|
// "code": "200000",
|
|
@@ -178715,35 +179210,59 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
178715
179210
|
// ]
|
|
178716
179211
|
// }
|
|
178717
179212
|
//
|
|
179213
|
+
// Cross
|
|
179214
|
+
//
|
|
179215
|
+
// {
|
|
179216
|
+
// "code": "200000",
|
|
179217
|
+
// "data": {
|
|
179218
|
+
// "debtRatio": "0",
|
|
179219
|
+
// "accounts": [
|
|
179220
|
+
// {
|
|
179221
|
+
// "currency": "USDT",
|
|
179222
|
+
// "totalBalance": "5",
|
|
179223
|
+
// "availableBalance": "5",
|
|
179224
|
+
// "holdBalance": "0",
|
|
179225
|
+
// "liability": "0",
|
|
179226
|
+
// "maxBorrowSize": "20"
|
|
179227
|
+
// },
|
|
179228
|
+
// ]
|
|
179229
|
+
// }
|
|
179230
|
+
// }
|
|
179231
|
+
//
|
|
178718
179232
|
// Isolated
|
|
178719
179233
|
//
|
|
178720
179234
|
// {
|
|
178721
179235
|
// "code": "200000",
|
|
178722
179236
|
// "data": {
|
|
178723
|
-
// "
|
|
178724
|
-
// "
|
|
179237
|
+
// "totalAssetOfQuoteCurrency": "0",
|
|
179238
|
+
// "totalLiabilityOfQuoteCurrency": "0",
|
|
179239
|
+
// "timestamp": 1712085661155,
|
|
178725
179240
|
// "assets": [
|
|
178726
179241
|
// {
|
|
178727
179242
|
// "symbol": "MANA-USDT",
|
|
178728
|
-
// "status": "
|
|
179243
|
+
// "status": "EFFECTIVE",
|
|
178729
179244
|
// "debtRatio": "0",
|
|
178730
179245
|
// "baseAsset": {
|
|
178731
179246
|
// "currency": "MANA",
|
|
178732
|
-
// "
|
|
178733
|
-
// "
|
|
178734
|
-
// "
|
|
179247
|
+
// "borrowEnabled": true,
|
|
179248
|
+
// "transferInEnabled": true,
|
|
179249
|
+
// "total": "0",
|
|
179250
|
+
// "hold": "0",
|
|
179251
|
+
// "available": "0",
|
|
178735
179252
|
// "liability": "0",
|
|
178736
179253
|
// "interest": "0",
|
|
178737
|
-
// "
|
|
179254
|
+
// "maxBorrowSize": "0"
|
|
178738
179255
|
// },
|
|
178739
179256
|
// "quoteAsset": {
|
|
178740
179257
|
// "currency": "USDT",
|
|
178741
|
-
// "
|
|
178742
|
-
// "
|
|
178743
|
-
// "
|
|
179258
|
+
// "borrowEnabled": true,
|
|
179259
|
+
// "transferInEnabled": true,
|
|
179260
|
+
// "total": "0",
|
|
179261
|
+
// "hold": "0",
|
|
179262
|
+
// "available": "0",
|
|
178744
179263
|
// "liability": "0",
|
|
178745
179264
|
// "interest": "0",
|
|
178746
|
-
// "
|
|
179265
|
+
// "maxBorrowSize": "0"
|
|
178747
179266
|
// }
|
|
178748
179267
|
// },
|
|
178749
179268
|
// ...
|
|
@@ -179932,6 +180451,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
179932
180451
|
'fetchL3OrderBook': true,
|
|
179933
180452
|
'fetchLedger': true,
|
|
179934
180453
|
'fetchLeverageTiers': false,
|
|
180454
|
+
'fetchMarginAdjustmentHistory': false,
|
|
179935
180455
|
'fetchMarginMode': false,
|
|
179936
180456
|
'fetchMarketLeverageTiers': true,
|
|
179937
180457
|
'fetchMarkets': true,
|
|
@@ -181478,14 +181998,18 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
181478
181998
|
const crossMode = this.safeValue(info, 'crossMode');
|
|
181479
181999
|
const mode = crossMode ? 'cross' : 'isolated';
|
|
181480
182000
|
const marketId = this.safeString(market, 'symbol');
|
|
182001
|
+
const timestamp = this.safeInteger(info, 'currentTimestamp');
|
|
181481
182002
|
return {
|
|
181482
182003
|
'info': info,
|
|
181483
|
-
'
|
|
181484
|
-
'
|
|
182004
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
182005
|
+
'type': undefined,
|
|
182006
|
+
'marginMode': mode,
|
|
181485
182007
|
'amount': undefined,
|
|
182008
|
+
'total': undefined,
|
|
181486
182009
|
'code': this.safeCurrencyCode(currencyId),
|
|
181487
|
-
'symbol': this.safeSymbol(marketId, market),
|
|
181488
182010
|
'status': undefined,
|
|
182011
|
+
'timestamp': timestamp,
|
|
182012
|
+
'datetime': this.iso8601(timestamp),
|
|
181489
182013
|
};
|
|
181490
182014
|
}
|
|
181491
182015
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -181626,6 +182150,32 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
181626
182150
|
}
|
|
181627
182151
|
return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
|
|
181628
182152
|
}
|
|
182153
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
182154
|
+
/**
|
|
182155
|
+
* @method
|
|
182156
|
+
* @name kucoinfutures#fetchOpenOrders
|
|
182157
|
+
* @description fetches information on multiple open orders made by the user
|
|
182158
|
+
* @see https://docs.kucoin.com/futures/#get-order-list
|
|
182159
|
+
* @see https://docs.kucoin.com/futures/#get-untriggered-stop-order-list
|
|
182160
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
182161
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
182162
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
182163
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
182164
|
+
* @param {int} [params.till] end time in ms
|
|
182165
|
+
* @param {string} [params.side] buy or sell
|
|
182166
|
+
* @param {string} [params.type] limit, or market
|
|
182167
|
+
* @param {boolean} [params.trigger] set to true to retrieve untriggered stop orders
|
|
182168
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
182169
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
182170
|
+
*/
|
|
182171
|
+
await this.loadMarkets();
|
|
182172
|
+
let paginate = false;
|
|
182173
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
182174
|
+
if (paginate) {
|
|
182175
|
+
return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params);
|
|
182176
|
+
}
|
|
182177
|
+
return await this.fetchOrdersByStatus('open', symbol, since, limit, params);
|
|
182178
|
+
}
|
|
181629
182179
|
async fetchOrder(id = undefined, symbol = undefined, params = {}) {
|
|
181630
182180
|
/**
|
|
181631
182181
|
* @method
|
|
@@ -185385,6 +185935,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
185385
185935
|
'symbol': market['symbol'],
|
|
185386
185936
|
'maker': this.safeNumber(response, 'makerFee'),
|
|
185387
185937
|
'taker': this.safeNumber(response, 'takerFee'),
|
|
185938
|
+
'percentage': undefined,
|
|
185939
|
+
'tierBased': undefined,
|
|
185388
185940
|
};
|
|
185389
185941
|
}
|
|
185390
185942
|
async fetchPrivateTradingFee(symbol, params = {}) {
|
|
@@ -185408,6 +185960,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
185408
185960
|
'symbol': market['symbol'],
|
|
185409
185961
|
'maker': this.safeNumber(response, 'makerFee'),
|
|
185410
185962
|
'taker': this.safeNumber(response, 'takerFee'),
|
|
185963
|
+
'percentage': undefined,
|
|
185964
|
+
'tierBased': undefined,
|
|
185411
185965
|
};
|
|
185412
185966
|
}
|
|
185413
185967
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -187511,6 +188065,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
187511
188065
|
'symbol': symbol,
|
|
187512
188066
|
'maker': this.safeNumber(fee, 'makerCommission'),
|
|
187513
188067
|
'taker': this.safeNumber(fee, 'takerCommission'),
|
|
188068
|
+
'percentage': undefined,
|
|
188069
|
+
'tierBased': undefined,
|
|
187514
188070
|
};
|
|
187515
188071
|
}
|
|
187516
188072
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -187525,7 +188081,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
187525
188081
|
*/
|
|
187526
188082
|
const market = this.market(symbol);
|
|
187527
188083
|
const result = await this.fetchTradingFees(this.extend(params, { 'category': market['id'] }));
|
|
187528
|
-
return result;
|
|
188084
|
+
return this.safeDict(result, symbol);
|
|
187529
188085
|
}
|
|
187530
188086
|
async fetchTradingFees(params = {}) {
|
|
187531
188087
|
/**
|
|
@@ -190029,6 +190585,8 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
190029
190585
|
'symbol': symbol,
|
|
190030
190586
|
'maker': this.safeNumber(response, 'maker_fee'),
|
|
190031
190587
|
'taker': this.safeNumber(response, 'taker_fee'),
|
|
190588
|
+
'percentage': undefined,
|
|
190589
|
+
'tierBased': undefined,
|
|
190032
190590
|
};
|
|
190033
190591
|
}
|
|
190034
190592
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -192604,6 +193162,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
192604
193162
|
'fetchLeverage': true,
|
|
192605
193163
|
'fetchLeverages': false,
|
|
192606
193164
|
'fetchLeverageTiers': true,
|
|
193165
|
+
'fetchMarginAdjustmentHistory': false,
|
|
192607
193166
|
'fetchMarginMode': false,
|
|
192608
193167
|
'fetchMarketLeverageTiers': undefined,
|
|
192609
193168
|
'fetchMarkets': true,
|
|
@@ -196829,8 +197388,9 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
196829
197388
|
/**
|
|
196830
197389
|
* @method
|
|
196831
197390
|
* @name mexc#fetchLeverageTiers
|
|
196832
|
-
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
196833
|
-
* @
|
|
197391
|
+
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes, if a market has a leverage tier of 0, then the leverage tiers cannot be obtained for this market
|
|
197392
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
|
|
197393
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
196834
197394
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
196835
197395
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
196836
197396
|
*/
|
|
@@ -196886,10 +197446,44 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
196886
197446
|
return this.parseLeverageTiers(data, symbols, 'symbol');
|
|
196887
197447
|
}
|
|
196888
197448
|
parseMarketLeverageTiers(info, market = undefined) {
|
|
196889
|
-
|
|
196890
|
-
|
|
196891
|
-
|
|
196892
|
-
|
|
197449
|
+
//
|
|
197450
|
+
// {
|
|
197451
|
+
// "symbol": "BTC_USDT",
|
|
197452
|
+
// "displayName": "BTC_USDT永续",
|
|
197453
|
+
// "displayNameEn": "BTC_USDT SWAP",
|
|
197454
|
+
// "positionOpenType": 3,
|
|
197455
|
+
// "baseCoin": "BTC",
|
|
197456
|
+
// "quoteCoin": "USDT",
|
|
197457
|
+
// "settleCoin": "USDT",
|
|
197458
|
+
// "contractSize": 0.0001,
|
|
197459
|
+
// "minLeverage": 1,
|
|
197460
|
+
// "maxLeverage": 125,
|
|
197461
|
+
// "priceScale": 2,
|
|
197462
|
+
// "volScale": 0,
|
|
197463
|
+
// "amountScale": 4,
|
|
197464
|
+
// "priceUnit": 0.5,
|
|
197465
|
+
// "volUnit": 1,
|
|
197466
|
+
// "minVol": 1,
|
|
197467
|
+
// "maxVol": 1000000,
|
|
197468
|
+
// "bidLimitPriceRate": 0.1,
|
|
197469
|
+
// "askLimitPriceRate": 0.1,
|
|
197470
|
+
// "takerFeeRate": 0.0006,
|
|
197471
|
+
// "makerFeeRate": 0.0002,
|
|
197472
|
+
// "maintenanceMarginRate": 0.004,
|
|
197473
|
+
// "initialMarginRate": 0.008,
|
|
197474
|
+
// "riskBaseVol": 10000,
|
|
197475
|
+
// "riskIncrVol": 200000,
|
|
197476
|
+
// "riskIncrMmr": 0.004,
|
|
197477
|
+
// "riskIncrImr": 0.004,
|
|
197478
|
+
// "riskLevelLimit": 5,
|
|
197479
|
+
// "priceCoefficientVariation": 0.1,
|
|
197480
|
+
// "indexOrigin": ["BINANCE","GATEIO","HUOBI","MXC"],
|
|
197481
|
+
// "state": 0, // 0 enabled, 1 delivery, 2 completed, 3 offline, 4 pause
|
|
197482
|
+
// "isNew": false,
|
|
197483
|
+
// "isHot": true,
|
|
197484
|
+
// "isHidden": false
|
|
197485
|
+
// }
|
|
197486
|
+
//
|
|
196893
197487
|
let maintenanceMarginRate = this.safeString(info, 'maintenanceMarginRate');
|
|
196894
197488
|
let initialMarginRate = this.safeString(info, 'initialMarginRate');
|
|
196895
197489
|
const maxVol = this.safeString(info, 'maxVol');
|
|
@@ -196899,6 +197493,19 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
196899
197493
|
let floor = '0';
|
|
196900
197494
|
const tiers = [];
|
|
196901
197495
|
const quoteId = this.safeString(info, 'quoteCoin');
|
|
197496
|
+
if (riskIncrVol === '0') {
|
|
197497
|
+
return [
|
|
197498
|
+
{
|
|
197499
|
+
'tier': 0,
|
|
197500
|
+
'currency': this.safeCurrencyCode(quoteId),
|
|
197501
|
+
'notionalFloor': undefined,
|
|
197502
|
+
'notionalCap': undefined,
|
|
197503
|
+
'maintenanceMarginRate': undefined,
|
|
197504
|
+
'maxLeverage': this.safeNumber(info, 'maxLeverage'),
|
|
197505
|
+
'info': info,
|
|
197506
|
+
},
|
|
197507
|
+
];
|
|
197508
|
+
}
|
|
196902
197509
|
while (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringLt(floor, maxVol)) {
|
|
196903
197510
|
const cap = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(floor, riskIncrVol);
|
|
196904
197511
|
tiers.push({
|
|
@@ -206384,6 +206991,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206384
206991
|
'fetchLedgerEntry': undefined,
|
|
206385
206992
|
'fetchLeverage': true,
|
|
206386
206993
|
'fetchLeverageTiers': false,
|
|
206994
|
+
'fetchMarginAdjustmentHistory': true,
|
|
206387
206995
|
'fetchMarketLeverageTiers': true,
|
|
206388
206996
|
'fetchMarkets': true,
|
|
206389
206997
|
'fetchMarkOHLCV': true,
|
|
@@ -208654,6 +209262,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
208654
209262
|
// OKX returns the fees as negative values opposed to other exchanges, so the sign needs to be flipped
|
|
208655
209263
|
'maker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'maker', 'makerU'))),
|
|
208656
209264
|
'taker': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringNeg(this.safeString2(fee, 'taker', 'takerU'))),
|
|
209265
|
+
'percentage': undefined,
|
|
209266
|
+
'tierBased': undefined,
|
|
208657
209267
|
};
|
|
208658
209268
|
}
|
|
208659
209269
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -212761,9 +213371,9 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212761
213371
|
// }
|
|
212762
213372
|
//
|
|
212763
213373
|
const data = this.safeList(response, 'data', []);
|
|
213374
|
+
const entry = this.safeDict(data, 0, {});
|
|
212764
213375
|
const errorCode = this.safeString(response, 'code');
|
|
212765
|
-
|
|
212766
|
-
return this.extend(this.parseMarginModification(item, market), {
|
|
213376
|
+
return this.extend(this.parseMarginModification(entry, market), {
|
|
212767
213377
|
'status': (errorCode === '0') ? 'ok' : 'failed',
|
|
212768
213378
|
});
|
|
212769
213379
|
}
|
|
@@ -212778,22 +213388,68 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212778
213388
|
// "type": "reduce"
|
|
212779
213389
|
// }
|
|
212780
213390
|
//
|
|
212781
|
-
|
|
213391
|
+
// fetchMarginAdjustmentHistory
|
|
213392
|
+
//
|
|
213393
|
+
// {
|
|
213394
|
+
// bal: '67621.4325135010619812',
|
|
213395
|
+
// balChg: '-10.0000000000000000',
|
|
213396
|
+
// billId: '691293628710342659',
|
|
213397
|
+
// ccy: 'USDT',
|
|
213398
|
+
// clOrdId: '',
|
|
213399
|
+
// execType: '',
|
|
213400
|
+
// fee: '0',
|
|
213401
|
+
// fillFwdPx: '',
|
|
213402
|
+
// fillIdxPx: '',
|
|
213403
|
+
// fillMarkPx: '',
|
|
213404
|
+
// fillMarkVol: '',
|
|
213405
|
+
// fillPxUsd: '',
|
|
213406
|
+
// fillPxVol: '',
|
|
213407
|
+
// fillTime: '1711089244850',
|
|
213408
|
+
// from: '',
|
|
213409
|
+
// instId: 'XRP-USDT-SWAP',
|
|
213410
|
+
// instType: 'SWAP',
|
|
213411
|
+
// interest: '0',
|
|
213412
|
+
// mgnMode: 'isolated',
|
|
213413
|
+
// notes: '',
|
|
213414
|
+
// ordId: '',
|
|
213415
|
+
// pnl: '0',
|
|
213416
|
+
// posBal: '73.12',
|
|
213417
|
+
// posBalChg: '10.00',
|
|
213418
|
+
// px: '',
|
|
213419
|
+
// subType: '160',
|
|
213420
|
+
// sz: '10',
|
|
213421
|
+
// tag: '',
|
|
213422
|
+
// to: '',
|
|
213423
|
+
// tradeId: '0',
|
|
213424
|
+
// ts: '1711089244699',
|
|
213425
|
+
// type: '6'
|
|
213426
|
+
// }
|
|
213427
|
+
//
|
|
213428
|
+
const amountRaw = this.safeString2(data, 'amt', 'posBalChg');
|
|
212782
213429
|
const typeRaw = this.safeString(data, 'type');
|
|
212783
|
-
|
|
213430
|
+
let type = undefined;
|
|
213431
|
+
if (typeRaw === '6') {
|
|
213432
|
+
type = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringGt(amountRaw, '0') ? 'add' : 'reduce';
|
|
213433
|
+
}
|
|
213434
|
+
else {
|
|
213435
|
+
type = typeRaw;
|
|
213436
|
+
}
|
|
213437
|
+
const amount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(amountRaw);
|
|
212784
213438
|
const marketId = this.safeString(data, 'instId');
|
|
212785
213439
|
const responseMarket = this.safeMarket(marketId, market);
|
|
212786
213440
|
const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];
|
|
213441
|
+
const timestamp = this.safeInteger(data, 'ts');
|
|
212787
213442
|
return {
|
|
212788
213443
|
'info': data,
|
|
212789
213444
|
'symbol': responseMarket['symbol'],
|
|
212790
213445
|
'type': type,
|
|
212791
|
-
'
|
|
212792
|
-
'
|
|
213446
|
+
'marginMode': 'isolated',
|
|
213447
|
+
'amount': this.parseNumber(amount),
|
|
212793
213448
|
'code': code,
|
|
213449
|
+
'total': undefined,
|
|
212794
213450
|
'status': undefined,
|
|
212795
|
-
'timestamp':
|
|
212796
|
-
'datetime':
|
|
213451
|
+
'timestamp': timestamp,
|
|
213452
|
+
'datetime': this.iso8601(timestamp),
|
|
212797
213453
|
};
|
|
212798
213454
|
}
|
|
212799
213455
|
async reduceMargin(symbol, amount, params = {}) {
|
|
@@ -213895,6 +214551,108 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
213895
214551
|
}
|
|
213896
214552
|
return undefined;
|
|
213897
214553
|
}
|
|
214554
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
214555
|
+
/**
|
|
214556
|
+
* @method
|
|
214557
|
+
* @name okx#fetchMarginAdjustmentHistory
|
|
214558
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
214559
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days
|
|
214560
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
214561
|
+
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
214562
|
+
* @param {string} [type] "add" or "reduce"
|
|
214563
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
214564
|
+
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
214565
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
214566
|
+
*/
|
|
214567
|
+
await this.loadMarkets();
|
|
214568
|
+
const auto = this.safeBool(params, 'auto');
|
|
214569
|
+
if (type === undefined) {
|
|
214570
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory () requires a type argument');
|
|
214571
|
+
}
|
|
214572
|
+
const isAdd = type === 'add';
|
|
214573
|
+
let subType = isAdd ? '160' : '161';
|
|
214574
|
+
if (auto) {
|
|
214575
|
+
if (isAdd) {
|
|
214576
|
+
subType = '162';
|
|
214577
|
+
}
|
|
214578
|
+
else {
|
|
214579
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' cannot fetch margin adjustments for type ' + type);
|
|
214580
|
+
}
|
|
214581
|
+
}
|
|
214582
|
+
const request = {
|
|
214583
|
+
'subType': subType,
|
|
214584
|
+
'mgnMode': 'isolated',
|
|
214585
|
+
};
|
|
214586
|
+
const until = this.safeInteger(params, 'until');
|
|
214587
|
+
params = this.omit(params, 'until');
|
|
214588
|
+
if (since !== undefined) {
|
|
214589
|
+
request['startTime'] = since;
|
|
214590
|
+
}
|
|
214591
|
+
if (limit !== undefined) {
|
|
214592
|
+
request['limit'] = limit;
|
|
214593
|
+
}
|
|
214594
|
+
if (until !== undefined) {
|
|
214595
|
+
request['endTime'] = until;
|
|
214596
|
+
}
|
|
214597
|
+
let response = undefined;
|
|
214598
|
+
const now = this.milliseconds();
|
|
214599
|
+
const oneWeekAgo = now - 604800000;
|
|
214600
|
+
const threeMonthsAgo = now - 7776000000;
|
|
214601
|
+
if ((since === undefined) || (since > oneWeekAgo)) {
|
|
214602
|
+
response = await this.privateGetAccountBills(this.extend(request, params));
|
|
214603
|
+
}
|
|
214604
|
+
else if (since > threeMonthsAgo) {
|
|
214605
|
+
response = await this.privateGetAccountBillsArchive(this.extend(request, params));
|
|
214606
|
+
}
|
|
214607
|
+
else {
|
|
214608
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchMarginAdjustmentHistory () cannot fetch margin adjustments older than 3 months');
|
|
214609
|
+
}
|
|
214610
|
+
//
|
|
214611
|
+
// {
|
|
214612
|
+
// code: '0',
|
|
214613
|
+
// data: [
|
|
214614
|
+
// {
|
|
214615
|
+
// bal: '67621.4325135010619812',
|
|
214616
|
+
// balChg: '-10.0000000000000000',
|
|
214617
|
+
// billId: '691293628710342659',
|
|
214618
|
+
// ccy: 'USDT',
|
|
214619
|
+
// clOrdId: '',
|
|
214620
|
+
// execType: '',
|
|
214621
|
+
// fee: '0',
|
|
214622
|
+
// fillFwdPx: '',
|
|
214623
|
+
// fillIdxPx: '',
|
|
214624
|
+
// fillMarkPx: '',
|
|
214625
|
+
// fillMarkVol: '',
|
|
214626
|
+
// fillPxUsd: '',
|
|
214627
|
+
// fillPxVol: '',
|
|
214628
|
+
// fillTime: '1711089244850',
|
|
214629
|
+
// from: '',
|
|
214630
|
+
// instId: 'XRP-USDT-SWAP',
|
|
214631
|
+
// instType: 'SWAP',
|
|
214632
|
+
// interest: '0',
|
|
214633
|
+
// mgnMode: 'isolated',
|
|
214634
|
+
// notes: '',
|
|
214635
|
+
// ordId: '',
|
|
214636
|
+
// pnl: '0',
|
|
214637
|
+
// posBal: '73.12',
|
|
214638
|
+
// posBalChg: '10.00',
|
|
214639
|
+
// px: '',
|
|
214640
|
+
// subType: '160',
|
|
214641
|
+
// sz: '10',
|
|
214642
|
+
// tag: '',
|
|
214643
|
+
// to: '',
|
|
214644
|
+
// tradeId: '0',
|
|
214645
|
+
// ts: '1711089244699',
|
|
214646
|
+
// type: '6'
|
|
214647
|
+
// }
|
|
214648
|
+
// ],
|
|
214649
|
+
// msg: ''
|
|
214650
|
+
// }
|
|
214651
|
+
//
|
|
214652
|
+
const data = this.safeList(response, 'data');
|
|
214653
|
+
const modifications = this.parseMarginModifications(data);
|
|
214654
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
214655
|
+
}
|
|
213898
214656
|
}
|
|
213899
214657
|
|
|
213900
214658
|
|
|
@@ -221843,6 +222601,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
221843
222601
|
'info': data,
|
|
221844
222602
|
'symbol': this.safeSymbol(undefined, market),
|
|
221845
222603
|
'type': 'set',
|
|
222604
|
+
'marginMode': 'isolated',
|
|
221846
222605
|
'amount': undefined,
|
|
221847
222606
|
'total': undefined,
|
|
221848
222607
|
'code': market[codeCurrency],
|
|
@@ -236464,6 +237223,8 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
236464
237223
|
'ordersAlgo': this.handleOrder,
|
|
236465
237224
|
'account': this.handleBalance,
|
|
236466
237225
|
'positions': this.handlePositions,
|
|
237226
|
+
'account-isolated': this.handleBalance,
|
|
237227
|
+
'account-crossed': this.handleBalance,
|
|
236467
237228
|
};
|
|
236468
237229
|
const arg = this.safeValue(message, 'arg', {});
|
|
236469
237230
|
const topic = this.safeValue(arg, 'channel', '');
|
|
@@ -296181,6 +296942,63 @@ const hash_to_ristretto255 = (msg, options) => {
|
|
|
296181
296942
|
};
|
|
296182
296943
|
|
|
296183
296944
|
|
|
296945
|
+
/***/ }),
|
|
296946
|
+
|
|
296947
|
+
/***/ 2572:
|
|
296948
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
296949
|
+
|
|
296950
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
296951
|
+
/* harmony export */ lA: () => (/* binding */ P256)
|
|
296952
|
+
/* harmony export */ });
|
|
296953
|
+
/* unused harmony exports secp256r1, hashToCurve, encodeToCurve */
|
|
296954
|
+
/* harmony import */ var _shortw_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77);
|
|
296955
|
+
/* harmony import */ var _noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1372);
|
|
296956
|
+
/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(111);
|
|
296957
|
+
/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9270);
|
|
296958
|
+
/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4945);
|
|
296959
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
296960
|
+
|
|
296961
|
+
|
|
296962
|
+
|
|
296963
|
+
|
|
296964
|
+
|
|
296965
|
+
// NIST secp256r1 aka P256
|
|
296966
|
+
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/nist/P-256
|
|
296967
|
+
// Field over which we'll do calculations; 2n**224n * (2n**32n-1n) + 2n**192n + 2n**96n-1n
|
|
296968
|
+
const Fp = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_0__.Fp)(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'));
|
|
296969
|
+
const CURVE_A = Fp.create(BigInt('-3'));
|
|
296970
|
+
const CURVE_B = BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b');
|
|
296971
|
+
const mapSWU = (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_1__/* .mapToCurveSimpleSWU */ .L4)(Fp, {
|
|
296972
|
+
A: CURVE_A,
|
|
296973
|
+
B: CURVE_B,
|
|
296974
|
+
Z: Fp.create(BigInt('-10')),
|
|
296975
|
+
});
|
|
296976
|
+
const P256 = (0,_shortw_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .createCurve */ ._)({
|
|
296977
|
+
// Params: a, b
|
|
296978
|
+
a: CURVE_A,
|
|
296979
|
+
b: CURVE_B,
|
|
296980
|
+
Fp,
|
|
296981
|
+
// Curve order, total count of valid points in the field
|
|
296982
|
+
n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'),
|
|
296983
|
+
// Base point (x, y) aka generator point
|
|
296984
|
+
Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'),
|
|
296985
|
+
Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'),
|
|
296986
|
+
h: BigInt(1),
|
|
296987
|
+
lowS: false,
|
|
296988
|
+
}, _noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_3__/* .sha256 */ .J);
|
|
296989
|
+
const secp256r1 = P256;
|
|
296990
|
+
const { hashToCurve, encodeToCurve } = _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__/* .createHasher */ .V1(secp256r1.ProjectivePoint, (scalars) => mapSWU(scalars[0]), {
|
|
296991
|
+
DST: 'P256_XMD:SHA-256_SSWU_RO_',
|
|
296992
|
+
encodeDST: 'P256_XMD:SHA-256_SSWU_NU_',
|
|
296993
|
+
p: Fp.ORDER,
|
|
296994
|
+
m: 1,
|
|
296995
|
+
k: 128,
|
|
296996
|
+
expand: 'xmd',
|
|
296997
|
+
hash: _noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_3__/* .sha256 */ .J,
|
|
296998
|
+
});
|
|
296999
|
+
|
|
297000
|
+
|
|
297001
|
+
|
|
296184
297002
|
/***/ }),
|
|
296185
297003
|
|
|
296186
297004
|
/***/ 1339:
|
|
@@ -299504,6 +300322,8 @@ class timex extends _abstract_timex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
299504
300322
|
'symbol': this.safeSymbol(marketId, market),
|
|
299505
300323
|
'maker': rate,
|
|
299506
300324
|
'taker': rate,
|
|
300325
|
+
'percentage': undefined,
|
|
300326
|
+
'tierBased': undefined,
|
|
299507
300327
|
};
|
|
299508
300328
|
}
|
|
299509
300329
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -311457,6 +312277,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
311457
312277
|
'fetchIndexOHLCV': false,
|
|
311458
312278
|
'fetchLedger': true,
|
|
311459
312279
|
'fetchLeverage': true,
|
|
312280
|
+
'fetchMarginAdjustmentHistory': false,
|
|
311460
312281
|
'fetchMarginMode': false,
|
|
311461
312282
|
'fetchMarkets': true,
|
|
311462
312283
|
'fetchMarkOHLCV': false,
|
|
@@ -324546,7 +325367,7 @@ SOFTWARE.
|
|
|
324546
325367
|
|
|
324547
325368
|
//-----------------------------------------------------------------------------
|
|
324548
325369
|
// this is updated by vss.js when building
|
|
324549
|
-
const version = '4.2.
|
|
325370
|
+
const version = '4.2.90';
|
|
324550
325371
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
324551
325372
|
//-----------------------------------------------------------------------------
|
|
324552
325373
|
|