diff --git a/cs/ccxt/exchanges/binance.cs b/cs/ccxt/exchanges/binance.cs index 7a59c22e7d94..ad0f65db5341 100644 --- a/cs/ccxt/exchanges/binance.cs +++ b/cs/ccxt/exchanges/binance.cs @@ -82,8 +82,8 @@ public override object describe() { "fetchFundingRates", true }, { "fetchGreeks", true }, { "fetchIndexOHLCV", true }, - { "fetchIsolatedBorrowRate", false }, - { "fetchIsolatedBorrowRates", false }, + { "fetchIsolatedBorrowRate", "emulated" }, + { "fetchIsolatedBorrowRates", true }, { "fetchL3OrderBook", false }, { "fetchLastPrices", true }, { "fetchLedger", true }, @@ -12031,6 +12031,77 @@ public async override Task fetchCrossBorrowRate(object code, object para return this.parseBorrowRate(rate); } + public async override Task fetchIsolatedBorrowRate(object symbol, object parameters = null) + { + /** + * @method + * @name binance#fetchIsolatedBorrowRate + * @description fetch the rate of interest to borrow a currency for margin trading + * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data + * @param {string} symbol unified market symbol + * @param {object} [params] extra parameters specific to the exchange API endpoint + * + * EXCHANGE SPECIFIC PARAMETERS + * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted + * @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure} + */ + parameters ??= new Dictionary(); + object request = new Dictionary() { + { "symbol", symbol }, + }; + object borrowRates = await this.fetchIsolatedBorrowRates(this.extend(request, parameters)); + return this.safeDict(borrowRates, symbol); + } + + public async override Task fetchIsolatedBorrowRates(object parameters = null) + { + /** + * @method + * @name binance#fetchIsolatedBorrowRates + * @description fetch the borrow interest rates of all currencies + * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data + * @param {object} [params] extra parameters specific to the exchange API endpoint + * @param {object} [params.symbol] unified market symbol + * + * EXCHANGE SPECIFIC PARAMETERS + * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted + * @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} + */ + parameters ??= new Dictionary(); + await this.loadMarkets(); + object request = new Dictionary() {}; + object symbol = this.safeString(parameters, "symbol"); + parameters = this.omit(parameters, "symbol"); + if (isTrue(!isEqual(symbol, null))) + { + object market = this.market(symbol); + ((IDictionary)request)["symbol"] = getValue(market, "id"); + } + object response = await this.sapiGetMarginIsolatedMarginData(this.extend(request, parameters)); + // + // [ + // { + // "vipLevel": 0, + // "symbol": "BTCUSDT", + // "leverage": "10", + // "data": [ + // { + // "coin": "BTC", + // "dailyInterest": "0.00026125", + // "borrowLimit": "270" + // }, + // { + // "coin": "USDT", + // "dailyInterest": "0.000475", + // "borrowLimit": "2100000" + // } + // ] + // } + // ] + // + return this.parseIsolatedBorrowRates(response); + } + public async virtual Task fetchBorrowRateHistory(object code, object since = null, object limit = null, object parameters = null) { /** @@ -12114,6 +12185,45 @@ public virtual object parseBorrowRate(object info, object currency = null) }; } + public override object parseIsolatedBorrowRate(object info, object market = null) + { + // + // { + // "vipLevel": 0, + // "symbol": "BTCUSDT", + // "leverage": "10", + // "data": [ + // { + // "coin": "BTC", + // "dailyInterest": "0.00026125", + // "borrowLimit": "270" + // }, + // { + // "coin": "USDT", + // "dailyInterest": "0.000475", + // "borrowLimit": "2100000" + // } + // ] + // } + // + object marketId = this.safeString(info, "symbol"); + market = this.safeMarket(marketId, market, null, "spot"); + object data = this.safeList(info, "data"); + object baseInfo = this.safeDict(data, 0); + object quoteInfo = this.safeDict(data, 1); + return new Dictionary() { + { "info", info }, + { "symbol", this.safeString(market, "symbol") }, + { "base", this.safeString(baseInfo, "coin") }, + { "baseRate", this.safeNumber(baseInfo, "dailyInterest") }, + { "quote", this.safeString(quoteInfo, "coin") }, + { "quoteRate", this.safeNumber(quoteInfo, "dailyInterest") }, + { "period", 86400000 }, + { "timestamp", null }, + { "datetime", null }, + }; + } + public async virtual Task createGiftCode(object code, object amount, object parameters = null) { /** diff --git a/cs/ccxt/wrappers/binance.cs b/cs/ccxt/wrappers/binance.cs index 7838a65f5459..3b3e1d6f0758 100644 --- a/cs/ccxt/wrappers/binance.cs +++ b/cs/ccxt/wrappers/binance.cs @@ -2314,6 +2314,64 @@ public async Task FetchCrossBorrowRate(string code, Dictionary< return new CrossBorrowRate(res); } /// + /// fetch the rate of interest to borrow a currency for margin trading + /// + /// + /// See
+ /// + /// + /// params + /// + /// object : extra parameters specific to the exchange API endpoint + /// + /// + /// + /// params.vipLevel + /// + /// object : user's current specific margin data will be returned if viplevel is omitted + /// + /// + /// + ///
+ /// object an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}. + public async Task FetchIsolatedBorrowRate(string symbol, Dictionary parameters = null) + { + var res = await this.fetchIsolatedBorrowRate(symbol, parameters); + return new IsolatedBorrowRate(res); + } + /// + /// fetch the borrow interest rates of all currencies + /// + /// + /// See
+ /// + /// + /// params + /// + /// object : extra parameters specific to the exchange API endpoint + /// + /// + /// + /// params.symbol + /// + /// object : unified market symbol + /// + /// + /// + /// params.vipLevel + /// + /// object : user's current specific margin data will be returned if viplevel is omitted + /// + /// + /// + ///
+ /// object a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}. + public async Task FetchIsolatedBorrowRates(Dictionary parameters = null) + { + var res = await this.fetchIsolatedBorrowRates(parameters); + return new IsolatedBorrowRates(res); + } + /// /// retrieves a history of a currencies borrow interest rate at specific time slots /// /// diff --git a/dist/ccxt.browser.js b/dist/ccxt.browser.js index 8e3fc2b1c044..845e765438e3 100644 --- a/dist/ccxt.browser.js +++ b/dist/ccxt.browser.js @@ -19171,8 +19171,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'fetchFundingRates': true, 'fetchGreeks': true, 'fetchIndexOHLCV': true, - 'fetchIsolatedBorrowRate': false, - 'fetchIsolatedBorrowRates': false, + 'fetchIsolatedBorrowRate': 'emulated', + 'fetchIsolatedBorrowRates': true, 'fetchL3OrderBook': false, 'fetchLastPrices': true, 'fetchLedger': true, @@ -30415,6 +30415,70 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa const rate = this.safeDict(response, 0); return this.parseBorrowRate(rate); } + async fetchIsolatedBorrowRate(symbol, params = {}) { + /** + * @method + * @name binance#fetchIsolatedBorrowRate + * @description fetch the rate of interest to borrow a currency for margin trading + * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data + * @param {string} symbol unified market symbol + * @param {object} [params] extra parameters specific to the exchange API endpoint + * + * EXCHANGE SPECIFIC PARAMETERS + * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted + * @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure} + */ + const request = { + 'symbol': symbol, + }; + const borrowRates = await this.fetchIsolatedBorrowRates(this.extend(request, params)); + return this.safeDict(borrowRates, symbol); + } + async fetchIsolatedBorrowRates(params = {}) { + /** + * @method + * @name binance#fetchIsolatedBorrowRates + * @description fetch the borrow interest rates of all currencies + * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data + * @param {object} [params] extra parameters specific to the exchange API endpoint + * @param {object} [params.symbol] unified market symbol + * + * EXCHANGE SPECIFIC PARAMETERS + * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted + * @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} + */ + await this.loadMarkets(); + const request = {}; + const symbol = this.safeString(params, 'symbol'); + params = this.omit(params, 'symbol'); + if (symbol !== undefined) { + const market = this.market(symbol); + request['symbol'] = market['id']; + } + const response = await this.sapiGetMarginIsolatedMarginData(this.extend(request, params)); + // + // [ + // { + // "vipLevel": 0, + // "symbol": "BTCUSDT", + // "leverage": "10", + // "data": [ + // { + // "coin": "BTC", + // "dailyInterest": "0.00026125", + // "borrowLimit": "270" + // }, + // { + // "coin": "USDT", + // "dailyInterest": "0.000475", + // "borrowLimit": "2100000" + // } + // ] + // } + // ] + // + return this.parseIsolatedBorrowRates(response); + } async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) { /** * @method @@ -30489,6 +30553,43 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa 'info': info, }; } + parseIsolatedBorrowRate(info, market = undefined) { + // + // { + // "vipLevel": 0, + // "symbol": "BTCUSDT", + // "leverage": "10", + // "data": [ + // { + // "coin": "BTC", + // "dailyInterest": "0.00026125", + // "borrowLimit": "270" + // }, + // { + // "coin": "USDT", + // "dailyInterest": "0.000475", + // "borrowLimit": "2100000" + // } + // ] + // } + // + const marketId = this.safeString(info, 'symbol'); + market = this.safeMarket(marketId, market, undefined, 'spot'); + const data = this.safeList(info, 'data'); + const baseInfo = this.safeDict(data, 0); + const quoteInfo = this.safeDict(data, 1); + return { + 'info': info, + 'symbol': this.safeString(market, 'symbol'), + 'base': this.safeString(baseInfo, 'coin'), + 'baseRate': this.safeNumber(baseInfo, 'dailyInterest'), + 'quote': this.safeString(quoteInfo, 'coin'), + 'quoteRate': this.safeNumber(quoteInfo, 'dailyInterest'), + 'period': 86400000, + 'timestamp': undefined, + 'datetime': undefined, + }; + } async createGiftCode(code, amount, params = {}) { /** * @method diff --git a/dist/ccxt.browser.min.js b/dist/ccxt.browser.min.js index dbce0a7c1bc4..da0911525c12 100644 --- a/dist/ccxt.browser.min.js +++ b/dist/ccxt.browser.min.js @@ -1,4 +1,4 @@ -(()=>{"use strict";var e={6696:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9650:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1359:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},4890:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},4611:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2244:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3108:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1868:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},657:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},4928:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3420:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2787:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2065:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5823:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},4993:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8154:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3813:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},7317:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9581:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1573:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},133:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},15:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},858:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3617:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6065:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5489:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6851:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},806:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1698:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2090:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1006:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2456:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},931:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2925:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},7089:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8519:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3378:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},7044:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},488:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3767:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},435:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},4663:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6450:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1304:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2708:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6563:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},823:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},4680:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2465:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8185:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9190:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3727:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2140:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},7758:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8402:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5563:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1106:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},7872:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3203:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3931:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5792:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5667:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3583);class r extends i.Z{}const a=r},4722:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9720:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6168:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3148:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8850:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2874:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8240:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5491:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6513:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3229:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5848:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5190:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9788:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8310:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},6123:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9192:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2735:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3480:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},7875:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},1696:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},58:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},567:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},2120:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},8888:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9564:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5307:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3771:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5790:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},5224:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},3565:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(3043);class r extends i.e{}const a=r},9869:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(6696),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"ace",name:"ACE",countries:["TW"],version:"v2",rateLimit:100,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createOrder:!0,editOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDepositAddress:!1,fetchDeposits:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!1,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,setLeverage:!1,setMarginMode:!1,transfer:!1,withdraw:!1,ws:!1},timeframes:{"1m":1,"5m":5,"10m":10,"30m":10,"1h":60,"2h":120,"4h":240,"8h":480,"12h":720,"1d":24,"1w":70,"1M":31},urls:{logo:"https://user-images.githubusercontent.com/1294454/216908003-fb314cf6-e66e-471c-b91d-1d86e4baaa90.jpg",api:{public:"https://ace.io/polarisex",private:"https://ace.io/polarisex/open"},www:"https://ace.io/",doc:["https://github.com/ace-exchange/ace-offical-api-docs"],fees:"https://helpcenter.ace.io/hc/zh-tw/articles/360018609132-%E8%B2%BB%E7%8E%87%E8%AA%AA%E6%98%8E"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:["oapi/v2/list/tradePrice","oapi/v2/list/marketPair","open/v2/public/getOrderBook"]},private:{post:["v2/coin/customerAccount","v2/kline/getKline","v2/order/order","v2/order/cancel","v2/order/getOrderList","v2/order/showOrderStatus","v2/order/showOrderHistory","v2/order/getTradeList"]}},fees:{trading:{percentage:!0,maker:this.parseNumber("0.0005"),taker:this.parseNumber("0.001")}},options:{brokerId:"ccxt"},precisionMode:o.sh,exceptions:{exact:{2003:r.InvalidOrder,2004:r.InvalidOrder,2005:r.InvalidOrder,2021:r.InsufficientFunds,2036:r.InvalidOrder,2039:r.InvalidOrder,2053:r.InvalidOrder,2061:r.BadRequest,2063:r.InvalidOrder,9996:r.BadRequest,10012:r.AuthenticationError,20182:r.AuthenticationError,20183:r.InvalidOrder},broad:{}},commonCurrencies:{}})}async fetchMarkets(e={}){const t=await this.publicGetOapiV2ListMarketPair();return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"base"),s=this.safeCurrencyCode(t),i=this.safeString(e,"quote"),r=this.safeCurrencyCode(i),a=s+"/"+r;return{id:this.safeString(e,"symbol"),uppercaseId:void 0,symbol:a,base:s,baseId:t,quote:r,quoteId:i,settle:void 0,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,limits:{amount:{min:this.safeNumber(e,"minLimitBaseAmount"),max:this.safeNumber(e,"maxLimitBaseAmount")},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0},leverage:{min:void 0,max:void 0}},precision:{price:this.parseNumber(this.parsePrecision(this.safeString(e,"quotePrecision"))),amount:this.parseNumber(this.parsePrecision(this.safeString(e,"basePrecision")))},active:void 0,created:void 0,info:e}}parseTicker(e,t=void 0){const s=this.safeString(e,"id"),i=this.safeSymbol(s,t);return this.safeTicker({symbol:i,timestamp:void 0,datetime:void 0,high:void 0,low:void 0,bid:void 0,bidVolume:void 0,ask:void 0,askVolume:void 0,vwap:void 0,open:void 0,close:this.safeString(e,"last_price"),last:this.safeString(e,"last_price"),previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:this.safeString(e,"base_volume"),quoteVolume:this.safeString(e,"quote_volume"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e),i=await this.publicGetOapiV2ListTradePrice(t),r=s.id,a=this.safeValue(i,r,{});return this.parseTicker(a,s)}async fetchTickers(e=void 0,t={}){await this.loadMarkets();const s=await this.publicGetOapiV2ListTradePrice(),i=[],r=Object.keys(s);for(let e=0;e200){const e=c.toString();this.throwExactlyMatchedException(this.exceptions.exact,e,h),this.throwBroadlyMatchedException(this.exceptions.broad,e,h)}}}},5660:(e,t,s)=>{s.d(t,{Z:()=>o});var i=s(9650),r=s(6689),a=s(9292);class o extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"alpaca",name:"Alpaca",countries:["US"],rateLimit:333,hostname:"alpaca.markets",pro:!0,urls:{logo:"https://user-images.githubusercontent.com/1294454/187234005-b864db3d-f1e3-447a-aaf9-a9fc7b955d07.jpg",www:"https://alpaca.markets",api:{broker:"https://broker-api.{hostname}",trader:"https://api.{hostname}",market:"https://data.{hostname}"},test:{broker:"https://broker-api.sandbox.{hostname}",trader:"https://paper-api.{hostname}",market:"https://data.sandbox.{hostname}"},doc:"https://alpaca.markets/docs/",fees:"https://docs.alpaca.markets/docs/crypto-fees"},has:{CORS:!1,spot:!0,margin:!1,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,fetchBalance:!1,fetchBidsAsks:!1,fetchClosedOrders:!0,fetchCurrencies:!1,fetchDepositAddress:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRates:!1,fetchL1OrderBook:!0,fetchL2OrderBook:!1,fetchMarkets:!0,fetchMyTrades:!1,fetchOHLCV:!0,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchStatus:!1,fetchTicker:!1,fetchTickers:!1,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawals:!1,setLeverage:!1,setMarginMode:!1,transfer:!1,withdraw:!1},api:{broker:{},trader:{private:{get:["v2/account","v2/orders","v2/orders/{order_id}","v2/positions","v2/positions/{symbol_or_asset_id}","v2/account/portfolio/history","v2/watchlists","v2/watchlists/{watchlist_id}","v2/watchlists:by_name","v2/account/configurations","v2/account/activities","v2/account/activities/{activity_type}","v2/calendar","v2/clock","v2/assets","v2/assets/{symbol_or_asset_id}","v2/corporate_actions/announcements/{id}","v2/corporate_actions/announcements"],post:["v2/orders","v2/watchlists","v2/watchlists/{watchlist_id}","v2/watchlists:by_name"],put:["v2/watchlists/{watchlist_id}","v2/watchlists:by_name"],patch:["v2/orders/{order_id}","v2/account/configurations"],delete:["v2/orders","v2/orders/{order_id}","v2/positions","v2/positions/{symbol_or_asset_id}","v2/watchlists/{watchlist_id}","v2/watchlists:by_name","v2/watchlists/{watchlist_id}/{symbol}"]}},market:{public:{get:["v1beta3/crypto/{loc}/bars","v1beta3/crypto/{loc}/latest/bars","v1beta3/crypto/{loc}/latest/orderbooks","v1beta3/crypto/{loc}/latest/quotes","v1beta3/crypto/{loc}/latest/trades","v1beta3/crypto/{loc}/quotes","v1beta3/crypto/{loc}/snapshots","v1beta3/crypto/{loc}/trades"]},private:{get:["v1beta1/corporate-actions","v1beta1/forex/latest/rates","v1beta1/forex/rates","v1beta1/logos/{symbol}","v1beta1/news","v1beta1/screener/stocks/most-actives","v1beta1/screener/{market_type}/movers","v2/stocks/auctions","v2/stocks/bars","v2/stocks/bars/latest","v2/stocks/meta/conditions/{ticktype}","v2/stocks/meta/exchanges","v2/stocks/quotes","v2/stocks/quotes/latest","v2/stocks/snapshots","v2/stocks/trades","v2/stocks/trades/latest","v2/stocks/{symbol}/auctions","v2/stocks/{symbol}/bars","v2/stocks/{symbol}/bars/latest","v2/stocks/{symbol}/quotes","v2/stocks/{symbol}/quotes/latest","v2/stocks/{symbol}/snapshot","v2/stocks/{symbol}/trades","v2/stocks/{symbol}/trades/latest"]}}},timeframes:{"1m":"1min","3m":"3min","5m":"5min","15m":"15min","30m":"30min","1h":"1H","2h":"2H","4h":"4H","6h":"6H","8h":"8H","12h":"12H","1d":"1D","3d":"3D","1w":"1W","1M":"1M"},precisionMode:a.sh,requiredCredentials:{apiKey:!0,secret:!0},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.0015"),taker:this.parseNumber("0.0025"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0022")],[this.parseNumber("500000"),this.parseNumber("0.0020")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("10000000"),this.parseNumber("0.0015")],[this.parseNumber("25000000"),this.parseNumber("0.0013")],[this.parseNumber("50000000"),this.parseNumber("0.0012")],[this.parseNumber("100000000"),this.parseNumber("0.001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.0012")],[this.parseNumber("500000"),this.parseNumber("0.001")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("10000000"),this.parseNumber("0.0005")],[this.parseNumber("25000000"),this.parseNumber("0.0002")],[this.parseNumber("50000000"),this.parseNumber("0.0002")],[this.parseNumber("100000000"),this.parseNumber("0.00")]]}}},headers:{"APCA-PARTNER-ID":"ccxt"},options:{defaultExchange:"CBSE",exchanges:["CBSE","FTX","GNSS","ERSX"],defaultTimeInForce:"gtc",clientOrderId:"ccxt_{id}"},exceptions:{exact:{"forbidden.":r.PermissionDenied,4041e4:r.InvalidOrder,40010001:r.BadRequest,4011e4:r.PermissionDenied,4031e4:r.InsufficientFunds,4291e4:r.RateLimitExceeded},broad:{"Invalid format for parameter":r.BadRequest,"Invalid symbol":r.BadSymbol}}})}async fetchTime(e={}){const t=await this.traderPrivateGetV2Clock(e),s=this.safeString(t,"timestamp"),i=s.slice(0,23),r=s.length-6,a=s.length-3,o=s.slice(r,a);return this.parse8601(i)-3600*this.parseToNumeric(o)*1e3}async fetchMarkets(e={}){const t=await this.traderPrivateGetV2Assets(this.extend({asset_class:"crypto",status:"active"},e));return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"symbol"),s=t.split("/"),i=this.safeString(e,"class"),r=this.safeString(s,0),a=this.safeString(s,1),o=this.safeCurrencyCode(r);let n=this.safeCurrencyCode(a);void 0===n&&"us_equity"===i&&(n="USD");const d=o+"/"+n,h="active"===this.safeString(e,"status"),c=this.safeNumber(e,"min_order_size");return{id:t,symbol:d,base:o,quote:n,settle:void 0,baseId:r,quoteId:a,settleId:void 0,type:"spot",spot:!0,margin:void 0,swap:!1,future:!1,option:!1,active:h,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(e,"min_trade_increment"),price:this.safeNumber(e,"price_increment")},limits:{leverage:{min:void 0,max:void 0},amount:{min:c,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e}}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const a=this.market(e),o=a.id,n=this.safeString(i,"loc","us"),d=this.safeString(i,"method","marketPublicGetV1beta3CryptoLocTrades"),h={symbols:o,loc:n};let c;if(i=this.omit(i,["loc","method"]),"marketPublicGetV1beta3CryptoLocTrades"===d){void 0!==t&&(h.start=this.iso8601(t)),void 0!==s&&(h.limit=s);const e=await this.marketPublicGetV1beta3CryptoLocTrades(this.extend(h,i)),r=this.safeDict(e,"trades",{});c=this.safeList(r,o,[])}else{if("marketPublicGetV1beta3CryptoLocLatestTrades"!==d)throw new r.NotSupported(this.id+" fetchTrades() does not support "+d+", marketPublicGetV1beta3CryptoLocTrades and marketPublicGetV1beta3CryptoLocLatestTrades are supported");{const e=await this.marketPublicGetV1beta3CryptoLocLatestTrades(this.extend(h,i)),t=this.safeDict(e,"trades",{});c=this.safeDict(t,o,{}),c=[c]}}return this.parseTrades(c,a,t,s)}async fetchOrderBook(e,t=void 0,s={}){await this.loadMarkets();const i=this.market(e),r=i.id,a={symbols:r,loc:this.safeString(s,"loc","us")},o=await this.marketPublicGetV1beta3CryptoLocLatestOrderbooks(this.extend(a,s)),n=this.safeValue(o,"orderbooks",{}),d=this.safeValue(n,r,{}),h=this.parse8601(this.safeString(d,"t"));return this.parseOrderBook(d,i.symbol,h,"b","a","p","s")}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=o.id,d=this.safeString(a,"loc","us"),h=this.safeString(a,"method","marketPublicGetV1beta3CryptoLocBars"),c={symbols:n,loc:d};let l;if(a=this.omit(a,["loc","method"]),"marketPublicGetV1beta3CryptoLocBars"===h){void 0!==i&&(c.limit=i),void 0!==s&&(c.start=this.yyyymmdd(s)),c.timeframe=this.safeString(this.timeframes,t,t);const e=await this.marketPublicGetV1beta3CryptoLocBars(this.extend(c,a)),r=this.safeDict(e,"bars",{});l=this.safeList(r,n,[])}else{if("marketPublicGetV1beta3CryptoLocLatestBars"!==h)throw new r.NotSupported(this.id+" fetchOHLCV() does not support "+h+", marketPublicGetV1beta3CryptoLocBars and marketPublicGetV1beta3CryptoLocLatestBars are supported");{const e=await this.marketPublicGetV1beta3CryptoLocLatestBars(this.extend(c,a)),t=this.safeDict(e,"bars",{});l=this.safeDict(t,n,{}),l=[l]}}return this.parseOHLCVs(l,o,t,s,i)}parseOHLCV(e,t=void 0){const s=this.safeString(e,"t");return[this.parse8601(s),this.safeNumber(e,"o"),this.safeNumber(e,"h"),this.safeNumber(e,"l"),this.safeNumber(e,"c"),this.safeNumber(e,"v")]}async createOrder(e,t,s,i,a=void 0,o={}){await this.loadMarkets();const n=this.market(e),d={symbol:n.id,qty:this.amountToPrecision(e,i),side:s,type:t},h=this.safeStringN(o,["triggerPrice","stop_price"]);if(void 0!==h){let s;if(!(t.indexOf("limit")>=0))throw new r.NotSupported(this.id+" createOrder() does not support stop orders for "+t+" orders, only stop_limit orders are supported");s="stop_limit",d.stop_price=this.priceToPrecision(e,h),d.type=s}t.indexOf("limit")>=0&&(d.limit_price=this.priceToPrecision(e,a));const c=this.safeString(this.options,"defaultTimeInForce");d.time_in_force=this.safeString(o,"timeInForce",c),o=this.omit(o,["timeInForce","triggerPrice"]);const l=this.safeString(this.options,"clientOrderId"),u=this.uuid().split("-").join(""),p=this.implodeParams(l,{id:u}),f=this.safeString(o,"clientOrderId",p);d.client_order_id=f,o=this.omit(o,["clientOrderId"]);const m=await this.traderPrivatePostV2Orders(this.extend(d,o));return this.parseOrder(m,n)}async cancelOrder(e,t=void 0,s={}){const i={order_id:e},r=await this.traderPrivateDeleteV2OrdersOrderId(this.extend(i,s));return this.safeValue(r,"message",{})}async cancelAllOrders(e=void 0,t={}){await this.loadMarkets();const s=await this.traderPrivateDeleteV2Orders(t);return Array.isArray(s)?this.parseOrders(s,void 0):s}async fetchOrder(e,t=void 0,s={}){await this.loadMarkets();const i={order_id:e},r=await this.traderPrivateGetV2OrdersOrderId(this.extend(i,s)),a=this.safeString(r,"symbol"),o=this.safeMarket(a);return this.parseOrder(r,o)}async fetchOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={status:"all"};let a;void 0!==e&&(a=this.market(e),r.symbols=a.id);const o=this.safeInteger(i,"until");void 0!==o&&(i=this.omit(i,"until"),r.endTime=o),void 0!==t&&(r.after=t),void 0!==s&&(r.limit=s);const n=await this.traderPrivateGetV2Orders(this.extend(r,i));return this.parseOrders(n,a,t,s)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchOrders(e,t,s,this.extend({status:"open"},i))}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchOrders(e,t,s,this.extend({status:"closed"},i))}parseOrder(e,t=void 0){const s=this.safeString(e,"symbol"),i=(t=this.safeMarket(s,t)).symbol,r=this.safeString(e,"status"),a=this.parseOrderStatus(r),o=this.safeString(e,"commission");let n;void 0!==o&&(n={cost:o,currency:"USD"});let d=this.safeString(e,"order_type");void 0!==d&&d.indexOf("limit")>=0&&(d="limit");const h=this.safeString(e,"submitted_at"),c=this.parse8601(h);return this.safeOrder({id:this.safeString(e,"id"),clientOrderId:this.safeString(e,"client_order_id"),timestamp:c,datetime:h,lastTradeTimeStamp:void 0,status:a,symbol:i,type:d,timeInForce:this.parseTimeInForce(this.safeString(e,"time_in_force")),postOnly:void 0,side:this.safeString(e,"side"),price:this.safeNumber(e,"limit_price"),stopPrice:this.safeNumber(e,"stop_price"),triggerPrice:this.safeNumber(e,"stop_price"),cost:void 0,average:this.safeNumber(e,"filled_avg_price"),amount:this.safeNumber(e,"qty"),filled:this.safeNumber(e,"filled_qty"),remaining:void 0,trades:void 0,fee:n,info:e},t)}parseOrderStatus(e){return this.safeString({pending_new:"open",accepted:"open",new:"open",partially_filled:"open",activated:"open",filled:"closed"},e,e)}parseTimeInForce(e){return this.safeString({day:"Day"},e,e)}parseTrade(e,t=void 0){const s=this.safeString(e,"S"),i=this.safeSymbol(s,t),r=this.safeString(e,"t"),a=this.parse8601(r),o=this.safeString(e,"tks");let n;"B"===o?n="buy":"S"===o&&(n="sell");const d=this.safeString(e,"p"),h=this.safeString(e,"s");return this.safeTrade({info:e,id:this.safeString(e,"i"),timestamp:a,datetime:this.iso8601(a),symbol:i,order:void 0,type:void 0,side:n,takerOrMaker:"taker",price:d,amount:h,cost:void 0,fee:void 0},t)}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/"+this.implodeParams(e,i),n=this.implodeHostname(this.urls.api[t[0]]);r=void 0!==r?r:{},"private"===t[1]&&(r["APCA-API-KEY-ID"]=this.apiKey,r["APCA-API-SECRET-KEY"]=this.secret);const d=this.omit(i,this.extractParams(e));return Object.keys(d).length&&("GET"===s||"DELETE"===s?o+="?"+this.urlencode(d):(a=this.json(d),r["Content-Type"]="application/json")),n+=o,{url:n,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.id+" "+o,l=this.safeString(n,"code");void 0!==e&&this.throwExactlyMatchedException(this.exceptions.exact,l,c);const u=this.safeValue(n,"message",void 0);if(void 0!==u)throw this.throwExactlyMatchedException(this.exceptions.exact,u,c),this.throwBroadlyMatchedException(this.exceptions.broad,u,c),new r.ExchangeError(c)}}},9612:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(1359),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"ascendex",name:"AscendEX",countries:["SG"],rateLimit:400,certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:"emulated",fetchFundingRateHistory:!1,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!0,fetchMarginMode:"emulated",fetchMarginModes:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!1,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!1,transfer:!0},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","2h":"120","4h":"240","6h":"360","12h":"720","1d":"1d","1w":"1w","1M":"1m"},version:"v2",urls:{logo:"https://user-images.githubusercontent.com/1294454/112027508-47984600-8b48-11eb-9e17-d26459cc36c6.jpg",api:{rest:"https://ascendex.com"},test:{rest:"https://api-test.ascendex-sandbox.com"},www:"https://ascendex.com",doc:["https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation"],fees:"https://ascendex.com/en/feerate/transactionfee-traderate",referral:{url:"https://ascendex.com/en-us/register?inviteCode=EL6BXBQM",discount:.25}},api:{v1:{public:{get:{assets:1,products:1,ticker:1,"barhist/info":1,barhist:1,depth:1,trades:1,"cash/assets":1,"cash/products":1,"margin/assets":1,"margin/products":1,"futures/collateral":1,"futures/contracts":1,"futures/ref-px":1,"futures/market-data":1,"futures/funding-rates":1,"risk-limit-info":1,"exchange-info":1}},private:{get:{info:1,"wallet/transactions":1,"wallet/deposit/address":1,"data/balance/snapshot":1,"data/balance/history":1},accountCategory:{get:{balance:1,"order/open":1,"order/status":1,"order/hist/current":1,risk:1},post:{order:1,"order/batch":1},delete:{order:1,"order/all":1,"order/batch":1}},accountGroup:{get:{"cash/balance":1,"margin/balance":1,"margin/risk":1,"futures/collateral-balance":1,"futures/position":1,"futures/risk":1,"futures/funding-payments":1,"order/hist":1,"spot/fee":1},post:{transfer:1,"futures/transfer/deposit":1,"futures/transfer/withdraw":1}}}},v2:{public:{get:{assets:1,"futures/contract":1,"futures/collateral":1,"futures/pricing-data":1,"futures/ticker":1,"risk-limit-info":1}},private:{data:{get:{"order/hist":1}},get:{"account/info":1},accountGroup:{get:{"order/hist":1,"futures/position":1,"futures/free-margin":1,"futures/order/hist/current":1,"futures/funding-payments":1,"futures/order/open":1,"futures/order/status":1},post:{"futures/isolated-position-margin":1,"futures/margin-type":1,"futures/leverage":1,"futures/transfer/deposit":1,"futures/transfer/withdraw":1,"futures/order":1,"futures/order/batch":1,"futures/order/open":1,"subuser/subuser-transfer":1,"subuser/subuser-transfer-hist":1},delete:{"futures/order":1,"futures/order/batch":1,"futures/order/all":1}}}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")}},precisionMode:o.sh,options:{"account-category":"cash","account-group":void 0,fetchClosedOrders:{method:"v2PrivateDataGetOrderHist"},defaultType:"spot",accountsByType:{spot:"cash",swap:"futures",margin:"margin"},transfer:{fillResponseFromRequest:!0},networks:{BSC:"BEP20 (BSC)",ARB:"arbitrum",SOL:"Solana",AVAX:"avalanche C chain",OMNI:"Omni",TRC:"TRC20",TRX:"TRC20",ERC:"ERC20"},networksById:{"BEP20 (BSC)":"BSC",arbitrum:"ARB",Solana:"SOL","avalanche C chain":"AVAX",Omni:"OMNI",TRC20:"TRC20",ERC20:"ERC20",GO20:"GO20",BEP2:"BEP2",Bitcoin:"BTC","Bitcoin ABC":"BCH",Litecoin:"LTC","Matic Network":"MATIC",xDai:"STAKE",Akash:"AKT"}},exceptions:{exact:{1900:r.BadRequest,2100:r.AuthenticationError,5002:r.BadSymbol,6001:r.BadSymbol,6010:r.InsufficientFunds,60060:r.InvalidOrder,600503:r.InvalidOrder,100001:r.BadRequest,100002:r.BadRequest,100003:r.BadRequest,100004:r.BadRequest,100005:r.BadRequest,100006:r.BadRequest,100007:r.BadRequest,100008:r.BadSymbol,100009:r.AuthenticationError,100010:r.BadRequest,100011:r.BadRequest,100012:r.BadRequest,100013:r.BadRequest,100101:r.ExchangeError,150001:r.BadRequest,200001:r.AuthenticationError,200002:r.ExchangeError,200003:r.ExchangeError,200004:r.ExchangeError,200005:r.ExchangeError,200006:r.ExchangeError,200007:r.ExchangeError,200008:r.ExchangeError,200009:r.ExchangeError,200010:r.AuthenticationError,200011:r.ExchangeError,200012:r.ExchangeError,200013:r.ExchangeError,200014:r.PermissionDenied,200015:r.PermissionDenied,300001:r.InvalidOrder,300002:r.InvalidOrder,300003:r.InvalidOrder,300004:r.InvalidOrder,300005:r.InvalidOrder,300006:r.InvalidOrder,300007:r.InvalidOrder,300008:r.InvalidOrder,300009:r.InvalidOrder,300011:r.InsufficientFunds,300012:r.BadSymbol,300013:r.InvalidOrder,300014:r.InvalidOrder,300020:r.InvalidOrder,300021:r.AccountSuspended,300031:r.InvalidOrder,310001:r.InsufficientFunds,310002:r.InvalidOrder,310003:r.InvalidOrder,310004:r.BadSymbol,310005:r.InvalidOrder,510001:r.ExchangeError,900001:r.ExchangeError},broad:{}},commonCurrencies:{BOND:"BONDED",BTCBEAR:"BEAR",BTCBULL:"BULL",BYN:"BeyondFi",PLN:"Pollen"}})}getAccount(e={}){const t=this.safeValue(e,"account",this.options.account).toLowerCase();return this.capitalize(t)}async fetchCurrencies(e={}){const t=await this.v1PublicGetAssets(e),s=await this.v1PublicGetMarginAssets(e),i=await this.v1PublicGetCashAssets(e),r=this.safeValue(t,"data",[]),a=this.safeValue(s,"data",[]),o=this.safeValue(i,"data",[]),n=this.indexBy(r,"assetCode"),d=this.indexBy(a,"assetCode"),h=this.indexBy(o,"assetCode"),c=this.deepExtend(n,d,h),l=Object.keys(c),u={};for(let e=0;e1){const e=this.indexBy(h,"chainName");if(void 0===a){const t=Object.keys(e).join(", ");throw new r.ArgumentsRequired(this.id+" fetchDepositAddress() returned more than one address, a chainName parameter is required, one of "+t)}c=this.safeDict(e,a,{})}else c=this.safeDict(h,0,{});const l=this.parseDepositAddress(c,s);return this.extend(l,{info:n})}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactions(e,t,s,this.extend({txType:"deposit"},i))}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactions(e,t,s,this.extend({txType:"withdrawal"},i))}async fetchDepositsWithdrawals(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};let a;void 0!==e&&(a=this.currency(e),r.asset=a.id),void 0!==t&&(r.startTs=t),void 0!==s&&(r.pageSize=s);const o=await this.v1PrivateGetWalletTransactions(this.extend(r,i)),n=this.safeValue(o,"data",{}),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,s)}parseTransactionStatus(e){return this.safeString({reviewing:"pending",pending:"pending",confirmed:"ok",rejected:"rejected"},e,e)}parseTransaction(e,t=void 0){const s=this.safeValue(e,"destAddress",{}),i=this.safeString(s,"address"),r=this.safeString(s,"destTag"),o=this.safeInteger(e,"time"),n=this.safeString(e,"asset");let d=this.safeString(e,"amount");const h=this.safeString(e,"commission");d=a.O.stringSub(d,h);const c=this.safeCurrencyCode(n,t);return{info:e,id:this.safeString(e,"requestId"),txid:this.safeString(e,"networkTransactionId"),type:this.safeString(e,"transactionType"),currency:c,network:void 0,amount:this.parseNumber(d),status:this.parseTransactionStatus(this.safeString(e,"status")),timestamp:o,datetime:this.iso8601(o),address:i,addressFrom:void 0,addressTo:i,tag:r,tagFrom:void 0,tagTo:r,updated:void 0,comment:void 0,fee:{currency:c,cost:this.parseNumber(h),rate:void 0},internal:!1}}async fetchPositions(e=void 0,t={}){await this.loadMarkets(),await this.loadAccounts();const s=this.safeValue(this.accounts,0,{}),i={"account-group":this.safeString(s,"id")},r=await this.v2PrivateAccountGroupGetFuturesPosition(this.extend(i,t)),a=this.safeValue(r,"data",{}),o=this.safeValue(a,"contracts",[]),n=[];for(let e=0;e100)throw new r.BadRequest(this.id+" leverage should be between 1 and 100");await this.loadMarkets(),await this.loadAccounts();const i=this.market(t);if(!i.swap)throw new r.BadSymbol(this.id+" setLeverage() supports swap contracts only");const a=this.safeValue(this.accounts,0,{}),o={"account-group":this.safeString(a,"id"),symbol:i.id,leverage:e};return await this.v2PrivateAccountGroupPostFuturesLeverage(this.extend(o,s))}async setMarginMode(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("cross"===(e=e.toLowerCase())&&(e="crossed"),"isolated"!==e&&"crossed"!==e)throw new r.BadRequest(this.id+" setMarginMode() marginMode argument should be isolated or cross");await this.loadMarkets(),await this.loadAccounts();const i=this.market(t),a=this.safeValue(this.accounts,0,{}),o={"account-group":this.safeString(a,"id"),symbol:i.id,marginType:e};if(!i.swap)throw new r.BadSymbol(this.id+" setMarginMode() supports swap contracts only");return await this.v2PrivateAccountGroupPostFuturesMarginType(this.extend(o,s))}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const s=await this.v2PublicGetFuturesContract(t),i=this.safeValue(s,"data");return e=this.marketSymbols(e),this.parseLeverageTiers(i,e,"symbol")}parseMarketLeverageTiers(e,t=void 0){const s=this.safeValue(e,"marginRequirements",[]),i=this.safeString(e,"symbol");t=this.safeMarket(i,t);const r=[];for(let e=0;e=0){const e=u.split("/");u=e[2]}if(i=this.omit(i,this.extractParams(e)),"public"===d)Object.keys(i).length&&(c+="?"+this.urlencode(i));else{this.checkRequiredCredentials();const e=this.milliseconds().toString(),t=e+"+"+u,o=this.hmac(this.encode(t),this.encode(this.secret),n.J,"base64");r={"x-auth-key":this.apiKey,"x-auth-timestamp":e,"x-auth-signature":o},"GET"===s?Object.keys(i).length&&(c+="?"+this.urlencode(i)):(r["Content-Type"]="application/json",a=this.json(i))}return c=this.urls.api.rest+c,{url:c,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code"),l=this.safeString(n,"message");if(void 0!==c&&"0"!==c||void 0!==l){const e=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,c,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e),this.throwBroadlyMatchedException(this.exceptions.broad,l,e),new r.ExchangeError(e)}}}},3043:(e,t,s)=>{s.d(t,{e:()=>ct});var i=s(7100),r=s(927),a=s(2116),o=s(6689),n=s(2194),d=s(7517),h=s(2367),c=s(7091),l=s(6890),u=s(2523),p=s(7090),f=s(7843),m=s(2491);const{isNode:g,deepExtend:v,extend:y,clone:w,flatten:b,unique:S,indexBy:k,sortBy:O,sortBy2:T,safeFloat2:P,groupBy:x,aggregate:I,uuid:M,unCamelCase:A,precisionFromString:C,Throttler:E,capitalize:_,now:B,decimalToPrecision:N,safeValue:R,safeValue2:L,safeString:V,safeString2:D,seconds:q,milliseconds:F,binaryToBase16:G,numberToBE:H,base16ToBinary:U,iso8601:W,omit:j,isJsonEncodedObject:K,safeInteger:z,sum:Z,omitZero:X,implodeParams:Q,extractParams:Y,json:J,merge:$,binaryConcat:ee,hash:te,ecdsa:se,arrayConcat:ie,encode:re,urlencode:ae,hmac:oe,numberToString:ne,parseTimeframe:de,safeInteger2:he,safeStringLower:ce,parse8601:le,yyyymmdd:ue,safeStringUpper:pe,safeTimestamp:fe,binaryConcatArray:me,uuidv1:ge,numberToLE:ve,ymdhms:ye,stringToBase64:we,decode:be,uuid22:Se,safeIntegerProduct2:ke,safeIntegerProduct:Oe,safeStringLower2:Te,yymmdd:Pe,base58ToBinary:xe,binaryToBase58:Ie,safeTimestamp2:Me,rawencode:Ae,keysort:Ce,inArray:Ee,isEmpty:_e,ordered:Be,filterBy:Ne,uuid16:Re,safeFloat:Le,base64ToBinary:Ve,safeStringUpper2:De,urlencodeWithArrayRepeat:qe,microseconds:Fe,binaryToBase64:Ge,strip:He,toArray:Ue,safeFloatN:We,safeIntegerN:je,safeIntegerProductN:Ke,safeTimestampN:ze,safeValueN:Ze,safeStringN:Xe,safeStringLowerN:Qe,safeStringUpperN:Ye,urlencodeNested:Je,parseDate:$e,ymd:et,base64ToString:tt,crc32:st,packb:it,TRUNCATE:rt,ROUND:at,DECIMAL_PLACES:ot,NO_PADDING:nt,TICK_SIZE:dt,SIGNIFICANT_DIGITS:ht}=i;class ct{constructor(e={}){this.throttleProp=void 0,this.api=void 0,this.userAgent=void 0,this.user_agent=void 0,this.userAgents={chrome:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36",chrome39:"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36",chrome100:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"},this.headers={},this.origin="*",this.agent=void 0,this.nodeHttpModuleLoaded=!1,this.httpAgent=void 0,this.httpsAgent=void 0,this.minFundingAddressLength=1,this.substituteCommonCurrencyCodes=!0,this.quoteJsonNumbers=!0,this.number=Number,this.handleContentTypeApplicationZip=!1,this.reduceFees=!0,this.validateServerSsl=!0,this.validateClientSsl=!1,this.timeout=1e4,this.verbose=!1,this.twofa=void 0,this.balance={},this.orderbooks={},this.tickers={},this.bidsasks={},this.orders=void 0,this.triggerOrders=void 0,this.transactions={},this.requiresWeb3=!1,this.requiresEddsa=!1,this.enableLastJsonResponse=!0,this.enableLastHttpResponse=!0,this.enableLastResponseHeaders=!0,this.last_http_response=void 0,this.last_json_response=void 0,this.last_response_headers=void 0,this.last_request_headers=void 0,this.last_request_body=void 0,this.last_request_url=void 0,this.last_request_path=void 0,this.id="Exchange",this.markets=void 0,this.status=void 0,this.rateLimit=void 0,this.tokenBucket=void 0,this.throttler=void 0,this.enableRateLimit=void 0,this.httpExceptions=void 0,this.markets_by_id=void 0,this.symbols=void 0,this.ids=void 0,this.currencies={},this.baseCurrencies=void 0,this.quoteCurrencies=void 0,this.currencies_by_id=void 0,this.codes=void 0,this.reloadingMarkets=void 0,this.marketsLoading=void 0,this.accounts=void 0,this.accountsById=void 0,this.commonCurrencies=void 0,this.hostname=void 0,this.precisionMode=void 0,this.paddingMode=void 0,this.exceptions={},this.timeframes={},this.version=void 0,this.marketsByAltname=void 0,this.name=void 0,this.targetAccount=void 0,this.stablePairs={},this.clients={},this.newUpdates=!0,this.streaming={},this.alias=!1,this.deepExtend=v,this.isNode=g,this.keys=r.XP,this.values=r.VO,this.extend=y,this.clone=w,this.flatten=b,this.unique=S,this.indexBy=k,this.sortBy=O,this.sortBy2=T,this.groupBy=x,this.aggregate=I,this.uuid=M,this.unCamelCase=A,this.precisionFromString=C,this.capitalize=_,this.now=B,this.decimalToPrecision=N,this.safeValue=R,this.safeValue2=L,this.safeString=V,this.safeString2=D,this.safeFloat=Le,this.safeFloat2=P,this.seconds=q,this.milliseconds=F,this.binaryToBase16=G,this.numberToBE=H,this.base16ToBinary=U,this.iso8601=W,this.omit=j,this.isJsonEncodedObject=K,this.safeInteger=z,this.sum=Z,this.omitZero=X,this.implodeParams=Q,this.extractParams=Y,this.json=J,this.vwap=a.KY,this.merge=$,this.binaryConcat=ee,this.hash=te,this.arrayConcat=ie,this.encode=re,this.urlencode=ae,this.hmac=oe,this.numberToString=ne,this.parseTimeframe=de,this.safeInteger2=he,this.safeStringLower=ce,this.parse8601=le,this.yyyymmdd=ue,this.safeStringUpper=pe,this.safeTimestamp=fe,this.binaryConcatArray=me,this.uuidv1=ge,this.numberToLE=ve,this.ymdhms=ye,this.yymmdd=Pe,this.stringToBase64=we,this.decode=be,this.uuid22=Se,this.safeIntegerProduct2=ke,this.safeIntegerProduct=Oe,this.binaryToBase58=Ie,this.base58ToBinary=xe,this.base64ToBinary=Ve,this.safeTimestamp2=Me,this.rawencode=Ae,this.keysort=Ce,this.inArray=Ee,this.safeStringLower2=Te,this.safeStringUpper2=De,this.isEmpty=_e,this.ordered=Be,this.filterBy=Ne,this.uuid16=Re,this.urlencodeWithArrayRepeat=qe,this.microseconds=Fe,this.binaryToBase64=Ge,this.strip=He,this.toArray=Ue,this.safeFloatN=We,this.safeIntegerN=je,this.safeIntegerProductN=Ke,this.safeTimestampN=ze,this.safeValueN=Ze,this.safeStringN=Xe,this.safeStringLowerN=Qe,this.safeStringUpperN=Ye,this.urlencodeNested=Je,this.parseDate=$e,this.ymd=et,this.base64ToString=tt,this.crc32=st,this.packb=it,this.httpProxyAgentModule=void 0,this.httpsProxyAgentModule=void 0,this.socksProxyAgentModule=void 0,this.socksProxyAgentModuleChecked=!1,this.proxyDictionaries={},this.proxiesModulesLoading=void 0,Object.assign(this,i),this.options=this.getDefaultOptions(),this.headers={},this.origin="*",this.minFundingAddressLength=1,this.substituteCommonCurrencyCodes=!0,this.quoteJsonNumbers=!0,this.number=Number,this.handleContentTypeApplicationZip=!1,this.reduceFees=!0,this.fetchImplementation=void 0,this.validateServerSsl=!0,this.validateClientSsl=!1,this.timeout=1e4,this.verbose=!1,this.twofa=void 0,this.apiKey=void 0,this.secret=void 0,this.uid=void 0,this.login=void 0,this.password=void 0,this.privateKey=void 0,this.walletAddress=void 0,this.token=void 0,this.balance={},this.orderbooks={},this.tickers={},this.orders=void 0,this.trades={},this.transactions={},this.ohlcvs={},this.myTrades=void 0,this.positions=void 0,this.requiresWeb3=!1,this.requiresEddsa=!1,this.lastRestRequestTimestamp=0,this.enableLastJsonResponse=!0,this.enableLastHttpResponse=!0,this.enableLastResponseHeaders=!0,this.last_http_response=void 0,this.last_json_response=void 0,this.last_response_headers=void 0,this.last_request_headers=void 0,this.last_request_body=void 0,this.last_request_url=void 0,this.last_request_path=void 0;const t=(e=this)=>{if(null!==e){const s=Object.getOwnPropertyNames(e);for(let e=0;ep&&(s=!1),c===p&&(l>f||l===f&&u>m)&&(s=!1),!s){if(t)throw new o.NotSupported("Your current version of CCXT is "+ct.ccxtVersion+", a newer version "+e+" is required, please, upgrade your version of CCXT");return t}return s}checkAddress(e){if(void 0===e)throw new o.InvalidAddress(this.id+" address is undefined");if(1===this.unique(e).length||e.length0?1/this.rateLimit:Number.MAX_VALUE},this.tokenBucket),this.throttler=new E(this.tokenBucket)}throttle(e=void 0){return this.throttler.throttle(e)}defineRestApiEndpoint(e,t,s,i,r,a,o={}){const n=r.split(/[^a-zA-Z0-9]/),d=n.map(this.capitalize).join(""),h=n.map((e=>e.trim().toLowerCase())).filter((e=>e.length>0)).join("_"),c=[a[0]].concat(a.slice(1).map(this.capitalize)).join(""),l=[a[0]].concat(a.slice(1).map((e=>e.trim())).filter((e=>e.length>0))).join("_"),u=c+i+this.capitalize(d),p=l+"_"+s+"_"+h,f=a.length>1?a:a[0],m=async(s={},i={})=>this[e](r,f,t,s,void 0,void 0,o,i);this[u]=m,this[p]=m}defineRestApi(e,t,s=[]){const i=Object.keys(e);for(let r=0;r{try{this.httpProxyAgentModule=await import("../static_dependencies/proxies/http-proxy-agent/index.js"),this.httpsProxyAgentModule=await import("../static_dependencies/proxies/https-proxy-agent/index.js")}catch(e){try{this.httpProxyAgentModule=await import("http-proxy-agent"),this.httpProxyAgentModule=await import("https-proxy-agent")}catch(e){}}if(!1===this.socksProxyAgentModuleChecked){try{this.socksProxyAgentModule=await import("socks-proxy-agent")}catch(e){}this.socksProxyAgentModuleChecked=!0}})()),await this.proxiesModulesLoading}setProxyAgents(e,t,s){let i;if(!g&&(e||t||s))throw new o.NotSupported(this.id+' - proxies in browser-side projects are not supported. You have several choices: [A] Use `exchange.proxyUrl` property to redirect requests through local/remote cors-proxy server (find sample file named "sample-local-proxy-server-with-cors" in https://github.com/ccxt/ccxt/tree/master/examples/ folder, which can be used for REST requests only) [B] override `exchange.fetch` && `exchange.watch` methods to send requests through your custom proxy');if(e){if(void 0===this.httpProxyAgentModule)throw new o.NotSupported(this.id+" you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies");e in this.proxyDictionaries||(this.proxyDictionaries[e]=new this.httpProxyAgentModule.HttpProxyAgent(e)),i=this.proxyDictionaries[e]}else if(t){if(void 0===this.httpsProxyAgentModule)throw new o.NotSupported(this.id+" you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies");t in this.proxyDictionaries||(this.proxyDictionaries[t]=new this.httpsProxyAgentModule.HttpsProxyAgent(t)),i=this.proxyDictionaries[t],i.keepAlive=!0}else if(s){if(void 0===this.socksProxyAgentModule)throw new o.NotSupported(this.id+' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" and then initialize proxies with `.loadProxyModules()` method');s in this.proxyDictionaries||(this.proxyDictionaries[s]=new this.socksProxyAgentModule.SocksProxyAgent(s)),i=this.proxyDictionaries[s]}return i}async loadHttpProxyAgent(){if(!this.httpAgent){const e=await import("node:http");this.httpAgent=new e.Agent}return this.httpAgent}getHttpAgentIfNeeded(e){if(g&&"ws://"===e.substring(0,5)){if(void 0===this.httpAgent)throw new o.NotSupported(this.id+" to use proxy with non-ssl ws:// urls, at first run `await exchange.loadHttpProxyAgent()` method");return this.httpAgent}}async fetch(e,t="GET",s=void 0,i=void 0){if(g&&!this.nodeHttpModuleLoaded){this.nodeHttpModuleLoaded=!0;const e=await import("node:https");this.httpsAgent=new e.Agent({keepAlive:!0})}s=this.extend(this.headers,s);const r=this.checkProxyUrlSettings(e,t,s,i);let a=!1;void 0!==r&&(g&&(s=this.extend({Origin:this.origin},s),"http:"===r.substring(0,5)&&(await this.loadHttpProxyAgent(),a=this.httpAgent)),e=r+e);const[n,d,h]=this.checkProxySettings(e,t,s,i);this.checkConflictingProxies(n||d||h,r),g&&await this.loadProxyModules();const c=this.setProxyAgents(n,d,h),l=void 0!==this.userAgent?this.userAgent:this.user_agent;if(l&&g&&("string"==typeof l?s=this.extend({"User-Agent":l},s):"object"==typeof l&&"User-Agent"in l&&(s=this.extend(l,s))),s=this.setHeaders(s),this.verbose&&this.log("fetch Request:\n",this.id,t,e,"\nRequestHeaders:\n",s,"\nRequestBody:\n",i,"\n"),void 0===this.fetchImplementation)if(g){void 0===this.agent&&(this.agent=this.httpsAgent);try{const e=await import("../static_dependencies/node-fetch/index.js");this.AbortError=e.AbortError,this.fetchImplementation=e.default,this.FetchError=e.FetchError}catch(e){if("function"!=typeof fetch)throw new Error('Seems, "fetch" function is not available in your node-js version, please use latest node-js version');this.fetchImplementation=fetch,this.AbortError=DOMException,this.FetchError=TypeError}}else this.fetchImplementation=self.fetch,this.AbortError=DOMException,this.FetchError=TypeError;const u=this.fetchImplementation,p={method:t,headers:s,body:i,timeout:this.timeout};this.agent&&(p.agent=this.agent),a?p.agent=a:c&&(p.agent=c);const f=new AbortController;p.signal=f.signal;const m=setTimeout((()=>{f.abort()}),this.timeout);try{const r=await u(e,p);return clearTimeout(m),this.handleRestResponse(r,e,t,s,i)}catch(s){if(s instanceof this.AbortError)throw new o.RequestTimeout(this.id+" "+t+" "+e+" request timed out ("+this.timeout+" ms)");if(s instanceof this.FetchError)throw new o.NetworkError(this.id+" "+t+" "+e+" fetch failed");throw s}}parseJson(e){try{if(this.isJsonEncodedObject(e))return JSON.parse(this.onJsonResponse(e))}catch(e){return}}getResponseHeaders(e){const t={};return e.headers.forEach(((e,s)=>{s=s.split("-").map((e=>this.capitalize(e))).join("-"),t[s]=e})),t}handleRestResponse(e,t,s="GET",i=void 0,r=void 0){const a=this.getResponseHeaders(e);if(this.handleContentTypeApplicationZip&&"application/zip"===a["Content-Type"]){const i=e.buffer();return this.enableLastResponseHeaders&&(this.last_response_headers=a),this.enableLastHttpResponse&&(this.last_http_response=i),this.verbose&&this.log("handleRestResponse:\n",this.id,s,t,e.status,e.statusText,"\nResponseHeaders:\n",a,"ZIP redacted","\n"),i}return e.text().then((o=>{const n=this.onRestResponse(e.status,e.statusText,t,s,a,o,i,r),d=this.parseJson(n);this.enableLastResponseHeaders&&(this.last_response_headers=a),this.enableLastHttpResponse&&(this.last_http_response=o),this.enableLastJsonResponse&&(this.last_json_response=d),this.verbose&&this.log("handleRestResponse:\n",this.id,s,t,e.status,e.statusText,"\nResponseHeaders:\n",a,"\nResponseBody:\n",o,"\n");return this.handleErrors(e.status,e.statusText,t,s,a,o,d,i,r)||this.handleHttpStatusCode(e.status,e.statusText,t,s,o),d||o}))}onRestResponse(e,t,s,i,r,a,o,n){return a.trim()}onJsonResponse(e){return this.quoteJsonNumbers?e.replace(/":([+.0-9eE-]+)([,}])/g,'":"$1"$2'):e}async loadMarketsHelper(e=!1,t={}){if(!e&&this.markets)return this.markets_by_id?this.markets:this.setMarkets(this.markets);let s;!0===this.has.fetchCurrencies&&(s=await this.fetchCurrencies());const i=await this.fetchMarkets(t);return this.setMarkets(i,s)}async loadMarkets(e=!1,t={}){return(e&&!this.reloadingMarkets||!this.marketsLoading)&&(this.reloadingMarkets=!0,this.marketsLoading=this.loadMarketsHelper(e,t).then((e=>(this.reloadingMarkets=!1,e)),(e=>{throw this.reloadingMarkets=!1,e}))),this.marketsLoading}async fetchCurrencies(e={}){return new Promise(((e,t)=>e(this.currencies)))}async fetchCurrenciesWs(e={}){return new Promise(((e,t)=>e(this.currencies)))}async fetchMarkets(e={}){return new Promise(((e,t)=>e(Object.values(this.markets))))}async fetchMarketsWs(e={}){return new Promise(((e,t)=>e(Object.values(this.markets))))}checkRequiredDependencies(){}parseNumber(e,t=void 0){if(void 0===e)return t;try{return this.number(e)}catch(e){return t}}checkOrderArguments(e,t,s,i,r,a){if(void 0===r&&"limit"===t)throw new o.ArgumentsRequired(this.id+" createOrder() requires a price argument for a limit order");if(i<=0)throw new o.ArgumentsRequired(this.id+" createOrder() amount should be above 0")}handleHttpStatusCode(e,t,s,i,r){const a=e.toString();if(a in this.httpExceptions){throw new(0,this.httpExceptions[a])(this.id+" "+i+" "+s+" "+a+" "+t+" "+r)}}remove0xPrefix(e){return"0x"===e.slice(0,2)?e.slice(2):e}spawn(e,...t){const s=(0,h.o)();return setTimeout((()=>{e.apply(this,t).then(s.resolve).catch(s.reject)}),0),s}delay(e,t,...s){setTimeout((()=>{this.spawn(t,...s)}),e)}orderBook(e={},t=Number.MAX_SAFE_INTEGER){return new c.ZY(e,t)}indexedOrderBook(e={},t=Number.MAX_SAFE_INTEGER){return new c.rc(e,t)}countedOrderBook(e={},t=Number.MAX_SAFE_INTEGER){return new c.yk(e,t)}handleMessage(e,t){}ping(e){}client(e){if(this.clients=this.clients||{},!this.clients[e]){const t=this.handleMessage.bind(this),s=this.onError.bind(this),i=this.onClose.bind(this),r=this.onConnected.bind(this),a=this.safeValue(this.options,"ws",{}),[o,n,h]=this.checkWsProxySettings(),c=this.setProxyAgents(o,n,h),l=this.getHttpAgentIfNeeded(e),u=c||(l||this.agent),p=this.deepExtend(this.streaming,{log:this.log?this.log.bind(this):this.log,ping:this.ping?this.ping.bind(this):this.ping,verbose:this.verbose,throttler:new E(this.tokenBucket),options:{agent:u}},a);this.clients[e]=new d.Z(e,t,s,i,r,p)}return this.clients[e]}watchMultiple(e,t,s=void 0,i=void 0,r=void 0){const a=this.client(e),o=h.o.race(t.map((e=>a.future(e))));let n=[];if(void 0!==i)for(let e=0;e{const e=this.safeValue(this.options,"ws"),t=this.safeValue(e,"cost",1);s&&(this.enableRateLimit&&a.throttle?a.throttle(t).then((()=>{a.send(s)})).catch((e=>{for(let e=0;e{for(let e=0;e{for(let e=0;e{const e=this.safeValue(this.options,"ws"),t=this.safeValue(e,"cost",1);s&&(this.enableRateLimit&&a.throttle?a.throttle(t).then((()=>{a.send(s)})).catch((e=>{a.onError(e)})):a.send(s).catch((e=>{a.onError(e)})))})).catch((e=>{delete a.subscriptions[i],o.reject(e)})),o}onConnected(e,t=void 0){}onError(e,t){e.url in this.clients&&this.clients[e.url].error&&delete this.clients[e.url]}onClose(e,t){e.error||this.clients[e.url]&&delete this.clients[e.url]}async close(){const e=Object.values(this.clients||{}),t=[];for(let s=0;s=0)return d.reset(o),this.handleDeltas(d,a.slice(h)),d.cache.length=0,void e.resolve(d,t);n++}e.reject(new o.ExchangeError(this.id+" nonce is behind the cache after "+a.toString()+" tries."),t),delete this.clients[e.url]}catch(a){e.reject(a,t),await this.loadOrderBook(e,t,s,i,r)}}convertToBigInt(e){return BigInt(e)}stringToCharsArray(e){return e.split("")}valueIsDefined(e){return null!=e}arraySlice(e,t,s=void 0){return void 0===s?e.slice(t):e.slice(t,s)}getProperty(e,t,s=void 0){return t in e?e[t]:s}setProperty(e,t,s=void 0){e[t]=s}axolotl(e,t,s){return(0,l.gC)(e,t,s)}fixStringifiedJsonMembers(e){let t=e.replaceAll("\\","");return t=t.replaceAll('"{',"{"),t=t.replaceAll('}"',"}"),t}ethAbiEncode(e,t){return this.base16ToBinary(p.ZP.encode(e,t).slice(2))}ethEncodeStructuredData(e,t,s){return this.base16ToBinary(f.E.encode(e,t,s).slice(-132))}intToBase16(e){return e.toString(16)}extendExchangeOptions(e){this.options=this.extend(this.options,e)}createSafeDictionary(){return{}}randomBytes(e){const t=new m.C,s=[];return s.length=e,t.nextBytes(s),Buffer.from(s).toString("hex")}safeBoolN(e,t,s=void 0){const i=this.safeValueN(e,t,s);return"boolean"==typeof i?i:s}safeBool2(e,t,s,i=void 0){return this.safeBoolN(e,[t,s],i)}safeBool(e,t,s=void 0){return this.safeBoolN(e,[t],s)}safeDictN(e,t,s=void 0){const i=this.safeValueN(e,t,s);return void 0===i?s:"object"==typeof i?i:s}safeDict(e,t,s=void 0){return this.safeDictN(e,[t],s)}safeDict2(e,t,s,i=void 0){return this.safeDictN(e,[t,s],i)}safeListN(e,t,s=void 0){const i=this.safeValueN(e,t,s);return void 0===i?s:Array.isArray(i)?i:s}safeList2(e,t,s,i=void 0){return this.safeListN(e,[t,s],i)}safeList(e,t,s=void 0){return this.safeListN(e,[t],s)}handleDeltas(e,t){for(let s=0;s1){const e=r.join(",");throw new o.ProxyError(this.id+" you have multiple conflicting proxy settings ("+e+"), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback")}return a}checkProxySettings(e=void 0,t=void 0,s=void 0,i=void 0){const r=[];let a,n,d;this.valueIsDefined(this.httpProxy)&&(r.push("httpProxy"),a=this.httpProxy),this.valueIsDefined(this.http_proxy)&&(r.push("http_proxy"),a=this.http_proxy),void 0!==this.httpProxyCallback&&(r.push("httpProxyCallback"),a=this.httpProxyCallback(e,t,s,i)),void 0!==this.http_proxy_callback&&(r.push("http_proxy_callback"),a=this.http_proxy_callback(e,t,s,i)),this.valueIsDefined(this.httpsProxy)&&(r.push("httpsProxy"),n=this.httpsProxy),this.valueIsDefined(this.https_proxy)&&(r.push("https_proxy"),n=this.https_proxy),void 0!==this.httpsProxyCallback&&(r.push("httpsProxyCallback"),n=this.httpsProxyCallback(e,t,s,i)),void 0!==this.https_proxy_callback&&(r.push("https_proxy_callback"),n=this.https_proxy_callback(e,t,s,i)),this.valueIsDefined(this.socksProxy)&&(r.push("socksProxy"),d=this.socksProxy),this.valueIsDefined(this.socks_proxy)&&(r.push("socks_proxy"),d=this.socks_proxy),void 0!==this.socksProxyCallback&&(r.push("socksProxyCallback"),d=this.socksProxyCallback(e,t,s,i)),void 0!==this.socks_proxy_callback&&(r.push("socks_proxy_callback"),d=this.socks_proxy_callback(e,t,s,i));if(r.length>1){const e=r.join(",");throw new o.ProxyError(this.id+" you have multiple conflicting proxy settings ("+e+"), please use only one from: httpProxy, httpsProxy, httpProxyCallback, httpsProxyCallback, socksProxy, socksProxyCallback")}return[a,n,d]}checkWsProxySettings(){const e=[];let t,s,i;this.valueIsDefined(this.wsProxy)&&(e.push("wsProxy"),t=this.wsProxy),this.valueIsDefined(this.ws_proxy)&&(e.push("ws_proxy"),t=this.ws_proxy),this.valueIsDefined(this.wssProxy)&&(e.push("wssProxy"),s=this.wssProxy),this.valueIsDefined(this.wss_proxy)&&(e.push("wss_proxy"),s=this.wss_proxy),this.valueIsDefined(this.wsSocksProxy)&&(e.push("wsSocksProxy"),i=this.wsSocksProxy),this.valueIsDefined(this.ws_socks_proxy)&&(e.push("ws_socks_proxy"),i=this.ws_socks_proxy);if(e.length>1){const t=e.join(",");throw new o.ProxyError(this.id+" you have multiple conflicting proxy settings ("+t+"), please use only one from: wsProxy, wssProxy, wsSocksProxy")}return[t,s,i]}checkConflictingProxies(e,t){if(e&&t)throw new o.ProxyError(this.id+" you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy")}findMessageHashes(e,t){const s=[],i=Object.keys(e.futures);for(let e=0;e=0&&s.push(r)}return s}filterByLimit(e,t=void 0,s="timestamp",i=!1){if(this.valueIsDefined(t)){const r=e.length;if(r>0){let a=!0;if(s in e[0]){const t=e[0][s],i=e[r-1][s];void 0!==t&&void 0!==i&&(a=t<=i)}i?(t>r&&(t=r),e=a?this.arraySlice(e,0,t):this.arraySlice(e,-t)):e=a?this.arraySlice(e,-t):this.arraySlice(e,0,t)}}return e}filterBySinceLimit(e,t=void 0,s=void 0,i="timestamp",r=!1){const a=this.valueIsDefined(t),o=this.toArray(e);let n=o;if(a){n=[];for(let e=0;e=t&&n.push(s)}}if(r&&void 0!==s)return this.arraySlice(n,-s);const d=!r&&a;return this.filterByLimit(n,s,i,d)}filterByValueSinceLimit(e,t,s=void 0,i=void 0,r=void 0,a="timestamp",o=!1){const n=this.valueIsDefined(s),d=this.valueIsDefined(i),h=this.toArray(e);let c=h;if(n||d){c=[];for(let e=0;e=i)&&c.push(r)}}return o&&void 0!==r?this.arraySlice(c,-r):this.filterByLimit(c,r,a,d)}setSandboxMode(e){if(e){if(!("test"in this.urls))throw new o.NotSupported(this.id+" does not have a sandbox URL");"string"==typeof this.urls.api?(this.urls.apiBackup=this.urls.api,this.urls.api=this.urls.test):(this.urls.apiBackup=this.clone(this.urls.api),this.urls.api=this.clone(this.urls.test))}else if("apiBackup"in this.urls){"string"==typeof this.urls.api?this.urls.api=this.urls.apiBackup:this.urls.api=this.clone(this.urls.apiBackup);const e=this.omit(this.urls,"apiBackup");this.urls=e}}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){return{}}async fetchAccounts(e={}){throw new o.NotSupported(this.id+" fetchAccounts() is not supported yet")}async fetchTrades(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchTrades() is not supported yet")}async fetchTradesWs(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchTradesWs() is not supported yet")}async watchTrades(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchTrades() is not supported yet")}async watchTradesForSymbols(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchTradesForSymbols() is not supported yet")}async watchMyTradesForSymbols(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchMyTradesForSymbols() is not supported yet")}async watchOrdersForSymbols(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchOrdersForSymbols() is not supported yet")}async watchOHLCVForSymbols(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchOHLCVForSymbols() is not supported yet")}async watchOrderBookForSymbols(e,t=void 0,s={}){throw new o.NotSupported(this.id+" watchOrderBookForSymbols() is not supported yet")}async fetchDepositAddresses(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchDepositAddresses() is not supported yet")}async fetchOrderBook(e,t=void 0,s={}){throw new o.NotSupported(this.id+" fetchOrderBook() is not supported yet")}async fetchMarginMode(e,t={}){if(this.has.fetchMarginModes){const s=await this.fetchMarginModes([e],t);return this.safeDict(s,e)}throw new o.NotSupported(this.id+" fetchMarginMode() is not supported yet")}async fetchMarginModes(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchMarginModes () is not supported yet")}async fetchRestOrderBookSafe(e,t=void 0,s={}){const i=this.handleOption("watchOrderBook","maxRetries",3);for(let r=0;r=0?parseFloat(t):parseInt(t)}isRoundNumber(e){return 0===this.parseToNumeric(e%1)}afterConstruct(){this.createNetworksByIdObject()}createNetworksByIdObject(){const e=this.invertFlatStringDictionary(this.safeValue(this.options,"networks",{}));this.options.networksById=this.extend(e,this.safeValue(this.options,"networksById",{}))}getDefaultOptions(){return{defaultNetworkCodeReplacements:{ETH:{ERC20:"ETH"},TRX:{TRC20:"TRX"},CRO:{CRC20:"CRONOS"}}}}safeLedgerEntry(e,t=void 0){t=this.safeCurrency(void 0,t);let s=this.safeString(e,"direction"),i=this.safeString(e,"before"),r=this.safeString(e,"after");const a=this.safeString(e,"amount");void 0!==a&&(void 0===i&&void 0!==r?i=n.O.stringSub(r,a):void 0!==i&&void 0===r&&(r=n.O.stringAdd(i,a))),void 0!==i&&void 0!==r&&void 0===s&&(n.O.stringGt(i,r)&&(s="out"),n.O.stringGt(r,i)&&(s="in"));const o=this.safeValue(e,"fee");void 0!==o&&(o.cost=this.safeNumber(o,"cost"));const d=this.safeInteger(e,"timestamp"),h=this.safeDict(e,"info",{});return{id:this.safeString(e,"id"),timestamp:d,datetime:this.iso8601(d),direction:s,account:this.safeString(e,"account"),referenceId:this.safeString(e,"referenceId"),referenceAccount:this.safeString(e,"referenceAccount"),type:this.safeString(e,"type"),currency:t.code,amount:this.parseNumber(a),before:this.parseNumber(i),after:this.parseNumber(r),status:this.safeString(e,"status"),fee:o,info:h}}safeCurrencyStructure(e){return this.extend({info:void 0,id:void 0,numericId:void 0,code:void 0,precision:void 0,type:void 0,name:void 0,active:void 0,deposit:void 0,withdraw:void 0,fee:void 0,fees:{},networks:{},limits:{deposit:{min:void 0,max:void 0},withdraw:{min:void 0,max:void 0}}},e)}safeMarketStructure(e=void 0){const t={id:void 0,lowercaseId:void 0,symbol:void 0,base:void 0,quote:void 0,settle:void 0,baseId:void 0,quoteId:void 0,settleId:void 0,type:void 0,spot:void 0,margin:void 0,swap:void 0,future:void 0,option:void 0,index:void 0,active:void 0,contract:void 0,linear:void 0,inverse:void 0,subType:void 0,taker:void 0,maker:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:void 0,price:void 0,cost:void 0,base:void 0,quote:void 0},limits:{leverage:{min:void 0,max:void 0},amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:void 0};if(void 0!==e){const s=this.extend(t,e);return s.spot&&(void 0===s.contract&&(s.contract=!1),void 0===s.swap&&(s.swap=!1),void 0===s.future&&(s.future=!1),void 0===s.option&&(s.option=!1),void 0===s.index&&(s.index=!1)),s}return t}setMarkets(e,t=void 0){const s=[];this.markets_by_id={};const i=this.sortBy(this.toArray(e),"spot",!0,!0);for(let e=0;ei.precision?t:i}o.push(i)}const n=this.sortBy(o,"code");this.currencies=this.deepExtend(this.currencies,this.indexBy(n,"code"))}this.currencies_by_id=this.indexBy(this.currencies,"id");const o=this.keysort(this.currencies);return this.codes=Object.keys(o),this.markets}getDescribeForExtendedWsExchange(e,t,s){const i=this.deepExtend(t.describe(),e.describe());return this.deepExtend(i,s)}safeBalance(e){const t=this.omit(e,["info","timestamp","datetime","free","used","total"]),s=Object.keys(t);e.free={},e.used={},e.total={};const i={};for(let t=0;t0){void 0===e.symbol&&(e.symbol=O[0].symbol),void 0===e.side&&(e.side=O[0].side),void 0===e.type&&(e.type=O[0].type),void 0===e.id&&(e.id=O[0].order),p&&(r="0"),f&&(a="0");for(let e=0;e=this.sum(a[d][0],r)?a.push([n,i.price,i.price,i.price,i.price,i.amount,1]):(a[d][2]=Math.max(a[d][2],i.price),a[d][3]=Math.min(a[d][3],i.price),a[d][4]=i.price,a[d][5]=this.sum(a[d][5],i.amount),a[d][6]=this.sum(a[d][6],1))}return a}parseTradingViewOHLCV(e,t=void 0,s="1m",i=void 0,r=void 0){const a=this.convertTradingViewToOHLCV(e);return this.parseOHLCVs(a,t,s,i,r)}async editLimitBuyOrder(e,t,s,i=void 0,r={}){return await this.editLimitOrder(e,t,"buy",s,i,r)}async editLimitSellOrder(e,t,s,i=void 0,r={}){return await this.editLimitOrder(e,t,"sell",s,i,r)}async editLimitOrder(e,t,s,i,r=void 0,a={}){return await this.editOrder(e,t,"limit",s,i,r,a)}async editOrder(e,t,s,i,r=void 0,a=void 0,o={}){return await this.cancelOrder(e,t),await this.createOrder(t,s,i,r,a,o)}async editOrderWs(e,t,s,i,r,a=void 0,o={}){return await this.cancelOrderWs(e,t),await this.createOrderWs(t,s,i,r,a,o)}async fetchPermissions(e={}){throw new o.NotSupported(this.id+" fetchPermissions() is not supported yet")}async fetchPosition(e,t={}){throw new o.NotSupported(this.id+" fetchPosition() is not supported yet")}async fetchPositionWs(e,t={}){throw new o.NotSupported(this.id+" fetchPositionWs() is not supported yet")}async watchPosition(e=void 0,t={}){throw new o.NotSupported(this.id+" watchPosition() is not supported yet")}async watchPositions(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchPositions() is not supported yet")}async watchPositionForSymbols(e=void 0,t=void 0,s=void 0,i={}){return await this.watchPositions(e,t,s,i)}async fetchPositionsForSymbol(e,t={}){throw new o.NotSupported(this.id+" fetchPositionsForSymbol() is not supported yet")}async fetchPositionsForSymbolWs(e,t={}){throw new o.NotSupported(this.id+" fetchPositionsForSymbol() is not supported yet")}async fetchPositions(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositions() is not supported yet")}async fetchPositionsWs(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositions() is not supported yet")}async fetchPositionsRisk(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchPositionsRisk() is not supported yet")}async fetchBidsAsks(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchBidsAsks() is not supported yet")}async fetchBorrowInterest(e=void 0,t=void 0,s=void 0,i=void 0,r={}){throw new o.NotSupported(this.id+" fetchBorrowInterest() is not supported yet")}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchLedger() is not supported yet")}async fetchLedgerEntry(e,t=void 0,s={}){throw new o.NotSupported(this.id+" fetchLedgerEntry() is not supported yet")}parseBidAsk(e,t=0,s=1,i=2){const r=this.safeNumber(e,t),a=this.safeNumber(e,s),o=this.safeInteger(e,i),n=[r,a];return void 0!==o&&n.push(o),n}safeCurrency(e,t=void 0){if(void 0===e&&void 0!==t)return t;if(void 0!==this.currencies_by_id&&e in this.currencies_by_id&&void 0!==this.currencies_by_id[e])return this.currencies_by_id[e];let s=e;return void 0!==e&&(s=this.commonCurrencyCode(e.toUpperCase())),this.safeCurrencyStructure({id:e,code:s,precision:void 0})}safeMarket(e,t=void 0,s=void 0,i=void 0){const r=this.safeMarketStructure({symbol:e,marketId:e});if(void 0!==e)if(void 0!==this.markets_by_id&&e in this.markets_by_id){const s=this.markets_by_id[e];if(1===s.length)return s[0];if(void 0===i){if(void 0===t)throw new o.ArgumentsRequired(this.id+" safeMarket() requires a fourth argument for "+e+" to disambiguate between different markets with the same market id");i=t.type}for(let e=0;e=0)return i}}handleErrors(e,t,s,i,r,a,o,n,d){}calculateRateLimiterCost(e,t,s,i,r={}){return this.safeValue(r,"cost",1)}async fetchTicker(e,t={}){if(this.has.fetchTickers){await this.loadMarkets();e=this.market(e).symbol;const s=await this.fetchTickers([e],t),i=this.safeDict(s,e);if(void 0===i)throw new o.NullResponse(this.id+" fetchTickers() could not find a ticker for "+e);return i}throw new o.NotSupported(this.id+" fetchTicker() is not supported yet")}async fetchTickerWs(e,t={}){if(this.has.fetchTickersWs){await this.loadMarkets();e=this.market(e).symbol;const s=await this.fetchTickerWs(e,t),i=this.safeDict(s,e);if(void 0===i)throw new o.NullResponse(this.id+" fetchTickers() could not find a ticker for "+e);return i}throw new o.NotSupported(this.id+" fetchTicker() is not supported yet")}async watchTicker(e,t={}){throw new o.NotSupported(this.id+" watchTicker() is not supported yet")}async fetchTickers(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchTickers() is not supported yet")}async fetchTickersWs(e=void 0,t={}){throw new o.NotSupported(this.id+" fetchTickers() is not supported yet")}async fetchOrderBooks(e=void 0,t=void 0,s={}){throw new o.NotSupported(this.id+" fetchOrderBooks() is not supported yet")}async watchBidsAsks(e=void 0,t={}){throw new o.NotSupported(this.id+" watchBidsAsks() is not supported yet")}async watchTickers(e=void 0,t={}){throw new o.NotSupported(this.id+" watchTickers() is not supported yet")}async fetchOrder(e,t=void 0,s={}){throw new o.NotSupported(this.id+" fetchOrder() is not supported yet")}async fetchOrderWs(e,t=void 0,s={}){throw new o.NotSupported(this.id+" fetchOrderWs() is not supported yet")}async fetchOrderStatus(e,t=void 0,s={}){return(await this.fetchOrder(e,t,s)).status}async fetchUnifiedOrder(e,t={}){return await this.fetchOrder(this.safeString(e,"id"),this.safeString(e,"symbol"),t)}async createOrder(e,t,s,i,r=void 0,a={}){throw new o.NotSupported(this.id+" createOrder() is not supported yet")}async createTrailingAmountOrder(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingAmountOrder() requires a trailingAmount argument");if(d.trailingAmount=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingAmountOrder)return await this.createOrder(e,t,s,i,r,d);throw new o.NotSupported(this.id+" createTrailingAmountOrder() is not supported yet")}async createTrailingAmountOrderWs(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingAmountOrderWs() requires a trailingAmount argument");if(d.trailingAmount=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingAmountOrderWs)return await this.createOrderWs(e,t,s,i,r,d);throw new o.NotSupported(this.id+" createTrailingAmountOrderWs() is not supported yet")}async createTrailingPercentOrder(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingPercentOrder() requires a trailingPercent argument");if(d.trailingPercent=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingPercentOrder)return await this.createOrder(e,t,s,i,r,d);throw new o.NotSupported(this.id+" createTrailingPercentOrder() is not supported yet")}async createTrailingPercentOrderWs(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTrailingPercentOrderWs() requires a trailingPercent argument");if(d.trailingPercent=a,void 0!==n&&(d.trailingTriggerPrice=n),this.has.createTrailingPercentOrderWs)return await this.createOrderWs(e,t,s,i,r,d);throw new o.NotSupported(this.id+" createTrailingPercentOrderWs() is not supported yet")}async createMarketOrderWithCost(e,t,s,i={}){if(this.has.createMarketOrderWithCost||this.has.createMarketBuyOrderWithCost&&this.has.createMarketSellOrderWithCost)return await this.createOrder(e,"market",t,s,1,i);throw new o.NotSupported(this.id+" createMarketOrderWithCost() is not supported yet")}async createMarketBuyOrderWithCost(e,t,s={}){if(this.options.createMarketBuyOrderRequiresPrice||this.has.createMarketBuyOrderWithCost)return await this.createOrder(e,"market","buy",t,1,s);throw new o.NotSupported(this.id+" createMarketBuyOrderWithCost() is not supported yet")}async createMarketSellOrderWithCost(e,t,s={}){if(this.options.createMarketSellOrderRequiresPrice||this.has.createMarketSellOrderWithCost)return await this.createOrder(e,"market","sell",t,1,s);throw new o.NotSupported(this.id+" createMarketSellOrderWithCost() is not supported yet")}async createMarketOrderWithCostWs(e,t,s,i={}){if(this.has.createMarketOrderWithCostWs||this.has.createMarketBuyOrderWithCostWs&&this.has.createMarketSellOrderWithCostWs)return await this.createOrderWs(e,"market",t,s,1,i);throw new o.NotSupported(this.id+" createMarketOrderWithCostWs() is not supported yet")}async createTriggerOrder(e,t,s,i,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTriggerOrder() requires a triggerPrice argument");if(n.triggerPrice=a,this.has.createTriggerOrder)return await this.createOrder(e,t,s,i,r,n);throw new o.NotSupported(this.id+" createTriggerOrder() is not supported yet")}async createTriggerOrderWs(e,t,s,i,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTriggerOrderWs() requires a triggerPrice argument");if(n.triggerPrice=a,this.has.createTriggerOrderWs)return await this.createOrderWs(e,t,s,i,r,n);throw new o.NotSupported(this.id+" createTriggerOrderWs() is not supported yet")}async createStopLossOrder(e,t,s,i,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createStopLossOrder() requires a stopLossPrice argument");if(n.stopLossPrice=a,this.has.createStopLossOrder)return await this.createOrder(e,t,s,i,r,n);throw new o.NotSupported(this.id+" createStopLossOrder() is not supported yet")}async createStopLossOrderWs(e,t,s,i,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createStopLossOrderWs() requires a stopLossPrice argument");if(n.stopLossPrice=a,this.has.createStopLossOrderWs)return await this.createOrderWs(e,t,s,i,r,n);throw new o.NotSupported(this.id+" createStopLossOrderWs() is not supported yet")}async createTakeProfitOrder(e,t,s,i,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTakeProfitOrder() requires a takeProfitPrice argument");if(n.takeProfitPrice=a,this.has.createTakeProfitOrder)return await this.createOrder(e,t,s,i,r,n);throw new o.NotSupported(this.id+" createTakeProfitOrder() is not supported yet")}async createTakeProfitOrderWs(e,t,s,i,r=void 0,a=void 0,n={}){if(void 0===a)throw new o.ArgumentsRequired(this.id+" createTakeProfitOrderWs() requires a takeProfitPrice argument");if(n.takeProfitPrice=a,this.has.createTakeProfitOrderWs)return await this.createOrderWs(e,t,s,i,r,n);throw new o.NotSupported(this.id+" createTakeProfitOrderWs() is not supported yet")}async createOrderWithTakeProfitAndStopLoss(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(d=this.setTakeProfitAndStopLossParams(e,t,s,i,r,a,n,d),this.has.createOrderWithTakeProfitAndStopLoss)return await this.createOrder(e,t,s,i,r,d);throw new o.NotSupported(this.id+" createOrderWithTakeProfitAndStopLoss() is not supported yet")}setTakeProfitAndStopLossParams(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(void 0===a&&void 0===n)throw new o.ArgumentsRequired(this.id+" createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument");void 0!==a&&(d.takeProfit={triggerPrice:a}),void 0!==n&&(d.stopLoss={triggerPrice:n});const h=this.safeString(d,"takeProfitType"),c=this.safeString(d,"takeProfitPriceType"),l=this.safeString(d,"takeProfitLimitPrice"),u=this.safeString(d,"takeProfitAmount"),p=this.safeString(d,"stopLossType"),f=this.safeString(d,"stopLossPriceType"),m=this.safeString(d,"stopLossLimitPrice"),g=this.safeString(d,"stopLossAmount");return void 0!==h&&(d.takeProfit.type=h),void 0!==c&&(d.takeProfit.priceType=c),void 0!==l&&(d.takeProfit.price=this.parseToNumeric(l)),void 0!==u&&(d.takeProfit.amount=this.parseToNumeric(u)),void 0!==p&&(d.stopLoss.type=p),void 0!==f&&(d.stopLoss.priceType=f),void 0!==m&&(d.stopLoss.price=this.parseToNumeric(m)),void 0!==g&&(d.stopLoss.amount=this.parseToNumeric(g)),d=this.omit(d,["takeProfitType","takeProfitPriceType","takeProfitLimitPrice","takeProfitAmount","stopLossType","stopLossPriceType","stopLossLimitPrice","stopLossAmount"])}async createOrderWithTakeProfitAndStopLossWs(e,t,s,i,r=void 0,a=void 0,n=void 0,d={}){if(d=this.setTakeProfitAndStopLossParams(e,t,s,i,r,a,n,d),this.has.createOrderWithTakeProfitAndStopLossWs)return await this.createOrderWs(e,t,s,i,r,d);throw new o.NotSupported(this.id+" createOrderWithTakeProfitAndStopLossWs() is not supported yet")}async createOrders(e,t={}){throw new o.NotSupported(this.id+" createOrders() is not supported yet")}async createOrderWs(e,t,s,i,r=void 0,a={}){throw new o.NotSupported(this.id+" createOrderWs() is not supported yet")}async cancelOrder(e,t=void 0,s={}){throw new o.NotSupported(this.id+" cancelOrder() is not supported yet")}async cancelOrderWs(e,t=void 0,s={}){throw new o.NotSupported(this.id+" cancelOrderWs() is not supported yet")}async cancelOrdersWs(e,t=void 0,s={}){throw new o.NotSupported(this.id+" cancelOrdersWs() is not supported yet")}async cancelAllOrders(e=void 0,t={}){throw new o.NotSupported(this.id+" cancelAllOrders() is not supported yet")}async cancelAllOrdersAfter(e,t={}){throw new o.NotSupported(this.id+" cancelAllOrdersAfter() is not supported yet")}async cancelOrdersForSymbols(e,t={}){throw new o.NotSupported(this.id+" cancelOrdersForSymbols() is not supported yet")}async cancelAllOrdersWs(e=void 0,t={}){throw new o.NotSupported(this.id+" cancelAllOrdersWs() is not supported yet")}async cancelUnifiedOrder(e,t={}){return this.cancelOrder(this.safeString(e,"id"),this.safeString(e,"symbol"),t)}async fetchOrders(e=void 0,t=void 0,s=void 0,i={}){if(this.has.fetchOpenOrders&&this.has.fetchClosedOrders)throw new o.NotSupported(this.id+" fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() instead");throw new o.NotSupported(this.id+" fetchOrders() is not supported yet")}async fetchOrdersWs(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchOrdersWs() is not supported yet")}async fetchOrderTrades(e,t=void 0,s=void 0,i=void 0,r={}){throw new o.NotSupported(this.id+" fetchOrderTrades() is not supported yet")}async watchOrders(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchOrders() is not supported yet")}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){if(this.has.fetchOrders){const r=await this.fetchOrders(e,t,s,i);return this.filterBy(r,"status","open")}throw new o.NotSupported(this.id+" fetchOpenOrders() is not supported yet")}async fetchOpenOrdersWs(e=void 0,t=void 0,s=void 0,i={}){if(this.has.fetchOrdersWs){const r=await this.fetchOrdersWs(e,t,s,i);return this.filterBy(r,"status","open")}throw new o.NotSupported(this.id+" fetchOpenOrdersWs() is not supported yet")}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){if(this.has.fetchOrders){const r=await this.fetchOrders(e,t,s,i);return this.filterBy(r,"status","closed")}throw new o.NotSupported(this.id+" fetchClosedOrders() is not supported yet")}async fetchCanceledAndClosedOrders(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchCanceledAndClosedOrders() is not supported yet")}async fetchClosedOrdersWs(e=void 0,t=void 0,s=void 0,i={}){if(this.has.fetchOrdersWs){const r=await this.fetchOrdersWs(e,t,s,i);return this.filterBy(r,"status","closed")}throw new o.NotSupported(this.id+" fetchClosedOrdersWs() is not supported yet")}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchMyTrades() is not supported yet")}async fetchMyLiquidations(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchMyLiquidations() is not supported yet")}async fetchLiquidations(e,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchLiquidations() is not supported yet")}async fetchMyTradesWs(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchMyTradesWs() is not supported yet")}async watchMyTrades(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" watchMyTrades() is not supported yet")}async fetchGreeks(e,t={}){throw new o.NotSupported(this.id+" fetchGreeks() is not supported yet")}async fetchOptionChain(e,t={}){throw new o.NotSupported(this.id+" fetchOptionChain() is not supported yet")}async fetchOption(e,t={}){throw new o.NotSupported(this.id+" fetchOption() is not supported yet")}async fetchConvertQuote(e,t,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchConvertQuote() is not supported yet")}async fetchDepositsWithdrawals(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchDepositsWithdrawals() is not supported yet")}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchDeposits() is not supported yet")}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchWithdrawals() is not supported yet")}async fetchDepositsWs(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchDepositsWs() is not supported yet")}async fetchWithdrawalsWs(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchWithdrawalsWs() is not supported yet")}async fetchFundingRateHistory(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchFundingRateHistory() is not supported yet")}async fetchFundingHistory(e=void 0,t=void 0,s=void 0,i={}){throw new o.NotSupported(this.id+" fetchFundingHistory() is not supported yet")}async closePosition(e,t=void 0,s={}){throw new o.NotSupported(this.id+" closePosition() is not supported yet")}async closeAllPositions(e={}){throw new o.NotSupported(this.id+" closeAllPositions() is not supported yet")}async fetchL3OrderBook(e,t=void 0,s={}){throw new o.BadRequest(this.id+" fetchL3OrderBook() is not supported yet")}parseLastPrice(e,t=void 0){throw new o.NotSupported(this.id+" parseLastPrice() is not supported yet")}async fetchDepositAddress(e,t={}){if(this.has.fetchDepositAddresses){const s=await this.fetchDepositAddresses([e],t),i=this.safeValue(s,e);if(void 0===i)throw new o.InvalidAddress(this.id+" fetchDepositAddress() could not find a deposit address for "+e+", make sure you have created a corresponding deposit address in your wallet on the exchange website");return i}if(this.has.fetchDepositAddressesByNetwork){const s=this.safeString(t,"network");t=this.omit(t,"network");const i=await this.fetchDepositAddressesByNetwork(e,t);if(void 0!==s)return this.safeDict(i,s);{const e=Object.keys(i),t=this.safeString(e,0);return this.safeDict(i,t)}}throw new o.NotSupported(this.id+" fetchDepositAddress() is not supported yet")}account(){return{free:void 0,used:void 0,total:void 0}}commonCurrencyCode(e){return this.substituteCommonCurrencyCodes?this.safeString(this.commonCurrencies,e,e):e}currency(e){if(void 0===this.currencies)throw new o.ExchangeError(this.id+" currencies not loaded");if("string"==typeof e){if(e in this.currencies)return this.currencies[e];if(e in this.currencies_by_id)return this.currencies_by_id[e]}throw new o.ExchangeError(this.id+" does not have currency code "+e)}market(e){if(void 0===this.markets)throw new o.ExchangeError(this.id+" markets not loaded");if(e in this.markets)return this.markets[e];if(e in this.markets_by_id){const t=this.markets_by_id[e],s=this.safeString2(this.options,"defaultType","defaultSubType","spot");for(let e=0;e0&&!this.inArray(t,i)){const t=i.join(", ");let r=this.id+" "+e+"() requires a "+s+" argument";throw""!==t&&(r+=", one of ("+t+")"),new o.ArgumentsRequired(r)}}checkRequiredMarginArgument(e,t,s){if("isolated"===s&&void 0===t)throw new o.ArgumentsRequired(this.id+" "+e+"() requires a symbol argument for isolated margin");if("cross"===s&&void 0!==t)throw new o.ArgumentsRequired(this.id+" "+e+"() cannot have a symbol argument for cross margin")}parseDepositWithdrawFees(e,t=void 0,s=void 0){const i={},r=Array.isArray(e);let a=e;r||(a=Object.keys(e));for(let o=0;o=f)break}}catch(e){if(p+=1,p>d)throw e}}const m=this.removeRepeatedElementsFromArray(u),g="fetchOHLCV"===e?0:"timestamp";return this.filterBySinceLimit(m,s,i,g)}async safeDeterministicCall(e,t=void 0,s=void 0,i=void 0,r=void 0,a={}){let n;[n,a]=this.handleOptionAndParams(a,e,"maxRetries",3);let d=0;try{return r&&"fetchFundingRateHistory"!==e?await this[e](t,r,s,i,a):await this[e](t,s,i,a)}catch(e){if(e instanceof o.RateLimitExceeded)throw e;if(d+=1,d>n)throw e}}async fetchPaginatedCallDeterministic(e,t=void 0,s=void 0,i=void 0,r=void 0,a={},n=void 0){let d;[d,a]=this.handleOptionAndParams(a,e,"paginationCalls",10),[n,a]=this.handleMaxEntriesPerRequestAndParams(e,n,a);const h=this.milliseconds(),c=[],l=1e3*this.parseTimeframe(r)*n;let u=h-d*l-1;void 0!==s&&(u=Math.max(u,s));const p=this.safeInteger2(a,"until","till");if(void 0!==p){const e=Math.ceil((p-s)/l);if(e>d)throw new o.BadRequest(this.id+" the number of required calls is greater than the max number of calls allowed, either increase the paginationCalls or decrease the since-until gap. Current paginationCalls limit is "+d.toString()+" required calls is "+e.toString())}for(let s=0;s=p);s++)c.push(this.safeDeterministicCall(e,t,u,n,r,a)),u=this.sum(u,l)-1;const f=await Promise.all(c);let m=[];for(let e=0;ec)throw e}u+=1}const m=this.sortCursorPaginatedResult(f),g="fetchOHLCV"===e?0:"timestamp";return this.filterBySinceLimit(m,s,i,g)}async fetchPaginatedCallIncremental(e,t=void 0,s=void 0,i=void 0,r={},a=void 0,o=void 0){let n,d;[n,r]=this.handleOptionAndParams(r,e,"paginationCalls",10),[d,r]=this.handleOptionAndParams(r,e,"maxRetries",3),[o,r]=this.handleMaxEntriesPerRequestAndParams(e,o,r);let h=0,c=0,l=[];for(;hd)throw e}h+=1}const u=this.sortCursorPaginatedResult(l),p="fetchOHLCV"===e?0:"timestamp";return this.filterBySinceLimit(u,s,i,p)}sortCursorPaginatedResult(e){const t=this.safeValue(e,0);if(void 0!==t){if("timestamp"in t)return this.sortBy(e,"timestamp",!0);if("id"in t)return this.sortBy(e,"id",!0)}return e}removeRepeatedElementsFromArray(e){const t={};for(let s=0;s0?s:e}handleUntilOption(e,t,s,i=1){const r=this.safeInteger2(s,"until","till");return void 0!==r&&(t[e]=this.parseToInt(r*i),s=this.omit(s,["until","till"])),[t,s]}safeOpenInterest(e,t=void 0){return this.extend(e,{symbol:this.safeString(t,"symbol"),baseVolume:this.safeNumber(e,"baseVolume"),quoteVolume:this.safeNumber(e,"quoteVolume"),openInterestAmount:this.safeNumber(e,"openInterestAmount"),openInterestValue:this.safeNumber(e,"openInterestValue"),timestamp:this.safeInteger(e,"timestamp"),datetime:this.safeString(e,"datetime"),info:this.safeValue(e,"info")})}parseLiquidation(e,t=void 0){throw new o.NotSupported(this.id+" parseLiquidation () is not supported yet")}parseLiquidations(e,t=void 0,s=void 0,i=void 0){const r=[];for(let s=0;s{s.d(t,{O:()=>o});const i=BigInt(0),r=BigInt(-1),a=BigInt(10);class o{constructor(e,t=void 0){if(this.base=void 0,void 0===t){let t=0;(e=e.toLowerCase()).indexOf("e")>-1&&([e,t]=e.split("e"),t=parseInt(t.toString()));const s=e.indexOf(".");this.decimals=s>-1?e.length-s-1:0;const i=e.replace(".","");this.integer=BigInt(i),this.decimals=this.decimals-t}else this.integer=e,this.decimals=t}mul(e){const t=this.integer*e.integer;return new o(t,this.decimals+e.decimals)}div(e,t=18){const s=t-this.decimals+e.decimals;let i;if(0===s)i=this.integer;else if(s<0){const e=a**BigInt(-s);i=this.integer/e}else{const e=a**BigInt(s);i=this.integer*e}const r=i/e.integer;return new o(r,t)}add(e){if(this.decimals===e.decimals){const t=this.integer+e.integer;return new o(t,this.decimals)}{const[t,s]=this.decimals>e.decimals?[e,this]:[this,e],i=s.decimals-t.decimals,r=t.integer*a**BigInt(i)+s.integer;return new o(r,s.decimals)}}mod(e){const t=Math.max(-this.decimals+e.decimals,0),s=this.integer*a**BigInt(t),i=Math.max(-e.decimals+this.decimals,0),r=e.integer*a**BigInt(i);return new o(s%r,i+e.decimals)}sub(e){const t=new o(-e.integer,e.decimals);return this.add(t)}abs(){return new o(this.integer<0?this.integer*r:this.integer,this.decimals)}neg(){return new o(-this.integer,this.decimals)}min(e){return this.lt(e)?this:e}max(e){return this.gt(e)?this:e}gt(e){return this.sub(e).integer>0}ge(e){return this.sub(e).integer>=0}lt(e){return e.gt(this)}le(e){return e.ge(this)}reduce(){const e=this.integer.toString(),t=e.length-1;if(0===t)return"0"===e&&(this.decimals=0),this;let s;for(s=t;s>=0&&"0"===e.charAt(s);s--);const i=t-s;if(0===i)return this;this.decimals-=i,this.integer=BigInt(e.slice(0,s+1))}equals(e){return this.reduce(),e.reduce(),this.decimals===e.decimals&&this.integer===e.integer}toString(){let e,t;this.reduce(),this.integer<0?(e="-",t=-this.integer):(e="",t=this.integer);const s=Array.from(t.toString(Number(a)).padStart(this.decimals,"0")),i=s.length-this.decimals;let r;return r=0===i?"0.":this.decimals<0?"0".repeat(-this.decimals):0===this.decimals?"":".",s.splice(i,0,r),e+s.join("")}static stringMul(e,t){if(void 0!==e&&void 0!==t)return new o(e).mul(new o(t)).toString()}static stringDiv(e,t,s=18){if(void 0===e||void 0===t)return;const r=new o(t);return r.integer!==i?new o(e).div(r,s).toString():void 0}static stringAdd(e,t){if(void 0!==e||void 0!==t)return void 0===e?t:void 0===t?e:new o(e).add(new o(t)).toString()}static stringSub(e,t){if(void 0!==e&&void 0!==t)return new o(e).sub(new o(t)).toString()}static stringAbs(e){if(void 0!==e)return new o(e).abs().toString()}static stringNeg(e){if(void 0!==e)return new o(e).neg().toString()}static stringMod(e,t){if(void 0!==e&&void 0!==t)return new o(e).mod(new o(t)).toString()}static stringEquals(e,t){if(void 0!==e&&void 0!==t)return new o(e).equals(new o(t))}static stringEq(e,t){if(void 0!==e&&void 0!==t)return new o(e).equals(new o(t))}static stringMin(e,t){if(void 0!==e&&void 0!==t)return new o(e).min(new o(t)).toString()}static stringMax(e,t){if(void 0!==e&&void 0!==t)return new o(e).max(new o(t)).toString()}static stringGt(e,t){if(void 0!==e&&void 0!==t)return new o(e).gt(new o(t))}static stringGe(e,t){if(void 0!==e&&void 0!==t)return new o(e).ge(new o(t))}static stringLt(e,t){if(void 0!==e&&void 0!==t)return new o(e).lt(new o(t))}static stringLe(e,t){if(void 0!==e&&void 0!==t)return new o(e).le(new o(t))}}},6689:(e,t,s)=>{s.r(t),s.d(t,{AccountNotEnabled:()=>n,AccountSuspended:()=>d,AddressPending:()=>w,ArgumentsRequired:()=>h,AuthenticationError:()=>a,BadRequest:()=>c,BadResponse:()=>m,BadSymbol:()=>l,BaseError:()=>i,CancelPending:()=>O,ContractUnavailable:()=>I,DDoSProtection:()=>B,DuplicateOrderId:()=>x,ExchangeClosedByUser:()=>C,ExchangeError:()=>r,ExchangeNotAvailable:()=>R,InsufficientFunds:()=>v,InvalidAddress:()=>y,InvalidNonce:()=>V,InvalidOrder:()=>b,MarginModeAlreadySet:()=>f,NetworkError:()=>_,NoChange:()=>p,NotSupported:()=>M,NullResponse:()=>g,OnMaintenance:()=>L,OperationFailed:()=>E,OperationRejected:()=>u,OrderImmediatelyFillable:()=>T,OrderNotCached:()=>k,OrderNotFillable:()=>P,OrderNotFound:()=>S,PermissionDenied:()=>o,ProxyError:()=>A,RateLimitExceeded:()=>N,RequestTimeout:()=>D,default:()=>q});class i extends Error{constructor(e){super(e),this.name="BaseError"}}class r extends i{constructor(e){super(e),this.name="ExchangeError"}}class a extends r{constructor(e){super(e),this.name="AuthenticationError"}}class o extends a{constructor(e){super(e),this.name="PermissionDenied"}}class n extends o{constructor(e){super(e),this.name="AccountNotEnabled"}}class d extends a{constructor(e){super(e),this.name="AccountSuspended"}}class h extends r{constructor(e){super(e),this.name="ArgumentsRequired"}}class c extends r{constructor(e){super(e),this.name="BadRequest"}}class l extends c{constructor(e){super(e),this.name="BadSymbol"}}class u extends r{constructor(e){super(e),this.name="OperationRejected"}}class p extends u{constructor(e){super(e),this.name="NoChange"}}class f extends p{constructor(e){super(e),this.name="MarginModeAlreadySet"}}class m extends r{constructor(e){super(e),this.name="BadResponse"}}class g extends m{constructor(e){super(e),this.name="NullResponse"}}class v extends r{constructor(e){super(e),this.name="InsufficientFunds"}}class y extends r{constructor(e){super(e),this.name="InvalidAddress"}}class w extends y{constructor(e){super(e),this.name="AddressPending"}}class b extends r{constructor(e){super(e),this.name="InvalidOrder"}}class S extends b{constructor(e){super(e),this.name="OrderNotFound"}}class k extends b{constructor(e){super(e),this.name="OrderNotCached"}}class O extends b{constructor(e){super(e),this.name="CancelPending"}}class T extends b{constructor(e){super(e),this.name="OrderImmediatelyFillable"}}class P extends b{constructor(e){super(e),this.name="OrderNotFillable"}}class x extends b{constructor(e){super(e),this.name="DuplicateOrderId"}}class I extends b{constructor(e){super(e),this.name="ContractUnavailable"}}class M extends r{constructor(e){super(e),this.name="NotSupported"}}class A extends r{constructor(e){super(e),this.name="ProxyError"}}class C extends r{constructor(e){super(e),this.name="ExchangeClosedByUser"}}class E extends i{constructor(e){super(e),this.name="OperationFailed"}}class _ extends E{constructor(e){super(e),this.name="NetworkError"}}class B extends _{constructor(e){super(e),this.name="DDoSProtection"}}class N extends _{constructor(e){super(e),this.name="RateLimitExceeded"}}class R extends _{constructor(e){super(e),this.name="ExchangeNotAvailable"}}class L extends R{constructor(e){super(e),this.name="OnMaintenance"}}class V extends _{constructor(e){super(e),this.name="InvalidNonce"}}class D extends _{constructor(e){super(e),this.name="RequestTimeout"}}const q={BaseError:i,ExchangeError:r,AuthenticationError:a,PermissionDenied:o,AccountNotEnabled:n,AccountSuspended:d,ArgumentsRequired:h,BadRequest:c,BadSymbol:l,OperationRejected:u,NoChange:p,MarginModeAlreadySet:f,BadResponse:m,NullResponse:g,InsufficientFunds:v,InvalidAddress:y,AddressPending:w,InvalidOrder:b,OrderNotFound:S,OrderNotCached:k,CancelPending:O,OrderImmediatelyFillable:T,OrderNotFillable:P,DuplicateOrderId:x,ContractUnavailable:I,NotSupported:M,ProxyError:A,ExchangeClosedByUser:C,OperationFailed:E,NetworkError:_,DDoSProtection:B,RateLimitExceeded:N,ExchangeNotAvailable:R,OnMaintenance:L,InvalidNonce:V,RequestTimeout:D}},7100:(e,t,s)=>{s.r(t),s.d(t,{DECIMAL_PLACES:()=>n.nr,NO_PADDING:()=>n.EZ,PAD_WITH_ZERO:()=>n.Z_,ROUND:()=>n.oU,ROUND_DOWN:()=>n.qh,ROUND_UP:()=>n.N8,SIGNIFICANT_DIGITS:()=>n.tV,TICK_SIZE:()=>n.sh,TRUNCATE:()=>n.tk,Throttler:()=>l.e,TimedOut:()=>c.PL,aggregate:()=>u.m_,arrayConcat:()=>r.oE,asFloat:()=>o.GX,asInteger:()=>o.xJ,axolotl:()=>h.gC,base16ToBinary:()=>d.aj,base58ToBinary:()=>d.ZA,base64ToBinary:()=>d.R5,base64ToString:()=>d.Vy,binaryConcat:()=>d.F6,binaryConcatArray:()=>d.C_,binaryToBase16:()=>d.d9,binaryToBase58:()=>d.cN,binaryToBase64:()=>d.bA,binaryToString:()=>d.rV,capitalize:()=>a.kC,clone:()=>r.d9,crc32:()=>h.kn,decimalToPrecision:()=>n._T,decode:()=>d.Jx,deepExtend:()=>r.ZB,ecdsa:()=>h.bu,eddsa:()=>h.UZ,encode:()=>d.cv,extend:()=>r.l7,extractParams:()=>u.k,filterBy:()=>r.j,flatten:()=>r.xH,groupBy:()=>r.vM,hasProps:()=>o.s_,hash:()=>h.vp,hmac:()=>h.bD,implodeParams:()=>u.xX,inArray:()=>r.d3,index:()=>r.Kz,indexBy:()=>r.HK,isArray:()=>o.kJ,isBrowser:()=>i.jU,isDictionary:()=>o.wg,isElectron:()=>i.d,isEmpty:()=>r.xb,isInteger:()=>o.U,isJsonEncodedObject:()=>d.Dd,isNode:()=>i.UG,isNumber:()=>o.hj,isObject:()=>o.Kn,isString:()=>o.HD,isStringCoercible:()=>o.bT,isWebWorker:()=>i.n2,isWindows:()=>i.ED,iso8601:()=>c.qo,json:()=>d.AV,keys:()=>r.XP,keysort:()=>r.x4,mdy:()=>c.xg,merge:()=>r.TS,microseconds:()=>c.sR,milliseconds:()=>c.m,now:()=>c.zO,numberToBE:()=>d.cm,numberToLE:()=>d.K0,numberToString:()=>n.D$,omit:()=>r.CE,omitZero:()=>n.Zb,ordered:()=>r.sT,packb:()=>d.UN,parse8601:()=>c.V$,parseDate:()=>c.sG,parseTimeframe:()=>u.A7,pluck:()=>r.jg,precisionConstants:()=>n.S5,precisionFromString:()=>n.Rl,prop:()=>o.vg,rawencode:()=>d.Ot,rfc2616:()=>c.Nz,roundTimeframe:()=>u.KV,safeFloat:()=>o.Vb,safeFloat2:()=>o.ds,safeFloatN:()=>o._3,safeInteger:()=>o.oF,safeInteger2:()=>o.bz,safeIntegerN:()=>o.c$,safeIntegerProduct:()=>o.mM,safeIntegerProduct2:()=>o.yy,safeIntegerProductN:()=>o.RF,safeString:()=>o.p2,safeString2:()=>o.St,safeStringLower:()=>o.BL,safeStringLower2:()=>o.I1,safeStringLowerN:()=>o.oz,safeStringN:()=>o.xV,safeStringUpper:()=>o.ff,safeStringUpper2:()=>o.Wp,safeStringUpperN:()=>o.aK,safeTimestamp:()=>o.ES,safeTimestamp2:()=>o.Nc,safeTimestampN:()=>o.pA,safeValue:()=>o.Wz,safeValue2:()=>o.bS,safeValueN:()=>o.WW,seconds:()=>c.m9,setTimeout_safe:()=>c.qc,sleep:()=>c._v,sortBy:()=>r.MR,sortBy2:()=>r.uv,stringToBase64:()=>d.Ne,stringToBinary:()=>d.mW,strip:()=>a.Aq,sum:()=>r.Sm,timeout:()=>c.Vs,toArray:()=>r.qo,truncate:()=>n.$G,truncate_to_string:()=>n.qL,unCamelCase:()=>a.u,unique:()=>r.Tw,urlencode:()=>d.i$,urlencodeBase64:()=>d.xr,urlencodeNested:()=>d.xX,urlencodeWithArrayRepeat:()=>d.jD,uuid:()=>a.Vj,uuid16:()=>a.fY,uuid22:()=>a.mO,uuidv1:()=>c.ft,values:()=>r.VO,vwap:()=>u.KY,ymd:()=>c.Eo,ymdhms:()=>c.KN,yymmdd:()=>c.ax,yyyymmdd:()=>c.rm});var i=s(9125),r=s(927),a=s(7715),o=s(5948),n=s(9292),d=s(1237),h=s(6890),c=s(1621),l=s(5134),u=s(2116)},6890:(e,t,s)=>{s.d(t,{UZ:()=>g,bD:()=>p,bu:()=>f,gC:()=>m,kn:()=>v,vp:()=>u});var i=s(138),r=s(9651),a=s(9285),o=s(1728),n=s(1339),d=s(2572),h=s(2773);const c={binary:e=>e,hex:r.YU.encode,base64:r.US.encode},l={"1.3.132.0.10":n.kA,"1.2.840.10045.3.1.7":d.lA},u=(e,t,s="hex")=>{const i=t(e);return c[s](i)},p=(e,t,s,r="hex")=>{const a=(0,i.b)(s,t,e);return c[r](a)};function f(e,t,s,i=null,r=!1){if(i&&(e=u(e,i,"hex")),"string"==typeof t&&t.length>64){if(!t.startsWith("-----BEGIN EC PRIVATE KEY-----"))throw new Error("Unsupported key format");{const e=a.D.unarmor(t);let i=o.lj.decode(e);if(4!==i.sub.length)throw new Error("Unsupported key format");if(null!==typeof i.sub[2].sub&&i.sub[2].sub.length>0){const e=i.sub[2].sub[0].content(void 0);if(void 0===l[e])throw new Error("Unsupported curve");s=l[e]}t=i.sub[1].getHexStringValue()}}let n=s.sign(e,t,{lowS:!0});const d=(BigInt(1)<c||n.r<=d||n.s<=d);)n=s.sign(e,t,{lowS:!0,extraEntropy:(0,h.S5)(BigInt(p),32)}),p+=1;return{r:n.r.toString(16),s:n.s.toString(16),v:n.recovery}}function m(e,t,s){const i=s.signModified(e,t);return r.Jq.encode(i)}function g(e,t,s){const i=new Uint8Array(a.D.unarmor(t).slice(16)),o=s.sign(e,i);return r.US.encode(o)}function v(e,t=!1){void 0===v.table&&(v.table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".split(" ").map((e=>parseInt(e,16))));let s=-1;for(let t=0;t>>8^v.table[255&(s^e.charCodeAt(t))];const i=(-1^s)>>>0;return t&&i>=2147483648?i-4294967296:i}},1237:(e,t,s)=>{s.d(t,{AV:()=>d,C_:()=>S,Dd:()=>h,F6:()=>b,Jx:()=>I,K0:()=>A,Ne:()=>u,Ot:()=>P,R5:()=>f,UN:()=>E,Vy:()=>p,ZA:()=>y,aj:()=>g,bA:()=>m,cN:()=>w,cm:()=>C,cv:()=>x,d9:()=>v,i$:()=>k,jD:()=>T,mW:()=>l,rV:()=>c,xX:()=>O,xr:()=>M});var i=s(9651),r=s(2773),a=s(9948),o=s(3165),n=s.n(o);const d=(e,t=void 0)=>JSON.stringify(e),h=e=>"string"==typeof e&&e.length>=2&&("{"===e[0]||"["===e[0]),c=i.KA.encode,l=i.KA.decode,u=e=>i.US.encode(i.KA.decode(e)),p=e=>i.KA.encode(i.US.decode(e)),f=i.US.decode,m=i.US.encode,g=i.YU.decode,v=i.YU.encode,y=i.Jq.decode,w=i.Jq.encode,b=r.eV,S=e=>(0,r.eV)(...e),k=e=>n().stringify(e),O=e=>n().stringify(e),T=e=>n().stringify(e,{arrayFormat:"repeat"}),P=e=>n().stringify(e,{encode:!1}),x=i.KA.decode,I=i.KA.encode,M=e=>e.replace(/[=]+$/,"").replace(/\+/g,"-").replace(/\//g,"_"),A=(e,t)=>(0,r.S5)(BigInt(e),t),C=(e,t)=>(0,r.tL)(BigInt(e),t);function E(e){return(0,a.q)(e)}},927:(e,t,s)=>{s.d(t,{CE:()=>O,HK:()=>v,Kz:()=>o,MR:()=>w,Sm:()=>T,TS:()=>x,Tw:()=>c,VO:()=>a,XP:()=>r,ZB:()=>P,d3:()=>u,d9:()=>d,j:()=>y,jg:()=>k,l7:()=>n,oE:()=>l,qo:()=>p,sT:()=>h,uv:()=>b,vM:()=>g,x4:()=>m,xH:()=>S,xb:()=>f});var i=s(5948);const r=Object.keys,a=e=>(0,i.kJ)(e)?e:Object.values(e),o=e=>new Set(a(e)),n=(...e)=>Object.assign({},...e),d=e=>(0,i.kJ)(e)?Array.from(e):n(e),h=e=>e,c=e=>Array.from(o(e)),l=(e,t)=>e.concat(t),u=(e,t)=>t.includes(e),p=e=>Object.values(e),f=e=>!e||(Array.isArray(e)?e:Object.keys(e)).length<1,m=(e,t={})=>{for(const s of r(e).sort())t[s]=e[s];return t},g=(e,t,s={})=>{for(const i of a(e))if(t in i){const e=i[t];s[e]=s[e]||[],s[e].push(i)}return s},v=(e,t,s={})=>{for(const i of a(e))t in i&&(s[i[t]]=i);return s},y=(e,t,s=void 0,i=[])=>{for(const r of a(e))r[t]===s&&i.push(r);return i},w=(e,t,s=!1,i=0,r=(s?-1:1))=>e.sort(((e,s)=>{const a=t in e?e[t]:i,o=t in s?s[t]:i;return ao?r:0})),b=(e,t,s,i=!1,r=(i?-1:1))=>e.sort(((e,i)=>e[t]i[t]?r:e[s]i[s]?r:0)),S=function e(t,s=[]){for(const r of t)(0,i.kJ)(r)?e(r,s):s.push(r);return s},k=(e,t)=>a(e).filter((e=>t in e)).map((e=>e[t])),O=(e,...t)=>{if(!Array.isArray(e)){const s=d(e);for(const e of t)if((0,i.kJ)(e))for(const t of e)delete s[t];else delete s[e];return s}return e},T=(...e)=>{const t=e.filter(i.hj);return t.length>0?t.reduce(((e,t)=>e+t),0):void 0},P=function e(...t){let s;for(const r of t)if((0,i.wg)(r)){(0,i.wg)(s)||(s={});for(const t in r)s[t]=e(s[t],r[t])}else s=r;return s},x=(e,...t)=>{const s={},i=Object.assign({},...t),r=Object.keys(i);for(let t=0;t{s.d(t,{A7:()=>o,KV:()=>n,KY:()=>c,k:()=>d,m_:()=>l,xX:()=>h});var i=s(9292),r=s(5948),a=s(6689);const o=e=>{const t=(0,r.GX)(e.slice(0,-1)),s=e.slice(-1);let i;if("y"===s)i=31536e3;else if("M"===s)i=2592e3;else if("w"===s)i=604800;else if("d"===s)i=86400;else if("h"===s)i=3600;else if("m"===s)i=60;else{if("s"!==s)throw new a.NotSupported("timeframe unit "+s+" is not supported");i=1}return t*i},n=(e,t,s=i.qh)=>{const r=1e3*o(e);return t-t%r+(s===i.N8?r:0)},d=e=>{const t=/{([\w-]+)}/g,s=[];let i=t.exec(e);for(;i;)s.push(i[1]),i=t.exec(e);return s},h=(e,t)=>{if(!Array.isArray(t)){const s=Object.keys(t);for(let i=0;i0?t/e:void 0}function l(e){const t={};for(let s=0;s0&&(t[i]=(t[i]||0)+r)}return Object.keys(t).map((e=>[parseFloat(e),parseFloat(t[e])]))}},9292:(e,t,s)=>{s.d(t,{$G:()=>g,D$:()=>p,EZ:()=>c,N8:()=>a,Rl:()=>v,S5:()=>u,Z_:()=>l,Zb:()=>w,_T:()=>y,nr:()=>n,oU:()=>r,qL:()=>m,qh:()=>o,sh:()=>h,tV:()=>d,tk:()=>i});const i=0,r=1,a=2,o=3,n=2,d=3,h=4,c=5,l=6,u={ROUND:r,TRUNCATE:i,ROUND_UP:a,ROUND_DOWN:o,DECIMAL_PLACES:n,SIGNIFICANT_DIGITS:d,TICK_SIZE:h,NO_PADDING:c,PAD_WITH_ZERO:l};function p(e){if(void 0===e)return;if("number"!=typeof e)return e.toString();const t=e.toString();if(Math.abs(e)<1){const s=t.split("e-"),i=s[0].replace(".",""),r=parseInt(s[1]),a="-"===t[0];if(r)return e=(a?"-":"")+"0."+new Array(r).join("0")+i.substring(a)}else{const e=t.split("e");if(e[1]){let t=parseInt(e[1]);const s=e[0].split(".");let i="";return s[1]&&(t-=s[1].length,i=s[1]),s[0]+i+new Array(t+1).join("0")}}return t}const f=[],m=(e,t=0)=>{if(e=p(e),t>0){const s=f[t]||(f[t]=new RegExp("([-]*\\d+\\.\\d{"+t+"})(\\d)")),[,i]=e.toString().match(s)||[null,e];return i.toString()}return parseInt(e).toString()},g=(e,t=0)=>parseFloat(m(e,t));function v(e){if(e.indexOf("e")>-1){const t=e.replace(/\de/,"");return-1*parseInt(t)}const t=e.replace(/0+$/g,"").split(".");return t.length>1?t[1].length:0}const y=(e,t,s,a=n,o=c)=>{if(a===h&&("string"==typeof s&&(s=parseFloat(s)),s<=0))throw new Error("TICK_SIZE cant be used with negative or zero numPrecisionDigits");if(s<0){const n=Math.pow(10,-s);if(t===r)return(n*y(e/n,t,0,a,o)).toString();if(t===i)return(e-e%n).toString()}if(a===h){const a=v(y(s,r,22,n,c));let d=e%s;d=Number(y(d,r,8,n,c));return 0!==v(y(d/s,r,Math.max(a,8),n,c))&&(t===r?e>0?d>=s/2?e=e-d+s:e-=d:e=d>=s/2?Number(e)-d:Number(e)-d-s:t===i&&(e-=d)),y(e,r,a,n,o)}const l=p(e),u="-"===l[0],f=u?1:0,m=l.length;for(var g=0;g57)throw new Error(`${l}: invalid number (contains an illegal character '${l[P-1]}')`);S[P]=e,e!==b&&O<0&&(O=P)}}O<0&&(O=1);let I=a===n?k:O,M=I+s;T=-1;let A=!0,C=u;for(let e=S.length-1,i=0;e>=0;e--){let a=S[e];if(0!==e){if(a+=i,e>=I+s){a=t===r&&a>=53&&!(53===a&&i)?58:b}a>57?(a=b,i=1):i=0}else i&&(a=49);S[e]=a,a!==b&&(A=!1,O=e,T=T<0?e+1:T)}a===d&&(I=O,M=I+s),A&&(C=!1);const E=O>=k||A?k-1:O,_=T{s.d(t,{ED:()=>o,UG:()=>n,d:()=>r,jU:()=>i,n2:()=>a});const i="undefined"!=typeof window,r="undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.electron,a="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,o="undefined"!=typeof process&&"win32"===process.platform,n=!(i||a)},5981:(e,t,s)=>{s.d(t,{F:()=>h,j:()=>d});var i=s(9026),r=s(9651),a=s(1237),o=s(6890),n=s(2572);function d(e,t,s){const a=new i.X;a.setPrivateKey(t);const o=s.create().constructor.name.toLowerCase();return a.sign(e,(e=>r.YU.encode(s(e))),o)}function h(e,t,s,i=!1,h={}){let c=(i?"RS":"HS")+8*s.outputLen;h.alg&&(c=h.alg.toUpperCase());const l=Object.assign({alg:c,typ:"JWT"},h);void 0!==l.iat&&(e.iat=l.iat,delete l.iat);const u=[(0,a.xr)((0,a.Ne)(JSON.stringify(l))),(0,a.xr)((0,a.Ne)(JSON.stringify(e)))].join("."),p=c.slice(0,2);let f;if("HS"===p)f=(0,a.xr)((0,o.bD)(u,t,s,"base64"));else if(i||"RS"===p)f=(0,a.xr)(d(u,r.KA.encode(t),s));else if("ES"===p){const e=(0,o.bu)(u,r.KA.encode(t),n.lA,s),i=e.r.padStart(64,"0"),d=e.s.padStart(64,"0");f=(0,a.xr)((0,a.bA)((0,a.aj)(i+d)))}return[u,f].join(".")}},7715:(e,t,s)=>{s.d(t,{Aq:()=>a,Vj:()=>o,fY:()=>n,kC:()=>r,mO:()=>d,u:()=>i});const i=e=>{const t={fetchOHLCVWs:"fetch_ohlcv_ws"};return t[e]?t[e]:e.match(/[A-Z]/)?e.replace(/[a-z0-9][A-Z]/g,(e=>e[0]+"_"+e[1])).replace(/[A-Z0-9][A-Z0-9][a-z][^$]/g,(e=>e[0]+"_"+e[1]+e[2]+e[3])).replace(/[a-z][0-9]$/g,(e=>e[0]+"_"+e[1])).toLowerCase():e},r=e=>e.length?e.charAt(0).toUpperCase()+e.slice(1):e,a=e=>e.replace(/^\s+|\s+$/g,""),o=e=>e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,o),n=e=>e?(e^16*Math.random()>>e/4).toString(16):([1e5]+100+400+8e3).replace(/[018]/g,n),d=e=>e?(e^16*Math.random()>>e/4).toString(16):([1e7]+1e3+4e3+8e5).replace(/[018]/g,d)},5134:(e,t,s)=>{s.d(t,{e:()=>r});var i=s(1621);class r{constructor(e){this.config={refillRate:1,delay:.001,capacity:1,maxCapacity:2e3,tokens:0,cost:1},Object.assign(this.config,e),this.queue=[],this.running=!1}async loop(){let e=(0,i.zO)();for(;this.running;){const{resolver:t,cost:s}=this.queue[0];if(this.config.tokens>=0)this.config.tokens-=s,t(),this.queue.shift(),await Promise.resolve(),0===this.queue.length&&(this.running=!1);else{await(0,i._v)(1e3*this.config.delay);const t=(0,i.zO)(),s=t-e;e=t;const r=this.config.tokens+this.config.refillRate*s;this.config.tokens=Math.min(r,this.config.capacity)}}}throttle(e=void 0){let t;const s=new Promise(((e,s)=>{t=e}));if(this.queue.length>this.config.maxCapacity)throw new Error("throttle queue is over maxCapacity ("+this.config.maxCapacity.toString()+"), see https://github.com/ccxt/ccxt/issues/11645#issuecomment-1195695526");return e=void 0===e?this.config.cost:e,this.queue.push({resolver:t,cost:e}),this.running||(this.running=!0,this.loop()),s}}},1621:(e,t,s)=>{s.d(t,{Eo:()=>g,KN:()=>w,Nz:()=>f,PL:()=>c,V$:()=>u,Vs:()=>S,_v:()=>b,ax:()=>v,ft:()=>n,m:()=>a,m9:()=>o,qc:()=>h,qo:()=>l,rm:()=>y,sG:()=>p,sR:()=>r,xg:()=>m,zO:()=>i});const i=Date.now,r=()=>1e3*i(),a=i,o=()=>Math.floor(i()/1e3),n=()=>{const e=(10*r()+122192928e9).toString(16);return e.slice(7,15)+e.slice(3,7)+"1"+e.slice(0,3)+"9696"+"ff".repeat(6)},d=setTimeout,h=(e,t,s=d,r=i()+t)=>{if(t>=2147483647)throw new Error("setTimeout() function was called with unrealistic value of "+t.toString());let a=()=>{},o=!0;const n=s((()=>{o=!0;const t=r-i();t>0?a=h(e,t,s,r):e()}),t);return function(){o&&(o=!1,clearTimeout(n)),a()}};class c extends Error{constructor(){const e="timed out";super(e),this.constructor=c,this.__proto__=c.prototype,this.message=e}}const l=e=>{let t;if(t="number"==typeof e?Math.floor(e):parseInt(e,10),!(Number.isNaN(t)||t<0))try{return new Date(t).toISOString()}catch(e){return}},u=e=>{if("string"==typeof e&&e&&!e.match(/^[0-9]+$/)&&!(e.indexOf("-")<0||e.indexOf(":")<0))try{const t=Date.parse(e.indexOf("+")>=0||"Z"===e.slice(-1)?e:(e+"Z").replace(/\s(\d\d):/,"T$1:"));if(Number.isNaN(t))return;return t}catch(e){return}},p=e=>{if("string"==typeof e&&e){if(e.indexOf("GMT")>=0)try{return Date.parse(e)}catch(e){return}return u(e)}},f=(e=void 0)=>new Date(e).toUTCString(),m=(e,t="-")=>{t=t||"";const s=new Date(e),i=s.getUTCFullYear().toString();let r=s.getUTCMonth()+1,a=s.getUTCDate();return r=r<10?"0"+r:r.toString(),a=a<10?"0"+a:a.toString(),r+t+a+t+i},g=(e,t,s=!0)=>{t=t||"";const i=new Date(e),r=i.getUTCFullYear(),a=(s?r:r-2e3).toString();let o=i.getUTCMonth()+1,n=i.getUTCDate();return o=o<10?"0"+o:o.toString(),n=n<10?"0"+n:n.toString(),a+t+o+t+n},v=(e,t="")=>g(e,t,!1),y=(e,t="-")=>g(e,t,!0),w=(e,t=" ")=>{const s=new Date(e),i=s.getUTCFullYear();let r=s.getUTCMonth()+1,a=s.getUTCDate(),o=s.getUTCHours(),n=s.getUTCMinutes(),d=s.getUTCSeconds();return r=r<10?"0"+r:r,a=a<10?"0"+a:a,o=o<10?"0"+o:o,n=n<10?"0"+n:n,d=d<10?"0"+d:d,i+"-"+r+"-"+a+t+o+":"+n+":"+d},b=e=>new Promise((t=>h(t,e))),S=async(e,t)=>{let s=()=>{};const i=new Promise((t=>s=h(t,e)));try{return await Promise.race([t,i.then((()=>{throw new c}))])}finally{s()}}},2523:(e,t,s)=>{s.d(t,{H:()=>o,Z:()=>n});var i=s(9651),r=s(3307),a=s(6890);function o(e){const t=e=>parseInt(e,16);e=e.replace(" ","");const s=Math.round((new Date).getTime()/1e3),o=((e,t)=>(t+e).slice(-t.length))(((n=Math.floor(s/30))<15.5?"0":"")+Math.round(n).toString(16),"0000000000000000");var n;const d=(0,a.bD)(i.YU.decode(o),i.pJ.decode(e),r.q,"hex"),h=t(d.substring(d.length-1));let c=(t(d.substr(2*h,8))&t("7fffffff"))+"";return c.substring(c.length-6,c.length)}const n=o},5948:(e,t,s)=>{s.d(t,{BL:()=>k,ES:()=>w,GX:()=>f,HD:()=>n,I1:()=>C,Kn:()=>d,Nc:()=>I,RF:()=>N,St:()=>A,U:()=>r,Vb:()=>g,WW:()=>L,Wp:()=>E,Wz:()=>b,_3:()=>_,aK:()=>q,bS:()=>M,bT:()=>c,bz:()=>P,c$:()=>B,ds:()=>T,ff:()=>O,hj:()=>i,kJ:()=>a,mM:()=>y,oF:()=>v,oz:()=>D,p2:()=>S,pA:()=>R,s_:()=>o,vg:()=>l,wg:()=>h,xJ:()=>m,xV:()=>V,yy:()=>x});const i=Number.isFinite,r=Number.isInteger,a=Array.isArray,o=e=>null!=e,n=e=>"string"==typeof e,d=e=>null!==e&&"object"==typeof e,h=e=>d(e)&&Object.getPrototypeOf(e)===Object.prototype&&!a(e)&&!(e=>e instanceof RegExp)(e),c=e=>o(e)&&e.toString||i(e),l=(e,t)=>d(e)&&""!==e[t]&&null!==e[t]?e[t]:void 0,u=(e,t,s)=>d(e)?void 0!==e[t]&&""!==e[t]&&null!==e[t]?e[t]:""!==e[s]&&null!==e[s]?e[s]:void 0:void 0,p=(e,t)=>e[t.find((t=>void 0!==l(e,t)))],f=e=>i(e)||n(e)&&0!==e.length?parseFloat(e):NaN,m=e=>i(e)||n(e)&&0!==e.length?Math.trunc(Number(e)):NaN,g=(e,t,s)=>{const r=f(l(e,t));return i(r)?r:s},v=(e,t,s)=>{const r=m(l(e,t));return i(r)?r:s},y=(e,t,s,r)=>{const a=f(l(e,t));return i(a)?parseInt(a*s):r},w=(e,t,s)=>{const r=f(l(e,t));return i(r)?parseInt(1e3*r):s},b=(e,t,s)=>{const i=l(e,t);return o(i)?i:s},S=(e,t,s)=>{const i=l(e,t);return c(i)?String(i):s},k=(e,t,s)=>{const i=l(e,t);return c(i)?String(i).toLowerCase():s},O=(e,t,s)=>{const i=l(e,t);return c(i)?String(i).toUpperCase():s},T=(e,t,s,r)=>{const a=f(u(e,t,s));return i(a)?a:r},P=(e,t,s,r)=>{const a=m(u(e,t,s));return i(a)?a:r},x=(e,t,s,r,a)=>{const o=m(u(e,t,s));return i(o)?parseInt(o*r):a},I=(e,t,s,r)=>{const a=f(u(e,t,s));return i(a)?parseInt(1e3*a):r},M=(e,t,s,i)=>{const r=u(e,t,s);return o(r)?r:i},A=(e,t,s,i)=>{const r=u(e,t,s);return c(r)?String(r):i},C=(e,t,s,i)=>{const r=u(e,t,s);return c(r)?String(r).toLowerCase():i},E=(e,t,s,i)=>{const r=u(e,t,s);return c(r)?String(r).toUpperCase():i},_=(e,t,s)=>{const r=f(p(e,t));return i(r)?r:s},B=(e,t,s)=>{if(void 0===e)return s;const r=m(p(e,t));return i(r)?r:s},N=(e,t,s,r)=>{const a=m(p(e,t));return i(a)?parseInt(a*s):r},R=(e,t,s)=>{const r=f(p(e,t));return i(r)?parseInt(1e3*r):s},L=(e,t,s)=>{if(void 0===e)return s;const i=p(e,t);return o(i)?i:s},V=(e,t,s)=>{if(void 0===e)return s;const i=p(e,t);return c(i)?String(i):s},D=(e,t,s)=>{if(void 0===e)return s;const i=p(e,t);return c(i)?String(i).toLowerCase():s},q=(e,t,s)=>{const i=p(e,t);return c(i)?String(i).toUpperCase():s}},3020:(e,t,s)=>{s.d(t,{Py:()=>a,ZL:()=>r,hl:()=>o,tU:()=>n});class i extends Array{constructor(e=void 0){super(),Object.defineProperty(this,"maxSize",{__proto__:null,value:e,writable:!0})}clear(){this.length=0}}class r extends i{constructor(e=void 0){super(e),this.hashmap={},Object.defineProperty(this,"nestedNewUpdatesBySymbol",{__proto__:null,value:!1,writable:!0}),Object.defineProperty(this,"newUpdatesBySymbol",{__proto__:null,value:{},writable:!0}),Object.defineProperty(this,"clearUpdatesBySymbol",{__proto__:null,value:{},writable:!0}),Object.defineProperty(this,"allNewUpdates",{__proto__:null,value:0,writable:!0}),Object.defineProperty(this,"clearAllUpdates",{__proto__:null,value:!1,writable:!0}),Object.defineProperty(this,"hashmap",{__proto__:null,value:{},writable:!0,enumerable:!1})}getLimit(e,t){let s;return void 0===e?(s=this.allNewUpdates,this.clearAllUpdates=!0):(s=this.newUpdatesBySymbol[e],void 0!==s&&this.nestedNewUpdatesBySymbol&&(s=s.size),this.clearUpdatesBySymbol[e]=!0),void 0===s?t:void 0!==t?Math.min(s,t):s}append(e){this.maxSize&&this.length===this.maxSize&&this.shift(),this.push(e),this.clearAllUpdates&&(this.clearAllUpdates=!1,this.clearUpdatesBySymbol={},this.allNewUpdates=0,this.newUpdatesBySymbol={}),this.clearUpdatesBySymbol[e.symbol]&&(this.clearUpdatesBySymbol[e.symbol]=!1,this.newUpdatesBySymbol[e.symbol]=0),this.newUpdatesBySymbol[e.symbol]=(this.newUpdatesBySymbol[e.symbol]||0)+1,this.allNewUpdates=(this.allNewUpdates||0)+1}}class a extends i{constructor(e=void 0){super(e),Object.defineProperty(this,"hashmap",{__proto__:null,value:{},writable:!0}),Object.defineProperty(this,"sizeTracker",{__proto__:null,value:new Set,writable:!0}),Object.defineProperty(this,"newUpdates",{__proto__:null,value:0,writable:!0}),Object.defineProperty(this,"clearUpdates",{__proto__:null,value:!1,writable:!0})}getLimit(e,t){return this.clearUpdates=!0,void 0===t?this.newUpdates:Math.min(this.newUpdates,t)}append(e){if(e[0]in this.hashmap){const t=this.hashmap[e[0]];if(t!==e)for(const s in e)t[s]=e[s]}else{if(this.hashmap[e[0]]=e,this.maxSize&&this.length===this.maxSize){const e=this.shift();delete this.hashmap[e[0]]}this.push(e)}this.clearUpdates&&(this.clearUpdates=!1,this.sizeTracker.clear()),this.sizeTracker.add(e[0]),this.newUpdates=this.sizeTracker.size}}class o extends r{constructor(e=void 0){super(e),this.nestedNewUpdatesBySymbol=!0}append(e){const t=this.hashmap[e.symbol]=this.hashmap[e.symbol]||{};if(e.id in t){const s=t[e.id];if(s!==e)for(const t in e)s[t]=e[t];e=s;const i=this.findIndex((t=>t.id===e.id));this.splice(i,1)}else t[e.id]=e;if(this.maxSize&&this.length===this.maxSize){const e=this.shift();delete this.hashmap[e.symbol][e.id]}this.push(e),this.clearAllUpdates&&(this.clearAllUpdates=!1,this.clearUpdatesBySymbol={},this.allNewUpdates=0,this.newUpdatesBySymbol={}),void 0===this.newUpdatesBySymbol[e.symbol]&&(this.newUpdatesBySymbol[e.symbol]=new Set),this.clearUpdatesBySymbol[e.symbol]&&(this.clearUpdatesBySymbol[e.symbol]=!1,this.newUpdatesBySymbol[e.symbol].clear());const s=this.newUpdatesBySymbol[e.symbol],i=s.size;s.add(e.id);const r=s.size;this.allNewUpdates=(this.allNewUpdates||0)+(r-i)}}class n extends r{constructor(){super(),this.nestedNewUpdatesBySymbol=!0,Object.defineProperty(this,"hashmap",{__proto__:null,value:{},writable:!0})}append(e){const t=this.hashmap[e.symbol]=this.hashmap[e.symbol]||{};if(e.side in t){const s=t[e.side];if(s!==e)for(const t in e)s[t]=e[t];e=s;const i=this.findIndex((t=>t.symbol===e.symbol&&t.side===e.side));this.splice(i,1)}else t[e.side]=e;this.push(e),this.clearAllUpdates&&(this.clearAllUpdates=!1,this.clearUpdatesBySymbol={},this.allNewUpdates=0,this.newUpdatesBySymbol={}),void 0===this.newUpdatesBySymbol[e.symbol]&&(this.newUpdatesBySymbol[e.symbol]=new Set),this.clearUpdatesBySymbol[e.symbol]&&(this.clearUpdatesBySymbol[e.symbol]=!1,this.newUpdatesBySymbol[e.symbol].clear());const s=this.newUpdatesBySymbol[e.symbol],i=s.size;s.add(e.side);const r=s.size;this.allNewUpdates=(this.allNewUpdates||0)+(r-i)}}},2897:(e,t,s)=>{s.d(t,{Z:()=>l});var i=s(6689),r=s(7348),a=s(2367),o=s(927),n=s(1621),d=s(9125),h=s(1237),c=s(9651);class l{constructor(e,t,s,i,r,n={}){const d={url:e,onMessageCallback:t,onErrorCallback:s,onCloseCallback:i,onConnectedCallback:r,verbose:!1,protocols:void 0,options:void 0,futures:{},subscriptions:{},rejections:{},connected:void 0,error:void 0,connectionStarted:void 0,connectionEstablished:void 0,isConnected:!1,connectionTimer:void 0,connectionTimeout:1e4,pingInterval:void 0,ping:void 0,keepAlive:3e4,maxPingPongMisses:2,connection:void 0,startedConnecting:!1,gunzip:!1,inflate:!1};Object.assign(this,(0,o.ZB)(d,n)),this.connected=(0,a.o)()}future(e){e in this.futures||(this.futures[e]=(0,a.o)());const t=this.futures[e];return e in this.rejections&&(t.reject(this.rejections[e]),delete this.rejections[e]),t}resolve(e,t){if(this.verbose&&void 0===t&&this.log(new Date,"resolve received undefined messageHash"),t in this.futures){this.futures[t].resolve(e),delete this.futures[t]}return e}reject(e,t=void 0){if(t)if(t in this.futures){this.futures[t].reject(e),delete this.futures[t]}else this.rejections[t]=e;else{const t=Object.keys(this.futures);for(let s=0;s{this.onError(e)})):d.UG?this.connection.ping():this.lastPong=e}}}onOpen(){this.verbose&&this.log(new Date,"onOpen"),this.connectionEstablished=(0,n.m)(),this.isConnected=!0,this.connected.resolve(this.url),this.clearConnectionTimeout(),this.setPingInterval(),this.onConnectedCallback(this)}onPing(){this.verbose&&this.log(new Date,"onPing")}onPong(){this.lastPong=(0,n.m)(),this.verbose&&this.log(new Date,"onPong")}onError(e){this.verbose&&this.log(new Date,"onError",e.message),e instanceof i.BaseError||(e=new i.NetworkError(e.message)),this.error=e,this.reset(this.error),this.onErrorCallback(this,this.error)}onClose(e){this.verbose&&this.log(new Date,"onClose",e),this.error||this.reset(new i.NetworkError("connection closed by remote server, closing code "+String(e.code))),this.error instanceof i.ExchangeClosedByUser&&this.reset(this.error),void 0!==this.disconnected&&this.disconnected.resolve(!0),this.onCloseCallback(this,e)}onUpgrade(e){this.verbose&&this.log(new Date,"onUpgrade")}async send(e){this.verbose&&this.log(new Date,"sending",e),e="string"==typeof e?e:JSON.stringify(e);const t=(0,a.o)();if(d.UG){function s(e){e?t.reject(e):t.resolve(null)}this.connection.send(e,{},s)}else this.connection.send(e),t.resolve(null);return t}close(){throw new i.NotSupported("close() not implemented yet")}onMessage(e){let t,s=e.data;"string"!=typeof s&&(this.gunzip||this.inflate?(t=new Uint8Array(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)),this.gunzip?t=(0,r._Z)(t):this.inflate&&(t=(0,r.n)(t)),s=c.KA.encode(t)):s=s.toString());try{(0,h.Dd)(s)&&(s=JSON.parse(s.replace(/:(\d{15,}),/g,':"$1",'))),this.verbose&&this.log(new Date,"onMessage",s)}catch(e){this.log(new Date,"onMessage JSON.parse",e)}try{this.onMessageCallback(this,s)}catch(e){this.reject(e)}}}},2367:(e,t,s)=>{function i(){let e,t;const s=new Promise(((s,i)=>{e=s,t=i}));return s.resolve=function(){setTimeout((()=>{e.apply(this,arguments)}))},s.reject=function(){setTimeout((()=>{t.apply(this,arguments)}))},s}s.d(t,{o:()=>i}),i.race=e=>function(e){const t=i();return e.then(t.resolve,t.reject),t}(Promise.race(e))},7091:(e,t,s)=>{s.d(t,{ZY:()=>o,rc:()=>d,yk:()=>n});var i=s(1621),r=s(927),a=s(416);class o{constructor(e={},t=void 0){this.cache=[],Object.defineProperty(this,"cache",{__proto__:null,value:[],writable:!0,enumerable:!1}),t=t||Number.MAX_SAFE_INTEGER;const s={bids:[],asks:[],timestamp:void 0,datetime:void 0,nonce:void 0,symbol:void 0},o=Object.entries((0,r.l7)(s,e));for(let e=0;e{function i(e,t){let s=0,i=e.length-1;for(;s<=i;){const r=s+i>>>1;e[r]-t<0?s=r+1:i=r-1}return s}s.d(t,{GC:()=>l,T8:()=>h,jC:()=>c,lB:()=>d,rH:()=>p,wG:()=>u});const r=new Float64Array(new Array(1024).fill(Number.MAX_VALUE));class a extends Array{constructor(e=[],t=void 0){super(),Object.defineProperty(this,"index",{__proto__:null,value:new Float64Array(r),writable:!0}),Object.defineProperty(this,"depth",{__proto__:null,value:t||Number.MAX_SAFE_INTEGER,writable:!0}),this.length=0;for(let t=0;tthis.index.length-1){const e=Array.from(this.index);e.length=2*this.length,e.fill(Number.MAX_VALUE,this.index.length),this.index=new Float64Array(e)}}else this.index[a]===r&&(this.index.copyWithin(a,a+1,this.index.length),this.index[this.length-1]=Number.MAX_VALUE,this.copyWithin(a,a+1,this.length),this.length--)}store(e,t){this.storeArray([e,t])}limit(){if(this.length>this.depth){for(let e=this.depth;ethis.index.length-1){const e=Array.from(this.index);e.length=2*this.length,e.fill(Number.MAX_VALUE,this.index.length),this.index=new Float64Array(e)}}else this.index[o]===a&&(this.index.copyWithin(o,o+1,this.index.length),this.index[this.length-1]=Number.MAX_VALUE,this.copyWithin(o,o+1,this.length),this.length--)}}class n extends Array{constructor(e=[],t=Number.MAX_SAFE_INTEGER){super(e.length),Object.defineProperty(this,"hashmap",{__proto__:null,value:new Map,writable:!0}),Object.defineProperty(this,"index",{__proto__:null,value:new Float64Array(r),writable:!0}),Object.defineProperty(this,"depth",{__proto__:null,value:t||Number.MAX_SAFE_INTEGER,writable:!0});for(let t=0;tthis.index.length-1){const e=Array.from(this.index);e.length=2*this.length,e.fill(Number.MAX_VALUE,this.index.length),this.index=new Float64Array(e)}}else if(this.hashmap.has(r)){const e=this.hashmap.get(r);let t=i(this.index,e);for(;this[t][2]!==r;)t++;this.index.copyWithin(t,t+1,this.index.length),this.index[this.length-1]=Number.MAX_VALUE,this.copyWithin(t,t+1,this.length),this.length--,this.hashmap.delete(r)}}limit(){if(this.length>this.depth){for(let e=this.depth;e{s.d(t,{Z:()=>c});var i=s(7026),r=s.n(i),a=s(2897),o=s(9125),n=s(1621),d=s(2367);const h=o.UG?r():self.WebSocket;class c extends a.Z{createConnection(){this.verbose&&this.log(new Date,"connecting to",this.url),this.connectionStarted=(0,n.m)(),this.setConnectionTimeout(),o.UG?this.connection=new h(this.url,this.protocols,this.options):this.connection=new h(this.url,this.protocols),this.connection.onopen=this.onOpen.bind(this),this.connection.onmessage=this.onMessage.bind(this),this.connection.onerror=this.onError.bind(this),this.connection.onclose=this.onClose.bind(this),o.UG&&this.connection.on("ping",this.onPing.bind(this)).on("pong",this.onPong.bind(this)).on("upgrade",this.onUpgrade.bind(this))}connect(e=0){return this.startedConnecting||(this.startedConnecting=!0,e?(0,n._v)(e).then(this.createConnection.bind(this)):this.createConnection()),this.connected}isOpen(){return this.connection.readyState===h.OPEN}close(){return this.connection instanceof h&&(void 0===this.disconnected&&(this.disconnected=(0,d.o)()),this.connection.close()),this.disconnected}}},2049:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(4714);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bequant",name:"Bequant",countries:["MT"],pro:!0,urls:{logo:"https://user-images.githubusercontent.com/1294454/55248342-a75dfe00-525a-11e9-8aa2-05e9dca943c6.jpg",api:{public:"https://api.bequant.io/api/3",private:"https://api.bequant.io/api/3"},www:"https://bequant.io",doc:["https://api.bequant.io/"],fees:["https://bequant.io/fees-and-limits"],referral:"https://bequant.io/referral/dd104e3bee7634ec"}})}}},7679:(e,t,s)=>{s.d(t,{Z:()=>h});var i=s(4890),r=s(6689),a=s(9292),o=s(5981),n=s(1372),d=s(2194);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bigone",name:"BigONE",countries:["CN"],version:"v3",rateLimit:1200,has:{CORS:void 0,spot:!0,margin:!1,swap:void 0,future:void 0,option:!1,cancelAllOrders:!0,cancelOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchFundingRate:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchWithdrawals:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"min1","5m":"min5","15m":"min15","30m":"min30","1h":"hour1","3h":"hour3","4h":"hour4","6h":"hour6","12h":"hour12","1d":"day1","1w":"week1","1M":"month1"},hostname:"big.one",urls:{logo:"https://user-images.githubusercontent.com/1294454/69354403-1d532180-0c91-11ea-88ed-44c06cefdf87.jpg",api:{public:"https://{hostname}/api/v3",private:"https://{hostname}/api/v3/viewer",contractPublic:"https://{hostname}/api/contract/v2",contractPrivate:"https://{hostname}/api/contract/v2",webExchange:"https://{hostname}/api/"},www:"https://big.one",doc:"https://open.big.one/docs/api.html",fees:"https://bigone.zendesk.com/hc/en-us/articles/115001933374-BigONE-Fee-Policy",referral:"https://b1.run/users/new?code=D3LLBVFT"},api:{public:{get:["ping","asset_pairs","asset_pairs/{asset_pair_name}/depth","asset_pairs/{asset_pair_name}/trades","asset_pairs/{asset_pair_name}/ticker","asset_pairs/{asset_pair_name}/candles","asset_pairs/tickers"]},private:{get:["accounts","fund/accounts","assets/{asset_symbol}/address","orders","orders/{id}","orders/multi","trades","withdrawals","deposits"],post:["orders","orders/{id}/cancel","orders/cancel","withdrawals","transfer"]},contractPublic:{get:["symbols","instruments","depth@{symbol}/snapshot","instruments/difference","instruments/prices"]},contractPrivate:{get:["accounts","orders/{id}","orders","orders/opening","orders/count","orders/opening/count","trades","trades/count"],post:["orders","orders/batch"],put:["positions/{symbol}/margin","positions/{symbol}/risk-limit"],delete:["orders/{id}","orders/batch"]},webExchange:{get:["uc/v2/assets"]}},fees:{trading:{maker:this.parseNumber("0.001"),taker:this.parseNumber("0.001")},funding:{withdraw:{}}},options:{createMarketBuyOrderRequiresPrice:!0,accountsByType:{spot:"SPOT",fund:"FUND",funding:"FUND",future:"CONTRACT",swap:"CONTRACT"},transfer:{fillResponseFromRequest:!0},exchangeMillisecondsCorrection:-100,fetchCurrencies:{webApiEnable:!0,webApiRetries:5,webApiMuteFailure:!0},defaultNetwork:"ERC20",defaultNetworks:{USDT:"TRC20"},networks:{ABBC:"ABBC",ACA:"Acala",AE:"Aeternity",ALGO:"Algorand",APT:"Aptos",AR:"Arweave",ASTR:"Astar",AVAXC:"Avax",AVAXX:"AvaxChain",BEAM:"Beam",BEP20:"BinanceSmartChain",BITCI:"BitciChain",BTC:"Bitcoin",BCH:"BitcoinCash",BSV:"BitcoinSV",CELO:"Celo",CKKB:"CKB",ATOM:"Cosmos",CRC20:"CRO",DASH:"Dash",DOGE:"Dogecoin",XEC:"ECash",EOS:"EOS",ETH:"Ethereum",ETC:"EthereumClassic",ETHW:"EthereumPow",FTM:"Fantom",FIL:"Filecoin",FSN:"Fusion",GRIN:"Grin",ONE:"Harmony",HRC20:"Hecochain",HBAR:"Hedera",HNT:"Helium",ZEN:"Horizen",IOST:"IOST",IRIS:"IRIS",KLAY:"Klaytn",KSM:"Kusama",LTC:"Litecoin",XMR:"Monero",GLMR:"Moonbeam",NEAR:"Near",NEO:"Neo",NEON3:"NeoN3",OASIS:"Oasis",OKC:"Okexchain",ONT:"Ontology",OPTIMISM:"Optimism",DOT:"Polkadot",MATIC:"Polygon",QTUM:"Qtum",REI:"REI",XRP:"Ripple",SGB:"SGB",SDN:"Shiden",SOL:"Solana",XLM:"Stellar",TERA:"Tera",XTZ:"Tezos",TRC20:"Tron",VET:"Vechain",VSYS:"VSystems",WAX:"WAX",ZEC:"Zcash"}},precisionMode:a.sh,exceptions:{exact:{10001:r.BadRequest,10005:r.ExchangeError,"Amount's scale must greater than AssetPair's base scale":r.InvalidOrder,"Price mulit with amount should larger than AssetPair's min_quote_value":r.InvalidOrder,10007:r.BadRequest,10011:r.ExchangeError,10013:r.BadSymbol,10014:r.InsufficientFunds,10403:r.PermissionDenied,10429:r.RateLimitExceeded,40004:r.AuthenticationError,40103:r.AuthenticationError,40104:r.AuthenticationError,40301:r.PermissionDenied,40302:r.ExchangeError,40601:r.ExchangeError,40602:r.ExchangeError,40603:r.InsufficientFunds,40604:r.InvalidOrder,40605:r.InvalidOrder,40120:r.InvalidOrder,40121:r.InvalidOrder,60100:r.BadSymbol},broad:{}},commonCurrencies:{CRE:"Cybereits",FXT:"FXTTOKEN",FREE:"FreeRossDAO",MBN:"Mobilian Coin",ONE:"BigONE Token"}})}async fetchCurrencies(e={}){const t=await this.fetchWebEndpoint("fetchCurrencies","webExchangeGetUcV2Assets",!0);if(void 0===t)return;const s=this.safeList(t,"data",[]),i={};for(let e=0;e{s.d(t,{Z:()=>l});var i=s(4611),r=s(6689),a=s(2194),o=s(9292),n=s(1372),d=s(5981),h=s(6890),c=s(8817);class l extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"binance",name:"Binance",countries:["JP","MT"],rateLimit:50,certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:!0,addMargin:!0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createConvertTrade:!0,createDepositAddress:!1,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createMarketSellOrder:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!1,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingPercentOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchAccounts:void 0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!0,fetchCanceledAndClosedOrders:"emulated",fetchCanceledOrders:"emulated",fetchClosedOrder:!1,fetchClosedOrders:"emulated",fetchConvertCurrencies:!0,fetchConvertQuote:!0,fetchConvertTrade:!0,fetchConvertTradeHistory:!0,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLastPrices:!0,fetchLedger:!0,fetchLedgerEntry:!0,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!0,fetchLiquidations:!1,fetchMarginAdjustmentHistory:!0,fetchMarginMode:"emulated",fetchMarginModes:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMySettlementHistory:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!1,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!0,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!0,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTradingLimits:"emulated",fetchTransactionFee:"emulated",fetchTransactionFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawAddresses:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!1,reduceMargin:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!0},timeframes:{"1s":"1s","1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/29604020-d5483cdc-87ee-11e7-94c7-d1a8d9169293.jpg",test:{dapiPublic:"https://testnet.binancefuture.com/dapi/v1",dapiPrivate:"https://testnet.binancefuture.com/dapi/v1",dapiPrivateV2:"https://testnet.binancefuture.com/dapi/v2",fapiPublic:"https://testnet.binancefuture.com/fapi/v1",fapiPublicV2:"https://testnet.binancefuture.com/fapi/v2",fapiPrivate:"https://testnet.binancefuture.com/fapi/v1",fapiPrivateV2:"https://testnet.binancefuture.com/fapi/v2",public:"https://testnet.binance.vision/api/v3",private:"https://testnet.binance.vision/api/v3",v1:"https://testnet.binance.vision/api/v1"},api:{sapi:"https://api.binance.com/sapi/v1",sapiV2:"https://api.binance.com/sapi/v2",sapiV3:"https://api.binance.com/sapi/v3",sapiV4:"https://api.binance.com/sapi/v4",dapiPublic:"https://dapi.binance.com/dapi/v1",dapiPrivate:"https://dapi.binance.com/dapi/v1",eapiPublic:"https://eapi.binance.com/eapi/v1",eapiPrivate:"https://eapi.binance.com/eapi/v1",dapiPrivateV2:"https://dapi.binance.com/dapi/v2",dapiData:"https://dapi.binance.com/futures/data",fapiPublic:"https://fapi.binance.com/fapi/v1",fapiPublicV2:"https://fapi.binance.com/fapi/v2",fapiPrivate:"https://fapi.binance.com/fapi/v1",fapiData:"https://fapi.binance.com/futures/data",fapiPrivateV2:"https://fapi.binance.com/fapi/v2",public:"https://api.binance.com/api/v3",private:"https://api.binance.com/api/v3",v1:"https://api.binance.com/api/v1",papi:"https://papi.binance.com/papi/v1"},www:"https://www.binance.com",referral:{url:"https://accounts.binance.com/en/register?ref=D7YA7CLY",discount:.1},doc:["https://binance-docs.github.io/apidocs/spot/en"],api_management:"https://www.binance.com/en/usercenter/settings/api-management",fees:"https://www.binance.com/en/fee/schedule"},api:{sapi:{get:{"system/status":.1,accountSnapshot:240,"margin/asset":1,"margin/pair":1,"margin/allAssets":.1,"margin/allPairs":.1,"margin/priceIndex":1,"spot/delist-schedule":10,"asset/assetDividend":1,"asset/dribblet":.1,"asset/transfer":.1,"asset/assetDetail":.1,"asset/tradeFee":.1,"asset/ledger-transfer/cloud-mining/queryByPage":4.0002,"asset/convert-transfer/queryByPage":.033335,"asset/wallet/balance":6,"asset/custody/transfer-history":6,"margin/borrow-repay":1,"margin/loan":1,"margin/repay":1,"margin/account":1,"margin/transfer":.1,"margin/interestHistory":.1,"margin/forceLiquidationRec":.1,"margin/order":1,"margin/openOrders":1,"margin/allOrders":20,"margin/myTrades":1,"margin/maxBorrowable":5,"margin/maxTransferable":5,"margin/tradeCoeff":1,"margin/isolated/transfer":.1,"margin/isolated/account":1,"margin/isolated/pair":1,"margin/isolated/allPairs":1,"margin/isolated/accountLimit":.1,"margin/interestRateHistory":.1,"margin/orderList":1,"margin/allOrderList":20,"margin/openOrderList":1,"margin/crossMarginData":{cost:.1,noCoin:.5},"margin/isolatedMarginData":{cost:.1,noCoin:1},"margin/isolatedMarginTier":.1,"margin/rateLimit/order":2,"margin/dribblet":.1,"margin/dust":20.001,"margin/crossMarginCollateralRatio":10,"margin/exchange-small-liability":.6667,"margin/exchange-small-liability-history":.6667,"margin/next-hourly-interest-rate":.6667,"margin/capital-flow":10,"margin/delist-schedule":10,"margin/available-inventory":.3334,"margin/leverageBracket":.1,"loan/vip/loanable/data":40,"loan/vip/collateral/data":40,"loan/vip/request/data":2.6668,"loan/vip/request/interestRate":2.6668,"loan/income":40.002,"loan/ongoing/orders":40,"loan/ltv/adjustment/history":40,"loan/borrow/history":40,"loan/repay/history":40,"loan/loanable/data":40,"loan/collateral/data":40,"loan/repay/collateral/rate":600,"loan/flexible/ongoing/orders":30,"loan/flexible/borrow/history":40,"loan/flexible/repay/history":40,"loan/flexible/ltv/adjustment/history":40,"loan/vip/ongoing/orders":40,"loan/vip/repay/history":40,"loan/vip/collateral/account":600,"fiat/orders":600.03,"fiat/payments":.1,"futures/transfer":1,"futures/histDataLink":.1,"rebate/taxQuery":80.004,"capital/config/getall":1,"capital/deposit/address":1,"capital/deposit/address/list":1,"capital/deposit/hisrec":.1,"capital/deposit/subAddress":.1,"capital/deposit/subHisrec":.1,"capital/withdraw/history":1800,"capital/withdraw/address/list":10,"capital/contract/convertible-coins":4.0002,"convert/tradeFlow":20.001,"convert/exchangeInfo":50,"convert/assetInfo":10,"convert/orderStatus":.6667,"convert/limit/queryOpenOrders":20.001,"account/status":.1,"account/apiTradingStatus":.1,"account/apiRestrictions/ipRestriction":.1,bnbBurn:.1,"sub-account/futures/account":1,"sub-account/futures/accountSummary":.1,"sub-account/futures/positionRisk":1,"sub-account/futures/internalTransfer":.1,"sub-account/list":.1,"sub-account/margin/account":1,"sub-account/margin/accountSummary":1,"sub-account/spotSummary":.1,"sub-account/status":1,"sub-account/sub/transfer/history":.1,"sub-account/transfer/subUserHistory":.1,"sub-account/universalTransfer":.1,"sub-account/apiRestrictions/ipRestriction/thirdPartyList":1,"sub-account/transaction-statistics":.40002,"sub-account/subAccountApi/ipRestriction":20.001,"managed-subaccount/asset":.1,"managed-subaccount/accountSnapshot":240,"managed-subaccount/queryTransLogForInvestor":.1,"managed-subaccount/queryTransLogForTradeParent":.40002,"managed-subaccount/fetch-future-asset":.40002,"managed-subaccount/marginAsset":.1,"managed-subaccount/info":.40002,"managed-subaccount/deposit/address":.006667,"managed-subaccount/query-trans-log":.40002,"lending/daily/product/list":.1,"lending/daily/userLeftQuota":.1,"lending/daily/userRedemptionQuota":.1,"lending/daily/token/position":.1,"lending/union/account":.1,"lending/union/purchaseRecord":.1,"lending/union/redemptionRecord":.1,"lending/union/interestHistory":.1,"lending/project/list":.1,"lending/project/position/list":.1,"eth-staking/eth/history/stakingHistory":15,"eth-staking/eth/history/redemptionHistory":15,"eth-staking/eth/history/rewardsHistory":15,"eth-staking/eth/quota":15,"eth-staking/eth/history/rateHistory":15,"eth-staking/account":15,"eth-staking/wbeth/history/wrapHistory":15,"eth-staking/wbeth/history/unwrapHistory":15,"eth-staking/eth/history/wbethRewardsHistory":15,"mining/pub/algoList":.1,"mining/pub/coinList":.1,"mining/worker/detail":.5,"mining/worker/list":.5,"mining/payment/list":.5,"mining/statistics/user/status":.5,"mining/statistics/user/list":.5,"mining/payment/uid":.5,"bswap/pools":.1,"bswap/liquidity":{cost:.1,noPoolId:1},"bswap/liquidityOps":20.001,"bswap/quote":1.00005,"bswap/swap":20.001,"bswap/poolConfigure":1.00005,"bswap/addLiquidityPreview":1.00005,"bswap/removeLiquidityPreview":1.00005,"bswap/unclaimedRewards":6.667,"bswap/claimedHistory":6.667,"blvt/tokenInfo":.1,"blvt/subscribe/record":.1,"blvt/redeem/record":.1,"blvt/userLimit":.1,"apiReferral/ifNewUser":1,"apiReferral/customization":1,"apiReferral/userCustomization":1,"apiReferral/rebate/recentRecord":1,"apiReferral/rebate/historicalRecord":1,"apiReferral/kickback/recentRecord":1,"apiReferral/kickback/historicalRecord":1,"broker/subAccountApi":1,"broker/subAccount":1,"broker/subAccountApi/commission/futures":1,"broker/subAccountApi/commission/coinFutures":1,"broker/info":1,"broker/transfer":1,"broker/transfer/futures":1,"broker/rebate/recentRecord":1,"broker/rebate/historicalRecord":1,"broker/subAccount/bnbBurn/status":1,"broker/subAccount/depositHist":1,"broker/subAccount/spotSummary":1,"broker/subAccount/marginSummary":1,"broker/subAccount/futuresSummary":1,"broker/rebate/futures/recentRecord":1,"broker/subAccountApi/ipRestriction":1,"broker/universalTransfer":1,"account/apiRestrictions":.1,"c2c/orderMatch/listUserOrderHistory":.1,"nft/history/transactions":20.001,"nft/history/deposit":20.001,"nft/history/withdraw":20.001,"nft/user/getAsset":20.001,"pay/transactions":20.001,"giftcard/verify":.1,"giftcard/cryptography/rsa-public-key":.1,"giftcard/buyCode/token-limit":.1,"algo/spot/openOrders":.1,"algo/spot/historicalOrders":.1,"algo/spot/subOrders":.1,"algo/futures/openOrders":.1,"algo/futures/historicalOrders":.1,"algo/futures/subOrders":.1,"portfolio/account":.1,"portfolio/collateralRate":5,"portfolio/pmLoan":3.3335,"portfolio/interest-history":.6667,"portfolio/asset-index-price":.1,"portfolio/repay-futures-switch":3,"portfolio/margin-asset-leverage":5,"staking/productList":.1,"staking/position":.1,"staking/stakingRecord":.1,"staking/personalLeftQuota":.1,"lending/auto-invest/target-asset/list":.1,"lending/auto-invest/target-asset/roi/list":.1,"lending/auto-invest/all/asset":.1,"lending/auto-invest/source-asset/list":.1,"lending/auto-invest/plan/list":.1,"lending/auto-invest/plan/id":.1,"lending/auto-invest/history/list":.1,"lending/auto-invest/index/info":.1,"lending/auto-invest/index/user-summary":.1,"lending/auto-invest/one-off/status":.1,"lending/auto-invest/redeem/history":.1,"lending/auto-invest/rebalance/history":.1,"simple-earn/flexible/list":15,"simple-earn/locked/list":15,"simple-earn/flexible/personalLeftQuota":15,"simple-earn/locked/personalLeftQuota":15,"simple-earn/flexible/subscriptionPreview":15,"simple-earn/locked/subscriptionPreview":15,"simple-earn/flexible/history/rateHistory":15,"simple-earn/flexible/position":15,"simple-earn/locked/position":15,"simple-earn/account":15,"simple-earn/flexible/history/subscriptionRecord":15,"simple-earn/locked/history/subscriptionRecord":15,"simple-earn/flexible/history/redemptionRecord":15,"simple-earn/locked/history/redemptionRecord":15,"simple-earn/flexible/history/rewardsRecord":15,"simple-earn/locked/history/rewardsRecord":15,"simple-earn/flexible/history/collateralRecord":.1,"dci/product/list":.1,"dci/product/positions":.1,"dci/product/accounts":.1},post:{"asset/dust":.06667,"asset/dust-btc":.1,"asset/transfer":6.0003,"asset/get-funding-asset":.1,"asset/convert-transfer":.033335,"account/disableFastWithdrawSwitch":.1,"account/enableFastWithdrawSwitch":.1,"capital/withdraw/apply":4.0002,"capital/contract/convertible-coins":4.0002,"capital/deposit/credit-apply":.1,"margin/borrow-repay":20.001,"margin/transfer":4.0002,"margin/loan":20.001,"margin/repay":20.001,"margin/order":.040002,"margin/order/oco":.040002,"margin/dust":20.001,"margin/exchange-small-liability":20.001,"margin/isolated/transfer":4.0002,"margin/isolated/account":2.0001,"margin/max-leverage":300,bnbBurn:.1,"sub-account/virtualSubAccount":.1,"sub-account/margin/transfer":4.0002,"sub-account/margin/enable":.1,"sub-account/futures/enable":.1,"sub-account/futures/transfer":.1,"sub-account/futures/internalTransfer":.1,"sub-account/transfer/subToSub":.1,"sub-account/transfer/subToMaster":.1,"sub-account/universalTransfer":.1,"sub-account/options/enable":.1,"managed-subaccount/deposit":.1,"managed-subaccount/withdraw":.1,userDataStream:.1,"userDataStream/isolated":.1,"futures/transfer":.1,"lending/customizedFixed/purchase":.1,"lending/daily/purchase":.1,"lending/daily/redeem":.1,"bswap/liquidityAdd":60,"bswap/liquidityRemove":60,"bswap/swap":60,"bswap/claimRewards":6.667,"blvt/subscribe":.1,"blvt/redeem":.1,"apiReferral/customization":1,"apiReferral/userCustomization":1,"apiReferral/rebate/historicalRecord":1,"apiReferral/kickback/historicalRecord":1,"broker/subAccount":1,"broker/subAccount/margin":1,"broker/subAccount/futures":1,"broker/subAccountApi":1,"broker/subAccountApi/permission":1,"broker/subAccountApi/commission":1,"broker/subAccountApi/commission/futures":1,"broker/subAccountApi/commission/coinFutures":1,"broker/transfer":1,"broker/transfer/futures":1,"broker/rebate/historicalRecord":1,"broker/subAccount/bnbBurn/spot":1,"broker/subAccount/bnbBurn/marginInterest":1,"broker/subAccount/blvt":1,"broker/subAccountApi/ipRestriction":1,"broker/subAccountApi/ipRestriction/ipList":1,"broker/universalTransfer":1,"broker/subAccountApi/permission/universalTransfer":1,"broker/subAccountApi/permission/vanillaOptions":1,"giftcard/createCode":.1,"giftcard/redeemCode":.1,"giftcard/buyCode":.1,"algo/spot/newOrderTwap":20.001,"algo/futures/newOrderVp":20.001,"algo/futures/newOrderTwap":20.001,"staking/purchase":.1,"staking/redeem":.1,"staking/setAutoStaking":.1,"eth-staking/eth/stake":15,"eth-staking/eth/redeem":15,"eth-staking/wbeth/wrap":15,"mining/hash-transfer/config":.5,"mining/hash-transfer/config/cancel":.5,"portfolio/repay":20.001,"loan/vip/renew":40.002,"loan/vip/borrow":40.002,"loan/borrow":40.002,"loan/repay":40.002,"loan/adjust/ltv":40.002,"loan/customize/margin_call":40.002,"loan/flexible/repay":40.002,"loan/flexible/adjust/ltv":40.002,"loan/vip/repay":40.002,"convert/getQuote":1.3334,"convert/acceptQuote":3.3335,"convert/limit/placeOrder":3.3335,"convert/limit/cancelOrder":1.3334,"portfolio/auto-collection":150,"portfolio/asset-collection":6,"portfolio/bnb-transfer":150,"portfolio/repay-futures-switch":150,"portfolio/repay-futures-negative-balance":150,"lending/auto-invest/plan/add":.1,"lending/auto-invest/plan/edit":.1,"lending/auto-invest/plan/edit-status":.1,"lending/auto-invest/one-off":.1,"lending/auto-invest/redeem":.1,"simple-earn/flexible/subscribe":.1,"simple-earn/locked/subscribe":.1,"simple-earn/flexible/redeem":.1,"simple-earn/locked/redeem":.1,"simple-earn/flexible/setAutoSubscribe":15,"simple-earn/locked/setAutoSubscribe":15,"dci/product/subscribe":.1,"dci/product/auto_compound/edit":.1},put:{userDataStream:.1,"userDataStream/isolated":.1},delete:{"margin/openOrders":.1,"margin/order":.006667,"margin/orderList":.006667,"margin/isolated/account":2.0001,userDataStream:.1,"userDataStream/isolated":.1,"broker/subAccountApi":1,"broker/subAccountApi/ipRestriction/ipList":1,"algo/spot/order":.1,"algo/futures/order":.1,"sub-account/subAccountApi/ipRestriction/ipList":20.001}},sapiV2:{get:{"eth-staking/account":15,"sub-account/futures/account":.1,"sub-account/futures/accountSummary":1,"sub-account/futures/positionRisk":.1,"loan/flexible/ongoing/orders":30,"loan/flexible/borrow/history":40,"loan/flexible/repay/history":40,"loan/flexible/ltv/adjustment/history":40,"loan/flexible/loanable/data":40,"loan/flexible/collateral/data":40},post:{"eth-staking/eth/stake":15,"sub-account/subAccountApi/ipRestriction":20.001,"loan/flexible/borrow":40.002,"loan/flexible/repay":40.002,"loan/flexible/adjust/ltv":40.002}},sapiV3:{get:{"sub-account/assets":.40002},post:{"asset/getUserAsset":.5}},sapiV4:{get:{"sub-account/assets":.40002}},dapiPublic:{get:{ping:1,time:1,exchangeInfo:1,depth:{cost:2,byLimit:[[50,2],[100,5],[500,10],[1e3,20]]},trades:5,historicalTrades:20,aggTrades:20,premiumIndex:10,fundingRate:1,klines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},continuousKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},indexPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},markPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},premiumIndexKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},"ticker/24hr":{cost:1,noSymbol:40},"ticker/price":{cost:1,noSymbol:2},"ticker/bookTicker":{cost:2,noSymbol:5},constituents:2,openInterest:1}},dapiData:{get:{"delivery-price":1,openInterestHist:1,topLongShortAccountRatio:1,topLongShortPositionRatio:1,globalLongShortAccountRatio:1,takerBuySellVol:1,basis:1}},dapiPrivate:{get:{"positionSide/dual":30,orderAmendment:1,order:1,openOrder:1,openOrders:{cost:1,noSymbol:5},allOrders:{cost:20,noSymbol:40},balance:1,account:5,"positionMargin/history":1,positionRisk:1,userTrades:{cost:20,noSymbol:40},income:20,leverageBracket:1,forceOrders:{cost:20,noSymbol:50},adlQuantile:5,commissionRate:20,"income/asyn":5,"income/asyn/id":5,pmExchangeInfo:.5,pmAccountInfo:.5},post:{"positionSide/dual":1,order:4,batchOrders:5,countdownCancelAll:10,leverage:1,marginType:1,positionMargin:1,listenKey:1},put:{listenKey:1,order:1,batchOrders:5},delete:{order:1,allOpenOrders:1,batchOrders:5,listenKey:1}},dapiPrivateV2:{get:{leverageBracket:1}},fapiPublic:{get:{ping:1,time:1,exchangeInfo:1,depth:{cost:2,byLimit:[[50,2],[100,5],[500,10],[1e3,20]]},trades:5,historicalTrades:20,aggTrades:20,klines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},continuousKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},markPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},indexPriceKlines:{cost:1,byLimit:[[99,1],[499,2],[1e3,5],[1e4,10]]},fundingRate:1,fundingInfo:1,premiumIndex:1,"ticker/24hr":{cost:1,noSymbol:40},"ticker/price":{cost:1,noSymbol:2},"ticker/bookTicker":{cost:1,noSymbol:2},openInterest:1,indexInfo:1,assetIndex:{cost:1,noSymbol:10},constituents:2,apiTradingStatus:{cost:1,noSymbol:10},lvtKlines:1}},fapiData:{get:{"delivery-price":1,openInterestHist:1,topLongShortAccountRatio:1,topLongShortPositionRatio:1,globalLongShortAccountRatio:1,takerlongshortRatio:1,basis:1}},fapiPrivate:{get:{forceOrders:{cost:20,noSymbol:50},allOrders:5,openOrder:1,openOrders:1,order:1,account:5,balance:5,leverageBracket:1,"positionMargin/history":1,positionRisk:5,"positionSide/dual":30,userTrades:5,income:30,commissionRate:20,"rateLimit/order":1,apiTradingStatus:1,multiAssetsMargin:30,"apiReferral/ifNewUser":1,"apiReferral/customization":1,"apiReferral/userCustomization":1,"apiReferral/traderNum":1,"apiReferral/overview":1,"apiReferral/tradeVol":1,"apiReferral/rebateVol":1,"apiReferral/traderSummary":1,adlQuantile:5,pmAccountInfo:5,orderAmendment:1,"income/asyn":1e3,"income/asyn/id":10,"order/asyn":1e3,"order/asyn/id":10,"trade/asyn":1e3,"trade/asyn/id":10},post:{batchOrders:5,"positionSide/dual":1,positionMargin:1,marginType:1,order:4,leverage:1,listenKey:1,countdownCancelAll:10,multiAssetsMargin:1,"apiReferral/customization":1,"apiReferral/userCustomization":1},put:{listenKey:1,order:1,batchOrders:5},delete:{batchOrders:1,order:1,allOpenOrders:1,listenKey:1}},fapiPublicV2:{get:{"ticker/price":0}},fapiPrivateV2:{get:{account:1,balance:1,positionRisk:1}},eapiPublic:{get:{ping:1,time:1,exchangeInfo:1,index:1,ticker:5,mark:5,depth:1,klines:1,trades:5,historicalTrades:20,exerciseHistory:3,openInterest:3}},eapiPrivate:{get:{account:3,position:5,openOrders:{cost:1,noSymbol:40},historyOrders:3,userTrades:5,exerciseRecord:5,bill:1,"income/asyn":5,"income/asyn/id":5,marginAccount:3,mmp:1,countdownCancelAll:1,order:1},post:{order:1,batchOrders:5,listenKey:1,mmpSet:1,mmpReset:1,countdownCancelAll:1,countdownCancelAllHeartBeat:10},put:{listenKey:1},delete:{order:1,batchOrders:1,allOpenOrders:1,allOpenOrdersByUnderlying:1,listenKey:1}},public:{get:{ping:.2,time:.2,depth:{cost:1,byLimit:[[100,1],[500,5],[1e3,10],[5e3,50]]},trades:2,aggTrades:.4,historicalTrades:2,klines:.4,uiKlines:.4,"ticker/24hr":{cost:.4,noSymbol:16},ticker:{cost:.4,noSymbol:16},"ticker/tradingDay":.8,"ticker/price":{cost:.4,noSymbol:.8},"ticker/bookTicker":{cost:.4,noSymbol:.8},exchangeInfo:4,avgPrice:.4},put:{userDataStream:.4},post:{userDataStream:.4},delete:{userDataStream:.4}},private:{get:{allOrderList:4,openOrderList:1.2,orderList:.8,order:.8,openOrders:{cost:1.2,noSymbol:16},allOrders:4,account:4,myTrades:4,"rateLimit/order":8,myPreventedMatches:4,myAllocations:4,"account/commission":4},post:{"order/oco":.2,"orderList/oco":.2,"sor/order":.2,"sor/order/test":.2,order:.2,"order/cancelReplace":.2,"order/test":.2},delete:{openOrders:.2,orderList:.2,order:.2}},papi:{get:{ping:1,"um/order":1,"um/openOrder":1,"um/openOrders":1,"um/allOrders":5,"cm/order":1,"cm/openOrder":1,"cm/openOrders":1,"cm/allOrders":20,"um/conditional/openOrder":1,"um/conditional/openOrders":40,"um/conditional/orderHistory":1,"um/conditional/allOrders":40,"cm/conditional/openOrder":1,"cm/conditional/openOrders":40,"cm/conditional/orderHistory":1,"cm/conditional/allOrders":40,"margin/order":5,"margin/openOrders":5,"margin/allOrders":100,"margin/orderList":5,"margin/allOrderList":100,"margin/openOrderList":5,"margin/myTrades":5,balance:20,account:20,"margin/maxBorrowable":5,"margin/maxWithdraw":5,"um/positionRisk":5,"cm/positionRisk":1,"um/positionSide/dual":30,"cm/positionSide/dual":30,"um/userTrades":5,"cm/userTrades":20,"um/leverageBracket":1,"cm/leverageBracket":1,"margin/forceOrders":1,"um/forceOrders":20,"cm/forceOrders":20,"um/apiTradingStatus":1,"um/commissionRate":20,"cm/commissionRate":20,"margin/marginLoan":10,"margin/repayLoan":10,"margin/marginInterestHistory":1,"portfolio/interest-history":50,"um/income":30,"cm/income":30,"um/account":5,"cm/account":5,"repay-futures-switch":3,"um/adlQuantile":5,"cm/adlQuantile":5},post:{"um/order":1,"um/conditional/order":1,"cm/order":1,"cm/conditional/order":1,"margin/order":.0133,marginLoan:.1333,repayLoan:.1333,"margin/order/oco":.04,"um/leverage":1,"cm/leverage":1,"um/positionSide/dual":1,"cm/positionSide/dual":1,"auto-collection":.6667,"bnb-transfer":.6667,"repay-futures-switch":150,"repay-futures-negative-balance":150,listenKey:1,"asset-collection":3},put:{listenKey:1},delete:{"um/order":1,"um/conditional/order":1,"um/allOpenOrders":1,"um/conditional/allOpenOrders":1,"cm/order":1,"cm/conditional/order":1,"cm/allOpenOrders":1,"cm/conditional/allOpenOrders":1,"margin/order":1,"margin/allOpenOrders":5,"margin/orderList":2,listenKey:1}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0.001")},linear:{trading:{feeSide:"quote",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000500"),maker:this.parseNumber("0.000200"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000400")],[this.parseNumber("250"),this.parseNumber("0.000400")],[this.parseNumber("2500"),this.parseNumber("0.000350")],[this.parseNumber("7500"),this.parseNumber("0.000320")],[this.parseNumber("22500"),this.parseNumber("0.000300")],[this.parseNumber("50000"),this.parseNumber("0.000270")],[this.parseNumber("100000"),this.parseNumber("0.000250")],[this.parseNumber("200000"),this.parseNumber("0.000220")],[this.parseNumber("400000"),this.parseNumber("0.000200")],[this.parseNumber("750000"),this.parseNumber("0.000170")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000200")],[this.parseNumber("250"),this.parseNumber("0.000160")],[this.parseNumber("2500"),this.parseNumber("0.000140")],[this.parseNumber("7500"),this.parseNumber("0.000120")],[this.parseNumber("22500"),this.parseNumber("0.000100")],[this.parseNumber("50000"),this.parseNumber("0.000080")],[this.parseNumber("100000"),this.parseNumber("0.000060")],[this.parseNumber("200000"),this.parseNumber("0.000040")],[this.parseNumber("400000"),this.parseNumber("0.000020")],[this.parseNumber("750000"),this.parseNumber("0")]]}}},inverse:{trading:{feeSide:"base",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000500"),maker:this.parseNumber("0.000100"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000500")],[this.parseNumber("250"),this.parseNumber("0.000450")],[this.parseNumber("2500"),this.parseNumber("0.000400")],[this.parseNumber("7500"),this.parseNumber("0.000300")],[this.parseNumber("22500"),this.parseNumber("0.000250")],[this.parseNumber("50000"),this.parseNumber("0.000240")],[this.parseNumber("100000"),this.parseNumber("0.000240")],[this.parseNumber("200000"),this.parseNumber("0.000240")],[this.parseNumber("400000"),this.parseNumber("0.000240")],[this.parseNumber("750000"),this.parseNumber("0.000240")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000100")],[this.parseNumber("250"),this.parseNumber("0.000080")],[this.parseNumber("2500"),this.parseNumber("0.000050")],[this.parseNumber("7500"),this.parseNumber("0.0000030")],[this.parseNumber("22500"),this.parseNumber("0")],[this.parseNumber("50000"),this.parseNumber("-0.000050")],[this.parseNumber("100000"),this.parseNumber("-0.000060")],[this.parseNumber("200000"),this.parseNumber("-0.000070")],[this.parseNumber("400000"),this.parseNumber("-0.000080")],[this.parseNumber("750000"),this.parseNumber("-0.000090")]]}}},option:{}},commonCurrencies:{BCC:"BCC",YOYO:"YOYOW"},precisionMode:o.nr,options:{sandboxMode:!1,fetchMarkets:["spot","linear","inverse"],fetchCurrencies:!0,defaultTimeInForce:"GTC",defaultType:"spot",defaultSubType:void 0,hasAlreadyAuthenticatedSuccessfully:!1,warnOnFetchOpenOrdersWithoutSymbol:!0,throwMarginModeAlreadySet:!1,fetchPositions:"positionRisk",recvWindow:1e4,timeDifference:0,adjustForTimeDifference:!1,newOrderRespType:{market:"FULL",limit:"FULL"},quoteOrderQty:!0,broker:{spot:"x-R4BD3S82",margin:"x-R4BD3S82",future:"x-xcKtGhcu",delivery:"x-xcKtGhcu",swap:"x-xcKtGhcu",option:"x-xcKtGhcu"},accountsByType:{main:"MAIN",spot:"MAIN",funding:"FUNDING",margin:"MARGIN",cross:"MARGIN",future:"UMFUTURE",delivery:"CMFUTURE",linear:"UMFUTURE",inverse:"CMFUTURE",option:"OPTION"},accountsById:{MAIN:"spot",FUNDING:"funding",MARGIN:"margin",UMFUTURE:"linear",CMFUTURE:"inverse",OPTION:"option"},networks:{ERC20:"ETH",TRC20:"TRX",BEP2:"BNB",BEP20:"BSC",OMNI:"OMNI",EOS:"EOS",SPL:"SOL"},reverseNetworks:{"tronscan.org":"TRC20","etherscan.io":"ERC20","bscscan.com":"BSC","explorer.binance.org":"BEP2","bithomp.com":"XRP","bloks.io":"EOS","stellar.expert":"XLM","blockchair.com/bitcoin":"BTC","blockchair.com/bitcoin-cash":"BCH","blockchair.com/ecash":"XEC","explorer.litecoin.net":"LTC","explorer.avax.network":"AVAX","solscan.io":"SOL","polkadot.subscan.io":"DOT","dashboard.internetcomputer.org":"ICP","explorer.chiliz.com":"CHZ","cardanoscan.io":"ADA","mainnet.theoan.com":"AION","algoexplorer.io":"ALGO","explorer.ambrosus.com":"AMB","viewblock.io/zilliqa":"ZIL","viewblock.io/arweave":"AR","explorer.ark.io":"ARK","atomscan.com":"ATOM","www.mintscan.io":"CTK","explorer.bitcoindiamond.org":"BCD","btgexplorer.com":"BTG","bts.ai":"BTS","explorer.celo.org":"CELO","explorer.nervos.org":"CKB","cerebro.cortexlabs.ai":"CTXC","chainz.cryptoid.info":"VIA","explorer.dcrdata.org":"DCR","digiexplorer.info":"DGB","dock.subscan.io":"DOCK","dogechain.info":"DOGE","explorer.elrond.com":"EGLD","blockscout.com":"ETC","explore-fetchhub.fetch.ai":"FET","filfox.info":"FIL","fio.bloks.io":"FIO","explorer.firo.org":"FIRO","neoscan.io":"NEO","ftmscan.com":"FTM","explorer.gochain.io":"GO","block.gxb.io":"GXS","hash-hash.info":"HBAR","www.hiveblockexplorer.com":"HIVE","explorer.helium.com":"HNT","tracker.icon.foundation":"ICX","www.iostabc.com":"IOST","explorer.iota.org":"IOTA","iotexscan.io":"IOTX","irishub.iobscan.io":"IRIS","kava.mintscan.io":"KAVA","scope.klaytn.com":"KLAY","kmdexplorer.io":"KMD","kusama.subscan.io":"KSM","explorer.lto.network":"LTO","polygonscan.com":"POLYGON","explorer.ont.io":"ONT","minaexplorer.com":"MINA","nanolooker.com":"NANO","explorer.nebulas.io":"NAS","explorer.nbs.plus":"NBS","explorer.nebl.io":"NEBL","nulscan.io":"NULS","nxscan.com":"NXS","explorer.harmony.one":"ONE","explorer.poa.network":"POA","qtum.info":"QTUM","explorer.rsk.co":"RSK","www.oasisscan.com":"ROSE","ravencoin.network":"RVN","sc.tokenview.com":"SC","secretnodes.com":"SCRT","explorer.skycoin.com":"SKY","steemscan.com":"STEEM","explorer.stacks.co":"STX","www.thetascan.io":"THETA","scan.tomochain.com":"TOMO","explore.vechain.org":"VET","explorer.vite.net":"VITE","www.wanscan.org":"WAN","wavesexplorer.com":"WAVES","wax.eosx.io":"WAXP","waltonchain.pro":"WTC","chain.nem.ninja":"XEM","verge-blockchain.info":"XVG","explorer.yoyow.org":"YOYOW","explorer.zcha.in":"ZEC","explorer.zensystem.io":"ZEN"},networksById:{"tronscan.org":"TRC20","etherscan.io":"ERC20","bscscan.com":"BSC","explorer.binance.org":"BEP2","bithomp.com":"XRP","bloks.io":"EOS","stellar.expert":"XLM","blockchair.com/bitcoin":"BTC","blockchair.com/bitcoin-cash":"BCH","blockchair.com/ecash":"XEC","explorer.litecoin.net":"LTC","explorer.avax.network":"AVAX","solscan.io":"SOL","polkadot.subscan.io":"DOT","dashboard.internetcomputer.org":"ICP","explorer.chiliz.com":"CHZ","cardanoscan.io":"ADA","mainnet.theoan.com":"AION","algoexplorer.io":"ALGO","explorer.ambrosus.com":"AMB","viewblock.io/zilliqa":"ZIL","viewblock.io/arweave":"AR","explorer.ark.io":"ARK","atomscan.com":"ATOM","www.mintscan.io":"CTK","explorer.bitcoindiamond.org":"BCD","btgexplorer.com":"BTG","bts.ai":"BTS","explorer.celo.org":"CELO","explorer.nervos.org":"CKB","cerebro.cortexlabs.ai":"CTXC","chainz.cryptoid.info":"VIA","explorer.dcrdata.org":"DCR","digiexplorer.info":"DGB","dock.subscan.io":"DOCK","dogechain.info":"DOGE","explorer.elrond.com":"EGLD","blockscout.com":"ETC","explore-fetchhub.fetch.ai":"FET","filfox.info":"FIL","fio.bloks.io":"FIO","explorer.firo.org":"FIRO","neoscan.io":"NEO","ftmscan.com":"FTM","explorer.gochain.io":"GO","block.gxb.io":"GXS","hash-hash.info":"HBAR","www.hiveblockexplorer.com":"HIVE","explorer.helium.com":"HNT","tracker.icon.foundation":"ICX","www.iostabc.com":"IOST","explorer.iota.org":"IOTA","iotexscan.io":"IOTX","irishub.iobscan.io":"IRIS","kava.mintscan.io":"KAVA","scope.klaytn.com":"KLAY","kmdexplorer.io":"KMD","kusama.subscan.io":"KSM","explorer.lto.network":"LTO","polygonscan.com":"POLYGON","explorer.ont.io":"ONT","minaexplorer.com":"MINA","nanolooker.com":"NANO","explorer.nebulas.io":"NAS","explorer.nbs.plus":"NBS","explorer.nebl.io":"NEBL","nulscan.io":"NULS","nxscan.com":"NXS","explorer.harmony.one":"ONE","explorer.poa.network":"POA","qtum.info":"QTUM","explorer.rsk.co":"RSK","www.oasisscan.com":"ROSE","ravencoin.network":"RVN","sc.tokenview.com":"SC","secretnodes.com":"SCRT","explorer.skycoin.com":"SKY","steemscan.com":"STEEM","explorer.stacks.co":"STX","www.thetascan.io":"THETA","scan.tomochain.com":"TOMO","explore.vechain.org":"VET","explorer.vite.net":"VITE","www.wanscan.org":"WAN","wavesexplorer.com":"WAVES","wax.eosx.io":"WAXP","waltonchain.pro":"WTC","chain.nem.ninja":"XEM","verge-blockchain.info":"XVG","explorer.yoyow.org":"YOYOW","explorer.zcha.in":"ZEC","explorer.zensystem.io":"ZEN"},impliedNetworks:{ETH:{ERC20:"ETH"},TRX:{TRC20:"TRX"}},legalMoney:{MXN:!0,UGX:!0,SEK:!0,CHF:!0,VND:!0,AED:!0,DKK:!0,KZT:!0,HUF:!0,PEN:!0,PHP:!0,USD:!0,TRY:!0,EUR:!0,NGN:!0,PLN:!0,BRL:!0,ZAR:!0,KES:!0,ARS:!0,RUB:!0,AUD:!0,NOK:!0,CZK:!0,GBP:!0,UAH:!0,GHS:!0,HKD:!0,CAD:!0,INR:!0,JPY:!0,NZD:!0},legalMoneyCurrenciesById:{BUSD:"USD"}},exceptions:{spot:{exact:{"-1004":r.OperationFailed,"-1008":r.OperationFailed,"-1099":r.AuthenticationError,"-1108":r.BadRequest,"-1131":r.BadRequest,"-1134":r.BadRequest,"-1135":r.BadRequest,"-1145":r.BadRequest,"-1151":r.BadSymbol,"-2008":r.AuthenticationError,"-2016":r.OperationRejected,"-2021":r.BadResponse,"-2022":r.BadResponse,"-2026":r.InvalidOrder,"-3000":r.OperationFailed,"-3001":r.AuthenticationError,"-3002":r.BadSymbol,"-3003":r.BadRequest,"-3004":r.OperationRejected,"-3005":r.BadRequest,"-3006":r.BadRequest,"-3007":r.OperationFailed,"-3008":r.BadRequest,"-3009":r.OperationRejected,"-3010":r.BadRequest,"-3011":r.BadRequest,"-3012":r.OperationRejected,"-3013":r.BadRequest,"-3014":r.AccountSuspended,"-3015":r.BadRequest,"-3016":r.BadRequest,"-3017":r.OperationRejected,"-3018":r.AccountSuspended,"-3019":r.AccountSuspended,"-3020":r.BadRequest,"-3021":r.BadRequest,"-3022":r.AccountSuspended,"-3023":r.OperationRejected,"-3024":r.OperationRejected,"-3025":r.BadRequest,"-3026":r.BadRequest,"-3027":r.BadSymbol,"-3028":r.BadSymbol,"-3029":r.OperationFailed,"-3036":r.AccountSuspended,"-3037":r.OperationFailed,"-3038":r.BadRequest,"-3041":r.InsufficientFunds,"-3042":r.BadRequest,"-3043":r.PermissionDenied,"-3044":r.OperationFailed,"-3045":r.OperationFailed,"-3999":r.PermissionDenied,"-4000":r.ExchangeError,"-4001":r.BadRequest,"-4002":r.BadRequest,"-4003":r.BadRequest,"-4004":r.AuthenticationError,"-4005":r.RateLimitExceeded,"-4006":r.BadRequest,"-4007":r.PermissionDenied,"-4008":r.PermissionDenied,"-4009":r.ExchangeError,"-4010":r.PermissionDenied,"-4011":r.BadRequest,"-4012":r.PermissionDenied,"-4013":r.AuthenticationError,"-4014":r.OperationFailed,"-4015":r.PermissionDenied,"-4016":r.PermissionDenied,"-4017":r.PermissionDenied,"-4018":r.BadSymbol,"-4019":r.BadRequest,"-4020":r.ExchangeError,"-4021":r.BadRequest,"-4022":r.BadRequest,"-4023":r.OperationFailed,"-4024":r.InsufficientFunds,"-4025":r.InsufficientFunds,"-4026":r.InsufficientFunds,"-4027":r.OperationFailed,"-4028":r.BadRequest,"-4029":r.BadRequest,"-4030":r.BadResponse,"-4031":r.OperationFailed,"-4032":r.OperationFailed,"-4033":r.BadRequest,"-4034":r.OperationRejected,"-4035":r.PermissionDenied,"-4036":r.PermissionDenied,"-4037":r.OperationFailed,"-4038":r.OperationFailed,"-4039":r.PermissionDenied,"-4040":r.OperationRejected,"-4041":r.OperationFailed,"-4042":r.OperationRejected,"-4043":r.OperationRejected,"-4044":r.PermissionDenied,"-4045":r.OperationFailed,"-4046":r.AuthenticationError,"-4047":r.BadRequest,"-4048":r.ExchangeError,"-4049":r.ExchangeError,"-4050":r.ExchangeError,"-4051":r.ExchangeError,"-4052":r.ExchangeError,"-4053":r.ExchangeError,"-4054":r.ExchangeError,"-4055":r.ExchangeError,"-4056":r.ExchangeError,"-4057":r.ExchangeError,"-4058":r.ExchangeError,"-4059":r.ExchangeError,"-4060":r.OperationFailed,"-4061":r.ExchangeError,"-4062":r.ExchangeError,"-4063":r.ExchangeError,"-4064":r.ExchangeError,"-4065":r.ExchangeError,"-4066":r.ExchangeError,"-4067":r.ExchangeError,"-4068":r.ExchangeError,"-4069":r.ExchangeError,"-4070":r.ExchangeError,"-4071":r.ExchangeError,"-4072":r.ExchangeError,"-4073":r.ExchangeError,"-4074":r.ExchangeError,"-4075":r.ExchangeError,"-4076":r.ExchangeError,"-4077":r.ExchangeError,"-4078":r.ExchangeError,"-4079":r.ExchangeError,"-4080":r.ExchangeError,"-4081":r.ExchangeError,"-4082":r.ExchangeError,"-4083":r.ExchangeError,"-4084":r.ExchangeError,"-4085":r.ExchangeError,"-4086":r.ExchangeError,"-4087":r.ExchangeError,"-4088":r.ExchangeError,"-4089":r.ExchangeError,"-4091":r.ExchangeError,"-4092":r.ExchangeError,"-4093":r.ExchangeError,"-4094":r.ExchangeError,"-4095":r.ExchangeError,"-4096":r.ExchangeError,"-4097":r.ExchangeError,"-4098":r.ExchangeError,"-4099":r.ExchangeError,"-4101":r.ExchangeError,"-4102":r.ExchangeError,"-4103":r.ExchangeError,"-4104":r.ExchangeError,"-4105":r.ExchangeError,"-4106":r.ExchangeError,"-4107":r.ExchangeError,"-4108":r.ExchangeError,"-4109":r.ExchangeError,"-4110":r.ExchangeError,"-4112":r.ExchangeError,"-4113":r.ExchangeError,"-4114":r.ExchangeError,"-4115":r.ExchangeError,"-4116":r.ExchangeError,"-4117":r.ExchangeError,"-4118":r.ExchangeError,"-4119":r.ExchangeError,"-4120":r.ExchangeError,"-4121":r.ExchangeError,"-4122":r.ExchangeError,"-4123":r.ExchangeError,"-4124":r.ExchangeError,"-4125":r.ExchangeError,"-4126":r.ExchangeError,"-4127":r.ExchangeError,"-4128":r.ExchangeError,"-4129":r.ExchangeError,"-4130":r.ExchangeError,"-4131":r.ExchangeError,"-4132":r.ExchangeError,"-4133":r.ExchangeError,"-4134":r.ExchangeError,"-4135":r.ExchangeError,"-4136":r.ExchangeError,"-4137":r.ExchangeError,"-4138":r.ExchangeError,"-4139":r.ExchangeError,"-4141":r.ExchangeError,"-4142":r.ExchangeError,"-4143":r.ExchangeError,"-4144":r.ExchangeError,"-4145":r.ExchangeError,"-4146":r.ExchangeError,"-4147":r.ExchangeError,"-4148":r.ExchangeError,"-4149":r.ExchangeError,"-4150":r.ExchangeError,"-5001":r.BadRequest,"-5002":r.InsufficientFunds,"-5003":r.InsufficientFunds,"-5004":r.OperationRejected,"-5005":r.OperationRejected,"-5006":r.OperationFailed,"-5007":r.BadRequest,"-5008":r.OperationRejected,"-5009":r.BadSymbol,"-5010":r.OperationFailed,"-5011":r.BadRequest,"-5012":r.OperationFailed,"-5013":r.InsufficientFunds,"-5021":r.BadRequest,"-5022":r.BadRequest,"-6001":r.BadSymbol,"-6003":r.PermissionDenied,"-6004":r.BadRequest,"-6005":r.BadRequest,"-6006":r.BadRequest,"-6007":r.OperationFailed,"-6008":r.OperationFailed,"-6009":r.RateLimitExceeded,"-6011":r.OperationRejected,"-6012":r.InsufficientFunds,"-6013":r.BadResponse,"-6014":r.OperationRejected,"-6015":r.BadRequest,"-6016":r.BadRequest,"-6017":r.PermissionDenied,"-6018":r.InsufficientFunds,"-6019":r.OperationRejected,"-6020":r.BadRequest,"-7001":r.BadRequest,"-7002":r.BadRequest,"-10001":r.OperationFailed,"-10002":r.BadRequest,"-10005":r.BadResponse,"-10007":r.BadRequest,"-10008":r.BadRequest,"-10009":r.BadRequest,"-10010":r.BadRequest,"-10011":r.InsufficientFunds,"-10012":r.BadRequest,"-10013":r.InsufficientFunds,"-10015":r.OperationFailed,"-10016":r.OperationFailed,"-10017":r.OperationRejected,"-10018":r.BadRequest,"-10019":r.BadRequest,"-10020":r.BadRequest,"-10021":r.InvalidOrder,"-10022":r.BadRequest,"-10023":r.OperationFailed,"-10024":r.BadRequest,"-10025":r.OperationFailed,"-10026":r.BadRequest,"-10028":r.BadRequest,"-10029":r.OperationRejected,"-10030":r.OperationRejected,"-10031":r.OperationRejected,"-10032":r.OperationFailed,"-10034":r.OperationRejected,"-10039":r.OperationRejected,"-10040":r.OperationRejected,"-10041":r.OperationFailed,"-10042":r.BadSymbol,"-10043":r.OperationRejected,"-10044":r.OperationRejected,"-10045":r.OperationRejected,"-10046":r.OperationRejected,"-10047":r.PermissionDenied,"-11008":r.OperationRejected,"-12014":r.RateLimitExceeded,"-13000":r.OperationRejected,"-13001":r.OperationRejected,"-13002":r.OperationRejected,"-13003":r.PermissionDenied,"-13004":r.OperationRejected,"-13005":r.OperationRejected,"-13006":r.OperationRejected,"-13007":r.PermissionDenied,"-18002":r.OperationRejected,"-18003":r.OperationRejected,"-18004":r.OperationRejected,"-18005":r.PermissionDenied,"-18006":r.OperationRejected,"-18007":r.OperationRejected,"-21001":r.BadRequest,"-21002":r.BadRequest,"-21003":r.BadResponse,"-21004":r.OperationRejected,"-21005":r.InsufficientFunds,"-21006":r.OperationFailed,"-21007":r.OperationFailed,"-32603":r.BadRequest,400002:r.BadRequest,100001003:r.AuthenticationError,200003903:r.AuthenticationError}},linear:{exact:{"-1005":r.PermissionDenied,"-1008":r.OperationFailed,"-1011":r.PermissionDenied,"-1023":r.BadRequest,"-1099":r.AuthenticationError,"-1109":r.PermissionDenied,"-1110":r.BadRequest,"-1113":r.BadRequest,"-1122":r.BadRequest,"-1126":r.BadSymbol,"-1136":r.BadRequest,"-2012":r.OperationFailed,"-2016":r.OperationRejected,"-2017":r.PermissionDenied,"-2018":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-2020":r.OperationFailed,"-2021":r.OrderImmediatelyFillable,"-2022":r.InvalidOrder,"-2023":r.OperationFailed,"-2024":r.InsufficientFunds,"-2025":r.OperationRejected,"-2026":r.InvalidOrder,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-4063":r.BadRequest,"-4064":r.BadRequest,"-4065":r.BadRequest,"-4066":r.BadRequest,"-4069":r.BadRequest,"-4070":r.BadRequest,"-4071":r.BadRequest,"-4072":r.OperationRejected,"-4073":r.BadRequest,"-4074":r.OperationRejected,"-4075":r.BadRequest,"-4076":r.OperationRejected,"-4077":r.OperationRejected,"-4078":r.OperationFailed,"-4079":r.BadRequest,"-4080":r.PermissionDenied,"-4081":r.BadRequest,"-4085":r.BadRequest,"-4087":r.PermissionDenied,"-4088":r.PermissionDenied,"-4114":r.BadRequest,"-4115":r.BadRequest,"-4118":r.OperationRejected,"-4131":r.OperationRejected,"-4140":r.BadRequest,"-4141":r.OperationRejected,"-4144":r.BadSymbol,"-4164":r.InvalidOrder,"-4165":r.BadRequest,"-4167":r.BadRequest,"-4168":r.BadRequest,"-4169":r.OperationRejected,"-4170":r.OperationRejected,"-4171":r.OperationRejected,"-4172":r.OperationRejected,"-4183":r.BadRequest,"-4184":r.BadRequest,"-4192":r.PermissionDenied,"-4202":r.PermissionDenied,"-4203":r.PermissionDenied,"-4205":r.PermissionDenied,"-4206":r.PermissionDenied,"-4208":r.OperationRejected,"-4209":r.OperationRejected,"-4210":r.BadRequest,"-4211":r.BadRequest,"-4400":r.PermissionDenied,"-4401":r.PermissionDenied,"-4402":r.PermissionDenied,"-4403":r.PermissionDenied,"-5021":r.OrderNotFillable,"-5022":r.OrderNotFillable,"-5024":r.OperationRejected,"-5025":r.OperationRejected,"-5026":r.OperationRejected,"-5027":r.OperationRejected,"-5028":r.BadRequest,"-5037":r.BadRequest,"-5038":r.BadRequest,"-5039":r.BadRequest,"-5040":r.BadRequest,"-5041":r.OperationFailed}},inverse:{exact:{"-1005":r.PermissionDenied,"-1011":r.PermissionDenied,"-1023":r.BadRequest,"-1109":r.AuthenticationError,"-1110":r.BadSymbol,"-1113":r.BadRequest,"-1128":r.BadRequest,"-1136":r.BadRequest,"-2016":r.OperationRejected,"-2018":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-2020":r.OperationFailed,"-2021":r.OrderImmediatelyFillable,"-2022":r.InvalidOrder,"-2023":r.OperationFailed,"-2024":r.BadRequest,"-2025":r.OperationRejected,"-2026":r.InvalidOrder,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-4086":r.BadRequest,"-4087":r.BadSymbol,"-4088":r.BadRequest,"-4089":r.PermissionDenied,"-4090":r.PermissionDenied,"-4110":r.BadRequest,"-4111":r.BadRequest,"-4112":r.OperationRejected,"-4113":r.OperationRejected,"-4150":r.OperationRejected,"-4151":r.BadRequest,"-4152":r.BadRequest,"-4154":r.BadRequest,"-4155":r.BadRequest,"-4178":r.BadRequest,"-4188":r.BadRequest,"-4192":r.PermissionDenied,"-4194":r.PermissionDenied,"-4195":r.PermissionDenied,"-4196":r.BadRequest,"-4197":r.OperationRejected,"-4198":r.OperationRejected,"-4199":r.BadRequest,"-4200":r.PermissionDenied,"-4201":r.PermissionDenied,"-4202":r.OperationRejected}},option:{exact:{"-1003":r.ExchangeError,"-1004":r.ExchangeError,"-1006":r.ExchangeError,"-1007":r.ExchangeError,"-1008":r.RateLimitExceeded,"-1010":r.ExchangeError,"-1013":r.ExchangeError,"-1108":r.ExchangeError,"-1112":r.ExchangeError,"-1114":r.ExchangeError,"-1128":r.BadSymbol,"-1129":r.BadSymbol,"-1131":r.BadRequest,"-2011":r.ExchangeError,"-2018":r.InsufficientFunds,"-2027":r.InsufficientFunds,"-3029":r.OperationFailed,"-4006":r.ExchangeError,"-4007":r.ExchangeError,"-4008":r.ExchangeError,"-4009":r.ExchangeError,"-4010":r.ExchangeError,"-4011":r.ExchangeError,"-4012":r.ExchangeError,"-4014":r.ExchangeError,"-4015":r.ExchangeError,"-4016":r.ExchangeError,"-4017":r.ExchangeError,"-4018":r.ExchangeError,"-4019":r.ExchangeError,"-4020":r.ExchangeError,"-4021":r.ExchangeError,"-4022":r.ExchangeError,"-4023":r.ExchangeError,"-4024":r.ExchangeError,"-4025":r.ExchangeError,"-4026":r.ExchangeError,"-4027":r.ExchangeError,"-4028":r.ExchangeError,"-4031":r.ExchangeError,"-4032":r.ExchangeError,"-4033":r.ExchangeError,"-4034":r.ExchangeError,"-4035":r.ExchangeError,"-4036":r.ExchangeError,"-4037":r.ExchangeError,"-4038":r.ExchangeError,"-4039":r.ExchangeError,"-4040":r.ExchangeError,"-4041":r.ExchangeError,"-4042":r.ExchangeError,"-4043":r.ExchangeError,"-4044":r.ExchangeError,"-4045":r.ExchangeError,"-4046":r.ExchangeError,"-4047":r.ExchangeError,"-4048":r.ExchangeError,"-4049":r.ExchangeError,"-4050":r.ExchangeError,"-4051":r.ExchangeError,"-4052":r.ExchangeError,"-4053":r.ExchangeError,"-4054":r.ExchangeError,"-4056":r.ExchangeError,"-4057":r.ExchangeError,"-4058":r.ExchangeError,"-4059":r.ExchangeError,"-4060":r.ExchangeError,"-4061":r.ExchangeError,"-4062":r.ExchangeError,"-4063":r.ExchangeError,"-4064":r.ExchangeError,"-4065":r.ExchangeError,"-4066":r.ExchangeError,"-4067":r.ExchangeError,"-4068":r.ExchangeError,"-4069":r.ExchangeError,"-4070":r.ExchangeError,"-4071":r.ExchangeError,"-4072":r.ExchangeError,"-4073":r.ExchangeError,"-4074":r.ExchangeError,"-4075":r.ExchangeError,"-4076":r.ExchangeError,"-4077":r.ExchangeError,"-4078":r.ExchangeError,"-4079":r.ExchangeError,"-4080":r.ExchangeError,"-4081":r.ExchangeError,"-4082":r.ExchangeError,"-4083":r.ExchangeError,"-4084":r.ExchangeError,"-4085":r.ExchangeError,"-4086":r.ExchangeError,"-4087":r.ExchangeError,"-4088":r.ExchangeError,"-4089":r.ExchangeError,"-4091":r.ExchangeError,"-4092":r.ExchangeError,"-4093":r.ExchangeError,"-4094":r.ExchangeError,"-4095":r.ExchangeError,"-4096":r.ExchangeError,"-4097":r.ExchangeError,"-4098":r.ExchangeError,"-4099":r.ExchangeError,"-4101":r.ExchangeError,"-4102":r.ExchangeError,"-4103":r.ExchangeError,"-4104":r.ExchangeError,"-4105":r.ExchangeError,"-4106":r.ExchangeError,"-4107":r.ExchangeError,"-4108":r.ExchangeError,"-4109":r.ExchangeError,"-4110":r.ExchangeError,"-4112":r.ExchangeError,"-4113":r.ExchangeError,"-4114":r.ExchangeError,"-4115":r.ExchangeError,"-4116":r.ExchangeError,"-4117":r.ExchangeError,"-4118":r.ExchangeError,"-4119":r.ExchangeError,"-4120":r.ExchangeError,"-4121":r.ExchangeError,"-4122":r.ExchangeError,"-4123":r.ExchangeError,"-4124":r.ExchangeError,"-4125":r.ExchangeError,"-4126":r.ExchangeError,"-4127":r.ExchangeError,"-4128":r.ExchangeError,"-4129":r.ExchangeError,"-4130":r.ExchangeError,"-4131":r.ExchangeError,"-4132":r.ExchangeError,"-4133":r.ExchangeError,"-4134":r.ExchangeError,"-4135":r.ExchangeError,"-4136":r.ExchangeError,"-4137":r.ExchangeError,"-4138":r.ExchangeError,"-4139":r.ExchangeError,"-4141":r.ExchangeError,"-4142":r.ExchangeError,"-4143":r.ExchangeError,"-4144":r.ExchangeError,"-4145":r.ExchangeError,"-4146":r.ExchangeError,"-4147":r.ExchangeError,"-4148":r.ExchangeError,"-4149":r.ExchangeError,"-4150":r.ExchangeError,"-20121":r.ExchangeError,"-20124":r.ExchangeError,"-20130":r.ExchangeError,"-20132":r.ExchangeError,"-20194":r.ExchangeError,"-20195":r.ExchangeError,"-20196":r.ExchangeError,"-20198":r.ExchangeError,"-20204":r.ExchangeError}},portfolioMargin:{exact:{"-1005":r.PermissionDenied,"-1011":r.PermissionDenied,"-1023":r.BadRequest,"-1109":r.BadRequest,"-1110":r.BadSymbol,"-1113":r.BadRequest,"-1128":r.BadRequest,"-1136":r.BadRequest,"-2016":r.OperationRejected,"-2018":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-2020":r.OrderNotFillable,"-2021":r.OrderImmediatelyFillable,"-2022":r.InvalidOrder,"-2023":r.OperationFailed,"-2024":r.OperationRejected,"-2025":r.OperationRejected,"-2026":r.InvalidOrder,"-2027":r.OperationRejected,"-2028":r.OperationRejected,"-4063":r.BadRequest,"-4064":r.BadRequest,"-4065":r.BadRequest,"-4066":r.BadRequest,"-4069":r.BadRequest,"-4070":r.BadRequest,"-4071":r.BadRequest,"-4072":r.OperationRejected,"-4073":r.BadRequest,"-4074":r.BadRequest,"-4075":r.BadRequest,"-4076":r.OperationRejected,"-4077":r.OperationRejected,"-4078":r.OperationFailed,"-4079":r.BadRequest,"-4080":r.PermissionDenied,"-4081":r.BadRequest,"-4085":r.BadRequest,"-4086":r.BadRequest,"-4087":r.PermissionDenied,"-4088":r.PermissionDenied,"-4114":r.BadRequest,"-4115":r.BadRequest,"-4118":r.OperationRejected,"-4131":r.OperationRejected,"-4140":r.BadRequest,"-4141":r.BadRequest,"-4144":r.BadSymbol,"-4161":r.OperationRejected,"-4164":r.OperationRejected,"-4165":r.BadRequest,"-4183":r.BadRequest,"-4184":r.BadRequest,"-5021":r.OrderNotFillable,"-5022":r.OrderNotFillable,"-20121":r.ExchangeError,"-20124":r.ExchangeError,"-20130":r.ExchangeError,"-20132":r.ExchangeError,"-20194":r.ExchangeError,"-20195":r.ExchangeError,"-20196":r.ExchangeError,"-20198":r.ExchangeError,"-20204":r.ExchangeError,"-21001":r.BadRequest,"-21002":r.BadRequest,"-21003":r.BadResponse,"-21004":r.OperationRejected,"-21005":r.InsufficientFunds,"-21006":r.OperationFailed,"-21007":r.OperationFailed}},exact:{"-1000":r.OperationFailed,"-1001":r.OperationFailed,"-1002":r.AuthenticationError,"-1003":r.RateLimitExceeded,"-1004":r.OperationRejected,"-1006":r.OperationFailed,"-1007":r.RequestTimeout,"-1010":r.OperationFailed,"-1013":r.BadRequest,"-1014":r.InvalidOrder,"-1015":r.RateLimitExceeded,"-1016":r.BadRequest,"-1020":r.BadRequest,"-1021":r.InvalidNonce,"-1022":r.AuthenticationError,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1108":r.BadSymbol,"-1111":r.BadRequest,"-1112":r.OperationFailed,"-1114":r.BadRequest,"-1115":r.BadRequest,"-1116":r.BadRequest,"-1117":r.BadRequest,"-1118":r.BadRequest,"-1119":r.BadRequest,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1125":r.AuthenticationError,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-2010":r.InvalidOrder,"-2011":r.OrderNotFound,"-2013":r.OrderNotFound,"-2014":r.AuthenticationError,"-2015":r.AuthenticationError,"-4000":r.InvalidOrder,"-4001":r.BadRequest,"-4002":r.BadRequest,"-4003":r.BadRequest,"-4004":r.BadRequest,"-4005":r.BadRequest,"-4006":r.BadRequest,"-4007":r.BadRequest,"-4008":r.BadRequest,"-4009":r.BadRequest,"-4010":r.BadRequest,"-4011":r.BadRequest,"-4012":r.BadRequest,"-4013":r.BadRequest,"-4014":r.BadRequest,"-4015":r.BadRequest,"-4016":r.BadRequest,"-4017":r.BadRequest,"-4018":r.BadRequest,"-4019":r.OperationRejected,"-4020":r.BadRequest,"-4021":r.BadRequest,"-4022":r.BadRequest,"-4023":r.BadRequest,"-4024":r.BadRequest,"-4025":r.BadRequest,"-4026":r.BadRequest,"-4027":r.BadRequest,"-4028":r.BadRequest,"-4029":r.BadRequest,"-4030":r.BadRequest,"-4031":r.BadRequest,"-4032":r.OperationRejected,"-4033":r.BadRequest,"-4044":r.BadRequest,"-4045":r.OperationRejected,"-4046":r.OperationRejected,"-4047":r.OperationRejected,"-4048":r.OperationRejected,"-4049":r.BadRequest,"-4050":r.InsufficientFunds,"-4051":r.InsufficientFunds,"-4052":r.OperationRejected,"-4053":r.BadRequest,"-4054":r.OperationRejected,"-4055":r.BadRequest,"-4056":r.AuthenticationError,"-4057":r.AuthenticationError,"-4058":r.BadRequest,"-4059":r.OperationRejected,"-4060":r.BadRequest,"-4061":r.OperationRejected,"-4062":r.BadRequest,"-4067":r.OperationRejected,"-4068":r.OperationRejected,"-4082":r.BadRequest,"-4083":r.OperationRejected,"-4084":r.BadRequest,"-4086":r.BadRequest,"-4104":r.BadRequest,"-4135":r.BadRequest,"-4137":r.BadRequest,"-4138":r.BadRequest,"-4139":r.BadRequest,"-4142":r.OrderImmediatelyFillable,"-20121":r.BadSymbol,"-20124":r.BadRequest,"-20130":r.BadRequest,"-20132":r.BadRequest,"-20194":r.BadRequest,"-20195":r.BadRequest,"-20196":r.BadRequest,"-20198":r.OperationRejected,"-20204":r.BadRequest,"System is under maintenance.":r.OnMaintenance,"System abnormality":r.OperationFailed,"You are not authorized to execute this request.":r.PermissionDenied,"API key does not exist":r.AuthenticationError,"Order would trigger immediately.":r.OrderImmediatelyFillable,"Stop price would trigger immediately.":r.OrderImmediatelyFillable,"Order would immediately match and take.":r.OrderImmediatelyFillable,"Account has insufficient balance for requested action.":r.InsufficientFunds,"Rest API trading is not enabled.":r.PermissionDenied,"This account may not place or cancel orders.":r.PermissionDenied,"You don't have permission.":r.PermissionDenied,"Market is closed.":r.OperationRejected,"Too many requests. Please try again later.":r.RateLimitExceeded,"This action is disabled on this account.":r.AccountSuspended,"Limit orders require GTC for this phase.":r.BadRequest,"This order type is not possible in this trading phase.":r.BadRequest,"This type of sub-account exceeds the maximum number limit":r.OperationRejected,"This symbol is restricted for this account.":r.PermissionDenied,"This symbol is not permitted for this account.":r.PermissionDenied},broad:{"has no operation privilege":r.PermissionDenied,MAX_POSITION:r.BadRequest}}})}isInverse(e,t=void 0){return void 0===t?"delivery"===e:"inverse"===t}isLinear(e,t=void 0){return void 0===t?"future"===e||"swap"===e:"linear"===t}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}createExpiredOptionMarket(e){const t="USDT",s=e.split("-"),i=e.split("/");let r;r=e.indexOf("/")>-1?this.safeString(i,0):this.safeString(s,0);const a=this.safeString(s,1),o=this.safeInteger(s,2),n=this.safeString(s,2),d=this.safeString(s,3),h=this.convertExpireDate(a);return{id:r+"-"+a+"-"+n+"-"+d,symbol:r+"/"+t+":"+t+"-"+a+"-"+n+"-"+d,base:r,quote:t,baseId:r,quoteId:t,active:void 0,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:void 0,expiry:this.parse8601(h),expiryDatetime:h,optionType:"C"===d?"call":"put",strike:o,settle:t,settleId:t,precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}market(e){if(void 0===this.markets)throw new r.ExchangeError(this.id+" markets not loaded");let t=this.safeString(this.options,"defaultType");const s=this.safeString(this.options,"defaultSubType"),i="future"===t,a="delivery"===t,o=i||a;if("string"==typeof e)if(e in this.markets){const t=this.markets[e];if(!o||!t.spot)return t;{const s=e+":"+(i?t.quote:t.base);if(s in this.markets)return this.markets[s]}}else{if(e in this.markets_by_id){const r=this.markets_by_id[e];i?t="linear":a?t="inverse":void 0===t&&(t=s);for(let e=0;e-1&&e.indexOf(":")<0){const[t,s]=e.split("/"),i=e+":"+("USD"===s?t:s);if(i in this.markets)return this.markets[i]}else if(e.indexOf("-C")>-1||e.indexOf("-P")>-1)return this.createExpiredOptionMarket(e)}throw new r.BadSymbol(this.id+" does not have market symbol "+e)}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return void 0!==e&&(e.indexOf("-C")>-1||e.indexOf("-P")>-1)&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,s,i)}costToPrecision(e,t){return this.decimalToPrecision(t,o.tk,this.markets[e].precision.quote,this.precisionMode,this.paddingMode)}currencyToPrecision(e,t,s=void 0){return void 0!==this.safeValue(this.currencies[e],"precision")?this.decimalToPrecision(t,o.tk,this.currencies[e].precision,this.precisionMode,this.paddingMode):this.numberToString(t)}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchTime(e={}){const t=this.safeString2(this.options,"fetchTime","defaultType","spot"),s=this.safeString(e,"type",t),i=this.omit(e,"type");let r,a;return[r,e]=this.handleSubTypeAndParams("fetchTime",void 0,e),a=this.isLinear(s,r)?await this.fapiPublicGetTime(i):this.isInverse(s,r)?await this.dapiPublicGetTime(i):await this.publicGetTime(i),this.safeInteger(a,"serverTime")}async fetchCurrencies(e={}){if(!this.safeValue(this.options,"fetchCurrencies"))return;if(!this.checkRequiredCredentials(!1))return;if(void 0!==this.safeValue(this.urls,"apiBackup"))return;const t=await this.sapiGetCapitalConfigGetall(e),s={};for(let e=0;e0)){const e=this.parseTimeframe(t),r=this.sum(s,i*e*1e3-1),a=this.milliseconds();h.endTime=Math.min(a,r)}let l;return void 0!==d&&(h.endTime=d),l=o.option?await this.eapiPublicGetKlines(this.extend(h,r)):"mark"===n?o.inverse?await this.dapiPublicGetMarkPriceKlines(this.extend(h,r)):await this.fapiPublicGetMarkPriceKlines(this.extend(h,r)):"index"===n?o.inverse?await this.dapiPublicGetIndexPriceKlines(this.extend(h,r)):await this.fapiPublicGetIndexPriceKlines(this.extend(h,r)):o.linear?await this.fapiPublicGetKlines(this.extend(h,r)):o.inverse?await this.dapiPublicGetKlines(this.extend(h,r)):await this.publicGetKlines(this.extend(h,r)),this.parseOHLCVs(l,o,t,s,i)}parseTrade(e,t=void 0){if("isDustTrade"in e)return this.parseDustTrade(e,t);const s=this.safeInteger2(e,"T","time");let i=this.safeString2(e,"q","qty");i=this.safeString(e,"quantity",i);const r=this.safeString(e,"symbol"),o="isIsolated"in e||"M"in e||"orderListId"in e||"isMaker"in e?"spot":"contract",n=(t=this.safeMarket(r,t,void 0,o)).symbol;let d;const h=this.safeValue2(e,"m","isBuyerMaker");let c,l;if(void 0!==h?d=h?"sell":"buy":"side"in e?d=this.safeStringLower(e,"side"):"isBuyer"in e&&(d=e.isBuyer?"buy":"sell"),"commission"in e&&(l={cost:this.safeString(e,"commission"),currency:this.safeCurrencyCode(this.safeString(e,"commissionAsset"))}),"isMaker"in e&&(c=e.isMaker?"maker":"taker"),"maker"in e&&(c=e.maker?"maker":"taker"),"optionSide"in e||t.option){const t=this.safeCurrencyCode(this.safeString(e,"quoteAsset","USDT"));c=this.safeStringLower(e,"liquidity"),"fee"in e&&(l={cost:this.safeString(e,"fee"),currency:t}),"buy"!==d&&"sell"!==d&&(d="1"===d?"buy":"sell"),"optionSide"in e&&"buy"!==d&&(i=a.O.stringMul("-1",i))}return this.safeTrade({info:e,timestamp:s,datetime:this.iso8601(s),symbol:n,id:this.safeStringN(e,["t","a","tradeId","id"]),order:this.safeString(e,"orderId"),type:this.safeStringLower(e,"type"),side:d,takerOrMaker:c,price:this.safeString2(e,"p","price"),amount:i,cost:this.safeString2(e,"quoteQty","baseQty"),fee:l},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchTrades",e,t,s,i);const a=this.market(e),o={symbol:a.id};if(!a.option){void 0!==t&&(o.startTime=t,o.endTime=this.sum(t,36e5));const e=this.safeInteger(i,"until");void 0!==e&&(o.endTime=e)}if(void 0!==s){const e=a.swap||a.future;o.limit=e?Math.min(s,1e3):s}let n,d=this.safeString(this.options,"fetchTradesMethod");return d=this.safeString2(i,"fetchTradesMethod","method",d),i=this.omit(i,["until","fetchTradesMethod"]),n=a.option||"eapiPublicGetTrades"===d?await this.eapiPublicGetTrades(this.extend(o,i)):a.linear||"fapiPublicGetAggTrades"===d?await this.fapiPublicGetAggTrades(this.extend(o,i)):a.inverse||"dapiPublicGetAggTrades"===d?await this.dapiPublicGetAggTrades(this.extend(o,i)):await this.publicGetAggTrades(this.extend(o,i)),this.parseTrades(n,a,t,s)}async editSpotOrder(e,t,s,i,a,o=void 0,n={}){await this.loadMarkets();const d=this.market(t);if(!d.spot)throw new r.NotSupported(this.id+" editSpotOrder() does not support "+d.type+" orders");const h=this.editSpotOrderRequest(e,t,s,i,a,o,n),c=await this.privatePostOrderCancelReplace(h),l=this.safeDict(c,"newOrderResponse");return this.parseOrder(l,d)}editSpotOrderRequest(e,t,s,i,n,d=void 0,h={}){const c=this.market(t),l=this.safeStringN(h,["newClientOrderId","clientOrderId","origClientOrderId"]),u={symbol:c.id,side:i.toUpperCase()},p=s.toUpperCase();let f=p;this.isPostOnly("MARKET"===p,"LIMIT_MAKER"===p,h)&&(f="LIMIT_MAKER"),u.type=f;const m=this.safeNumber2(h,"stopPrice","triggerPrice");void 0!==m&&("MARKET"===f?f="STOP_LOSS":"LIMIT"===f&&(f="STOP_LOSS_LIMIT"));const g=this.safeValue(c.info,"orderTypes");if(!this.inArray(f,g))throw p!==f?new r.InvalidOrder(this.id+" stopPrice parameter is not allowed for "+t+" "+s+" orders"):new r.InvalidOrder(this.id+" "+s+" is not a valid order type for the "+t+" market");if(void 0===l){const e=this.safeValue(this.options,"broker");if(void 0!==e){const t=this.safeString(e,"spot");void 0!==t&&(u.newClientOrderId=t+this.uuid22())}}else u.newClientOrderId=l;u.newOrderRespType=this.safeValue(this.options.newOrderRespType,s,"RESULT");let v=!1,y=!1,w=!1,b=!1;if("MARKET"===f){if(this.safeBool(this.options,"quoteOrderQty",!0)){const e=this.safeValue2(h,"quoteOrderQty","cost"),t=c.precision.price;if(void 0!==e)u.quoteOrderQty=this.decimalToPrecision(e,o.tk,t,this.precisionMode);else if(void 0!==d){const e=this.numberToString(n),s=this.numberToString(d),i=a.O.stringMul(e,s);u.quoteOrderQty=this.decimalToPrecision(i,o.tk,t,this.precisionMode)}else b=!0}else b=!0}else"LIMIT"===f?(y=!0,v=!0,b=!0):"STOP_LOSS"===f||"TAKE_PROFIT"===f?(w=!0,b=!0):"STOP_LOSS_LIMIT"===f||"TAKE_PROFIT_LIMIT"===f?(b=!0,w=!0,y=!0,v=!0):"LIMIT_MAKER"===f&&(y=!0,b=!0);if(b&&(u.quantity=this.amountToPrecision(t,n)),y){if(void 0===d)throw new r.InvalidOrder(this.id+" editOrder() requires a price argument for a "+s+" order");u.price=this.priceToPrecision(t,d)}if(v&&void 0===this.safeString(h,"timeInForce")&&(u.timeInForce=this.options.defaultTimeInForce),w){if(void 0===m)throw new r.InvalidOrder(this.id+" editOrder() requires a stopPrice extra param for a "+s+" order");u.stopPrice=this.priceToPrecision(t,m)}u.cancelReplaceMode="STOP_ON_FAILURE";return void 0===this.safeString2(h,"cancelNewClientOrderId","cancelOrigClientOrderId")&&(u.cancelOrderId=e),"PO"===this.safeString(h,"timeInForce")&&(h=this.omit(h,["timeInForce"])),h=this.omit(h,["quoteOrderQty","cost","stopPrice","newClientOrderId","clientOrderId","postOnly"]),this.extend(u,h)}editContractOrderRequest(e,t,s,i,a,o=void 0,n={}){const d=this.market(t);if(!d.contract)throw new r.NotSupported(this.id+" editContractOrder() does not support "+d.type+" orders");const h={symbol:d.id,side:i.toUpperCase()},c=this.safeStringN(n,["newClientOrderId","clientOrderId","origClientOrderId"]);return h.orderId=e,h.quantity=this.amountToPrecision(t,a),void 0!==o&&(h.price=this.priceToPrecision(t,o)),void 0!==c&&(h.origClientOrderId=c),n=this.omit(n,["clientOrderId","newClientOrderId"]),h}async editContractOrder(e,t,s,i,r,a=void 0,o={}){await this.loadMarkets();const n=this.market(t),d=this.editContractOrderRequest(e,t,s,i,r,a,o);let h;return n.linear?h=await this.fapiPrivatePutOrder(this.extend(d,o)):n.inverse&&(h=await this.dapiPrivatePutOrder(this.extend(d,o))),this.parseOrder(h,n)}async editOrder(e,t,s,i,a=void 0,o=void 0,n={}){await this.loadMarkets();const d=this.market(t);if(d.option)throw new r.NotSupported(this.id+" editOrder() does not support "+d.type+" orders");return d.spot?await this.editSpotOrder(e,t,s,i,a,o,n):await this.editContractOrder(e,t,s,i,a,o,n)}parseOrderStatus(e){return this.safeString({NEW:"open",PARTIALLY_FILLED:"open",ACCEPTED:"open",FILLED:"closed",CANCELED:"canceled",CANCELLED:"canceled",PENDING_CANCEL:"canceling",REJECTED:"rejected",EXPIRED:"expired",EXPIRED_IN_MATCH:"expired"},e,e)}parseOrder(e,t=void 0){if(void 0!==this.safeString(e,"code"))return this.safeOrder({info:e,status:"rejected"},t);const s=this.parseOrderStatus(this.safeString2(e,"status","strategyStatus")),i=this.safeString(e,"symbol"),r="positionSide"in e||"cumQuote"in e?"contract":"spot",o=this.safeSymbol(i,t,void 0,r),n=this.safeString(e,"executedQty","0"),d=this.safeIntegerN(e,["time","createTime","workingTime","transactTime","updateTime"]);let h;if("transactTime"in e||"updateTime"in e){const t=this.safeInteger2(e,"updateTime","transactTime");"open"===s?a.O.stringGt(n,"0")&&(h=t):"closed"===s&&(h=t)}const c=this.safeInteger2(e,"transactTime","updateTime"),l=this.safeString(e,"avgPrice"),u=this.safeString(e,"price"),p=this.safeString2(e,"origQty","quantity");let f=this.safeString2(e,"cummulativeQuoteQty","cumQuote");f=this.safeString(e,"cumBase",f);let m=this.safeStringLower(e,"type");const g=this.safeStringLower(e,"side"),v=this.safeList(e,"fills",[]);let y=this.safeString(e,"timeInForce");"GTX"===y&&(y="PO");const w="limit_maker"===m||"PO"===y;"limit_maker"===m&&(m="limit");const b=this.safeString(e,"stopPrice"),S=this.parseNumber(this.omitZero(b)),k=this.safeNumber(e,"fee");let O;return void 0!==k&&(O={currency:this.safeString(e,"quoteAsset"),cost:k,rate:void 0}),this.safeOrder({info:e,id:this.safeString2(e,"strategyId","orderId"),clientOrderId:this.safeString2(e,"clientOrderId","newClientStrategyId"),timestamp:d,datetime:this.iso8601(d),lastTradeTimestamp:h,lastUpdateTimestamp:c,symbol:o,type:m,timeInForce:y,postOnly:w,reduceOnly:this.safeBool(e,"reduceOnly"),side:g,price:u,triggerPrice:S,amount:p,cost:f,average:l,filled:n,remaining:void 0,status:s,fee:O,trades:v},t)}async createOrders(e,t={}){await this.loadMarkets();const s=[];let i=[];for(let t=0;t=i&&void 0===l&&n.linear&&(l=this.sum(e,i),l=Math.min(l,s))}if(void 0!==l&&(o.endTime=l,i=this.omit(i,["endTime","until"])),void 0!==s&&(("option"===d||n.contract)&&(s=Math.min(s,1e3)),o.limit=s),"option"===d)c=await this.eapiPrivateGetUserTrades(this.extend(o,i));else{if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");let t;[h,i]=this.handleMarginModeAndParams("fetchMyTrades",i),[t,i]=this.handleOptionAndParams2(i,"fetchMyTrades","papi","portfolioMargin",!1),"spot"===d||"margin"===d?t?c=await this.papiGetMarginMyTrades(this.extend(o,i)):"margin"===d||void 0!==h?("isolated"===h&&(o.isIsolated=!0),c=await this.sapiGetMarginMyTrades(this.extend(o,i))):c=await this.privateGetMyTrades(this.extend(o,i)):n.linear?c=t?await this.papiGetUmUserTrades(this.extend(o,i)):await this.fapiPrivateGetUserTrades(this.extend(o,i)):n.inverse&&(c=t?await this.papiGetCmUserTrades(this.extend(o,i)):await this.dapiPrivateGetUserTrades(this.extend(o,i)))}return this.parseTrades(c,n,t,s)}async fetchMyDustTrades(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};void 0!==t&&(r.startTime=t,r.endTime=this.sum(t,7776e6));const a=this.safeStringUpper(i,"type");i=this.omit(i,"type"),void 0!==a&&(r.accountType=a);const o=await this.sapiGetAssetDribblet(this.extend(r,i)),n=this.safeList(o,"userAssetDribblets",[]),d=this.safeInteger(o,"total",0),h=[];for(let e=0;e=0&&(a=a.slice(18));const o=this.safeString2(e,"coin","fiatCurrency");let n,d=this.safeCurrencyCode(o,t);n=this.safeInteger2(e,"insertTime","createTime"),void 0===n&&(n=this.parse8601(this.safeString(e,"applyTime")));const h=this.safeInteger2(e,"successTime","updateTime");let c=this.safeString(e,"type");if(void 0===c){const t=this.safeString(e,"transactionType");void 0!==t&&(c="0"===t?"deposit":"withdrawal");const s=this.safeValue(this.options,"legalMoneyCurrenciesById");d=this.safeString(s,d,d)}const l=this.parseTransactionStatusByType(this.safeString(e,"status"),c),u=this.safeNumber(e,"amount"),p=this.safeNumber2(e,"transactionFee","totalFee");let f;void 0!==p&&(f={currency:d,cost:p});const m=this.safeInteger(e,"transferType");let g;void 0!==m&&(g=!!m);const v=this.safeString(e,"network");return{info:e,id:s,txid:a,timestamp:n,datetime:this.iso8601(n),network:v,address:i,addressTo:i,addressFrom:void 0,tag:r,tagTo:r,tagFrom:void 0,type:c,amount:u,currency:d,status:l,updated:h,internal:g,comment:void 0,fee:f}}parseTransferStatus(e){return this.safeString({CONFIRMED:"ok"},e,e)}parseTransfer(e,t=void 0){const s=this.safeString(e,"tranId"),i=this.safeString(e,"asset"),r=this.safeCurrencyCode(i,t),a=this.safeNumber(e,"amount"),o=this.safeString(e,"type");let n,d;const h=this.safeDict(this.options,"accountsById",{});if(void 0!==o){const e=o.split("_");n=this.safeValue(e,0),d=this.safeValue(e,1),n=this.safeString(h,n,n),d=this.safeString(h,d,d)}const c=this.safeInteger(e,"timestamp"),l=this.parseTransferStatus(this.safeString(e,"status"));return{info:e,id:s,timestamp:c,datetime:this.iso8601(c),currency:r,amount:a,fromAccount:n,toAccount:d,status:l}}parseIncome(e,t=void 0){const s=this.safeString(e,"symbol"),i=this.safeString(e,"asset"),r=this.safeInteger(e,"time");return{info:e,symbol:this.safeSymbol(s,t,void 0,"swap"),code:this.safeCurrencyCode(i),timestamp:r,datetime:this.iso8601(r),id:this.safeString(e,"tranId"),amount:this.safeNumber(e,"income")}}async transfer(e,t,s,i,a={}){await this.loadMarkets();const o=this.currency(e),n={asset:o.id,amount:this.currencyToPrecision(e,t)};if(n.type=this.safeString(a,"type"),a=this.omit(a,"type"),void 0===n.type){const e=this.safeString(a,"symbol");let t;void 0!==e&&(t=this.market(e),a=this.omit(a,"symbol"));let o,d=this.convertTypeToAccount(s).toUpperCase(),h=this.convertTypeToAccount(i).toUpperCase();if(void 0!==t&&(o=t.id),"ISOLATED"===d&&void 0===e)throw new r.ArgumentsRequired(this.id+' transfer () requires params["symbol"] when fromAccount is '+s);if("ISOLATED"===h&&void 0===e)throw new r.ArgumentsRequired(this.id+' transfer () requires params["symbol"] when toAccount is '+i);const c=this.safeDict(this.options,"accountsById",{}),l=!(d in c),u=!(h in c);if(l&&void 0===t&&(o=d),u&&void 0===t&&(o=h),l||u){const e="MAIN"===d,t="MAIN"===h;if((l||u)&&("UMFUTURE"===d||"CMFUTURE"===d||("UMFUTURE"===h||"CMFUTURE"===h)||("FUNDING"===d||"FUNDING"===h)||("OPTION"===d||"OPTION"===h)))throw new r.BadRequest(this.id+" transfer () does not allow transfers between "+s+" and "+i);t&&l?(d="ISOLATED_MARGIN",n.fromSymbol=o):e&&u?(h="ISOLATED_MARGIN",n.toSymbol=o):l&&u?(n.fromSymbol=d,n.toSymbol=h,d="ISOLATEDMARGIN",h="ISOLATEDMARGIN"):(l&&(n.fromSymbol=o,d="ISOLATEDMARGIN"),u&&(n.toSymbol=o,h="ISOLATEDMARGIN")),n.type=d+"_"+h}else n.type=d+"_"+h}const d=await this.sapiPostAssetTransfer(this.extend(n,a));return this.parseTransfer(d,o)}async fetchTransfers(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let a,o=!1;if([o,i]=this.handleOptionAndParams(i,"fetchTransfers","paginate"),o)return await this.fetchPaginatedCallDynamic("fetchTransfers",e,t,s,i);void 0!==e&&(a=this.currency(e));const n=this.safeString2(this.options,"fetchTransfers","defaultType","spot"),d=this.safeString(i,"fromAccount",n),h="future"===d?"spot":"future",c=this.safeString(i,"toAccount",h);let l=this.safeString(i,"type");const u=this.safeDict(this.options,"accountsByType",{}),p=this.safeString(u,d),f=this.safeString(u,c);if(void 0===l){if(void 0===p){const e=Object.keys(u);throw new r.ExchangeError(this.id+" fromAccount parameter must be one of "+e.join(", "))}if(void 0===f){const e=Object.keys(u);throw new r.ExchangeError(this.id+" toAccount parameter must be one of "+e.join(", "))}l=p+"_"+f}const m={type:l};void 0!==t&&(m.startTime=t),void 0!==s&&(m.size=s);const g=this.safeInteger(i,"until");void 0!==g&&(i=this.omit(i,"until"),m.endTime=g);const v=await this.sapiGetAssetTransfer(this.extend(m,i)),y=this.safeList(v,"rows",[]);return this.parseTransfers(y,a,t,s)}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s={coin:this.currency(e).id},i=this.safeDict(this.options,"networks",{});let r=this.safeStringUpper(t,"network");r=this.safeString(i,r,r),void 0!==r&&(s.network=r,t=this.omit(t,"network"));const a=await this.sapiGetCapitalDepositAddress(this.extend(s,t)),o=this.safeString(a,"address"),n=this.safeString(a,"url");let d;if(void 0!==n){const t=this.safeDict(this.options,"reverseNetworks",{}),s=n.split("/");let i=this.safeString(s,2);if("blockchair.com"===i||"viewblock.io"===i){const e=this.safeString(s,3);void 0!==e&&(i=i+"/"+e)}d=this.safeString(t,i);const r=this.safeValue(this.options,"impliedNetworks",{ETH:{ERC20:"ETH"},TRX:{TRC20:"TRX"}});if(e in r){const t=this.safeDict(r,e,{});d=this.safeString(t,d,d)}}let h=this.safeString(a,"tag","");return 0===h.length&&(h=void 0),this.checkAddress(o),{currency:e,address:o,tag:h,network:d,info:a}}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const s=await this.sapiGetCapitalConfigGetall(t),i={};for(let e=0;e4)throw new r.ArgumentsRequired(this.id+" type must be between 1 and 4");await this.loadMarkets();const a=this.currency(e),o={asset:a.id,amount:t,type:s},n=await this.sapiPostFuturesTransfer(this.extend(o,i));return this.parseTransfer(n,a)}async fetchFundingRate(e,t={}){await this.loadMarkets();const s=this.market(e),i={symbol:s.id};let a;if(s.linear)a=await this.fapiPublicGetPremiumIndex(this.extend(i,t));else{if(!s.inverse)throw new r.NotSupported(this.id+" fetchFundingRate() supports linear and inverse contracts only");a=await this.dapiPublicGetPremiumIndex(this.extend(i,t))}return s.inverse&&(a=a[0]),this.parseFundingRate(a,s)}async fetchFundingRateHistory(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const a={};let o=!1;if([o,i]=this.handleOptionAndParams(i,"fetchFundingRateHistory","paginate"),o)return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory",e,t,s,"8h",i);const n=this.safeString2(this.options,"fetchFundingRateHistory","defaultType","future"),d=this.safeString(i,"type",n);let h,c;void 0!==e&&(h=this.market(e),e=h.symbol,a.symbol=h.id),[c,i]=this.handleSubTypeAndParams("fetchFundingRateHistory",h,i,"linear"),i=this.omit(i,"type"),void 0!==t&&(a.startTime=t);const l=this.safeInteger(i,"until"),u=this.safeInteger(i,"endTime",l);let p;if(i=this.omit(i,["endTime","until"]),void 0!==u&&(a.endTime=u),void 0!==s&&(a.limit=s),this.isLinear(d,c))p=await this.fapiPublicGetFundingRate(this.extend(a,i));else{if(!this.isInverse(d,c))throw new r.NotSupported(this.id+" fetchFundingRateHistory() is not supported for "+d+" markets");p=await this.dapiPublicGetFundingRate(this.extend(a,i))}const f=[];for(let e=0;e1)throw new r.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;i=this.market(t),s.symbol=i.id}const a=await this.eapiPrivateGetPosition(this.extend(s,t)),o=[];for(let e=0;e125)throw new r.BadRequest(this.id+" leverage should be between 1 and 125");await this.loadMarkets();const i=this.market(t),a={symbol:i.id,leverage:e};let o,n;if([o,s]=this.handleOptionAndParams2(s,"setLeverage","papi","portfolioMargin",!1),i.linear)n=o?await this.papiPostUmLeverage(this.extend(a,s)):await this.fapiPrivatePostLeverage(this.extend(a,s));else{if(!i.inverse)throw new r.NotSupported(this.id+" setLeverage() supports linear and inverse contracts only");n=o?await this.papiPostCmLeverage(this.extend(a,s)):await this.dapiPrivatePostLeverage(this.extend(a,s))}return n}async setMarginMode(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("CROSS"===(e=e.toUpperCase())&&(e="CROSSED"),"ISOLATED"!==e&&"CROSSED"!==e)throw new r.BadRequest(this.id+" marginMode must be either isolated or cross");await this.loadMarkets();const i=this.market(t),a={symbol:i.id,marginType:e};let o;try{if(i.linear)o=await this.fapiPrivatePostMarginType(this.extend(a,s));else{if(!i.inverse)throw new r.NotSupported(this.id+" setMarginMode() supports linear and inverse contracts only");o=await this.dapiPrivatePostMarginType(this.extend(a,s))}}catch(e){if(!(e instanceof r.MarginModeAlreadySet))throw e;if(this.safeBool(this.options,"throwMarginModeAlreadySet",!1))throw e;o={code:-4046,msg:"No need to change margin type."}}return o}async setPositionMode(e,t=void 0,s={}){const i=this.safeString(this.options,"defaultType","future"),a=this.safeString(s,"type",i);let o,n,d;s=this.omit(s,["type"]),[o,s]=this.handleSubTypeAndParams("setPositionMode",void 0,s),[n,s]=this.handleOptionAndParams2(s,"setPositionMode","papi","portfolioMargin",!1),d=e?"true":"false";const h={dualSidePosition:d};let c;if(this.isInverse(a,o))c=n?await this.papiPostCmPositionSideDual(this.extend(h,s)):await this.dapiPrivatePostPositionSideDual(this.extend(h,s));else{if(!this.isLinear(a,o))throw new r.BadRequest(this.id+" setPositionMode() supports linear and inverse contracts only");c=n?await this.papiPostUmPositionSideDual(this.extend(h,s)):await this.fapiPrivatePostPositionSideDual(this.extend(h,s))}return c}async fetchLeverages(e=void 0,t={}){let s,i,a,o;if(await this.loadMarkets(),await this.loadLeverageBrackets(!1,t),[s,t]=this.handleMarketTypeAndParams("fetchLeverages",void 0,t),[i,t]=this.handleSubTypeAndParams("fetchLeverages",void 0,t,"linear"),[a,t]=this.handleOptionAndParams2(t,"fetchLeverages","papi","portfolioMargin",!1),this.isLinear(s,i))o=a?await this.papiGetUmAccount(t):await this.fapiPrivateV2GetAccount(t);else{if(!this.isInverse(s,i))throw new r.NotSupported(this.id+" fetchLeverages() supports linear and inverse contracts only");o=a?await this.papiGetCmAccount(t):await this.dapiPrivateGetAccount(t)}const n=this.safeList(o,"positions",[]);return this.parseLeverages(n,e,"symbol")}parseLeverage(e,t=void 0){const s=this.safeString(e,"symbol"),i=this.safeBool(e,"isolated");let r;void 0!==i&&(r=i?"isolated":"cross");const a=this.safeStringLower(e,"positionSide");let o,n;const d=this.safeInteger(e,"leverage");return"both"===a?(o=d,n=d):"long"===a?o=d:"short"===a&&(n=d),{info:e,symbol:this.safeSymbol(s,t),marginMode:r,longLeverage:o,shortLeverage:n}}async fetchSettlementHistory(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const a=void 0===e?void 0:this.market(e);let o;if([o,i]=this.handleMarketTypeAndParams("fetchSettlementHistory",a,i),"option"!==o)throw new r.NotSupported(this.id+" fetchSettlementHistory() supports option markets only");const n={};void 0!==e&&(e=a.symbol,n.underlying=a.baseId+a.quoteId),void 0!==t&&(n.startTime=t),void 0!==s&&(n.limit=s);const d=await this.eapiPublicGetExerciseHistory(this.extend(n,i)),h=this.parseSettlements(d,a),c=this.sortBy(h,"timestamp");return this.filterBySymbolSinceLimit(c,e,t,s)}async fetchMySettlementHistory(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const a=void 0===e?void 0:this.market(e);let o;if([o,i]=this.handleMarketTypeAndParams("fetchMySettlementHistory",a,i),"option"!==o)throw new r.NotSupported(this.id+" fetchMySettlementHistory() supports option markets only");const n={};void 0!==e&&(n.symbol=a.id),void 0!==t&&(n.startTime=t),void 0!==s&&(n.limit=s);const d=await this.eapiPrivateGetExerciseRecord(this.extend(n,i)),h=this.parseSettlements(d,a),c=this.sortBy(h,"timestamp");return this.filterBySymbolSinceLimit(c,a.symbol,t,s)}parseSettlement(e,t){const s=this.safeInteger2(e,"expiryDate","createDate"),i=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(i,t),price:this.safeNumber2(e,"realStrikePrice","exercisePrice"),timestamp:s,datetime:this.iso8601(s)}}parseSettlements(e,t){const s=[];for(let i=0;i-1||"private"===t,s=e?"spot":"future",r=e?"x-R4BD3S82":"x-xcKtGhcu",a=this.safeDict(this.options,"broker",{}),o=this.safeString(a,s,r);i.newClientOrderId=o+this.uuid22()}}let r;if("batchOrders"===e&&"POST"===s){const e=this.safeValue(i,"batchOrders"),t=this.json(e);i.batchOrders=t}const u=this.safeInteger(this.options,"recvWindow");let p=this.extend({timestamp:this.nonce()},i);void 0!==u&&(p.recvWindow=u);const f=this.safeInteger(i,"recvWindow");if(void 0!==f&&(p.recvWindow=f),"sapi"===t&&"asset/dust"===e)r=this.urlencodeWithArrayRepeat(p);else if("batchOrders"===e||e.indexOf("sub-account")>=0||"capital/withdraw/apply"===e||e.indexOf("staking")>=0)if("DELETE"===s&&"batchOrders"===e){const e=this.safeList(p,"orderidlist",[]),t=this.safeList(p,"origclientorderidlist",[]);p=this.omit(p,["orderidlist","origclientorderidlist"]),r=this.rawencode(p);const s=e.length,i=t.length;s>0&&(r=r+"&orderidlist=["+e.join(",")+"]"),i>0&&(r=r+"&origclientorderidlist=["+t.join(",")+"]")}else r=this.rawencode(p);else r=this.urlencode(p);let m;m=this.secret.indexOf("PRIVATE KEY")>-1?this.secret.length>120?this.encodeURIComponent((0,d.j)(r,this.secret,n.J)):this.encodeURIComponent((0,h.UZ)(this.encode(r),this.secret,c.UN)):this.hmac(this.encode(r),this.encode(this.secret),n.J),r+="&signature="+m,a={"X-MBX-APIKEY":this.apiKey},"GET"===s||"DELETE"===s?l+="?"+r:(o=r,a["Content-Type"]="application/x-www-form-urlencoded")}else Object.keys(i).length&&(l+="?"+this.urlencode(i));return{url:l,method:s,body:o,headers:a}}getExceptionsByUrl(e,t){let s;const i=void 0!==this.hostname?this.hostname:"binance.com";if(e.startsWith("https://api."+i+"/")?s="spot":e.startsWith("https://dapi."+i+"/")?s="inverse":e.startsWith("https://fapi."+i+"/")?s="linear":e.startsWith("https://eapi."+i+"/")?s="option":e.startsWith("https://papi."+i+"/")&&(s="portfoliomargin"),void 0!==s){const e=this.safeDict(this.exceptions,s,{});return this.safeDict(e,t,{})}return{}}handleErrors(e,t,s,i,o,n,d,h,c){if(418===e||429===e)throw new r.DDoSProtection(this.id+" "+e.toString()+" "+t+" "+n);if(e>=400){if(n.indexOf("Price * QTY is zero or less")>=0)throw new r.InvalidOrder(this.id+" order cost = amount * price is zero or less "+n);if(n.indexOf("LOT_SIZE")>=0)throw new r.InvalidOrder(this.id+" order amount should be evenly divisible by lot size "+n);if(n.indexOf("PRICE_FILTER")>=0)throw new r.InvalidOrder(this.id+" order price is invalid, i.e. exceeds allowed price precision, exceeds min price or max price limits or is invalid value in general, use this.priceToPrecision (symbol, amount) "+n)}if(void 0===d)return;const l=this.safeBool(d,"success",!0);if(!l){const e=this.safeString(d,"msg");let t;if(void 0!==e){try{t=JSON.parse(e)}catch(e){t=void 0}void 0!==t&&(d=t)}}const u=this.safeString(d,"msg");void 0!==u&&(this.throwExactlyMatchedException(this.getExceptionsByUrl(s,"exact"),u,this.id+" "+u),this.throwExactlyMatchedException(this.exceptions.exact,u,this.id+" "+u),this.throwBroadlyMatchedException(this.getExceptionsByUrl(s,"broad"),u,this.id+" "+u),this.throwBroadlyMatchedException(this.exceptions.broad,u,this.id+" "+u));const p=this.safeString(d,"code");if(void 0!==p){if("200"===p||a.O.stringEquals(p,"0"))return;if("-2015"===p&&this.options.hasAlreadyAuthenticatedSuccessfully)throw new r.DDoSProtection(this.id+" "+n);const e=this.id+" "+n;if("No need to change margin type."===u)throw new r.MarginModeAlreadySet(e);throw this.throwExactlyMatchedException(this.getExceptionsByUrl(s,"exact"),p,e),this.throwExactlyMatchedException(this.exceptions.exact,p,e),new r.ExchangeError(e)}if(!l)throw new r.ExchangeError(this.id+" "+n);if(Array.isArray(d)){if(1===d.length){const e=d[0],t=this.safeString(e,"code");void 0!==t&&(this.throwExactlyMatchedException(this.getExceptionsByUrl(s,"exact"),t,this.id+" "+n),this.throwExactlyMatchedException(this.exceptions.exact,t,this.id+" "+n))}}}calculateRateLimiterCost(e,t,s,i,r={}){if("noCoin"in r&&!("coin"in i))return r.noCoin;if("noSymbol"in r&&!("symbol"in i))return r.noSymbol;if("noPoolId"in r&&!("poolId"in i))return r.noPoolId;if("byLimit"in r&&"limit"in i){const e=i.limit,t=r.byLimit;for(let s=0;s93)throw new r.BadRequest(this.id+" fetchBorrowRateHistory() limit parameter cannot exceed 92");const a={asset:this.currency(e).id,limit:s};if(void 0!==t){a.startTime=t;const e=this.sum(t,864e5*s)-1,i=this.milliseconds();a.endTime=Math.min(e,i)}const o=await this.sapiGetMarginInterestRateHistory(this.extend(a,i));return this.parseBorrowRateHistory(o,e,t,s)}parseBorrowRateHistory(e,t,s,i){const r=[];for(let t=0;t{s.d(t,{Z:()=>r});var i=s(9987);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"binancecoinm",name:"Binance COIN-M",urls:{logo:"https://user-images.githubusercontent.com/1294454/117738721-668c8d80-b205-11eb-8c49-3fad84c4a07f.jpg",doc:["https://binance-docs.github.io/apidocs/delivery/en/","https://binance-docs.github.io/apidocs/spot/en"]},has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:void 0,createStopMarketOrder:!0},options:{fetchMarkets:["inverse"],defaultSubType:"inverse",leverageBrackets:void 0}})}async transferIn(e,t,s={}){return await this.futuresTransfer(e,t,3,s)}async transferOut(e,t,s={}){return await this.futuresTransfer(e,t,4,s)}}},2723:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(9987);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"binanceus",name:"Binance US",countries:["US"],hostname:"binance.us",rateLimit:50,certified:!1,pro:!0,urls:{logo:"https://user-images.githubusercontent.com/1294454/65177307-217b7c80-da5f-11e9-876e-0b748ba0a358.jpg",api:{web:"https://www.binance.us",public:"https://api.binance.us/api/v3",private:"https://api.binance.us/api/v3",sapi:"https://api.binance.us/sapi/v1",sapiV2:"https://api.binance.us/sapi/v2",sapiV3:"https://api.binance.us/sapi/v3"},www:"https://www.binance.us",referral:"https://www.binance.us/?ref=35005074",doc:"https://github.com/binance-us/binance-official-api-docs",fees:"https://www.binance.us/en/fee/schedule"},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0.001")}},options:{fetchMarkets:["spot"],defaultType:"spot",quoteOrderQty:!1},has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:void 0,option:!1,addMargin:!1,closeAllPositions:!1,closePosition:!1,createReduceOnlyOrder:!1,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedPositions:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchOpenInterestHistory:!1,fetchPosition:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,reduceMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1},api:{public:{get:{ping:1,time:1,exchangeInfo:10,trades:1,historicalTrades:5,aggTrades:1,depth:{cost:1,byLimit:[[100,1],[500,5],[1e3,10],[5e3,50]]},klines:1,"ticker/price":{cost:1,noSymbol:2},avgPrice:1,"ticker/bookTicker":{cost:1,noSymbol:2},"ticker/24hr":{cost:1,noSymbol:40},ticker:{cost:2,noSymbol:100}}},private:{get:{account:10,"rateLimit/order":20,order:2,openOrders:{cost:3,noSymbol:40},myTrades:10,myPreventedMatches:10,allOrders:10,orderList:2,allOrderList:10,openOrderList:3},post:{order:1,"order/test":1,"order/cancelReplace":1,"order/oco":1},delete:{order:1,openOrders:1,orderList:1}},sapi:{get:{"system/status":1,"asset/assetDistributionHistory":1,"asset/query/trading-fee":1,"asset/query/trading-volume":1,"sub-account/spotSummary":1,"sub-account/status":1,"otc/coinPairs":1,"otc/orders/{orderId}":1,"otc/orders":1,"ocbs/orders":1,"capital/config/getall":1,"capital/withdraw/history":1,"fiatpayment/query/withdraw/history":1,"capital/deposit/address":1,"capital/deposit/hisrec":1,"fiatpayment/query/deposit/history":1,"capital/sub-account/deposit/address":1,"capital/sub-account/deposit/history":1,"asset/query/dust-logs":1,"asset/query/dust-assets":1,"marketing/referral/reward/history":1,"staking/asset":1,"staking/stakingBalance":1,"staking/history":1,"staking/stakingRewardsHistory":1,"custodian/balance":1,"custodian/supportedAssetList":1,"custodian/walletTransferHistory":1,"custodian/custodianTransferHistory":1,"custodian/openOrders":1,"custodian/order":1,"custodian/orderHistory":1,"custodian/tradeHistory":1,"custodian/settlementSetting":1,"custodian/settlementHistory":1,"cl/transferHistory":1,"apipartner/checkEligibility":1,"apipartner/rebateHistory":1},post:{"otc/quotes":1,"otc/orders":1,"fiatpayment/withdraw/apply":1,"capital/withdraw/apply":1,"asset/dust":10,"staking/stake":1,"staking/unstake":1,"custodian/walletTransfer":1,"custodian/custodianTransfer":1,"custodian/undoTransfer":1,"custodian/order":1,"custodian/ocoOrder":1,"cl/transfer":1},delete:{"custodian/cancelOrder":1,"custodian/cancelOrdersBySymbol":1,"custodian/cancelOcoOrder":1}},sapiV2:{get:{"cl/account":10,"cl/alertHistory":1}},sapiV3:{get:{accountStatus:1,apiTradingStatus:1,"sub-account/list":1,"sub-account/transfer/history":1,"sub-account/assets":1},post:{"sub-account/transfer":1}}}})}}},3254:(e,t,s)=>{s.d(t,{Z:()=>a});var i=s(9987),r=s(6689);class a extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"binanceusdm",name:"Binance USDⓈ-M",urls:{logo:"https://user-images.githubusercontent.com/1294454/117738721-668c8d80-b205-11eb-8c49-3fad84c4a07f.jpg",doc:["https://binance-docs.github.io/apidocs/futures/en/","https://binance-docs.github.io/apidocs/spot/en"]},has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:void 0,createStopMarketOrder:!0},options:{fetchMarkets:["linear"],defaultSubType:"linear",leverageBrackets:void 0,marginTypes:{},marginModes:{}},exceptions:{exact:{"-5021":r.InvalidOrder,"-5022":r.InvalidOrder,"-5028":r.InvalidOrder}}})}async transferIn(e,t,s={}){return await this.futuresTransfer(e,t,1,s)}async transferOut(e,t,s={}){return await this.futuresTransfer(e,t,2,s)}}},7960:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(2244),r=s(6689),a=s(2194),o=s(1372),n=s(9292);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bingx",name:"BingX",countries:["US"],rateLimit:1e3,version:"v1",certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,addMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!0,closePosition:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createStopLossOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!0,createTrailingPercentOrder:!0,createTriggerOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchLeverage:!0,fetchLiquidations:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPositionHistory:!1,fetchPositionMode:!0,fetchPositions:!0,fetchPositionsHistory:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTransfers:!0,fetchWithdrawals:!0,reduceMargin:!0,setLeverage:!0,setMargin:!0,setMarginMode:!0,setPositionMode:!0,transfer:!0},hostname:"bingx.com",urls:{logo:"https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg",api:{spot:"https://open-api.{hostname}/openApi",swap:"https://open-api.{hostname}/openApi",contract:"https://open-api.{hostname}/openApi",wallets:"https://open-api.{hostname}/openApi",user:"https://open-api.{hostname}/openApi",subAccount:"https://open-api.{hostname}/openApi",account:"https://open-api.{hostname}/openApi",copyTrading:"https://open-api.{hostname}/openApi"},test:{swap:"https://open-api-vst.{hostname}/openApi"},www:"https://bingx.com/",doc:"https://bingx-api.github.io/docs/",referral:"https://bingx.com/invite/OHETOM"},fees:{tierBased:!0,spot:{feeSide:"get",maker:this.parseNumber("0.001"),taker:this.parseNumber("0.001")},swap:{feeSide:"quote",maker:this.parseNumber("0.0002"),taker:this.parseNumber("0.0005")}},requiredCredentials:{apiKey:!0,secret:!0},api:{spot:{v1:{public:{get:{"server/time":3,"common/symbols":3,"market/trades":3,"market/depth":3,"market/kline":3,"ticker/24hr":1}},private:{get:{"trade/query":3,"trade/openOrders":3,"trade/historyOrders":3,"trade/myTrades":3,"user/commissionRate":3,"account/balance":3},post:{"trade/order":3,"trade/cancel":3,"trade/batchOrders":3,"trade/order/cancelReplace":3,"trade/cancelOrders":3,"trade/cancelOpenOrders":3,"trade/cancelAllAfter":1}}},v3:{private:{get:{"get/asset/transfer":3,"asset/transfer":3,"capital/deposit/hisrec":3,"capital/withdraw/history":3},post:{"post/asset/transfer":3}}}},swap:{v1:{public:{get:{"ticker/price":1}},private:{get:{"positionSide/dual":1,"market/markPriceKlines":1,"trade/batchCancelReplace":1,"trade/fullOrder":1},post:{"trade/cancelReplace":1,"positionSide/dual":1,"trade/closePosition":1}}},v2:{public:{get:{"server/time":3,"quote/contracts":1,"quote/price":1,"quote/depth":1,"quote/trades":1,"quote/premiumIndex":1,"quote/fundingRate":1,"quote/klines":1,"quote/openInterest":1,"quote/ticker":1,"quote/bookTicker":1}},private:{get:{"user/balance":3,"user/positions":3,"user/income":3,"trade/openOrders":3,"trade/openOrder":3,"trade/order":3,"trade/marginType":3,"trade/leverage":3,"trade/forceOrders":3,"trade/allOrders":3,"trade/allFillOrders":3,"user/income/export":3,"user/commissionRate":3,"quote/bookTicker":3},post:{"trade/order":3,"trade/batchOrders":3,"trade/closeAllPositions":3,"trade/cancelAllAfter":3,"trade/marginType":3,"trade/leverage":3,"trade/positionMargin":3,"trade/order/test":3},delete:{"trade/order":3,"trade/batchOrders":3,"trade/allOpenOrders":3}}},v3:{public:{get:{"quote/klines":1}}}},contract:{v1:{private:{get:{allPosition:3,allOrders:3,balance:3}}}},wallets:{v1:{private:{get:{"capital/config/getall":3,"capital/deposit/address":1,"capital/innerTransfer/records":1,"capital/subAccount/deposit/address":1,"capital/deposit/subHisrec":1,"capital/subAccount/innerTransfer/records":1},post:{"capital/withdraw/apply":3,"capital/innerTransfer/apply":3,"capital/subAccountInnerTransfer/apply":3,"capital/deposit/createSubAddress":1}}}},subAccount:{v1:{private:{get:{list:3,assets:3},post:{create:3,"apiKey/create":3,"apiKey/edit":3,"apiKey/del":3,updateStatus:3}}}},account:{v1:{private:{get:{uid:1,"apiKey/query":1},post:{"innerTransfer/authorizeSubAccount":3}}}},user:{auth:{private:{post:{userDataStream:1},put:{userDataStream:1}}}},copyTrading:{v1:{private:{get:{"swap/trace/currentTrack":1},post:{"swap/trace/closeTrackOrder":1,"swap/trace/setTPSL":1,"spot/trader/sellOrder":1}}}},api:{v3:{private:{get:{"asset/transfer":1,"capital/deposit/hisrec":1,"capital/withdraw/history":1},post:{"post/asset/transfer":1}}}}},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},precisionMode:n.nr,exceptions:{exact:{400:r.BadRequest,401:r.AuthenticationError,403:r.PermissionDenied,404:r.BadRequest,429:r.DDoSProtection,418:r.PermissionDenied,500:r.ExchangeError,504:r.ExchangeError,100001:r.AuthenticationError,100412:r.AuthenticationError,100202:r.InsufficientFunds,100204:r.BadRequest,100400:r.BadRequest,100421:r.BadSymbol,100440:r.ExchangeError,100500:r.OperationFailed,100503:r.ExchangeError,80001:r.BadRequest,80012:r.InsufficientFunds,80014:r.BadRequest,80016:r.OrderNotFound,80017:r.OrderNotFound,100414:r.AccountSuspended,100419:r.PermissionDenied,100437:r.BadRequest,101204:r.InsufficientFunds},broad:{}},commonCurrencies:{SNOW:"Snowman"},options:{defaultType:"spot",accountsByType:{spot:"FUND",swap:"PFUTURES",future:"SFUTURES"},accountsById:{FUND:"spot",PFUTURES:"swap",SFUTURES:"future"},recvWindow:5e3,broker:"CCXT",defaultNetworks:{ETH:"ETH",USDT:"ERC20",USDC:"ERC20",BTC:"BTC",LTC:"LTC"}}})}async fetchTime(e={}){const t=await this.swapV2PublicGetServerTime(e),s=this.safeDict(t,"data");return this.safeInteger(s,"serverTime")}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;if(this.safeBool(this.options,"sandboxMode",!1))return;const t=await this.walletsV1PrivateGetCapitalConfigGetall(e),s=this.safeList(t,"data",[]),i={};for(let e=0;e0,i={type:s?"ACTIVATE":"CLOSE",timeOut:s?this.parseToInt(e/1e3):0};let a,o;if([o,t]=this.handleMarketTypeAndParams("cancelAllOrdersAfter",void 0,t),"spot"===o)a=await this.spotV1PrivatePostTradeCancelAllAfter(this.extend(i,t));else{if("swap"!==o)throw new r.NotSupported(this.id+" cancelAllOrdersAfter() is not supported for "+o+" markets");a=await this.swapV2PrivatePostTradeCancelAllAfter(this.extend(i,t))}return a}async fetchOrder(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");await this.loadMarkets();const i=this.market(t),a={symbol:i.id,orderId:e};let o;const[n,d]=this.handleMarketTypeAndParams("fetchOrder",i,s);o="spot"===n?await this.spotV1PrivateGetTradeQuery(this.extend(a,d)):await this.swapV2PrivateGetTradeOrder(this.extend(a,d));const h=this.safeValue(o,"data"),c=this.safeDict(h,"order",h);return this.parseOrder(c,i)}async fetchOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const a={};let o,n;if(void 0!==e&&(o=this.market(e),a.symbol=o.id),[n,i]=this.handleMarketTypeAndParams("fetchOrders",o,i),"swap"!==n)throw new r.NotSupported(this.id+" fetchOrders() is only supported for swap markets");void 0!==s&&(a.limit=s),void 0!==t&&(a.startTime=t);const d=this.safeInteger(i,"until"),h=this.safeInteger(i,"endTime",d);i=this.omit(i,["endTime","until"]),void 0!==h&&(a.endTime=h);const c=await this.swapV1PrivateGetTradeFullOrder(this.extend(a,i)),l=this.safeDict(c,"data",{}),u=this.safeList(l,"orders",[]);return this.parseOrders(u,o,t,s)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets();const a={};let o;void 0!==e&&(r=this.market(e),a.symbol=r.id);const[n,d]=this.handleMarketTypeAndParams("fetchOpenOrders",r,i);o="spot"===n?await this.spotV1PrivateGetTradeOpenOrders(this.extend(a,d)):await this.swapV2PrivateGetTradeOpenOrders(this.extend(a,d));const h=this.safeDict(o,"data",{}),c=this.safeList(h,"orders",[]);return this.parseOrders(c,r,t,s)}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchClosedOrders() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={symbol:a.id};let n,d;[d,i]=this.handleOptionAndParams(i,"fetchClosedOrders","standard",!1);const[h,c]=this.handleMarketTypeAndParams("fetchClosedOrders",a,i);n=d?await this.contractV1PrivateGetAllOrders(this.extend(o,c)):"spot"===h?await this.spotV1PrivateGetTradeHistoryOrders(this.extend(o,c)):await this.swapV2PrivateGetTradeAllOrders(this.extend(o,c));const l=this.safeValue(n,"data",[]),u=this.safeList(l,"orders",[]);return this.parseOrders(u,a,t,s)}async transfer(e,t,s,i,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeDict(this.options,"accountsByType",{}),n=this.safeString(o,s,s),d=this.safeString(o,i,i),h={asset:a.id,amount:this.currencyToPrecision(e,t),type:n+"_"+d},c=await this.spotV3PrivateGetGetAssetTransfer(this.extend(h,r));return{info:c,id:this.safeString(c,"tranId"),timestamp:void 0,datetime:void 0,currency:e,amount:t,fromAccount:s,toAccount:i,status:void 0}}async fetchTransfers(e=void 0,t=void 0,s=void 0,i={}){let a;await this.loadMarkets(),void 0!==e&&(a=this.currency(e));const o=this.safeDict(this.options,"accountsByType",{}),n=this.safeString(i,"fromAccount"),d=this.safeString(i,"toAccount"),h=this.safeString(o,n,n),c=this.safeString(o,d,d);if(void 0===h||void 0===c)throw new r.ExchangeError(this.id+" fromAccount & toAccount parameter are required");const l={type:h+"_"+c};void 0!==t&&(l.startTime=t),void 0!==s&&(l.size=s);const u=await this.spotV3PrivateGetAssetTransfer(this.extend(l,i)),p=this.safeList(u,"rows",[]);return this.parseTransfers(p,a,t,s)}parseTransfer(e,t=void 0){const s=this.safeString(e,"tranId"),i=this.safeInteger(e,"timestamp"),r=this.safeCurrencyCode(void 0,t),a=this.safeString(e,"status"),o=this.safeDict(this.options,"accountsById",{}),n=this.safeString(e,"type"),d=n.split("_"),h=this.safeString(d,0),c=this.safeString(n,1),l=this.safeString(o,h,h),u=this.safeString(o,c,c);return{info:e,id:s,timestamp:i,datetime:this.iso8601(i),currency:r,amount:this.safeNumber(e,"amount"),fromAccount:l,toAccount:u,status:a}}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();const s=this.currency(e),i=this.safeInteger(this.options,"recvWindow"),r=this.safeInteger(this.parseParams,"recvWindow",i),a={coin:s.id,offset:0,limit:1e3,recvWindow:r},o=await this.walletsV1PrivateGetCapitalDepositAddress(this.extend(a,t)),n=this.safeList(this.safeDict(o,"data"),"data"),d=this.parseDepositAddresses(n,[s.code],!1);return this.indexBy(d,"network")}async fetchDepositAddress(e,t={}){const s=this.safeString(t,"network");t=this.omit(t,["network"]);const i=await this.fetchDepositAddressesByNetwork(e,t);if(void 0!==s)return this.safeDict(i,s);{const t=this.safeDict(this.options,"defaultNetworks"),s=this.safeString(t,e);if(void 0!==s)return this.safeDict(i,s);{const e=Object.keys(i),t=this.safeString(e,0);return this.safeDict(i,t)}}}parseDepositAddress(e,t=void 0){const s=this.safeString(e,"address"),i=this.safeString(e,"tag"),r=this.safeString(e,"coin"),a=(t=this.safeCurrency(r,t)).code,o=this.safeString(e,"network");return this.checkAddress(s),{currency:a,address:s,tag:i,network:o,info:e}}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};let a;void 0!==e&&(a=this.currency(e),r.coin=a.id),void 0!==t&&(r.startTime=t),void 0!==s&&(r.limit=s);const o=await this.spotV3PrivateGetCapitalDepositHisrec(this.extend(r,i));return this.parseTransactions(o,a,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};let a;void 0!==e&&(a=this.currency(e),r.coin=a.id),void 0!==t&&(r.startTime=t),void 0!==s&&(r.limit=s);const o=await this.spotV3PrivateGetCapitalWithdrawHistory(this.extend(r,i));return this.parseTransactions(o,a,t,s)}parseTransaction(e,t=void 0){const s=this.safeValue(e,"data"),i=void 0===s?void 0:this.safeString(s,"id"),r=this.safeString(e,"id",i),a=this.safeString(e,"address"),o=this.safeString(e,"addressTag");let n=this.safeInteger(e,"insertTime"),d=this.iso8601(n);void 0===n&&(d=this.safeString(e,"applyTime"),n=this.parse8601(d));const h=this.safeString(e,"network"),c=this.safeString(e,"coin");let l=this.safeCurrencyCode(c,t);void 0!==l&&l!==h&&l.indexOf(h)>=0&&void 0!==h&&(l=l.replace(h,""));const u="0"===this.safeString(e,"transferType")?"deposit":"withdrawal";return{info:e,id:r,txid:this.safeString(e,"txId"),type:u,currency:l,network:this.networkIdToCode(h),amount:this.safeNumber(e,"amount"),status:this.parseTransactionStatus(this.safeString(e,"status")),timestamp:n,datetime:d,address:a,addressFrom:void 0,addressTo:a,tag:o,tagFrom:o,tagTo:void 0,updated:void 0,comment:this.safeString(e,"info"),fee:{currency:l,cost:this.safeNumber(e,"transactionFee"),rate:void 0},internal:void 0}}parseTransactionStatus(e){return this.safeString({0:"pending",1:"ok",10:"pending",20:"rejected",30:"ok",40:"rejected",50:"ok",60:"pending",70:"rejected",2:"pending",3:"rejected",4:"pending",5:"rejected",6:"ok"},e,e)}async setMarginMode(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");await this.loadMarkets();const i=this.market(t);if("swap"!==i.type)throw new r.BadSymbol(this.id+" setMarginMode() supports swap contracts only");if("CROSS"===(e=e.toUpperCase())&&(e="CROSSED"),"ISOLATED"!==e&&"CROSSED"!==e)throw new r.BadRequest(this.id+" setMarginMode() marginMode argument should be isolated or cross");const a={symbol:i.id,marginType:e};return await this.swapV2PrivatePostTradeMarginType(this.extend(a,s))}async addMargin(e,t,s={}){return await this.setMargin(e,t,this.extend({type:1},s))}async reduceMargin(e,t,s={}){return await this.setMargin(e,t,this.extend({type:2},s))}async setMargin(e,t,s={}){const i=this.safeInteger(s,"type");if(void 0===i)throw new r.ArgumentsRequired(this.id+" setMargin() requires a type parameter either 1 (increase margin) or 2 (decrease margin)");if(!this.inArray(i,[1,2]))throw new r.ArgumentsRequired(this.id+" setMargin() requires a type parameter either 1 (increase margin) or 2 (decrease margin)");await this.loadMarkets();const a=this.market(e),o={symbol:a.id,amount:this.amountToPrecision(a.symbol,t),type:i},n=await this.swapV2PrivatePostTradePositionMargin(this.extend(o,s));return this.parseMarginModification(n,a)}parseMarginModification(e,t=void 0){const s=this.safeString(e,"type");return{info:e,symbol:this.safeString(t,"symbol"),type:"1"===s?"add":"reduce",marginMode:"isolated",amount:this.safeNumber(e,"amount"),total:this.safeNumber(e,"margin"),code:this.safeString(t,"settle"),status:void 0,timestamp:void 0,datetime:void 0}}async fetchLeverage(e,t={}){await this.loadMarkets();const s=this.market(e),i={symbol:s.id},r=await this.swapV2PrivateGetTradeLeverage(this.extend(i,t)),a=this.safeDict(r,"data",{});return this.parseLeverage(a,s)}parseLeverage(e,t=void 0){const s=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(s,t),marginMode:void 0,longLeverage:this.safeInteger(e,"longLeverage"),shortLeverage:this.safeInteger(e,"shortLeverage")}}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");const i=this.safeStringUpper(s,"side");this.checkRequiredArgument("setLeverage",i,"side",["LONG","SHORT","BOTH"]),await this.loadMarkets();const a={symbol:this.market(t).id,side:i,leverage:e};return await this.swapV2PrivatePostTradeLeverage(this.extend(a,s))}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o=this.milliseconds();let n;const d={symbol:a.id};if(void 0!==t){d[a.spot?"startTime":"startTs"]=t}else a.swap&&(d.startTs=o-7776e6);const h=this.safeInteger(i,"until");if(i=this.omit(i,"until"),void 0!==h){d[a.spot?"endTime":"endTs"]=h}else a.swap&&(d.endTs=o);let c;if(a.spot){n=await this.spotV1PrivateGetTradeMyTrades(this.extend(d,i));const e=this.safeDict(n,"data",{});c=this.safeList(e,"fills",[])}else{const e=this.safeStringUpper(i,"tradingUnit","CONT");i=this.omit(i,"tradingUnit"),d.tradingUnit=e,n=await this.swapV2PrivateGetTradeAllFillOrders(this.extend(d,i));const t=this.safeDict(n,"data",{});c=this.safeList(t,"fill_orders",[])}return this.parseTrades(c,a,t,s,i)}parseDepositWithdrawFee(e,t=void 0){const s=this.safeList(e,"networkList",[]),i=s.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};if(0!==i)for(let e=0;e0&&(e+=","),e+=r[t].toString()}e+="]",t[i]=e}}return t}async fetchMyLiquidations(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r,a={autoCloseType:"LIQUIDATION"};[a,i]=this.handleUntilOption("endTime",a,i),void 0!==e&&(r=this.market(e),a.symbol=r.id),void 0!==t&&(a.startTime=t),void 0!==s&&(a.limit=s);const o=await this.swapV2PrivateGetTradeForceOrders(this.extend(a,i)),n=this.safeDict(o,"data",{}),d=this.safeList(n,"orders",[]);return this.parseLiquidations(d,r,t,s)}parseLiquidation(e,t=void 0){const s=this.safeString(e,"symbol"),i=this.safeInteger(e,"time"),r=this.safeString(e,"executedQty"),o=this.safeString(t,"contractSize"),n=this.safeString(e,"avgPrice"),d=a.O.stringMul(r,o),h=a.O.stringMul(d,n);return this.safeLiquidation({info:e,symbol:this.safeSymbol(s,t),contracts:this.parseNumber(r),contractSize:this.parseNumber(o),price:this.parseNumber(n),baseValue:this.parseNumber(d),quoteValue:this.parseNumber(h),timestamp:i,datetime:this.iso8601(i)})}async closePosition(e,t=void 0,s={}){await this.loadMarkets();const i=this.safeString(s,"positionId");let r;if(s=this.omit(s,"positionId"),void 0!==i){const e={positionId:i};r=await this.swapV1PrivatePostTradeClosePosition(this.extend(e,s))}else{const t={symbol:this.market(e).id};r=await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(t,s))}const a=this.safeDict(r,"data");return this.parseOrder(a)}async closeAllPositions(e={}){await this.loadMarkets();const t=this.safeInteger(this.options,"recvWindow"),s=this.safeInteger(this.parseParams,"recvWindow",t);let i;if([i,e]=this.handleMarketTypeAndParams("closeAllPositions",void 0,e),"margin"===i)throw new r.BadRequest(this.id+" closePositions () cannot be used for "+i+" markets");const a={recvWindow:s},o=await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(a,e)),n=this.safeDict(o,"data",{}),d=this.safeList(n,"success",[]),h=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(3108),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bit2c",name:"Bit2C",countries:["IL"],rateLimit:3e3,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,ws:!1},urls:{logo:"https://user-images.githubusercontent.com/1294454/27766119-3593220e-5ece-11e7-8b3a-5a041f6bcc3f.jpg",api:{rest:"https://bit2c.co.il"},www:"https://www.bit2c.co.il",referral:"https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf",doc:["https://www.bit2c.co.il/home/api","https://github.com/OferE/bit2c"]},api:{public:{get:["Exchanges/{pair}/Ticker","Exchanges/{pair}/orderbook","Exchanges/{pair}/trades","Exchanges/{pair}/lasttrades"]},private:{post:["Merchant/CreateCheckout","Funds/AddCoinFundsRequest","Order/AddFund","Order/AddOrder","Order/GetById","Order/AddOrderMarketPriceBuy","Order/AddOrderMarketPriceSell","Order/CancelOrder","Order/AddCoinFundsRequest","Order/AddStopOrder","Payment/GetMyId","Payment/Send","Payment/Pay"],get:["Account/Balance","Account/Balance/v2","Order/MyOrders","Order/GetById","Order/AccountHistory","Order/OrderHistory"]}},markets:{"BTC/NIS":this.safeMarketStructure({id:"BtcNis",symbol:"BTC/NIS",base:"BTC",quote:"NIS",baseId:"Btc",quoteId:"Nis",type:"spot",spot:!0}),"ETH/NIS":this.safeMarketStructure({id:"EthNis",symbol:"ETH/NIS",base:"ETH",quote:"NIS",baseId:"Eth",quoteId:"Nis",type:"spot",spot:!0}),"LTC/NIS":this.safeMarketStructure({id:"LtcNis",symbol:"LTC/NIS",base:"LTC",quote:"NIS",baseId:"Ltc",quoteId:"Nis",type:"spot",spot:!0}),"USDC/NIS":this.safeMarketStructure({id:"UsdcNis",symbol:"USDC/NIS",base:"USDC",quote:"NIS",baseId:"Usdc",quoteId:"Nis",type:"spot",spot:!0})},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.025"),taker:this.parseNumber("0.03"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.03")],[this.parseNumber("20000"),this.parseNumber("0.0275")],[this.parseNumber("50000"),this.parseNumber("0.025")],[this.parseNumber("75000"),this.parseNumber("0.0225")],[this.parseNumber("100000"),this.parseNumber("0.02")],[this.parseNumber("250000"),this.parseNumber("0.015")],[this.parseNumber("500000"),this.parseNumber("0.0125")],[this.parseNumber("750000"),this.parseNumber("0.01")],[this.parseNumber("1000000"),this.parseNumber("0.008")],[this.parseNumber("2000000"),this.parseNumber("0.006")],[this.parseNumber("3000000"),this.parseNumber("0.004")],[this.parseNumber("4000000"),this.parseNumber("0.002")]],maker:[[this.parseNumber("0"),this.parseNumber("0.025")],[this.parseNumber("20000"),this.parseNumber("0.0225")],[this.parseNumber("50000"),this.parseNumber("0.02")],[this.parseNumber("75000"),this.parseNumber("0.0175")],[this.parseNumber("100000"),this.parseNumber("0.015")],[this.parseNumber("250000"),this.parseNumber("0.01")],[this.parseNumber("500000"),this.parseNumber("0.0075")],[this.parseNumber("750000"),this.parseNumber("0.005")],[this.parseNumber("1000000"),this.parseNumber("0.004")],[this.parseNumber("2000000"),this.parseNumber("0.003")],[this.parseNumber("3000000"),this.parseNumber("0.002")],[this.parseNumber("4000000"),this.parseNumber("0.001")]]}}},options:{fetchTradesMethod:"public_get_exchanges_pair_trades"},precisionMode:o.sh,exceptions:{exact:{"Please provide valid APIkey":r.AuthenticationError,"No order found.":r.OrderNotFound},broad:{"Please provide valid nonce":r.InvalidNonce,"please approve new terms of use on site":r.PermissionDenied}}})}parseBalance(e){const t={info:e,timestamp:void 0,datetime:void 0},s=Object.keys(this.currencies);for(let i=0;i{s.d(t,{Z:()=>n});var i=s(1868),r=s(6689),a=s(9292),o=s(1372);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitbank",name:"bitbank",countries:["JP"],version:"v1",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1hour","4h":"4hour","8h":"8hour","12h":"12hour","1d":"1day","1w":"1week"},hostname:"bitbank.cc",urls:{logo:"https://user-images.githubusercontent.com/1294454/37808081-b87f2d9c-2e59-11e8-894d-c1900b7584fe.jpg",api:{public:"https://public.{hostname}",private:"https://api.{hostname}",markets:"https://api.{hostname}"},www:"https://bitbank.cc/",doc:"https://docs.bitbank.cc/",fees:"https://bitbank.cc/docs/fees/"},api:{public:{get:["{pair}/ticker","tickers","tickers_jpy","{pair}/depth","{pair}/transactions","{pair}/transactions/{yyyymmdd}","{pair}/candlestick/{candletype}/{yyyymmdd}","{pair}/circuit_break_info"]},private:{get:["user/assets","user/spot/order","user/spot/active_orders","user/spot/trade_history","user/deposit_history","user/withdrawal_account","user/withdrawal_history","spot/status","spot/pairs"],post:["user/spot/order","user/spot/cancel_order","user/spot/cancel_orders","user/spot/orders_info","user/request_withdrawal"]},markets:{get:["spot/pairs"]}},precisionMode:a.sh,exceptions:{exact:{20001:r.AuthenticationError,20002:r.AuthenticationError,20003:r.AuthenticationError,20005:r.AuthenticationError,20004:r.InvalidNonce,40020:r.InvalidOrder,40021:r.InvalidOrder,40025:r.ExchangeError,40013:r.OrderNotFound,40014:r.OrderNotFound,50008:r.PermissionDenied,50009:r.OrderNotFound,50010:r.OrderNotFound,60001:r.InsufficientFunds,60005:r.InvalidOrder}}})}async fetchMarkets(e={}){const t=await this.marketsGetSpotPairs(e),s=this.safeValue(t,"data"),i=this.safeValue(s,"pairs",[]);return this.parseMarkets(i)}parseMarket(e){const t=this.safeString(e,"name"),s=this.safeString(e,"base_asset"),i=this.safeString(e,"quote_asset"),r=this.safeCurrencyCode(s),a=this.safeCurrencyCode(i);return{id:t,symbol:r+"/"+a,base:r,quote:a,settle:void 0,baseId:s,quoteId:i,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:this.safeValue(e,"is_enabled"),contract:!1,linear:void 0,inverse:void 0,taker:this.safeNumber(e,"taker_fee_rate_quote"),maker:this.safeNumber(e,"maker_fee_rate_quote"),contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"amount_digits"))),price:this.parseNumber(this.parsePrecision(this.safeString(e,"price_digits")))},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.safeNumber(e,"unit_amount"),max:this.safeNumber(e,"limit_max_amount")},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e}}parseTicker(e,t=void 0){const s=this.safeSymbol(void 0,t),i=this.safeInteger(e,"timestamp"),r=this.safeString(e,"last");return this.safeTicker({symbol:s,timestamp:i,datetime:this.iso8601(i),high:this.safeString(e,"high"),low:this.safeString(e,"low"),bid:this.safeString(e,"buy"),bidVolume:void 0,ask:this.safeString(e,"sell"),askVolume:void 0,vwap:void 0,open:void 0,close:r,last:r,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:this.safeString(e,"vol"),quoteVolume:void 0,info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e),i={pair:s.id},r=await this.publicGetPairTicker(this.extend(i,t)),a=this.safeDict(r,"data",{});return this.parseTicker(a,s)}async fetchOrderBook(e,t=void 0,s={}){await this.loadMarkets();const i=this.market(e),r={pair:i.id},a=await this.publicGetPairDepth(this.extend(r,s)),o=this.safeValue(a,"data",{}),n=this.safeInteger(o,"timestamp");return this.parseOrderBook(o,i.symbol,n)}parseTrade(e,t=void 0){const s=this.safeInteger(e,"executed_at");t=this.safeMarket(void 0,t);const i=this.safeString(e,"price"),r=this.safeString(e,"amount"),a=this.safeString2(e,"transaction_id","trade_id"),o=this.safeString(e,"maker_taker");let n;const d=this.safeString(e,"fee_amount_quote");void 0!==d&&(n={currency:t.quote,cost:d});const h=this.safeString(e,"order_id"),c=this.safeString(e,"type"),l=this.safeString(e,"side");return this.safeTrade({timestamp:s,datetime:this.iso8601(s),symbol:t.symbol,id:a,order:h,type:c,side:l,takerOrMaker:o,price:i,amount:r,cost:void 0,fee:n,info:e},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.market(e),a={pair:r.id},o=await this.publicGetPairTransactions(this.extend(a,i)),n=this.safeValue(o,"data",{}),d=this.safeList(n,"transactions",[]);return this.parseTrades(d,r,t,s)}async fetchTradingFees(e={}){await this.loadMarkets();const t=await this.marketsGetSpotPairs(e),s=this.safeValue(t,"data",{}),i=this.safeValue(s,"pairs",[]),r={};for(let e=0;e{s.d(t,{Z:()=>r});var i=s(5140);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitbay",name:"BitBay",alias:!0})}}},7790:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(657),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitbns",name:"Bitbns",countries:["IN"],rateLimit:1e3,certified:!1,version:"v2",has:{CORS:void 0,spot:!0,margin:void 0,swap:!1,future:!1,option:void 0,cancelAllOrders:!1,cancelOrder:!0,createOrder:!0,fetchBalance:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPositionMode:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:"emulated",fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,transfer:!1,withdraw:!1},hostname:"bitbns.com",urls:{logo:"https://user-images.githubusercontent.com/1294454/117201933-e7a6e780-adf5-11eb-9d80-98fc2a21c3d6.jpg",api:{www:"https://{hostname}",v1:"https://api.{hostname}/api/trade/v1",v2:"https://api.{hostname}/api/trade/v2"},www:"https://bitbns.com",referral:"https://ref.bitbns.com/1090961",doc:["https://bitbns.com/trade/#/api-trading/"],fees:"https://bitbns.com/fees"},api:{www:{get:["order/fetchMarkets","order/fetchTickers","order/fetchOrderbook","order/getTickerWithVolume","exchangeData/ohlc","exchangeData/orderBook","exchangeData/tradedetails"]},v1:{get:["platform/status","tickers","orderbook/sell/{symbol}","orderbook/buy/{symbol}"],post:["currentCoinBalance/EVERYTHING","getApiUsageStatus/USAGE","getOrderSocketToken/USAGE","currentCoinBalance/{symbol}","orderStatus/{symbol}","depositHistory/{symbol}","withdrawHistory/{symbol}","withdrawHistoryAll/{symbol}","depositHistoryAll/{symbol}","listOpenOrders/{symbol}","listOpenStopOrders/{symbol}","getCoinAddress/{symbol}","placeSellOrder/{symbol}","placeBuyOrder/{symbol}","buyStopLoss/{symbol}","sellStopLoss/{symbol}","cancelOrder/{symbol}","cancelStopLossOrder/{symbol}","listExecutedOrders/{symbol}","placeMarketOrder/{symbol}","placeMarketOrderQnty/{symbol}"]},v2:{post:["orders","cancel","getordersnew","marginOrders"]}},fees:{trading:{feeSide:"quote",tierBased:!1,percentage:!0,taker:this.parseNumber("0.0025"),maker:this.parseNumber("0.0025")}},precisionMode:o.sh,exceptions:{exact:{400:r.BadRequest,409:r.BadSymbol,416:r.InsufficientFunds,417:r.OrderNotFound},broad:{}}})}async fetchStatus(e={}){const t=await this.v1GetPlatformStatus(e),s=this.safeString(t,"status");return{status:this.safeString({1:"ok"},s,s),updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){const t=await this.wwwGetOrderFetchMarkets(e),s=[];for(let e=0;e1){let e=this.safeString(a,1);const r=this.account();r.free=this.safeString(i,t),r.used=this.safeString(i,"inorder"+e),"Money"===e&&(e="INR");s[this.safeCurrencyCode(e)]=r}}return this.safeBalance(s)}async fetchBalance(e={}){await this.loadMarkets();const t=await this.v1PostCurrentCoinBalanceEVERYTHING(e);return this.parseBalance(t)}parseStatus(e){return this.safeString({"-1":"cancelled",0:"open",1:"open",2:"done"},e,e)}parseOrder(e,t=void 0){const s=this.safeString2(e,"id","entry_id"),i=this.safeString(e,"time"),r=this.safeString(e,"t_rate");let a=this.safeString(e,"type");"0"===a?a="buy":"1"===a&&(a="sell");const o=this.safeString(e,"data");let n=this.safeString(e,"status");return n="Successfully cancelled the order"===o?"cancelled":this.parseStatus(n),this.safeOrder({info:e,id:s,clientOrderId:void 0,timestamp:this.parse8601(i),datetime:i,lastTradeTimestamp:void 0,symbol:this.safeString(t,"symbol"),timeInForce:void 0,postOnly:void 0,side:a,price:this.safeString(e,"rate"),stopPrice:r,triggerPrice:r,amount:this.safeString(e,"btc"),cost:void 0,average:void 0,filled:void 0,remaining:void 0,status:n,fee:{cost:void 0,currency:void 0,rate:void 0},trades:void 0},t)}async createOrder(e,t,s,i,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.safeStringN(a,["triggerPrice","stopPrice","t_rate"]),d=this.safeString(a,"target_rate"),h=this.safeString(a,"trail_rate");a=this.omit(a,["triggerPrice","stopPrice","trail_rate","target_rate","t_rate"]);const c={side:s.toUpperCase(),symbol:o.uppercaseId,quantity:this.amountToPrecision(e,i)};let l="v2PostOrders";"limit"===t?c.rate=this.priceToPrecision(e,r):(l="v1PostPlaceMarketOrderQntySymbol",c.market=o.quoteId),void 0!==n&&(c.t_rate=this.priceToPrecision(e,n)),void 0!==d&&(c.target_rate=this.priceToPrecision(e,d)),void 0!==h&&(c.trail_rate=this.priceToPrecision(e,h));const u=await this[l](this.extend(c,a));return this.parseOrder(u,o)}async cancelOrder(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");await this.loadMarkets();const i=this.market(t),a=this.safeValue2(s,"trigger","stop");s=this.omit(s,["trigger","stop"]);const o={entry_id:e,symbol:i.uppercaseId};let n;const d=a?"StopLossOrder":"Order";let h="USDT"===i.quoteId?"usdtcancel":"cancel";return h+=d,o.side=h,n=await this.v2PostCancel(this.extend(o,s)),this.parseOrder(n,i)}async fetchOrder(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");await this.loadMarkets();const i=this.market(t),a={symbol:i.id,entry_id:e};if(this.safeValue2(s,"trigger","stop"))throw new r.BadRequest(this.id+" fetchOrder cannot fetch stop orders");const o=await this.v1PostOrderStatusSymbol(this.extend(a,s)),n=this.safeValue(o,"data",[]),d=this.safeDict(n,0);return this.parseOrder(d,i)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchOpenOrders() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o=this.safeValue2(i,"trigger","stop");i=this.omit(i,["trigger","stop"]);const n="USDT"===a.quoteId?"usdtListOpen":"listOpen",d={symbol:a.uppercaseId,page:0,side:o?n+"StopOrders":n+"Orders"},h=await this.v2PostGetordersnew(this.extend(d,i)),c=this.safeList(h,"data",[]);return this.parseOrders(c,a,t,s)}parseTrade(e,t=void 0){t=this.safeMarket(void 0,t);const s=this.safeString2(e,"id","tradeId");let i=this.parse8601(this.safeString(e,"date"));i=this.safeInteger(e,"timestamp",i);const r=this.safeString2(e,"rate","price");let o=this.safeString(e,"amount"),n=this.safeStringLower(e,"type");void 0!==n&&(n.indexOf("buy")>=0?n="buy":n.indexOf("sell")>=0&&(n="sell"));const d=this.safeString(e,"factor");let h;void 0!==d?o=a.O.stringDiv(o,d):(o=this.safeString(e,"base_volume"),h=this.safeString(e,"quote_volume"));const c=t.symbol;let l;const u=this.safeString(e,"fee");if(void 0!==u){l={cost:u,currency:t.quote}}return this.safeTrade({info:e,timestamp:i,datetime:this.iso8601(i),symbol:c,id:s,order:s,type:void 0,side:n,takerOrMaker:void 0,price:r,amount:o,cost:h,fee:l},t)}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={symbol:a.id,page:0};void 0!==t&&(o.since=this.iso8601(t));const n=await this.v1PostListExecutedOrdersSymbol(this.extend(o,i)),d=this.safeList(n,"data",[]);return this.parseTrades(d,a,t,s)}async fetchTrades(e,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchTrades() requires a symbol argument");await this.loadMarkets();const a=this.market(e),o={coin:a.baseId,market:a.quoteId},n=await this.wwwGetExchangeDataTradedetails(this.extend(o,i));return this.parseTrades(n,a,t,s)}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchDeposits() requires a currency code argument");await this.loadMarkets();const a=this.currency(e),o={symbol:a.id,page:0},n=await this.v1PostDepositHistorySymbol(this.extend(o,i)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchWithdrawals() requires a currency code argument");await this.loadMarkets();const a=this.currency(e),o={symbol:a.id,page:0},n=await this.v1PostWithdrawHistorySymbol(this.extend(o,i)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,s)}parseTransactionStatusByType(e,t=void 0){const s=this.safeValue({deposit:{0:"pending",1:"ok"},withdrawal:{0:"pending",1:"canceled",2:"pending",3:"failed",4:"pending",5:"failed",6:"ok"}},t,{});return this.safeString(s,e,e)}parseTransaction(e,t=void 0){const s=this.safeString(e,"unit"),i=this.safeCurrencyCode(s,t),r=this.parse8601(this.safeString2(e,"date","timestamp"));let a=this.safeString(e,"type");const o=this.safeString(e,"expTime","");let n;void 0!==a&&(a.indexOf("deposit")>=0?(a="deposit",n="ok"):(a.indexOf("withdraw")>=0||o.indexOf("withdraw")>=0)&&(a="withdrawal"));const d=this.safeNumber(e,"amount"),h=this.safeNumber(e,"fee");let c;return void 0!==h&&(c={currency:i,cost:h}),{info:e,id:void 0,txid:void 0,timestamp:r,datetime:this.iso8601(r),network:void 0,address:void 0,addressTo:void 0,addressFrom:void 0,tag:void 0,tagTo:void 0,tagFrom:void 0,type:a,amount:d,currency:i,status:n,updated:void 0,comment:void 0,internal:void 0,fee:c}}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s={symbol:this.currency(e).id},i=await this.v1PostGetCoinAddressSymbol(this.extend(s,t)),r=this.safeValue(i,"data",{}),a=this.safeString(r,"token"),o=this.safeString(r,"tag");return this.checkAddress(a),{currency:e,address:a,tag:o,network:void 0,info:i}}nonce(){return this.milliseconds()}sign(e,t="www",s="GET",i={},a=void 0,o=void 0){if(!(t in this.urls.api))throw new r.ExchangeError(this.id+" does not have a testnet/sandbox URL for "+t+" endpoints");"www"!==t&&(this.checkRequiredCredentials(),a={"X-BITBNS-APIKEY":this.apiKey});let d=this.implodeHostname(this.urls.api[t])+"/"+this.implodeParams(e,i);const h=this.omit(i,this.extractParams(e)),c=this.nonce().toString();if("GET"===s)Object.keys(h).length&&(d+="?"+this.urlencode(h));else if("POST"===s){const e={timeStamp_nonce:c,body:o=Object.keys(h).length?this.json(h):"{}"},t=this.stringToBase64(this.json(e)),s=this.hmac(this.encode(t),this.encode(this.secret),n.o);a["X-BITBNS-PAYLOAD"]=t,a["X-BITBNS-SIGNATURE"]=s,a["Content-Type"]="application/x-www-form-urlencoded"}return{url:d,method:s,body:o,headers:a}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code"),l=this.safeString(n,"msg");if(void 0!==c&&"200"!==c&&"204"!==c||void 0!==l){const e=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,c,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e),this.throwBroadlyMatchedException(this.exceptions.broad,l,e),new r.ExchangeError(e)}}}},1819:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(5788);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitcoincom",name:"Bitcoin.com",alias:!0})}}},6537:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(4928),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitfinex",name:"Bitfinex",countries:["VG"],version:"v1",rateLimit:666.666,pro:!0,has:{CORS:void 0,spot:!0,margin:void 0,swap:void 0,future:void 0,option:void 0,cancelAllOrders:!0,cancelOrder:!0,createDepositAddress:!0,createOrder:!0,editOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchDepositAddress:!0,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchIndexOHLCV:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:!0,fetchTransactions:"emulated",transfer:!0,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","3h":"3h","4h":"4h","6h":"6h","12h":"12h","1d":"1D","1w":"7D","2w":"14D","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/27766244-e328a50c-5ed2-11e7-947b-041416579bb3.jpg",api:{v2:"https://api-pub.bitfinex.com",public:"https://api.bitfinex.com",private:"https://api.bitfinex.com"},www:"https://www.bitfinex.com",referral:"https://www.bitfinex.com/?refcode=P61eYxFL",doc:["https://docs.bitfinex.com/v1/docs","https://github.com/bitfinexcom/bitfinex-api-node"]},api:{v2:{get:{"platform/status":3,tickers:1,"ticker/{symbol}":1,"tickers/hist":1,"trades/{symbol}/hist":1,"book/{symbol}/{precision}":.375,"book/{symbol}/P0":.375,"book/{symbol}/P1":.375,"book/{symbol}/P2":.375,"book/{symbol}/P3":.375,"book/{symbol}/R0":.375,"stats1/{key}:{size}:{symbol}:{side}/{section}":1,"stats1/{key}:{size}:{symbol}/{section}":1,"stats1/{key}:{size}:{symbol}:long/last":1,"stats1/{key}:{size}:{symbol}:long/hist":1,"stats1/{key}:{size}:{symbol}:short/last":1,"stats1/{key}:{size}:{symbol}:short/hist":1,"candles/trade:{timeframe}:{symbol}/{section}":1,"candles/trade:{timeframe}:{symbol}/last":1,"candles/trade:{timeframe}:{symbol}/hist":1}},public:{get:{"book/{symbol}":1,"lendbook/{currency}":6,"lends/{currency}":3,"pubticker/{symbol}":3,"stats/{symbol}":6,symbols:18,symbols_details:18,tickers:1,"trades/{symbol}":3}},private:{post:{account_fees:18,account_infos:6,balances:9.036,basket_manage:6,credits:6,"deposit/new":18,"funding/close":6,history:6,"history/movements":6,key_info:6,margin_infos:3,mytrades:3,mytrades_funding:6,"offer/cancel":6,"offer/new":6,"offer/status":6,offers:6,"offers/hist":90.03,"order/cancel":.2,"order/cancel/all":.2,"order/cancel/multi":.2,"order/cancel/replace":.2,"order/new":.2,"order/new/multi":.2,"order/status":.2,orders:.2,"orders/hist":90.03,"position/claim":18,"position/close":18,positions:18,summary:18,taken_funds:6,total_taken_funds:6,transfer:18,unused_taken_funds:6,withdraw:18}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,maker:this.parseNumber("0.001"),taker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.002")],[this.parseNumber("2500000"),this.parseNumber("0.002")],[this.parseNumber("5000000"),this.parseNumber("0.002")],[this.parseNumber("7500000"),this.parseNumber("0.002")],[this.parseNumber("10000000"),this.parseNumber("0.0018")],[this.parseNumber("15000000"),this.parseNumber("0.0016")],[this.parseNumber("20000000"),this.parseNumber("0.0014")],[this.parseNumber("25000000"),this.parseNumber("0.0012")],[this.parseNumber("30000000"),this.parseNumber("0.001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("500000"),this.parseNumber("0.0008")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0002")],[this.parseNumber("7500000"),this.parseNumber("0")],[this.parseNumber("10000000"),this.parseNumber("0")],[this.parseNumber("15000000"),this.parseNumber("0")],[this.parseNumber("20000000"),this.parseNumber("0")],[this.parseNumber("25000000"),this.parseNumber("0")],[this.parseNumber("30000000"),this.parseNumber("0")]]}},funding:{tierBased:!1,percentage:!1,deposit:{},withdraw:{}}},commonCurrencies:{ALG:"ALGO",AMP:"AMPL",ATO:"ATOM",BCHABC:"XEC",BCHN:"BCH",DAT:"DATA",DOG:"MDOGE",DSH:"DASH",EDO:"PNT",EUS:"EURS",EUT:"EURT",IDX:"ID",IOT:"IOTA",IQX:"IQ",LUNA:"LUNC",LUNA2:"LUNA",MNA:"MANA",ORS:"ORS Group",PAS:"PASS",QSH:"QASH",QTM:"QTUM",RBT:"RBTC",SNG:"SNGLS",STJ:"STORJ",TERRAUST:"USTC",TSD:"TUSD",YGG:"YEED",YYW:"YOYOW",UDC:"USDC",UST:"USDT",VSY:"VSYS",WAX:"WAXP",XCH:"XCHF",ZBT:"ZB"},exceptions:{exact:{temporarily_unavailable:r.ExchangeNotAvailable,"Order could not be cancelled.":r.OrderNotFound,"No such order found.":r.OrderNotFound,"Order price must be positive.":r.InvalidOrder,"Could not find a key matching the given X-BFX-APIKEY.":r.AuthenticationError,'Key price should be a decimal number, e.g. "123.456"':r.InvalidOrder,'Key amount should be a decimal number, e.g. "123.456"':r.InvalidOrder,ERR_RATE_LIMIT:r.RateLimitExceeded,Ratelimit:r.RateLimitExceeded,"Nonce is too small.":r.InvalidNonce,"No summary found.":r.ExchangeError,"Cannot evaluate your available balance, please try again":r.ExchangeNotAvailable,"Unknown symbol":r.BadSymbol,"Cannot complete transfer. Exchange balance insufficient.":r.InsufficientFunds,"Momentary balance check. Please wait few seconds and try the transfer again.":r.ExchangeError},broad:{"Invalid X-BFX-SIGNATURE":r.AuthenticationError,"This API key does not have permission":r.PermissionDenied,"not enough exchange balance for ":r.InsufficientFunds,"minimum size for ":r.InvalidOrder,"Invalid order":r.InvalidOrder,"The available balance is only":r.InsufficientFunds}},precisionMode:o.tV,options:{currencyNames:{AGI:"agi",AID:"aid",AIO:"aio",ANT:"ant",AVT:"aventus",BAT:"bat",BCH:"bab",BCI:"bci",BFT:"bft",BSV:"bsv",BTC:"bitcoin",BTG:"bgold",CFI:"cfi",COMP:"comp",DAI:"dai",DADI:"dad",DASH:"dash",DATA:"datacoin",DTH:"dth",EDO:"eidoo",ELF:"elf",EOS:"eos",ETC:"ethereumc",ETH:"ethereum",ETP:"metaverse",FUN:"fun",GNT:"golem",IOST:"ios",IOTA:"iota",LEO:"let",LINK:"link",LRC:"lrc",LTC:"litecoin",LYM:"lym",MANA:"mna",MIT:"mit",MKR:"mkr",MTN:"mtn",NEO:"neo",ODE:"ode",OMG:"omisego",OMNI:"mastercoin",QASH:"qash",QTUM:"qtum",RCN:"rcn",RDN:"rdn",REP:"rep",REQ:"req",RLC:"rlc",SAN:"santiment",SNGLS:"sng",SNT:"status",SPANK:"spk",STORJ:"stj",TNB:"tnb",TRX:"trx",TUSD:"tsd",USD:"wire",USDC:"udc",UTK:"utk",USDT:"tetheruso",VEE:"vee",WAX:"wax",XLM:"xlm",XMR:"monero",XRP:"ripple",XVG:"xvg",YOYOW:"yoyow",ZEC:"zcash",ZRX:"zrx",XTZ:"xtz"},orderTypes:{limit:"exchange limit",market:"exchange market"},fiat:{USD:"USD",EUR:"EUR",JPY:"JPY",GBP:"GBP",CNH:"CNH"},accountsByType:{spot:"exchange",margin:"trading",funding:"deposit",swap:"trading"}}})}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const s={},i=await this.privatePostAccountFees(t),r=this.safeValue(i,"withdraw"),a=Object.keys(r);for(let t=0;t=0){const e=n.split(":");a=e[0],o=e[1]}else a=n.slice(0,3),o=n.slice(3,6);const d=this.safeCurrencyCode(a),h=this.safeCurrencyCode(o),c=d+"/"+h;let l="spot";n.indexOf("F0")>-1&&(l="swap"),i.push({id:n,symbol:c,base:d,quote:h,settle:void 0,baseId:a,quoteId:o,settleId:void 0,type:l,spot:"spot"===l,margin:this.safeValue(r,"margin"),swap:"swap"===l,future:!1,option:!1,active:!0,contract:"swap"===l,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:parseInt("8"),price:this.safeInteger(r,"price_precision")},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.safeNumber(r,"minimum_order_size"),max:this.safeNumber(r,"maximum_order_size")},price:{min:this.parseNumber("1e-8"),max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:r})}return i}amountToPrecision(e,t){return e=this.safeSymbol(e),this.decimalToPrecision(t,o.tk,this.markets[e].precision.amount,o.nr)}priceToPrecision(e,t){return e=this.safeSymbol(e),t=this.decimalToPrecision(t,o.oU,this.markets[e].precision.price,this.precisionMode),this.decimalToPrecision(t,o.tk,8,o.nr)}async fetchBalance(e={}){await this.loadMarkets();const t=this.safeValue(this.options,"accountsByType",{}),s=this.safeString(e,"type","exchange"),i=this.safeString(t,s,s);if(void 0===i){const e=Object.keys(t);throw new r.ExchangeError(this.id+" fetchBalance() type parameter must be one of "+e.join(", "))}const a=this.omit(e,"type"),o=await this.privatePostBalances(a),n={info:o},d="derivatives"===s;for(let e=0;e-1?d.price=this.nonce().toString():d.price=this.priceToPrecision(e,r),n&&(d.is_postonly=!0);const h=await this.privatePostOrderNew(this.extend(d,a));return this.parseOrder(h,o)}async editOrder(e,t,s,i,r=void 0,a=void 0,o={}){await this.loadMarkets();const n={order_id:parseInt(e)};void 0!==a&&(n.price=this.priceToPrecision(t,a)),void 0!==r&&(n.amount=this.numberToString(r)),void 0!==t&&(n.symbol=this.marketId(t)),void 0!==i&&(n.side=i),void 0!==s&&(n.type=this.safeString(this.options.orderTypes,s,s));const d=await this.privatePostOrderCancelReplace(this.extend(n,o));return this.parseOrder(d)}async cancelOrder(e,t=void 0,s={}){await this.loadMarkets();const i={order_id:parseInt(e)};return await this.privatePostOrderCancel(this.extend(i,s))}async cancelAllOrders(e=void 0,t={}){return await this.privatePostOrderCancelAll(t)}parseOrder(e,t=void 0){const s=this.safeString(e,"side"),i=this.safeValue(e,"is_live"),r=this.safeValue(e,"is_cancelled");let a;a=i?"open":r?"canceled":"closed";const o=this.safeStringUpper(e,"symbol"),n=this.safeSymbol(o,t);let d=this.safeString(e,"type","");if(d.indexOf("exchange ")>=0){d=e.type.split(" ")[1]}const h=this.safeTimestamp(e,"timestamp"),c=this.safeString(e,"id");return this.safeOrder({info:e,id:c,clientOrderId:void 0,timestamp:h,datetime:this.iso8601(h),lastTradeTimestamp:void 0,symbol:n,type:d,timeInForce:void 0,postOnly:void 0,side:s,price:this.safeString(e,"price"),stopPrice:void 0,triggerPrice:void 0,average:this.safeString(e,"avg_execution_price"),amount:this.safeString(e,"original_amount"),remaining:this.safeString(e,"remaining_amount"),filled:this.safeString(e,"executed_amount"),status:a,fee:void 0,cost:void 0,trades:void 0},t)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){if(await this.loadMarkets(),void 0!==e&&!(e in this.markets))throw new r.ExchangeError(this.id+" has no symbol "+e);const a=await this.privatePostOrders(i);let o=this.parseOrders(a,void 0,t,s);return void 0!==e&&(o=this.filterBy(o,"symbol",e)),o}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets(),e=this.symbol(e);const r={};void 0!==s&&(r.limit=s);const a=await this.privatePostOrdersHist(this.extend(r,i));let o=this.parseOrders(a,void 0,t,s);return void 0!==e&&(o=this.filterBy(o,"symbol",e)),o=this.filterByArray(o,"status",["closed","canceled"],!1),o}async fetchOrder(e,t=void 0,s={}){await this.loadMarkets();const i={order_id:parseInt(e)},r=await this.privatePostOrderStatus(this.extend(i,s));return this.parseOrder(r)}parseOHLCV(e,t=void 0){return[this.safeInteger(e,0),this.safeNumber(e,1),this.safeNumber(e,3),this.safeNumber(e,4),this.safeNumber(e,2),this.safeNumber(e,5)]}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,r={}){await this.loadMarkets(),i=void 0===i?100:Math.min(i,1e4);const a=this.market(e),o={symbol:"t"+a.id,timeframe:this.safeString(this.timeframes,t,t),sort:1,limit:i};void 0!==s&&(o.start=s);const n=await this.v2GetCandlesTradeTimeframeSymbolHist(this.extend(o,r));return this.parseOHLCVs(n,a,t,s,i)}getCurrencyName(e){if(e in this.options.currencyNames)return this.options.currencyNames[e];throw new r.NotSupported(this.id+" "+e+" not supported for withdrawal")}async createDepositAddress(e,t={}){await this.loadMarkets();return await this.fetchDepositAddress(e,this.extend({renew:1},t))}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s={method:this.getCurrencyName(e),wallet_name:"exchange",renew:0},i=await this.privatePostDepositNew(this.extend(s,t));let r,a=this.safeValue(i,"address");return"address_pool"in i&&(r=a,a=i.address_pool),this.checkAddress(a),{currency:e,address:a,tag:r,network:void 0,info:i}}async fetchDepositsWithdrawals(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let a=this.safeString(i,"currency");const o=this.omit(i,"currency");let n;if(void 0===a){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchDepositsWithdrawals() requires a currency `code` argument or a `currency` parameter");n=this.currency(e),a=n.id}o.currency=a,void 0!==t&&(o.since=this.parseToInt(t/1e3));const d=await this.privatePostHistoryMovements(this.extend(o,i));return this.parseTransactions(d,n,t,s)}parseTransaction(e,t=void 0){const s=this.safeTimestamp(e,"timestamp_created"),i=this.safeString(e,"currency"),r=this.safeCurrencyCode(i,t);let o=this.safeString(e,"fee");return void 0!==o&&(o=a.O.stringAbs(o)),{info:e,id:this.safeString2(e,"id","withdrawal_id"),txid:this.safeString(e,"txid"),type:this.safeStringLower(e,"type"),currency:r,network:void 0,amount:this.safeNumber(e,"amount"),status:this.parseTransactionStatus(this.safeString(e,"status")),timestamp:s,datetime:this.iso8601(s),address:this.safeString(e,"address"),addressFrom:void 0,addressTo:void 0,tag:this.safeString(e,"description"),tagFrom:void 0,tagTo:void 0,updated:this.safeTimestamp(e,"timestamp"),comment:void 0,internal:void 0,fee:{currency:r,cost:this.parseNumber(o),rate:void 0}}}parseTransactionStatus(e){return this.safeString({SENDING:"pending",CANCELED:"canceled",ZEROCONFIRMED:"failed",COMPLETED:"ok"},e,e)}async withdraw(e,t,s,i=void 0,a={}){[i,a]=this.handleWithdrawTagAndParams(i,a),this.checkAddress(s),await this.loadMarkets();const o=this.getCurrencyName(e),n=this.currency(e),d={withdraw_type:o,walletselected:"exchange",amount:this.numberToString(t),address:s};void 0!==i&&(d.payment_id=i);const h=await this.privatePostWithdraw(this.extend(d,a)),c=this.safeValue(h,0,{}),l=this.safeNumber(c,"withdrawal_id"),u=this.safeString(c,"message"),p=this.findBroadlyMatchedKey(this.exceptions.broad,u);if(0===l){if(void 0!==p){throw new(0,this.exceptions.broad[p])(this.id+" "+u)}throw new r.ExchangeError(this.id+" withdraw returned an id of zero: "+this.json(c))}return this.parseTransaction(c,n)}async fetchPositions(e=void 0,t={}){await this.loadMarkets();return await this.privatePostPositions(t)}nonce(){return this.milliseconds()}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/"+this.implodeParams(e,i);o="v2"===t?"/"+t+o:"/"+this.version+o;let d=this.omit(i,this.extractParams(e)),h=this.urls.api[t]+o;if(("public"===t||e.indexOf("/hist")>=0)&&Object.keys(d).length){const e="?"+this.urlencode(d);h+=e,o+=e}if("private"===t){this.checkRequiredCredentials();const e=this.nonce();d=this.extend({nonce:e.toString(),request:o},d),a=this.json(d);const t=this.stringToBase64(a),s=this.encode(this.secret),i=this.hmac(this.encode(t),s,n.iC);r={"X-BFX-APIKEY":this.apiKey,"X-BFX-PAYLOAD":t,"X-BFX-SIGNATURE":i,"Content-Type":"application/json"}}return{url:h,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;let c=!1;if(e>=400)"{"===o[0]&&(c=!0);else{const e=this.safeValue(n,0,{});"error"===this.safeString(e,"status","")&&(c=!0)}if(c){const e=this.id+" "+o,t=this.safeString2(n,"message","error");throw this.throwExactlyMatchedException(this.exceptions.exact,t,e),this.throwBroadlyMatchedException(this.exceptions.broad,t,e),new r.ExchangeError(e)}}}},730:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(6689),r=s(2194),a=s(3420),o=s(9292),n=s(7110);class d extends a.Z{describe(){return this.deepExtend(super.describe(),{id:"bitfinex2",name:"Bitfinex",countries:["VG"],version:"v2",certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,createDepositAddress:!0,createLimitOrder:!0,createMarketOrder:!0,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,createTrailingPercentOrder:!1,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRate:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchBorrowRates:!1,fetchBorrowRatesPerSymbol:!1,fetchClosedOrder:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchLiquidations:!0,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTickers:!0,fetchTime:!1,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:void 0,fetchTransactions:"emulated",reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!0,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","3h":"3h","4h":"4h","6h":"6h","12h":"12h","1d":"1D","1w":"7D","2w":"14D","1M":"1M"},rateLimit:250,urls:{logo:"https://user-images.githubusercontent.com/1294454/27766244-e328a50c-5ed2-11e7-947b-041416579bb3.jpg",api:{v1:"https://api.bitfinex.com",public:"https://api-pub.bitfinex.com",private:"https://api.bitfinex.com"},www:"https://www.bitfinex.com",doc:["https://docs.bitfinex.com/v2/docs/","https://github.com/bitfinexcom/bitfinex-api-node"],fees:"https://www.bitfinex.com/fees"},api:{public:{get:{"conf/{config}":2.7,"conf/pub:{action}:{object}":2.7,"conf/pub:{action}:{object}:{detail}":2.7,"conf/pub:map:{object}":2.7,"conf/pub:map:{object}:{detail}":2.7,"conf/pub:map:currency:{detail}":2.7,"conf/pub:map:currency:sym":2.7,"conf/pub:map:currency:label":2.7,"conf/pub:map:currency:unit":2.7,"conf/pub:map:currency:undl":2.7,"conf/pub:map:currency:pool":2.7,"conf/pub:map:currency:explorer":2.7,"conf/pub:map:currency:tx:fee":2.7,"conf/pub:map:tx:method":2.7,"conf/pub:list:{object}":2.7,"conf/pub:list:{object}:{detail}":2.7,"conf/pub:list:currency":2.7,"conf/pub:list:pair:exchange":2.7,"conf/pub:list:pair:margin":2.7,"conf/pub:list:pair:futures":2.7,"conf/pub:list:competitions":2.7,"conf/pub:info:{object}":2.7,"conf/pub:info:{object}:{detail}":2.7,"conf/pub:info:pair":2.7,"conf/pub:info:pair:futures":2.7,"conf/pub:info:tx:status":2.7,"conf/pub:fees":2.7,"platform/status":8,tickers:2.7,"ticker/{symbol}":2.7,"tickers/hist":2.7,"trades/{symbol}/hist":2.7,"book/{symbol}/{precision}":1,"book/{symbol}/P0":1,"book/{symbol}/P1":1,"book/{symbol}/P2":1,"book/{symbol}/P3":1,"book/{symbol}/R0":1,"stats1/{key}:{size}:{symbol}:{side}/{section}":2.7,"stats1/{key}:{size}:{symbol}:{side}/last":2.7,"stats1/{key}:{size}:{symbol}:{side}/hist":2.7,"stats1/{key}:{size}:{symbol}/{section}":2.7,"stats1/{key}:{size}:{symbol}/last":2.7,"stats1/{key}:{size}:{symbol}/hist":2.7,"stats1/{key}:{size}:{symbol}:long/last":2.7,"stats1/{key}:{size}:{symbol}:long/hist":2.7,"stats1/{key}:{size}:{symbol}:short/last":2.7,"stats1/{key}:{size}:{symbol}:short/hist":2.7,"candles/trade:{timeframe}:{symbol}:{period}/{section}":2.7,"candles/trade:{timeframe}:{symbol}/{section}":2.7,"candles/trade:{timeframe}:{symbol}/last":2.7,"candles/trade:{timeframe}:{symbol}/hist":2.7,"status/{type}":2.7,"status/deriv":2.7,"status/deriv/{symbol}/hist":2.7,"liquidations/hist":80,"rankings/{key}:{timeframe}:{symbol}/{section}":2.7,"rankings/{key}:{timeframe}:{symbol}/hist":2.7,"pulse/hist":2.7,"pulse/profile/{nickname}":2.7,"funding/stats/{symbol}/hist":10},post:{"calc/trade/avg":2.7,"calc/fx":2.7}},private:{post:{"auth/r/wallets":2.7,"auth/r/wallets/hist":2.7,"auth/r/orders":2.7,"auth/r/orders/{symbol}":2.7,"auth/w/order/submit":2.7,"auth/w/order/update":2.7,"auth/w/order/cancel":2.7,"auth/w/order/multi":2.7,"auth/w/order/cancel/multi":2.7,"auth/r/orders/{symbol}/hist":2.7,"auth/r/orders/hist":2.7,"auth/r/order/{symbol}:{id}/trades":2.7,"auth/r/trades/{symbol}/hist":2.7,"auth/r/trades/hist":2.7,"auth/r/ledgers/{currency}/hist":2.7,"auth/r/ledgers/hist":2.7,"auth/r/info/margin/{key}":2.7,"auth/r/info/margin/base":2.7,"auth/r/info/margin/sym_all":2.7,"auth/r/positions":2.7,"auth/w/position/claim":2.7,"auth/w/position/increase:":2.7,"auth/r/position/increase/info":2.7,"auth/r/positions/hist":2.7,"auth/r/positions/audit":2.7,"auth/r/positions/snap":2.7,"auth/w/deriv/collateral/set":2.7,"auth/w/deriv/collateral/limits":2.7,"auth/r/funding/offers":2.7,"auth/r/funding/offers/{symbol}":2.7,"auth/w/funding/offer/submit":2.7,"auth/w/funding/offer/cancel":2.7,"auth/w/funding/offer/cancel/all":2.7,"auth/w/funding/close":2.7,"auth/w/funding/auto":2.7,"auth/w/funding/keep":2.7,"auth/r/funding/offers/{symbol}/hist":2.7,"auth/r/funding/offers/hist":2.7,"auth/r/funding/loans":2.7,"auth/r/funding/loans/hist":2.7,"auth/r/funding/loans/{symbol}":2.7,"auth/r/funding/loans/{symbol}/hist":2.7,"auth/r/funding/credits":2.7,"auth/r/funding/credits/hist":2.7,"auth/r/funding/credits/{symbol}":2.7,"auth/r/funding/credits/{symbol}/hist":2.7,"auth/r/funding/trades/{symbol}/hist":2.7,"auth/r/funding/trades/hist":2.7,"auth/r/info/funding/{key}":2.7,"auth/r/info/user":2.7,"auth/r/summary":2.7,"auth/r/logins/hist":2.7,"auth/r/permissions":2.7,"auth/w/token":2.7,"auth/r/audit/hist":2.7,"auth/w/transfer":2.7,"auth/w/deposit/address":24,"auth/w/deposit/invoice":24,"auth/w/withdraw":24,"auth/r/movements/{currency}/hist":2.7,"auth/r/movements/hist":2.7,"auth/r/alerts":5.34,"auth/w/alert/set":2.7,"auth/w/alert/price:{symbol}:{price}/del":2.7,"auth/w/alert/{type}:{symbol}:{price}/del":2.7,"auth/calc/order/avail":2.7,"auth/w/settings/set":2.7,"auth/r/settings":2.7,"auth/w/settings/del":2.7,"auth/r/pulse/hist":2.7,"auth/w/pulse/add":16,"auth/w/pulse/del":2.7}}},fees:{trading:{feeSide:"get",percentage:!0,tierBased:!0,maker:this.parseNumber("0.001"),taker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.002")],[this.parseNumber("2500000"),this.parseNumber("0.002")],[this.parseNumber("5000000"),this.parseNumber("0.002")],[this.parseNumber("7500000"),this.parseNumber("0.002")],[this.parseNumber("10000000"),this.parseNumber("0.0018")],[this.parseNumber("15000000"),this.parseNumber("0.0016")],[this.parseNumber("20000000"),this.parseNumber("0.0014")],[this.parseNumber("25000000"),this.parseNumber("0.0012")],[this.parseNumber("30000000"),this.parseNumber("0.001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("500000"),this.parseNumber("0.0008")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0002")],[this.parseNumber("7500000"),this.parseNumber("0")],[this.parseNumber("10000000"),this.parseNumber("0")],[this.parseNumber("15000000"),this.parseNumber("0")],[this.parseNumber("20000000"),this.parseNumber("0")],[this.parseNumber("25000000"),this.parseNumber("0")],[this.parseNumber("30000000"),this.parseNumber("0")]]}},funding:{withdraw:{}}},precisionMode:o.tV,options:{precision:"R0",exchangeTypes:{"EXCHANGE MARKET":"market","EXCHANGE LIMIT":"limit","EXCHANGE STOP":"market","EXCHANGE FOK":"limit","EXCHANGE STOP LIMIT":"limit","EXCHANGE IOC":"limit"},orderTypes:{market:"EXCHANGE MARKET",limit:"EXCHANGE LIMIT"},fiat:{USD:"USD",EUR:"EUR",JPY:"JPY",GBP:"GBP",CHN:"CHN"},v2AccountsByType:{spot:"exchange",exchange:"exchange",funding:"funding",margin:"margin",derivatives:"margin",future:"margin",swap:"margin"},withdraw:{includeFee:!1}},exceptions:{exact:{11010:i.RateLimitExceeded,10001:i.PermissionDenied,10020:i.BadRequest,10100:i.AuthenticationError,10114:i.InvalidNonce,20060:i.OnMaintenance,temporarily_unavailable:i.ExchangeNotAvailable},broad:{address:i.InvalidAddress,"available balance is only":i.InsufficientFunds,"not enough exchange balance":i.InsufficientFunds,"Order not found":i.OrderNotFound,"symbol: invalid":i.BadSymbol,"Invalid order":i.InvalidOrder}},commonCurrencies:{UST:"USDT",EUTF0:"EURT",USTF0:"USDT",ALG:"ALGO",AMP:"AMPL",ATO:"ATOM",BCHABC:"XEC",BCHN:"BCH",DAT:"DATA",DOG:"MDOGE",DSH:"DASH",EDO:"PNT",EUS:"EURS",EUT:"EURT",HTX:"HT",IDX:"ID",IOT:"IOTA",IQX:"IQ",LUNA:"LUNC",LUNA2:"LUNA",MNA:"MANA",ORS:"ORS Group",PAS:"PASS",QSH:"QASH",QTM:"QTUM",RBT:"RBTC",SNG:"SNGLS",STJ:"STORJ",TERRAUST:"USTC",TSD:"TUSD",YGG:"YEED",YYW:"YOYOW",UDC:"USDC",VSY:"VSYS",WAX:"WAXP",XCH:"XCHF",ZBT:"ZB"}})}isFiat(e){return e in this.options.fiat}getCurrencyId(e){return"f"+e}getCurrencyName(e){if(e in this.options.currencyNames)return this.options.currencyNames[e];throw new i.NotSupported(this.id+" "+e+" not supported for withdrawal")}amountToPrecision(e,t){return e=this.safeSymbol(e),this.decimalToPrecision(t,o.tk,this.markets[e].precision.amount,o.nr)}priceToPrecision(e,t){return e=this.safeSymbol(e),t=this.decimalToPrecision(t,o.oU,this.markets[e].precision.price,this.precisionMode),this.decimalToPrecision(t,o.tk,8,o.nr)}async fetchStatus(e={}){const t=await this.publicGetPlatformStatus(e),s=this.safeString(t,0);return{status:this.safeString({0:"maintenance",1:"ok"},s,s),updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){let t=await this.publicGetConfPubInfoPair(e),s=await this.publicGetConfPubInfoPairFutures(e);t=this.safeValue(t,0,[]),s=this.safeValue(s,0,[]);const i=this.arrayConcat(t,s);let r=await this.publicGetConfPubListPairMargin(e);r=this.safeValue(r,0,[]);const a=[];for(let e=0;e=0&&(n=!1);const d=!n;let h,c;if(s.indexOf(":")>=0){const e=s.split(":");h=e[0],c=e[1]}else h=s.slice(0,3),c=s.slice(3,6);let l=this.safeCurrencyCode(h),u=this.safeCurrencyCode(c);const p=l.split("F0"),f=u.split("F0");l=this.safeString(p,0),u=this.safeString(f,0);let m,g,v=l+"/"+u;h=this.getCurrencyId(h),c=this.getCurrencyId(c),d&&(m=u,g=u,v=v+":"+m);const y=this.safeString(o,3),w=this.safeString(o,4);let b=!1;n&&this.inArray(s,r)&&(b=!0),a.push({id:"t"+s,symbol:v,base:l,quote:u,settle:m,baseId:h,quoteId:c,settleId:g,type:n?"spot":"swap",spot:n,margin:b,swap:d,future:!1,option:!1,active:!0,contract:d,linear:!!d||void 0,inverse:!d&&void 0,contractSize:d?this.parseNumber("1"):void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:parseInt("8"),price:parseInt("5")},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.parseNumber(y),max:this.parseNumber(w)},price:{min:this.parseNumber("1e-8"),max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:o})}return a}async fetchCurrencies(e={}){const t={config:["pub:list:currency","pub:map:currency:sym","pub:map:currency:label","pub:map:currency:unit","pub:map:currency:undl","pub:map:currency:pool","pub:map:currency:explorer","pub:map:currency:tx:fee","pub:map:tx:method"].join(",")},s=await this.publicGetConfConfig(this.extend(t,e)),i={sym:this.indexBy(this.safeValue(s,1,[]),0),label:this.indexBy(this.safeValue(s,2,[]),0),unit:this.indexBy(this.safeValue(s,3,[]),0),undl:this.indexBy(this.safeValue(s,4,[]),0),pool:this.indexBy(this.safeValue(s,5,[]),0),explorer:this.indexBy(this.safeValue(s,6,[]),0),fees:this.indexBy(this.safeValue(s,7,[]),0)},r=this.safeValue(s,0,[]),a={};for(let e=0;e=0)continue;const o=this.safeCurrencyCode(t),n=this.safeValue(i.label,t,[]),d=this.safeString(n,1),h=this.safeValue(i.pool,t,[]),c=void 0===this.safeString(h,1)?"other":"crypto",l=this.safeValue(i.fees,t,[]),u=this.safeValue(l,1,[]),p=this.safeNumber(u,1),f=this.safeValue(i.undl,t,[]),m="8",g="f"+t;a[o]={id:g,uppercaseId:t,code:o,info:[t,n,h,l,f],type:c,name:d,active:!0,deposit:void 0,withdraw:void 0,fee:p,precision:parseInt(m),limits:{amount:{min:this.parseNumber(this.parsePrecision(m)),max:void 0},withdraw:{min:p,max:void 0}},networks:{}};const v={},y=this.safeValue(s,8,[]),w=t.replace("F0","");for(let e=0;e0&&(a[o].networks=v)}return a}safeNetwork(e){return this.safeString({BITCOIN:"BTC",LITECOIN:"LTC",ETHEREUM:"ERC20",TETHERUSE:"ERC20",TETHERUSO:"OMNI",TETHERUSL:"LIQUID",TETHERUSX:"TRC20",TETHERUSS:"EOS",TETHERUSDTAVAX:"AVAX",TETHERUSDTSOL:"SOL",TETHERUSDTALG:"ALGO",TETHERUSDTBCH:"BCH",TETHERUSDTKSM:"KSM",TETHERUSDTDVF:"DVF",TETHERUSDTOMG:"OMG"},e,e)}async fetchBalance(e={}){await this.loadMarkets();const t=this.safeValue(this.options,"v2AccountsByType",{}),s=this.safeString(e,"type","exchange"),r=this.safeString(t,s,s);if(void 0===r){const e=Object.keys(t);throw new i.ExchangeError(this.id+" fetchBalance() type parameter must be one of "+e.join(", "))}const a="derivatives"===s,o=this.omit(e,"type"),n=await this.privatePostAuthRWallets(o),d={info:n};for(let e=0;e5,i=this.safeString(e,0),a=s?4:2;let o,n=this.safeString(e,a);const d=s?5:3,h=this.safeString(e,d);let c,l,u,p;"-"===n[0]?(o="sell",n=r.O.stringAbs(n)):o="buy";let f=this.safeSymbol(void 0,t);const m=s?2:1,g=this.safeInteger(e,m);if(s){const t=e[1];f=this.safeSymbol(t),c=this.safeString(e,3);l=1===this.safeInteger(e,8)?"maker":"taker";let s=this.safeString(e,9);s=r.O.stringNeg(s);const i=this.safeString(e,10);p={cost:s,currency:this.safeCurrencyCode(i)};const a=e[6];u=this.safeString(this.options.exchangeTypes,a)}return this.safeTrade({id:i,timestamp:g,datetime:this.iso8601(g),symbol:f,order:c,side:o,type:u,takerOrMaker:l,price:h,amount:n,cost:void 0,fee:p,info:e},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchTrades",e,t,s,i,1e4);const a=this.market(e);let o="-1",n={symbol:a.id};void 0!==t&&(n.start=t,o="1"),void 0!==s&&(n.limit=Math.min(s,1e4)),n.sort=o,[n,i]=this.handleUntilOption("end",n,i);const d=await this.publicGetTradesSymbolHist(this.extend(n,i)),h=this.sortBy(d,1);return this.parseTrades(h,a,void 0,s)}async fetchOHLCV(e,t="1m",s=void 0,i=100,r={}){await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchOHLCV","paginate"),a)return await this.fetchPaginatedCallDeterministic("fetchOHLCV",e,s,i,t,r,1e4);const o=this.market(e);i=void 0===i?1e4:Math.min(i,1e4);let n={symbol:o.id,timeframe:this.safeString(this.timeframes,t,t),sort:1,limit:i};void 0!==s&&(n.start=s),[n,r]=this.handleUntilOption("end",n,r);const d=await this.publicGetCandlesTradeTimeframeSymbolHist(this.extend(n,r));return this.parseOHLCVs(d,o,t,s,i)}parseOHLCV(e,t=void 0){return[this.safeInteger(e,0),this.safeNumber(e,1),this.safeNumber(e,3),this.safeNumber(e,4),this.safeNumber(e,2),this.safeNumber(e,5)]}parseOrderStatus(e){if(void 0===e)return e;const t=e.split(" "),s=this.safeString(t,0);return this.safeString({ACTIVE:"open",PARTIALLY:"open",EXECUTED:"closed",CANCELED:"canceled",INSUFFICIENT:"canceled","POSTONLY CANCELED":"canceled",RSN_DUST:"rejected",RSN_PAUSE:"rejected","IOC CANCELED":"canceled","FILLORKILL CANCELED":"canceled"},s,e)}parseOrderFlags(e){return this.safeValue({1024:["reduceOnly"],4096:["postOnly"],5120:["reduceOnly","postOnly"]},e,void 0)}parseTimeInForce(e){return this.safeString({"EXCHANGE IOC":"IOC","EXCHANGE FOK":"FOK",IOC:"IOC",FOK:"FOK"},e,"GTC")}parseOrder(e,t=void 0){const s=this.safeString(e,0),i=this.safeString(e,3),a=this.safeSymbol(i),o=this.safeInteger(e,5),n=r.O.stringAbs(this.safeString(e,6)),d=this.safeString(e,7),h=r.O.stringAbs(d),c=r.O.stringLt(d,"0")?"sell":"buy",l=this.safeString(e,8),u=this.safeString(this.safeValue(this.options,"exchangeTypes"),l),p=this.parseTimeInForce(l),f=this.safeString(e,12),m=this.parseOrderFlags(f);let g=!1;if(void 0!==m)for(let e=0;e=0||e.indexOf("charged")>=0?"fee":e.indexOf("rebate")>=0?"rebate":e.indexOf("deposit")>=0||e.indexOf("withdrawal")>=0?"transaction":e.indexOf("transfer")>=0?"transfer":e.indexOf("payment")>=0?"payout":e.indexOf("exchange")>=0||e.indexOf("position")>=0?"trade":e}parseLedgerEntry(e,t=void 0){let s;const i=this.safeString(e,0),r=this.safeString(e,1),a=this.safeCurrencyCode(r,t),o=this.safeInteger(e,3),n=this.safeNumber(e,5),d=this.safeNumber(e,6),h=this.safeString(e,8);if(void 0!==h){const e=h.split(" @ "),t=this.safeStringLower(e,0);s=this.parseLedgerEntryType(t)}return{id:i,direction:void 0,account:void 0,referenceId:i,referenceAccount:void 0,type:s,currency:a,amount:n,timestamp:o,datetime:this.iso8601(o),before:void 0,after:d,status:void 0,fee:void 0,info:e}}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r,a=!1;if([a,i]=this.handleOptionAndParams(i,"fetchLedger","paginate"),a)return await this.fetchPaginatedCallDynamic("fetchLedger",e,t,s,i,2500);let o,n={};return void 0!==t&&(n.start=t),void 0!==s&&(n.limit=s),[n,i]=this.handleUntilOption("end",n,i),void 0!==e?(r=this.currency(e),n.currency=r.uppercaseId,o=await this.privatePostAuthRLedgersCurrencyHist(this.extend(n,i))):o=await this.privatePostAuthRLedgersHist(this.extend(n,i)),this.parseLedger(o,r,t,s)}async fetchFundingRate(e,t={}){return await this.fetchFundingRates([e],t)}async fetchFundingRates(e=void 0,t={}){if(void 0===e)throw new i.ArgumentsRequired(this.id+" fetchFundingRates() requires a symbols argument");await this.loadMarkets();const s={keys:this.marketIds(e).join(",")},r=await this.publicGetStatusDeriv(this.extend(s,t));return this.parseFundingRates(r)}async fetchFundingRateHistory(e=void 0,t=void 0,s=void 0,r={}){if(void 0===e)throw new i.ArgumentsRequired(this.id+" fetchFundingRateHistory() requires a symbol argument");await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchFundingRateHistory","paginate"),a)return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory",e,t,s,"8h",r,5e3);const o=this.market(e);let n={symbol:o.id};void 0!==t&&(n.start=t),[n,r]=this.handleUntilOption("end",n,r);const d=await this.publicGetStatusDerivSymbolHist(this.extend(n,r)),h=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(2787),r=s(6689),a=s(9292),o=s(1372),n=s(2194);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitflyer",name:"bitFlyer",countries:["JP"],version:"v1",rateLimit:1e3,hostname:"bitflyer.com",has:{CORS:void 0,spot:!0,margin:!1,swap:void 0,future:void 0,option:!1,cancelAllOrders:void 0,cancelOrder:!0,createOrder:!0,fetchBalance:!0,fetchClosedOrders:"emulated",fetchDeposits:!0,fetchMarginMode:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOpenOrders:"emulated",fetchOrder:"emulated",fetchOrderBook:!0,fetchOrders:!0,fetchPositionMode:!1,fetchPositions:!0,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawals:!0,transfer:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/28051642-56154182-660e-11e7-9b0d-6042d1e6edd8.jpg",api:{rest:"https://api.{hostname}"},www:"https://bitflyer.com",doc:"https://lightning.bitflyer.com/docs?lang=en"},api:{public:{get:["getmarkets/usa","getmarkets/eu","getmarkets","getboard","getticker","getexecutions","gethealth","getboardstate","getchats"]},private:{get:["getpermissions","getbalance","getbalancehistory","getcollateral","getcollateralhistory","getcollateralaccounts","getaddresses","getcoinins","getcoinouts","getbankaccounts","getdeposits","getwithdrawals","getchildorders","getparentorders","getparentorder","getexecutions","getpositions","gettradingcommission"],post:["sendcoin","withdraw","sendchildorder","cancelchildorder","sendparentorder","cancelparentorder","cancelallchildorders"]}},fees:{trading:{maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},precisionMode:a.sh,exceptions:{exact:{"-2":r.OnMaintenance}}})}parseExpiryDate(e){const t=e.slice(0,2),s=e.slice(2,5),i=e.slice(5,9),r=this.safeString({JAN:"01",FEB:"02",MAR:"03",APR:"04",MAY:"05",JUN:"06",JUL:"07",AUG:"08",SEP:"09",OCT:"10",NOV:"11",DEC:"12"},s);return this.parse8601(i+"-"+r+"-"+t+"T00:00:00Z")}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return super.safeMarket(e,t,s,"spot")}async fetchMarkets(e={}){const t=await this.publicGetGetmarkets(e),s=await this.publicGetGetmarketsUsa(e),i=await this.publicGetGetmarketsEu(e);let r=this.arrayConcat(t,s);r=this.arrayConcat(r,i);const a=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(2065),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitget",name:"Bitget",countries:["SG"],version:"v2",rateLimit:50,certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:!1,addMargin:!0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!0,closePosition:!0,createConvertTrade:!0,createDepositAddress:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!1,createTrailingPercentOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchConvertCurrencies:!0,fetchConvertQuote:!0,fetchConvertTrade:!1,fetchConvertTradeHistory:!0,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!0,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!0,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!0,fetchWithdrawAddresses:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1m"},hostname:"bitget.com",urls:{logo:"https://user-images.githubusercontent.com/1294454/195989417-4253ddb0-afbe-4a1c-9dea-9dbcd121fa5d.jpg",api:{spot:"https://api.{hostname}",mix:"https://api.{hostname}",user:"https://api.{hostname}",p2p:"https://api.{hostname}",broker:"https://api.{hostname}",margin:"https://api.{hostname}",common:"https://api.{hostname}",tax:"https://api.{hostname}",convert:"https://api.{hostname}",copy:"https://api.{hostname}",earn:"https://api.{hostname}"},www:"https://www.bitget.com",doc:["https://www.bitget.com/api-doc/common/intro","https://www.bitget.com/api-doc/spot/intro","https://www.bitget.com/api-doc/contract/intro","https://www.bitget.com/api-doc/broker/intro","https://www.bitget.com/api-doc/margin/intro","https://www.bitget.com/api-doc/copytrading/intro","https://www.bitget.com/api-doc/earn/intro","https://bitgetlimited.github.io/apidoc/en/mix","https://bitgetlimited.github.io/apidoc/en/spot","https://bitgetlimited.github.io/apidoc/en/broker","https://bitgetlimited.github.io/apidoc/en/margin"],fees:"https://www.bitget.cc/zh-CN/rate?tab=1",referral:"https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j"},api:{public:{common:{get:{"v2/public/annoucements":1,"v2/public/time":1}},spot:{get:{"spot/v1/notice/queryAllNotices":1,"spot/v1/public/time":1,"spot/v1/public/currencies":6.6667,"spot/v1/public/products":1,"spot/v1/public/product":1,"spot/v1/market/ticker":1,"spot/v1/market/tickers":1,"spot/v1/market/fills":2,"spot/v1/market/fills-history":2,"spot/v1/market/candles":1,"spot/v1/market/depth":1,"spot/v1/market/spot-vip-level":2,"spot/v1/market/merge-depth":1,"spot/v1/market/history-candles":1,"spot/v1/public/loan/coinInfos":2,"spot/v1/public/loan/hour-interest":2,"v2/spot/public/coins":6.6667,"v2/spot/public/symbols":1,"v2/spot/market/vip-fee-rate":2,"v2/spot/market/tickers":1,"v2/spot/market/merge-depth":1,"v2/spot/market/orderbook":1,"v2/spot/market/candles":1,"v2/spot/market/history-candles":1,"v2/spot/market/fills":2,"v2/spot/market/fills-history":2}},mix:{get:{"mix/v1/market/contracts":1,"mix/v1/market/depth":1,"mix/v1/market/ticker":1,"mix/v1/market/tickers":1,"mix/v1/market/contract-vip-level":2,"mix/v1/market/fills":1,"mix/v1/market/fills-history":2,"mix/v1/market/candles":1,"mix/v1/market/index":1,"mix/v1/market/funding-time":1,"mix/v1/market/history-fundRate":1,"mix/v1/market/current-fundRate":1,"mix/v1/market/open-interest":1,"mix/v1/market/mark-price":1,"mix/v1/market/symbol-leverage":1,"mix/v1/market/queryPositionLever":1,"mix/v1/market/open-limit":1,"mix/v1/market/history-candles":1,"mix/v1/market/history-index-candles":1,"mix/v1/market/history-mark-candles":1,"mix/v1/market/merge-depth":1,"v2/mix/market/vip-fee-rate":2,"v2/mix/market/merge-depth":1,"v2/mix/market/ticker":1,"v2/mix/market/tickers":1,"v2/mix/market/fills":1,"v2/mix/market/fills-history":2,"v2/mix/market/candles":1,"v2/mix/market/history-candles":1,"v2/mix/market/history-index-candles":1,"v2/mix/market/history-mark-candles":1,"v2/mix/market/open-interest":1,"v2/mix/market/funding-time":1,"v2/mix/market/symbol-price":1,"v2/mix/market/history-fund-rate":1,"v2/mix/market/current-fund-rate":1,"v2/mix/market/contracts":1,"v2/mix/market/query-position-lever":2}},margin:{get:{"margin/v1/cross/public/interestRateAndLimit":2,"margin/v1/isolated/public/interestRateAndLimit":2,"margin/v1/cross/public/tierData":2,"margin/v1/isolated/public/tierData":2,"margin/v1/public/currencies":1,"v2/margin/currencies":2}},earn:{get:{"v2/earn/loan/public/coinInfos":2,"v2/earn/loan/public/hour-interest":2}}},private:{spot:{get:{"spot/v1/wallet/deposit-address":4,"spot/v1/wallet/withdrawal-list":1,"spot/v1/wallet/deposit-list":1,"spot/v1/account/getInfo":20,"spot/v1/account/assets":2,"spot/v1/account/assets-lite":2,"spot/v1/account/transferRecords":1,"spot/v1/convert/currencies":2,"spot/v1/convert/convert-record":2,"spot/v1/loan/ongoing-orders":2,"spot/v1/loan/repay-history":2,"spot/v1/loan/revise-history":2,"spot/v1/loan/borrow-history":2,"spot/v1/loan/debts":2,"v2/spot/trade/orderInfo":1,"v2/spot/trade/unfilled-orders":1,"v2/spot/trade/history-orders":1,"v2/spot/trade/fills":2,"v2/spot/trade/current-plan-order":1,"v2/spot/trade/history-plan-order":1,"v2/spot/account/info":20,"v2/spot/account/assets":2,"v2/spot/account/subaccount-assets":2,"v2/spot/account/bills":2,"v2/spot/account/transferRecords":1,"v2/spot/wallet/deposit-address":2,"v2/spot/wallet/deposit-records":2,"v2/spot/wallet/withdrawal-records":2},post:{"spot/v1/wallet/transfer":4,"spot/v1/wallet/transfer-v2":4,"spot/v1/wallet/subTransfer":10,"spot/v1/wallet/withdrawal":4,"spot/v1/wallet/withdrawal-v2":4,"spot/v1/wallet/withdrawal-inner":4,"spot/v1/wallet/withdrawal-inner-v2":4,"spot/v1/account/sub-account-spot-assets":200,"spot/v1/account/bills":2,"spot/v1/trade/orders":2,"spot/v1/trade/batch-orders":4,"spot/v1/trade/cancel-order":2,"spot/v1/trade/cancel-order-v2":2,"spot/v1/trade/cancel-symbol-order":2,"spot/v1/trade/cancel-batch-orders":4,"spot/v1/trade/cancel-batch-orders-v2":4,"spot/v1/trade/orderInfo":1,"spot/v1/trade/open-orders":1,"spot/v1/trade/history":1,"spot/v1/trade/fills":1,"spot/v1/plan/placePlan":1,"spot/v1/plan/modifyPlan":1,"spot/v1/plan/cancelPlan":1,"spot/v1/plan/currentPlan":1,"spot/v1/plan/historyPlan":1,"spot/v1/plan/batchCancelPlan":2,"spot/v1/convert/quoted-price":4,"spot/v1/convert/trade":4,"spot/v1/loan/borrow":2,"spot/v1/loan/repay":2,"spot/v1/loan/revise-pledge":2,"spot/v1/trace/order/orderCurrentList":2,"spot/v1/trace/order/orderHistoryList":2,"spot/v1/trace/order/closeTrackingOrder":2,"spot/v1/trace/order/updateTpsl":2,"spot/v1/trace/order/followerEndOrder":2,"spot/v1/trace/order/spotInfoList":2,"spot/v1/trace/config/getTraderSettings":2,"spot/v1/trace/config/getFollowerSettings":2,"spot/v1/trace/user/myTraders":2,"spot/v1/trace/config/setFollowerConfig":2,"spot/v1/trace/user/myFollowers":2,"spot/v1/trace/config/setProductCode":2,"spot/v1/trace/user/removeTrader":2,"spot/v1/trace/getRemovableFollower":2,"spot/v1/trace/user/removeFollower":2,"spot/v1/trace/profit/totalProfitInfo":2,"spot/v1/trace/profit/totalProfitList":2,"spot/v1/trace/profit/profitHisList":2,"spot/v1/trace/profit/profitHisDetailList":2,"spot/v1/trace/profit/waitProfitDetailList":2,"spot/v1/trace/user/getTraderInfo":2,"v2/spot/trade/place-order":2,"v2/spot/trade/cancel-order":2,"v2/spot/trade/batch-orders":20,"v2/spot/trade/batch-cancel-order":2,"v2/spot/trade/cancel-symbol-order":4,"v2/spot/trade/place-plan-order":1,"v2/spot/trade/modify-plan-order":1,"v2/spot/trade/cancel-plan-order":1,"v2/spot/trade/batch-cancel-plan-order":2,"v2/spot/wallet/transfer":2,"v2/spot/wallet/subaccount-transfer":2,"v2/spot/wallet/withdrawal":2,"v2/spot/wallet/cancel-withdrawal":2,"v2/spot/wallet/modify-deposit-account":2}},mix:{get:{"mix/v1/account/account":2,"mix/v1/account/accounts":2,"mix/v1/position/singlePosition":2,"mix/v1/position/singlePosition-v2":2,"mix/v1/position/allPosition":4,"mix/v1/position/allPosition-v2":4,"mix/v1/position/history-position":1,"mix/v1/account/accountBill":2,"mix/v1/account/accountBusinessBill":4,"mix/v1/order/current":1,"mix/v1/order/marginCoinCurrent":1,"mix/v1/order/history":2,"mix/v1/order/historyProductType":4,"mix/v1/order/detail":2,"mix/v1/order/fills":2,"mix/v1/order/allFills":2,"mix/v1/plan/currentPlan":1,"mix/v1/plan/historyPlan":2,"mix/v1/trace/currentTrack":2,"mix/v1/trace/followerOrder":2,"mix/v1/trace/followerHistoryOrders":2,"mix/v1/trace/historyTrack":2,"mix/v1/trace/summary":1,"mix/v1/trace/profitSettleTokenIdGroup":1,"mix/v1/trace/profitDateGroupList":1,"mix/v1/trade/profitDateList":2,"mix/v1/trace/waitProfitDateList":1,"mix/v1/trace/traderSymbols":1,"mix/v1/trace/traderList":2,"mix/v1/trace/traderDetail":2,"mix/v1/trace/queryTraceConfig":2,"v2/mix/account/account":2,"v2/mix/account/accounts":2,"v2/mix/account/sub-account-assets":200,"v2/mix/account/open-count":2,"v2/mix/account/bill":2,"v2/mix/market/query-position-lever":2,"v2/mix/position/single-position":2,"v2/mix/position/all-position":4,"v2/mix/position/history-position":1,"v2/mix/order/detail":2,"v2/mix/order/fills":2,"v2/mix/order/fill-history":2,"v2/mix/order/orders-pending":2,"v2/mix/order/orders-history":2,"v2/mix/order/orders-plan-pending":2,"v2/mix/order/orders-plan-history":2},post:{"mix/v1/account/sub-account-contract-assets":200,"mix/v1/account/open-count":1,"mix/v1/account/setLeverage":4,"mix/v1/account/setMargin":4,"mix/v1/account/setMarginMode":4,"mix/v1/account/setPositionMode":4,"mix/v1/order/placeOrder":2,"mix/v1/order/batch-orders":2,"mix/v1/order/cancel-order":2,"mix/v1/order/cancel-batch-orders":2,"mix/v1/order/modifyOrder":2,"mix/v1/order/cancel-symbol-orders":2,"mix/v1/order/cancel-all-orders":2,"mix/v1/order/close-all-positions":20,"mix/v1/plan/placePlan":2,"mix/v1/plan/modifyPlan":2,"mix/v1/plan/modifyPlanPreset":2,"mix/v1/plan/placeTPSL":2,"mix/v1/plan/placeTrailStop":2,"mix/v1/plan/placePositionsTPSL":2,"mix/v1/plan/modifyTPSLPlan":2,"mix/v1/plan/cancelPlan":2,"mix/v1/plan/cancelSymbolPlan":2,"mix/v1/plan/cancelAllPlan":2,"mix/v1/trace/closeTrackOrder":2,"mix/v1/trace/modifyTPSL":2,"mix/v1/trace/closeTrackOrderBySymbol":2,"mix/v1/trace/setUpCopySymbols":2,"mix/v1/trace/followerSetBatchTraceConfig":2,"mix/v1/trace/followerCloseByTrackingNo":2,"mix/v1/trace/followerCloseByAll":2,"mix/v1/trace/followerSetTpsl":2,"mix/v1/trace/cancelCopyTrader":4,"mix/v1/trace/traderUpdateConfig":2,"mix/v1/trace/myTraderList":2,"mix/v1/trace/myFollowerList":2,"mix/v1/trace/removeFollower":2,"mix/v1/trace/public/getFollowerConfig":2,"mix/v1/trace/report/order/historyList":2,"mix/v1/trace/report/order/currentList":2,"mix/v1/trace/queryTraderTpslRatioConfig":2,"mix/v1/trace/traderUpdateTpslRatioConfig":2,"v2/mix/account/set-leverage":4,"v2/mix/account/set-margin":4,"v2/mix/account/set-margin-mode":4,"v2/mix/account/set-position-mode":4,"v2/mix/order/place-order":20,"v2/mix/order/click-backhand":20,"v2/mix/order/batch-place-order":20,"v2/mix/order/modify-order":2,"v2/mix/order/cancel-order":2,"v2/mix/order/batch-cancel-orders":2,"v2/mix/order/close-positions":20,"v2/mix/order/place-tpsl-order":2,"v2/mix/order/place-plan-order":2,"v2/mix/order/modify-tpsl-order":2,"v2/mix/order/modify-plan-order":2,"v2/mix/order/cancel-plan-order":2}},user:{get:{"user/v1/fee/query":2,"user/v1/sub/virtual-list":2,"user/v1/sub/virtual-api-list":2,"user/v1/tax/spot-record":1,"user/v1/tax/future-record":1,"user/v1/tax/margin-record":1,"user/v1/tax/p2p-record":1,"v2/user/virtual-subaccount-list":2,"v2/user/virtual-subaccount-apikey-list":2},post:{"user/v1/sub/virtual-create":4,"user/v1/sub/virtual-modify":4,"user/v1/sub/virtual-api-batch-create":20,"user/v1/sub/virtual-api-create":4,"user/v1/sub/virtual-api-modify":4,"v2/user/create-virtual-subaccount":4,"v2/user/modify-virtual-subaccount":4,"v2/user/batch-create-subaccount-and-apikey":20,"v2/user/create-virtual-subaccount-apikey":4,"v2/user/modify-virtual-subaccount-apikey":4}},p2p:{get:{"p2p/v1/merchant/merchantList":2,"p2p/v1/merchant/merchantInfo":2,"p2p/v1/merchant/advList":2,"p2p/v1/merchant/orderList":2,"v2/p2p/merchantList":2,"v2/p2p/merchantInfo":2,"v2/p2p/orderList":2,"v2/p2p/advList":2}},broker:{get:{"broker/v1/account/info":2,"broker/v1/account/sub-list":20,"broker/v1/account/sub-email":20,"broker/v1/account/sub-spot-assets":2,"broker/v1/account/sub-future-assets":2,"broker/v1/account/subaccount-transfer":1,"broker/v1/account/subaccount-deposit":1,"broker/v1/account/subaccount-withdrawal":1,"broker/v1/account/sub-api-list":2,"v2/broker/account/info":2,"v2/broker/account/subaccount-list":20,"v2/broker/account/subaccount-email":2,"v2/broker/account/subaccount-spot-assets":2,"v2/broker/account/subaccount-future-assets":2,"v2/broker/manage/subaccount-apikey-list":2},post:{"broker/v1/account/sub-create":20,"broker/v1/account/sub-modify":20,"broker/v1/account/sub-modify-email":20,"broker/v1/account/sub-address":2,"broker/v1/account/sub-withdrawal":2,"broker/v1/account/sub-auto-transfer":4,"broker/v1/account/sub-api-create":2,"broker/v1/account/sub-api-modify":2,"v2/broker/account/modify-subaccount-email":2,"v2/broker/account/create-subaccount":20,"v2/broker/account/modify-subaccount":20,"v2/broker/account/subaccount-address":2,"v2/broker/account/subaccount-withdrawal":2,"v2/broker/account/set-subaccount-autotransfer":2,"v2/broker/manage/create-subaccount-apikey":2,"v2/broker/manage/modify-subaccount-apikey":2}},margin:{get:{"margin/v1/cross/account/riskRate":2,"margin/v1/cross/account/maxTransferOutAmount":2,"margin/v1/isolated/account/maxTransferOutAmount":2,"margin/v1/isolated/order/openOrders":2,"margin/v1/isolated/order/history":2,"margin/v1/isolated/order/fills":2,"margin/v1/isolated/loan/list":2,"margin/v1/isolated/repay/list":2,"margin/v1/isolated/interest/list":2,"margin/v1/isolated/liquidation/list":2,"margin/v1/isolated/fin/list":2,"margin/v1/cross/order/openOrders":2,"margin/v1/cross/order/history":2,"margin/v1/cross/order/fills":2,"margin/v1/cross/loan/list":2,"margin/v1/cross/repay/list":2,"margin/v1/cross/interest/list":2,"margin/v1/cross/liquidation/list":2,"margin/v1/cross/fin/list":2,"margin/v1/cross/account/assets":2,"margin/v1/isolated/account/assets":2,"v2/margin/crossed/borrow-history":2,"v2/margin/crossed/repay-history":2,"v2/margin/crossed/interest-history":2,"v2/margin/crossed/liquidation-history":2,"v2/margin/crossed/financial-records":2,"v2/margin/crossed/account/assets":2,"v2/margin/crossed/account/risk-rate":2,"v2/margin/crossed/account/max-borrowable-amount":2,"v2/margin/crossed/account/max-transfer-out-amount":2,"v2/margin/crossed/interest-rate-and-limit":2,"v2/margin/crossed/tier-data":2,"v2/margin/crossed/open-orders":2,"v2/margin/crossed/history-orders":2,"v2/margin/crossed/fills":2,"v2/margin/isolated/borrow-history":2,"v2/margin/isolated/repay-history":2,"v2/margin/isolated/interest-history":2,"v2/margin/isolated/liquidation-history":2,"v2/margin/isolated/financial-records":2,"v2/margin/isolated/account/assets":2,"v2/margin/isolated/account/risk-rate":2,"v2/margin/isolated/account/max-borrowable-amount":2,"v2/margin/isolated/account/max-transfer-out-amount":2,"v2/margin/isolated/interest-rate-and-limit":2,"v2/margin/isolated/tier-data":2,"v2/margin/isolated/open-orders":2,"v2/margin/isolated/history-orders":2,"v2/margin/isolated/fills":2},post:{"margin/v1/cross/account/borrow":2,"margin/v1/isolated/account/borrow":2,"margin/v1/cross/account/repay":2,"margin/v1/isolated/account/repay":2,"margin/v1/isolated/account/riskRate":2,"margin/v1/cross/account/maxBorrowableAmount":2,"margin/v1/isolated/account/maxBorrowableAmount":2,"margin/v1/isolated/account/flashRepay":2,"margin/v1/isolated/account/queryFlashRepayStatus":2,"margin/v1/cross/account/flashRepay":2,"margin/v1/cross/account/queryFlashRepayStatus":2,"margin/v1/isolated/order/placeOrder":4,"margin/v1/isolated/order/batchPlaceOrder":4,"margin/v1/isolated/order/cancelOrder":2,"margin/v1/isolated/order/batchCancelOrder":2,"margin/v1/cross/order/placeOrder":2,"margin/v1/cross/order/batchPlaceOrder":2,"margin/v1/cross/order/cancelOrder":2,"margin/v1/cross/order/batchCancelOrder":2,"v2/margin/crossed/account/borrow":2,"v2/margin/crossed/account/repay":2,"v2/margin/crossed/account/flash-repay":2,"v2/margin/crossed/account/query-flash-repay-status":2,"v2/margin/crossed/place-order":2,"v2/margin/crossed/batch-place-order":2,"v2/margin/crossed/cancel-order":2,"v2/margin/crossed/batch-cancel-order":2,"v2/margin/isolated/account/borrow":2,"v2/margin/isolated/account/repay":2,"v2/margin/isolated/account/flash-repay":2,"v2/margin/isolated/account/query-flash-repay-status":2,"v2/margin/isolated/place-order":2,"v2/margin/isolated/batch-place-order":2,"v2/margin/isolated/cancel-order":2,"v2/margin/isolated/batch-cancel-order":2}},copy:{get:{"v2/copy/mix-trader/order-current-track":2,"v2/copy/mix-trader/order-history-track":2,"v2/copy/mix-trader/order-total-detail":2,"v2/copy/mix-trader/profit-history-summarys":1,"v2/copy/mix-trader/profit-history-details":1,"v2/copy/mix-trader/profit-details":1,"v2/copy/mix-trader/profits-group-coin-date":1,"v2/copy/mix-trader/config-query-symbols":1,"v2/copy/mix-trader/config-query-followers":2,"v2/copy/mix-follower/query-current-orders":2,"v2/copy/mix-follower/query-history-orders":1,"v2/copy/mix-follower/query-settings":2,"v2/copy/mix-follower/query-traders":2,"v2/copy/mix-follower/query-quantity-limit":2,"v2/copy/mix-broker/query-traders":2,"v2/copy/mix-broker/query-history-traces":2,"v2/copy/mix-broker/query-current-traces":2,"v2/copy/spot-trader/profit-summarys":2,"v2/copy/spot-trader/profit-history-details":2,"v2/copy/spot-trader/profit-details":2,"v2/copy/spot-trader/order-total-detail":2,"v2/copy/spot-trader/order-history-track":2,"v2/copy/spot-trader/order-current-track":2,"v2/copy/spot-trader/config-query-settings":2,"v2/copy/spot-trader/config-query-followers":2,"v2/copy/spot-follower/query-traders":2,"v2/copy/spot-follower/query-trader-symbols":2,"v2/copy/spot-follower/query-settings":2,"v2/copy/spot-follower/query-history-orders":2,"v2/copy/spot-follower/query-current-orders":2},post:{"v2/copy/mix-trader/order-modify-tpsl":2,"v2/copy/mix-trader/order-close-positions":2,"v2/copy/mix-trader/config-setting-symbols":2,"v2/copy/mix-trader/config-setting-base":2,"v2/copy/mix-trader/config-remove-follower":2,"v2/copy/mix-follower/setting-tpsl":1,"v2/copy/mix-follower/settings":2,"v2/copy/mix-follower/close-positions":2,"v2/copy/mix-follower/cancel-trader":4,"v2/copy/spot-trader/order-modify-tpsl":2,"v2/copy/spot-trader/order-close-tracking":2,"v2/copy/spot-trader/config-setting-symbols":2,"v2/copy/spot-trader/config-remove-follower":2,"v2/copy/spot-follower/stop-order":2,"v2/copy/spot-follower/settings":2,"v2/copy/spot-follower/setting-tpsl":2,"v2/copy/spot-follower/order-close-tracking":2,"v2/copy/spot-follower/cancel-trader":2}},tax:{get:{"v2/tax/spot-record":20,"v2/tax/future-record":20,"v2/tax/margin-record":20,"v2/tax/p2p-record":20}},convert:{get:{"v2/convert/currencies":2,"v2/convert/quoted-price":2,"v2/convert/convert-record":2,"v2/convert/bgb-convert-coin-list":2,"v2/convert/bgb-convert-records":2},post:{"v2/convert/trade":2,"v2/convert/bgb-convert":2}},earn:{get:{"v2/earn/savings/product":2,"v2/earn/savings/account":2,"v2/earn/savings/assets":2,"v2/earn/savings/records":2,"v2/earn/savings/subscribe-info":2,"v2/earn/savings/subscribe-result":2,"v2/earn/savings/redeem-result":2,"v2/earn/sharkfin/product":2,"v2/earn/sharkfin/account":2,"v2/earn/sharkfin/assets":2,"v2/earn/sharkfin/records":2,"v2/earn/sharkfin/subscribe-info":2,"v2/earn/sharkfin/subscribe-result":4,"v2/earn/loan/ongoing-orders":2,"v2/earn/loan/repay-history":2,"v2/earn/loan/revise-history":2,"v2/earn/loan/borrow-history":2,"v2/earn/loan/debts":2,"v2/earn/loan/reduces":2},post:{"v2/earn/savings/subscribe":2,"v2/earn/savings/redeem":2,"v2/earn/sharkfin/subscribe":2,"v2/earn/loan/borrow":2,"v2/earn/loan/repay":2,"v2/earn/loan/revise-pledge":2}},common:{get:{"v2/common/trade-rate":2}}}},fees:{spot:{taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")},swap:{taker:this.parseNumber("0.0006"),maker:this.parseNumber("0.0004")}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},exceptions:{exact:{1:r.ExchangeError,"failure to get a peer from the ring-balancer":r.ExchangeNotAvailable,4010:r.PermissionDenied,4001:r.ExchangeError,4002:r.ExchangeError,30001:r.AuthenticationError,30002:r.AuthenticationError,30003:r.AuthenticationError,30004:r.AuthenticationError,30005:r.InvalidNonce,30006:r.AuthenticationError,30007:r.BadRequest,30008:r.RequestTimeout,30009:r.ExchangeError,30010:r.AuthenticationError,30011:r.PermissionDenied,30012:r.AuthenticationError,30013:r.AuthenticationError,30014:r.DDoSProtection,30015:r.AuthenticationError,30016:r.ExchangeError,30017:r.ExchangeError,30018:r.ExchangeError,30019:r.ExchangeNotAvailable,30020:r.BadRequest,30021:r.BadRequest,30022:r.PermissionDenied,30023:r.BadRequest,30024:r.BadSymbol,30025:r.BadRequest,30026:r.DDoSProtection,30027:r.AuthenticationError,30028:r.PermissionDenied,30029:r.AccountSuspended,30030:r.ExchangeError,30031:r.BadRequest,30032:r.BadSymbol,30033:r.BadRequest,30034:r.ExchangeError,30035:r.ExchangeError,30036:r.ExchangeError,30037:r.ExchangeNotAvailable,30038:r.OnMaintenance,32001:r.AccountSuspended,32002:r.PermissionDenied,32003:r.CancelPending,32004:r.ExchangeError,32005:r.InvalidOrder,32006:r.InvalidOrder,32007:r.InvalidOrder,32008:r.InvalidOrder,32009:r.InvalidOrder,32010:r.ExchangeError,32011:r.ExchangeError,32012:r.ExchangeError,32013:r.ExchangeError,32014:r.ExchangeError,32015:r.ExchangeError,32016:r.ExchangeError,32017:r.ExchangeError,32018:r.ExchangeError,32019:r.ExchangeError,32020:r.ExchangeError,32021:r.ExchangeError,32022:r.ExchangeError,32023:r.ExchangeError,32024:r.ExchangeError,32025:r.ExchangeError,32026:r.ExchangeError,32027:r.ExchangeError,32028:r.AccountSuspended,32029:r.ExchangeError,32030:r.InvalidOrder,32031:r.ArgumentsRequired,32038:r.AuthenticationError,32040:r.ExchangeError,32044:r.ExchangeError,32045:r.ExchangeError,32046:r.ExchangeError,32047:r.ExchangeError,32048:r.InvalidOrder,32049:r.ExchangeError,32050:r.InvalidOrder,32051:r.InvalidOrder,32052:r.ExchangeError,32053:r.ExchangeError,32057:r.ExchangeError,32054:r.ExchangeError,32055:r.InvalidOrder,32056:r.ExchangeError,32058:r.ExchangeError,32059:r.InvalidOrder,32060:r.InvalidOrder,32061:r.InvalidOrder,32062:r.InvalidOrder,32063:r.InvalidOrder,32064:r.ExchangeError,32065:r.ExchangeError,32066:r.ExchangeError,32067:r.ExchangeError,32068:r.ExchangeError,32069:r.ExchangeError,32070:r.ExchangeError,32071:r.ExchangeError,32072:r.ExchangeError,32073:r.ExchangeError,32074:r.ExchangeError,32075:r.ExchangeError,32076:r.ExchangeError,32077:r.ExchangeError,32078:r.ExchangeError,32079:r.ExchangeError,32080:r.ExchangeError,32083:r.ExchangeError,33001:r.PermissionDenied,33002:r.AccountSuspended,33003:r.InsufficientFunds,33004:r.ExchangeError,33005:r.ExchangeError,33006:r.ExchangeError,33007:r.ExchangeError,33008:r.InsufficientFunds,33009:r.ExchangeError,33010:r.ExchangeError,33011:r.ExchangeError,33012:r.ExchangeError,33013:r.InvalidOrder,33014:r.OrderNotFound,33015:r.InvalidOrder,33016:r.ExchangeError,33017:r.InsufficientFunds,33018:r.ExchangeError,33020:r.ExchangeError,33021:r.BadRequest,33022:r.InvalidOrder,33023:r.ExchangeError,33024:r.InvalidOrder,33025:r.InvalidOrder,33026:r.ExchangeError,33027:r.InvalidOrder,33028:r.InvalidOrder,33029:r.InvalidOrder,33034:r.ExchangeError,33035:r.ExchangeError,33036:r.ExchangeError,33037:r.ExchangeError,33038:r.ExchangeError,33039:r.ExchangeError,33040:r.ExchangeError,33041:r.ExchangeError,33042:r.ExchangeError,33043:r.ExchangeError,33044:r.ExchangeError,33045:r.ExchangeError,33046:r.ExchangeError,33047:r.ExchangeError,33048:r.ExchangeError,33049:r.ExchangeError,33050:r.ExchangeError,33051:r.ExchangeError,33059:r.BadRequest,33060:r.BadRequest,33061:r.ExchangeError,33062:r.ExchangeError,33063:r.ExchangeError,33064:r.ExchangeError,33065:r.ExchangeError,21009:r.ExchangeError,34001:r.PermissionDenied,34002:r.InvalidAddress,34003:r.ExchangeError,34004:r.ExchangeError,34005:r.ExchangeError,34006:r.ExchangeError,34007:r.ExchangeError,34008:r.InsufficientFunds,34009:r.ExchangeError,34010:r.ExchangeError,34011:r.ExchangeError,34012:r.ExchangeError,34013:r.ExchangeError,34014:r.ExchangeError,34015:r.ExchangeError,34016:r.PermissionDenied,34017:r.AccountSuspended,34018:r.AuthenticationError,34019:r.PermissionDenied,34020:r.PermissionDenied,34021:r.InvalidAddress,34022:r.ExchangeError,34023:r.PermissionDenied,34026:r.ExchangeError,34036:r.ExchangeError,34037:r.ExchangeError,34038:r.ExchangeError,34039:r.ExchangeError,35001:r.ExchangeError,35002:r.ExchangeError,35003:r.ExchangeError,35004:r.ExchangeError,35005:r.AuthenticationError,35008:r.InvalidOrder,35010:r.InvalidOrder,35012:r.InvalidOrder,35014:r.InvalidOrder,35015:r.InvalidOrder,35017:r.ExchangeError,35019:r.InvalidOrder,35020:r.InvalidOrder,35021:r.InvalidOrder,35022:r.ExchangeError,35024:r.ExchangeError,35025:r.InsufficientFunds,35026:r.ExchangeError,35029:r.OrderNotFound,35030:r.InvalidOrder,35031:r.InvalidOrder,35032:r.ExchangeError,35037:r.ExchangeError,35039:r.ExchangeError,35040:r.InvalidOrder,35044:r.ExchangeError,35046:r.InsufficientFunds,35047:r.InsufficientFunds,35048:r.ExchangeError,35049:r.InvalidOrder,35050:r.InvalidOrder,35052:r.InsufficientFunds,35053:r.ExchangeError,35055:r.InsufficientFunds,35057:r.ExchangeError,35058:r.ExchangeError,35059:r.BadRequest,35060:r.BadRequest,35061:r.BadRequest,35062:r.InvalidOrder,35063:r.InvalidOrder,35064:r.InvalidOrder,35066:r.InvalidOrder,35067:r.InvalidOrder,35068:r.InvalidOrder,35069:r.InvalidOrder,35070:r.InvalidOrder,35071:r.InvalidOrder,35072:r.InvalidOrder,35073:r.InvalidOrder,35074:r.InvalidOrder,35075:r.InvalidOrder,35076:r.InvalidOrder,35077:r.InvalidOrder,35078:r.InvalidOrder,35079:r.InvalidOrder,35080:r.InvalidOrder,35081:r.InvalidOrder,35082:r.InvalidOrder,35083:r.InvalidOrder,35084:r.InvalidOrder,35085:r.InvalidOrder,35086:r.InvalidOrder,35087:r.InvalidOrder,35088:r.InvalidOrder,35089:r.InvalidOrder,35090:r.ExchangeError,35091:r.ExchangeError,35092:r.ExchangeError,35093:r.ExchangeError,35094:r.ExchangeError,35095:r.BadRequest,35096:r.ExchangeError,35097:r.ExchangeError,35098:r.ExchangeError,35099:r.ExchangeError,36001:r.BadRequest,36002:r.BadRequest,36005:r.ExchangeError,36101:r.AuthenticationError,36102:r.PermissionDenied,36103:r.AccountSuspended,36104:r.PermissionDenied,36105:r.PermissionDenied,36106:r.AccountSuspended,36107:r.PermissionDenied,36108:r.InsufficientFunds,36109:r.PermissionDenied,36201:r.PermissionDenied,36202:r.PermissionDenied,36203:r.InvalidOrder,36204:r.ExchangeError,36205:r.BadRequest,36206:r.BadRequest,36207:r.InvalidOrder,36208:r.InvalidOrder,36209:r.InvalidOrder,36210:r.InvalidOrder,36211:r.InvalidOrder,36212:r.InvalidOrder,36213:r.InvalidOrder,36214:r.ExchangeError,36216:r.OrderNotFound,36217:r.InvalidOrder,36218:r.InvalidOrder,36219:r.InvalidOrder,36220:r.InvalidOrder,36221:r.InvalidOrder,36222:r.InvalidOrder,36223:r.InvalidOrder,36224:r.InvalidOrder,36225:r.InvalidOrder,36226:r.InvalidOrder,36227:r.InvalidOrder,36228:r.InvalidOrder,36229:r.InvalidOrder,36230:r.InvalidOrder,400:r.BadRequest,401:r.AuthenticationError,403:r.PermissionDenied,404:r.BadRequest,405:r.BadRequest,415:r.BadRequest,429:r.DDoSProtection,500:r.ExchangeNotAvailable,1001:r.RateLimitExceeded,1002:r.ExchangeError,1003:r.ExchangeError,40001:r.AuthenticationError,40002:r.AuthenticationError,40003:r.AuthenticationError,40004:r.InvalidNonce,40005:r.InvalidNonce,40006:r.AuthenticationError,40007:r.BadRequest,40008:r.InvalidNonce,40009:r.AuthenticationError,40010:r.AuthenticationError,40011:r.AuthenticationError,40012:r.AuthenticationError,40013:r.ExchangeError,40014:r.PermissionDenied,40015:r.ExchangeError,40016:r.PermissionDenied,40017:r.ExchangeError,40018:r.PermissionDenied,40019:r.BadRequest,40031:r.AccountSuspended,40037:r.AuthenticationError,40102:r.BadRequest,40103:r.BadRequest,40104:r.ExchangeError,40105:r.ExchangeError,40106:r.ExchangeError,40107:r.ExchangeError,40108:r.InvalidOrder,40109:r.OrderNotFound,40200:r.OnMaintenance,40201:r.InvalidOrder,40202:r.ExchangeError,40203:r.BadRequest,40204:r.BadRequest,40205:r.BadRequest,40206:r.BadRequest,40207:r.BadRequest,40208:r.BadRequest,40209:r.BadRequest,40300:r.ExchangeError,40301:r.PermissionDenied,40302:r.BadRequest,40303:r.BadRequest,40304:r.BadRequest,40305:r.BadRequest,40306:r.ExchangeError,40308:r.OnMaintenance,40309:r.BadSymbol,40400:r.ExchangeError,40401:r.ExchangeError,40402:r.BadRequest,40403:r.BadRequest,40404:r.BadRequest,40405:r.BadRequest,40406:r.BadRequest,40407:r.ExchangeError,40408:r.ExchangeError,40409:r.ExchangeError,40500:r.InvalidOrder,40501:r.ExchangeError,40502:r.ExchangeError,40503:r.ExchangeError,40504:r.ExchangeError,40505:r.ExchangeError,40506:r.AuthenticationError,40507:r.AuthenticationError,40508:r.ExchangeError,40509:r.ExchangeError,40600:r.ExchangeError,40601:r.ExchangeError,40602:r.ExchangeError,40603:r.ExchangeError,40604:r.ExchangeNotAvailable,40605:r.ExchangeError,40606:r.ExchangeError,40607:r.ExchangeError,40608:r.ExchangeError,40609:r.ExchangeError,40700:r.BadRequest,40701:r.ExchangeError,40702:r.ExchangeError,40703:r.ExchangeError,40704:r.ExchangeError,40705:r.BadRequest,40706:r.InvalidOrder,40707:r.BadRequest,40708:r.BadRequest,40709:r.ExchangeError,40710:r.ExchangeError,40711:r.InsufficientFunds,40712:r.InsufficientFunds,40713:r.ExchangeError,40714:r.ExchangeError,40768:r.OrderNotFound,41114:r.OnMaintenance,43011:r.InvalidOrder,43012:r.InsufficientFunds,43025:r.InvalidOrder,43115:r.OnMaintenance,45110:r.InvalidOrder,"invalid sign":r.AuthenticationError,"invalid currency":r.BadSymbol,"invalid symbol":r.BadSymbol,"invalid period":r.BadRequest,"invalid user":r.ExchangeError,"invalid amount":r.InvalidOrder,"invalid type":r.InvalidOrder,"invalid orderId":r.InvalidOrder,"invalid record":r.ExchangeError,"invalid accountId":r.BadRequest,"invalid address":r.BadRequest,"accesskey not null":r.AuthenticationError,"illegal accesskey":r.AuthenticationError,"sign not null":r.AuthenticationError,"req_time is too much difference from server time":r.InvalidNonce,"permissions not right":r.PermissionDenied,"illegal sign invalid":r.AuthenticationError,"user locked":r.AccountSuspended,"Request Frequency Is Too High":r.RateLimitExceeded,"more than a daily rate of cash":r.BadRequest,"more than the maximum daily withdrawal amount":r.BadRequest,"need to bind email or mobile":r.ExchangeError,"user forbid":r.PermissionDenied,"User Prohibited Cash Withdrawal":r.PermissionDenied,"Cash Withdrawal Is Less Than The Minimum Value":r.BadRequest,"Cash Withdrawal Is More Than The Maximum Value":r.BadRequest,"the account with in 24 hours ban coin":r.PermissionDenied,"order cancel fail":r.BadRequest,"base symbol error":r.BadSymbol,"base date error":r.ExchangeError,"api signature not valid":r.AuthenticationError,"gateway internal error":r.ExchangeError,"audit failed":r.ExchangeError,"order queryorder invalid":r.BadRequest,"market no need price":r.InvalidOrder,"limit need price":r.InvalidOrder,"userid not equal to account_id":r.ExchangeError,"your balance is low":r.InsufficientFunds,"address invalid cointype":r.ExchangeError,"system exception":r.ExchangeError,50003:r.ExchangeError,50004:r.BadSymbol,50006:r.PermissionDenied,50007:r.PermissionDenied,50008:r.RequestTimeout,50009:r.RateLimitExceeded,50010:r.ExchangeError,50014:r.InvalidOrder,50015:r.InvalidOrder,50016:r.InvalidOrder,50017:r.InvalidOrder,50018:r.InvalidOrder,50019:r.InvalidOrder,50020:r.InsufficientFunds,50021:r.InvalidOrder,50026:r.InvalidOrder,"invalid order query time":r.ExchangeError,"invalid start time":r.BadRequest,"invalid end time":r.BadRequest,20003:r.ExchangeError,"01001":r.ExchangeError,43111:r.PermissionDenied},broad:{"invalid size, valid range":r.ExchangeError}},precisionMode:o.sh,commonCurrencies:{JADE:"Jade Protocol",DEGEN:"DegenReborn",TONCOIN:"TON"},options:{timeframes:{spot:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1h","4h":"4h","6h":"6Hutc","12h":"12Hutc","1d":"1Dutc","3d":"3Dutc","1w":"1Wutc","1M":"1Mutc"},swap:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","6h":"6Hutc","12h":"12Hutc","1d":"1Dutc","3d":"3Dutc","1w":"1Wutc","1M":"1Mutc"}},fetchMarkets:["spot","swap"],defaultType:"spot",defaultSubType:"linear",createMarketBuyOrderRequiresPrice:!0,broker:"p4sve",withdraw:{fillResponseFromRequest:!0},fetchOHLCV:{spot:{method:"publicSpotGetV2SpotMarketCandles"},swap:{method:"publicMixGetV2MixMarketCandles"},maxDaysPerTimeframe:{"1m":30,"3m":30,"5m":30,"10m":52,"15m":52,"30m":52,"1h":83,"2h":120,"4h":240,"6h":360,"12h":360,"1d":360,"3d":1e3,"1w":1e3,"1M":1e3}},fetchTrades:{spot:{method:"publicSpotGetV2SpotMarketFillsHistory"},swap:{method:"publicMixGetV2MixMarketFillsHistory"}},accountsByType:{spot:"spot",cross:"crossed_margin",isolated:"isolated_margin",swap:"usdt_futures",usdc_swap:"usdc_futures",future:"coin_futures",p2p:"p2p"},accountsById:{spot:"spot",crossed_margin:"cross",isolated_margin:"isolated",usdt_futures:"swap",usdc_futures:"usdc_swap",coin_futures:"future",p2p:"p2p"},sandboxMode:!1,networks:{TRX:"TRC20",ETH:"ERC20",BSC:"BEP20"},networksById:{TRC20:"TRX",BSC:"BEP20"},fetchPositions:{method:"privateMixGetV2MixPositionAllPosition"},defaultTimeInForce:"GTC"}})}setSandboxMode(e){this.options.sandboxMode=e}convertSymbolForSandbox(e){if(e.startsWith("S"))return e;let t;if(e.indexOf("/")>-1){if(-1===e.indexOf(":"))throw new r.NotSupported(this.id+" sandbox supports swap and future markets only");const s=e.split("/"),i=this.safeString(s,0),a=this.safeString(s,1).split(":"),o=this.safeString(a,0),n=this.safeString(a,1).split("-"),d=this.safeString(n,0),h=this.safeString(n,1);t="S"+i+"/S"+o+":S"+d,void 0!==h&&(t=t+"-"+h)}else{t="S"+e.slice(0,3)+"S"+e.slice(3)}return t}handleProductTypeAndParams(e=void 0,t={}){let s,i;if([s,t]=this.handleSubTypeAndParams("handleProductTypeAndParams",void 0,t),void 0!==s&&void 0===e){i=this.safeBool(this.options,"sandboxMode",!1)?"linear"===s?"SUSDT-FUTURES":"SCOIN-FUTURES":"linear"===s?"USDT-FUTURES":"COIN-FUTURES"}let a=this.safeString(t,"productType",i);if(void 0===a&&void 0!==e){const t=e.settle;a="USDT"===t?"USDT-FUTURES":"USDC"===t?"USDC-FUTURES":"SUSDT"===t?"SUSDT-FUTURES":"SUSDC"===t?"SUSDC-FUTURES":"SBTC"===t||"SETH"===t||"SEOS"===t?"SCOIN-FUTURES":"COIN-FUTURES"}if(void 0===a)throw new r.ArgumentsRequired(this.id+' requires a productType param, one of "USDT-FUTURES", "USDC-FUTURES", "COIN-FUTURES", "SUSDT-FUTURES", "SUSDC-FUTURES" or "SCOIN-FUTURES"');return[a,t=this.omit(t,"productType")]}async fetchTime(e={}){const t=await this.publicCommonGetV2PublicTime(e),s=this.safeValue(t,"data",{});return this.safeInteger(s,"serverTime")}async fetchMarkets(e={}){const t=this.safeBool(this.options,"sandboxMode",!1);let s=this.safeValue(this.options,"fetchMarkets",["spot","swap"]);t&&(s=["swap"]);let i=[];for(let r=0;re*c)throw new r.BadRequest(this.id+" fetchOHLCV() between start and end must be less than "+e.toString()+" days")}else u.endTime=Math.min(T,this.sum(s,e*c));let t,i;[t,a]=this.handleParamString(a,"price"),[i,a]=this.handleProductTypeAndParams(n,a),u.productType=i;const o=this.extend(u,a);v="mark"===t?await this.publicMixGetV2MixMarketHistoryMarkCandles(o):"index"===t?await this.publicMixGetV2MixMarketHistoryIndexCandles(o):P?await this.publicMixGetV2MixMarketHistoryCandles(o):await this.publicMixGetV2MixMarketCandles(o)}if(""===v)return[];const x=this.safeList(v,"data",v);return this.parseOHLCVs(x,n,t,s,i)}async fetchBalance(e={}){await this.loadMarkets();const t={};let s,i,a;if([s,e]=this.handleMarketTypeAndParams("fetchBalance",void 0,e),[i,e]=this.handleMarginModeAndParams("fetchBalance",e),"swap"===s||"future"===s){let s;[s,e]=this.handleProductTypeAndParams(void 0,e),t.productType=s,a=await this.privateMixGetV2MixAccountAccounts(this.extend(t,e))}else if("isolated"===i)a=await this.privateMarginGetMarginV1IsolatedAccountAssets(this.extend(t,e));else if("cross"===i)a=await this.privateMarginGetMarginV1CrossAccountAssets(this.extend(t,e));else{if("spot"!==s)throw new r.NotSupported(this.id+" fetchBalance() does not support "+s+" accounts");a=await this.privateSpotGetV2SpotAccountAssets(this.extend(t,e))}const o=this.safeValue(a,"data",[]);return this.parseBalance(o)}parseBalance(e){const t={info:e};for(let s=0;s1)throw new r.ExchangeError(this.id+" createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent");"limit"===t&&(l.price=this.priceToPrecision(e,o));const M=this.safeString(n,"triggerType","mark_price"),A=this.safeBool(n,"reduceOnly",!1),C=this.safeString2(n,"clientOid","clientOrderId"),E=this.safeString2(n,"force","timeInForce");let _;[_,n]=this.handlePostOnly(u,"post_only"===E,n);const B=this.safeStringUpper(this.options,"defaultTimeInForce"),N=this.safeStringUpper(n,"timeInForce",B);if(_?l.force="post_only":"GTC"===N?l.force="GTC":"FOK"===N?l.force="FOK":"IOC"===N&&(l.force="IOC"),n=this.omit(n,["stopPrice","triggerType","stopLossPrice","takeProfitPrice","stopLoss","takeProfit","postOnly","reduceOnly","clientOrderId","trailingPercent","trailingTriggerPrice"]),"swap"===h||"future"===h){let t;if(l.marginCoin=d.settleId,l.size=this.amountToPrecision(e,i),[t,n]=this.handleProductTypeAndParams(d,n),l.productType=t,void 0!==C&&(l.clientOid=C),(y||O||I)&&(l.triggerType=M),I){if(!u)throw new r.BadRequest(this.id+" createOrder() bitget trailing orders must be market orders");if(void 0===P)throw new r.ArgumentsRequired(this.id+" createOrder() bitget trailing orders must have a trailingTriggerPrice param");l.planType="track_plan",l.triggerPrice=this.priceToPrecision(e,P),l.callbackRatio=x}else if(y){if(l.planType="normal_plan",l.triggerPrice=this.priceToPrecision(e,p),void 0!==o&&(l.executePrice=this.priceToPrecision(e,o)),S){const t=this.safeNumber2(g,"triggerPrice","stopPrice");l.stopLossTriggerPrice=this.priceToPrecision(e,t);const s=this.safeNumber(g,"price");l.stopLossExecutePrice=this.priceToPrecision(e,s);const i=this.safeString(g,"type","mark_price");l.stopLossTriggerType=i}if(k){const t=this.safeNumber2(v,"triggerPrice","stopPrice");l.stopSurplusTriggerPrice=this.priceToPrecision(e,t);const s=this.safeNumber(v,"price");l.stopSurplusExecutePrice=this.priceToPrecision(e,s);const i=this.safeString(v,"type","mark_price");l.stopSurplusTriggerType=i}}else if(O){if(!u)throw new r.ExchangeError(this.id+" createOrder() bitget stopLoss or takeProfit orders must be market orders");l.holdSide="buy"===s?"long":"short",w?(l.triggerPrice=this.priceToPrecision(e,f),l.planType="pos_loss"):b&&(l.triggerPrice=this.priceToPrecision(e,m),l.planType="pos_profit")}else{if(S){const t=this.safeValue2(g,"triggerPrice","stopPrice");l.presetStopLossPrice=this.priceToPrecision(e,t)}if(k){const t=this.safeValue2(v,"triggerPrice","stopPrice");l.presetStopSurplusPrice=this.priceToPrecision(e,t)}}if(!O){void 0===c&&(c="cross");const e="cross"===c?"crossed":"isolated";l.marginMode=e;const t=this.safeBool(n,"oneWayMode",!1);n=this.omit(n,"oneWayMode");let i=s;A?t?l.reduceOnly="YES":(i="buy"===s?"sell":"buy",l.tradeSide="Close"):t||(l.tradeSide="Open"),l.side=i}}else{if("spot"!==h)throw new r.NotSupported(this.id+" createOrder() does not support "+h+" orders");{if(O||T)throw new r.InvalidOrder(this.id+" createOrder() does not support stop loss/take profit orders on spot markets, only swap markets");let t,d;l.side=s;let h=!0;if([h,n]=this.handleOptionAndParams(n,"createOrder","createMarketBuyOrderRequiresPrice",!0),u&&"buy"===s){d="total";const s=this.safeNumber(n,"cost");if(n=this.omit(n,"cost"),void 0!==s)t=this.costToPrecision(e,s);else if(h){if(void 0===o)throw new r.InvalidOrder(this.id+" createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument");{const s=this.numberToString(i),r=this.numberToString(o),n=a.O.stringMul(s,r);t=this.costToPrecision(e,n)}}else t=this.costToPrecision(e,i)}else d="amount",t=this.amountToPrecision(e,i);void 0!==C&&(l.clientOid=C),void 0!==c?(l.loanType="normal",h&&u&&"buy"===s?l.quoteSize=t:l.baseSize=t):(void 0!==t&&(l.size=t),void 0!==p&&(l.planType=d,l.triggerType=M,l.triggerPrice=this.priceToPrecision(e,p),void 0!==o&&(l.executePrice=this.priceToPrecision(e,o))))}}return this.extend(l,n)}async createOrders(e,t={}){await this.loadMarkets();const s=[];let i,a;for(let t=0;t1)throw new r.ExchangeError(this.id+" editOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent");const P=this.safeString2(d,"clientOid","clientOrderId");let x;if(void 0!==P&&(c.clientOid=P),d=this.omit(d,["stopPrice","triggerType","stopLossPrice","takeProfitPrice","stopLoss","takeProfit","clientOrderId","trailingTriggerPrice","trailingPercent"]),h.spot){if(void 0===u)throw new r.NotSupported(this.id+"editOrder() only supports plan/trigger spot orders");if(this.safeBool(this.options,"editMarketBuyOrderRequiresPrice",!0)&&l&&"buy"===i){if(void 0===n)throw new r.InvalidOrder(this.id+" editOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the editMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter");{const e=this.numberToString(o),s=this.numberToString(n),i=this.parseNumber(a.O.stringMul(e,s));c.size=this.priceToPrecision(t,i)}}else c.size=this.amountToPrecision(t,o);c.orderType=s,c.triggerPrice=this.priceToPrecision(t,u),c.executePrice=this.priceToPrecision(t,n),x=await this.privateSpotPostV2SpotTradeModifyPlanOrder(this.extend(c,d))}else{if(!h.swap&&!h.future)throw new r.NotSupported(this.id+" editOrder() does not support "+h.type+" orders");let e;if(c.symbol=h.id,[e,d]=this.handleProductTypeAndParams(h,d),c.productType=e,v||m||(c.newSize=this.amountToPrecision(t,o),void 0===n||T||(c.newPrice=this.priceToPrecision(t,n))),T){if(!l)throw new r.BadRequest(this.id+" editOrder() bitget trailing orders must be market orders");void 0!==k&&(c.newTriggerPrice=this.priceToPrecision(t,k)),c.newCallbackRatio=O,x=await this.privateMixPostV2MixOrderModifyPlanOrder(this.extend(c,d))}else if(v||m)c.marginCoin=h.settleId,c.size=this.amountToPrecision(t,o),c.executePrice=this.priceToPrecision(t,n),m?c.triggerPrice=this.priceToPrecision(t,f):v&&(c.triggerPrice=this.priceToPrecision(t,g)),x=await this.privateMixPostV2MixOrderModifyTpslOrder(this.extend(c,d));else if(p){if(c.newTriggerPrice=this.priceToPrecision(t,u),b){const e=this.safeNumber2(y,"triggerPrice","stopPrice");c.newStopLossTriggerPrice=this.priceToPrecision(t,e);const s=this.safeNumber(y,"price");c.newStopLossExecutePrice=this.priceToPrecision(t,s);const i=this.safeString(y,"type","mark_price");c.newStopLossTriggerType=i}if(S){const e=this.safeNumber2(w,"triggerPrice","stopPrice");c.newSurplusTriggerPrice=this.priceToPrecision(t,e);const s=this.safeNumber(w,"price");c.newStopSurplusExecutePrice=this.priceToPrecision(t,s);const i=this.safeString(w,"type","mark_price");c.newStopSurplusTriggerType=i}x=await this.privateMixPostV2MixOrderModifyPlanOrder(this.extend(c,d))}else{const e=this.uuid(),s=this.safeString2(d,"newClientOid","newClientOrderId",e);if(d=this.omit(d,"newClientOrderId"),c.newClientOid=s,b){const e=this.safeValue2(y,"triggerPrice","stopPrice");c.newPresetStopLossPrice=this.priceToPrecision(t,e)}if(S){const e=this.safeValue2(w,"triggerPrice","stopPrice");c.newPresetStopSurplusPrice=this.priceToPrecision(t,e)}x=await this.privateMixPostV2MixOrderModifyOrder(this.extend(c,d))}}const I=this.safeDict(x,"data",{});return this.parseOrder(I,h)}async cancelOrder(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");await this.loadMarkets();let i,a,o;if(this.safeBool(this.options,"sandboxMode",!1)){const e=this.convertSymbolForSandbox(t);i=this.market(e)}else i=this.market(t);[a,s]=this.handleMarginModeAndParams("cancelOrder",s);const n={},d=this.safeValue(s,"trailing"),h=this.safeValue2(s,"stop","trigger");if(s=this.omit(s,["stop","trigger","trailing"]),i.spot&&h||(n.symbol=i.id),(i.swap||i.future)&&h||(n.orderId=e),i.swap||i.future){let t;if([t,s]=this.handleProductTypeAndParams(i,s),n.productType=t,h||d){const t=[],s={orderId:e};t.push(s),n.orderIdList=t}if(d){const e=this.safeString(s,"planType","track_plan");n.planType=e,o=await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(n,s))}else o=h?await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(n,s)):await this.privateMixPostV2MixOrderCancelOrder(this.extend(n,s))}else{if(!i.spot)throw new r.NotSupported(this.id+" cancelOrder() does not support "+i.type+" orders");void 0!==a?"isolated"===a?o=await this.privateMarginPostV2MarginIsolatedCancelOrder(this.extend(n,s)):"cross"===a&&(o=await this.privateMarginPostV2MarginCrossedCancelOrder(this.extend(n,s))):o=h?await this.privateSpotPostV2SpotTradeCancelPlanOrder(this.extend(n,s)):await this.privateSpotPostV2SpotTradeCancelOrder(this.extend(n,s))}const c=this.safeValue(o,"data",{});let l;if((i.swap||i.future)&&h){l=this.safeValue(c,"successList",[])[0]}else l=c;return this.parseOrder(l,i)}async cancelOrders(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrders() requires a symbol argument");await this.loadMarkets();let i,a;if(this.safeBool(this.options,"sandboxMode",!1)){const e=this.convertSymbolForSandbox(t);i=this.market(e)}else i=this.market(t);[a,s]=this.handleMarginModeAndParams("cancelOrders",s);const o=this.safeValue2(s,"stop","trigger");s=this.omit(s,["stop","trigger"]);const n=[];for(let t=0;t=0&&(c="out"),{info:e,id:this.safeString(e,"billId"),timestamp:r,datetime:this.iso8601(r),direction:c,account:void 0,referenceId:void 0,referenceAccount:void 0,type:this.parseLedgerType(this.safeString(e,"businessType")),currency:i,amount:h,before:void 0,after:o,status:void 0,fee:n}}parseLedgerType(e){return this.safeString({trans_to_cross:"transfer",trans_from_cross:"transfer",trans_to_exchange:"transfer",trans_from_exchange:"transfer",trans_to_isolated:"transfer",trans_from_isolated:"transfer",trans_to_contract:"transfer",trans_from_contract:"transfer",trans_to_otc:"transfer",trans_from_otc:"transfer",open_long:"trade",close_long:"trade",open_short:"trade",close_short:"trade",force_close_long:"trade",force_close_short:"trade",burst_long_loss_query:"trade",burst_short_loss_query:"trade",force_buy:"trade",force_sell:"trade",burst_buy:"trade",burst_sell:"trade",delivery_long:"settlement",delivery_short:"settlement",contract_settle_fee:"fee",append_margin:"transaction",adjust_down_lever_append_margin:"transaction",reduce_margin:"transaction",auto_append_margin:"transaction",cash_gift_issue:"cashback",cash_gift_recycle:"cashback",bonus_issue:"rebate",bonus_recycle:"rebate",bonus_expired:"rebate",transfer_in:"transfer",transfer_out:"transfer",deposit:"deposit",withdraw:"withdrawal",buy:"trade",sell:"trade"},e,e)}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument");await this.loadMarkets();let a,o;if(this.safeBool(this.options,"sandboxMode",!1)){const t=this.convertSymbolForSandbox(e);a=this.market(t)}else a=this.market(e);[o,i]=this.handleMarginModeAndParams("fetchMyTrades",i);let n,d=!1;if([d,i]=this.handleOptionAndParams(i,"fetchMyTrades","paginate"),d){let r;return a.spot?void 0!==o&&(r="minId"):r="endId",await this.fetchPaginatedCallCursor("fetchMyTrades",e,t,s,i,r,"idLessThan")}let h={symbol:a.id};if([h,i]=this.handleUntilOption("endTime",h,i),void 0!==t&&(h.startTime=t),void 0!==s&&(h.limit=s),a.spot)void 0!==o?(void 0===t&&(h.startTime=this.milliseconds()-7776e6),"isolated"===o?n=await this.privateMarginGetV2MarginIsolatedFills(this.extend(h,i)):"cross"===o&&(n=await this.privateMarginGetV2MarginCrossedFills(this.extend(h,i)))):n=await this.privateSpotGetV2SpotTradeFills(this.extend(h,i));else{let e;[e,i]=this.handleProductTypeAndParams(a,i),h.productType=e,n=await this.privateMixGetV2MixOrderFills(this.extend(h,i))}const c=this.safeValue(n,"data");if(a.swap||a.future){const e=this.safeList(c,"fillList",[]);return this.parseTrades(e,a,t,s)}if(void 0!==o){const e=this.safeList(c,"fills",[]);return this.parseTrades(e,a,t,s)}return this.parseTrades(c,a,t,s)}async fetchPosition(e,t={}){await this.loadMarkets();let s,i;if(this.safeBool(this.options,"sandboxMode",!1)){const t=this.convertSymbolForSandbox(e);s=this.market(t)}else s=this.market(e);[i,t]=this.handleProductTypeAndParams(s,t);const r={symbol:s.id,marginCoin:s.settleId,productType:i},a=await this.privateMixGetV2MixPositionSinglePosition(this.extend(r,t)),o=this.safeList(a,"data",[]),n=this.safeDict(o,0,{});return this.parsePosition(n,s)}async fetchPositions(e=void 0,t={}){await this.loadMarkets();let s,i=!1;if([i,t]=this.handleOptionAndParams(t,"fetchPositions","paginate"),i)return await this.fetchPaginatedCallCursor("fetchPositions",void 0,void 0,void 0,t,"endId","idLessThan");let a,o;if(this.safeBool(t,"useHistoryEndpoint",!1)?s="privateMixGetV2MixPositionHistoryPosition":[s,t]=this.handleOptionAndParams(t,"fetchPositions","method","privateMixGetV2MixPositionAllPosition"),void 0!==e){const t=this.safeString(e,0);if(this.safeBool(this.options,"sandboxMode",!1)){const e=this.convertSymbolForSandbox(t);a=this.market(e)}else a=this.market(t)}[o,t]=this.handleProductTypeAndParams(a,t);const n={productType:o};let d,h=!1;if("privateMixGetV2MixPositionAllPosition"===s){let s=this.safeString(t,"marginCoin","USDT");if(void 0!==e)s=a.settleId;else if("USDT-FUTURES"===o)s="USDT";else if("USDC-FUTURES"===o)s="USDC";else if("SUSDT-FUTURES"===o)s="SUSDT";else if("SUSDC-FUTURES"===o)s="SUSDC";else if(("SCOIN-FUTURES"===o||"COIN-FUTURES"===o)&&void 0===s)throw new r.ArgumentsRequired(this.id+" fetchPositions() requires a marginCoin parameter that matches the productType");n.marginCoin=s,d=await this.privateMixGetV2MixPositionAllPosition(this.extend(n,t))}else h=!0,void 0!==a&&(n.symbol=a.id),d=await this.privateMixGetV2MixPositionHistoryPosition(this.extend(n,t));let c=[];if(h){const e=this.safeDict(d,"data",{});c=this.safeList(e,"list",[])}else c=this.safeList(d,"data",[]);const l=[];for(let e=0;e0)throw new r.BadRequest(this.id+" reduceMargin() amount parameter must be a negative value");if(void 0===this.safeString(s,"holdSide"))throw new r.ArgumentsRequired(this.id+" reduceMargin() requires a holdSide parameter, either long or short");return await this.modifyMarginHelper(e,t,"reduce",s)}async addMargin(e,t,s={}){if(void 0===this.safeString(s,"holdSide"))throw new r.ArgumentsRequired(this.id+" addMargin() requires a holdSide parameter, either long or short");return await this.modifyMarginHelper(e,t,"add",s)}async fetchLeverage(e,t={}){await this.loadMarkets();let s,i;if(this.safeBool(this.options,"sandboxMode",!1)){const t=this.convertSymbolForSandbox(e);s=this.market(t)}else s=this.market(e);[i,t]=this.handleProductTypeAndParams(s,t);const r={symbol:s.id,marginCoin:s.settleId,productType:i},a=await this.privateMixGetV2MixAccountAccount(this.extend(r,t)),o=this.safeDict(a,"data",{});return this.parseLeverage(o,s)}parseLeverage(e,t=void 0){return{info:e,symbol:t.symbol,marginMode:"isolated",longLeverage:this.safeInteger(e,"isolatedLongLever"),shortLeverage:this.safeInteger(e,"isolatedShortLever")}}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");await this.loadMarkets();let i,a;if(this.safeBool(this.options,"sandboxMode",!1)){const e=this.convertSymbolForSandbox(t);i=this.market(e)}else i=this.market(t);[a,s]=this.handleProductTypeAndParams(i,s);const o={symbol:i.id,marginCoin:i.settleId,leverage:this.numberToString(e),productType:a};return await this.privateMixPostV2MixAccountSetLeverage(this.extend(o,s))}async setMarginMode(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("cross"===(e=e.toLowerCase())&&(e="crossed"),"isolated"!==e&&"crossed"!==e)throw new r.ArgumentsRequired(this.id+" setMarginMode() marginMode must be either isolated or crossed (cross)");await this.loadMarkets();let i,a;if(this.safeBool(this.options,"sandboxMode",!1)){const e=this.convertSymbolForSandbox(t);i=this.market(e)}else i=this.market(t);[a,s]=this.handleProductTypeAndParams(i,s);const o={symbol:i.id,marginCoin:i.settleId,marginMode:e,productType:a};return await this.privateMixPostV2MixAccountSetMarginMode(this.extend(o,s))}async setPositionMode(e,t=void 0,s={}){await this.loadMarkets();const i=e?"hedge_mode":"one_way_mode";let r,a;if(void 0!==t){if(this.safeBool(this.options,"sandboxMode",!1)){const e=this.convertSymbolForSandbox(t);r=this.market(e)}else r=this.market(t)}[a,s]=this.handleProductTypeAndParams(r,s);const o={posMode:i,productType:a};return await this.privateMixPostV2MixAccountSetPositionMode(this.extend(o,s))}async fetchOpenInterest(e,t={}){await this.loadMarkets();let s,i;if(this.safeBool(this.options,"sandboxMode",!1)){const t=this.convertSymbolForSandbox(e);s=this.market(t)}else s=this.market(e);if(!s.contract)throw new r.BadRequest(this.id+" fetchOpenInterest() supports contract markets only");[i,t]=this.handleProductTypeAndParams(s,t);const a={symbol:s.id,productType:i},o=await this.publicMixGetV2MixMarketOpenInterest(this.extend(a,t)),n=this.safeDict(o,"data",{});return this.parseOpenInterest(n,s)}parseOpenInterest(e,t=void 0){const s=this.safeValue(e,"openInterestList",[]),i=this.safeInteger(e,"ts"),r=this.safeString(s[0],"symbol");return this.safeOpenInterest({symbol:this.safeSymbol(r,t,void 0,"contract"),openInterestAmount:this.safeNumber(s[0],"size"),openInterestValue:void 0,timestamp:i,datetime:this.iso8601(i),info:e},t)}async fetchTransfers(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchTransfers() requires a code argument");let a;await this.loadMarkets(),[a,i]=this.handleMarketTypeAndParams("fetchTransfers",void 0,i);const o=this.safeString(i,"fromAccount",a);i=this.omit(i,"fromAccount");const n=this.safeValue(this.options,"accountsByType",{});a=this.safeString(n,o);const d=this.currency(e);let h={coin:d.id,fromType:a};void 0!==t&&(h.startTime=t),void 0!==s&&(h.limit=s),[h,i]=this.handleUntilOption("endTime",h,i);const c=await this.privateSpotGetV2SpotAccountTransferRecords(this.extend(h,i)),l=this.safeList(c,"data",[]);return this.parseTransfers(l,d,t,s)}async transfer(e,t,s,i,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeValue(this.options,"accountsByType",{}),n={fromType:this.safeString(o,s),toType:this.safeString(o,i),amount:t,coin:a.id},d=this.safeString(r,"symbol");let h;r=this.omit(r,"symbol"),void 0!==d&&(h=this.market(d),n.symbol=h.id);const c=await this.privateSpotPostV2SpotWalletTransfer(this.extend(n,r)),l=this.safeValue(c,"data",{});return l.ts=this.safeInteger(c,"requestTime"),this.parseTransfer(l,a)}parseTransfer(e,t=void 0){const s=this.safeInteger(e,"ts"),i=this.safeStringLower(e,"status"),r=this.safeString(e,"coin"),a=this.safeString(e,"fromType"),o=this.safeValue(this.options,"accountsById",{}),n=this.safeString(o,a,a),d=this.safeString(e,"toType"),h=this.safeString(o,d,d);return{info:e,id:this.safeString(e,"transferId"),timestamp:s,datetime:this.iso8601(s),currency:this.safeCurrencyCode(r,t),amount:this.safeNumber(e,"size"),fromAccount:n,toAccount:h,status:this.parseTransferStatus(i)}}parseTransferStatus(e){return this.safeString({successful:"ok"},e,e)}parseDepositWithdrawFee(e,t=void 0){const s=this.safeValue(e,"chains",[]),i=s.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};for(let e=0;e0){const t=this.market(e[0]);a.symbol=t.id}}void 0!==t&&(a.startTime=t),void 0!==s&&(a.limit=s),void 0!==r&&(a.endTime=r);const o=await this.privateMixGetV2MixPositionHistoryPosition(this.extend(a,i)),n=this.safeDict(o,"data"),d=this.safeList(n,"list"),h=this.parsePositions(d,e,i);return this.filterBySinceLimit(h,t,s)}async fetchConvertQuote(e,t,s=void 0,i={}){await this.loadMarkets();const r={fromCoin:e,toCoin:t,fromCoinSize:this.numberToString(s)},a=await this.privateConvertGetV2ConvertQuotedPrice(this.extend(r,i)),o=this.safeDict(a,"data",{}),n=this.safeString(o,"fromCoin",e),d=this.currency(n),h=this.safeString(o,"toCoin",t),c=this.currency(h);return this.parseConversion(o,d,c)}async createConvertTrade(e,t,s,i=void 0,a={}){await this.loadMarkets();const o=this.safeString2(a,"price","cnvtPrice");if(void 0===o)throw new r.ArgumentsRequired(this.id+" createConvertTrade() requires a price parameter");const n=this.safeString2(a,"toAmount","toCoinSize");if(void 0===n)throw new r.ArgumentsRequired(this.id+" createConvertTrade() requires a toAmount parameter");a=this.omit(a,["price","toAmount"]);const d={traceId:e,fromCoin:t,toCoin:s,fromCoinSize:this.numberToString(i),toCoinSize:n,cnvtPrice:o},h=await this.privateConvertPostV2ConvertTrade(this.extend(d,a)),c=this.safeDict(h,"data",{}),l=this.safeString(c,"toCoin",s),u=this.currency(l);return this.parseConversion(c,void 0,u)}async fetchConvertTradeHistory(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={},a=this.milliseconds();r.startTime=void 0!==t?t:a-864e5;const o=this.safeString2(i,"endTime","until");r.endTime=void 0!==o?o:a,void 0!==s&&(r.limit=s),i=this.omit(i,"until");const n=await this.privateConvertGetV2ConvertConvertRecord(this.extend(r,i)),d=this.safeDict(n,"data",{}),h=this.safeList(d,"dataList",[]);return this.parseConversions(h,e,"fromCoin","toCoin",t,s)}parseConversion(e,t=void 0,s=void 0){const i=this.safeInteger(e,"ts"),r=this.safeString(e,"fromCoin"),a=this.safeCurrencyCode(r,t),o=this.safeString(e,"toCoin"),n=this.safeCurrencyCode(o,s);return{info:e,timestamp:i,datetime:this.iso8601(i),id:this.safeString2(e,"id","traceId"),fromCurrency:a,fromAmount:this.safeNumber(e,"fromCoinSize"),toCurrency:n,toAmount:this.safeNumber(e,"toCoinSize"),price:this.safeNumber(e,"cnvtPrice"),fee:this.safeNumber(e,"fee")}}async fetchConvertCurrencies(e={}){await this.loadMarkets();const t=await this.privateConvertGetV2ConvertCurrencies(e),s={},i=this.safeList(t,"data",[]);for(let e=0;e0&&(c=c+"?"+this.urlencode(l))}if(o){this.checkRequiredCredentials();const e=this.milliseconds().toString();let t=e+s+h;if("POST"===s)t+=a=this.json(i);else if(Object.keys(i).length){let e="?"+this.urlencode(this.keysort(i));e.indexOf("%24")>-1&&(e=e.replace("%24","$")),c+=e,t+=e}const o=this.hmac(this.encode(t),this.encode(this.secret),n.J,"base64"),d=this.safeString(this.options,"broker");r={"ACCESS-KEY":this.apiKey,"ACCESS-SIGN":o,"ACCESS-TIMESTAMP":e,"ACCESS-PASSPHRASE":this.password,"X-CHANNEL-API-CODE":d},"POST"===s&&(r["Content-Type"]="application/json")}return{url:c,method:s,body:a,headers:r}}}},5305:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(5823),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bithumb",name:"Bithumb",countries:["KR"],rateLimit:500,pro:!0,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketOrder:!0,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTransfer:!1,fetchTransfers:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},hostname:"bithumb.com",urls:{logo:"https://user-images.githubusercontent.com/1294454/30597177-ea800172-9d5e-11e7-804c-b9d4fa9b56b0.jpg",api:{public:"https://api.{hostname}/public",private:"https://api.{hostname}"},www:"https://www.bithumb.com",doc:"https://apidocs.bithumb.com",fees:"https://en.bithumb.com/customer_support/info_fee"},api:{public:{get:["ticker/ALL_{quoteId}","ticker/{baseId}_{quoteId}","orderbook/ALL_{quoteId}","orderbook/{baseId}_{quoteId}","transaction_history/{baseId}_{quoteId}","network-info","assetsstatus/multichain/ALL","assetsstatus/multichain/{currency}","withdraw/minimum/ALL","withdraw/minimum/{currency}","assetsstatus/ALL","assetsstatus/{baseId}","candlestick/{baseId}_{quoteId}/{interval}"]},private:{post:["info/account","info/balance","info/wallet_address","info/ticker","info/orders","info/user_transactions","info/order_detail","trade/place","trade/cancel","trade/btc_withdrawal","trade/krw_deposit","trade/krw_withdrawal","trade/market_buy","trade/market_sell","trade/stop_limit"]}},fees:{trading:{maker:this.parseNumber("0.0025"),taker:this.parseNumber("0.0025")}},precisionMode:o.tV,exceptions:{"Bad Request(SSL)":r.BadRequest,"Bad Request(Bad Method)":r.BadRequest,"Bad Request.(Auth Data)":r.AuthenticationError,"Not Member":r.AuthenticationError,"Invalid Apikey":r.AuthenticationError,"Method Not Allowed.(Access IP)":r.PermissionDenied,"Method Not Allowed.(BTC Adress)":r.InvalidAddress,"Method Not Allowed.(Access)":r.PermissionDenied,"Database Fail":r.ExchangeNotAvailable,"Invalid Parameter":r.BadRequest,5600:r.ExchangeError,"Unknown Error":r.ExchangeError,"After May 23th, recent_transactions is no longer, hence users will not be able to connect to recent_transactions":r.ExchangeError},timeframes:{"1m":"1m","3m":"3m","5m":"5m","10m":"10m","30m":"30m","1h":"1h","6h":"6h","12h":"12h","1d":"24h"},options:{quoteCurrencies:{BTC:{limits:{cost:{min:2e-4,max:100}}},KRW:{limits:{cost:{min:500,max:5e9}}}}},commonCurrencies:{ALT:"ArchLoot",FTC:"FTC2",SOC:"Soda Coin"}})}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return super.safeMarket(e,t,s,"spot")}amountToPrecision(e,t){return this.decimalToPrecision(t,o.tk,this.markets[e].precision.amount,o.nr)}async fetchMarkets(e={}){const t=[],s=this.safeValue(this.options,"quoteCurrencies",{}),i=Object.keys(s);for(let r=0;r1){const e=t[0];let i=t[1];i.length<8&&(i="0"+i),s=this.parse8601(e+" "+i)}else s=this.safeIntegerProduct(e,"transaction_date",.001)}void 0!==s&&(s-=324e5);let r=this.safeString(e,"type");r="ask"===r?"sell":"buy";const a=this.safeString(e,"cont_no");t=this.safeMarket(void 0,t);const o=this.safeString(e,"price"),n=this.fixCommaNumber(this.safeString2(e,"units_traded","units")),d=this.safeString(e,"total");let h;const c=this.safeString(e,"fee");if(void 0!==c){const t=this.safeString(e,"fee_currency");h={cost:c,currency:this.commonCurrencyCode(t)}}return this.safeTrade({id:a,info:e,timestamp:s,datetime:this.iso8601(s),symbol:t.symbol,order:void 0,type:undefined,side:r,takerOrMaker:void 0,price:o,amount:n,cost:d,fee:h},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.market(e),a={baseId:r.baseId,quoteId:r.quoteId};void 0!==s&&(a.count=s);const o=await this.publicGetTransactionHistoryBaseIdQuoteId(this.extend(a,i)),n=this.safeList(o,"data",[]);return this.parseTrades(n,r,t,s)}async createOrder(e,t,s,i,a=void 0,o={}){await this.loadMarkets();const n=this.market(e),d={order_currency:n.id,payment_currency:n.quote,units:i};let h="privatePostTradePlace";"limit"===t?(d.price=a,d.type="buy"===s?"bid":"ask"):h="privatePostTradeMarket"+this.capitalize(s);const c=await this[h](this.extend(d,o)),l=this.safeString(c,"order_id");if(void 0===l)throw new r.InvalidOrder(this.id+" createOrder() did not return an order id");return this.safeOrder({info:c,symbol:e,type:t,side:s,id:l},n)}async fetchOrder(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" fetchOrder() requires a symbol argument");await this.loadMarkets();const i=this.market(t),a={order_id:e,count:1,order_currency:i.base,payment_currency:i.quote},o=await this.privatePostInfoOrderDetail(this.extend(a,s)),n=this.safeDict(o,"data");return this.parseOrder(this.extend(n,{order_id:e}),i)}parseOrderStatus(e){return this.safeString({Pending:"open",Completed:"closed",Cancel:"canceled"},e,e)}parseOrder(e,t=void 0){const s=this.safeIntegerProduct(e,"order_date",.001),i="bid"===this.safeValue2(e,"type","side")?"buy":"sell",r=this.parseOrderStatus(this.safeString(e,"order_status")),o=this.safeString2(e,"order_price","price");let n="limit";a.O.stringEquals(o,"0")&&(n="market");const d=this.fixCommaNumber(this.safeString2(e,"order_qty","units"));let h,c=this.fixCommaNumber(this.safeString(e,"units_remaining"));void 0===c&&("closed"===r?c="0":"canceled"!==r&&(c=d));const l=this.safeString(e,"order_currency"),u=this.safeString(e,"payment_currency"),p=this.safeCurrencyCode(l),f=this.safeCurrencyCode(u);void 0!==p&&void 0!==f&&(h=p+"/"+f),void 0===h&&(h=(t=this.safeMarket(void 0,t)).symbol);const m=this.safeString(e,"order_id"),g=this.safeValue(e,"contract",[]);return this.safeOrder({info:e,id:m,clientOrderId:void 0,timestamp:s,datetime:this.iso8601(s),lastTradeTimestamp:void 0,symbol:h,type:n,timeInForce:void 0,postOnly:void 0,side:i,price:o,stopPrice:void 0,triggerPrice:void 0,amount:d,cost:void 0,average:void 0,filled:void 0,remaining:c,status:r,fee:void 0,trades:g},t)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchOpenOrders() requires a symbol argument");await this.loadMarkets();const a=this.market(e);void 0===s&&(s=100);const o={count:s,order_currency:a.base,payment_currency:a.quote};void 0!==t&&(o.after=t);const n=await this.privatePostInfoOrders(this.extend(o,i)),d=this.safeList(n,"data",[]);return this.parseOrders(d,a,t,s)}async cancelOrder(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a symbol argument");if(!("side"in s))throw new r.ArgumentsRequired(this.id+" cancelOrder() requires a `side` parameter (sell or buy)");const i=this.market(t),a="buy"===s.side?"bid":"ask";s=this.omit(s,["side","currency"]);const o={order_id:e,type:a,order_currency:i.base,payment_currency:i.quote};return await this.privatePostTradeCancel(this.extend(o,s))}async cancelUnifiedOrder(e,t={}){const s={side:e.side};return await this.cancelOrder(e.id,e.symbol,this.extend(s,t))}async withdraw(e,t,s,i=void 0,a={}){[i,a]=this.handleWithdrawTagAndParams(i,a),this.checkAddress(s),await this.loadMarkets();const o=this.currency(e),n={units:t,address:s,currency:o.id};if("XRP"===e||"XMR"===e||"EOS"===e||"STEEM"===e){const t=this.safeString(a,"destination");if(void 0===i&&void 0===t)throw new r.ArgumentsRequired(this.id+" "+e+" withdraw() requires a tag argument or an extra destination param");void 0!==i&&(n.destination=i)}const d=await this.privatePostTradeBtcWithdrawal(this.extend(n,a));return this.parseTransaction(d,o)}parseTransaction(e,t=void 0){return{id:void 0,txid:void 0,timestamp:void 0,datetime:void 0,network:void 0,addressFrom:void 0,address:void 0,addressTo:void 0,amount:void 0,type:void 0,currency:(t=this.safeCurrency(void 0,t)).code,status:void 0,updated:void 0,tagFrom:void 0,tag:void 0,tagTo:void 0,comment:void 0,internal:void 0,fee:void 0,info:e}}fixCommaNumber(e){if(void 0===e)return;let t=e;for(;t.indexOf(",")>-1;)t=t.replace(",","");return t}nonce(){return this.milliseconds()}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){const o="/"+this.implodeParams(e,i);let d=this.implodeHostname(this.urls.api[t])+o;const h=this.omit(i,this.extractParams(e));if("public"===t)Object.keys(h).length&&(d+="?"+this.urlencode(h));else{this.checkRequiredCredentials(),a=this.urlencode(this.extend({endpoint:o},h));const e=this.nonce().toString(),t=o+"\0"+a+"\0"+e,s=this.hmac(this.encode(t),this.encode(this.secret),n.o),i=this.stringToBase64(s);r={Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","Api-Key":this.apiKey,"Api-Sign":i,"Api-Nonce":e}}return{url:d,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0!==n&&"status"in n){const e=this.safeString(n,"status"),t=this.safeString(n,"message");if(void 0!==e){if("0000"===e)return;if("거래 진행중인 내역이 존재하지 않습니다."===t)return;const s=this.id+" "+t;throw this.throwExactlyMatchedException(this.exceptions,e,s),this.throwExactlyMatchedException(this.exceptions,t,s),new r.ExchangeError(s)}}}}},3718:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(4993),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitmart",name:"BitMart",countries:["US","CN","HK","KR"],rateLimit:33.34,version:"v2",certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,borrowCrossMargin:!1,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,createTrailingPercentOrder:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:!0,fetchDepositWithdrawFees:!1,fetchFundingHistory:void 0,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIsolatedBorrowRate:!0,fetchIsolatedBorrowRates:!0,fetchLiquidations:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMyLiquidations:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactionFee:!0,fetchTransactionFees:!1,fetchTransfer:!1,fetchTransfers:!0,fetchWithdrawAddressesByNetwork:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!1,transfer:!0,withdraw:!0},hostname:"bitmart.com",urls:{logo:"https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg",api:{rest:"https://api-cloud.{hostname}"},www:"https://www.bitmart.com/",doc:"https://developer-pro.bitmart.com/",referral:{url:"http://www.bitmart.com/?r=rQCFLh",discount:.3},fees:"https://www.bitmart.com/fee/en"},requiredCredentials:{apiKey:!0,secret:!0,uid:!0},api:{public:{get:{"system/time":3,"system/service":3,"spot/v1/currencies":7.5,"spot/v1/symbols":7.5,"spot/v1/symbols/details":5,"spot/quotation/v3/tickers":6,"spot/quotation/v3/ticker":4,"spot/quotation/v3/lite-klines":5,"spot/quotation/v3/klines":7,"spot/quotation/v3/books":4,"spot/quotation/v3/trades":4,"spot/v1/ticker":5,"spot/v2/ticker":30,"spot/v1/ticker_detail":5,"spot/v1/steps":30,"spot/v1/symbols/kline":6,"spot/v1/symbols/book":5,"spot/v1/symbols/trades":5,"contract/v1/tickers":15,"contract/public/details":5,"contract/public/depth":5,"contract/public/open-interest":30,"contract/public/funding-rate":30,"contract/public/kline":6,"account/v1/currencies":30}},private:{get:{"account/sub-account/v1/transfer-list":7.5,"account/sub-account/v1/transfer-history":7.5,"account/sub-account/main/v1/wallet":5,"account/sub-account/main/v1/subaccount-list":7.5,"account/contract/sub-account/main/v1/wallet":5,"account/contract/sub-account/main/v1/transfer-list":7.5,"account/contract/sub-account/v1/transfer-history":7.5,"account/v1/wallet":5,"account/v1/currencies":30,"spot/v1/wallet":5,"account/v1/deposit/address":30,"account/v1/withdraw/charge":32,"account/v2/deposit-withdraw/history":7.5,"account/v1/deposit-withdraw/detail":7.5,"spot/v1/order_detail":1,"spot/v2/orders":5,"spot/v1/trades":5,"spot/v2/trades":5,"spot/v3/orders":5,"spot/v2/order_detail":1,"spot/v1/margin/isolated/borrow_record":1,"spot/v1/margin/isolated/repay_record":1,"spot/v1/margin/isolated/pairs":30,"spot/v1/margin/isolated/account":5,"spot/v1/trade_fee":30,"spot/v1/user_fee":30,"spot/v1/broker/rebate":1,"contract/private/assets-detail":5,"contract/private/order":1.2,"contract/private/order-history":10,"contract/private/position":10,"contract/private/get-open-orders":1.2,"contract/private/current-plan-order":1.2,"contract/private/trades":10},post:{"account/sub-account/main/v1/sub-to-main":30,"account/sub-account/sub/v1/sub-to-main":30,"account/sub-account/main/v1/main-to-sub":30,"account/sub-account/sub/v1/sub-to-sub":30,"account/sub-account/main/v1/sub-to-sub":30,"account/contract/sub-account/main/v1/sub-to-main":7.5,"account/contract/sub-account/main/v1/main-to-sub":7.5,"account/contract/sub-account/sub/v1/sub-to-main":7.5,"account/v1/withdraw/apply":7.5,"spot/v1/submit_order":1,"spot/v1/batch_orders":1,"spot/v2/cancel_order":1,"spot/v1/cancel_orders":15,"spot/v4/query/order":1,"spot/v4/query/client-order":1,"spot/v4/query/open-orders":5,"spot/v4/query/history-orders":5,"spot/v4/query/trades":5,"spot/v4/query/order-trades":5,"spot/v3/cancel_order":1,"spot/v2/batch_orders":1,"spot/v2/submit_order":1,"spot/v1/margin/submit_order":1,"spot/v1/margin/isolated/borrow":30,"spot/v1/margin/isolated/repay":30,"spot/v1/margin/isolated/transfer":30,"account/v1/transfer-contract-list":60,"account/v1/transfer-contract":60,"contract/private/submit-order":2.5,"contract/private/cancel-order":1.5,"contract/private/cancel-orders":30,"contract/private/submit-plan-order":2.5,"contract/private/cancel-plan-order":1.5,"contract/private/submit-leverage":2.5}}},timeframes:{"1m":1,"3m":3,"5m":5,"15m":15,"30m":30,"45m":45,"1h":60,"2h":120,"3h":180,"4h":240,"1d":1440,"1w":10080,"1M":43200},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0040"),maker:this.parseNumber("0.0035"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0020")],[this.parseNumber("10"),this.parseNumber("0.18")],[this.parseNumber("50"),this.parseNumber("0.0016")],[this.parseNumber("250"),this.parseNumber("0.0014")],[this.parseNumber("1000"),this.parseNumber("0.0012")],[this.parseNumber("5000"),this.parseNumber("0.0010")],[this.parseNumber("25000"),this.parseNumber("0.0008")],[this.parseNumber("50000"),this.parseNumber("0.0006")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("10"),this.parseNumber("0.0009")],[this.parseNumber("50"),this.parseNumber("0.0008")],[this.parseNumber("250"),this.parseNumber("0.0007")],[this.parseNumber("1000"),this.parseNumber("0.0006")],[this.parseNumber("5000"),this.parseNumber("0.0005")],[this.parseNumber("25000"),this.parseNumber("0.0004")],[this.parseNumber("50000"),this.parseNumber("0.0003")]]}}},precisionMode:o.sh,exceptions:{exact:{3e4:r.ExchangeError,30001:r.AuthenticationError,30002:r.AuthenticationError,30003:r.AccountSuspended,30004:r.AuthenticationError,30005:r.AuthenticationError,30006:r.AuthenticationError,30007:r.AuthenticationError,30008:r.AuthenticationError,30010:r.PermissionDenied,30011:r.AuthenticationError,30012:r.AuthenticationError,30013:r.RateLimitExceeded,30014:r.ExchangeNotAvailable,30016:r.OnMaintenance,30017:r.RateLimitExceeded,30018:r.BadRequest,30019:r.PermissionDenied,6e4:r.BadRequest,60001:r.BadRequest,60002:r.BadRequest,60003:r.ExchangeError,60004:r.ExchangeError,60005:r.ExchangeError,60006:r.ExchangeError,60007:r.InvalidAddress,60008:r.InsufficientFunds,60009:r.ExchangeError,60010:r.ExchangeError,60011:r.InvalidAddress,60012:r.ExchangeError,60020:r.PermissionDenied,60021:r.PermissionDenied,60022:r.PermissionDenied,60026:r.PermissionDenied,60027:r.PermissionDenied,60028:r.AccountSuspended,60029:r.AccountSuspended,60030:r.BadRequest,60031:r.BadRequest,60050:r.ExchangeError,60051:r.ExchangeError,61001:r.InsufficientFunds,61003:r.BadRequest,61004:r.BadRequest,61005:r.BadRequest,61006:r.NotSupported,61007:r.ExchangeError,61008:r.ExchangeError,7e4:r.ExchangeError,70001:r.BadRequest,70002:r.BadSymbol,70003:r.NetworkError,71001:r.BadRequest,71002:r.BadRequest,71003:r.BadRequest,71004:r.BadRequest,71005:r.BadRequest,5e4:r.BadRequest,50001:r.BadSymbol,50002:r.BadRequest,50003:r.BadRequest,50004:r.BadRequest,50005:r.OrderNotFound,50006:r.InvalidOrder,50007:r.InvalidOrder,50008:r.InvalidOrder,50009:r.InvalidOrder,50010:r.InvalidOrder,50011:r.InvalidOrder,50012:r.InvalidOrder,50013:r.InvalidOrder,50014:r.BadRequest,50015:r.BadRequest,50016:r.BadRequest,50017:r.BadRequest,50018:r.BadRequest,50019:r.ExchangeError,50020:r.InsufficientFunds,50021:r.BadRequest,50022:r.ExchangeNotAvailable,50023:r.BadSymbol,50024:r.BadRequest,50025:r.BadRequest,50026:r.BadRequest,50027:r.BadRequest,50028:r.BadRequest,50029:r.InvalidOrder,50030:r.OrderNotFound,50031:r.OrderNotFound,50032:r.OrderNotFound,50033:r.InvalidOrder,50034:r.InvalidOrder,50035:r.InvalidOrder,50036:r.ExchangeError,50037:r.BadRequest,50038:r.BadRequest,50039:r.BadRequest,50040:r.BadSymbol,50041:r.ExchangeError,50042:r.BadRequest,51e3:r.BadSymbol,51001:r.ExchangeError,51002:r.ExchangeError,51003:r.ExchangeError,51004:r.InsufficientFunds,51005:r.InvalidOrder,51006:r.InvalidOrder,51007:r.BadRequest,51008:r.ExchangeError,51009:r.InvalidOrder,51010:r.InvalidOrder,51011:r.InvalidOrder,51012:r.InvalidOrder,51013:r.InvalidOrder,51014:r.InvalidOrder,51015:r.InvalidOrder,52e3:r.BadRequest,52001:r.BadRequest,52002:r.BadRequest,52003:r.BadRequest,52004:r.BadRequest,53e3:r.AccountSuspended,53001:r.AccountSuspended,53002:r.PermissionDenied,53003:r.PermissionDenied,53005:r.PermissionDenied,53006:r.PermissionDenied,53007:r.PermissionDenied,53008:r.PermissionDenied,53009:r.PermissionDenied,53010:r.PermissionDenied,57001:r.BadRequest,58001:r.BadRequest,59001:r.ExchangeError,59002:r.ExchangeError,59003:r.ExchangeError,59004:r.ExchangeError,59005:r.PermissionDenied,59006:r.ExchangeError,59007:r.ExchangeError,59008:r.ExchangeError,59009:r.ExchangeError,59010:r.InsufficientFunds,59011:r.ExchangeError,40001:r.ExchangeError,40002:r.ExchangeError,40003:r.ExchangeError,40004:r.ExchangeError,40005:r.ExchangeError,40006:r.PermissionDenied,40007:r.BadRequest,40008:r.InvalidNonce,40009:r.BadRequest,40010:r.BadRequest,40011:r.BadRequest,40012:r.ExchangeError,40013:r.ExchangeError,40014:r.BadSymbol,40015:r.BadSymbol,40016:r.InvalidOrder,40017:r.InvalidOrder,40018:r.InvalidOrder,40019:r.ExchangeError,40020:r.InvalidOrder,40021:r.ExchangeError,40022:r.ExchangeError,40023:r.ExchangeError,40024:r.ExchangeError,40025:r.ExchangeError,40026:r.ExchangeError,40027:r.InsufficientFunds,40028:r.PermissionDenied,40029:r.InvalidOrder,40030:r.InvalidOrder,40031:r.InvalidOrder,40032:r.InvalidOrder,40033:r.InvalidOrder,40034:r.BadSymbol,40035:r.OrderNotFound,40036:r.InvalidOrder,40037:r.OrderNotFound,40038:r.BadRequest,40039:r.BadRequest,40040:r.InvalidOrder,40041:r.InvalidOrder,40042:r.InvalidOrder,40043:r.InvalidOrder,40044:r.InvalidOrder,40045:r.InvalidOrder,40046:r.PermissionDenied,40047:r.PermissionDenied,40048:r.BadRequest,40049:r.BadRequest,40050:r.InvalidOrder},broad:{}},commonCurrencies:{$GM:"GOLDMINER",$HERO:"Step Hero",$PAC:"PAC",BP:"BEYOND",GDT:"Gorilla Diamond",GLD:"Goldario",MVP:"MVP Coin",TRU:"Truebit"},options:{defaultNetwork:"ERC20",defaultNetworks:{USDT:"ERC20"},networks:{ERC20:"ERC20",SOL:"SOL",BTC:"BTC",TRC20:"TRC20",OMNI:"OMNI",XLM:"XLM",EOS:"EOS",NEO:"NEO",BTM:"BTM",BCH:"BCH",LTC:"LTC",BSV:"BSV",XRP:"XRP",PLEX:"PLEX",XCH:"XCH",NEAR:"NEAR",FIO:"FIO",SCRT:"SCRT",IOTX:"IOTX",ALGO:"ALGO",ATOM:"ATOM",DOT:"DOT",ADA:"ADA",DOGE:"DOGE",XYM:"XYM",GLMR:"GLMR",MOVR:"MOVR",ZIL:"ZIL",INJ:"INJ",KSM:"KSM",ZEC:"ZEC",NAS:"NAS",HRC20:"HECO",XDC:"XDC",ONE:"ONE",LAT:"LAT",CSPR:"Casper",ICP:"Computer",XTZ:"XTZ",MINA:"MINA",THETA:"THETA",AKT:"AKT",AR:"AR",CELO:"CELO",FIL:"FIL",NULS:"NULS",ETC:"ETC",DASH:"DASH",DGB:"DGB",BEP2:"BEP2",GRIN:"GRIN",WAVES:"WAVES",ABBC:"ABBC",ACA:"ACA",QTUM:"QTUM",PAC:"PAC",TLOS:"TLOS",KARDIA:"KardiaChain",FUSE:"FUSE",TRC10:"TRC10",FIRO:"FIRO",FTM:"Fantom",EVER:"EVER",KAVA:"KAVA",HYDRA:"HYDRA",PLCU:"PLCU",BRISE:"BRISE",OPTIMISM:"OPTIMISM",REEF:"REEF",SYS:"SYS",VITE:"VITE",STX:"STX",SXP:"SXP",BITCI:"BITCI",XRD:"XRD",ASTR:"ASTAR",ZEN:"HORIZEN",LTO:"LTO",ETHW:"ETHW",ETHF:"ETHF",IOST:"IOST",APT:"APT",ONT:"ONT",EVMOS:"EVMOS",XMR:"XMR",OASYS:"OAS",OSMO:"OSMO",OMAX:"OMAX Chain",DESO:"DESO",BFIC:"BFIC",OHO:"OHO",CS:"CS",CHEQ:"CHEQ",NODL:"NODL",NEM:"XEM",FRA:"FRA",ERGO:"ERG"},defaultType:"spot",fetchBalance:{type:"spot"},accountsByType:{spot:"spot",swap:"swap"},createMarketBuyOrderRequiresPrice:!0,brokerId:"CCXTxBitmart000"}})}async fetchTime(e={}){const t=await this.publicGetSystemTime(e),s=this.safeValue(t,"data",{});return this.safeInteger(s,"server_time")}async fetchStatus(e={}){const t=this.safeValue(this.options,"fetchStatus",{}),s=this.safeString(this.options,"defaultType");let i=this.safeString(t,"type",s);i=this.safeString(e,"type",i),e=this.omit(e,"type");const r=await this.publicGetSystemService(e),a=this.safeValue(r,"data",{}),o=this.safeValue(a,"service",[]),n=this.indexBy(o,"service_type");"swap"===i&&(i="contract");const d=this.safeValue(n,i);let h,c;if(void 0!==d){2===this.safeInteger(d,"status")?h="ok":(h="maintenance",c=this.safeInteger(d,"end_time"))}return{status:h,updated:void 0,eta:c,url:void 0,info:r}}async fetchSpotMarkets(e={}){const t=await this.publicGetSpotV1SymbolsDetails(e),s=this.safeValue(t,"data",{}),i=this.safeValue(s,"symbols",[]),r=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(8154),r=s(9292),a=s(6689),o=s(2194),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitmex",name:"BitMEX",countries:["SC"],version:"v1",userAgent:void 0,rateLimit:100,certified:!0,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!0,option:!1,addMargin:void 0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createOrder:!0,createReduceOnlyOrder:!0,createTrailingAmountOrder:!0,editOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDepositsWithdrawals:"emulated",fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchLedger:!0,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!1,fetchLiquidations:!0,fetchMarginAdjustmentHistory:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,reduceMargin:void 0,setLeverage:!0,setMargin:void 0,setMarginMode:!0,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","1h":"1h","1d":"1d"},urls:{test:{public:"https://testnet.bitmex.com",private:"https://testnet.bitmex.com"},logo:"https://github.com/ccxt/ccxt/assets/43336371/cea9cfe5-c57e-4b84-b2ac-77b960b04445",api:{public:"https://www.bitmex.com",private:"https://www.bitmex.com"},www:"https://www.bitmex.com",doc:["https://www.bitmex.com/app/apiOverview","https://github.com/BitMEX/api-connectors/tree/master/official-http"],fees:"https://www.bitmex.com/app/fees",referral:{url:"https://www.bitmex.com/app/register/NZTR1q",discount:.1}},api:{public:{get:{announcement:5,"announcement/urgent":5,chat:5,"chat/channels":5,"chat/connected":5,"chat/pinned":5,funding:5,guild:5,instrument:5,"instrument/active":5,"instrument/activeAndIndices":5,"instrument/activeIntervals":5,"instrument/compositeIndex":5,"instrument/indices":5,"instrument/usdVolume":5,insurance:5,leaderboard:5,liquidation:5,"orderBook/L2":5,"porl/nonce":5,quote:5,"quote/bucketed":5,schema:5,"schema/websocketHelp":5,settlement:5,stats:5,"stats/history":5,"stats/historyUSD":5,trade:5,"trade/bucketed":5,"wallet/assets":5,"wallet/networks":5}},private:{get:{address:5,apiKey:5,execution:5,"execution/tradeHistory":5,globalNotification:5,"leaderboard/name":5,order:5,"porl/snapshots":5,position:5,user:5,"user/affiliateStatus":5,"user/checkReferralCode":5,"user/commission":5,"user/csa":5,"user/depositAddress":5,"user/executionHistory":5,"user/getWalletTransferAccounts":5,"user/margin":5,"user/quoteFillRatio":5,"user/quoteValueRatio":5,"user/staking":5,"user/staking/instruments":5,"user/staking/tiers":5,"user/tradingVolume":5,"user/unstakingRequests":5,"user/wallet":5,"user/walletHistory":5,"user/walletSummary":5,userAffiliates:5,userEvent:5},post:{address:5,chat:5,guild:5,"guild/archive":5,"guild/join":5,"guild/kick":5,"guild/leave":5,"guild/sharesTrades":5,order:1,"order/cancelAllAfter":5,"order/closePosition":5,"position/isolate":1,"position/leverage":1,"position/riskLimit":5,"position/transferMargin":1,"user/addSubaccount":5,"user/cancelWithdrawal":5,"user/communicationToken":5,"user/confirmEmail":5,"user/confirmWithdrawal":5,"user/logout":5,"user/preferences":5,"user/requestWithdrawal":5,"user/unstakingRequests":5,"user/updateSubaccount":5,"user/walletTransfer":5},put:{guild:5,order:1},delete:{order:1,"order/all":1,"user/unstakingRequests":5}}},exceptions:{exact:{"Invalid API Key.":a.AuthenticationError,"This key is disabled.":a.PermissionDenied,"Access Denied":a.PermissionDenied,"Duplicate clOrdID":a.InvalidOrder,"orderQty is invalid":a.InvalidOrder,"Invalid price":a.InvalidOrder,"Invalid stopPx for ordType":a.InvalidOrder},broad:{"Signature not valid":a.AuthenticationError,overloaded:a.ExchangeNotAvailable,"Account has insufficient Available Balance":a.InsufficientFunds,"Service unavailable":a.ExchangeNotAvailable,"Server Error":a.ExchangeError,"Unable to cancel order due to existing state":a.InvalidOrder,"We require all new traders to verify":a.PermissionDenied}},precisionMode:r.sh,options:{"api-expires":5,fetchOHLCVOpenTimestamp:!0,oldPrecision:!1,networks:{BTC:"btc",ERC20:"eth",BEP20:"bsc",TRC20:"tron",AVAXC:"avax",NEAR:"near",XTZ:"xtz",DOT:"dot",SOL:"sol",ADA:"ada"}},commonCurrencies:{USDt:"USDT",XBt:"BTC",XBT:"BTC",Gwei:"ETH",GWEI:"ETH",LAMP:"SOL",LAMp:"SOL"}})}async fetchCurrencies(e={}){const t=await this.publicGetWalletAssets(e),s={};for(let e=0;e=0)throw new a.OrderNotFound(this.id+" cancelOrder() failed: "+d);return this.parseOrder(n)}async cancelOrders(e,t=void 0,s={}){await this.loadMarkets();const i=this.safeValue2(s,"clOrdID","clientOrderId"),r={};void 0===i?r.orderID=e:(r.clOrdID=i,s=this.omit(s,["clOrdID","clientOrderId"]));const a=await this.privateDeleteOrder(this.extend(r,s));return this.parseOrders(a)}async cancelAllOrders(e=void 0,t={}){await this.loadMarkets();const s={};let i;void 0!==e&&(i=this.market(e),s.symbol=i.id);const r=await this.privateDeleteOrderAll(this.extend(s,t));return this.parseOrders(r,i)}async cancelAllOrdersAfter(e,t={}){await this.loadMarkets();const s={timeout:e>0?this.parseToInt(e/1e3):0};return await this.privatePostOrderCancelAllAfter(this.extend(s,t))}async fetchLeverages(e=void 0,t={}){await this.loadMarkets();const s=await this.fetchPositions(e,t);return this.parseLeverages(s,e,"symbol")}parseLeverage(e,t=void 0){const s=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(s,t),marginMode:this.safeStringLower(e,"marginMode"),longLeverage:this.safeInteger(e,"leverage"),shortLeverage:this.safeInteger(e,"leverage")}}async fetchPositions(e=void 0,t={}){await this.loadMarkets();const s=await this.privateGetPosition(t),i=this.parsePositions(s,e);return this.filterByArrayPositions(i,"symbol",e,!1)}parsePosition(e,t=void 0){const s=(t=this.safeMarket(this.safeString(e,"symbol"),t)).symbol,i=this.safeString(e,"timestamp"),r=!0===this.safeValue(e,"crossMargin")?"cross":"isolated",a=o.O.stringAbs(this.safeString2(e,"foreignNotional","homeNotional")),n=this.safeString(t,"settle"),d=this.convertToRealAmount(n,this.safeString(e,"maintMargin")),h=this.convertToRealAmount(n,this.safeString(e,"unrealisedPnl")),c=this.parseNumber(o.O.stringAbs(this.safeString(e,"currentQty"))),l=this.safeNumber(t,"contractSize");let u;const p=this.safeString(e,"homeNotional");return void 0!==p&&(u="-"===p[0]?"short":"long"),this.safePosition({info:e,id:this.safeString(e,"account"),symbol:s,timestamp:this.parse8601(i),datetime:i,lastUpdateTimestamp:void 0,hedged:void 0,side:u,contracts:c,contractSize:l,entryPrice:this.safeNumber(e,"avgEntryPrice"),markPrice:this.safeNumber(e,"markPrice"),lastPrice:void 0,notional:this.parseNumber(a),leverage:this.safeNumber(e,"leverage"),collateral:void 0,initialMargin:this.safeNumber(e,"initMargin"),initialMarginPercentage:this.safeNumber(e,"initMarginReq"),maintenanceMargin:d,maintenanceMarginPercentage:this.safeNumber(e,"maintMarginReq"),unrealizedPnl:h,liquidationPrice:this.safeNumber(e,"liquidationPrice"),marginMode:r,marginRatio:void 0,percentage:this.safeNumber(e,"unrealisedPnlPcnt"),stopLossPrice:void 0,takeProfitPrice:void 0})}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),this.checkAddress(s),await this.loadMarkets();const a=this.currency(e),o=this.convertFromRealAmount(e,t);let n;[n,r]=this.handleNetworkCodeAndParams(r);const d={currency:a.id,amount:o,address:s,network:this.networkCodeToId(n,a.code)},h=await this.privatePostUserRequestWithdrawal(this.extend(d,r));return this.parseTransaction(h,a)}async fetchFundingRates(e=void 0,t={}){await this.loadMarkets();const s=await this.publicGetInstrumentActiveAndIndices(t),i=[];for(let e=0;e1&&this.inArray(t[1],s)){e=this.currency(t[0]).id+":"+t[1],r.symbol=e}else a=this.market(e),r.symbol=a.id}void 0!==t&&(r.startTime=this.iso8601(t)),void 0!==s&&(r.count=s);const o=this.safeInteger(i,"until");i=this.omit(i,["until"]),void 0!==o&&(r.endTime=this.iso8601(o)),void 0===t&&void 0===o&&(r.reverse=!0);const n=await this.publicGetFunding(this.extend(r,i));return this.parseFundingRateHistories(n,a,t,s)}parseFundingRateHistory(e,t=void 0){const s=this.safeString(e,"symbol"),i=this.safeString(e,"timestamp");return{info:e,symbol:this.safeSymbol(s,t),fundingRate:this.safeNumber(e,"fundingRate"),timestamp:this.parse8601(i),datetime:i}}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new a.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");if(e<.01||e>100)throw new a.BadRequest(this.id+" leverage should be between 0.01 and 100");await this.loadMarkets();const i=this.market(t);if("swap"!==i.type&&"future"!==i.type)throw new a.BadSymbol(this.id+" setLeverage() supports future and swap contracts only");const r={symbol:i.id,leverage:e};return await this.privatePostPositionLeverage(this.extend(r,s))}async setMarginMode(e,t=void 0,s={}){if(void 0===t)throw new a.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");if("isolated"!==(e=e.toLowerCase())&&"cross"!==e)throw new a.BadRequest(this.id+" setMarginMode() marginMode argument should be isolated or cross");await this.loadMarkets();const i=this.market(t);if("swap"!==i.type&&"future"!==i.type)throw new a.BadSymbol(this.id+" setMarginMode() supports swap and future contracts only");const r="cross"!==e,o={symbol:i.id,enabled:r};return await this.privatePostPositionIsolate(this.extend(o,s))}async fetchDepositAddress(e,t={}){let s;if(await this.loadMarkets(),[s,t]=this.handleNetworkCodeAndParams(t),void 0===s)throw new a.ArgumentsRequired(this.id+' fetchDepositAddress requires params["network"]');const i=this.currency(e);t=this.omit(t,"network");const r={currency:i.id,network:this.networkCodeToId(s,i.code)},o=await this.privateGetUserDepositAddress(this.extend(r,t));return{currency:e,address:o.replace('"',"").replace('"',""),tag:void 0,network:s,info:o}}parseDepositWithdrawFee(e,t=void 0){const s=this.safeValue(e,"networks",[]),i=s.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};if(0!==i){const a=this.safeString(e,"scale"),n=this.parsePrecision(a);for(let e=0;e=400){const t=this.safeValue(n,"error",{}),s=this.safeString(t,"message"),i=this.id+" "+o;if(this.throwExactlyMatchedException(this.exceptions.exact,s,i),this.throwBroadlyMatchedException(this.exceptions.broad,s,i),400===e)throw new a.BadRequest(i);throw new a.ExchangeError(i)}}}nonce(){return this.milliseconds()}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/api/"+this.version+"/"+e;if("GET"===s)Object.keys(i).length&&(o+="?"+this.urlencode(i));else{const e=this.safeString(i,"_format");void 0!==e&&(o+="?"+this.urlencode({_format:e}),i=this.omit(i,"_format"))}const d=this.urls.api[t]+o,h=this.checkRequiredCredentials(!1);if("private"===t||"public"===t&&h){this.checkRequiredCredentials();let e=s+o,t=this.safeInteger(this.options,"api-expires");r={"Content-Type":"application/json","api-key":this.apiKey},t=this.sum(this.seconds(),t);const d=t.toString();e+=d,r["api-expires"]=d,"POST"!==s&&"PUT"!==s&&"DELETE"!==s||Object.keys(i).length&&(e+=a=this.json(i)),r["api-signature"]=this.hmac(this.encode(e),this.encode(this.secret),n.J)}return{url:d,method:s,body:a,headers:r}}}},172:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(3813),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitopro",name:"BitoPro",countries:["TW"],version:"v3",rateLimit:100,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,editOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,setLeverage:!1,setMarginMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","3h":"3h","6h":"6h","12h":"12h","1d":"1d","1w":"1w","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/158227251-3a92a220-9222-453c-9277-977c6677fe71.jpg",api:{rest:"https://api.bitopro.com/v3"},www:"https://www.bitopro.com",doc:["https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md"],fees:"https://www.bitopro.com/fees"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:{"order-book/{pair}":1,tickers:1,"tickers/{pair}":1,"trades/{pair}":1,"provisioning/currencies":1,"provisioning/trading-pairs":1,"provisioning/limitations-and-fees":1,"trading-history/{pair}":1,"price/otc/{currency}":1}},private:{get:{"accounts/balance":1,"orders/history":1,"orders/all/{pair}":1,"orders/trades/{pair}":1,"orders/{pair}/{orderId}":1,"wallet/withdraw/{currency}/{serial}":1,"wallet/withdraw/{currency}/id/{id}":1,"wallet/depositHistory/{currency}":1,"wallet/withdrawHistory/{currency}":1},post:{"orders/{pair}":.5,"orders/batch":20/3,"wallet/withdraw/{currency}":10},put:{orders:5},delete:{"orders/{pair}/{id}":2/3,"orders/all":5,"orders/{pair}":5}}},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.001"),taker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("3000000"),this.parseNumber("0.00194")],[this.parseNumber("5000000"),this.parseNumber("0.0015")],[this.parseNumber("30000000"),this.parseNumber("0.0014")],[this.parseNumber("300000000"),this.parseNumber("0.0013")],[this.parseNumber("550000000"),this.parseNumber("0.0012")],[this.parseNumber("1300000000"),this.parseNumber("0.0011")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("3000000"),this.parseNumber("0.00097")],[this.parseNumber("5000000"),this.parseNumber("0.0007")],[this.parseNumber("30000000"),this.parseNumber("0.0006")],[this.parseNumber("300000000"),this.parseNumber("0.0005")],[this.parseNumber("550000000"),this.parseNumber("0.0004")],[this.parseNumber("1300000000"),this.parseNumber("0.0003")]]}}},options:{networks:{ERC20:"ERC20",ETH:"ERC20",TRX:"TRX",TRC20:"TRX",BEP20:"BSC",BSC:"BSC"}},precisionMode:o.sh,exceptions:{exact:{"Unsupported currency.":r.BadRequest,"Unsupported order type":r.BadRequest,"Invalid body":r.BadRequest,"Invalid Signature":r.AuthenticationError,"Address not in whitelist.":r.BadRequest},broad:{"Invalid amount":r.InvalidOrder,"Balance for ":r.InsufficientFunds,"Invalid ":r.BadRequest,"Wrong parameter":r.BadRequest}},commonCurrencies:{}})}async fetchCurrencies(e={}){const t=await this.publicGetProvisioningCurrencies(e),s=this.safeValue(t,"data",[]),i={};for(let e=0;e=200&&e<300)return;const c=this.id+" "+o,l=this.safeString(n,"error");throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,l,c),new r.ExchangeError(c)}}},2737:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(6481);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitpanda",alias:!0})}}},854:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(7317),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitrue",name:"Bitrue",countries:["SG"],rateLimit:1e3,certified:!1,version:"v1",pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingRate:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPositionMode:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!0,fetchWithdrawals:!0,setLeverage:!0,setMargin:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","1d":"1D","1w":"1W"},urls:{logo:"https://user-images.githubusercontent.com/1294454/139516488-243a830d-05dd-446b-91c6-c1f18fe30c63.jpg",api:{spot:"https://www.bitrue.com/api",fapi:"https://fapi.bitrue.com/fapi",dapi:"https://fapi.bitrue.com/dapi",kline:"https://www.bitrue.com/kline-api"},www:"https://www.bitrue.com",referral:"https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE",doc:["https://github.com/Bitrue-exchange/bitrue-official-api-docs","https://www.bitrue.com/api-docs"],fees:"https://bitrue.zendesk.com/hc/en-001/articles/4405479952537"},api:{spot:{kline:{public:{get:{"public.json":1,"public{currency}.json":1}}},v1:{public:{get:{ping:1,time:1,exchangeInfo:1,depth:{cost:1,byLimit:[[100,1],[500,5],[1e3,10]]},trades:1,historicalTrades:5,aggTrades:1,"ticker/24hr":{cost:1,noSymbol:40},"ticker/price":{cost:1,noSymbol:2},"ticker/bookTicker":{cost:1,noSymbol:2},"market/kline":1}},private:{get:{order:1,openOrders:1,allOrders:5,account:5,myTrades:{cost:5,noSymbol:40},"etf/net-value/{symbol}":1,"withdraw/history":1,"deposit/history":1},post:{order:4,"withdraw/commit":1},delete:{order:1}}},v2:{private:{get:{myTrades:5}}}},fapi:{v1:{public:{get:{ping:1,time:1,contracts:1,depth:1,ticker:1,klines:1}}},v2:{private:{get:{myTrades:1,openOrders:1,order:1,account:1,leverageBracket:1,commissionRate:1,futures_transfer_history:1,forceOrdersHistory:1},post:{positionMargin:1,level_edit:1,cancel:1,order:1,allOpenOrders:1,futures_transfer:1}}}},dapi:{v1:{public:{get:{ping:1,time:1,contracts:1,depth:1,ticker:1,klines:1}}},v2:{private:{get:{myTrades:1,openOrders:1,order:1,account:1,leverageBracket:1,commissionRate:1,futures_transfer_history:1,forceOrdersHistory:1},post:{positionMargin:1,level_edit:1,cancel:1,order:1,allOpenOrders:1,futures_transfer:1}}}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.00098"),maker:this.parseNumber("0.00098")},future:{trading:{feeSide:"quote",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000400"),maker:this.parseNumber("0.000200"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000400")],[this.parseNumber("250"),this.parseNumber("0.000400")],[this.parseNumber("2500"),this.parseNumber("0.000350")],[this.parseNumber("7500"),this.parseNumber("0.000320")],[this.parseNumber("22500"),this.parseNumber("0.000300")],[this.parseNumber("50000"),this.parseNumber("0.000270")],[this.parseNumber("100000"),this.parseNumber("0.000250")],[this.parseNumber("200000"),this.parseNumber("0.000220")],[this.parseNumber("400000"),this.parseNumber("0.000200")],[this.parseNumber("750000"),this.parseNumber("0.000170")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000200")],[this.parseNumber("250"),this.parseNumber("0.000160")],[this.parseNumber("2500"),this.parseNumber("0.000140")],[this.parseNumber("7500"),this.parseNumber("0.000120")],[this.parseNumber("22500"),this.parseNumber("0.000100")],[this.parseNumber("50000"),this.parseNumber("0.000080")],[this.parseNumber("100000"),this.parseNumber("0.000060")],[this.parseNumber("200000"),this.parseNumber("0.000040")],[this.parseNumber("400000"),this.parseNumber("0.000020")],[this.parseNumber("750000"),this.parseNumber("0")]]}}},delivery:{trading:{feeSide:"base",tierBased:!0,percentage:!0,taker:this.parseNumber("0.000500"),maker:this.parseNumber("0.000100"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.000500")],[this.parseNumber("250"),this.parseNumber("0.000450")],[this.parseNumber("2500"),this.parseNumber("0.000400")],[this.parseNumber("7500"),this.parseNumber("0.000300")],[this.parseNumber("22500"),this.parseNumber("0.000250")],[this.parseNumber("50000"),this.parseNumber("0.000240")],[this.parseNumber("100000"),this.parseNumber("0.000240")],[this.parseNumber("200000"),this.parseNumber("0.000240")],[this.parseNumber("400000"),this.parseNumber("0.000240")],[this.parseNumber("750000"),this.parseNumber("0.000240")]],maker:[[this.parseNumber("0"),this.parseNumber("0.000100")],[this.parseNumber("250"),this.parseNumber("0.000080")],[this.parseNumber("2500"),this.parseNumber("0.000050")],[this.parseNumber("7500"),this.parseNumber("0.0000030")],[this.parseNumber("22500"),this.parseNumber("0")],[this.parseNumber("50000"),this.parseNumber("-0.000050")],[this.parseNumber("100000"),this.parseNumber("-0.000060")],[this.parseNumber("200000"),this.parseNumber("-0.000070")],[this.parseNumber("400000"),this.parseNumber("-0.000080")],[this.parseNumber("750000"),this.parseNumber("-0.000090")]]}}}},options:{createMarketBuyOrderRequiresPrice:!0,fetchMarkets:["spot","linear","inverse"],fetchMyTradesMethod:"v2PrivateGetMyTrades",hasAlreadyAuthenticatedSuccessfully:!1,recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,parseOrderToPrecision:!1,newOrderRespType:{market:"FULL",limit:"FULL"},networks:{ERC20:"ETH",TRC20:"TRX"},defaultType:"spot",timeframes:{spot:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","12h":"12H","1d":"1D","1w":"1W"},future:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"1h","1d":"1day","1w":"1week","1M":"1month"}},accountsByType:{spot:"wallet",future:"contract",swap:"contract",funding:"wallet",fund:"wallet",contract:"contract"}},commonCurrencies:{MIM:"MIM Swarm"},precisionMode:o.sh,exceptions:{exact:{"System is under maintenance.":r.OnMaintenance,"System abnormality":r.ExchangeError,"You are not authorized to execute this request.":r.PermissionDenied,"API key does not exist":r.AuthenticationError,"Order would trigger immediately.":r.OrderImmediatelyFillable,"Stop price would trigger immediately.":r.OrderImmediatelyFillable,"Order would immediately match and take.":r.OrderImmediatelyFillable,"Account has insufficient balance for requested action.":r.InsufficientFunds,"Rest API trading is not enabled.":r.ExchangeNotAvailable,"You don't have permission.":r.PermissionDenied,"Market is closed.":r.ExchangeNotAvailable,"Too many requests. Please try again later.":r.DDoSProtection,"-1000":r.ExchangeNotAvailable,"-1001":r.ExchangeNotAvailable,"-1002":r.AuthenticationError,"-1003":r.RateLimitExceeded,"-1013":r.InvalidOrder,"-1015":r.RateLimitExceeded,"-1016":r.ExchangeNotAvailable,"-1020":r.BadRequest,"-1021":r.InvalidNonce,"-1022":r.AuthenticationError,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1111":r.BadRequest,"-1112":r.InvalidOrder,"-1114":r.BadRequest,"-1115":r.BadRequest,"-1116":r.BadRequest,"-1117":r.BadRequest,"-1166":r.InvalidOrder,"-1118":r.BadRequest,"-1119":r.BadRequest,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1125":r.AuthenticationError,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-1131":r.BadRequest,"-1160":r.InvalidOrder,"-1156":r.InvalidOrder,"-2008":r.AuthenticationError,"-2010":r.ExchangeError,"-2011":r.OrderNotFound,"-2013":r.OrderNotFound,"-2014":r.AuthenticationError,"-2015":r.AuthenticationError,"-2017":r.InsufficientFunds,"-2019":r.InsufficientFunds,"-3005":r.InsufficientFunds,"-3006":r.InsufficientFunds,"-3008":r.InsufficientFunds,"-3010":r.ExchangeError,"-3015":r.ExchangeError,"-3022":r.AccountSuspended,"-4028":r.BadRequest,"-3020":r.InsufficientFunds,"-3041":r.InsufficientFunds,"-5013":r.InsufficientFunds,"-11008":r.InsufficientFunds,"-4051":r.InsufficientFunds},broad:{"has no operation privilege":r.PermissionDenied,MAX_POSITION:r.InvalidOrder}}})}currencyToPrecision(e,t,s=void 0){return void 0!==this.safeValue(this.currencies[e],"precision")?this.decimalToPrecision(t,o.tk,this.currencies[e].precision,this.precisionMode,this.paddingMode):this.numberToString(t)}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchStatus(e={}){const t=await this.spotV1PublicGetPing(e);return{status:Object.keys(t).length?"maintenance":"ok",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchTime(e={}){const t=await this.spotV1PublicGetTime(e);return this.safeInteger(t,"serverTime")}safeNetwork(e){const t=e.toUpperCase();return this.safeString2({Aeternity:"Aeternity",AION:"AION",Algorand:"Algorand",ASK:"ASK",ATOM:"ATOM","AVAX C-Chain":"AVAX C-Chain",bch:"bch",BCH:"BCH",BEP2:"BEP2",BEP20:"BEP20",Bitcoin:"Bitcoin",BRP20:"BRP20",Cardano:"ADA",CasinoCoin:"CasinoCoin","CasinoCoin XRPL":"CasinoCoin XRPL",Contentos:"Contentos",Dash:"Dash",Decoin:"Decoin",DeFiChain:"DeFiChain",DGB:"DGB",Divi:"Divi",dogecoin:"DOGE",EOS:"EOS",ERC20:"ERC20",ETC:"ETC",Filecoin:"Filecoin",FREETON:"FREETON",HBAR:"HBAR","Hedera Hashgraph":"Hedera Hashgraph",HRC20:"HRC20",ICON:"ICON",ICP:"ICP",Ignis:"Ignis","Internet Computer":"Internet Computer",IOTA:"IOTA",KAVA:"KAVA",KSM:"KSM",LiteCoin:"LiteCoin",Luna:"Luna",MATIC:"MATIC","Mobile Coin":"Mobile Coin",MonaCoin:"MonaCoin",Monero:"Monero",NEM:"NEM",NEP5:"NEP5",OMNI:"OMNI",PAC:"PAC",Polkadot:"Polkadot",Ravencoin:"Ravencoin",Safex:"Safex",SOLANA:"SOL",Songbird:"Songbird","Stellar Lumens":"Stellar Lumens",Symbol:"Symbol",Tezos:"XTZ",theta:"theta",THETA:"THETA",TRC20:"TRC20",VeChain:"VeChain",VECHAIN:"VECHAIN",Wanchain:"Wanchain","XinFin Network":"XinFin Network",XRP:"XRP",XRPL:"XRPL",ZIL:"ZIL"},e,t,e)}async fetchCurrencies(e={}){const t=await this.spotV1PublicGetExchangeInfo(e),s={},i=this.safeValue(t,"coins",[]);for(let e=0;e100&&(t=100),e.limit=t),i.linear?a=await this.fapiV1PublicGetDepth(this.extend(e,s)):i.inverse&&(a=await this.dapiV1PublicGetDepth(this.extend(e,s)))}else{if(!i.spot)throw new r.NotSupported(this.id+" fetchOrderBook only support spot & swap markets");{const e={symbol:i.id};void 0!==t&&(t>1e3&&(t=1e3),e.limit=t),a=await this.spotV1PublicGetDepth(this.extend(e,s))}}const o=this.safeInteger(a,"time"),n=this.parseOrderBook(a,e,o);return n.nonce=this.safeInteger(a,"lastUpdateId"),n}parseTicker(e,t=void 0){const s=this.safeSymbol(void 0,t),i=this.safeString2(e,"lastPrice","last"),r=this.safeInteger(e,"time");let o;return o=t.swap?a.O.stringMul(this.safeString(e,"rose"),"100"):this.safeString(e,"priceChangePercent"),this.safeTicker({symbol:s,timestamp:r,datetime:this.iso8601(r),high:this.safeString2(e,"highPrice","high"),low:this.safeString2(e,"lowPrice","low"),bid:this.safeString2(e,"bidPrice","buy"),bidVolume:this.safeString(e,"bidQty"),ask:this.safeString2(e,"askPrice","sell"),askVolume:this.safeString(e,"askQty"),vwap:this.safeString(e,"weightedAvgPrice"),open:this.safeString(e,"openPrice"),close:i,last:i,previousClose:void 0,change:this.safeString(e,"priceChange"),percentage:o,average:void 0,baseVolume:this.safeString2(e,"volume","vol"),quoteVolume:this.safeString(e,"quoteVolume"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e);let i,a;if(s.swap){const e={contractName:s.id};s.linear?i=await this.fapiV1PublicGetTicker(this.extend(e,t)):s.inverse&&(i=await this.dapiV1PublicGetTicker(this.extend(e,t))),a=i}else{if(!s.spot)throw new r.NotSupported(this.id+" fetchTicker only support spot & swap markets");{const e={symbol:s.id};i=await this.spotV1PublicGetTicker24hr(this.extend(e,t)),a=this.safeValue(i,0,{})}}return this.parseTicker(a,s)}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.safeValue(this.options,"timeframes",{});let d,h;if(o.swap){const e=this.safeValue(n,"future",{}),s={contractName:o.id,interval:this.safeString(e,t,"1min")};void 0!==i&&(s.limit=i),o.linear?d=await this.fapiV1PublicGetKlines(this.extend(s,a)):o.inverse&&(d=await this.dapiV1PublicGetKlines(this.extend(s,a))),h=d}else{if(!o.spot)throw new r.NotSupported(this.id+" fetchOHLCV only support spot & swap markets");{const e=this.safeValue(n,"spot",{}),r={symbol:o.id,scale:this.safeString(e,t,"1m")};void 0!==i&&(r.limit=i),void 0!==s&&(r.fromIdx=s),d=await this.spotV1PublicGetMarketKline(this.extend(r,a)),h=this.safeValue(d,"data",[])}}return this.parseOHLCVs(h,o,t,s,i)}parseOHLCV(e,t=void 0){let s=this.safeTimestamp(e,"i");return void 0===s&&(s=this.safeInteger(e,"idx")),[s,this.safeNumber2(e,"o","open"),this.safeNumber2(e,"h","high"),this.safeNumber2(e,"l","low"),this.safeNumber2(e,"c","close"),this.safeNumber2(e,"v","vol")]}async fetchBidsAsks(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e,void 0,!1);const s=this.safeString(e,0),i=this.market(s);let a;if(i.swap){const e={contractName:i.id};i.linear?a=await this.fapiV1PublicGetTicker(this.extend(e,t)):i.inverse&&(a=await this.dapiV1PublicGetTicker(this.extend(e,t)))}else{if(!i.spot)throw new r.NotSupported(this.id+" fetchBidsAsks only support spot & swap markets");{const e={symbol:i.id};a=await this.spotV1PublicGetTickerBookTicker(this.extend(e,t))}}const o={};return o[i.id]=a,this.parseTickers(o,e)}async fetchTickers(e=void 0,t={}){let s,i;await this.loadMarkets();const a={};let o;if(void 0!==(e=this.marketSymbols(e))){const o=this.safeString(e,0),n=this.market(o);if(n.swap)throw new r.NotSupported(this.id+" fetchTickers does not support swap markets, please use fetchTicker instead");if(!n.spot)throw new r.NotSupported(this.id+" fetchTickers only support spot & swap markets");s=await this.spotV1PublicGetTicker24hr(this.extend(a,t)),i=s}else{if([o,t]=this.handleMarketTypeAndParams("fetchTickers",void 0,t),"spot"!==o)throw new r.NotSupported(this.id+" fetchTickers only support spot when symbols are not proved");s=await this.spotV1PublicGetTicker24hr(this.extend(a,t)),i=s}const n={};for(let e=0;e1e3&&(s=1e3),d.limit=s),a.swap)d.contractName=a.id,a.linear?o=await this.fapiV2PrivateGetMyTrades(this.extend(d,i)):a.inverse&&(o=await this.dapiV2PrivateGetMyTrades(this.extend(d,i))),n=this.safeValue(o,"data",[]);else{if(!a.spot)throw new r.NotSupported(this.id+" fetchMyTrades only support spot & swap markets");d.symbol=a.id,o=await this.spotV2PrivateGetMyTrades(this.extend(d,i)),n=o}return this.parseTrades(n,a,t,s)}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchDeposits() requires a code argument");await this.loadMarkets();const a=this.currency(e),o={coin:a.id,status:1};void 0!==t&&(o.startTime=t),void 0!==s&&(o.limit=s);const n=await this.spotV1PrivateGetDepositHistory(this.extend(o,i)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchWithdrawals() requires a code argument");await this.loadMarkets();const a=this.currency(e),o={coin:a.id,status:5};void 0!==t&&(o.startTime=t),void 0!==s&&(o.limit=s);const n=await this.spotV1PrivateGetWithdrawHistory(this.extend(o,i)),d=this.safeList(n,"data",[]);return this.parseTransactions(d,a)}parseTransactionStatusByType(e,t=void 0){const s=this.safeValue({deposit:{0:"pending",1:"ok"},withdrawal:{0:"pending",5:"ok",6:"canceled"}},t,{});return this.safeString(s,e,e)}parseTransaction(e,t=void 0){const s=this.safeString2(e,"id","withdrawId"),i=this.safeString(e,"tagType");let r,a,o=this.safeString(e,"addressTo"),n=this.safeString(e,"addressFrom");if(void 0!==i){if(void 0!==o){const e=o.split("_");o=this.safeString(e,0),r=this.safeString(e,1)}if(void 0!==n){const e=n.split("_");n=this.safeString(e,0),a=this.safeString(e,1)}}const d=this.safeString(e,"txid"),h=this.safeInteger(e,"createdAt"),c=this.safeInteger(e,"updatedAt"),l="payAmount"in e||"ctime"in e?"withdrawal":"deposit",u=this.parseTransactionStatusByType(this.safeString(e,"status"),l),p=this.safeNumber(e,"amount");let f,m=this.safeString2(e,"symbol","coin");if(void 0!==m){const e=m.split("_");m=this.safeString(e,0);const t=this.safeString(e,1);void 0!==t&&(f=t.toUpperCase())}const g=this.safeCurrencyCode(m,t),v=this.safeNumber(e,"fee");let y;return void 0!==v&&(y={currency:g,cost:v}),{info:e,id:s,txid:d,timestamp:h,datetime:this.iso8601(h),network:f,address:o,addressTo:o,addressFrom:n,tag:r,tagTo:r,tagFrom:a,type:l,amount:p,currency:g,status:u,updated:c,internal:!1,comment:void 0,fee:y}}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),this.checkAddress(s),await this.loadMarkets();const a=this.currency(e),o={coin:a.id,amount:t,addressTo:s};let n;[n,r]=this.handleNetworkCodeAndParams(r),void 0!==n&&(o.chainName=this.networkCodeToId(n)),void 0!==i&&(o.tag=i);const d=await this.spotV1PrivatePostWithdrawCommit(this.extend(o,r)),h=this.safeDict(d,"data",{});return this.parseTransaction(h,a)}parseDepositWithdrawFee(e,t=void 0){const s=this.safeValue(e,"chainDetail",[]),i=s.length,r={info:e,withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0},networks:{}};if(0!==i)for(let e=0;e200&&(s=200),r.limit=s);const o=this.safeInteger(i,"until");void 0!==o&&(i=this.omit(i,"until"),r.endTime=o);const n=await this.fapiV2PrivateGetFuturesTransferHistory(this.extend(r,i)),d=this.safeList(n,"data",[]);return this.parseTransfers(d,a,t,s)}async transfer(e,t,s,i,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeValue(this.options,"accountsByType",{}),n=this.safeString(o,s,s),d=this.safeString(o,i,i),h={coinSymbol:a.id,amount:this.currencyToPrecision(e,t),transferType:n+"_to_"+d},c=await this.fapiV2PrivatePostFuturesTransfer(this.extend(h,r)),l=this.safeDict(c,"data",{});return this.parseTransfer(l,a)}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");if(e<1||e>125)throw new r.BadRequest(this.id+" leverage should be between 1 and 125");await this.loadMarkets();const i=this.market(t);let a;const o={contractName:i.id,leverage:e};if(!i.swap)throw new r.NotSupported(this.id+" setLeverage only support swap markets");return i.linear?a=await this.fapiV2PrivatePostLevelEdit(this.extend(o,s)):i.inverse&&(a=await this.dapiV2PrivatePostLevelEdit(this.extend(o,s))),a}parseMarginModification(e,t=void 0){return{info:e,symbol:t.symbol,type:void 0,marginMode:"isolated",amount:void 0,total:void 0,code:void 0,status:void 0,timestamp:void 0,datetime:void 0}}async setMargin(e,t,s={}){await this.loadMarkets();const i=this.market(e);if(!i.swap)throw new r.NotSupported(this.id+" setMargin only support swap markets");let a;const o={contractName:i.id,amount:this.parseToNumeric(t)};return i.linear?a=await this.fapiV2PrivatePostPositionMargin(this.extend(o,s)):i.inverse&&(a=await this.dapiV2PrivatePostPositionMargin(this.extend(o,s))),this.parseMarginModification(a,i)}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){const o=this.safeString(t,0),d=this.safeString(t,1),h=this.safeString(t,2);let c;if(c="api"===o&&"kline"===d?this.urls.api[o]:this.urls.api[o]+"/"+d,c=c+"/"+this.implodeParams(e,i),i=this.omit(i,this.extractParams(e)),"private"===h){this.checkRequiredCredentials();const t=this.safeInteger(this.options,"recvWindow",5e3);if("spot"===o){let e=this.urlencode(this.extend({timestamp:this.nonce(),recvWindow:t},i));e+="&signature="+this.hmac(this.encode(e),this.encode(this.secret),n.J),r={"X-MBX-APIKEY":this.apiKey},"GET"===s||"DELETE"===s?c+="?"+e:(a=e,r["Content-Type"]="application/x-www-form-urlencoded")}else{const h=this.nonce().toString();let l;"fapi"===o?l="/fapi":"dapi"===o&&(l="/dapi"),l=l+"/"+d+"/"+e;let u=h+s+l;if("GET"===s){const e=this.hmac(this.encode(u),this.encode(this.secret),n.J);r={"X-CH-APIKEY":this.apiKey,"X-CH-SIGN":e,"X-CH-TS":h},c+="?"+this.urlencode(i)}else{const e=this.extend({recvWindow:t},i);a=this.json(e),u+=JSON.stringify(a);const s=this.hmac(this.encode(u),this.encode(this.secret),n.J);r={"Content-Type":"application/json","X-CH-APIKEY":this.apiKey,"X-CH-SIGN":s,"X-CH-TS":h}}}}else Object.keys(i).length&&(c+="?"+this.urlencode(i));return{url:c,method:s,body:a,headers:r}}handleErrors(e,t,s,i,o,n,d,h,c){if(418===e||429===e)throw new r.DDoSProtection(this.id+" "+e.toString()+" "+t+" "+n);if(e>=400){if(n.indexOf("Price * QTY is zero or less")>=0)throw new r.InvalidOrder(this.id+" order cost = amount * price is zero or less "+n);if(n.indexOf("LOT_SIZE")>=0)throw new r.InvalidOrder(this.id+" order amount should be evenly divisible by lot size "+n);if(n.indexOf("PRICE_FILTER")>=0)throw new r.InvalidOrder(this.id+" order price is invalid, i.e. exceeds allowed price precision, exceeds min price or max price limits or is invalid float value in general, use this.priceToPrecision (symbol, amount) "+n)}if(void 0===d)return;const l=this.safeBool(d,"success",!0);if(!l){const e=this.safeString(d,"msg");let t;if(void 0!==e){try{t=JSON.parse(e)}catch(e){t=void 0}void 0!==t&&(d=t)}}const u=this.safeString(d,"msg");void 0!==u&&(this.throwExactlyMatchedException(this.exceptions.exact,u,this.id+" "+u),this.throwBroadlyMatchedException(this.exceptions.broad,u,this.id+" "+u));const p=this.safeString(d,"code");if(void 0!==p){if("200"===p||a.O.stringEquals(p,"0"))return;if("-2015"===p&&this.options.hasAlreadyAuthenticatedSuccessfully)throw new r.DDoSProtection(this.id+" temporary banned: "+n);const e=this.id+" "+n;throw this.throwExactlyMatchedException(this.exceptions.exact,p,e),new r.ExchangeError(e)}if(!l)throw new r.ExchangeError(this.id+" "+n)}calculateRateLimiterCost(e,t,s,i,r={}){if("noSymbol"in r&&!("symbol"in i))return r.noSymbol;if("byLimit"in r&&"limit"in i){const e=i.limit,t=r.byLimit;for(let s=0;s{s.d(t,{Z:()=>d});var i=s(9581),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitso",name:"Bitso",countries:["MX"],rateLimit:2e3,version:"v3",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!1,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFee:!1,fetchTransactionFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87295554-11f98280-c50e-11ea-80d6-15b3bafa8cbf.jpg",api:{rest:"https://api.bitso.com"},www:"https://bitso.com",doc:"https://bitso.com/api_info",fees:"https://bitso.com/fees",referral:"https://bitso.com/?ref=itej"},precisionMode:o.sh,options:{precision:{XRP:1e-6,MXN:.01,TUSD:.01},defaultPrecision:1e-8},timeframes:{"1m":"60","5m":"300","15m":"900","30m":"1800","1h":"3600","4h":"14400","12h":"43200","1d":"86400","1w":"604800"},api:{public:{get:["available_books","ticker","order_book","trades","ohlc"]},private:{get:["account_status","balance","fees","fundings","fundings/{fid}","funding_destination","kyc_documents","ledger","ledger/trades","ledger/fees","ledger/fundings","ledger/withdrawals","mx_bank_codes","open_orders","order_trades/{oid}","orders/{oid}","user_trades","user_trades/{tid}","withdrawals/","withdrawals/{wid}"],post:["bitcoin_withdrawal","debit_card_withdrawal","ether_withdrawal","orders","phone_number","phone_verification","phone_withdrawal","spei_withdrawal","ripple_withdrawal","bcash_withdrawal","litecoin_withdrawal"],delete:["orders","orders/{oid}","orders/all"]}},exceptions:{"0201":r.AuthenticationError,104:r.InvalidNonce,"0304":r.BadRequest}})}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){const r={};void 0!==s&&(r.limit=s);const a=await this.privateGetLedger(this.extend(r,i)),o=this.safeValue(a,"payload",[]),n=this.safeCurrency(e);return this.parseLedger(o,n,t,s)}parseLedgerEntryType(e){return this.safeString({funding:"transaction",withdrawal:"transaction",trade:"trade",fee:"fee"},e,e)}parseLedgerEntry(e,t=void 0){const s=this.safeString(e,"operation"),i=this.parseLedgerEntryType(s),r=this.safeValue(e,"balance_updates",[]),o=this.safeValue(r,0,{});let n,d;const h=this.safeString(o,"amount"),c=this.safeString(o,"currency"),l=this.safeCurrencyCode(c,t),u=this.safeValue(e,"details",{});let p=this.safeString2(u,"fid","wid");if(void 0===p&&(p=this.safeString(u,"tid")),"funding"===s)n="in";else if("withdrawal"===s)n="out";else if("trade"===s)n=void 0;else if("fee"===s){n="out";d={cost:a.O.stringAbs(h),currency:t}}const f=this.parse8601(this.safeString(e,"created_at"));return this.safeLedgerEntry({id:this.safeString(e,"eid"),direction:n,account:void 0,referenceId:p,referenceAccount:void 0,type:i,currency:l,amount:h,timestamp:f,datetime:this.iso8601(f),before:void 0,after:void 0,status:"ok",fee:d,info:e},t)}async fetchMarkets(e={}){const t=await this.publicGetAvailableBooks(e),s=this.safeValue(t,"payload",[]),i=[];for(let e=0;e=0){const e=a.split("?dt=");a=this.safeString(e,0),r=this.safeString(e,1)}return this.checkAddress(a),{currency:e,address:a,tag:r,network:void 0,info:i}}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const s=await this.privateGetFees(t),i={},r=this.safeValue(s,"payload",{}),a=this.safeValue(r,"deposit_fees",[]);for(let t=0;t{s.d(t,{Z:()=>d});var i=s(1573),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitstamp",name:"Bitstamp",countries:["GB"],rateLimit:75,version:"v2",userAgent:this.userAgents.chrome,pro:!0,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactionFees:!0,fetchTransactions:"emulated",fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!0,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/27786377-8c8ab57e-5fe9-11e7-8ea4-2b05b6bcceec.jpg",api:{public:"https://www.bitstamp.net/api",private:"https://www.bitstamp.net/api"},www:"https://www.bitstamp.net",doc:"https://www.bitstamp.net/api"},timeframes:{"1m":"60","3m":"180","5m":"300","15m":"900","30m":"1800","1h":"3600","2h":"7200","4h":"14400","6h":"21600","12h":"43200","1d":"86400","1w":"259200"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:{"ohlc/{pair}/":1,"order_book/{pair}/":1,"ticker/":1,"ticker_hour/{pair}/":1,"ticker/{pair}/":1,"transactions/{pair}/":1,"trading-pairs-info/":1,"currencies/":1,"eur_usd/":1,"travel_rule/vasps/":1}},private:{get:{"travel_rule/contacts/":1,"contacts/{contact_uuid}/":1,"earn/subscriptions/":1,"earn/transactions/":1},post:{"account_balances/":1,"account_balances/{currency}/":1,"balance/":1,"balance/{pair}/":1,"bch_withdrawal/":1,"bch_address/":1,"user_transactions/":1,"user_transactions/{pair}/":1,"crypto-transactions/":1,"open_orders/all/":1,"open_orders/{pair}/":1,"order_status/":1,"cancel_order/":1,"cancel_all_orders/":1,"cancel_all_orders/{pair}/":1,"buy/{pair}/":1,"buy/market/{pair}/":1,"buy/instant/{pair}/":1,"sell/{pair}/":1,"sell/market/{pair}/":1,"sell/instant/{pair}/":1,"transfer-to-main/":1,"transfer-from-main/":1,"my_trading_pairs/":1,"fees/trading/":1,"fees/trading/{market_symbol}":1,"fees/withdrawal/":1,"fees/withdrawal/{currency}/":1,"withdrawal-requests/":1,"withdrawal/open/":1,"withdrawal/status/":1,"withdrawal/cancel/":1,"liquidation_address/new/":1,"liquidation_address/info/":1,"btc_unconfirmed/":1,"websockets_token/":1,"btc_withdrawal/":1,"btc_address/":1,"ripple_withdrawal/":1,"ripple_address/":1,"ltc_withdrawal/":1,"ltc_address/":1,"eth_withdrawal/":1,"eth_address/":1,"xrp_withdrawal/":1,"xrp_address/":1,"xlm_withdrawal/":1,"xlm_address/":1,"pax_withdrawal/":1,"pax_address/":1,"link_withdrawal/":1,"link_address/":1,"usdc_withdrawal/":1,"usdc_address/":1,"omg_withdrawal/":1,"omg_address/":1,"dai_withdrawal/":1,"dai_address/":1,"knc_withdrawal/":1,"knc_address/":1,"mkr_withdrawal/":1,"mkr_address/":1,"zrx_withdrawal/":1,"zrx_address/":1,"gusd_withdrawal/":1,"gusd_address/":1,"aave_withdrawal/":1,"aave_address/":1,"bat_withdrawal/":1,"bat_address/":1,"uma_withdrawal/":1,"uma_address/":1,"snx_withdrawal/":1,"snx_address/":1,"uni_withdrawal/":1,"uni_address/":1,"yfi_withdrawal/":1,yfi_address:1,"audio_withdrawal/":1,"audio_address/":1,"crv_withdrawal/":1,"crv_address/":1,"algo_withdrawal/":1,"algo_address/":1,"comp_withdrawal/":1,"comp_address/":1,grt_withdrawal:1,"grt_address/":1,"usdt_withdrawal/":1,"usdt_address/":1,"eurt_withdrawal/":1,"eurt_address/":1,"matic_withdrawal/":1,"matic_address/":1,"sushi_withdrawal/":1,"sushi_address/":1,"chz_withdrawal/":1,"chz_address/":1,"enj_withdrawal/":1,"enj_address/":1,"alpha_withdrawal/":1,"alpha_address/":1,"ftt_withdrawal/":1,"ftt_address/":1,"storj_withdrawal/":1,"storj_address/":1,"axs_withdrawal/":1,"axs_address/":1,"sand_withdrawal/":1,"sand_address/":1,"hbar_withdrawal/":1,"hbar_address/":1,"rgt_withdrawal/":1,"rgt_address/":1,"fet_withdrawal/":1,"fet_address/":1,"skl_withdrawal/":1,"skl_address/":1,"cel_withdrawal/":1,"cel_address/":1,"sxp_withdrawal/":1,"sxp_address/":1,"ada_withdrawal/":1,"ada_address/":1,"slp_withdrawal/":1,"slp_address/":1,"ftm_withdrawal/":1,"ftm_address/":1,"perp_withdrawal/":1,"perp_address/":1,"dydx_withdrawal/":1,"dydx_address/":1,"gala_withdrawal/":1,"gala_address/":1,"shib_withdrawal/":1,"shib_address/":1,"amp_withdrawal/":1,"amp_address/":1,"sgb_withdrawal/":1,"sgb_address/":1,"avax_withdrawal/":1,"avax_address/":1,"wbtc_withdrawal/":1,"wbtc_address/":1,"ctsi_withdrawal/":1,"ctsi_address/":1,"cvx_withdrawal/":1,"cvx_address/":1,"imx_withdrawal/":1,"imx_address/":1,"nexo_withdrawal/":1,"nexo_address/":1,"ust_withdrawal/":1,"ust_address/":1,"ant_withdrawal/":1,"ant_address/":1,"gods_withdrawal/":1,"gods_address/":1,"rad_withdrawal/":1,"rad_address/":1,"band_withdrawal/":1,"band_address/":1,"inj_withdrawal/":1,"inj_address/":1,"rly_withdrawal/":1,"rly_address/":1,"rndr_withdrawal/":1,"rndr_address/":1,"vega_withdrawal/":1,"vega_address/":1,"1inch_withdrawal/":1,"1inch_address/":1,"ens_withdrawal/":1,"ens_address/":1,"mana_withdrawal/":1,"mana_address/":1,"lrc_withdrawal/":1,"lrc_address/":1,"ape_withdrawal/":1,"ape_address/":1,"mpl_withdrawal/":1,"mpl_address/":1,"euroc_withdrawal/":1,"euroc_address/":1,"sol_withdrawal/":1,"sol_address/":1,"dot_withdrawal/":1,"dot_address/":1,"near_withdrawal/":1,"near_address/":1,"doge_withdrawal/":1,"doge_address/":1,"flr_withdrawal/":1,"flr_address/":1,"dgld_withdrawal/":1,"dgld_address/":1,"ldo_withdrawal/":1,"ldo_address/":1,"travel_rule/contacts/":1,"earn/subscribe/":1,"earn/subscriptions/setting/":1,"earn/unsubscribe":1,"wecan_withdrawal/":1,"wecan_address/":1,"trac_withdrawal/":1,"trac_address/":1,"eurcv_withdrawal/":1,"eurcv_address/":1,"pyusd_withdrawal/":1,"pyusd_address/":1,"lmwr_withdrawal/":1,"lmwr_address/":1,"pepe_withdrawal/":1,"pepe_address/":1,"blur_withdrawal/":1,"blur_address/":1,"vext_withdrawal/":1,"vext_address/":1,"cspr_withdrawal/":1,"cspr_address/":1,"vchf_withdrawal/":1,"vchf_address/":1,"veur_withdrawal/":1,"veur_address/":1}}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.005"),maker:this.parseNumber("0.005"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.005")],[this.parseNumber("20000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0024")],[this.parseNumber("200000"),this.parseNumber("0.0022")],[this.parseNumber("400000"),this.parseNumber("0.0020")],[this.parseNumber("600000"),this.parseNumber("0.0015")],[this.parseNumber("1000000"),this.parseNumber("0.0014")],[this.parseNumber("2000000"),this.parseNumber("0.0013")],[this.parseNumber("4000000"),this.parseNumber("0.0012")],[this.parseNumber("20000000"),this.parseNumber("0.0011")],[this.parseNumber("50000000"),this.parseNumber("0.0010")],[this.parseNumber("100000000"),this.parseNumber("0.0007")],[this.parseNumber("500000000"),this.parseNumber("0.0005")],[this.parseNumber("2000000000"),this.parseNumber("0.0003")],[this.parseNumber("6000000000"),this.parseNumber("0.0001")],[this.parseNumber("20000000000"),this.parseNumber("0.00005")],[this.parseNumber("20000000001"),this.parseNumber("0")]],maker:[[this.parseNumber("0"),this.parseNumber("0.005")],[this.parseNumber("20000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0024")],[this.parseNumber("200000"),this.parseNumber("0.0022")],[this.parseNumber("400000"),this.parseNumber("0.0020")],[this.parseNumber("600000"),this.parseNumber("0.0015")],[this.parseNumber("1000000"),this.parseNumber("0.0014")],[this.parseNumber("2000000"),this.parseNumber("0.0013")],[this.parseNumber("4000000"),this.parseNumber("0.0012")],[this.parseNumber("20000000"),this.parseNumber("0.0011")],[this.parseNumber("50000000"),this.parseNumber("0.0010")],[this.parseNumber("100000000"),this.parseNumber("0.0007")],[this.parseNumber("500000000"),this.parseNumber("0.0005")],[this.parseNumber("2000000000"),this.parseNumber("0.0003")],[this.parseNumber("6000000000"),this.parseNumber("0.0001")],[this.parseNumber("20000000000"),this.parseNumber("0.00005")],[this.parseNumber("20000000001"),this.parseNumber("0")]]}},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{BTC:0,BCH:0,LTC:0,ETH:0,XRP:0,XLM:0,PAX:0,USD:7.5,EUR:0}}},precisionMode:o.sh,commonCurrencies:{UST:"USTC"},options:{networksById:{"bitcoin-cash":"BCH",bitcoin:"BTC",ethereum:"ERC20",litecoin:"LTC",stellar:"XLM",xrpl:"XRP",tron:"TRC20",algorand:"ALGO",flare:"FLR",hedera:"HBAR",cardana:"ADA",songbird:"FLR","avalanche-c-chain":"AVAX",solana:"SOL",polkadot:"DOT",near:"NEAR",doge:"DOGE",sui:"SUI",casper:"CSRP"}},exceptions:{exact:{"No permission found":r.PermissionDenied,"API key not found":r.AuthenticationError,"IP address not allowed":r.PermissionDenied,"Invalid nonce":r.InvalidNonce,"Invalid signature":r.AuthenticationError,"Authentication failed":r.AuthenticationError,"Missing key, signature and nonce parameters":r.AuthenticationError,"Wrong API key format":r.AuthenticationError,"Your account is frozen":r.PermissionDenied,"Please update your profile with your FATCA information, before using API.":r.PermissionDenied,"Order not found.":r.OrderNotFound,"Price is more than 20% below market price.":r.InvalidOrder,"Bitstamp.net is under scheduled maintenance. We'll be back soon.":r.OnMaintenance,"Order could not be placed.":r.ExchangeNotAvailable,"Invalid offset.":r.BadRequest},broad:{"Minimum order size is":r.InvalidOrder,"Check your account balance for details.":r.InsufficientFunds,"Ensure this value has at least":r.InvalidAddress,"Ensure that there are no more than":r.InvalidOrder}}})}async fetchMarkets(e={}){const t=await this.fetchMarketsFromCache(e),s=[];for(let e=0;ei){const s=await this.publicGetTradingPairsInfo(e);this.options.fetchMarkets=this.extend(t,{response:s,timestamp:r})}return this.safeValue(this.options.fetchMarkets,"response")}async fetchCurrencies(e={}){const t=await this.fetchMarketsFromCache(e),s={};for(let e=0;e2)throw new r.ExchangeError(this.id+" getMarketFromTrade() too many keys: "+this.json(t)+" in the trade: "+this.json(e));if(2===s){let e=t[0]+t[1];if(e in this.markets_by_id)return this.safeMarket(e);if(e=t[1]+t[0],e in this.markets_by_id)return this.safeMarket(e)}}parseTrade(e,t=void 0){const s=this.safeString2(e,"id","tid");let i,r,o=this.safeString(e,"price"),n=this.safeString(e,"amount");const d=this.safeString(e,"order_id");let h,c=this.safeString(e,"cost");if(void 0===t){const s=Object.keys(e);for(let e=0;e=0&&(h=i,t=this.safeMarket(h,t,"_"))}}void 0===t&&(t=this.getMarketFromTrade(e));const l=this.safeString(e,"fee"),u=t.quote,p=void 0!==h?h:t.marketId;o=this.safeString(e,p,o),n=this.safeString(e,t.baseId,n),c=this.safeString(e,t.quoteId,c),i=t.symbol;const f=this.safeString2(e,"date","datetime");let m,g;if(void 0!==f&&(f.indexOf(" ")>=0?m=this.parse8601(f):(m=parseInt(f),m*=1e3)),"id"in e){if(void 0!==n){a.O.stringLt(n,"0")?(r="sell",n=a.O.stringNeg(n)):r="buy"}}else r=this.safeString(e,"type"),r="1"===r?"sell":"0"===r?"buy":void 0;return void 0!==c&&(c=a.O.stringAbs(c)),void 0!==l&&(g={cost:l,currency:u}),this.safeTrade({id:s,info:e,timestamp:m,datetime:this.iso8601(m),symbol:i,order:d,type:undefined,side:r,takerOrMaker:void 0,price:o,amount:n,cost:c,fee:g},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.market(e),a={pair:r.id,time:"hour"},o=await this.publicGetTransactionsPair(this.extend(a,i));return this.parseTrades(o,r,t,s)}parseOHLCV(e,t=void 0){return[this.safeTimestamp(e,"timestamp"),this.safeNumber(e,"open"),this.safeNumber(e,"high"),this.safeNumber(e,"low"),this.safeNumber(e,"close"),this.safeNumber(e,"volume")]}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,r={}){await this.loadMarkets();const a=this.market(e),o={pair:a.id,step:this.safeString(this.timeframes,t,t)},n=this.parseTimeframe(t);if(void 0===i)if(void 0===s)o.limit=1e3;else{i=1e3;const e=this.parseToInt(s/1e3);o.start=e,o.end=this.sum(e,n*(i-1)),o.limit=i}else{if(void 0!==s){const e=this.parseToInt(s/1e3);o.start=e,o.end=this.sum(e,n*(i-1))}o.limit=Math.min(i,1e3)}const d=await this.publicGetOhlcPair(this.extend(o,r)),h=this.safeValue(d,"data",{}),c=this.safeList(h,"ohlc",[]);return this.parseOHLCVs(c,a,t,s,i)}parseBalance(e){const t={info:e,timestamp:void 0,datetime:void 0};void 0===e&&(e=[]);for(let s=0;s1&&(u=e[0],c=e[1])}let p={currency:void 0,cost:void 0,rate:void 0};return void 0!==o&&(p={currency:n,cost:o,rate:void 0}),{info:e,id:this.safeString(e,"id"),txid:this.safeString(e,"transaction_id"),type:h,currency:r,network:void 0,amount:this.parseNumber(d),status:l,timestamp:s,datetime:this.iso8601(s),address:u,addressFrom:void 0,addressTo:u,tag:c,tagFrom:void 0,tagTo:c,updated:void 0,comment:void 0,internal:void 0,fee:p}}parseTransactionStatus(e){return this.safeString({0:"pending",1:"pending",2:"ok",3:"canceled",4:"failed"},e,e)}parseOrder(e,t=void 0){const s=this.safeString(e,"id"),i=this.safeString(e,"client_order_id");let r=this.safeString(e,"type");void 0!==r&&(r="1"===r?"sell":"buy");const a=this.parse8601(this.safeString(e,"datetime")),o=this.safeStringLower(e,"currency_pair"),n=this.safeSymbol(o,t,"/"),d=this.parseOrderStatus(this.safeString(e,"status")),h=this.safeString(e,"amount"),c=this.safeValue(e,"transactions",[]),l=this.safeString(e,"price");return this.safeOrder({id:s,clientOrderId:i,datetime:this.iso8601(a),timestamp:a,lastTradeTimestamp:void 0,status:d,symbol:n,type:void 0,timeInForce:void 0,postOnly:void 0,side:r,price:l,stopPrice:void 0,triggerPrice:void 0,cost:void 0,amount:h,filled:void 0,remaining:void 0,trades:c,fee:void 0,info:e,average:void 0},t)}parseLedgerEntryType(e){return this.safeString({0:"transaction",1:"transaction",2:"trade",14:"transfer"},e,e)}parseLedgerEntry(e,t=void 0){const s=this.parseLedgerEntryType(this.safeString(e,"type"));if("trade"===s){const t=this.parseTrade(e);let i;const r=Object.keys(e);for(let e=0;e=0){const t=r[e].replace("_","");i=this.safeMarket(t,i)}void 0===i&&(i=this.getMarketFromTrade(e));const a="buy"===t.side?"in":"out";return{id:t.id,info:e,timestamp:t.timestamp,datetime:t.datetime,direction:a,account:void 0,referenceId:t.order,referenceAccount:void 0,type:s,currency:i.base,amount:t.amount,before:void 0,after:void 0,status:"ok",fee:t.fee}}{const i=this.parseTransaction(e,t);let r;if("amount"in e){const t=this.safeString(e,"amount");r=a.O.stringGt(t,"0")?"in":"out"}else if("currency"in i&&void 0!==i.currency){const s=this.safeString(i,"currency");t=this.currency(s);const o=this.safeString(e,t.id);r=a.O.stringGt(o,"0")?"in":"out"}return{id:i.id,info:e,timestamp:i.timestamp,datetime:i.datetime,direction:r,account:void 0,referenceId:i.txid,referenceAccount:void 0,type:s,currency:i.currency,amount:i.amount,before:void 0,after:void 0,status:i.status,fee:i.fee}}}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};void 0!==s&&(r.limit=s);const a=await this.privatePostUserTransactions(this.extend(r,i));let o;return void 0!==e&&(o=this.currency(e)),this.parseLedger(a,o,t,s)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a=await this.privatePostOpenOrdersAll(i);return this.parseOrders(a,r,t,s,{status:"open",type:"limit"})}getCurrencyName(e){return e.toLowerCase()}isFiat(e){return"USD"===e||"EUR"===e||"GBP"===e}async fetchDepositAddress(e,t={}){if(this.isFiat(e))throw new r.NotSupported(this.id+" fiat fetchDepositAddress() for "+e+" is not supported!");const s=this.getCurrencyName(e),i="privatePost"+this.capitalize(s)+"Address",a=await this[i](t),o=this.safeString(a,"address"),n=this.safeString2(a,"memo_id","destination_tag");return this.checkAddress(o),{currency:e,address:o,tag:n,network:void 0,info:a}}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),await this.loadMarkets(),this.checkAddress(s);const a={amount:t};let o,n;if(this.isFiat(e))n="privatePostWithdrawalOpen",o=this.currency(e),a.iban=s,a.account_currency=o.id;else{const t=this.getCurrencyName(e);n="privatePost"+this.capitalize(t)+"Withdrawal","XRP"===e?void 0!==i&&(a.destination_tag=i):"XLM"!==e&&"HBAR"!==e||void 0!==i&&(a.memo_id=i),a.address=s}const d=await this[n](this.extend(a,r));return this.parseTransaction(d,o)}async transfer(e,t,s,i,a={}){await this.loadMarkets();const o=this.currency(e);t=this.currencyToPrecision(e,t);const n={amount:t=this.parseToNumeric(t),currency:o.id.toUpperCase()};let d;if("main"===s)n.subAccount=i,d=await this.privatePostTransferFromMain(this.extend(n,a));else{if("main"!==i)throw new r.BadRequest(this.id+" transfer() only supports from or to main");n.subAccount=s,d=await this.privatePostTransferToMain(this.extend(n,a))}const h=this.parseTransfer(d,o);return h.amount=t,h.fromAccount=s,h.toAccount=i,h}parseTransfer(e,t=void 0){const s=this.safeString(e,"status");return{info:e,id:void 0,timestamp:void 0,datetime:void 0,currency:t.code,amount:void 0,fromAccount:void 0,toAccount:void 0,status:this.parseTransferStatus(s)}}parseTransferStatus(e){return this.safeString({ok:"ok",error:"failed"},e,e)}nonce(){return this.milliseconds()}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o=this.urls.api[t]+"/";o+=this.version+"/",o+=this.implodeParams(e,i);const d=this.omit(i,this.extractParams(e));if("public"===t)Object.keys(d).length&&(o+="?"+this.urlencode(d));else{this.checkRequiredCredentials();const e="BITSTAMP "+this.apiKey,t=this.uuid(),i=this.milliseconds().toString(),h="v2";let c="";r={"X-Auth":e,"X-Auth-Nonce":t,"X-Auth-Timestamp":i,"X-Auth-Version":h},"POST"===s&&(Object.keys(d).length?(a=this.urlencode(d),c="application/x-www-form-urlencoded",r["Content-Type"]=c):(a=this.urlencode({foo:"bar"}),c="application/x-www-form-urlencoded",r["Content-Type"]=c));const l=a||"",u=e+s+o.replace("https://","")+c+t+i+h+l,p=this.hmac(this.encode(u),this.encode(this.secret),n.J);r["X-Auth-Signature"]=p}return{url:o,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"status"),l=this.safeValue(n,"error");if("error"===c||void 0!==l){let e=[];if("string"==typeof l)e.push(l);else if(void 0!==l){const t=Object.keys(l);for(let s=0;s{s.d(t,{Z:()=>n});var i=s(133),r=s(6689),a=s(9292),o=s(2194);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitteam",name:"BIT.TEAM",countries:["UK"],version:"v2.0.6",rateLimit:1,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,borrowMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,createDepositAddress:!1,createOrder:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,deposit:!1,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!0,fetchOrderTrades:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!0,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!1,withdraw:!1,ws:!1},timeframes:{"1m":"1","5m":"5","15m":"15","1h":"60","1d":"1D"},urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/cf71fe3d-b8b4-40f2-a906-907661b28793",api:{history:"https://history.bit.team",public:"https://bit.team",private:"https://bit.team"},www:"https://bit.team/",referral:"https://bit.team/auth/sign-up?ref=bitboy2023",doc:["https://bit.team/trade/api/documentation"]},api:{history:{get:{"api/tw/history/{pairName}/{resolution}":1}},public:{get:{"trade/api/asset":1,"trade/api/currencies":1,"trade/api/orderbooks/{symbol}":1,"trade/api/orders":1,"trade/api/pair/{name}":1,"trade/api/pairs":1,"trade/api/pairs/precisions":1,"trade/api/rates":1,"trade/api/trade/{id}":1,"trade/api/trades":1,"trade/api/ccxt/pairs":1,"trade/api/cmc/assets":1,"trade/api/cmc/orderbook/{pair}":1,"trade/api/cmc/summary":1,"trade/api/cmc/ticker":1,"trade/api/cmc/trades/{pair}":1}},private:{get:{"trade/api/ccxt/balance":1,"trade/api/ccxt/order/{id}":1,"trade/api/ccxt/ordersOfUser":1,"trade/api/ccxt/tradesOfUser":1,"trade/api/transactionsOfUser":1},post:{"trade/api/ccxt/cancel-all-order":1,"trade/api/ccxt/cancelorder":1,"trade/api/ccxt/ordercreate":1}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")}},precisionMode:a.nr,options:{networksById:{Ethereum:"ERC20",ethereum:"ERC20",Tron:"TRC20",tron:"TRC20",Binance:"BSC",binance:"BSC","Binance Smart Chain":"BSC",bscscan:"BSC",Bitcoin:"BTC",bitcoin:"BTC",Litecoin:"LTC",litecoin:"LTC",Polygon:"POLYGON",polygon:"POLYGON",PRIZM:"PRIZM",Decimal:"Decimal",ufobject:"ufobject",tonchain:"tonchain"},currenciesValuedInUsd:{USDT:!0,BUSD:!0}},exceptions:{exact:{400002:r.BadSymbol,401e3:r.AuthenticationError,403002:r.BadRequest,404200:r.BadSymbol},broad:{"is not allowed":r.BadRequest,"Insufficient funds":r.InsufficientFunds,"Invalid request params input":r.BadRequest,"must be a number":r.BadRequest,"must be a string":r.BadRequest,"must be of type":r.BadRequest,"must be one of":r.BadRequest,"Order not found":r.OrderNotFound,"Pair with pair name":r.BadSymbol,pairName:r.BadSymbol,"Service Unavailable":r.ExchangeNotAvailable,"Symbol ":r.BadSymbol}}})}async fetchMarkets(e={}){const t=await this.publicGetTradeApiCcxtPairs(e),s=this.safeValue(t,"result",{}),i=this.safeValue(s,"pairs",[]);return this.parseMarkets(i)}parseMarket(e){const t=this.safeString(e,"name"),s=this.safeInteger(e,"id"),i=t.split("_"),r=this.safeString(i,0),a=this.safeString(i,1),o=this.safeCurrencyCode(r),n=this.safeCurrencyCode(a),d=this.safeValue(e,"active"),h=this.safeInteger(e,"baseStep"),c=this.safeInteger(e,"quoteStep"),l=this.safeString(e,"timeStart"),u=this.parse8601(l);let p;const f=this.safeValue(this.options,"currenciesValuedInUsd",{});if(this.safeBool(f,n,!1)){const t=this.safeValue(e,"settings",{});p=this.safeNumber(t,"limit_usd")}return this.safeMarketStructure({id:t,numericId:s,symbol:o+"/"+n,base:o,quote:n,settle:void 0,baseId:r,quoteId:a,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:d,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:h,price:c},limits:{leverage:{min:void 0,max:void 0},amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:p,max:void 0}},created:u,info:e})}async fetchCurrencies(e={}){const t=await this.publicGetTradeApiCurrencies(e),s=this.safeValue(t,"result",{}),i=this.safeValue(s,"currencies",[]);let r=await this.publicGetTradeApiCmcAssets();r=this.indexBy(r,"unified_cryptoasset_id");const a={};for(let e=0;e=0&&"GET"===i){const e=s.split("/order/"),t=this.safeString(e,1);throw new r.OrderNotFound(this.id+" order "+t+" not found")}if(s.indexOf("/cmc/orderbook/")>=0){const e=s.split("/cmc/orderbook/"),t=this.safeString(e,1);throw new r.BadSymbol(this.id+" symbolId "+t+" not found")}}const t=this.id+" "+o,a=this.safeString(n,"message"),d=this.safeString(n,"code");throw this.throwBroadlyMatchedException(this.exceptions.broad,a,t),this.throwExactlyMatchedException(this.exceptions.exact,d,t),new r.ExchangeError(t)}}}},9943:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(15),r=s(6689),a=s(9292),o=s(2194),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bitvavo",name:"Bitvavo",countries:["NL"],rateLimit:60,version:"v2",certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d"},urls:{logo:"https://user-images.githubusercontent.com/1294454/169202626-bd130fc5-fcf9-41bb-8d97-6093225c73cd.jpg",api:{public:"https://api.bitvavo.com",private:"https://api.bitvavo.com"},www:"https://bitvavo.com/",doc:"https://docs.bitvavo.com/",fees:"https://bitvavo.com/en/fees",referral:"https://bitvavo.com/?a=24F34952F7"},api:{public:{get:{time:1,markets:1,assets:1,"{market}/book":1,"{market}/trades":5,"{market}/candles":1,"ticker/price":1,"ticker/book":1,"ticker/24h":{cost:1,noMarket:25}}},private:{get:{account:1,order:1,orders:5,ordersOpen:{cost:1,noMarket:25},trades:5,balance:5,deposit:1,depositHistory:5,withdrawalHistory:5},post:{order:1,withdrawal:1},put:{order:1},delete:{order:1,orders:1}}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0025"),maker:this.parseNumber("0.002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0020")],[this.parseNumber("250000"),this.parseNumber("0.0016")],[this.parseNumber("500000"),this.parseNumber("0.0012")],[this.parseNumber("1000000"),this.parseNumber("0.0010")],[this.parseNumber("2500000"),this.parseNumber("0.0008")],[this.parseNumber("5000000"),this.parseNumber("0.0006")],[this.parseNumber("10000000"),this.parseNumber("0.0005")],[this.parseNumber("25000000"),this.parseNumber("0.0004")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.0010")],[this.parseNumber("250000"),this.parseNumber("0.0008")],[this.parseNumber("500000"),this.parseNumber("0.0006")],[this.parseNumber("1000000"),this.parseNumber("0.0005")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0004")],[this.parseNumber("10000000"),this.parseNumber("0.0003")],[this.parseNumber("25000000"),this.parseNumber("0.0003")]]}}},requiredCredentials:{apiKey:!0,secret:!0},exceptions:{exact:{101:r.ExchangeError,102:r.BadRequest,103:r.RateLimitExceeded,104:r.RateLimitExceeded,105:r.PermissionDenied,107:r.ExchangeNotAvailable,108:r.ExchangeNotAvailable,109:r.ExchangeNotAvailable,110:r.BadRequest,200:r.BadRequest,201:r.BadRequest,202:r.BadRequest,203:r.BadSymbol,204:r.BadRequest,205:r.BadRequest,206:r.BadRequest,210:r.InvalidOrder,211:r.InvalidOrder,212:r.InvalidOrder,213:r.InvalidOrder,214:r.InvalidOrder,215:r.InvalidOrder,216:r.InsufficientFunds,217:r.InvalidOrder,230:r.ExchangeError,231:r.ExchangeError,232:r.BadRequest,233:r.InvalidOrder,234:r.InvalidOrder,235:r.ExchangeError,236:r.BadRequest,240:r.OrderNotFound,300:r.AuthenticationError,301:r.AuthenticationError,302:r.AuthenticationError,303:r.AuthenticationError,304:r.AuthenticationError,305:r.AuthenticationError,306:r.AuthenticationError,307:r.PermissionDenied,308:r.AuthenticationError,309:r.AuthenticationError,310:r.PermissionDenied,311:r.PermissionDenied,312:r.PermissionDenied,315:r.BadRequest,317:r.AccountSuspended,400:r.ExchangeError,401:r.ExchangeError,402:r.PermissionDenied,403:r.PermissionDenied,404:r.OnMaintenance,405:r.ExchangeError,406:r.BadRequest,407:r.ExchangeError,408:r.InsufficientFunds,409:r.InvalidAddress,410:r.ExchangeError,411:r.BadRequest,412:r.InvalidAddress,413:r.InvalidAddress,414:r.ExchangeError},broad:{"start parameter is invalid":r.BadRequest,"symbol parameter is invalid":r.BadSymbol,"amount parameter is invalid":r.InvalidOrder,"orderId parameter is invalid":r.InvalidOrder}},options:{"BITVAVO-ACCESS-WINDOW":1e4,networks:{ERC20:"ETH",TRC20:"TRX"}},precisionMode:a.tV,commonCurrencies:{MIOTA:"IOTA"}})}currencyToPrecision(e,t,s=void 0){return this.decimalToPrecision(t,0,this.currencies[e].precision,a.nr)}amountToPrecision(e,t){return this.decimalToPrecision(t,a.tk,this.markets[e].precision.amount,a.nr)}priceToPrecision(e,t){return t=this.decimalToPrecision(t,a.oU,this.markets[e].precision.price,this.precisionMode),this.decimalToPrecision(t,a.tk,8,a.nr)}async fetchTime(e={}){const t=await this.publicGetTime(e);return this.safeInteger(t,"time")}async fetchMarkets(e={}){const t=await this.publicGetMarkets(e);return this.parseMarkets(t)}parseMarkets(e){const t=this.currencies,s=this.indexBy(t,"id"),i=[],r=this.fees;for(let t=0;t{s.d(t,{Z:()=>n});var i=s(858),r=s(2194),a=s(9292),o=s(7110);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bl3p",name:"BL3P",countries:["NL"],rateLimit:1e3,version:"1",comment:"An exchange market by BitonicNL",pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchOpenInterestHistory:!1,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,ws:!1},urls:{logo:"https://user-images.githubusercontent.com/1294454/28501752-60c21b82-6feb-11e7-818b-055ee6d0e754.jpg",api:{rest:"https://api.bl3p.eu"},www:"https://bl3p.eu",doc:["https://github.com/BitonicNL/bl3p-api/tree/master/docs","https://bl3p.eu/api","https://bitonic.nl/en/api"]},api:{public:{get:["{market}/ticker","{market}/orderbook","{market}/trades"]},private:{post:["{market}/money/depth/full","{market}/money/order/add","{market}/money/order/cancel","{market}/money/order/result","{market}/money/orders","{market}/money/orders/history","{market}/money/trades/fetch","GENMKT/money/info","GENMKT/money/deposit_address","GENMKT/money/new_deposit_address","GENMKT/money/wallet/history","GENMKT/money/withdraw"]}},markets:{"BTC/EUR":this.safeMarketStructure({id:"BTCEUR",symbol:"BTC/EUR",base:"BTC",quote:"EUR",baseId:"BTC",quoteId:"EUR",maker:.0025,taker:.0025,type:"spot",spot:!0})},precisionMode:a.sh})}parseBalance(e){const t=this.safeValue(e,"data",{}),s=this.safeValue(t,"wallets",{}),i={info:t},r=Object.keys(this.currencies);for(let e=0;e{s.d(t,{Z:()=>n});var i=s(3617),r=s(6689),a=s(2194),o=s(9292);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"blockchaincom",secret:void 0,name:"Blockchain.com",countries:["LX"],rateLimit:500,version:"v3",pro:!0,has:{CORS:!1,spot:!0,margin:void 0,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchL2OrderBook:!0,fetchL3OrderBook:!0,fetchLedger:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPositionMode:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!1,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!0,transfer:!1,withdraw:!0},timeframes:void 0,urls:{logo:"https://user-images.githubusercontent.com/1294454/147515585-1296e91b-7398-45e5-9d32-f6121538533f.jpeg",test:{public:"https://testnet-api.delta.exchange",private:"https://testnet-api.delta.exchange"},api:{public:"https://api.blockchain.com/v3/exchange",private:"https://api.blockchain.com/v3/exchange"},www:"https://blockchain.com",doc:["https://api.blockchain.com/v3"],fees:"https://exchange.blockchain.com/fees"},api:{public:{get:{tickers:1,"tickers/{symbol}":1,symbols:1,"symbols/{symbol}":1,"l2/{symbol}":1,"l3/{symbol}":1}},private:{get:{fees:1,orders:1,"orders/{orderId}":1,trades:1,fills:1,deposits:1,"deposits/{depositId}":1,accounts:1,"accounts/{account}/{currency}":1,whitelist:1,"whitelist/{currency}":1,withdrawals:1,"withdrawals/{withdrawalId}":1},post:{orders:1,"deposits/{currency}":1,withdrawals:1},delete:{orders:1,"orders/{orderId}":1}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("10000"),this.parseNumber("0.0022")],[this.parseNumber("50000"),this.parseNumber("0.002")],[this.parseNumber("100000"),this.parseNumber("0.0018")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("2500000"),this.parseNumber("0.0018")],[this.parseNumber("5000000"),this.parseNumber("0.0016")],[this.parseNumber("25000000"),this.parseNumber("0.0014")],[this.parseNumber("100000000"),this.parseNumber("0.0011")],[this.parseNumber("500000000"),this.parseNumber("0.0008")],[this.parseNumber("1000000000"),this.parseNumber("0.0006")]],maker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("10000"),this.parseNumber("0.0012")],[this.parseNumber("50000"),this.parseNumber("0.001")],[this.parseNumber("100000"),this.parseNumber("0.0008")],[this.parseNumber("500000"),this.parseNumber("0.0007000000000000001")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0005")],[this.parseNumber("5000000"),this.parseNumber("0.0004")],[this.parseNumber("25000000"),this.parseNumber("0.0003")],[this.parseNumber("100000000"),this.parseNumber("0.0002")],[this.parseNumber("500000000"),this.parseNumber("0.0001")],[this.parseNumber("1000000000"),this.parseNumber("0")]]}}},requiredCredentials:{apiKey:!1,secret:!0},options:{networks:{ERC20:"ETH",TRC20:"TRX",ALGO:"ALGO",ADA:"ADA",AR:"AR",ATOM:"ATOM",AVAXC:"AVAX",BCH:"BCH",BSV:"BSV",BTC:"BTC",DCR:"DCR",DESO:"DESO",DASH:"DASH",CELO:"CELO",CHZ:"CHZ",MATIC:"MATIC",SOL:"SOL",DOGE:"DOGE",DOT:"DOT",EOS:"EOS",ETC:"ETC",FIL:"FIL",KAVA:"KAVA",LTC:"LTC",IOTA:"MIOTA",NEAR:"NEAR",STX:"STX",XLM:"XLM",XMR:"XMR",XRP:"XRP",XTZ:"XTZ",ZEC:"ZEC",ZIL:"ZIL"}},precisionMode:o.sh,exceptions:{exact:{401:r.AuthenticationError,404:r.OrderNotFound},broad:{}}})}async fetchMarkets(e={}){const t=await this.publicGetSymbols(e),s=Object.keys(t),i=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(6065),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"blofin",name:"BloFin",countries:["US"],version:"v1",rateLimit:100,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!1,option:!1,addMargin:!1,borrowMargin:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createDepositAddress:!1,createMarketBuyOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopLossOrder:!0,createStopMarketOrder:!1,createStopOrder:!1,createTakeProfitOrder:!0,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:void 0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!0,fetchLedgerEntry:void 0,fetchLeverage:!0,fetchLeverages:!0,fetchLeverageTiers:!1,fetchMarginMode:!0,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!0,fetchPermissions:void 0,fetchPosition:!0,fetchPositions:!0,fetchPositionsForSymbol:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,setLeverage:!0,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1H","2h":"2H","4h":"4H","6h":"6H","12h":"12H","1d":"1D","1w":"1W","1M":"1M","3M":"3M"},hostname:"www.blofin.com",urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/255a7b29-341f-4d20-8342-fbfae4932807",api:{rest:"https://openapi.blofin.com"},referral:{url:"https://blofin.com/register?referral_code=jBd8U1",discount:.05},www:"https://www.blofin.com",doc:"https://blofin.com/docs"},api:{public:{get:{"market/instruments":1,"market/tickers":1,"market/books":1,"market/trades":1,"market/candles":1,"market/mark-price":1,"market/funding-rate":1,"market/funding-rate-history":1}},private:{get:{"asset/balances":1,"trade/orders-pending":1,"trade/fills-history":1,"asset/deposit-history":1,"asset/withdrawal-history":1,"asset/bills":1,"account/balance":1,"account/positions":1,"account/leverage-info":1,"account/margin-mode":1,"account/batch-leverage-info":1,"trade/orders-tpsl-pending":1,"trade/orders-history":1,"trade/orders-tpsl-history":1,"user/query-apikey":1,"affiliate/basic":1},post:{"trade/order":1,"trade/cancel-order":1,"account/set-leverage":1,"trade/batch-orders":1,"trade/order-tpsl":1,"trade/cancel-batch-orders":1,"trade/cancel-tpsl":1,"trade/close-position":1,"asset/transfer":1}}},fees:{swap:{taker:this.parseNumber("0.00060"),maker:this.parseNumber("0.00020")}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},exceptions:{exact:{400:r.BadRequest,401:r.AuthenticationError,500:r.ExchangeError,404:r.BadRequest,405:r.BadRequest,406:r.BadRequest,429:r.RateLimitExceeded,152001:r.BadRequest,152002:r.BadRequest,152003:r.BadRequest,152004:r.BadRequest,152005:r.BadRequest,152006:r.InvalidOrder,152007:r.InvalidOrder,152008:r.InvalidOrder,152009:r.InvalidOrder,150003:r.InvalidOrder,150004:r.InvalidOrder,542:r.InvalidOrder,102002:r.InvalidOrder,102005:r.InvalidOrder,102014:r.InvalidOrder,102015:r.InvalidOrder,102022:r.InvalidOrder,102037:r.InvalidOrder,102038:r.InvalidOrder,102039:r.InvalidOrder,102040:r.InvalidOrder,102047:r.InvalidOrder,102048:r.InvalidOrder,102049:r.InvalidOrder,102050:r.InvalidOrder,102051:r.InvalidOrder,102052:r.InvalidOrder,102053:r.InvalidOrder,102054:r.InvalidOrder,102055:r.InvalidOrder,102064:r.BadRequest,102065:r.BadRequest,102068:r.BadRequest,103013:r.ExchangeError,"Order failed. Insufficient USDT margin in account":r.InsufficientFunds},broad:{"Internal Server Error":r.ExchangeNotAvailable,"server error":r.ExchangeNotAvailable}},httpExceptions:{429:r.ExchangeNotAvailable},precisionMode:o.sh,options:{brokerId:"ec6dd3a7dd982d0b",accountsByType:{swap:"futures",future:"futures"},accountsById:{futures:"swap"},sandboxMode:!1,defaultNetwork:"ERC20",defaultNetworks:{ETH:"ERC20",BTC:"BTC",USDT:"TRC20"},networks:{BTC:"Bitcoin",BEP20:"BSC",ERC20:"ERC20",TRC20:"TRC20"},fetchOpenInterestHistory:{timeframes:{"5m":"5m","1h":"1H","8h":"8H","1d":"1D","5M":"5m","1H":"1H","8H":"8H","1D":"1D"}},fetchOHLCV:{timezone:"UTC"},fetchPositions:{method:"privateGetAccountPositions"},createOrder:"privatePostTradeOrder",createMarketBuyOrderRequiresPrice:!1,fetchMarkets:["swap"],defaultType:"swap",fetchLedger:{method:"privateGetAssetBills"},fetchOpenOrders:{method:"privateGetTradeOrdersPending"},cancelOrders:{method:"privatePostTradeCancelBatchOrders"},fetchCanceledOrders:{method:"privateGetTradeOrdersHistory"},fetchClosedOrders:{method:"privateGetTradeOrdersHistory"},withdraw:{password:void 0,pwd:void 0},exchangeType:{spot:"SPOT",swap:"SWAP",SPOT:"SPOT",SWAP:"SWAP"}}})}async fetchMarkets(e={}){const t=await this.publicGetMarketInstruments(e),s=this.safeList(t,"data",[]);return this.parseMarkets(s)}parseMarket(e){const t=this.safeString(e,"instId"),s=this.safeStringLower(e,"instType"),i="spot"===s,r="future"===s,o="swap"===s,n="option"===s,d=o||r,h=this.safeString(e,"baseCurrency"),c=this.safeString(e,"quoteCurrency"),l=this.safeString(e,"quoteCurrency"),u=this.safeCurrencyCode(l),p=this.safeCurrencyCode(h),f=this.safeCurrencyCode(c);let m=p+"/"+f;o&&(m=m+":"+u);const g=void 0,v=this.safeString(e,"tickSize"),y=this.safeDict2(this.fees,s,"trading",{}),w=this.safeNumber(y,"taker"),b=this.safeNumber(y,"maker");let S=this.safeString(e,"maxLeverage","100");S=a.O.stringMax(S,"1");const k="live"===this.safeString(e,"state");return this.safeMarketStructure({id:t,symbol:m,base:p,quote:f,baseId:h,quoteId:c,settle:u,settleId:l,type:s,spot:i,option:n,margin:i&&a.O.stringGt(S,"1"),swap:o,future:r,active:k,taker:w,maker:b,contract:d,linear:d?c===l:void 0,inverse:d?h===l:void 0,contractSize:d?this.safeNumber(e,"contractValue"):void 0,expiry:g,expiryDatetime:g,strike:undefined,optionType:undefined,created:this.safeInteger(e,"listTime"),precision:{amount:this.safeNumber(e,"lotSize"),price:this.parseNumber(v)},limits:{leverage:{min:this.parseNumber("1"),max:this.parseNumber(S)},amount:{min:this.safeNumber(e,"minSize"),max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:e})}async fetchOrderBook(e,t=void 0,s={}){await this.loadMarkets();const i={instId:this.market(e).id};void 0!==(t=void 0===t?50:t)&&(i.size=t);const r=await this.publicGetMarketBooks(this.extend(i,s)),a=this.safeList(r,"data",[]),o=this.safeDict(a,0,{}),n=this.safeInteger(o,"ts");return this.parseOrderBook(o,e,n)}parseTicker(e,t=void 0){const s=this.safeInteger(e,"ts"),i=this.safeString(e,"instId"),r=(t=this.safeMarket(i,t,"-")).symbol,a=this.safeString(e,"last"),o=this.safeString(e,"open24h"),n=this.safeBool(t,"spot",!1)?this.safeString(e,"volCurrency24h"):void 0,d=this.safeString(e,"vol24h"),h=this.safeString(e,"high24h"),c=this.safeString(e,"low24h");return this.safeTicker({symbol:r,timestamp:s,datetime:this.iso8601(s),high:h,low:c,bid:this.safeString(e,"bidPrice"),bidVolume:this.safeString(e,"bidSize"),ask:this.safeString(e,"askPrice"),askVolume:this.safeString(e,"askSize"),vwap:void 0,open:o,close:a,last:a,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:d,quoteVolume:n,info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e),i={instId:s.id},r=await this.publicGetMarketTickers(this.extend(i,t)),a=this.safeList(r,"data",[]),o=this.safeDict(a,0,{});return this.parseTicker(o,s)}async fetchTickers(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e);const s=await this.publicGetMarketTickers(t),i=this.safeList(s,"data",[]);return this.parseTickers(i,e)}parseTrade(e,t=void 0){const s=this.safeString(e,"tradeId"),i=this.safeString(e,"instId"),r=(t=this.safeMarket(i,t,"-")).symbol,a=this.safeInteger(e,"ts"),o=this.safeString2(e,"price","fillPrice"),n=this.safeString2(e,"size","fillSize"),d=this.safeString(e,"side"),h=this.safeString(e,"orderId"),c=this.safeString(e,"fee");let l;return void 0!==c&&(l={cost:c,currency:t.settle}),this.safeTrade({info:e,timestamp:a,datetime:this.iso8601(a),symbol:r,id:s,order:h,type:void 0,takerOrMaker:void 0,side:d,price:o,amount:n,cost:void 0,fee:l},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallCursor("fetchTrades",e,t,s,i,"tradeId","after",void 0,100);const a=this.market(e),o={instId:a.id};let n,d;void 0!==s&&(o.limit=s),[d,i]=this.handleOptionAndParams(i,"fetchTrades","method","publicGetMarketTrades"),"publicGetMarketTrades"===d&&(n=await this.publicGetMarketTrades(this.extend(o,i)));const h=this.safeList(n,"data",[]);return this.parseTrades(h,a,t,s)}parseOHLCV(e,t=void 0){return[this.safeInteger(e,0),this.safeNumber(e,1),this.safeNumber(e,2),this.safeNumber(e,3),this.safeNumber(e,4),this.safeNumber(e,6)]}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,r={}){await this.loadMarkets();const a=this.market(e);let o=!1;if([o,r]=this.handleOptionAndParams(r,"fetchOHLCV","paginate"),o)return await this.fetchPaginatedCallDeterministic("fetchOHLCV",e,s,i,t,r,100);void 0===i&&(i=100);const n={instId:a.id,bar:this.safeString(this.timeframes,t,t),limit:i},d=this.safeInteger(r,"until");let h;void 0!==d&&(n.after=d,r=this.omit(r,"until")),h=await this.publicGetMarketCandles(this.extend(n,r));const c=this.safeList(h,"data",[]);return this.parseOHLCVs(c,a,t,s,i)}async fetchFundingRateHistory(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchFundingRateHistory() requires a symbol argument");await this.loadMarkets();let a=!1;if([a,i]=this.handleOptionAndParams(i,"fetchFundingRateHistory","paginate"),a)return await this.fetchPaginatedCallDeterministic("fetchFundingRateHistory",e,t,s,"8h",i);const o=this.market(e),n={instId:o.id};void 0!==t&&(n.before=Math.max(t-1,0)),void 0!==s&&(n.limit=s);const d=await this.publicGetMarketFundingRateHistory(this.extend(n,i)),h=[],c=this.safeList(d,"data",[]);for(let e=0;e0?i=i+","+r.id:i+=r.id}const a={instId:i,marginMode:s},o=await this.privateGetAccountBatchLeverageInfo(this.extend(a,t)),n=this.safeList(o,"data",[]);return this.parseLeverages(n,e,"instId")}async fetchLeverage(e,t={}){let s;if(await this.loadMarkets(),[s,t]=this.handleMarginModeAndParams("fetchLeverage",t),void 0===s&&(s=this.safeString(t,"marginMode","cross")),"cross"!==s&&"isolated"!==s)throw new r.BadRequest(this.id+" fetchLeverage() requires a marginMode parameter that must be either cross or isolated");const i=this.market(e),a={instId:i.id,marginMode:s},o=await this.privateGetAccountLeverageInfo(this.extend(a,t)),n=this.safeDict(o,"data",{});return this.parseLeverage(n,i)}parseLeverage(e,t=void 0){const s=this.safeString(e,"instId"),i=this.safeInteger(e,"leverage");return{info:e,symbol:this.safeSymbol(s,t),marginMode:this.safeStringLower(e,"marginMode"),longLeverage:i,shortLeverage:i}}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");if(e<1||e>125)throw new r.BadRequest(this.id+" setLeverage() leverage should be between 1 and 125");await this.loadMarkets();const i=this.market(t);let a;if([a,s]=this.handleMarginModeAndParams("setLeverage",s,"cross"),"cross"!==a&&"isolated"!==a)throw new r.BadRequest(this.id+" setLeverage() requires a marginMode parameter that must be either cross or isolated");const o={leverage:e,marginMode:a,instId:i.id};return await this.privatePostAccountSetLeverage(this.extend(o,s))}async closePosition(e,t=void 0,s={}){await this.loadMarkets();const i=this.market(e),r=this.safeString(s,"clientOrderId");let a;[a,s]=this.handleMarginModeAndParams("closePosition",s,"cross");const o={instId:i.id,marginMode:a};void 0!==r&&(o.clientOrderId=r);const n=await this.privatePostTradeClosePosition(this.extend(o,s));return this.safeDict(n,"data")}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchClosedOrders","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchClosedOrders",e,t,s,i);const a={};let o;void 0!==e&&(o=this.market(e),a.instId=o.id),void 0!==s&&(a.limit=s),void 0!==t&&(a.begin=t);const n=this.safeBoolN(i,["stop","trigger","tpsl","TPSL"],!1);let d;[d,i]=this.handleOptionAndParams(i,"fetchOpenOrders","method","privateGetTradeOrdersHistory");const h=this.omit(i,["method","stop","trigger","tpsl","TPSL"]);let c;c=n||"privateGetTradeOrdersTpslHistory"===d?await this.privateGetTradeOrdersTpslHistory(this.extend(a,h)):await this.privateGetTradeOrdersHistory(this.extend(a,h));const l=this.safeList(c,"data",[]);return this.parseOrders(l,o,t,s)}async fetchMarginMode(e,t={}){await this.loadMarkets();const s=this.market(e),i=await this.privateGetAccountMarginMode(t),r=this.safeDict(i,"data",{});return this.parseMarginMode(r,s)}parseMarginMode(e,t=void 0){return{info:e,symbol:t.symbol,marginMode:this.safeString(e,"marginMode")}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.safeString(n,"code"),l=this.safeString(n,"msg"),u=this.id+" "+o;if(void 0!==c&&"0"!==c)throw this.throwExactlyMatchedException(this.exceptions.exact,l,u),this.throwExactlyMatchedException(this.exceptions.exact,c,u),this.throwBroadlyMatchedException(this.exceptions.broad,l,u),new r.ExchangeError(u);const p=this.safeList(n,"data"),f=this.safeDict(p,0),m=this.safeString(f,"msg"),g=this.safeString(f,"code");void 0!==g&&"0"!==g&&(this.throwExactlyMatchedException(this.exceptions.exact,g,u),this.throwExactlyMatchedException(this.exceptions.exact,m,u),this.throwBroadlyMatchedException(this.exceptions.broad,m,u))}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/api/"+this.version+"/"+this.implodeParams(e,i);const d=this.omit(i,this.extractParams(e));let h=this.implodeHostname(this.urls.api.rest)+o;if("public"===t)this.isEmpty(d)||(h+="?"+this.urlencode(d));else if("private"===t){this.checkRequiredCredentials();const e=this.milliseconds().toString();r={"ACCESS-KEY":this.apiKey,"ACCESS-PASSPHRASE":this.password,"ACCESS-TIMESTAMP":e,"ACCESS-NONCE":e};let t="";if("GET"===s){if(!this.isEmpty(d)){const e="?"+this.urlencode(d);h+=e,o+=e}}else this.isEmpty(d)||(t=a=this.json(d)),r["Content-Type"]="application/json";const i=o+s+e+e+t,c=this.stringToBase64(this.hmac(this.encode(i),this.encode(this.secret),n.J));r["ACCESS-SIGN"]=c}return{url:h,method:s,body:a,headers:r}}}},6246:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(5489),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"btcalpha",name:"BTC-Alpha",countries:["US"],version:"v1",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL2OrderBook:!0,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{"5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","1d":"D"},urls:{logo:"https://user-images.githubusercontent.com/1294454/42625213-dabaa5da-85cf-11e8-8f99-aa8f8f7699f0.jpg",api:{rest:"https://btc-alpha.com/api"},www:"https://btc-alpha.com",doc:"https://btc-alpha.github.io/api-docs",fees:"https://btc-alpha.com/fees/",referral:"https://btc-alpha.com/?r=123788"},api:{public:{get:["currencies/","pairs/","orderbook/{pair_name}","exchanges/","charts/{pair}/{type}/chart/","ticker/"]},private:{get:["wallets/","orders/own/","order/{id}/","exchanges/own/","deposits/","withdraws/"],post:["order/","order-cancel/"]}},fees:{trading:{maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")},funding:{withdraw:{}}},commonCurrencies:{CBC:"Cashbery"},precisionMode:o.sh,exceptions:{exact:{},broad:{"Out of balance":r.InsufficientFunds}}})}async fetchMarkets(e={}){const t=await this.publicGetPairs(e);return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"name"),s=this.safeString(e,"currency1"),i=this.safeString(e,"currency2"),r=this.safeCurrencyCode(s),o=this.safeCurrencyCode(i),n=this.safeString(e,"price_precision"),d=this.parsePrecision(n),h=this.safeString(e,"minimum_order_size");return{id:t,symbol:r+"/"+o,base:r,quote:o,settle:void 0,baseId:s,quoteId:i,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:!0,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"amount_precision"))),price:this.parseNumber(this.parsePrecision(n))},limits:{leverage:{min:void 0,max:void 0},amount:{min:this.parseNumber(h),max:this.safeNumber(e,"maximum_order_size")},price:{min:this.parseNumber(d),max:void 0},cost:{min:this.parseNumber(a.O.stringMul(d,h)),max:void 0}},created:void 0,info:e}}async fetchTickers(e=void 0,t={}){await this.loadMarkets();const s=await this.publicGetTicker(t);return this.parseTickers(s,e)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e),i={pair:s.id},r=await this.publicGetTicker(this.extend(i,t));return this.parseTicker(r,s)}parseTicker(e,t=void 0){const s=this.safeString(e,"timestamp"),i=parseInt(a.O.stringMul(s,"1000000")),r=this.safeString(e,"pair");t=this.safeMarket(r,t,"_");const o=this.safeString(e,"last");return this.safeTicker({info:e,symbol:t.symbol,timestamp:i,datetime:this.iso8601(i),high:this.safeString(e,"high"),low:this.safeString(e,"low"),bid:this.safeString(e,"buy"),bidVolume:void 0,ask:this.safeString(e,"sell"),askVolume:void 0,vwap:void 0,open:void 0,close:o,last:o,previousClose:void 0,change:this.safeString(e,"diff"),percentage:void 0,average:void 0,baseVolume:void 0,quoteVolume:this.safeString(e,"vol")},t)}async fetchOrderBook(e,t=void 0,s={}){await this.loadMarkets();const i=this.market(e),r={pair_name:i.id};t&&(r.limit_sell=t,r.limit_buy=t);const a=await this.publicGetOrderbookPairName(this.extend(r,s));return this.parseOrderBook(a,i.symbol,void 0,"buy","sell","price","amount")}parseBidsAsks(e,t=0,s=1,i=2){const r=[];for(let i=0;i{s.d(t,{Z:()=>d});var i=s(6851),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"btcbox",name:"BtcBox",countries:["JP"],rateLimit:1e3,version:"v1",pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!1,fetchTrades:!0,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1,ws:!1},urls:{logo:"https://user-images.githubusercontent.com/51840849/87327317-98c55400-c53c-11ea-9a11-81f7d951cc74.jpg",api:{rest:"https://www.btcbox.co.jp/api"},www:"https://www.btcbox.co.jp/",doc:"https://blog.btcbox.jp/en/archives/8762",fees:"https://support.btcbox.co.jp/hc/en-us/articles/360001235694-Fees-introduction"},api:{public:{get:["depth","orders","ticker"]},private:{post:["balance","trade_add","trade_cancel","trade_list","trade_view","wallet"]}},markets:{"BTC/JPY":this.safeMarketStructure({id:"btc",symbol:"BTC/JPY",base:"BTC",quote:"JPY",baseId:"btc",quoteId:"jpy",taker:this.parseNumber("0.0005"),maker:this.parseNumber("0.0005"),type:"spot",spot:!0}),"ETH/JPY":this.safeMarketStructure({id:"eth",symbol:"ETH/JPY",base:"ETH",quote:"JPY",baseId:"eth",quoteId:"jpy",taker:this.parseNumber("0.0010"),maker:this.parseNumber("0.0010"),type:"spot",spot:!0}),"LTC/JPY":this.safeMarketStructure({id:"ltc",symbol:"LTC/JPY",base:"LTC",quote:"JPY",baseId:"ltc",quoteId:"jpy",taker:this.parseNumber("0.0010"),maker:this.parseNumber("0.0010"),type:"spot",spot:!0}),"BCH/JPY":this.safeMarketStructure({id:"bch",symbol:"BCH/JPY",base:"BCH",quote:"JPY",baseId:"bch",quoteId:"jpy",taker:this.parseNumber("0.0010"),maker:this.parseNumber("0.0010"),type:"spot",spot:!0})},precisionMode:o.sh,exceptions:{104:r.AuthenticationError,105:r.PermissionDenied,106:r.InvalidNonce,107:r.InvalidOrder,200:r.InsufficientFunds,201:r.InvalidOrder,202:r.InvalidOrder,203:r.OrderNotFound,401:r.OrderNotFound,402:r.DDoSProtection}})}parseBalance(e){const t={info:e},s=Object.keys(this.currencies);for(let i=0;i1&&(r.coin=i.baseId);const a=await this.publicGetDepth(this.extend(r,s));return this.parseOrderBook(a,i.symbol)}parseTicker(e,t=void 0){const s=this.safeSymbol(void 0,t),i=this.safeString(e,"last");return this.safeTicker({symbol:s,timestamp:void 0,datetime:void 0,high:this.safeString(e,"high"),low:this.safeString(e,"low"),bid:this.safeString(e,"buy"),bidVolume:void 0,ask:this.safeString(e,"sell"),askVolume:void 0,vwap:void 0,open:void 0,close:i,last:i,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:this.safeString(e,"vol"),quoteVolume:this.safeString(e,"volume"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e),i={};this.symbols.length>1&&(i.coin=s.baseId);const r=await this.publicGetTicker(this.extend(i,t));return this.parseTicker(r,s)}parseTrade(e,t=void 0){const s=this.safeTimestamp(e,"date");t=this.safeMarket(void 0,t);const i=this.safeString(e,"tid"),r=this.safeString(e,"price"),a=this.safeString(e,"amount"),o=this.safeString(e,"type");return this.safeTrade({info:e,id:i,order:void 0,timestamp:s,datetime:this.iso8601(s),symbol:t.symbol,type:undefined,side:o,takerOrMaker:void 0,price:r,amount:a,cost:void 0,fee:void 0},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.market(e),a={};this.symbols.length>1&&(a.coin=r.baseId);const o=await this.publicGetOrders(this.extend(a,i));return this.parseTrades(o,r,t,s)}async createOrder(e,t,s,i,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n={amount:i,price:r,type:s,coin:o.baseId},d=await this.privatePostTradeAdd(this.extend(n,a));return this.parseOrder(d,o)}async cancelOrder(e,t=void 0,s={}){await this.loadMarkets(),void 0===t&&(t="BTC/JPY");const i=this.market(t),r={id:e,coin:i.baseId},a=await this.privatePostTradeCancel(this.extend(r,s));return this.parseOrder(a,i)}parseOrderStatus(e){return this.safeString({part:"open",all:"closed",cancelled:"canceled",closed:"closed",no:"closed"},e,e)}parseOrder(e,t=void 0){const s=this.safeString(e,"id");let i;void 0!==this.safeString(e,"datetime")&&(i=this.parse8601(e.datetime+"+09:00"));const r=this.safeString(e,"amount_original"),o=this.safeString(e,"amount_outstanding"),n=this.safeString(e,"price");let d=this.parseOrderStatus(this.safeString(e,"status"));void 0===d&&a.O.stringEquals(o,"0")&&(d="closed");t=this.safeMarket(void 0,t);const h=this.safeString(e,"type");return this.safeOrder({id:s,clientOrderId:void 0,timestamp:i,datetime:this.iso8601(i),lastTradeTimestamp:void 0,amount:r,remaining:o,filled:void 0,side:h,type:void 0,timeInForce:void 0,postOnly:void 0,status:d,symbol:t.symbol,price:n,stopPrice:void 0,triggerPrice:void 0,cost:void 0,trades:undefined,fee:void 0,info:e,average:void 0},t)}async fetchOrder(e,t=void 0,s={}){await this.loadMarkets(),void 0===t&&(t="BTC/JPY");const i=this.market(t),r=this.extend({id:e,coin:i.baseId},s),a=await this.privatePostTradeView(this.extend(r,s));return this.parseOrder(a,i)}async fetchOrdersByType(e,t=void 0,s=void 0,i=void 0,r={}){await this.loadMarkets(),void 0===t&&(t="BTC/JPY");const a=this.market(t),o={type:e,coin:a.baseId},n=await this.privatePostTradeList(this.extend(o,r)),d=this.parseOrders(n,a,s,i);if("open"===e)for(let e=0;e=400)return;const c=this.safeValue(n,"result");if(void 0===c||!0===c)return;const l=this.safeValue(n,"code"),u=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions,l,u),new r.ExchangeError(u)}async request(e,t="public",s="GET",i={},a=void 0,o=void 0,n={}){let d=await this.fetch2(e,t,s,i,a,o,n);if("string"==typeof d){if(d=this.strip(d),!this.isJsonEncodedObject(d))throw new r.ExchangeError(this.id+" "+d);d=JSON.parse(d)}return d}}},1776:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(806),r=s(6689),a=s(9292),o=s(2194),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"btcmarkets",name:"BTC Markets",countries:["AU"],rateLimit:1e3,version:"v3",has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:"emulated",fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTime:!0,fetchTrades:!0,fetchTransactions:"emulated",fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/89731817-b3fb8480-da52-11ea-817f-783b08aaf32b.jpg",api:{public:"https://api.btcmarkets.net",private:"https://api.btcmarkets.net"},www:"https://btcmarkets.net",doc:["https://api.btcmarkets.net/doc/v3","https://github.com/BTCMarkets/API"]},api:{public:{get:["markets","markets/{marketId}/ticker","markets/{marketId}/trades","markets/{marketId}/orderbook","markets/{marketId}/candles","markets/tickers","markets/orderbooks","time"]},private:{get:["orders","orders/{id}","batchorders/{ids}","trades","trades/{id}","withdrawals","withdrawals/{id}","deposits","deposits/{id}","transfers","transfers/{id}","addresses","withdrawal-fees","assets","accounts/me/trading-fees","accounts/me/withdrawal-limits","accounts/me/balances","accounts/me/transactions","reports/{id}"],post:["orders","batchorders","withdrawals","reports"],delete:["orders","orders/{id}","batchorders/{ids}"],put:["orders/{id}"]}},timeframes:{"1m":"1m","1h":"1h","1d":"1d"},precisionMode:a.sh,exceptions:{3:r.InvalidOrder,6:r.DDoSProtection,InsufficientFund:r.InsufficientFunds,InvalidPrice:r.InvalidOrder,InvalidAmount:r.InvalidOrder,MissingArgument:r.InvalidOrder,OrderAlreadyCancelled:r.InvalidOrder,OrderNotFound:r.OrderNotFound,OrderStatusIsFinal:r.InvalidOrder,InvalidPaginationParameter:r.BadRequest},fees:{percentage:!0,tierBased:!0,maker:this.parseNumber("-0.0005"),taker:this.parseNumber("0.0020")},options:{fees:{AUD:{maker:this.parseNumber("0.0085"),taker:this.parseNumber("0.0085")}}}})}async fetchTransactionsWithMethod(e,t=void 0,s=void 0,i=void 0,r={}){await this.loadMarkets();const a={};let o;void 0!==i&&(a.limit=i),void 0!==s&&(a.after=s),void 0!==t&&(o=this.currency(t));const n=await this[e](this.extend(a,r));return this.parseTransactions(n,o,s,i)}async fetchDepositsWithdrawals(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactionsWithMethod("privateGetTransfers",e,t,s,i)}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactionsWithMethod("privateGetDeposits",e,t,s,i)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactionsWithMethod("privateGetWithdrawals",e,t,s,i)}parseTransactionStatus(e){return this.safeString({Accepted:"pending","Pending Authorization":"pending",Complete:"ok",Cancelled:"cancelled",Failed:"failed"},e,e)}parseTransactionType(e){return this.safeString({Withdraw:"withdrawal",Deposit:"deposit"},e,e)}parseTransaction(e,t=void 0){const s=this.parse8601(this.safeString(e,"creationTime")),i=this.parse8601(this.safeString(e,"lastUpdate"));let r=this.parseTransactionType(this.safeStringLower(e,"type"));"withdraw"===r&&(r="withdrawal");const a=this.safeValue(e,"paymentDetail",{}),n=this.safeString(a,"txId");let d,h=this.safeString(a,"address");if(void 0!==h){const e=h.split("?dt=");e.length>1&&(h=e[0],d=e[1])}const c=h,l=d,u=this.safeString(e,"fee"),p=this.parseTransactionStatus(this.safeString(e,"status")),f=this.safeString(e,"assetName"),m=this.safeCurrencyCode(f);let g=this.safeString(e,"amount");return u&&(g=o.O.stringSub(g,u)),{id:this.safeString(e,"id"),txid:n,timestamp:s,datetime:this.iso8601(s),network:void 0,address:h,addressTo:c,addressFrom:undefined,tag:d,tagTo:l,tagFrom:undefined,type:r,amount:this.parseNumber(g),currency:m,status:p,updated:i,comment:this.safeString(e,"description"),internal:void 0,fee:{currency:m,cost:this.parseNumber(u),rate:void 0},info:e}}async fetchMarkets(e={}){const t=await this.publicGetMarkets(e);return this.parseMarkets(t)}parseMarket(e){const t=this.safeString(e,"baseAssetName"),s=this.safeString(e,"quoteAssetName"),i=this.safeString(e,"marketId"),r=this.safeCurrencyCode(t),a=this.safeCurrencyCode(s),o=r+"/"+a,n=this.safeValue(this.safeValue(this.options,"fees",{}),a,this.fees),d=this.parseNumber(this.parsePrecision(this.safeString(e,"priceDecimals"))),h=this.safeNumber(e,"minOrderAmount"),c=this.safeNumber(e,"maxOrderAmount");let l;return"AUD"===a&&(l=d),{id:i,symbol:o,base:r,quote:a,settle:void 0,baseId:t,quoteId:s,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:void 0,contract:!1,linear:void 0,inverse:void 0,taker:n.taker,maker:n.maker,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(e,"amountDecimals"))),price:d},limits:{leverage:{min:void 0,max:void 0},amount:{min:h,max:c},price:{min:l,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:e}}async fetchTime(e={}){const t=await this.publicGetTime(e);return this.parse8601(this.safeString(t,"timestamp"))}parseBalance(e){const t={info:e};for(let s=0;s=400){const e=this.safeString(n,"code"),t=this.safeString(n,"message"),s=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions,e,s),this.throwExactlyMatchedException(this.exceptions,t,s),new r.ExchangeError(s)}}}}},6304:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(1698),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"btcturk",name:"BTCTurk",countries:["TR"],rateLimit:100,pro:!1,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!1},timeframes:{"1m":1,"15m":15,"30m":30,"1h":60,"4h":240,"1d":"1 d","1w":"1 w","1y":"1 y"},urls:{logo:"https://user-images.githubusercontent.com/51840849/87153926-efbef500-c2c0-11ea-9842-05b63612c4b9.jpg",api:{public:"https://api.btcturk.com/api/v2",private:"https://api.btcturk.com/api/v1",graph:"https://graph-api.btcturk.com/v1"},www:"https://www.btcturk.com",doc:"https://github.com/BTCTrader/broker-api-docs"},api:{public:{get:{orderbook:1,ticker:.1,trades:1,ohlc:1,"server/exchangeinfo":1}},private:{get:{"users/balances":1,openOrders:1,allOrders:1,"users/transactions/trade":1},post:{"users/transactions/crypto":1,"users/transactions/fiat":1,order:1,cancelOrder:1},delete:{order:1}},graph:{get:{ohlcs:1,"klines/history":1}}},fees:{trading:{maker:this.parseNumber("0.0005"),taker:this.parseNumber("0.0009")}},exceptions:{exact:{FAILED_ORDER_WITH_OPEN_ORDERS:r.InsufficientFunds,FAILED_LIMIT_ORDER:r.InvalidOrder,FAILED_MARKET_ORDER:r.InvalidOrder}},precisionMode:o.sh})}async fetchMarkets(e={}){const t=await this.publicGetServerExchangeinfo(e),s=this.safeValue(t,"data"),i=this.safeValue(s,"symbols",[]);return this.parseMarkets(i)}parseMarket(e){const t=this.safeString(e,"name"),s=this.safeString(e,"numerator"),i=this.safeString(e,"denominator"),r=this.safeCurrencyCode(s),a=this.safeCurrencyCode(i),o=this.safeValue(e,"filters",[]);let n,d,h,c,l;for(let e=0;e{s.d(t,{Z:()=>h});var i=s(2090),r=s(9292),a=s(6689),o=s(2194),n=s(1372),d=s(5981);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"bybit",name:"Bybit",countries:["VG"],version:"v5",userAgent:void 0,rateLimit:20,hostname:"bybit.com",pro:!0,certified:!0,has:{CORS:!0,spot:!0,margin:!0,swap:!0,future:!0,option:!0,borrowCrossMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,closeAllPositions:!1,closePosition:!1,createMarketBuyOrderWithCost:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createOrderWithTakeProfitAndStopLoss:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingAmountOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!0,fetchClosedOrder:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!0,fetchMarginAdjustmentHistory:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMySettlementHistory:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!0,fetchOrder:!1,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositions:!0,fetchPositionsHistory:!0,fetchPremiumIndexOHLCV:!0,fetchSettlementHistory:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfers:!0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!0,fetchWithdrawals:!0,repayCrossMargin:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"1","3m":"3","5m":"5","15m":"15","30m":"30","1h":"60","2h":"120","4h":"240","6h":"360","12h":"720","1d":"D","1w":"W","1M":"M"},urls:{test:{spot:"https://api-testnet.{hostname}",futures:"https://api-testnet.{hostname}",v2:"https://api-testnet.{hostname}",public:"https://api-testnet.{hostname}",private:"https://api-testnet.{hostname}"},logo:"https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg",api:{spot:"https://api.{hostname}",futures:"https://api.{hostname}",v2:"https://api.{hostname}",public:"https://api.{hostname}",private:"https://api.{hostname}"},demotrading:{spot:"https://api-demo.{hostname}",futures:"https://api-demo.{hostname}",v2:"https://api-demo.{hostname}",public:"https://api-demo.{hostname}",private:"https://api-demo.{hostname}"},www:"https://www.bybit.com",doc:["https://bybit-exchange.github.io/docs/inverse/","https://bybit-exchange.github.io/docs/linear/","https://github.com/bybit-exchange"],fees:"https://help.bybit.com/hc/en-us/articles/360039261154",referral:"https://www.bybit.com/register?affiliate_id=35953"},api:{public:{get:{"spot/v3/public/symbols":1,"spot/v3/public/quote/depth":1,"spot/v3/public/quote/depth/merged":1,"spot/v3/public/quote/trades":1,"spot/v3/public/quote/kline":1,"spot/v3/public/quote/ticker/24hr":1,"spot/v3/public/quote/ticker/price":1,"spot/v3/public/quote/ticker/bookTicker":1,"spot/v3/public/server-time":1,"spot/v3/public/infos":1,"spot/v3/public/margin-product-infos":1,"spot/v3/public/margin-ensure-tokens":1,"v3/public/time":1,"contract/v3/public/copytrading/symbol/list":1,"derivatives/v3/public/order-book/L2":1,"derivatives/v3/public/kline":1,"derivatives/v3/public/tickers":1,"derivatives/v3/public/instruments-info":1,"derivatives/v3/public/mark-price-kline":1,"derivatives/v3/public/index-price-kline":1,"derivatives/v3/public/funding/history-funding-rate":1,"derivatives/v3/public/risk-limit/list":1,"derivatives/v3/public/delivery-price":1,"derivatives/v3/public/recent-trade":1,"derivatives/v3/public/open-interest":1,"derivatives/v3/public/insurance":1,"v5/announcements/index":5,"v5/market/time":5,"v5/market/kline":5,"v5/market/mark-price-kline":5,"v5/market/index-price-kline":5,"v5/market/premium-index-price-kline":5,"v5/market/instruments-info":5,"v5/market/orderbook":5,"v5/market/tickers":5,"v5/market/funding/history":5,"v5/market/recent-trade":5,"v5/market/open-interest":5,"v5/market/historical-volatility":5,"v5/market/insurance":5,"v5/market/risk-limit":5,"v5/market/delivery-price":5,"v5/market/account-ratio":5,"v5/spot-lever-token/info":5,"v5/spot-lever-token/reference":5,"v5/spot-margin-trade/data":5,"v5/spot-cross-margin-trade/data":5,"v5/spot-cross-margin-trade/pledge-token":5,"v5/spot-cross-margin-trade/borrow-token":5,"v5/ins-loan/product-infos":5,"v5/ins-loan/ensure-tokens-convert":5}},private:{get:{"v2/private/wallet/fund/records":25,"spot/v3/private/order":2.5,"spot/v3/private/open-orders":2.5,"spot/v3/private/history-orders":2.5,"spot/v3/private/my-trades":2.5,"spot/v3/private/account":2.5,"spot/v3/private/reference":2.5,"spot/v3/private/record":2.5,"spot/v3/private/cross-margin-orders":10,"spot/v3/private/cross-margin-account":10,"spot/v3/private/cross-margin-loan-info":10,"spot/v3/private/cross-margin-repay-history":10,"spot/v3/private/margin-loan-infos":10,"spot/v3/private/margin-repaid-infos":10,"spot/v3/private/margin-ltv":10,"asset/v3/private/transfer/inter-transfer/list/query":50,"asset/v3/private/transfer/sub-member/list/query":50,"asset/v3/private/transfer/sub-member-transfer/list/query":50,"asset/v3/private/transfer/universal-transfer/list/query":25,"asset/v3/private/coin-info/query":25,"asset/v3/private/deposit/address/query":10,"contract/v3/private/copytrading/order/list":30,"contract/v3/private/copytrading/position/list":40,"contract/v3/private/copytrading/wallet/balance":25,"contract/v3/private/position/limit-info":25,"contract/v3/private/order/unfilled-orders":1,"contract/v3/private/order/list":1,"contract/v3/private/position/list":1,"contract/v3/private/execution/list":1,"contract/v3/private/position/closed-pnl":1,"contract/v3/private/account/wallet/balance":1,"contract/v3/private/account/fee-rate":1,"contract/v3/private/account/wallet/fund-records":1,"unified/v3/private/order/unfilled-orders":1,"unified/v3/private/order/list":1,"unified/v3/private/position/list":1,"unified/v3/private/execution/list":1,"unified/v3/private/delivery-record":1,"unified/v3/private/settlement-record":1,"unified/v3/private/account/wallet/balance":1,"unified/v3/private/account/transaction-log":1,"unified/v3/private/account/borrow-history":1,"unified/v3/private/account/borrow-rate":1,"unified/v3/private/account/info":1,"user/v3/private/frozen-sub-member":10,"user/v3/private/query-sub-members":5,"user/v3/private/query-api":5,"user/v3/private/get-member-type":1,"asset/v3/private/transfer/transfer-coin/list/query":50,"asset/v3/private/transfer/account-coin/balance/query":50,"asset/v3/private/transfer/account-coins/balance/query":25,"asset/v3/private/transfer/asset-info/query":50,"asset/v3/public/deposit/allowed-deposit-list/query":.17,"asset/v3/private/deposit/record/query":10,"asset/v3/private/withdraw/record/query":10,"v5/order/realtime":5,"v5/order/history":5,"v5/order/spot-borrow-check":1,"v5/position/list":5,"v5/execution/list":5,"v5/position/closed-pnl":5,"v5/position/move-history":5,"v5/pre-upgrade/order/history":5,"v5/pre-upgrade/execution/list":5,"v5/pre-upgrade/position/closed-pnl":5,"v5/pre-upgrade/account/transaction-log":5,"v5/pre-upgrade/asset/delivery-record":5,"v5/pre-upgrade/asset/settlement-record":5,"v5/account/wallet-balance":1,"v5/account/borrow-history":1,"v5/account/collateral-info":1,"v5/asset/coin-greeks":1,"v5/account/fee-rate":10,"v5/account/info":5,"v5/account/transaction-log":1,"v5/account/contract-transaction-log":1,"v5/account/smp-group":1,"v5/account/mmp-state":5,"v5/asset/exchange/order-record":5,"v5/asset/delivery-record":5,"v5/asset/settlement-record":5,"v5/asset/transfer/query-asset-info":50,"v5/asset/transfer/query-account-coins-balance":25,"v5/asset/transfer/query-account-coin-balance":50,"v5/asset/transfer/query-transfer-coin-list":50,"v5/asset/transfer/query-inter-transfer-list":50,"v5/asset/transfer/query-sub-member-list":50,"v5/asset/transfer/query-universal-transfer-list":25,"v5/asset/deposit/query-allowed-list":5,"v5/asset/deposit/query-record":10,"v5/asset/deposit/query-sub-member-record":10,"v5/asset/deposit/query-internal-record":5,"v5/asset/deposit/query-address":10,"v5/asset/deposit/query-sub-member-address":10,"v5/asset/coin/query-info":28,"v5/asset/withdraw/query-record":10,"v5/asset/withdraw/withdrawable-amount":5,"v5/user/query-sub-members":5,"v5/user/query-api":5,"v5/user/sub-apikeys":5,"v5/user/get-member-type":5,"v5/user/aff-customer-info":5,"v5/user/del-submember":5,"v5/user/submembers":5,"v5/spot-lever-token/order-record":1,"v5/spot-margin-trade/state":5,"v5/spot-cross-margin-trade/loan-info":1,"v5/spot-cross-margin-trade/account":1,"v5/spot-cross-margin-trade/orders":1,"v5/spot-cross-margin-trade/repay-history":1,"v5/ins-loan/product-infos":5,"v5/ins-loan/ensure-tokens-convert":5,"v5/ins-loan/loan-order":5,"v5/ins-loan/repaid-history":5,"v5/ins-loan/ltv-convert":5,"v5/lending/info":5,"v5/lending/history-order":5,"v5/lending/account":5,"v5/broker/earning-record":5,"v5/broker/earnings-info":5,"v5/broker/account-info":5,"v5/broker/asset/query-sub-member-deposit-record":10},post:{"option/usdc/openapi/private/v1/place-order":2.5,"option/usdc/openapi/private/v1/replace-order":2.5,"option/usdc/openapi/private/v1/cancel-order":2.5,"option/usdc/openapi/private/v1/cancel-all":2.5,"option/usdc/openapi/private/v1/query-active-orders":2.5,"option/usdc/openapi/private/v1/query-order-history":2.5,"option/usdc/openapi/private/v1/execution-list":2.5,"option/usdc/openapi/private/v1/query-position":2.5,"perpetual/usdc/openapi/private/v1/place-order":2.5,"perpetual/usdc/openapi/private/v1/replace-order":2.5,"perpetual/usdc/openapi/private/v1/cancel-order":2.5,"perpetual/usdc/openapi/private/v1/cancel-all":2.5,"perpetual/usdc/openapi/private/v1/position/leverage/save":2.5,"spot/v3/private/order":2.5,"spot/v3/private/cancel-order":2.5,"spot/v3/private/cancel-orders":2.5,"spot/v3/private/cancel-orders-by-ids":2.5,"spot/v3/private/purchase":2.5,"spot/v3/private/redeem":2.5,"spot/v3/private/cross-margin-loan":10,"spot/v3/private/cross-margin-repay":10,"asset/v3/private/transfer/inter-transfer":150,"asset/v3/private/withdraw/create":300,"asset/v3/private/withdraw/cancel":50,"asset/v3/private/transfer/sub-member-transfer":150,"asset/v3/private/transfer/transfer-sub-member-save":150,"asset/v3/private/transfer/universal-transfer":10,"user/v3/private/create-sub-member":10,"user/v3/private/create-sub-api":10,"user/v3/private/update-api":10,"user/v3/private/delete-api":10,"user/v3/private/update-sub-api":10,"user/v3/private/delete-sub-api":10,"contract/v3/private/copytrading/order/create":30,"contract/v3/private/copytrading/order/cancel":30,"contract/v3/private/copytrading/order/close":30,"contract/v3/private/copytrading/position/close":40,"contract/v3/private/copytrading/position/set-leverage":40,"contract/v3/private/copytrading/wallet/transfer":25,"contract/v3/private/copytrading/order/trading-stop":2.5,"contract/v3/private/order/create":1,"contract/v3/private/order/cancel":1,"contract/v3/private/order/cancel-all":1,"contract/v3/private/order/replace":1,"contract/v3/private/position/set-auto-add-margin":1,"contract/v3/private/position/switch-isolated":1,"contract/v3/private/position/switch-mode":1,"contract/v3/private/position/switch-tpsl-mode":1,"contract/v3/private/position/set-leverage":1,"contract/v3/private/position/trading-stop":1,"contract/v3/private/position/set-risk-limit":1,"contract/v3/private/account/setMarginMode":1,"unified/v3/private/order/create":30,"unified/v3/private/order/replace":30,"unified/v3/private/order/cancel":30,"unified/v3/private/order/create-batch":30,"unified/v3/private/order/replace-batch":30,"unified/v3/private/order/cancel-batch":30,"unified/v3/private/order/cancel-all":30,"unified/v3/private/position/set-leverage":2.5,"unified/v3/private/position/tpsl/switch-mode":2.5,"unified/v3/private/position/set-risk-limit":2.5,"unified/v3/private/position/trading-stop":2.5,"unified/v3/private/account/upgrade-unified-account":2.5,"unified/v3/private/account/setMarginMode":2.5,"fht/compliance/tax/v3/private/registertime":50,"fht/compliance/tax/v3/private/create":50,"fht/compliance/tax/v3/private/status":50,"fht/compliance/tax/v3/private/url":50,"v5/order/create":2.5,"v5/order/amend":5,"v5/order/cancel":2.5,"v5/order/cancel-all":50,"v5/order/create-batch":5,"v5/order/amend-batch":5,"v5/order/cancel-batch":5,"v5/order/disconnected-cancel-all":5,"v5/position/set-leverage":5,"v5/position/switch-isolated":5,"v5/position/set-tpsl-mode":5,"v5/position/switch-mode":5,"v5/position/set-risk-limit":5,"v5/position/trading-stop":5,"v5/position/set-auto-add-margin":5,"v5/position/add-margin":5,"v5/position/move-positions":5,"v5/position/confirm-pending-mmr":5,"v5/account/upgrade-to-uta":5,"v5/account/quick-repayment":5,"v5/account/set-margin-mode":5,"v5/account/set-hedging-mode":5,"v5/account/mmp-modify":5,"v5/account/mmp-reset":5,"v5/asset/transfer/inter-transfer":50,"v5/asset/transfer/save-transfer-sub-member":150,"v5/asset/transfer/universal-transfer":10,"v5/asset/deposit/deposit-to-account":5,"v5/asset/withdraw/create":50,"v5/asset/withdraw/cancel":50,"v5/user/create-sub-member":10,"v5/user/create-sub-api":10,"v5/user/frozen-sub-member":10,"v5/user/update-api":10,"v5/user/update-sub-api":10,"v5/user/delete-api":10,"v5/user/delete-sub-api":10,"v5/spot-lever-token/purchase":2.5,"v5/spot-lever-token/redeem":2.5,"v5/spot-margin-trade/switch-mode":5,"v5/spot-margin-trade/set-leverage":5,"v5/spot-cross-margin-trade/loan":2.5,"v5/spot-cross-margin-trade/repay":2.5,"v5/spot-cross-margin-trade/switch":2.5,"v5/ins-loan/association-uid":5,"v5/lending/purchase":5,"v5/lending/redeem":5,"v5/lending/redeem-cancel":5,"v5/account/set-collateral-switch":5,"v5/account/set-collateral-switch-batch":5,"v5/account/demo-apply-money":5}}},httpExceptions:{403:a.RateLimitExceeded},exceptions:{exact:{"-10009":a.BadRequest,"-1004":a.BadRequest,"-1021":a.BadRequest,"-1103":a.BadRequest,"-1140":a.InvalidOrder,"-1197":a.InvalidOrder,"-2013":a.InvalidOrder,"-2015":a.AuthenticationError,"-6017":a.BadRequest,"-6025":a.BadRequest,"-6029":a.BadRequest,5004:a.ExchangeError,7001:a.BadRequest,10001:a.BadRequest,10002:a.InvalidNonce,10003:a.AuthenticationError,10004:a.AuthenticationError,10005:a.PermissionDenied,10006:a.RateLimitExceeded,10007:a.AuthenticationError,10008:a.AuthenticationError,10009:a.AuthenticationError,10010:a.PermissionDenied,10014:a.BadRequest,10016:a.ExchangeError,10017:a.BadRequest,10018:a.RateLimitExceeded,10020:a.PermissionDenied,10024:a.PermissionDenied,10027:a.PermissionDenied,10028:a.PermissionDenied,10029:a.PermissionDenied,12137:a.InvalidOrder,12201:a.BadRequest,12141:a.BadRequest,100028:a.PermissionDenied,110001:a.OrderNotFound,110003:a.InvalidOrder,110004:a.InsufficientFunds,110005:a.InvalidOrder,110006:a.InsufficientFunds,110007:a.InsufficientFunds,110008:a.InvalidOrder,110009:a.InvalidOrder,110010:a.InvalidOrder,110011:a.InvalidOrder,110012:a.InsufficientFunds,110013:a.BadRequest,110014:a.InsufficientFunds,110015:a.BadRequest,110016:a.InvalidOrder,110017:a.InvalidOrder,110018:a.BadRequest,110019:a.InvalidOrder,110020:a.InvalidOrder,110021:a.InvalidOrder,110022:a.InvalidOrder,110023:a.InvalidOrder,110024:a.BadRequest,110025:a.NoChange,110026:a.MarginModeAlreadySet,110027:a.NoChange,110028:a.BadRequest,110029:a.BadRequest,110030:a.InvalidOrder,110031:a.InvalidOrder,110032:a.InvalidOrder,110033:a.InvalidOrder,110034:a.InvalidOrder,110035:a.InvalidOrder,110036:a.InvalidOrder,110037:a.InvalidOrder,110038:a.InvalidOrder,110039:a.InvalidOrder,110040:a.InvalidOrder,110041:a.InvalidOrder,110042:a.InvalidOrder,110043:a.BadRequest,110044:a.InsufficientFunds,110045:a.InsufficientFunds,110046:a.BadRequest,110047:a.BadRequest,110048:a.BadRequest,110049:a.BadRequest,110050:a.BadRequest,110051:a.InsufficientFunds,110052:a.InsufficientFunds,110053:a.InsufficientFunds,110054:a.InvalidOrder,110055:a.InvalidOrder,110056:a.InvalidOrder,110057:a.InvalidOrder,110058:a.InvalidOrder,110059:a.InvalidOrder,110060:a.BadRequest,110061:a.BadRequest,110062:a.BadRequest,110063:a.ExchangeError,110064:a.InvalidOrder,110065:a.PermissionDenied,110066:a.ExchangeError,110067:a.PermissionDenied,110068:a.PermissionDenied,110069:a.PermissionDenied,110070:a.InvalidOrder,110071:a.ExchangeError,110072:a.InvalidOrder,110073:a.ExchangeError,130006:a.InvalidOrder,130021:a.InsufficientFunds,130074:a.InvalidOrder,131001:a.InsufficientFunds,131084:a.ExchangeError,131200:a.ExchangeError,131201:a.ExchangeError,131202:a.BadRequest,131203:a.BadRequest,131204:a.BadRequest,131205:a.BadRequest,131206:a.ExchangeError,131207:a.BadRequest,131208:a.ExchangeError,131209:a.BadRequest,131210:a.BadRequest,131211:a.BadRequest,131212:a.InsufficientFunds,131213:a.BadRequest,131214:a.BadRequest,131215:a.BadRequest,131216:a.ExchangeError,131217:a.ExchangeError,131231:a.NotSupported,131232:a.NotSupported,131002:a.BadRequest,131003:a.ExchangeError,131004:a.AuthenticationError,131085:a.InsufficientFunds,131086:a.BadRequest,131088:a.BadRequest,131089:a.BadRequest,131090:a.ExchangeError,131091:a.ExchangeError,131092:a.ExchangeError,131093:a.ExchangeError,131094:a.BadRequest,131095:a.BadRequest,131096:a.BadRequest,131097:a.ExchangeError,131098:a.ExchangeError,131099:a.ExchangeError,140001:a.OrderNotFound,140003:a.InvalidOrder,140004:a.InsufficientFunds,140005:a.InvalidOrder,140006:a.InsufficientFunds,140007:a.InsufficientFunds,140008:a.InvalidOrder,140009:a.InvalidOrder,140010:a.InvalidOrder,140011:a.InvalidOrder,140012:a.InsufficientFunds,140013:a.BadRequest,140014:a.InsufficientFunds,140015:a.InvalidOrder,140016:a.InvalidOrder,140017:a.InvalidOrder,140018:a.BadRequest,140019:a.InvalidOrder,140020:a.InvalidOrder,140021:a.InvalidOrder,140022:a.InvalidOrder,140023:a.InvalidOrder,140024:a.BadRequest,140025:a.BadRequest,140026:a.BadRequest,140027:a.BadRequest,140028:a.InvalidOrder,140029:a.BadRequest,140030:a.InvalidOrder,140031:a.BadRequest,140032:a.InvalidOrder,140033:a.InvalidOrder,140034:a.InvalidOrder,140035:a.InvalidOrder,140036:a.BadRequest,140037:a.InvalidOrder,140038:a.BadRequest,140039:a.BadRequest,140040:a.InvalidOrder,140041:a.InvalidOrder,140042:a.InvalidOrder,140043:a.BadRequest,140044:a.InsufficientFunds,140045:a.InsufficientFunds,140046:a.BadRequest,140047:a.BadRequest,140048:a.BadRequest,140049:a.BadRequest,140050:a.InvalidOrder,140051:a.InsufficientFunds,140052:a.InsufficientFunds,140053:a.InsufficientFunds,140054:a.InvalidOrder,140055:a.InvalidOrder,140056:a.InvalidOrder,140057:a.InvalidOrder,140058:a.InvalidOrder,140059:a.InvalidOrder,140060:a.BadRequest,140061:a.BadRequest,140062:a.BadRequest,140063:a.ExchangeError,140064:a.InvalidOrder,140065:a.PermissionDenied,140066:a.ExchangeError,140067:a.PermissionDenied,140068:a.PermissionDenied,140069:a.PermissionDenied,140070:a.InvalidOrder,170001:a.ExchangeError,170007:a.RequestTimeout,170005:a.InvalidOrder,170031:a.ExchangeError,170032:a.ExchangeError,170033:a.InsufficientFunds,170034:a.InsufficientFunds,170035:a.BadRequest,170036:a.BadRequest,170037:a.BadRequest,170105:a.BadRequest,170115:a.InvalidOrder,170116:a.InvalidOrder,170117:a.InvalidOrder,170121:a.InvalidOrder,170130:a.BadRequest,170131:a.InsufficientFunds,170132:a.InvalidOrder,170133:a.InvalidOrder,170134:a.InvalidOrder,170135:a.InvalidOrder,170136:a.InvalidOrder,170137:a.InvalidOrder,170139:a.InvalidOrder,170140:a.InvalidOrder,170124:a.InvalidOrder,170141:a.InvalidOrder,170142:a.InvalidOrder,170143:a.InvalidOrder,170144:a.InvalidOrder,170145:a.InvalidOrder,170146:a.InvalidOrder,170147:a.InvalidOrder,170148:a.InvalidOrder,170149:a.ExchangeError,170150:a.ExchangeError,170151:a.InvalidOrder,170157:a.InvalidOrder,170159:a.InvalidOrder,170190:a.InvalidOrder,170191:a.InvalidOrder,170192:a.InvalidOrder,170193:a.InvalidOrder,170194:a.InvalidOrder,170195:a.InvalidOrder,170196:a.InvalidOrder,170197:a.InvalidOrder,170198:a.InvalidOrder,170199:a.InvalidOrder,170200:a.InvalidOrder,170221:a.BadRequest,170222:a.RateLimitExceeded,170223:a.InsufficientFunds,170224:a.PermissionDenied,170226:a.InsufficientFunds,170227:a.ExchangeError,170228:a.InvalidOrder,170229:a.InvalidOrder,170234:a.ExchangeError,170210:a.InvalidOrder,170213:a.OrderNotFound,170217:a.InvalidOrder,170218:a.InvalidOrder,170010:a.InvalidOrder,170011:a.InvalidOrder,170019:a.InvalidOrder,170201:a.PermissionDenied,170202:a.InvalidOrder,170203:a.InvalidOrder,170204:a.InvalidOrder,170206:a.InvalidOrder,175e3:a.InvalidOrder,175001:a.InvalidOrder,175002:a.InvalidOrder,175003:a.InsufficientFunds,175004:a.InvalidOrder,175005:a.InvalidOrder,175006:a.InsufficientFunds,175007:a.InvalidOrder,175008:a.InvalidOrder,175009:a.InvalidOrder,175010:a.PermissionDenied,175012:a.InvalidOrder,175013:a.InvalidOrder,175014:a.InvalidOrder,175015:a.InvalidOrder,175016:a.InvalidOrder,175017:a.InvalidOrder,175027:a.ExchangeError,176002:a.BadRequest,176004:a.BadRequest,176003:a.BadRequest,176006:a.BadRequest,176005:a.BadRequest,176008:a.BadRequest,176007:a.BadRequest,176010:a.BadRequest,176009:a.BadRequest,176012:a.BadRequest,176011:a.BadRequest,176014:a.BadRequest,176013:a.BadRequest,176015:a.InsufficientFunds,176016:a.BadRequest,176017:a.BadRequest,176018:a.BadRequest,176019:a.BadRequest,176020:a.BadRequest,176021:a.BadRequest,176022:a.BadRequest,176023:a.BadRequest,176024:a.BadRequest,176025:a.BadRequest,176026:a.BadRequest,176027:a.BadRequest,176028:a.BadRequest,176029:a.BadRequest,176030:a.BadRequest,176031:a.BadRequest,176034:a.BadRequest,176035:a.PermissionDenied,176036:a.PermissionDenied,176037:a.PermissionDenied,176038:a.BadRequest,176039:a.BadRequest,176040:a.BadRequest,181e3:a.BadRequest,181001:a.BadRequest,181002:a.InvalidOrder,181003:a.InvalidOrder,181004:a.InvalidOrder,182e3:a.InvalidOrder,181017:a.BadRequest,20001:a.OrderNotFound,20003:a.InvalidOrder,20004:a.InvalidOrder,20005:a.InvalidOrder,20006:a.InvalidOrder,20007:a.InvalidOrder,20008:a.InvalidOrder,20009:a.InvalidOrder,20010:a.InvalidOrder,20011:a.InvalidOrder,20012:a.InvalidOrder,20013:a.InvalidOrder,20014:a.InvalidOrder,20015:a.InvalidOrder,20016:a.InvalidOrder,20017:a.InvalidOrder,20018:a.InvalidOrder,20019:a.InvalidOrder,20020:a.InvalidOrder,20021:a.InvalidOrder,20022:a.BadRequest,20023:a.BadRequest,20031:a.BadRequest,20070:a.BadRequest,20071:a.BadRequest,20084:a.BadRequest,30001:a.BadRequest,30003:a.InvalidOrder,30004:a.InvalidOrder,30005:a.InvalidOrder,30007:a.InvalidOrder,30008:a.InvalidOrder,30009:a.ExchangeError,30010:a.InsufficientFunds,30011:a.PermissionDenied,30012:a.PermissionDenied,30013:a.PermissionDenied,30014:a.InvalidOrder,30015:a.InvalidOrder,30016:a.ExchangeError,30017:a.InvalidOrder,30018:a.InvalidOrder,30019:a.InvalidOrder,30020:a.InvalidOrder,30021:a.InvalidOrder,30022:a.InvalidOrder,30023:a.InvalidOrder,30024:a.InvalidOrder,30025:a.InvalidOrder,30026:a.InvalidOrder,30027:a.InvalidOrder,30028:a.InvalidOrder,30029:a.InvalidOrder,30030:a.InvalidOrder,30031:a.InsufficientFunds,30032:a.InvalidOrder,30033:a.RateLimitExceeded,30034:a.OrderNotFound,30035:a.RateLimitExceeded,30036:a.ExchangeError,30037:a.InvalidOrder,30041:a.ExchangeError,30042:a.InsufficientFunds,30043:a.InvalidOrder,30044:a.InvalidOrder,30045:a.InvalidOrder,30049:a.InsufficientFunds,30050:a.ExchangeError,30051:a.ExchangeError,30052:a.ExchangeError,30054:a.ExchangeError,30057:a.ExchangeError,30063:a.ExchangeError,30067:a.InsufficientFunds,30068:a.ExchangeError,30074:a.InvalidOrder,30075:a.InvalidOrder,30078:a.ExchangeError,33004:a.AuthenticationError,34026:a.ExchangeError,34036:a.BadRequest,35015:a.BadRequest,340099:a.ExchangeError,3400045:a.ExchangeError,3100116:a.BadRequest,3100198:a.BadRequest,3200300:a.InsufficientFunds},broad:{"Request timeout":a.RequestTimeout,"unknown orderInfo":a.OrderNotFound,"invalid api_key":a.AuthenticationError,oc_diff:a.InsufficientFunds,new_oc:a.InsufficientFunds,"openapi sign params error!":a.AuthenticationError}},precisionMode:r.sh,options:{sandboxMode:!1,enableDemoTrading:!1,fetchMarkets:["spot","linear","inverse","option"],createOrder:{method:"privatePostV5OrderCreate"},enableUnifiedMargin:void 0,enableUnifiedAccount:void 0,createMarketBuyOrderRequiresPrice:!0,createUnifiedMarginAccount:!1,defaultType:"swap",defaultSubType:"linear",defaultSettle:"USDT",code:"BTC",recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,loadAllOptions:!1,loadExpiredOptions:!1,brokerId:"CCXT",accountsByType:{spot:"SPOT",margin:"SPOT",future:"CONTRACT",swap:"CONTRACT",option:"OPTION",investment:"INVESTMENT",unified:"UNIFIED",funding:"FUND",fund:"FUND",contract:"CONTRACT"},accountsById:{SPOT:"spot",MARGIN:"spot",CONTRACT:"contract",OPTION:"option",INVESTMENT:"investment",UNIFIED:"unified",FUND:"fund"},networks:{ERC20:"ETH",TRC20:"TRX",BEP20:"BSC",OMNI:"OMNI",SPL:"SOL"},networksById:{ETH:"ERC20",TRX:"TRC20",BSC:"BEP20",OMNI:"OMNI",SPL:"SOL"},defaultNetwork:"ERC20",defaultNetworks:{USDT:"TRC20"},intervals:{"5m":"5min","15m":"15min","30m":"30min","1h":"1h","4h":"4h","1d":"1d"}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,taker:75e-5,maker:1e-4},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{}}}})}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}enableDemoTrading(e){if(this.options.sandboxMode)throw new a.NotSupported(this.id+" demo trading does not support in sandbox environment");if(e)this.urls.apiBackupDemoTrading=this.urls.api,this.urls.api=this.urls.demotrading;else if("apiBackupDemoTrading"in this.urls){this.urls.api=this.urls.apiBackupDemoTrading;const e=this.omit(this.urls,"apiBackupDemoTrading");this.urls=e}this.options.enableDemoTrading=e}nonce(){return this.milliseconds()-this.options.timeDifference}addPaginationCursorToResult(e){const t=this.safeDict(e,"result",{}),s=this.safeValueN(t,["list","rows","data","dataList"],[]),i=this.safeString2(t,"nextPageCursor","cursor"),r=s.length;if(void 0!==i&&r>0){const e=s[0];e.nextPageCursor=i,s[0]=e}return s}async isUnifiedEnabled(e={}){const t=this.safeBool(this.options,"enableUnifiedMargin"),s=this.safeBool(this.options,"enableUnifiedAccount");if(void 0===t||void 0===s){if(this.options.enableDemoTrading)return this.options.enableUnifiedMargin=!1,this.options.enableUnifiedAccount=!0,[this.options.enableUnifiedMargin,this.options.enableUnifiedAccount];const t=await this.privateGetV5UserQueryApi(e),s=this.safeDict(t,"result",{});this.options.enableUnifiedMargin=1===this.safeInteger(s,"unified"),this.options.enableUnifiedAccount=1===this.safeInteger(s,"uta")}return[this.options.enableUnifiedMargin,this.options.enableUnifiedAccount]}async upgradeUnifiedTradeAccount(e={}){return await this.privatePostV5AccountUpgradeToUta(e)}createExpiredOptionMarket(e){const t="USD",s="USDC",i=e.split("-"),r=e.split("/");let a,o;e.indexOf("/")>-1?(a=this.safeString(r,0),o=this.safeString(i,1)):(a=this.safeString(i,0),o=this.convertMarketIdExpireDate(this.safeString(i,1)));const n=this.safeString(i,2),d=this.safeString(i,3),h=this.convertExpireDate(o),c=this.parse8601(h);return{id:a+"-"+this.convertExpireDateToMarketIdDate(o)+"-"+n+"-"+d,symbol:a+"/"+t+":"+s+"-"+o+"-"+n+"-"+d,base:a,quote:t,settle:s,baseId:a,quoteId:t,settleId:s,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:void 0,expiry:c,expiryDatetime:h,optionType:"C"===d?"call":"put",strike:this.parseNumber(n),precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return void 0!==e&&(e.indexOf("-C")>-1||e.indexOf("-P")>-1)&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,s,i)}getBybitType(e,t,s={}){let i,r;return[i,s]=this.handleMarketTypeAndParams(e,t,s),[r,s]=this.handleSubTypeAndParams(e,t,s),"option"===i||"spot"===i?[i,s]:[r,s]}async fetchTime(e={}){const t=await this.publicGetV5MarketTime(e);return this.safeInteger(t,"time")}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;if(this.options.enableDemoTrading)return;const t=await this.privateGetV5AssetCoinQueryInfo(e),s=this.safeDict(t,"result",{}),i=this.safeList(s,"rows",[]),r={};for(let e=0;e1)throw new a.InvalidOrder(this.id+" returned more than one order");return this.safeValue(r,0)}async fetchOrder(e,t=void 0,s={}){const i=await this.isUnifiedEnabled();if(this.safeBool(i,1))throw new a.NotSupported(this.id+" fetchOrder() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrder or fetchClosedOrder");return await this.fetchOrderClassic(e,t,s)}async fetchOrders(e=void 0,t=void 0,s=void 0,i={}){const r=await this.isUnifiedEnabled();if(this.safeBool(r,1))throw new a.NotSupported(this.id+" fetchOrders() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders");return await this.fetchOrdersClassic(e,t,s,i)}async fetchOrdersClassic(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchOrders","paginate"),r)return await this.fetchPaginatedCallCursor("fetchOrders",e,t,s,i,"nextPageCursor","cursor",void 0,50);const[o,n]=await this.isUnifiedEnabled(),d=o||n,h={};let c,l,u=!1;if(void 0!==e&&(c=this.market(e),u="USDC"===c.settle,h.symbol=c.id),[l,i]=this.getBybitType("fetchOrders",c,i),("option"===l||u)&&!d)return await this.fetchUsdcOrders(e,t,s,i);if("spot"===l)throw new a.NotSupported(this.id+" fetchOrders() is not supported for spot markets");h.category=l;const p=this.safeBoolN(i,["trigger","stop"],!1);i=this.omit(i,["trigger","stop"]),p&&(h.orderFilter="StopOrder"),void 0!==s&&(h.limit=s),void 0!==t&&(h.startTime=t);const f=this.safeInteger(i,"until"),m=this.safeInteger(i,"endTime",f);i=this.omit(i,["endTime","until"]),void 0!==m&&(h.endTime=m);const g=await this.privateGetV5OrderHistory(this.extend(h,i)),v=this.addPaginationCursorToResult(g);return this.parseOrders(v,c,t,s)}async fetchClosedOrder(e,t=void 0,s={}){await this.loadMarkets();const i={orderId:e},r=await this.fetchClosedOrders(t,void 0,void 0,this.extend(i,s)),o=r.length;if(0===o){const t=this.safeBoolN(s,["trigger","stop"],!1)?"":'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';throw new a.OrderNotFound("Order "+e.toString()+" was not found."+t)}if(o>1)throw new a.InvalidOrder(this.id+" returned more than one order");return this.safeValue(r,0)}async fetchOpenOrder(e,t=void 0,s={}){await this.loadMarkets();const i={orderId:e},r=await this.fetchOpenOrders(t,void 0,void 0,this.extend(i,s)),o=r.length;if(0===o){const t=this.safeBoolN(s,["trigger","stop"],!1)?"":'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';throw new a.OrderNotFound("Order "+e.toString()+" was not found."+t)}if(o>1)throw new a.InvalidOrder(this.id+" returned more than one order");return this.safeValue(r,0)}async fetchCanceledAndClosedOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchCanceledAndClosedOrders","paginate"),r)return await this.fetchPaginatedCallCursor("fetchCanceledAndClosedOrders",e,t,s,i,"nextPageCursor","cursor",void 0,50);const[a,o]=await this.isUnifiedEnabled(),n=a||o,d={};let h,c,l=!1;if(void 0!==e&&(h=this.market(e),l="USDC"===h.settle,d.symbol=h.id),[c,i]=this.getBybitType("fetchCanceledAndClosedOrders",h,i),("option"===c||l)&&!n)return await this.fetchUsdcOrders(e,t,s,i);d.category=c;const u=this.safeBoolN(i,["trigger","stop"],!1);i=this.omit(i,["trigger","stop"]),u&&(d.orderFilter="StopOrder"),void 0!==s&&(d.limit=s),void 0!==t&&(d.startTime=t);const p=this.safeInteger(i,"until"),f=this.safeInteger(i,"endTime",p);i=this.omit(i,["endTime","until"]),void 0!==f&&(d.endTime=f);const m=await this.privateGetV5OrderHistory(this.extend(d,i)),g=this.addPaginationCursorToResult(m);return this.parseOrders(g,h,t,s)}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();return await this.fetchCanceledAndClosedOrders(e,t,s,this.extend({orderStatus:"Filled"},i))}async fetchCanceledOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();return await this.fetchCanceledAndClosedOrders(e,t,s,this.extend({orderStatus:"Cancelled"},i))}async fetchUsdcOpenOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};let a,o;void 0!==e&&(a=this.market(e),r.symbol=a.id),[o,i]=this.handleMarketTypeAndParams("fetchUsdcOpenOrders",a,i),r.category="swap"===o?"perpetual":"option";const n=await this.privatePostOptionUsdcOpenapiPrivateV1QueryActiveOrders(this.extend(r,i)),d=this.safeDict(n,"result",{}),h=this.safeList(d,"dataList",[]);return this.parseOrders(h,a,t,s)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const[r,a]=await this.isUnifiedEnabled(),o=r||a,n={};let d,h,c=!1;if(void 0!==e&&(d=this.market(e),c="USDC"===d.settle,n.symbol=d.id),[h,i]=this.getBybitType("fetchOpenOrders",d,i),"linear"===h||"inverse"===h){const t=this.safeString(i,"baseCoin");if(void 0===e&&void 0===t){const e=this.safeString(this.options,"defaultSettle","USDT"),t=this.safeString(i,"settleCoin",e);n.settleCoin=t,c="USDC"===t}}if(("option"===h||c)&&!o)return await this.fetchUsdcOpenOrders(e,t,s,i);n.category=h;const l=this.safeBool2(i,"stop","trigger",!1);i=this.omit(i,["stop","trigger"]),l&&(n.orderFilter="StopOrder"),void 0!==s&&(n.limit=s);const u=await this.privateGetV5OrderRealtime(this.extend(n,i)),p=this.addPaginationCursorToResult(u);return this.parseOrders(p,d,t,s)}async fetchOrderTrades(e,t=void 0,s=void 0,i=void 0,r={}){const a={},o=this.safeString2(r,"clientOrderId","orderLinkId");return void 0!==o?a.orderLinkId=o:a.orderId=e,r=this.omit(r,["clientOrderId","orderLinkId"]),await this.fetchMyTrades(t,s,i,this.extend(a,r))}async fetchMyUsdcTrades(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets();const a={};void 0!==e?(r=this.market(e),a.symbol=r.id,a.category=r.option?"OPTION":"PERPETUAL"):a.category="PERPETUAL";const o=await this.privatePostOptionUsdcOpenapiPrivateV1ExecutionList(this.extend(a,i)),n=this.safeDict(o,"result",{}),d=this.safeList(n,"dataList",[]);return this.parseTrades(d,r,t,s)}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchMyTrades","paginate"),r)return await this.fetchPaginatedCallCursor("fetchMyTrades",e,t,s,i,"nextPageCursor","cursor",void 0,100);const[a,o]=await this.isUnifiedEnabled(),n=a||o;let d,h,c={execType:"Trade"},l=!1;if(void 0!==e&&(d=this.market(e),l="USDC"===d.settle,c.symbol=d.id),[h,i]=this.getBybitType("fetchMyTrades",d,i),("option"===h||l)&&!n)return await this.fetchMyUsdcTrades(e,t,s,i);c.category=h,void 0!==s&&(c.limit=s),void 0!==t&&(c.startTime=t),[c,i]=this.handleUntilOption("endTime",c,i);const u=await this.privateGetV5ExecutionList(this.extend(c,i)),p=this.addPaginationCursorToResult(u);return this.parseTrades(p,d,t,s)}parseDepositAddress(e,t=void 0){const s=this.safeString(e,"addressDeposit"),i=this.safeString(e,"tagDeposit"),r=this.safeString(t,"code"),a=this.safeString(e,"chain");return this.checkAddress(s),{currency:r,address:s,tag:i,network:a,info:e}}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();let s=this.currency(e);const i={coin:s.id},r=await this.privateGetV5AssetDepositQueryAddress(this.extend(i,t)),a=this.safeDict(r,"result",{}),o=this.safeList(a,"chains",[]),n=this.safeString(a,"coin");s=this.currency(n);const d=this.parseDepositAddresses(o,[s.code],!1,{currency:s.code});return this.indexBy(d,"network")}async fetchDepositAddress(e,t={}){await this.loadMarkets();const[s,i]=this.handleNetworkCodeAndParams(t),r=this.networkCodeToId(s),a=this.currency(e),o={coin:a.id};void 0!==r&&(o.chainType=r);const n=await this.privateGetV5AssetDepositQueryAddress(this.extend(o,i)),d=this.safeDict(n,"result",{}),h=this.safeList(d,"chains",[]),c=this.indexBy(h,"chain"),l=this.selectNetworkIdFromRawNetworks(e,s,c),u=this.safeDict(c,l,{});return this.parseDepositAddress(u,a)}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchDeposits","paginate"),r)return await this.fetchPaginatedCallCursor("fetchDeposits",e,t,s,i,"nextPageCursor","cursor",void 0,50);let a,o={};void 0!==e&&(a=this.currency(e),o.coin=a.id),void 0!==t&&(o.startTime=t),void 0!==s&&(o.limit=s),[o,i]=this.handleUntilOption("endTime",o,i);const n=await this.privateGetV5AssetDepositQueryRecord(this.extend(o,i)),d=this.addPaginationCursorToResult(n);return this.parseTransactions(d,a,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchWithdrawals","paginate"),r)return await this.fetchPaginatedCallCursor("fetchWithdrawals",e,t,s,i,"nextPageCursor","cursor",void 0,50);let a,o={};void 0!==e&&(a=this.currency(e),o.coin=a.id),void 0!==t&&(o.startTime=t),void 0!==s&&(o.limit=s),[o,i]=this.handleUntilOption("endTime",o,i);const n=await this.privateGetV5AssetWithdrawQueryRecord(this.extend(o,i)),d=this.addPaginationCursorToResult(n);return this.parseTransactions(d,a,t,s)}parseTransactionStatus(e){return this.safeString({0:"unknown",1:"pending",2:"processing",3:"ok",4:"fail",SecurityCheck:"pending",Pending:"pending",success:"ok",CancelByUser:"canceled",Reject:"rejected",Fail:"failed",BlockchainConfirmed:"ok"},e,e)}parseTransaction(e,t=void 0){const s=this.safeString(e,"coin"),i=this.safeCurrencyCode(s,t),r=this.safeInteger2(e,"createTime","successAt"),a=this.safeInteger(e,"updateTime"),o=this.parseTransactionStatus(this.safeString(e,"status")),n=this.safeNumber2(e,"depositFee","withdrawFee"),d="depositFee"in e?"deposit":"withdrawal";let h;void 0!==n&&(h={cost:n,currency:i});const c=this.safeString(e,"toAddress");return{info:e,id:this.safeString2(e,"id","withdrawId"),txid:this.safeString(e,"txID"),timestamp:r,datetime:this.iso8601(r),network:this.networkIdToCode(this.safeString(e,"chain")),address:void 0,addressTo:c,addressFrom:void 0,tag:this.safeString(e,"tag"),tagTo:void 0,tagFrom:void 0,type:d,amount:this.safeNumber(e,"amount"),currency:i,status:o,updated:a,fee:h,internal:void 0,comment:void 0}}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={},a=await this.isUnifiedEnabled();let o,n,d="coin";a[1]?(d="currency",void 0!==t&&(r.startTime=t)):void 0!==t&&(r.start_date=this.yyyymmdd(t)),void 0!==e&&(o=this.currency(e),r[d]=o.id),void 0!==s&&(r.limit=s),n=a[1]?await this.privateGetV5AccountTransactionLog(this.extend(r,i)):await this.privateGetV2PrivateWalletFundRecords(this.extend(r,i));const h=this.addPaginationCursorToResult(n);return this.parseLedger(h,o,t,s)}parseLedgerEntry(e,t=void 0){const s=this.safeString2(e,"coin","currency"),i=this.safeCurrencyCode(s,t),r=this.safeString2(e,"amount","change"),a=this.safeString2(e,"wallet_balance","cashBalance"),n=o.O.stringLt(r,"0")?"out":"in";let d;if(void 0!==a&&void 0!==r){const e="out"===n?r:o.O.stringNeg(r);d=o.O.stringAdd(a,e)}let h=this.parse8601(this.safeString(e,"exec_time"));void 0===h&&(h=this.safeInteger(e,"transactionTime"));const c=this.parseLedgerEntryType(this.safeString(e,"type")),l=this.safeString(e,"id"),u=this.safeString(e,"tx_id");return{id:l,currency:i,account:this.safeString(e,"wallet_id"),referenceAccount:void 0,referenceId:u,status:void 0,amount:this.parseNumber(o.O.stringAbs(r)),before:this.parseNumber(d),after:this.parseNumber(a),fee:this.parseNumber(this.safeString(e,"fee")),direction:n,timestamp:h,datetime:this.iso8601(h),type:c,info:e}}parseLedgerEntryType(e){return this.safeString({Deposit:"transaction",Withdraw:"transaction",RealisedPNL:"trade",Commission:"fee",Refund:"cashback",Prize:"prize",ExchangeOrderWithdraw:"transaction",ExchangeOrderDeposit:"transaction",TRANSFER_IN:"transaction",TRANSFER_OUT:"transaction",TRADE:"trade",SETTLEMENT:"trade",DELIVERY:"trade",LIQUIDATION:"trade",BONUS:"Prize",FEE_REFUND:"cashback",INTEREST:"transaction",CURRENCY_BUY:"trade",CURRENCY_SELL:"trade"},e,e)}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),await this.loadMarkets(),this.checkAddress(s);const a=this.currency(e),o={coin:a.id,amount:this.numberToString(t),address:s,timestamp:this.milliseconds()};void 0!==i&&(o.tag=i);const[n,d]=this.handleNetworkCodeAndParams(r),h=this.networkCodeToId(n);void 0!==h&&(o.chain=h.toUpperCase());const c=await this.privatePostV5AssetWithdrawCreate(this.extend(o,d)),l=this.safeDict(c,"result",{});return this.parseTransaction(l,a)}async fetchPosition(e,t={}){if(void 0===e)throw new a.ArgumentsRequired(this.id+" fetchPosition() requires a symbol argument");await this.loadMarkets();const s=this.market(e),i={symbol:s.id},[r,o]=await this.isUnifiedEnabled(),n=r||o,d="USDC"===s.settle;let h,c;[c,t]=this.getBybitType("fetchPosition",s,t),"option"!==c&&!d||n?(i.category=c,h=await this.privateGetV5PositionList(this.extend(i,t))):(i.category="option"===c?"OPTION":"PERPETUAL",h=await this.privatePostOptionUsdcOpenapiPrivateV1QueryPosition(this.extend(i,t)));const l=this.safeDict(h,"result",{}),u=this.safeList2(l,"list","dataList",[]),p=this.safeInteger(h,"time"),f=this.safeDict(u,0,{}),m=this.parsePosition(f,s);return m.timestamp=p,m.datetime=this.iso8601(p),m}async fetchUsdcPositions(e=void 0,t={}){await this.loadMarkets();const s={};let i,r;if(Array.isArray(e)){if(1!==e.length)throw new a.ArgumentsRequired(this.id+" fetchUsdcPositions() takes an array with exactly one symbol");const t=this.safeString(e,0);i=this.market(t),s.symbol=i.id}else void 0!==e&&(i=this.market(e),s.symbol=i.id);[r,t]=this.getBybitType("fetchUsdcPositions",i,t),s.category="option"===r?"OPTION":"PERPETUAL";const o=await this.privatePostOptionUsdcOpenapiPrivateV1QueryPosition(this.extend(s,t)),n=this.safeDict(o,"result",{}),d=this.safeList(n,"dataList",[]),h=[];for(let e=0;e1)throw new a.ArgumentsRequired(this.id+" fetchPositions() does not accept an array with more than one symbol");1===t&&(s=e[0]),e=this.marketSymbols(e)}else void 0!==e&&(s=e,e=[this.symbol(s)]);await this.loadMarkets();const[i,r]=await this.isUnifiedEnabled(),o=i||r,n={};let d,h,c=!1;if(void 0!==s&&(d=this.market(s),s=d.symbol,n.symbol=d.id,c="USDC"===d.settle),[h,t]=this.getBybitType("fetchPositions",d,t),"linear"===h||"inverse"===h){const e=this.safeString(t,"baseCoin");if("linear"===h){if(void 0===s&&void 0===e){const e=this.safeString(this.options,"defaultSettle","USDT"),s=this.safeString(t,"settleCoin",e);n.settleCoin=s,c="USDC"===s}}else void 0===s&&void 0===e&&(n.category="inverse")}if(("option"===h||c)&&!o)return await this.fetchUsdcPositions(e,t);t=this.omit(t,["type"]),n.category=h;const l=await this.privateGetV5PositionList(this.extend(n,t)),u=this.addPaginationCursorToResult(l),p=[];for(let e=0;e0&&(r=this.market(e[0])));const n=this.safeInteger(i,"until");[a,i]=this.handleSubTypeAndParams("fetchPositionsHistory",r,i,"linear"),i=this.omit(i,"until");const d={category:a};void 0!==e&&1===o&&(d.symbol=r.id),void 0!==t&&(d.startTime=t),void 0!==s&&(d.limit=s),void 0!==n&&(d.endTime=n);const h=await this.privateGetV5PositionClosedPnl(this.extend(d,i)),c=this.safeDict(h,"result"),l=this.safeList(c,"list"),u=this.parsePositions(l,e,i);return this.filterBySinceLimit(u,t,s)}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o=this.implodeHostname(this.urls.api[t])+"/"+e;if("public"===t)Object.keys(i).length&&(o+="?"+this.rawencode(i));else if("private"===t){this.checkRequiredCredentials();const e=o.indexOf("openapi")>=0,t=o.indexOf("unified/v3")>=0,h=o.indexOf("contract/v3")>=0,c=o.indexOf("v5")>=0,l=this.nonce().toString();if(e){a=Object.keys(i).length?this.json(i):"{}";const e=l+this.apiKey+a,t=this.hmac(this.encode(e),this.encode(this.secret),n.J,"hex");r={"Content-Type":"application/json","X-BAPI-API-KEY":this.apiKey,"X-BAPI-TIMESTAMP":l,"X-BAPI-SIGN":t}}else if(t||h||c){r={"Content-Type":"application/json","X-BAPI-API-KEY":this.apiKey,"X-BAPI-TIMESTAMP":l,"X-BAPI-RECV-WINDOW":this.options.recvWindow.toString()},(t||h)&&(r["X-BAPI-SIGN-TYPE"]="2");const e=this.extend({},i),c=this.rawencode(e),u=l.toString()+this.apiKey+this.options.recvWindow.toString();let p,f;"POST"===s?p=u+(a=this.json(e)):(p=u+c,o+="?"+this.rawencode(e)),f=this.secret.indexOf("PRIVATE KEY")>-1?(0,d.j)(p,this.secret,n.J):this.hmac(this.encode(p),this.encode(this.secret),n.J),r["X-BAPI-SIGN"]=f}else{const e=this.extend(i,{api_key:this.apiKey,recv_window:this.options.recvWindow,timestamp:l}),t=this.keysort(e),h=this.rawencode(t);let c;if(c=this.secret.indexOf("PRIVATE KEY")>-1?(0,d.j)(h,this.secret,n.J):this.hmac(this.encode(h),this.encode(this.secret),n.J),"POST"===s){const t=o.indexOf("spot")>=0,s=this.extend(e,{sign:c});t?(a=this.urlencode(s),r={"Content-Type":"application/x-www-form-urlencoded"}):(a=this.json(s),r={"Content-Type":"application/json"})}else o+="?"+this.rawencode(t),o+="&sign="+c}}if("POST"===s){const e=this.safeString(this.options,"brokerId");void 0!==e&&(r.Referer=e)}return{url:o,method:s,body:a,headers:r}}handleErrors(e,t,s,i,r,o,n,d,h){if(!n)return;const c=this.safeString2(n,"ret_code","retCode");if("0"!==c){if("30084"===c)return;let e;throw e="10005"===c&&s.indexOf("order")<0?this.id+' private api uses /user/v3/private/query-api to check if you have a unified account. The API key of user id must own one of permissions: "Account Transfer", "Subaccount Transfer", "Withdrawal" '+o:this.id+" "+o,this.throwBroadlyMatchedException(this.exceptions.broad,o,e),this.throwExactlyMatchedException(this.exceptions.exact,c,e),new a.ExchangeError(e)}}}},6445:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(1006),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"cex",name:"CEX.IO",countries:["GB","EU","CY","RU"],rateLimit:1500,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,editOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,transfer:!1,withdraw:!1},timeframes:{"1m":"1m","1h":"1h","1d":"1d"},urls:{logo:"https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg",api:{rest:"https://cex.io/api"},www:"https://cex.io",doc:"https://cex.io/cex-api",fees:["https://cex.io/fee-schedule","https://cex.io/limits-commissions"],referral:"https://cex.io/r/0/up105393824/0/"},requiredCredentials:{apiKey:!0,secret:!0,uid:!0},api:{public:{get:["currency_profile","currency_limits/","last_price/{pair}/","last_prices/{currencies}/","ohlcv/hd/{yyyymmdd}/{pair}","order_book/{pair}/","ticker/{pair}/","tickers/{currencies}/","trade_history/{pair}/"],post:["convert/{pair}","price_stats/{pair}"]},private:{post:["active_orders_status/","archived_orders/{pair}/","balance/","cancel_order/","cancel_orders/{pair}/","cancel_replace_order/{pair}/","close_position/{pair}/","get_address/","get_crypto_address","get_myfee/","get_order/","get_order_tx/","open_orders/{pair}/","open_orders/","open_position/{pair}/","open_positions/{pair}/","place_order/{pair}/","raw_tx_history"]}},fees:{trading:{maker:this.parseNumber("0.0016"),taker:this.parseNumber("0.0025")},funding:{withdraw:{},deposit:{BTC:0,ETH:0,BCH:0,DASH:0,BTG:0,ZEC:0,XRP:0,XLM:0}}},precisionMode:o.sh,exceptions:{exact:{},broad:{"Insufficient funds":r.InsufficientFunds,"Nonce must be incremented":r.InvalidNonce,"Invalid Order":r.InvalidOrder,"Order not found":r.OrderNotFound,"limit exceeded":r.RateLimitExceeded,"Invalid API key":r.AuthenticationError,"There was an error while placing your order":r.InvalidOrder,"Sorry, too many clients already":r.DDoSProtection,"Invalid Symbols Pair":r.BadSymbol,"Wrong currency pair":r.BadSymbol}},options:{fetchOHLCVWarning:!0,createMarketBuyOrderRequiresPrice:!0,order:{status:{c:"canceled",d:"closed",cd:"canceled",a:"open"}},defaultNetwork:"ERC20",defaultNetworks:{USDT:"TRC20"},networks:{ERC20:"Ethereum",BTC:"BTC",BEP20:"Binance Smart Chain",TRC20:"Tron"}}})}async fetchCurrenciesFromCache(e={}){const t=this.safeValue(this.options,"fetchCurrencies",{}),s=this.safeInteger(t,"timestamp"),i=this.safeInteger(t,"expires",1e3),r=this.milliseconds();if(void 0===s||r-s>i){const s=await this.publicGetCurrencyProfile(e);this.options.fetchCurrencies=this.extend(t,{response:s,timestamp:r})}return this.safeValue(this.options.fetchCurrencies,"response")}async fetchCurrencies(e={}){const t=await this.fetchCurrenciesFromCache(e);this.options.currencies={timestamp:this.milliseconds(),response:t};const s=this.safeValue(t,"data",[]),i=this.safeValue(s,"symbols",[]),r={};for(let e=0;e=0?i=this.parse8601(i):void 0!==i&&(i=parseInt(i));const r=this.safeString(e,"symbol1"),o=this.safeString(e,"symbol2");if(void 0===t&&void 0!==r&&void 0!==o){const e=this.safeCurrencyCode(r),i=this.safeCurrencyCode(o);void 0!==e&&void 0!==i&&(s=e+"/"+i),s in this.markets&&(t=this.market(s))}const n=this.parseOrderStatus(this.safeString(e,"status")),d=this.safeString(e,"price");let h=this.omitZero(this.safeString(e,"amount"));if(void 0!==h)h=a.O.stringAbs(h);else if(void 0!==t){const s="a:"+t.base+"cds:";h=a.O.stringAbs(this.safeString(e,s))}const c=this.safeString2(e,"pending","remains"),l=a.O.stringSub(h,c);let u,p;if(void 0!==t){s=t.symbol;const i=this.safeString(e,"ta:"+t.quote),r=this.safeString(e,"tta:"+t.quote);p=a.O.stringAdd(i,r);const o="fa:"+t.base,n="tfa:"+t.base,d="fa:"+t.quote,h="tfa:"+t.quote;let c=this.safeString(e,"tradingFeeMaker");if(c||(c=this.safeString(e,"tradingFeeTaker",c)),c&&(c=a.O.stringDiv(c,"100")),o in e||n in e){const s=this.safeNumber2(e,o,n);u={currency:t.base,rate:this.parseNumber(c),cost:s}}else if(d in e||h in e){const s=this.safeNumber2(e,d,h);u={currency:t.quote,rate:this.parseNumber(c),cost:s}}}p||(p=a.O.stringMul(d,l));const f=this.safeString(e,"type");let m;const g=this.safeString(e,"id");if("vtx"in e){m=[];for(let i=0;i{s.d(t,{Z:()=>h});var i=s(2456),r=s(6689),a=s(2194),o=s(9292),n=s(1372),d=s(5981);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinbase",name:"Coinbase Advanced",countries:["US"],pro:!0,certified:!0,rateLimit:34,version:"v2",userAgent:this.userAgents.chrome,headers:{"CB-VERSION":"2018-05-30"},has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!0,createConvertTrade:!0,createDepositAddress:!0,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrder:!0,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!1,createStopOrder:!0,deposit:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchConvertQuote:!0,fetchConvertTrade:!0,fetchConvertTradeHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:"emulated",fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL2OrderBook:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyBuys:!0,fetchMySells:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg",api:{rest:"https://api.coinbase.com"},www:"https://www.coinbase.com",doc:["https://developers.coinbase.com/api/v2","https://docs.cloud.coinbase.com/advanced-trade-api/docs/welcome"],fees:["https://support.coinbase.com/customer/portal/articles/2109597-buy-sell-bank-transfer-fees","https://www.coinbase.com/advanced-fees"],referral:"https://www.coinbase.com/join/58cbe25a355148797479dbd2"},requiredCredentials:{apiKey:!0,secret:!0},api:{v2:{public:{get:{currencies:10.6,"currencies/crypto":10.6,time:10.6,"exchange-rates":10.6,"users/{user_id}":10.6,"prices/{symbol}/buy":10.6,"prices/{symbol}/sell":10.6,"prices/{symbol}/spot":10.6}},private:{get:{accounts:10.6,"accounts/{account_id}":10.6,"accounts/{account_id}/addresses":10.6,"accounts/{account_id}/addresses/{address_id}":10.6,"accounts/{account_id}/addresses/{address_id}/transactions":10.6,"accounts/{account_id}/transactions":10.6,"accounts/{account_id}/transactions/{transaction_id}":10.6,"accounts/{account_id}/buys":10.6,"accounts/{account_id}/buys/{buy_id}":10.6,"accounts/{account_id}/sells":10.6,"accounts/{account_id}/sells/{sell_id}":10.6,"accounts/{account_id}/deposits":10.6,"accounts/{account_id}/deposits/{deposit_id}":10.6,"accounts/{account_id}/withdrawals":10.6,"accounts/{account_id}/withdrawals/{withdrawal_id}":10.6,"payment-methods":10.6,"payment-methods/{payment_method_id}":10.6,user:10.6,"user/auth":10.6},post:{accounts:10.6,"accounts/{account_id}/primary":10.6,"accounts/{account_id}/addresses":10.6,"accounts/{account_id}/transactions":10.6,"accounts/{account_id}/transactions/{transaction_id}/complete":10.6,"accounts/{account_id}/transactions/{transaction_id}/resend":10.6,"accounts/{account_id}/buys":10.6,"accounts/{account_id}/buys/{buy_id}/commit":10.6,"accounts/{account_id}/sells":10.6,"accounts/{account_id}/sells/{sell_id}/commit":10.6,"accounts/{account_id}/deposits":10.6,"accounts/{account_id}/deposits/{deposit_id}/commit":10.6,"accounts/{account_id}/withdrawals":10.6,"accounts/{account_id}/withdrawals/{withdrawal_id}/commit":10.6},put:{"accounts/{account_id}":10.6,user:10.6},delete:{"accounts/{id}":10.6,"accounts/{account_id}/transactions/{transaction_id}":10.6}}},v3:{public:{get:{"brokerage/time":3,"brokerage/market/product_book":3,"brokerage/market/products":3,"brokerage/market/products/{product_id}":3,"brokerage/market/products/{product_id}/candles":3,"brokerage/market/products/{product_id}/ticker":3}},private:{get:{"brokerage/accounts":1,"brokerage/accounts/{account_uuid}":1,"brokerage/orders/historical/batch":1,"brokerage/orders/historical/fills":1,"brokerage/orders/historical/{order_id}":1,"brokerage/products":3,"brokerage/products/{product_id}":3,"brokerage/products/{product_id}/candles":3,"brokerage/products/{product_id}/ticker":3,"brokerage/best_bid_ask":3,"brokerage/product_book":3,"brokerage/transaction_summary":3,"brokerage/portfolios":1,"brokerage/portfolios/{portfolio_uuid}":1,"brokerage/convert/trade/{trade_id}":1,"brokerage/cfm/balance_summary":1,"brokerage/cfm/positions":1,"brokerage/cfm/positions/{product_id}":1,"brokerage/cfm/sweeps":1,"brokerage/intx/portfolio/{portfolio_uuid}":1,"brokerage/intx/positions/{portfolio_uuid}":1,"brokerage/intx/positions/{portfolio_uuid}/{symbol}":1,"brokerage/payment_methods":1,"brokerage/payment_methods/{payment_method_id}":1},post:{"brokerage/orders":1,"brokerage/orders/batch_cancel":1,"brokerage/orders/edit":1,"brokerage/orders/edit_preview":1,"brokerage/orders/preview":1,"brokerage/portfolios":1,"brokerage/portfolios/move_funds":1,"brokerage/convert/quote":1,"brokerage/convert/trade/{trade_id}":1,"brokerage/cfm/sweeps/schedule":1,"brokerage/intx/allocate":1,"brokerage/orders/close_position":1},put:{"brokerage/portfolios/{portfolio_uuid}":1},delete:{"brokerage/portfolios/{portfolio_uuid}":1,"brokerage/cfm/sweeps":1}}}},fees:{trading:{taker:this.parseNumber("0.006"),maker:this.parseNumber("0.004"),tierBased:!0,percentage:!0,tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.006")],[this.parseNumber("10000"),this.parseNumber("0.004")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("15000000"),this.parseNumber("0.0016")],[this.parseNumber("75000000"),this.parseNumber("0.0012")],[this.parseNumber("250000000"),this.parseNumber("0.0008")],[this.parseNumber("400000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("10000"),this.parseNumber("0.0025")],[this.parseNumber("50000"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.001")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("15000000"),this.parseNumber("0.0006")],[this.parseNumber("75000000"),this.parseNumber("0.0003")],[this.parseNumber("250000000"),this.parseNumber("0.0")],[this.parseNumber("400000000"),this.parseNumber("0.0")]]}}},precisionMode:o.sh,exceptions:{exact:{two_factor_required:r.AuthenticationError,param_required:r.ExchangeError,validation_error:r.ExchangeError,invalid_request:r.ExchangeError,personal_details_required:r.AuthenticationError,identity_verification_required:r.AuthenticationError,jumio_verification_required:r.AuthenticationError,jumio_face_match_verification_required:r.AuthenticationError,unverified_email:r.AuthenticationError,authentication_error:r.AuthenticationError,invalid_authentication_method:r.AuthenticationError,invalid_token:r.AuthenticationError,revoked_token:r.AuthenticationError,expired_token:r.AuthenticationError,invalid_scope:r.AuthenticationError,not_found:r.ExchangeError,rate_limit_exceeded:r.RateLimitExceeded,internal_server_error:r.ExchangeError,UNSUPPORTED_ORDER_CONFIGURATION:r.BadRequest,INSUFFICIENT_FUND:r.BadRequest,PERMISSION_DENIED:r.PermissionDenied,INVALID_ARGUMENT:r.BadRequest},broad:{"request timestamp expired":r.InvalidNonce,"order with this orderID was not found":r.OrderNotFound}},timeframes:{"1m":"ONE_MINUTE","5m":"FIVE_MINUTE","15m":"FIFTEEN_MINUTE","30m":"THIRTY_MINUTE","1h":"ONE_HOUR","2h":"TWO_HOUR","6h":"SIX_HOUR","1d":"ONE_DAY"},commonCurrencies:{CGLD:"CELO"},options:{brokerId:"ccxt",stablePairs:["BUSD-USD","CBETH-ETH","DAI-USD","GUSD-USD","GYEN-USD","PAX-USD","PAX-USDT","USDC-EUR","USDC-GBP","USDT-EUR","USDT-GBP","USDT-USD","USDT-USDC","WBTC-BTC"],fetchCurrencies:{expires:5e3},accounts:["wallet","fiat"],v3Accounts:["ACCOUNT_TYPE_CRYPTO","ACCOUNT_TYPE_FIAT"],networks:{ERC20:"ethereum",XLM:"stellar"},createMarketBuyOrderRequiresPrice:!0,advanced:!0,fetchMarkets:"fetchMarketsV3",fetchTicker:"fetchTickerV3",fetchTickers:"fetchTickersV3",fetchAccounts:"fetchAccountsV3",fetchBalance:"v2PrivateGetAccounts",fetchTime:"v2PublicGetTime",user_native_currency:"USD"}})}async fetchTime(e={}){const t=this.safeString(this.options,"fetchTime","v2PublicGetTime"),s=this.safeString(e,"method",t);let i;return e=this.omit(e,"method"),"v2PublicGetTime"===s?(i=await this.v2PublicGetTime(e),i=this.safeDict(i,"data",{})):i=await this.v3PublicGetBrokerageTime(e),this.safeTimestamp2(i,"epoch","epochSeconds")}async fetchAccounts(e={}){return"fetchAccountsV3"===this.safeString(this.options,"fetchAccounts","fetchAccountsV3")?await this.fetchAccountsV3(e):await this.fetchAccountsV2(e)}async fetchAccountsV2(e={}){await this.loadMarkets();let t=!1;if([t,e]=this.handleOptionAndParams(e,"fetchAccounts","paginate"),t)return await this.fetchPaginatedCallCursor("fetchAccounts",void 0,void 0,void 0,e,"next_starting_after","starting_after",void 0,100);const s=await this.v2PrivateGetAccounts(this.extend({limit:100},e)),i=this.safeList(s,"data",[]),r=this.safeDict(s,"pagination",{}),a=this.safeString(r,"next_starting_after"),o=this.safeList(s,"data",[]),n=o.length-1,d=this.safeDict(o,n);return void 0!==a&&""!==a&&(d.next_starting_after=a,o[n]=d),this.parseAccounts(i,e)}async fetchAccountsV3(e={}){await this.loadMarkets();let t=!1;if([t,e]=this.handleOptionAndParams(e,"fetchAccounts","paginate"),t)return await this.fetchPaginatedCallCursor("fetchAccounts",void 0,void 0,void 0,e,"cursor","cursor",void 0,100);const s=await this.v3PrivateGetBrokerageAccounts(this.extend({limit:100},e)),i=this.safeList(s,"accounts",[]),r=i.length-1,a=this.safeDict(i,r),o=this.safeString(s,"cursor");return void 0!==o&&""!==o&&(a.cursor=o,i[r]=a),this.parseAccounts(i,e)}async fetchPortfolios(e={}){const t=await this.v3PrivateGetBrokeragePortfolios(e),s=this.safeList(t,"portfolios",[]),i=[];for(let e=0;ei){const s=[this.v2PublicGetCurrencies(e),this.v2PublicGetCurrenciesCrypto(e)],i=await Promise.all(s),a=this.safeDict(i,0,{}),o=this.safeDict(i,1,{}),n=this.safeList(a,"data",[]),d=this.safeList(o,"data",[]),h=await this.v2PublicGetExchangeRates(e);this.options.fetchCurrencies=this.extend(t,{currencies:this.arrayConcat(n,d),exchangeRates:h,timestamp:r})}return this.safeDict(this.options,"fetchCurrencies",{})}async fetchCurrencies(e={}){const t=await this.fetchCurrenciesFromCache(e),s=this.safeList(t,"currencies",[]),i={},r={},a={};for(let e=0;e3&&(g=e[3])}return{info:e,id:u,timestamp:l,datetime:this.iso8601(l),direction:i,account:g,referenceId:void 0,referenceAccount:void 0,type:p,currency:n,amount:this.parseNumber(r),before:void 0,after:void 0,status:f,fee:d}}async findAccountId(e,t={}){await this.loadMarkets(),await this.loadAccounts(!1,t);for(let t=0;t0&&(i=i.slice(0,e))}const r=this.randomBytes(16),a={aud:["retail_rest_api_proxy"],iss:"coinbase-cloud",nbf:e,exp:e+120,sub:this.apiKey,iat:e};void 0!==i&&(a.uri=i);return(0,d.F)(a,this.encode(this.secret),n.J,!1,{kid:this.apiKey,nonce:r,alg:"ES256"})}sign(e,t=[],s="GET",i={},a=void 0,o=void 0){const d=t[0],h="private"===t[1],c="v3"===d;let l="/"+(c?"api/v3":"v2")+"/"+this.implodeParams(e,i);const u=this.omit(i,this.extractParams(e)),p=l;"GET"===s&&Object.keys(u).length&&(l+="?"+this.urlencodeWithArrayRepeat(u));const f=this.urls.api.rest+l;if(h){const e=this.safeString(this.headers,"Authorization");let t;if(void 0!==e)t=e;else if(this.token&&!this.checkRequiredCredentials(!1))t="Bearer "+this.token;else{this.checkRequiredCredentials();const e=this.seconds();let i="";"GET"!==s?Object.keys(u).length&&(i=o=this.json(u)):c||Object.keys(u).length&&(i+="?"+this.urlencode(u));if(this.apiKey.indexOf("organizations/")>=0||this.secret.startsWith("-----BEGIN")){if(this.apiKey.startsWith("-----BEGIN"))throw new r.ArgumentsRequired(this.id+" apiKey should contain the name (eg: organizations/3b910e93....) and not the public key");t="Bearer "+this.createAuthToken(e,s,f)}else{const e=this.seconds().toString(),t=e+s+p+i,r=this.hmac(this.encode(t),this.encode(this.secret),n.J);a={"CB-ACCESS-KEY":this.apiKey,"CB-ACCESS-SIGN":r,"CB-ACCESS-TIMESTAMP":e,"Content-Type":"application/json"}}}void 0!==t&&(a={Authorization:t,"Content-Type":"application/json"},"GET"!==s&&Object.keys(u).length&&(o=this.json(u)))}return{url:f,method:s,body:o,headers:a}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.id+" "+o;let l=this.safeString(n,"error");if(void 0!==l){const e=this.safeString(n,"error_description");throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,e,c),new r.ExchangeError(c)}const u=this.safeList(n,"errors");if(void 0!==u&&Array.isArray(u)){if(u.length>0){l=this.safeString(u[0],"id");const e=this.safeString(u[0],"message");if(void 0!==l)throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,e,c),new r.ExchangeError(c)}}const p=this.options.advanced;if(!("data"in n)&&!p)throw new r.ExchangeError(this.id+" failed due to a malformed response "+this.json(n))}}},9339:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(931),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinbaseinternational",name:"Coinbase International",countries:["US"],certified:!0,pro:!0,rateLimit:100,version:"v1",userAgent:this.userAgents.chrome,headers:{"CB-VERSION":"2018-05-30"},has:{CORS:!0,spot:!0,margin:!0,swap:!0,future:!0,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrder:!0,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL2OrderBook:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyBuys:!0,fetchMySells:!0,fetchMyTrades:!0,fetchOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!1,fetchOrders:!1,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!1,fetchTradingFee:!1,fetchTradingFees:!1,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMargin:!0,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625",api:{rest:"https://api.international.coinbase.com/api"},test:{rest:"https://api-n5e1.coinbase.com/api"},www:"https://international.coinbase.com",doc:["https://docs.cloud.coinbase.com/intx/docs"],fees:["https://help.coinbase.com/en/international-exchange/trading-deposits-withdrawals/international-exchange-fees"],referral:""},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{v1:{public:{get:["assets","assets/{assets}","assets/{asset}/networks","instruments","instruments/{instrument}","instruments/{instrument}/quote","instruments/{instrument}/funding",""]},private:{get:["orders","orders/{id}","portfolios","portfolios/{portfolio}","portfolios/{portfolio}/detail","portfolios/{portfolio}/summary","portfolios/{portfolio}/balances","portfolios/{portfolio}/balances/{asset}","portfolios/{portfolio}/positions","portfolios/{portfolio}/positions/{instrument}","portfolios/fills","portfolios/{portfolio}/fills","transfers","transfers/{transfer_uuid}"],post:["orders","portfolios","portfolios/margin","portfolios/transfer","transfers/withdraw","transfers/address","transfers/create-counterparty-id","transfers/validate-counterparty-id","transfers/withdraw/counterparty"],put:["orders/{id}","portfolios/{portfolio}"],delete:["orders","orders/{id}"]}}},fees:{trading:{taker:this.parseNumber("0.004"),maker:this.parseNumber("0.002"),tierBased:!0,percentage:!0,tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("1000000"),this.parseNumber("0.004")],[this.parseNumber("5000000"),this.parseNumber("0.0035")],[this.parseNumber("10000000"),this.parseNumber("0.0035")],[this.parseNumber("50000000"),this.parseNumber("0.003")],[this.parseNumber("250000000"),this.parseNumber("0.0025")]],maker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("1000000"),this.parseNumber("0.0016")],[this.parseNumber("5000000"),this.parseNumber("0.001")],[this.parseNumber("10000000"),this.parseNumber("0.0008")],[this.parseNumber("50000000"),this.parseNumber("0.0005")],[this.parseNumber("250000000"),this.parseNumber("0")]]}}},precisionMode:o.sh,exceptions:{exact:{},broad:{DUPLICATE_CLIENT_ORDER_ID:r.DuplicateOrderId,"Order rejected":r.InvalidOrder,"market orders must be IoC":r.InvalidOrder,"tif is required":r.InvalidOrder,"Invalid replace order request":r.InvalidOrder,Unauthorized:r.PermissionDenied,"invalid result_limit":r.BadRequest,"is a required field":r.BadRequest,"Not Found":r.BadRequest,"ip not allowed":r.AuthenticationError}},timeframes:{"1m":"ONE_MINUTE","5m":"FIVE_MINUTE","15m":"FIFTEEN_MINUTE","30m":"THIRTY_MINUTE","1h":"ONE_HOUR","2h":"TWO_HOUR","6h":"SIX_HOUR","1d":"ONE_DAY"},options:{brokerId:"nfqkvdjp",portfolio:"",withdraw:{method:"v1PrivatePostTransfersWithdraw"},networksById:{ethereum:"ETH",arbitrum:"ARBITRUM",avacchain:"AVAX",optimism:"OPTIMISM",polygon:"MATIC",solana:"SOL",bitcoin:"BTC"}}})}async handlePortfolioAndParams(e,t={}){let s;if([s,t]=this.handleOptionAndParams(t,e,"portfolio"),void 0!==s&&""!==s)return[s,t];const i=this.safeString(this.options,"portfolio");if(void 0!==i&&""!==i)return[i,t];const a=await this.fetchAccounts();for(let e=0;e100)throw new r.BadRequest(this.id+" fetchOpenOrders() maximum limit is 100");c.result_limit=s}void 0!==t&&(c.ref_datetime=this.iso8601(t));const u=await this.v1PrivateGetOrders(this.extend(c,i)),p=this.safeList(u,"results",[]);return this.parseOrders(p,l,t,s)}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let a=!1;[a,i]=this.handleOptionAndParams(i,"fetchMyTrades","paginate");const o="ccxtPageKey";let n,d;if([n,i]=this.handleOptionAndParams(i,"fetchMyTrades","maxEntriesPerRequest",100),a)return await this.fetchPaginatedCallIncremental("fetchMyTrades",e,t,s,i,o,n);void 0!==e&&(d=this.market(e));const h=this.safeInteger(i,o,1)-1,c={result_offset:this.safeInteger2(i,"offset","result_offset",h*n)};if(void 0!==s){if(s>100)throw new r.BadRequest(this.id+" fetchMyTrades() maximum limit is 100. Consider setting paginate to true to fetch more trades.");c.result_limit=s}void 0!==t&&(c.time_from=this.iso8601(t));const l=this.safeStringN(i,["until"]);void 0!==l&&(i=this.omit(i,["until"]),c.ref_datetime=this.iso8601(l));const u=await this.v1PrivateGetPortfoliosFills(this.extend(c,i)),p=this.safeList(u,"results",[]);return this.parseTrades(p,d,t,s)}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),this.checkAddress(s),await this.loadMarkets();const a=this.currency(e);let o,n,d;[o,r]=await this.handlePortfolioAndParams("withdraw",r),[n,r]=this.handleOptionAndParams(r,"withdraw","method","v1PrivatePostTransfersWithdraw"),[d,r]=await this.handleNetworkIdAndParams(e,"withdraw",r);const h={portfolio:o,type:"send",asset:a.id,address:s,amount:t,currency:a.id,network_arn_id:d,nonce:this.nonce()},c=await this[n](this.extend(h,r));return this.parseTransaction(c,a)}safeNetwork(e){let t=this.safeBool(e,"withdraw"),s=this.safeBool(e,"deposit");const i=this.safeDict(e,"limits"),r=this.safeDict(i,"withdraw"),a=this.safeNumber(r,"max"),o=this.safeDict(i,"deposit"),n=this.safeNumber(o,"max");void 0===t&&void 0!==a&&(t=a>0),void 0===s&&void 0!==n&&(s=n>0);const d=this.safeString(e,"id"),h=t&&s;return{info:e.info,id:d,name:this.safeString(e,"name"),network:this.safeString(e,"network"),active:this.safeBool(e,"active",h),deposit:s,withdraw:t,fee:this.safeNumber(e,"fee"),precision:this.safeNumber(e,"precision"),limits:{withdraw:{min:this.safeNumber(r,"min"),max:a},deposit:{min:this.safeNumber(o,"min"),max:n}}}}sign(e,t=[],s="GET",i={},r=void 0,a=void 0){const o=t[0],d="private"===t[1];let h="/"+o+"/"+this.implodeParams(e,i);const c=this.omit(i,this.extractParams(e)),l="/api"+h;"GET"!==s&&"DELETE"!==s||Object.keys(c).length&&(h+="?"+this.urlencodeWithArrayRepeat(c));const u=this.urls.api.rest+h;if(d){this.checkRequiredCredentials();const e=this.nonce().toString();let t="";"GET"!==s&&Object.keys(c).length&&(t=a=this.json(c));const i=e+s+l+t;r={"CB-ACCESS-TIMESTAMP":e,"CB-ACCESS-SIGN":this.hmac(this.encode(i),this.base64ToBinary(this.secret),n.J,"base64"),"CB-ACCESS-PASSPHRASE":this.password,"CB-ACCESS-KEY":this.apiKey}}return{url:u,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0===n)return;const c=this.id+" "+o,l=this.safeString(n,"title");if(void 0!==l)throw this.throwExactlyMatchedException(this.exceptions.exact,l,c),this.throwBroadlyMatchedException(this.exceptions.broad,l,c),new r.ExchangeError(c)}}},8856:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(2925),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinbasepro",name:"Coinbase Pro(Deprecated)",countries:["US"],rateLimit:100,userAgent:this.userAgents.chrome,pro:!0,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,createDepositAddress:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingRate:!1,fetchLedger:!0,fetchMarginMode:!1,fetchMarkets:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:"emulated",fetchWithdrawals:!0,withdraw:!0},timeframes:{"1m":60,"5m":300,"15m":900,"1h":3600,"6h":21600,"1d":86400},hostname:"pro.coinbase.com",urls:{test:{public:"https://api-public.sandbox.pro.coinbase.com",private:"https://api-public.sandbox.pro.coinbase.com"},logo:"https://user-images.githubusercontent.com/1294454/41764625-63b7ffde-760a-11e8-996d-a6328fa9347a.jpg",api:{public:"https://api.{hostname}",private:"https://api.{hostname}"},www:"https://pro.coinbase.com/",doc:"https://docs.pro.coinbase.com",fees:["https://docs.pro.coinbase.com/#fees","https://support.pro.coinbase.com/customer/en/portal/articles/2945310-fees"]},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{public:{get:["currencies","products","products/{id}","products/{id}/book","products/{id}/candles","products/{id}/stats","products/{id}/ticker","products/{id}/trades","time","products/spark-lines"]},private:{get:["address-book","accounts","accounts/{id}","accounts/{id}/holds","accounts/{id}/ledger","accounts/{id}/transfers","coinbase-accounts","fills","funding","fees","margin/profile_information","margin/buying_power","margin/withdrawal_power","margin/withdrawal_power_all","margin/exit_plan","margin/liquidation_history","margin/position_refresh_amounts","margin/status","oracle","orders","orders/{id}","orders/client:{client_oid}","otc/orders","payment-methods","position","profiles","profiles/{id}","reports/{report_id}","transfers","transfers/{transfer_id}","users/self/exchange-limits","users/self/hold-balances","users/self/trailing-volume","withdrawals/fee-estimate","conversions/{conversion_id}","conversions/fees"],post:["conversions","deposits/coinbase-account","deposits/payment-method","coinbase-accounts/{id}/addresses","funding/repay","orders","position/close","profiles/margin-transfer","profiles/transfer","reports","withdrawals/coinbase","withdrawals/coinbase-account","withdrawals/crypto","withdrawals/payment-method"],delete:["orders","orders/client:{client_oid}","orders/{id}"]}},commonCurrencies:{CGLD:"CELO"},precisionMode:o.sh,fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.004"),taker:this.parseNumber("0.006")},funding:{tierBased:!1,percentage:!1,withdraw:{BCH:0,BTC:0,LTC:0,ETH:0,EUR:.15,USD:25},deposit:{BCH:0,BTC:0,LTC:0,ETH:0,EUR:.15,USD:10}}},exceptions:{exact:{"Insufficient funds":r.InsufficientFunds,NotFound:r.OrderNotFound,"Invalid API Key":r.AuthenticationError,"invalid signature":r.AuthenticationError,"Invalid Passphrase":r.AuthenticationError,"Invalid order id":r.InvalidOrder,"Private rate limit exceeded":r.RateLimitExceeded,"Trading pair not available":r.PermissionDenied,"Product not found":r.InvalidOrder},broad:{"Order already done":r.OrderNotFound,"order not found":r.OrderNotFound,"price too small":r.InvalidOrder,"price too precise":r.InvalidOrder,"under maintenance":r.OnMaintenance,"size is too small":r.InvalidOrder,"Cancel only mode":r.OnMaintenance}}})}async fetchCurrencies(e={}){const t=await this.publicGetCurrencies(e),s={};for(let e=0;e{s.d(t,{Z:()=>n});var i=s(7089),r=s(6689),a=s(9292),o=s(1372);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coincheck",name:"coincheck",countries:["JP","ID"],rateLimit:1500,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg",api:{rest:"https://coincheck.com/api"},www:"https://coincheck.com",doc:"https://coincheck.com/documents/exchange/api",fees:["https://coincheck.com/exchange/fee","https://coincheck.com/info/fee"]},api:{public:{get:["exchange/orders/rate","order_books","rate/{pair}","ticker","trades"]},private:{get:["accounts","accounts/balance","accounts/leverage_balance","bank_accounts","deposit_money","exchange/orders/opens","exchange/orders/transactions","exchange/orders/transactions_pagination","exchange/leverage/positions","lending/borrows/matches","send_money","withdraws"],post:["bank_accounts","deposit_money/{id}/fast","exchange/orders","exchange/transfers/to_leverage","exchange/transfers/from_leverage","lending/borrows","lending/borrows/{id}/repay","send_money","withdraws"],delete:["bank_accounts/{id}","exchange/orders/{id}","withdraws/{id}"]}},markets:{"BTC/JPY":this.safeMarketStructure({id:"btc_jpy",symbol:"BTC/JPY",base:"BTC",quote:"JPY",baseId:"btc",quoteId:"jpy",type:"spot",spot:!0}),"ETC/JPY":this.safeMarketStructure({id:"etc_jpy",symbol:"ETC/JPY",base:"ETC",quote:"JPY",baseId:"etc",quoteId:"jpy",type:"spot",spot:!0}),"FCT/JPY":this.safeMarketStructure({id:"fct_jpy",symbol:"FCT/JPY",base:"FCT",quote:"JPY",baseId:"fct",quoteId:"jpy",type:"spot",spot:!0}),"MONA/JPY":this.safeMarketStructure({id:"mona_jpy",symbol:"MONA/JPY",base:"MONA",quote:"JPY",baseId:"mona",quoteId:"jpy",type:"spot",spot:!0}),"ETC/BTC":this.safeMarketStructure({id:"etc_btc",symbol:"ETC/BTC",base:"ETC",quote:"BTC",baseId:"etc",quoteId:"btc",type:"spot",spot:!0})},fees:{trading:{tierBased:!1,percentage:!0,maker:this.parseNumber("0"),taker:this.parseNumber("0")}},precisionMode:a.sh,exceptions:{exact:{"disabled API Key":r.AuthenticationError,"invalid authentication":r.AuthenticationError},broad:{}}})}parseBalance(e){const t={info:e},s=Object.keys(this.currencies);for(let i=0;i{s.d(t,{Z:()=>h});var i=s(8519),r=s(6689),a=s(2194),o=s(9292),n=s(1372),d=s(7311);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinex",name:"CoinEx",version:"v1",countries:["CN"],rateLimit:2.5,pro:!0,certified:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,borrowCrossMargin:!1,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,createDepositAddress:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!0,createStopLossOrder:!0,createTakeProfitOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddressByNetwork:!1,fetchDepositAddresses:!1,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!0,fetchIsolatedBorrowRates:!0,fetchLeverage:"emulated",fetchLeverages:!0,fetchLeverageTiers:!0,fetchMarginAdjustmentHistory:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!0,fetchPositionHistory:!0,fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransfer:!1,fetchTransfers:!0,fetchWithdrawal:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!1,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!0,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1min","3m":"3min","5m":"5min","15m":"15min","30m":"30min","1h":"1hour","2h":"2hour","4h":"4hour","6h":"6hour","12h":"12hour","1d":"1day","3d":"3day","1w":"1week"},urls:{logo:"https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg",api:{public:"https://api.coinex.com",private:"https://api.coinex.com",perpetualPublic:"https://api.coinex.com/perpetual",perpetualPrivate:"https://api.coinex.com/perpetual"},www:"https://www.coinex.com",doc:"https://docs.coinex.com/api/v2",fees:"https://www.coinex.com/fees",referral:"https://www.coinex.com/register?refer_code=yw5fz"},api:{v1:{public:{get:{"amm/market":1,"common/currency/rate":1,"common/asset/config":1,"common/maintain/info":1,"common/temp-maintain/info":1,"margin/market":1,"market/info":1,"market/list":1,"market/ticker":1,"market/ticker/all":1,"market/depth":1,"market/deals":1,"market/kline":1,"market/detail":1}},private:{get:{"account/amm/balance":40,"account/investment/balance":40,"account/balance/history":40,"account/market/fee":40,"balance/coin/deposit":40,"balance/coin/withdraw":40,"balance/info":40,"balance/deposit/address/{coin_type}":40,"contract/transfer/history":40,"credit/info":40,"credit/balance":40,"investment/transfer/history":40,"margin/account":1,"margin/config":1,"margin/loan/history":40,"margin/transfer/history":40,"order/deals":40,"order/finished":40,"order/pending":8,"order/status":8,"order/status/batch":8,"order/user/deals":40,"order/stop/finished":40,"order/stop/pending":8,"order/user/trade/fee":1,"order/market/trade/info":1,"sub_account/balance":1,"sub_account/transfer/history":40,"sub_account/auth/api":40,"sub_account/auth/api/{user_auth_id}":40},post:{"balance/coin/withdraw":40,"contract/balance/transfer":40,"margin/flat":40,"margin/loan":40,"margin/transfer":40,"order/limit/batch":40,"order/ioc":13.334,"order/limit":13.334,"order/market":13.334,"order/modify":13.334,"order/stop/limit":13.334,"order/stop/market":13.334,"order/stop/modify":13.334,"sub_account/transfer":40,"sub_account/register":1,"sub_account/unfrozen":40,"sub_account/frozen":40,"sub_account/auth/api":40},put:{"balance/deposit/address/{coin_type}":40,"sub_account/unfrozen":40,"sub_account/frozen":40,"sub_account/auth/api/{user_auth_id}":40,"v1/account/settings":40},delete:{"balance/coin/withdraw":40,"order/pending/batch":40,"order/pending":13.334,"order/stop/pending":40,"order/stop/pending/{id}":13.334,"order/pending/by_client_id":40,"order/stop/pending/by_client_id":40,"sub_account/auth/api/{user_auth_id}":40,"sub_account/authorize/{id}":40}},perpetualPublic:{get:{ping:1,time:1,"market/list":1,"market/limit_config":1,"market/ticker":1,"market/ticker/all":1,"market/depth":1,"market/deals":1,"market/funding_history":1,"market/kline":1}},perpetualPrivate:{get:{"market/user_deals":1,"asset/query":40,"order/pending":8,"order/finished":40,"order/stop_finished":40,"order/stop_pending":8,"order/status":8,"order/stop_status":8,"position/finished":40,"position/pending":40,"position/funding":40,"position/adl_history":40,"market/preference":40,"position/margin_history":40,"position/settle_history":40},post:{"market/adjust_leverage":1,"market/position_expect":1,"order/put_limit":20,"order/put_market":20,"order/put_stop_limit":20,"order/put_stop_market":20,"order/modify":20,"order/modify_stop":20,"order/cancel":20,"order/cancel_all":40,"order/cancel_batch":40,"order/cancel_stop":20,"order/cancel_stop_all":40,"order/close_limit":20,"order/close_market":20,"position/adjust_margin":20,"position/stop_loss":20,"position/take_profit":20,"position/market_close":20,"order/cancel/by_client_id":20,"order/cancel_stop/by_client_id":20,"market/preference":20}}},v2:{public:{get:{"maintain-info":1,ping:1,time:1,"spot/market":1,"spot/ticker":1,"spot/depth":1,"spot/deals":1,"spot/kline":1,"spot/index":1,"futures/market":1,"futures/ticker":1,"futures/depth":1,"futures/deals":1,"futures/kline":1,"futures/index":1,"futures/funding-rate":1,"futures/funding-rate-history":1,"futures/position-level":1,"futures/liquidation-history":1,"futures/basis-history":1}},private:{get:{"account/subs":1,"account/subs/api-detail":40,"account/subs/info":1,"account/subs/api":40,"account/subs/transfer-history":40,"account/subs/spot-balance":1,"account/trade-fee-rate":40,"assets/spot/balance":40,"assets/futures/balance":40,"assets/margin/balance":1,"assets/financial/balance":40,"assets/amm/liquidity":40,"assets/credit/info":40,"assets/margin/borrow-history":40,"assets/margin/interest-limit":1,"assets/deposit-address":40,"assets/deposit-history":40,"assets/withdraw":40,"assets/deposit-withdraw-config":1,"assets/transfer-history":40,"spot/order-status":8,"spot/batch-order-status":8,"spot/pending-order":8,"spot/finished-order":40,"spot/pending-stop-order":8,"spot/finished-stop-order":40,"spot/user-deals":40,"spot/order-deals":40,"futures/order-status":8,"futures/batch-order-status":1,"futures/pending-order":8,"futures/finished-order":40,"futures/pending-stop-order":8,"futures/finished-stop-order":40,"futures/user-deals":1,"futures/order-deals":1,"futures/pending-position":40,"futures/finished-position":1,"futures/position-margin-history":1,"futures/position-funding-history":40,"futures/position-adl-history":1,"futures/position-settle-history":1},post:{"account/subs":40,"account/subs/frozen":40,"account/subs/unfrozen":40,"account/subs/api":40,"account/subs/edit-api":40,"account/subs/delete-api":40,"account/subs/transfer":40,"account/settings":40,"assets/margin/borrow":40,"assets/margin/repay":40,"assets/renewal-deposit-address":40,"assets/withdraw":40,"assets/cancel-withdraw":40,"assets/transfer":40,"assets/amm/add-liquidity":1,"assets/amm/remove-liquidity":1,"spot/order":13.334,"spot/stop-order":13.334,"spot/batch-order":40,"spot/batch-stop-order":1,"spot/modify-order":13.334,"spot/modify-stop-order":13.334,"spot/cancel-all-order":1,"spot/cancel-order":6.667,"spot/cancel-stop-order":6.667,"spot/cancel-batch-order":10,"spot/cancel-batch-stop-order":10,"spot/cancel-order-by-client-id":1,"spot/cancel-stop-order-by-client-id":1,"futures/order":20,"futures/stop-order":20,"futures/batch-order":1,"futures/batch-stop-order":1,"futures/modify-order":20,"futures/modify-stop-order":20,"futures/cancel-all-order":1,"futures/cancel-order":10,"futures/cancel-stop-order":10,"futures/cancel-batch-order":20,"futures/cancel-batch-stop-order":20,"futures/cancel-order-by-client-id":1,"futures/cancel-stop-order-by-client-id":1,"futures/close-position":20,"futures/adjust-position-margin":20,"futures/adjust-position-leverage":20,"futures/set-position-stop-loss":20,"futures/set-position-take-profit":20}}}},fees:{trading:{maker:.001,taker:.001},funding:{withdraw:{BCH:0,BTC:.001,LTC:.001,ETH:.001,ZEC:1e-4,DASH:1e-4}}},limits:{amount:{min:.001,max:void 0}},options:{brokerId:"x-167673045",createMarketBuyOrderRequiresPrice:!0,defaultType:"spot",defaultSubType:"linear",fetchDepositAddress:{fillResponseFromRequest:!0},accountsById:{spot:"0"},networks:{BEP20:"BSC",TRX:"TRC20",ETH:"ERC20"}},commonCurrencies:{ACM:"Actinium"},precisionMode:o.sh,exceptions:{exact:{23:r.PermissionDenied,24:r.AuthenticationError,25:r.AuthenticationError,34:r.AuthenticationError,35:r.ExchangeNotAvailable,36:r.RequestTimeout,213:r.RateLimitExceeded,107:r.InsufficientFunds,600:r.OrderNotFound,601:r.InvalidOrder,602:r.InvalidOrder,606:r.InvalidOrder},broad:{"ip not allow visit":r.PermissionDenied,"service too busy":r.ExchangeNotAvailable}}})}async fetchCurrencies(e={}){const t=await this.v1PublicGetCommonAssetConfig(e),s=this.safeValue(t,"data",[]),i=Object.keys(s),r={};for(let e=0;e1){if(void 0===o)throw new r.ArgumentsRequired(this.id+" fetchDepositAddress() "+e+" requires a network parameter");if(!(o in a))throw new r.ExchangeError(this.id+" fetchDepositAddress() "+o+" network not supported for "+e)}void 0!==o&&(i.smart_contract_name=o);const d=await this.v1PrivateGetBalanceDepositAddressCoinType(this.extend(i,t)),h=this.safeValue(d,"data",{}),c=this.parseDepositAddress(h,s),l=this.safeValue(this.options,"fetchDepositAddress",{});return this.safeBool(l,"fillResponseFromRequest",!0)&&(c.network=this.safeNetworkCode(o,s)),c}safeNetwork(e,t=void 0){const s=this.safeValue(t,"networks",{}),i=Object.keys(s),r=i.length;return void 0===e&&1===r?s[i[0]]:{id:e,network:void 0===e?void 0:e.toUpperCase()}}safeNetworkCode(e,t=void 0){return this.safeNetwork(e,t).network}parseDepositAddress(e,t=void 0){const s=this.safeString(e,"coin_address"),i=s.split(":");let r,a;return i.length>1&&"cfx"!==i[0]?(r=i[0],a=i[1]):r=s,{info:e,currency:this.safeCurrencyCode(void 0,t),address:r,tag:a,network:void 0}}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){let a;await this.loadMarkets(),void 0===s&&(s=100);const o={limit:s,offset:0};let n;if(void 0!==e&&(a=this.market(e),o.market=a.id),[n,i]=this.handleMarketTypeAndParams("fetchMyTrades",a,i),"spot"!==n&&void 0===e)throw new r.ArgumentsRequired(this.id+" fetchMyTrades() requires a symbol argument for non-spot markets");const d="swap"===n,h=this.safeInteger(i,"account_id");let c,l;if([c,i]=this.handleMarginModeAndParams("fetchMyTrades",i),void 0!==c){if(void 0===h)throw new r.BadRequest(this.id+" fetchMyTrades() requires an account_id parameter for margin trades");o.account_id=h,i=this.omit(i,"account_id")}d?(void 0!==t&&(o.start_time=t),o.side=0,l=await this.v1PerpetualPrivateGetMarketUserDeals(this.extend(o,i))):(o.page=1,l=await this.v1PrivateGetOrderUserDeals(this.extend(o,i)));const u=d?"records":"data",p=this.safeValue(l,"data"),f=this.safeList(p,u,[]);return this.parseTrades(f,a,t,s)}async fetchPositions(e=void 0,t={}){let s;await this.loadMarkets(),[s,t]=this.handleOptionAndParams(t,"fetchPositions","method","v1PerpetualPrivateGetPositionPending");const i="v1PerpetualPrivateGetPositionFinished"===s,a={};let o,n;if(void 0!==(e=this.marketSymbols(e))){let t;if(Array.isArray(e)){if(e.length>1)throw new r.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;o=this.market(t),a.market=o.id}else if(i)throw new r.ArgumentsRequired(this.id+" fetchPositions() requires a symbol argument for closed positions");i&&(a.limit=100,a.side=this.safeInteger(t,"side",0)),n="v1PerpetualPrivateGetPositionPending"===s?await this.v1PerpetualPrivateGetPositionPending(this.extend(a,t)):await this.v1PerpetualPrivateGetPositionFinished(this.extend(a,t));const d=this.safeValue(n,"data",[]),h=[];for(let e=0;en)throw new r.BadRequest(this.id+" setMarginMode() leverage should be between 3 and "+n.toString()+" for "+t);const h={market:i.id,leverage:o.toString(),position_type:d};return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(h,s))}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");await this.loadMarkets();const i=this.market(t);if(!i.swap)throw new r.BadSymbol(this.id+" setLeverage() supports swap contracts only");let a,o;[a,s]=this.handleMarginModeAndParams("setLeverage",s,"cross"),"isolated"===a?o=1:"cross"===a&&(o=2);const n=this.safeInteger(i.limits.leverage,"min",1),d=this.safeInteger(i.limits.leverage,"max",100);if(ed)throw new r.BadRequest(this.id+" setLeverage() leverage should be between "+n.toString()+" and "+d.toString()+" for "+t);const h={market:i.id,leverage:e.toString(),position_type:o};return await this.v1PerpetualPrivatePostMarketAdjustLeverage(this.extend(h,s))}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const s=await this.v1PerpetualPublicGetMarketLimitConfig(t),i=this.safeValue(s,"data",{});return this.parseLeverageTiers(i,e,void 0)}parseMarketLeverageTiers(e,t=void 0){const s=[];let i=0;for(let r=0;r{s.d(t,{Z:()=>d});var i=s(3378),r=s(6689),a=s(9292),o=s(2194),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinlist",name:"Coinlist",countries:["US"],version:"v1",rateLimit:300,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,deposit:!1,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!0,fetchTransfers:!0,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!0,ws:!1},timeframes:{"1m":"1m","5m":"5m","30m":"30m"},urls:{logo:"https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg",api:{public:"https://trade-api.coinlist.co",private:"https://trade-api.coinlist.co"},www:"https://coinlist.co",doc:["https://trade-docs.coinlist.co"],fees:"https://coinlist.co/fees"},api:{public:{get:{"v1/symbols":1,"v1/symbols/summary":1,"v1/symbols/{symbol}":1,"v1/symbols/{symbol}/summary":1,"v1/symbols/{symbol}/book":1,"v1/symbols/{symbol}/quote":1,"v1/symbols/{symbol}/candles":1,"v1/symbols/{symbol}/auctions":1,"v1/symbols/{symbol}/auctions/{auction_code}":1,"v1/time":1,"v1/assets":1,"v1/leaderboard":1,"v1/affiliate/{competition_code}":1,"v1/competition/{competition_id}":1}},private:{get:{"v1/fees":1,"v1/accounts":1,"v1/accounts/{trader_id}":1,"v1/accounts/{trader_id}/alias":1,"v1/accounts/{trader_id}/ledger":1,"v1/accounts/{trader_id}/wallets":1,"v1/accounts/{trader_id}/wallet-ledger":1,"v1/accounts/{trader_id}/ledger-summary":1,"v1/keys":1,"v1/fills":1,"v1/orders":1,"v1/orders/{order_id}":1,"v1/reports":1,"v1/balances":1,"v1/transfers":1,"v1/user":1,"v1/credits":1,"v1/positions":1,"v1/accounts/{trader_id}/competitions":1},post:{"v1/keys":1,"v1/orders":1,"v1/orders/cancel-all-after":1,"v1/reports":1,"v1/transfers/to-wallet":1,"v1/transfers/from-wallet":1,"v1/transfers/internal-transfer":1,"v1/transfers/withdrawal-request":1,"v1/orders/bulk":1,"v1/accounts/{trader_id}/competitions":1,"v1/accounts/{trader_id}/create-competition":1},patch:{"v1/orders/{order_id}":1,"v1/orders/bulk":1},delete:{"v1/keys/{key}":1,"v1/orders":1,"v1/orders/{order_id}":1,"v1/orders/bulk":1}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,taker:this.parseNumber("0.0045"),maker:this.parseNumber("0.0025"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0045")],[this.parseNumber("20000"),this.parseNumber("0.003")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("750000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0016")],[this.parseNumber("2500000"),this.parseNumber("0.0013")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("10000000"),this.parseNumber("0.001")],[this.parseNumber("50000000"),this.parseNumber("0.0005")],[this.parseNumber("100000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("20000"),this.parseNumber("0.0025")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.002")],[this.parseNumber("500000"),this.parseNumber("0.0015")],[this.parseNumber("750000"),this.parseNumber("0.0012")],[this.parseNumber("1000000"),this.parseNumber("0.001")],[this.parseNumber("2500000"),this.parseNumber("0.0008")],[this.parseNumber("5000000"),this.parseNumber("0.0007")],[this.parseNumber("10000000"),this.parseNumber("0.0006")],[this.parseNumber("50000000"),this.parseNumber("0.0000")],[this.parseNumber("100000000"),this.parseNumber("0.00")]]}}},precisionMode:a.sh,options:{accountsByType:{"CoinList Pro":"trading","CoinList Pro trading account":"trading",Pro:"trading",pro:"trading",trade:"trading",trading:"trading",CoinList:"funding","CoinList wallet":"funding",Wallet:"funding",wallet:"funding",fund:"funding",funding:"funding"}},exceptions:{exact:{AUTH_SIG_INVALID:r.AuthenticationError,DENIED_MAINTENANCE:r.OnMaintenance,ORDER_REJECT_BAD_STATUS:r.InvalidOrder,ORDER_REJECT_INVALID_POST_ONLY:r.InvalidOrder,ORDER_REJECT_INVALID_CLOSE_ONLY:r.InvalidOrder,ORDER_REJECT_POST_ONLY_REQUIRED:r.InvalidOrder,ORDER_REJECT_FROZEN_ORDER:r.InvalidOrder,ORDER_REJECT_LIMIT_PRICE_PROTECTION_VIOLATION:r.InvalidOrder,ORDER_REJECT_CLOSED:r.NotSupported,ORDER_REJECT_MAX_ORDERS:r.BadRequest,ORDER_REJECT_NOT_FOUND:r.OrderNotFound,ORDER_REJECT_PARSE_ERROR:r.BadRequest,ORDER_REJECT_PRICE_INVALID:r.InvalidOrder,ORDER_REJECT_QUANTITY_ZERO:r.InvalidOrder,ORDER_REJECT_TOKEN_LIMIT:r.InsufficientFunds,ORDER_REJECT_TOKEN_LIMIT_OTHER:r.InvalidOrder,ORDER_REJECT_SELF_TRADE:r.InvalidOrder,ORDER_VALIDATE_BAD_SIZE_ALIGNMENT:r.InvalidOrder,ORDER_VALIDATE_BAD_TICK_ALIGNMENT:r.InvalidOrder,ORDER_VALIDATE_SYMBOL_NOT_FOUND:r.BadSymbol,TRANSFERS_WITHDRAWAL_REQUEST_TOO_LARGE:r.InsufficientFunds,WITHDRAWAL_REQUEST_NOT_ALLOWED:r.PermissionDenied},broad:{"A destinationAddress is required for non-USD withdrawals":r.InvalidAddress,"fails to match the JsonSchema date-time format pattern":r.BadRequest,"is required":r.ArgumentsRequired,"must be a string":r.BadRequest,"must be a valid GUID":r.BadRequest,"must be greater than or equal to":r.BadRequest,"must be less than or equal to":r.BadRequest,"must be one of":r.BadRequest,"Symbol not found":r.BadSymbol}}})}calculateRateLimiterCost(e,t,s,i,r={}){if(Array.isArray(i)){const e=i.length;return Math.ceil(e/2)}return 1}async fetchTime(e={}){const t=await this.publicGetV1Time(e),s=this.safeString(t,"iso");return this.parse8601(s)}async fetchCurrencies(e={}){const t=await this.publicGetV1Assets(e),s=this.safeValue(t,"assets",[]),i={};for(let e=0;e0){for(let t=0;t0)for(let e=0;e=0&&"GET"===i){const e=s.split("/orders/"),t=this.safeString(e,1);throw new r.OrderNotFound(this.id+" order "+t+" not found (or rejected on the exchange side)")}return}const c=this.safeString(n,"status"),l=this.safeString(n,"message_code");if(void 0!==l||void 0!==c&&200!==e&&202!==e&&"200"!==c&&"202"!==c){const e=this.id+" "+o,t=this.safeString(n,"message");throw this.throwBroadlyMatchedException(this.exceptions.broad,t,e),this.throwExactlyMatchedException(this.exceptions.exact,l,e),new r.ExchangeError(e)}}}},9816:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(7044),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinmate",name:"CoinMate",countries:["GB","CZ","EU"],rateLimit:1e3,has:{CORS:!0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactions:"emulated",reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg",api:{rest:"https://coinmate.io/api"},www:"https://coinmate.io",fees:"https://coinmate.io/fees",doc:["https://coinmate.docs.apiary.io","https://coinmate.io/developers"],referral:"https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0"},requiredCredentials:{apiKey:!0,secret:!0,uid:!0},api:{public:{get:["orderBook","ticker","tickerAll","products","transactions","tradingPairs"]},private:{post:["balances","bitcoinCashWithdrawal","bitcoinCashDepositAddresses","bitcoinDepositAddresses","bitcoinWithdrawal","bitcoinWithdrawalFees","buyInstant","buyLimit","cancelOrder","cancelOrderWithInfo","createVoucher","dashDepositAddresses","dashWithdrawal","ethereumWithdrawal","ethereumDepositAddresses","litecoinWithdrawal","litecoinDepositAddresses","openOrders","order","orderHistory","orderById","pusherAuth","redeemVoucher","replaceByBuyLimit","replaceByBuyInstant","replaceBySellLimit","replaceBySellInstant","rippleDepositAddresses","rippleWithdrawal","sellInstant","sellLimit","transactionHistory","traderFees","tradeHistory","transfer","transferHistory","unconfirmedBitcoinDeposits","unconfirmedBitcoinCashDeposits","unconfirmedDashDeposits","unconfirmedEthereumDeposits","unconfirmedLitecoinDeposits","unconfirmedRippleDeposits","cancelAllOpenOrders","withdrawVirtualCurrency","virtualCurrencyDepositAddresses","unconfirmedVirtualCurrencyDeposits","adaWithdrawal","adaDepositAddresses","unconfirmedAdaDeposits","solWithdrawal","solDepositAddresses","unconfirmedSolDeposits"]}},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.0012"),taker:this.parseNumber("0.0025"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0035")],[this.parseNumber("10000"),this.parseNumber("0.0023")],[this.parseNumber("100000"),this.parseNumber("0.0021")],[this.parseNumber("250000"),this.parseNumber("0.0020")],[this.parseNumber("500000"),this.parseNumber("0.0015")],[this.parseNumber("1000000"),this.parseNumber("0.0013")],[this.parseNumber("3000000"),this.parseNumber("0.0010")],[this.parseNumber("15000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.003")],[this.parseNumber("10000"),this.parseNumber("0.0011")],[this.parseNumber("100000"),this.parseNumber("0.0010")],[this.parseNumber("250000"),this.parseNumber("0.0008")],[this.parseNumber("500000"),this.parseNumber("0.0005")],[this.parseNumber("1000000"),this.parseNumber("0.0003")],[this.parseNumber("3000000"),this.parseNumber("0.0002")],[this.parseNumber("15000000"),this.parseNumber("0")]]}}},options:{withdraw:{fillResponsefromRequest:!0,methods:{BTC:"privatePostBitcoinWithdrawal",LTC:"privatePostLitecoinWithdrawal",BCH:"privatePostBitcoinCashWithdrawal",ETH:"privatePostEthereumWithdrawal",XRP:"privatePostRippleWithdrawal",DASH:"privatePostDashWithdrawal",DAI:"privatePostDaiWithdrawal",ADA:"privatePostAdaWithdrawal",SOL:"privatePostSolWithdrawal"}}},exceptions:{exact:{"No order with given ID":r.OrderNotFound},broad:{"Not enough account balance available":r.InsufficientFunds,"Incorrect order ID":r.InvalidOrder,"Minimum Order Size ":r.InvalidOrder,"max allowed precision":r.InvalidOrder,"TOO MANY REQUESTS":r.RateLimitExceeded,"Access denied.":r.AuthenticationError}},precisionMode:o.sh})}async fetchMarkets(e={}){const t=await this.publicGetTradingPairs(e),s=this.safeValue(t,"data",[]),i=[];for(let e=0;e400){if(o){const e=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,o,e),this.throwBroadlyMatchedException(this.exceptions.broad,o,e),new r.ExchangeError(e)}throw new r.ExchangeError(this.id+" "+o)}}}},4759:(e,t,s)=>{s.d(t,{Z:()=>n});var i=s(488),r=s(6689),a=s(9292),o=s(2194);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinmetro",name:"Coinmetro",countries:["EE"],version:"v1",rateLimit:200,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,addMargin:!1,borrowCrossMargin:!0,borrowIsolatedMargin:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!0,createDepositAddress:!1,createOrder:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,deposit:!1,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledAndClosedOrders:!0,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!1,fetchTicker:!1,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!1,withdraw:!1,ws:!1},timeframes:{"1m":"60000","5m":"300000","30m":"1800000","4h":"14400000","1d":"86400000"},urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/e86f87ec-6ba3-4410-962b-f7988c5db539",api:{public:"https://api.coinmetro.com",private:"https://api.coinmetro.com"},test:{public:"https://api.coinmetro.com/open",private:"https://api.coinmetro.com/open"},www:"https://coinmetro.com/",doc:["https://documenter.getpostman.com/view/3653795/SVfWN6KS"],fees:"https://help.coinmetro.com/hc/en-gb/articles/6844007317789-What-are-the-fees-on-Coinmetro-",referral:"https://go.coinmetro.com/?ref=crypto24"},api:{public:{get:{"demo/temp":1,"exchange/candles/{pair}/{timeframe}/{from}/{to}":3,"exchange/prices":1,"exchange/ticks/{pair}/{from}":3,assets:1,markets:1,"exchange/book/{pair}":3,"exchange/bookUpdates/{pair}/{from}":1}},private:{get:{"users/balances":1,"users/wallets":1,"users/wallets/history/{since}":1.67,"exchange/orders/status/{orderID}":1,"exchange/orders/active":1,"exchange/orders/history/{since}":1.67,"exchange/fills/{since}":1.67,"exchange/margin":1},post:{jwt:1,jwtDevice:1,devices:1,"jwt-read-only":1,"exchange/orders/create":1,"exchange/orders/modify/{orderID}":1,"exchange/swap":1,"exchange/swap/confirm/{swapId}":1,"exchange/orders/close/{orderID}":1,"exchange/orders/hedge":1},put:{jwt:1,"exchange/orders/cancel/{orderID}":1,"users/margin/collateral":1,"users/margin/primary/{currency}":1}}},requiredCredentials:{apiKey:!1,secret:!1,uid:!0,token:!0},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0")}},precisionMode:a.nr,options:{currenciesByIdForParseMarket:void 0,currencyIdsListForParseMarket:void 0},exceptions:{exact:{"Both buyingCurrency and sellingCurrency are required":r.InvalidOrder,"One and only one of buyingQty and sellingQty is required":r.InvalidOrder,"Invalid buyingCurrency":r.InvalidOrder,"Invalid 'from'":r.BadRequest,"Invalid sellingCurrency":r.InvalidOrder,"Invalid buyingQty":r.InvalidOrder,"Invalid sellingQty":r.InvalidOrder,"Insufficient balance":r.InsufficientFunds,"Expiration date is in the past or too near in the future":r.InvalidOrder,Forbidden:r.PermissionDenied,"Order Not Found":r.OrderNotFound,"since must be a millisecond timestamp":r.BadRequest,"This pair is disabled on margin":r.BadSymbol},broad:{"accessing from a new IP":r.PermissionDenied,"available to allocate as collateral":r.InsufficientFunds,"At least":r.BadRequest,"collateral is not allowed":r.BadRequest,"Insufficient liquidity":r.InvalidOrder,"Insufficient order size":r.InvalidOrder,"Invalid quantity":r.InvalidOrder,"Invalid Stop Loss":r.InvalidOrder,"Invalid stop price!":r.InvalidOrder,"Not enough balance":r.InsufficientFunds,"Not enough margin":r.InsufficientFunds,"orderType missing":r.BadRequest,"Server Timeout":r.ExchangeError,"Time in force has to be IOC or FOK for market orders":r.InvalidOrder,"Too many attempts":r.RateLimitExceeded}}})}async fetchCurrencies(e={}){const t=await this.publicGetAssets(e),s={};for(let e=0;e1&&(t=this.parseLedgerEntryType(i[0]),s="-"!==i[1]?i[1]:this.safeString(i,2)),[t,s]}parseLedgerEntryType(e){return this.safeString({Deposit:"transaction",Withdraw:"transaction",Order:"trade"},e,e)}async createOrder(e,t,s,i,a=void 0,n={}){await this.loadMarkets();const d=this.market(e);let h,c={};c.orderType=t,void 0!==i&&(h=this.amountToPrecision(e,i));let l,u=this.safeValue(n,"cost");if(n=this.omit(n,"cost"),"limit"===t){if(void 0===a&&void 0===u)throw new r.ArgumentsRequired(this.id+" createOrder() requires a price or params.cost argument for a "+t+" order");if(void 0!==a&&void 0!==i){const e=o.O.stringMul(this.numberToString(a),this.numberToString(h));u=this.parseToNumeric(e)}}void 0!==u&&(l=this.costToPrecision(e,u)),"sell"===s?c=this.handleCreateOrderSide(d.baseId,d.quoteId,h,l,c):"buy"===s&&(c=this.handleCreateOrderSide(d.quoteId,d.baseId,l,h,c));const p=this.safeValue(n,"timeInForce");void 0!==p&&(n=this.omit(n,"timeInForce"),c.timeInForce=this.encodeOrderTimeInForce(p));const f=this.safeString2(n,"triggerPrice","stopPrice");void 0!==f&&(n=this.omit(n,["triggerPrice"]),c.stopPrice=this.priceToPrecision(e,f));const m=this.safeValue(n,"userData",{}),g=this.safeString2(n,"clientOrderId","comment");void 0!==g&&(n=this.omit(n,["clientOrderId"]),m.comment=g);const v=this.safeString(n,"stopLossPrice");void 0!==v&&(n=this.omit(n,"stopLossPrice"),m.stopLoss=this.priceToPrecision(e,v));const y=this.safeString(n,"takeProfitPrice");void 0!==y&&(n=this.omit(n,"takeProfitPrice"),m.takeProfit=this.priceToPrecision(e,y)),this.isEmpty(m)||(c.userData=m);const w=await this.privatePostExchangeOrdersCreate(this.extend(c,n));return this.parseOrder(w,d)}handleCreateOrderSide(e,t,s,i,r={}){return r.sellingCurrency=e,r.buyingCurrency=t,void 0!==s&&(r.sellingQty=s),void 0!==i&&(r.buyingQty=i),r}encodeOrderTimeInForce(e){return this.safeValue({GTC:1,IOC:2,GTD:3,FOK:4},e,e)}async cancelOrder(e,t=void 0,s={}){await this.loadMarkets();const i={orderID:e};[s,s]=this.handleMarginModeAndParams("cancelOrder",s);const r=this.safeBool(s,"margin",!1);let a;return s=this.omit(s,"margin"),a=r?await this.privatePostExchangeOrdersCloseOrderID(this.extend(i,s)):await this.privatePutExchangeOrdersCancelOrderID(this.extend(i,s)),this.parseOrder(a)}async closePosition(e,t=void 0,s={}){await this.loadMarkets();const i=this.safeString(s,"orderId");if(void 0===i)throw new r.ArgumentsRequired(this.id+" closePosition() requires a orderId parameter");const a={orderID:i},o=await this.privatePostExchangeOrdersCloseOrderID(this.extend(a,s));return this.parseOrder(o)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a=await this.privateGetExchangeOrdersActive(i),o=this.parseOrders(a,r,t,s);for(let e=0;e{s.d(t,{Z:()=>d});var i=s(3767),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinone",name:"CoinOne",countries:["KR"],rateLimit:667,version:"v2",pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketOrder:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddresses:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg",api:{rest:"https://api.coinone.co.kr",v2Public:"https://api.coinone.co.kr/public/v2",v2Private:"https://api.coinone.co.kr/v2",v2_1Private:"https://api.coinone.co.kr/v2.1"},www:"https://coinone.co.kr",doc:"https://doc.coinone.co.kr"},requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:["orderbook","ticker","ticker_utc","trades"]},v2Public:{get:["range_units","markets/{quote_currency}","markets/{quote_currency}/{target_currency}","orderbook/{quote_currency}/{target_currency}","trades/{quote_currency}/{target_currency}","ticker_new/{quote_currency}","ticker_new/{quote_currency}/{target_currency}","ticker_utc_new/{quote_currency}","ticker_utc_new/{quote_currency}/{target_currency}","currencies","currencies/{currency}","chart/{quote_currency}/{target_currency}"]},private:{post:["account/deposit_address","account/btc_deposit_address","account/balance","account/daily_balance","account/user_info","account/virtual_account","order/cancel_all","order/cancel","order/limit_buy","order/limit_sell","order/complete_orders","order/limit_orders","order/order_info","transaction/auth_number","transaction/history","transaction/krw/history","transaction/btc","transaction/coin"]},v2Private:{post:["account/balance","account/deposit_address","account/user_info","account/virtual_account","order/cancel","order/limit_buy","order/limit_sell","order/limit_orders","order/complete_orders","order/query_order","transaction/auth_number","transaction/btc","transaction/history","transaction/krw/history"]},v2_1Private:{post:["account/balance/all","account/balance","account/trade_fee","account/trade_fee/{quote_currency}/{target_currency}","order/limit","order/cancel","order/cancel/all","order/open_orders","order/open_orders/all","order/complete_orders","order/complete_orders/all","order/info","transaction/krw/history","transaction/coin/history","transaction/coin/withdrawal/limit"]}},fees:{trading:{tierBased:!1,percentage:!0,taker:.002,maker:.002}},precisionMode:o.sh,exceptions:{405:r.OnMaintenance,104:r.OrderNotFound,108:r.BadSymbol,107:r.BadRequest},commonCurrencies:{SOC:"Soda Coin"}})}async fetchCurrencies(e={}){const t=await this.v2PublicGetCurrencies(e),s={},i=this.safeValue(t,"currencies",[]);for(let e=0;e{s.d(t,{Z:()=>d});var i=s(435),r=s(6689),a=s(9292),o=s(2194),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinsph",name:"Coins.ph",countries:["PH"],version:"v1",rateLimit:50,certified:!1,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createPostOnlyOrder:!1,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,deposit:!0,editOrder:!1,fetchAccounts:!1,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrder:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTradingLimits:!1,fetchTransactionFee:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchWithdrawal:void 0,fetchWithdrawals:!0,fetchWithdrawalWhitelist:!1,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!1,withdraw:!0,ws:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","8h":"8h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/225719995-48ab2026-4ddb-496c-9da7-0d7566617c9b.jpg",api:{public:"https://api.pro.coins.ph",private:"https://api.pro.coins.ph"},www:"https://coins.ph/",doc:["https://coins-docs.github.io/rest-api"],fees:"https://support.coins.ph/hc/en-us/sections/4407198694681-Limits-Fees"},api:{public:{get:{"openapi/v1/ping":1,"openapi/v1/time":1,"openapi/quote/v1/ticker/24hr":{cost:1,noSymbolAndNoSymbols:40,byNumberOfSymbols:[[101,40],[21,20],[0,1]]},"openapi/quote/v1/ticker/price":{cost:1,noSymbol:2},"openapi/quote/v1/ticker/bookTicker":{cost:1,noSymbol:2},"openapi/v1/exchangeInfo":10,"openapi/quote/v1/depth":{cost:1,byLimit:[[101,5],[0,1]]},"openapi/quote/v1/klines":1,"openapi/quote/v1/trades":1,"openapi/v1/pairs":1,"openapi/quote/v1/avgPrice":1}},private:{get:{"openapi/wallet/v1/config/getall":10,"openapi/wallet/v1/deposit/address":10,"openapi/wallet/v1/deposit/history":1,"openapi/wallet/v1/withdraw/history":1,"openapi/v1/account":10,"openapi/v1/openOrders":{cost:3,noSymbol:40},"openapi/v1/asset/tradeFee":1,"openapi/v1/order":2,"openapi/v1/historyOrders":{cost:10,noSymbol:40},"openapi/v1/myTrades":10,"openapi/v1/capital/deposit/history":1,"openapi/v1/capital/withdraw/history":1,"openapi/v3/payment-request/get-payment-request":1,"merchant-api/v1/get-invoices":1,"openapi/account/v3/crypto-accounts":1,"openapi/transfer/v3/transfers/{id}":1},post:{"openapi/wallet/v1/withdraw/apply":600,"openapi/v1/order/test":1,"openapi/v1/order":1,"openapi/v1/capital/withdraw/apply":1,"openapi/v1/capital/deposit/apply":1,"openapi/v3/payment-request/payment-requests":1,"openapi/v3/payment-request/delete-payment-request":1,"openapi/v3/payment-request/payment-request-reminder":1,"openapi/v1/userDataStream":1,"merchant-api/v1/invoices":1,"merchant-api/v1/invoices-cancel":1,"openapi/convert/v1/get-supported-trading-pairs":1,"openapi/convert/v1/get-quote":1,"openapi/convert/v1/accpet-quote":1,"openapi/fiat/v1/support-channel":1,"openapi/fiat/v1/cash-out":1,"openapi/fiat/v1/history":1,"openapi/migration/v4/sellorder":1,"openapi/migration/v4/validate-field":1,"openapi/transfer/v3/transfers":1},delete:{"openapi/v1/order":1,"openapi/v1/openOrders":1,"openapi/v1/userDataStream":1}}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,maker:this.parseNumber("0.0025"),taker:this.parseNumber("0.003"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.003")],[this.parseNumber("500000"),this.parseNumber("0.0027")],[this.parseNumber("1000000"),this.parseNumber("0.0024")],[this.parseNumber("2500000"),this.parseNumber("0.002")],[this.parseNumber("5000000"),this.parseNumber("0.0018")],[this.parseNumber("10000000"),this.parseNumber("0.0015")],[this.parseNumber("100000000"),this.parseNumber("0.0012")],[this.parseNumber("500000000"),this.parseNumber("0.0009")],[this.parseNumber("1000000000"),this.parseNumber("0.0007")],[this.parseNumber("2500000000"),this.parseNumber("0.0005")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0025")],[this.parseNumber("500000"),this.parseNumber("0.0022")],[this.parseNumber("1000000"),this.parseNumber("0.0018")],[this.parseNumber("2500000"),this.parseNumber("0.0015")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("10000000"),this.parseNumber("0.001")],[this.parseNumber("100000000"),this.parseNumber("0.0008")],[this.parseNumber("500000000"),this.parseNumber("0.0007")],[this.parseNumber("1000000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000000"),this.parseNumber("0.0005")]]}}},precisionMode:a.sh,options:{createMarketBuyOrderRequiresPrice:!0,withdraw:{warning:!1},deposit:{warning:!1},createOrder:{timeInForce:"GTC",newOrderRespType:{market:"FULL",limit:"FULL"}},fetchTicker:{method:"publicGetOpenapiQuoteV1Ticker24hr"},fetchTickers:{method:"publicGetOpenapiQuoteV1Ticker24hr"},networks:{TRC20:"TRX",ERC20:"ETH",BEP20:"BSC",ARB:"ARBITRUM"}},exceptions:{exact:{"-1000":r.BadRequest,"-1001":r.BadRequest,"-1002":r.AuthenticationError,"-1003":r.RateLimitExceeded,"-1004":r.InvalidOrder,"-1006":r.BadResponse,"-1007":r.BadResponse,"-1014":r.InvalidOrder,"-1015":r.RateLimitExceeded,"-1016":r.NotSupported,"-1020":r.NotSupported,"-1021":r.BadRequest,"-1022":r.BadRequest,"-1023":r.AuthenticationError,"-1024":r.BadRequest,"-1025":r.BadRequest,"-1030":r.ExchangeError,"-1100":r.BadRequest,"-1101":r.BadRequest,"-1102":r.BadRequest,"-1103":r.BadRequest,"-1104":r.BadRequest,"-1105":r.BadRequest,"-1106":r.BadRequest,"-1111":r.BadRequest,"-1112":r.BadResponse,"-1114":r.BadRequest,"-1115":r.InvalidOrder,"-1116":r.InvalidOrder,"-1117":r.InvalidOrder,"-1118":r.InvalidOrder,"-1119":r.InvalidOrder,"-1120":r.BadRequest,"-1121":r.BadSymbol,"-1122":r.InvalidOrder,"-1125":r.BadRequest,"-1127":r.BadRequest,"-1128":r.BadRequest,"-1130":r.BadRequest,"-1131":r.InsufficientFunds,"-1132":r.InvalidOrder,"-1133":r.InvalidOrder,"-1134":r.InvalidOrder,"-1135":r.InvalidOrder,"-1136":r.InvalidOrder,"-1137":r.InvalidOrder,"-1138":r.InvalidOrder,"-1139":r.InvalidOrder,"-1140":r.InvalidOrder,"-1141":r.DuplicateOrderId,"-1142":r.InvalidOrder,"-1143":r.OrderNotFound,"-1144":r.InvalidOrder,"-1145":r.InvalidOrder,"-1146":r.InvalidOrder,"-1147":r.InvalidOrder,"-1148":r.InvalidOrder,"-1149":r.InvalidOrder,"-1150":r.InvalidOrder,"-1151":r.BadSymbol,"-1152":r.NotSupported,"-1153":r.AuthenticationError,"-1154":r.BadRequest,"-1155":r.BadRequest,"-1156":r.InvalidOrder,"-1157":r.BadSymbol,"-1158":r.InvalidOrder,"-1159":r.InvalidOrder,"-1160":r.BadRequest,"-1161":r.BadRequest,"-2010":r.InvalidOrder,"-2013":r.OrderNotFound,"-2011":r.BadRequest,"-2014":r.BadRequest,"-2015":r.AuthenticationError,"-2016":r.BadResponse,"-3126":r.InvalidOrder,"-3127":r.InvalidOrder,"-4001":r.BadRequest,"-100011":r.BadSymbol,"-100012":r.BadSymbol,"-30008":r.InsufficientFunds,"-30036":r.InsufficientFunds,403:r.ExchangeNotAvailable},broad:{"Unknown order sent":r.OrderNotFound,"Duplicate order sent":r.DuplicateOrderId,"Market is closed":r.BadSymbol,"Account has insufficient balance for requested action":r.InsufficientFunds,"Market orders are not supported for this symbol":r.BadSymbol,"Iceberg orders are not supported for this symbol":r.BadSymbol,"Stop loss orders are not supported for this symbol":r.BadSymbol,"Stop loss limit orders are not supported for this symbol":r.BadSymbol,"Take profit orders are not supported for this symbol":r.BadSymbol,"Take profit limit orders are not supported for this symbol":r.BadSymbol,"Price* QTY is zero or less":r.BadRequest,"IcebergQty exceeds QTY":r.BadRequest,"This action disabled is on this account":r.PermissionDenied,"Unsupported order combination":r.InvalidOrder,"Order would trigger immediately":r.InvalidOrder,"Cancel order is invalid. Check origClOrdId and orderId":r.InvalidOrder,"Order would immediately match and take":r.OrderImmediatelyFillable,PRICE_FILTER:r.InvalidOrder,LOT_SIZE:r.InvalidOrder,MIN_NOTIONAL:r.InvalidOrder,MAX_NUM_ORDERS:r.InvalidOrder,MAX_ALGO_ORDERS:r.InvalidOrder,BROKER_MAX_NUM_ORDERS:r.InvalidOrder,BROKER_MAX_ALGO_ORDERS:r.InvalidOrder,ICEBERG_PARTS:r.BadRequest}}})}calculateRateLimiterCost(e,t,s,i,r={}){if("noSymbol"in r&&!("symbol"in i))return r.noSymbol;if("noSymbolAndNoSymbols"in r&&!("symbol"in i)&&!("symbols"in i))return r.noSymbolAndNoSymbols;if("byNumberOfSymbols"in r&&"symbols"in i){const e=i.symbols.length,t=r.byNumberOfSymbols;for(let s=0;s=i[0])return i[1]}}else if("byLimit"in r&&"limit"in i){const e=i.limit,t=r.byLimit;for(let s=0;s=i[0])return i[1]}}return this.safeValue(r,"cost",1)}async fetchStatus(e={}){return{status:"ok",updated:void 0,eta:void 0,url:void 0,info:await this.publicGetOpenapiV1Ping(e)}}async fetchTime(e={}){const t=await this.publicGetOpenapiV1Time(e);return this.safeInteger(t,"serverTime")}async fetchMarkets(e={}){const t=await this.publicGetOpenapiV1ExchangeInfo(e),s=this.safeValue(t,"symbols"),i=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(4663),r=s(6689),a=s(9292),o=s(7110),n=s(2194);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"coinspot",name:"CoinSpot",countries:["AU"],rateLimit:1e3,pro:!1,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createMarketOrder:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,ws:!1},urls:{logo:"https://user-images.githubusercontent.com/1294454/28208429-3cacdf9a-6896-11e7-854e-4c79a772a30f.jpg",api:{public:"https://www.coinspot.com.au/pubapi",private:"https://www.coinspot.com.au/api"},www:"https://www.coinspot.com.au",doc:"https://www.coinspot.com.au/api",referral:"https://www.coinspot.com.au/register?code=PJURCU"},api:{public:{get:["latest"]},private:{post:["orders","orders/history","my/coin/deposit","my/coin/send","quote/buy","quote/sell","my/balances","my/orders","my/buy","my/sell","my/buy/cancel","my/sell/cancel","ro/my/balances","ro/my/balances/{cointype}","ro/my/deposits","ro/my/withdrawals","ro/my/transactions","ro/my/transactions/{cointype}","ro/my/transactions/open","ro/my/transactions/{cointype}/open","ro/my/sendreceive","ro/my/affiliatepayments","ro/my/referralpayments"]}},markets:{"ADA/AUD":this.safeMarketStructure({id:"ada",symbol:"ADA/AUD",base:"ADA",quote:"AUD",baseId:"ada",quoteId:"aud",type:"spot",spot:!0}),"BTC/AUD":this.safeMarketStructure({id:"btc",symbol:"BTC/AUD",base:"BTC",quote:"AUD",baseId:"btc",quoteId:"aud",type:"spot",spot:!0}),"ETH/AUD":this.safeMarketStructure({id:"eth",symbol:"ETH/AUD",base:"ETH",quote:"AUD",baseId:"eth",quoteId:"aud",type:"spot",spot:!0}),"XRP/AUD":this.safeMarketStructure({id:"xrp",symbol:"XRP/AUD",base:"XRP",quote:"AUD",baseId:"xrp",quoteId:"aud",type:"spot",spot:!0}),"LTC/AUD":this.safeMarketStructure({id:"ltc",symbol:"LTC/AUD",base:"LTC",quote:"AUD",baseId:"ltc",quoteId:"aud",type:"spot",spot:!0}),"DOGE/AUD":this.safeMarketStructure({id:"doge",symbol:"DOGE/AUD",base:"DOGE",quote:"AUD",baseId:"doge",quoteId:"aud",type:"spot",spot:!0}),"RFOX/AUD":this.safeMarketStructure({id:"rfox",symbol:"RFOX/AUD",base:"RFOX",quote:"AUD",baseId:"rfox",quoteId:"aud",type:"spot",spot:!0}),"POWR/AUD":this.safeMarketStructure({id:"powr",symbol:"POWR/AUD",base:"POWR",quote:"AUD",baseId:"powr",quoteId:"aud",type:"spot",spot:!0}),"NEO/AUD":this.safeMarketStructure({id:"neo",symbol:"NEO/AUD",base:"NEO",quote:"AUD",baseId:"neo",quoteId:"aud",type:"spot",spot:!0}),"TRX/AUD":this.safeMarketStructure({id:"trx",symbol:"TRX/AUD",base:"TRX",quote:"AUD",baseId:"trx",quoteId:"aud",type:"spot",spot:!0}),"EOS/AUD":this.safeMarketStructure({id:"eos",symbol:"EOS/AUD",base:"EOS",quote:"AUD",baseId:"eos",quoteId:"aud",type:"spot",spot:!0}),"XLM/AUD":this.safeMarketStructure({id:"xlm",symbol:"XLM/AUD",base:"XLM",quote:"AUD",baseId:"xlm",quoteId:"aud",type:"spot",spot:!0}),"RHOC/AUD":this.safeMarketStructure({id:"rhoc",symbol:"RHOC/AUD",base:"RHOC",quote:"AUD",baseId:"rhoc",quoteId:"aud",type:"spot",spot:!0}),"GAS/AUD":this.safeMarketStructure({id:"gas",symbol:"GAS/AUD",base:"GAS",quote:"AUD",baseId:"gas",quoteId:"aud",type:"spot",spot:!0})},commonCurrencies:{DRK:"DASH"},options:{fetchBalance:"private_post_my_balances"},precisionMode:a.sh})}parseBalance(e){const t={info:e},s=this.safeValue2(e,"balance","balances");if(Array.isArray(s))for(let e=0;e{s.d(t,{Z:()=>d});var i=s(6450),r=s(2194),a=s(6689),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"cryptocom",name:"Crypto.com",countries:["MT"],version:"v2",rateLimit:10,certified:!0,pro:!0,has:{CORS:!1,spot:!0,margin:!0,swap:!0,future:!0,option:!0,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,closeAllPositions:!1,closePosition:!0,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:"emulated",fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDepositAddress:!0,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositsWithdrawals:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchGreeks:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchStatus:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFees:!1,fetchTransactions:!1,fetchTransfers:!1,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!1,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","4h":"4h","6h":"6h","12h":"12h","1d":"1D","1w":"7D","2w":"14D","1M":"1M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg",test:{v1:"https://uat-api.3ona.co/exchange/v1",v2:"https://uat-api.3ona.co/v2",derivatives:"https://uat-api.3ona.co/v2"},api:{v1:"https://api.crypto.com/exchange/v1",v2:"https://api.crypto.com/v2",derivatives:"https://deriv-api.crypto.com/v1"},www:"https://crypto.com/",referral:{url:"https://crypto.com/exch/kdacthrnxt",discount:.15},doc:["https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html","https://exchange-docs.crypto.com/spot/index.html","https://exchange-docs.crypto.com/derivatives/index.html"],fees:"https://crypto.com/exchange/document/fees-limits"},api:{v1:{public:{get:{"public/auth":10/3,"public/get-instruments":10/3,"public/get-book":1,"public/get-candlestick":1,"public/get-trades":1,"public/get-tickers":1,"public/get-valuations":1,"public/get-expired-settlement-price":10/3,"public/get-insurance":1}},private:{post:{"private/set-cancel-on-disconnect":10/3,"private/get-cancel-on-disconnect":10/3,"private/user-balance":10/3,"private/user-balance-history":10/3,"private/get-positions":10/3,"private/create-order":2/3,"private/create-order-list":10/3,"private/cancel-order":2/3,"private/cancel-order-list":10/3,"private/cancel-all-orders":2/3,"private/close-position":10/3,"private/get-order-history":100,"private/get-open-orders":10/3,"private/get-order-detail":1/3,"private/get-trades":100,"private/change-account-leverage":10/3,"private/get-transactions":10/3,"private/create-subaccount-transfer":10/3,"private/get-subaccount-balances":10/3,"private/get-order-list":10/3,"private/create-withdrawal":10/3,"private/get-currency-networks":10/3,"private/get-deposit-address":10/3,"private/get-accounts":10/3,"private/get-withdrawal-history":10/3,"private/get-deposit-history":10/3}}},v2:{public:{get:{"public/auth":1,"public/get-instruments":1,"public/get-book":1,"public/get-candlestick":1,"public/get-ticker":1,"public/get-trades":1,"public/margin/get-transfer-currencies":1,"public/margin/get-load-currenices":1,"public/respond-heartbeat":1}},private:{post:{"private/set-cancel-on-disconnect":10/3,"private/get-cancel-on-disconnect":10/3,"private/create-withdrawal":10/3,"private/get-withdrawal-history":10/3,"private/get-currency-networks":10/3,"private/get-deposit-history":10/3,"private/get-deposit-address":10/3,"private/export/create-export-request":10/3,"private/export/get-export-requests":10/3,"private/export/download-export-output":10/3,"private/get-account-summary":10/3,"private/create-order":2/3,"private/cancel-order":2/3,"private/cancel-all-orders":2/3,"private/create-order-list":10/3,"private/get-order-history":10/3,"private/get-open-orders":10/3,"private/get-order-detail":1/3,"private/get-trades":100,"private/get-accounts":10/3,"private/get-subaccount-balances":10/3,"private/create-subaccount-transfer":10/3,"private/otc/get-otc-user":10/3,"private/otc/get-instruments":10/3,"private/otc/request-quote":100,"private/otc/accept-quote":100,"private/otc/get-quote-history":10/3,"private/otc/get-trade-history":10/3,"private/otc/create-order":10/3}}},derivatives:{public:{get:{"public/auth":10/3,"public/get-instruments":10/3,"public/get-book":1,"public/get-candlestick":1,"public/get-trades":1,"public/get-tickers":1,"public/get-valuations":1,"public/get-expired-settlement-price":10/3,"public/get-insurance":1}},private:{post:{"private/set-cancel-on-disconnect":10/3,"private/get-cancel-on-disconnect":10/3,"private/user-balance":10/3,"private/user-balance-history":10/3,"private/get-positions":10/3,"private/create-order":2/3,"private/create-order-list":10/3,"private/cancel-order":2/3,"private/cancel-order-list":10/3,"private/cancel-all-orders":2/3,"private/close-position":10/3,"private/convert-collateral":10/3,"private/get-order-history":100,"private/get-open-orders":10/3,"private/get-order-detail":1/3,"private/get-trades":100,"private/change-account-leverage":10/3,"private/get-transactions":10/3,"private/create-subaccount-transfer":10/3,"private/get-subaccount-balances":10/3,"private/get-order-list":10/3}}}},fees:{trading:{maker:this.parseNumber("0.004"),taker:this.parseNumber("0.004"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("25000"),this.parseNumber("0.0035")],[this.parseNumber("50000"),this.parseNumber("0.0015")],[this.parseNumber("100000"),this.parseNumber("0.001")],[this.parseNumber("250000"),this.parseNumber("0.0009")],[this.parseNumber("1000000"),this.parseNumber("0.0008")],[this.parseNumber("20000000"),this.parseNumber("0.0007")],[this.parseNumber("100000000"),this.parseNumber("0.0006")],[this.parseNumber("200000000"),this.parseNumber("0.0004")]],taker:[[this.parseNumber("0"),this.parseNumber("0.004")],[this.parseNumber("25000"),this.parseNumber("0.0035")],[this.parseNumber("50000"),this.parseNumber("0.0025")],[this.parseNumber("100000"),this.parseNumber("0.0016")],[this.parseNumber("250000"),this.parseNumber("0.00015")],[this.parseNumber("1000000"),this.parseNumber("0.00014")],[this.parseNumber("20000000"),this.parseNumber("0.00013")],[this.parseNumber("100000000"),this.parseNumber("0.00012")],[this.parseNumber("200000000"),this.parseNumber("0.0001")]]}}},options:{defaultType:"spot",accountsById:{funding:"SPOT",spot:"SPOT",margin:"MARGIN",derivatives:"DERIVATIVES",swap:"DERIVATIVES",future:"DERIVATIVES"},networks:{BEP20:"BSC",ERC20:"ETH",TRC20:"TRON"},broker:"CCXT"},commonCurrencies:{USD_STABLE_COIN:"USDC"},precisionMode:o.sh,exceptions:{exact:{219:a.InvalidOrder,314:a.InvalidOrder,10001:a.ExchangeError,10002:a.PermissionDenied,10003:a.PermissionDenied,10004:a.BadRequest,10005:a.PermissionDenied,10006:a.DDoSProtection,10007:a.InvalidNonce,10008:a.BadRequest,10009:a.BadRequest,20001:a.BadRequest,20002:a.InsufficientFunds,20005:a.AccountNotEnabled,30003:a.BadSymbol,30004:a.BadRequest,30005:a.BadRequest,30006:a.InvalidOrder,30007:a.InvalidOrder,30008:a.InvalidOrder,30009:a.InvalidOrder,30010:a.BadRequest,30013:a.InvalidOrder,30014:a.InvalidOrder,30016:a.InvalidOrder,30017:a.InvalidOrder,30023:a.InvalidOrder,30024:a.InvalidOrder,30025:a.InvalidOrder,40001:a.BadRequest,40002:a.BadRequest,40003:a.BadRequest,40004:a.BadRequest,40005:a.BadRequest,40006:a.BadRequest,40007:a.BadRequest,40101:a.AuthenticationError,50001:a.BadRequest,9010001:a.OnMaintenance},broad:{}}})}async fetchMarkets(e={}){const t=await this.v1PublicGetPublicGetInstruments(e),s=this.safeValue(t,"result",{}),i=this.safeValue(s,"data",[]),r=[];for(let e=0;e1)throw new a.BadRequest(this.id+" fetchTickers() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;s=this.market(t),i.instrument_name=s.id}const r=await this.v1PublicGetPublicGetTickers(this.extend(i,t)),o=this.safeValue(r,"result",{}),n=this.safeList(o,"data",[]);return this.parseTickers(n,e)}async fetchTicker(e,t={}){await this.loadMarkets(),e=this.symbol(e);const s=await this.fetchTickers([e],t);return this.safeValue(s,e)}async fetchOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r,a=!1;if([a,i]=this.handleOptionAndParams(i,"fetchOrders","paginate"),a)return await this.fetchPaginatedCallDynamic("fetchOrders",e,t,s,i);const o={};void 0!==e&&(r=this.market(e),o.instrument_name=r.id),void 0!==t&&(o.start_time=t),void 0!==s&&(o.limit=s);const n=this.safeInteger(i,"until");i=this.omit(i,["until"]),void 0!==n&&(o.end_time=n);const d=await this.v1PrivatePostPrivateGetOrderHistory(this.extend(o,i)),h=this.safeValue(d,"result",{}),c=this.safeList(h,"data",[]);return this.parseOrders(c,r,t,s)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchTrades","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchTrades",e,t,s,i);const a=this.market(e),o={instrument_name:a.id};void 0!==t&&(o.start_ts=t),void 0!==s&&(o.count=s);const n=this.safeInteger(i,"until");i=this.omit(i,["until"]),void 0!==n&&(o.end_ts=n);const d=await this.v1PublicGetPublicGetTrades(this.extend(o,i)),h=this.safeValue(d,"result",{}),c=this.safeList(h,"data",[]);return this.parseTrades(c,a,t,s)}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,r={}){await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchOHLCV","paginate",!1),a)return await this.fetchPaginatedCallDeterministic("fetchOHLCV",e,s,i,t,r,300);const o=this.market(e),n={instrument_name:o.id,timeframe:this.safeString(this.timeframes,t,t)};void 0!==s&&(n.start_ts=s),void 0!==i&&(n.count=i);const d=this.safeInteger(r,"until");r=this.omit(r,["until"]),void 0!==d&&(n.end_ts=d);const h=await this.v1PublicGetPublicGetCandlestick(this.extend(n,r)),c=this.safeValue(h,"result",{}),l=this.safeList(c,"data",[]);return this.parseOHLCVs(l,o,t,s,i)}async fetchOrderBook(e,t=void 0,s={}){await this.loadMarkets();const i={instrument_name:this.market(e).id};t&&(i.depth=t);const r=await this.v1PublicGetPublicGetBook(this.extend(i,s)),a=this.safeValue(r,"result",{}),o=this.safeValue(a,"data",[]),n=this.safeValue(o,0),d=this.safeInteger(n,"t");return this.parseOrderBook(n,e,d)}parseBalance(e){const t=this.safeValue(e,"result",{}),s=this.safeValue(t,"data",[]),i=this.safeValue(s[0],"position_balances",[]),r={info:e};for(let e=0;e0){[t,i]=e.split("?");s=i.split("=")[1]}else t=e;return[t,s]}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),await this.loadMarkets();const a=this.safeCurrency(e),o={currency:a.id,amount:t,address:s};let n;void 0!==i&&(o.address_tag=i),[n,r]=this.handleNetworkCodeAndParams(r);const d=this.networkCodeToId(n);void 0!==d&&(o.network_id=d);const h=await this.v1PrivatePostPrivateCreateWithdrawal(this.extend(o,r)),c=this.safeDict(h,"result");return this.parseTransaction(c,a)}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();const s={currency:this.safeCurrency(e).id},i=await this.v1PrivatePostPrivateGetDepositAddress(this.extend(s,t)),r=this.safeValue(i,"result",{}),o=this.safeValue(r,"deposit_address_list",[]),n=o.length;if(0===n)throw new a.ExchangeError(this.id+" fetchDepositAddressesByNetwork() generating address...");const d={};for(let e=0;e1)throw new a.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;i=this.market(t),s.instrument_name=i.id}const r=await this.v1PrivatePostPrivateGetPositions(this.extend(s,t)),o=this.safeValue(r,"result",{}),n=this.safeValue(o,"data",[]),d=[];for(let e=0;e=3)return e.toString();if("string"==typeof e)return e;let s,i="";if(Array.isArray(e))s=e;else{const t=this.keysort(e);s=Object.keys(t)}for(let r=0;r{s.d(t,{Z:()=>d});var i=s(1304),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"currencycom",name:"Currency.com",countries:["BY"],rateLimit:100,certified:!1,pro:!0,version:"v2",has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:void 0,cancelAllOrders:void 0,cancelOrder:!0,cancelOrders:void 0,createDepositAddress:void 0,createLimitOrder:!0,createMarketOrder:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:"emulated",fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:void 0,fetchBorrowRateHistory:void 0,fetchCanceledOrders:void 0,fetchClosedOrder:void 0,fetchClosedOrders:void 0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL2OrderBook:!0,fetchLedger:!0,fetchLedgerEntry:!1,fetchLeverage:!0,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:void 0,fetchOrders:void 0,fetchOrderTrades:void 0,fetchPosition:void 0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:void 0,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTradingLimits:void 0,fetchTransactionFee:void 0,fetchTransactionFees:void 0,fetchTransactions:"emulated",fetchTransfers:void 0,fetchWithdrawal:void 0,fetchWithdrawals:!0,reduceMargin:void 0,setLeverage:void 0,setMarginMode:void 0,setPositionMode:void 0,signIn:void 0,transfer:void 0,withdraw:void 0},timeframes:{"1m":"1m","5m":"5m","10m":"10m","15m":"15m","30m":"30m","1h":"1h","4h":"4h","1d":"1d","1w":"1w"},hostname:"backend.currency.com",urls:{logo:"https://user-images.githubusercontent.com/1294454/83718672-36745c00-a63e-11ea-81a9-677b1f789a4d.jpg",api:{public:"https://api-adapter.{hostname}/api",private:"https://api-adapter.{hostname}/api",marketcap:"https://marketcap.{hostname}/api"},test:{public:"https://demo-api-adapter.{hostname}/api",private:"https://demo-api-adapter.{hostname}/api"},www:"https://www.currency.com",referral:"https://currency.com/trading/signup?c=362jaimv&pid=referral",doc:["https://currency.com/api"],fees:"https://currency.com/fees-charges"},api:{public:{get:{"v1/time":1,"v1/exchangeInfo":1,"v1/depth":1,"v1/aggTrades":1,"v1/klines":1,"v1/ticker/24hr":1,"v2/time":1,"v2/exchangeInfo":1,"v2/depth":1,"v2/aggTrades":1,"v2/klines":1,"v2/ticker/24hr":1}},marketcap:{get:{"v1/assets":1,"v1/candles":1,"v1/orderbook":1,"v1/summary":1,"v1/ticker":1,"v1/token/assets":1,"v1/token/orderbook":1,"v1/token/summary":1,"v1/token/ticker":1,"v1/token/trades":1,"v1/token_crypto/OHLC":1,"v1/token_crypto/assets":1,"v1/token_crypto/orderbook":1,"v1/token_crypto/summary":1,"v1/token_crypto/ticker":1,"v1/token_crypto/trades":1,"v1/trades":1}},private:{get:{"v1/account":1,"v1/currencies":1,"v1/deposits":1,"v1/depositAddress":1,"v1/ledger":1,"v1/leverageSettings":1,"v1/myTrades":1,"v1/openOrders":1,"v1/tradingPositions":1,"v1/tradingPositionsHistory":1,"v1/transactions":1,"v1/withdrawals":1,"v2/account":1,"v2/currencies":1,"v2/deposits":1,"v2/depositAddress":1,"v2/ledger":1,"v2/leverageSettings":1,"v2/myTrades":1,"v2/openOrders":1,"v2/tradingPositions":1,"v2/tradingPositionsHistory":1,"v2/transactions":1,"v2/withdrawals":1,"v2/fetchOrder":1},post:{"v1/order":1,"v1/updateTradingPosition":1,"v1/updateTradingOrder":1,"v1/closeTradingPosition":1,"v2/order":1,"v2/updateTradingPosition":1,"v2/updateTradingOrder":1,"v2/closeTradingPosition":1},delete:{"v1/order":1,"v2/order":1}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,taker:this.parseNumber("0.002"),maker:this.parseNumber("0.002")}},precisionMode:o.sh,options:{defaultTimeInForce:"GTC",warnOnFetchOpenOrdersWithoutSymbol:!0,recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,parseOrderToPrecision:!1,newOrderRespType:{market:"FULL",limit:"RESULT",stop:"RESULT"},leverage_markets_suffix:"_LEVERAGE",collateralCurrencies:["USD","EUR","USDT"]},exceptions:{broad:{"FIELD_VALIDATION_ERROR Cancel is available only for LIMIT order":r.InvalidOrder,"API key does not exist":r.AuthenticationError,"Order would trigger immediately.":r.InvalidOrder,"Account has insufficient balance for requested action.":r.InsufficientFunds,"Rest API trading is not enabled.":r.ExchangeNotAvailable,"Combination of parameters invalid":r.BadRequest,"Invalid limit price":r.BadRequest,"Only leverage symbol allowed here:":r.BadSymbol,"market data service is not available":r.ExchangeNotAvailable,"your time is ahead of server":r.InvalidNonce,"Can not find account":r.BadRequest,"You mentioned an invalid value for the price parameter":r.BadRequest},exact:{"-1000":r.ExchangeNotAvailable,"-1013":r.InvalidOrder,"-1022":r.AuthenticationError,"-1030":r.InvalidOrder,"-1100":r.InvalidOrder,"-1104":r.ExchangeError,"-1025":r.AuthenticationError,"-1128":r.BadRequest,"-2010":r.ExchangeError,"-2011":r.OrderNotFound,"-2013":r.OrderNotFound,"-2014":r.AuthenticationError,"-2015":r.AuthenticationError}},commonCurrencies:{ACN:"Accenture",AMC:"AMC Entertainment Holdings",BNS:"Bank of Nova Scotia",CAR:"Avis Budget Group Inc",CLR:"Continental Resources",EDU:"New Oriental Education & Technology Group Inc",ETN:"Eaton",FOX:"Fox Corporation",GM:"General Motors Co",IQ:"iQIYI",OSK:"Oshkosh",PLAY:"Dave & Buster's Entertainment"}})}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchTime(e={}){const t=await this.publicGetV2Time(e);return this.safeInteger(t,"serverTime")}async fetchCurrencies(e={}){if(!this.checkRequiredCredentials(!1))return;const t=await this.privateGetV2Currencies(e),s={};for(let e=0;e=400){if(o.indexOf("Price * QTY is zero or less")>=0)throw new r.InvalidOrder(this.id+" order cost = amount * price is zero or less "+o);if(o.indexOf("LOT_SIZE")>=0)throw new r.InvalidOrder(this.id+" order amount should be evenly divisible by lot size "+o);if(o.indexOf("PRICE_FILTER")>=0)throw new r.InvalidOrder(this.id+" order price is invalid, i.e. exceeds allowed price precision, exceeds min price or max price limits or is invalid float value in general, use this.priceToPrecision (symbol, amount) "+o)}if(void 0===n)return;const c=this.safeString(n,"code");if(void 0!==c&&"0"!==c){const e=this.id+" "+this.json(n);this.throwExactlyMatchedException(this.exceptions.exact,c,e);const t=this.safeString(n,"msg");throw this.throwBroadlyMatchedException(this.exceptions.broad,t,e),new r.ExchangeError(e)}}}},1753:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(2708),r=s(6689),a=s(9292),o=s(2194),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"delta",name:"Delta Exchange",countries:["VC"],rateLimit:300,version:"v2",has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!0,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!0,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!0,editOrder:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDeposits:void 0,fetchFundingHistory:!1,fetchFundingRate:!0,fetchFundingRateHistory:!1,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchLedger:!0,fetchLeverage:!0,fetchLeverageTiers:!1,fetchMarginMode:!0,fetchMarginModes:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!1,fetchOrderBook:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTransfer:void 0,fetchTransfers:void 0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!1,fetchWithdrawal:void 0,fetchWithdrawals:void 0,reduceMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!1},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","1d":"1d","7d":"7d","1w":"1w","2w":"2w","1M":"30d"},urls:{logo:"https://user-images.githubusercontent.com/1294454/99450025-3be60a00-2931-11eb-9302-f4fd8d8589aa.jpg",test:{public:"https://testnet-api.delta.exchange",private:"https://testnet-api.delta.exchange"},api:{public:"https://api.delta.exchange",private:"https://api.delta.exchange"},www:"https://www.delta.exchange",doc:["https://docs.delta.exchange"],fees:"https://www.delta.exchange/fees",referral:"https://www.delta.exchange/app/signup/?code=IULYNB"},api:{public:{get:["assets","indices","products","products/{symbol}","tickers","tickers/{symbol}","l2orderbook/{symbol}","trades/{symbol}","stats","history/candles","history/sparklines","settings"]},private:{get:["orders","products/{product_id}/orders/leverage","positions/margined","positions","orders/history","fills","fills/history/download/csv","wallet/balances","wallet/transactions","wallet/transactions/download","wallets/sub_accounts_transfer_history","users/trading_preferences","sub_accounts","profile","deposits/address","orders/leverage"],post:["orders","orders/bracket","orders/batch","products/{product_id}/orders/leverage","positions/change_margin","positions/close_all","wallets/sub_account_balance_transfer","orders/cancel_after","orders/leverage"],put:["orders","orders/bracket","orders/batch","positions/auto_topup","users/update_mmp","users/reset_mmp"],delete:["orders","orders/all","orders/batch"]}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0015"),maker:this.parseNumber("0.0010"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0015")],[this.parseNumber("100"),this.parseNumber("0.0013")],[this.parseNumber("250"),this.parseNumber("0.0013")],[this.parseNumber("1000"),this.parseNumber("0.001")],[this.parseNumber("5000"),this.parseNumber("0.0009")],[this.parseNumber("10000"),this.parseNumber("0.00075")],[this.parseNumber("20000"),this.parseNumber("0.00065")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("100"),this.parseNumber("0.001")],[this.parseNumber("250"),this.parseNumber("0.0009")],[this.parseNumber("1000"),this.parseNumber("0.00075")],[this.parseNumber("5000"),this.parseNumber("0.0006")],[this.parseNumber("10000"),this.parseNumber("0.0005")],[this.parseNumber("20000"),this.parseNumber("0.0005")]]}}},options:{networks:{TRC20:"TRC20(TRON)",BEP20:"BEP20(BSC)"}},precisionMode:a.sh,requiredCredentials:{apiKey:!0,secret:!0},exceptions:{exact:{insufficient_margin:r.InsufficientFunds,order_size_exceed_available:r.InvalidOrder,risk_limits_breached:r.BadRequest,invalid_contract:r.BadSymbol,immediate_liquidation:r.InvalidOrder,out_of_bankruptcy:r.InvalidOrder,self_matching_disrupted_post_only:r.InvalidOrder,immediate_execution_post_only:r.InvalidOrder,bad_schema:r.BadRequest,invalid_api_key:r.AuthenticationError,invalid_signature:r.AuthenticationError,open_order_not_found:r.OrderNotFound,unavailable:r.ExchangeNotAvailable},broad:{}}})}createExpiredOptionMarket(e){const t="USDT",s=e.split("-"),i=e.split("/");let r,a,o;e.indexOf("/")>-1?(r=this.safeString(i,0),a=this.safeString(s,1),o=this.safeString(s,3)):(r=this.safeString(s,1),a=this.safeString(s,3),o=this.safeString(s,0));const n=t,d=this.safeString(s,2),h=this.convertExpireDate(a),c=this.parse8601(h);return{id:o+"-"+r+"-"+d+"-"+a,symbol:r+"/"+t+":"+n+"-"+a+"-"+d+"-"+o,base:r,quote:t,settle:n,baseId:r,quoteId:t,settleId:n,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:this.parseNumber("1"),expiry:c,expiryDatetime:h,optionType:"C"===o?"call":"put",strike:this.parseNumber(d),precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return void 0!==e&&(e.endsWith("-C")||e.endsWith("-P")||e.startsWith("C-")||e.startsWith("P-"))&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,s,i)}async fetchTime(e={}){const t=await this.publicGetSettings(e),s=this.safeDict(t,"result",{});return this.safeIntegerProduct(s,"server_time",.001)}async fetchStatus(e={}){const t=await this.publicGetSettings(e),s=this.safeDict(t,"result",{});return{status:"true"===this.safeString(s,"under_maintenance")?"maintenance":"ok",updated:this.safeIntegerProduct(s,"server_time",.001,this.milliseconds()),eta:void 0,url:void 0,info:t}}async fetchCurrencies(e={}){const t=await this.publicGetAssets(e),s=this.safeList(t,"result",[]),i={};for(let e=0;e{s.d(t,{Z:()=>h});var i=s(6563),r=s(9292),a=s(6689),o=s(2194),n=s(1372),d=s(2523);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"deribit",name:"Deribit",countries:["NL"],version:"v2",userAgent:void 0,rateLimit:50,pro:!0,has:{CORS:!0,spot:!1,margin:!1,swap:!0,future:!0,option:!0,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,createDepositAddress:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!1,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositWithdrawFees:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchGreeks:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverageTiers:!1,fetchLiquidations:!0,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!0,fetchMySettlementHistory:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!0,fetchUnderlyingAssets:!1,fetchVolatilityHistory:!0,fetchWithdrawal:!1,fetchWithdrawals:!0,transfer:!0,withdraw:!0},timeframes:{"1m":"1","3m":"3","5m":"5","10m":"10","15m":"15","30m":"30","1h":"60","2h":"120","3h":"180","6h":"360","12h":"720","1d":"1D"},urls:{test:{rest:"https://test.deribit.com"},logo:"https://user-images.githubusercontent.com/1294454/41933112-9e2dd65a-798b-11e8-8440-5bab2959fcb8.jpg",api:{rest:"https://www.deribit.com"},www:"https://www.deribit.com",doc:["https://docs.deribit.com/v2","https://github.com/deribit"],fees:"https://www.deribit.com/pages/information/fees",referral:{url:"https://www.deribit.com/reg-1189.4038",discount:.1}},api:{public:{get:{auth:1,exchange_token:1,fork_token:1,set_heartbeat:1,disable_heartbeat:1,get_time:1,hello:1,status:1,test:1,subscribe:1,unsubscribe:1,unsubscribe_all:1,get_announcements:1,get_book_summary_by_currency:1,get_book_summary_by_instrument:1,get_contract_size:1,get_currencies:1,get_delivery_prices:1,get_funding_chart_data:1,get_funding_rate_history:1,get_funding_rate_value:1,get_historical_volatility:1,get_index:1,get_index_price:1,get_index_price_names:1,get_instrument:1,get_instruments:1,get_last_settlements_by_currency:1,get_last_settlements_by_instrument:1,get_last_trades_by_currency:1,get_last_trades_by_currency_and_time:1,get_last_trades_by_instrument:1,get_last_trades_by_instrument_and_time:1,get_mark_price_history:1,get_order_book:1,get_trade_volumes:1,get_tradingview_chart_data:1,get_volatility_index_data:1,ticker:1}},private:{get:{logout:1,enable_cancel_on_disconnect:1,disable_cancel_on_disconnect:1,get_cancel_on_disconnect:1,subscribe:1,unsubscribe:1,unsubscribe_all:1,change_api_key_name:1,change_scope_in_api_key:1,change_subaccount_name:1,create_api_key:1,create_subaccount:1,disable_api_key:1,disable_tfa_for_subaccount:1,enable_affiliate_program:1,enable_api_key:1,get_access_log:1,get_account_summary:1,get_affiliate_program_info:1,get_email_language:1,get_new_announcements:1,get_portfolio_margins:1,get_position:1,get_positions:1,get_subaccounts:1,get_subaccounts_details:1,get_transaction_log:1,list_api_keys:1,remove_api_key:1,remove_subaccount:1,reset_api_key:1,set_announcement_as_read:1,set_api_key_as_default:1,set_email_for_subaccount:1,set_email_language:1,set_password_for_subaccount:1,toggle_notifications_from_subaccount:1,toggle_subaccount_login:1,execute_block_trade:4,get_block_trade:1,get_last_block_trades_by_currency:1,invalidate_block_trade_signature:1,verify_block_trade:4,buy:4,sell:4,edit:4,edit_by_label:4,cancel:4,cancel_all:4,cancel_all_by_currency:4,cancel_all_by_instrument:4,cancel_by_label:4,close_position:4,get_margins:1,get_mmp_config:1,get_open_orders_by_currency:1,get_open_orders_by_instrument:1,get_order_history_by_currency:1,get_order_history_by_instrument:1,get_order_margin_by_ids:1,get_order_state:1,get_stop_order_history:1,get_trigger_order_history:1,get_user_trades_by_currency:1,get_user_trades_by_currency_and_time:1,get_user_trades_by_instrument:1,get_user_trades_by_instrument_and_time:1,get_user_trades_by_order:1,reset_mmp:1,set_mmp_config:1,get_settlement_history_by_instrument:1,get_settlement_history_by_currency:1,cancel_transfer_by_id:1,cancel_withdrawal:1,create_deposit_address:1,get_current_deposit_address:1,get_deposits:1,get_transfers:1,get_withdrawals:1,submit_transfer_to_subaccount:1,submit_transfer_to_user:1,withdraw:1}}},exceptions:{9999:a.PermissionDenied,1e4:a.AuthenticationError,10001:a.ExchangeError,10002:a.InvalidOrder,10003:a.InvalidOrder,10004:a.OrderNotFound,10005:a.InvalidOrder,10006:a.InvalidOrder,10007:a.InvalidOrder,10008:a.InvalidOrder,10009:a.InsufficientFunds,10010:a.OrderNotFound,10011:a.InvalidOrder,10012:a.InvalidOrder,10013:a.PermissionDenied,10014:a.PermissionDenied,10015:a.PermissionDenied,10016:a.PermissionDenied,10017:a.PermissionDenied,10018:a.PermissionDenied,10019:a.PermissionDenied,10020:a.ExchangeError,10021:a.InvalidOrder,10022:a.InvalidOrder,10023:a.InvalidOrder,10024:a.InvalidOrder,10025:a.InvalidOrder,10026:a.InvalidOrder,10027:a.InvalidOrder,10028:a.DDoSProtection,10029:a.OrderNotFound,10030:a.ExchangeError,10031:a.ExchangeError,10032:a.InvalidOrder,10033:a.NotSupported,10034:a.InvalidOrder,10035:a.InvalidOrder,10036:a.InvalidOrder,10040:a.ExchangeNotAvailable,10041:a.OnMaintenance,10043:a.InvalidOrder,10044:a.InvalidOrder,10045:a.InvalidOrder,10046:a.InvalidOrder,10047:a.DDoSProtection,10048:a.ExchangeError,11008:a.InvalidOrder,11029:a.BadRequest,11030:a.ExchangeError,11031:a.ExchangeError,11035:a.DDoSProtection,11036:a.InvalidOrder,11037:a.BadRequest,11038:a.InvalidOrder,11039:a.InvalidOrder,11041:a.InvalidOrder,11042:a.PermissionDenied,11043:a.BadRequest,11044:a.InvalidOrder,11045:a.BadRequest,11046:a.BadRequest,11047:a.BadRequest,11048:a.ExchangeError,11049:a.BadRequest,11050:a.BadRequest,11051:a.OnMaintenance,11052:a.ExchangeError,11053:a.ExchangeError,11090:a.InvalidAddress,11091:a.InvalidAddress,11092:a.InvalidAddress,11093:a.DDoSProtection,11094:a.ExchangeError,11095:a.ExchangeError,11096:a.ExchangeError,12e3:a.AuthenticationError,12001:a.DDoSProtection,12002:a.ExchangeError,12998:a.AuthenticationError,12003:a.AuthenticationError,12004:a.AuthenticationError,12005:a.AuthenticationError,12100:a.ExchangeError,12999:a.AuthenticationError,13e3:a.AuthenticationError,13001:a.AuthenticationError,13002:a.PermissionDenied,13003:a.AuthenticationError,13004:a.AuthenticationError,13005:a.AuthenticationError,13006:a.AuthenticationError,13007:a.AuthenticationError,13008:a.ExchangeError,13009:a.AuthenticationError,13010:a.BadRequest,13011:a.BadRequest,13012:a.PermissionDenied,13013:a.BadRequest,13014:a.BadRequest,13015:a.BadRequest,13016:a.BadRequest,13017:a.ExchangeError,13018:a.ExchangeError,13019:a.ExchangeError,13020:a.ExchangeError,13021:a.PermissionDenied,13025:a.ExchangeError,"-32602":a.BadRequest,"-32601":a.BadRequest,"-32700":a.BadRequest,"-32000":a.BadRequest,11054:a.InvalidOrder},precisionMode:r.sh,options:{code:"BTC",fetchBalance:{code:"BTC"},fetchPositions:{code:"BTC"},transfer:{method:"privateGetSubmitTransferToSubaccount"}}})}createExpiredOptionMarket(e){let t,s="USD";const i=e.split("-"),r=e.split("/");let a,o;e.indexOf("/")>-1?(a=this.safeString(r,0),o=this.safeString(i,1),e.indexOf("USDC")>-1&&(a+="_USDC")):(a=this.safeString(i,0),o=this.convertMarketIdExpireDate(this.safeString(i,1))),e.indexOf("USDC")>-1?(s="USDC",t="USDC"):t=a;let n=a;if(a.indexOf("_")>-1){const e=a.split("_");n=this.safeString(e,0)}const d=this.safeString(i,2),h=this.safeString(i,3),c=this.convertExpireDate(o),l=this.parse8601(c);return{id:a+"-"+this.convertExpireDateToMarketIdDate(o)+"-"+d+"-"+h,symbol:n+"/"+s+":"+t+"-"+o+"-"+d+"-"+h,base:a,quote:s,settle:t,baseId:a,quoteId:s,settleId:t,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:void 0,expiry:l,expiryDatetime:c,optionType:"C"===h?"call":"put",strike:this.parseNumber(d),precision:{amount:void 0,price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return void 0!==e&&(e.endsWith("-C")||e.endsWith("-P"))&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,s,i)}async fetchTime(e={}){const t=await this.publicGetGetTime(e);return this.safeInteger(t,"result")}async fetchCurrencies(e={}){const t=await this.publicGetGetCurrencies(e),s=this.safeValue(t,"result",{}),i={};for(let e=0;e=0,g=a.indexOf("option")>=0,v=a.indexOf("combo")>=0,y=this.safeInteger(t,"expiration_timestamp");let w,b,S=n,k="swap";if(m?k="future":g?k="option":o&&(k="spot"),o)S=l+"/"+u;else if(!v&&(S=l+"/"+u+":"+p,(g||m)&&(S=S+"-"+this.yymmdd(y,""),g))){w=this.safeNumber(t,"strike"),b=this.safeString(t,"option_type");const e="call"===b?"C":"P";S=S+"-"+this.numberToString(w)+"-"+e}if(this.safeValue(i,S))continue;i[S]=!0;const O=this.safeNumber(t,"min_trade_amount"),T=this.safeNumber(t,"tick_size");s.push({id:n,symbol:S,base:l,quote:u,settle:p,baseId:d,quoteId:h,settleId:c,type:k,spot:o,margin:!1,swap:f,future:m,option:g,active:this.safeValue(t,"is_active"),contract:!o,linear:p===u,inverse:p!==u,taker:this.safeNumber(t,"taker_commission"),maker:this.safeNumber(t,"maker_commission"),contractSize:this.safeNumber(t,"contract_size"),expiry:y,expiryDatetime:this.iso8601(y),strike:w,optionType:b,precision:{amount:O,price:T},limits:{leverage:{min:void 0,max:void 0},amount:{min:O,max:void 0},price:{min:T,max:void 0},cost:{min:void 0,max:void 0}},created:this.safeInteger(t,"creation_timestamp"),info:t})}}return s}parseBalance(e){const t={info:e},s=this.safeString(e,"currency"),i=this.safeCurrencyCode(s),r=this.account();return r.free=this.safeString(e,"available_funds"),r.used=this.safeString(e,"maintenance_margin"),r.total=this.safeString(e,"equity"),t[i]=r,this.safeBalance(t)}async fetchBalance(e={}){await this.loadMarkets();const t=this.codeFromOptions("fetchBalance",e),s={currency:this.currency(t).id},i=await this.privateGetGetAccountSummary(this.extend(s,e)),r=this.safeValue(i,"result",{});return this.parseBalance(r)}async createDepositAddress(e,t={}){await this.loadMarkets();const s={currency:this.currency(e).id},i=await this.privateGetCreateDepositAddress(this.extend(s,t)),r=this.safeValue(i,"result",{}),a=this.safeString(r,"address");return this.checkAddress(a),{currency:e,address:a,tag:void 0,info:i}}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s={currency:this.currency(e).id},i=await this.privateGetGetCurrentDepositAddress(this.extend(s,t)),r=this.safeValue(i,"result",{}),a=this.safeString(r,"address");return this.checkAddress(a),{currency:e,address:a,tag:void 0,network:void 0,info:i}}parseTicker(e,t=void 0){const s=this.safeInteger2(e,"timestamp","creation_timestamp"),i=this.safeString(e,"instrument_name"),r=this.safeSymbol(i,t),a=this.safeString2(e,"last_price","last"),o=this.safeValue(e,"stats",e);return this.safeTicker({symbol:r,timestamp:s,datetime:this.iso8601(s),high:this.safeString2(o,"high","max_price"),low:this.safeString2(o,"low","min_price"),bid:this.safeString2(e,"best_bid_price","bid_price"),bidVolume:this.safeString(e,"best_bid_amount"),ask:this.safeString2(e,"best_ask_price","ask_price"),askVolume:this.safeString(e,"best_ask_amount"),vwap:void 0,open:void 0,close:a,last:a,previousClose:void 0,change:void 0,percentage:void 0,average:void 0,baseVolume:void 0,quoteVolume:this.safeString(o,"volume"),info:e},t)}async fetchTicker(e,t={}){await this.loadMarkets();const s=this.market(e),i={instrument_name:s.id},r=await this.publicGetTicker(this.extend(i,t)),a=this.safeDict(r,"result");return this.parseTicker(a,s)}async fetchTickers(e=void 0,t={}){await this.loadMarkets(),e=this.marketSymbols(e);const s=this.safeString2(t,"code","currency");if(t=this.omit(t,["code"]),void 0===s)throw new a.ArgumentsRequired(this.id+" fetchTickers requires a currency/code (eg: BTC/ETH/USDT) parameter to fetch tickers for");const i={currency:this.currency(s).id},r=await this.publicGetGetBookSummaryByCurrency(this.extend(i,t)),o=this.safeList(r,"result",[]),n={};for(let e=0;e0){const i=t[0],r=t[s-1];i.continuation=e,r.continuation=e,t[0]=i,t[s-1]=r}}return t}async fetchMyLiquidations(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new a.ArgumentsRequired(this.id+" fetchMyLiquidations() requires a symbol argument");await this.loadMarkets();const r=this.market(e);if(r.spot)throw new a.NotSupported(this.id+" fetchMyLiquidations() does not support "+r.type+" markets");const o={instrument_name:r.id,type:"bankruptcy"};void 0!==t&&(o.search_start_timestamp=t),void 0!==s&&(o.count=s);const n=await this.privateGetGetSettlementHistoryByInstrument(this.extend(o,i)),d=this.safeValue(n,"result",{}),h=this.safeList(d,"settlements",[]);return this.parseLiquidations(h,r,t,s)}parseLiquidation(e,t=void 0){const s=this.safeInteger(e,"timestamp");return this.safeLiquidation({info:e,symbol:this.safeSymbol(void 0,t),contracts:void 0,contractSize:this.safeNumber(t,"contractSize"),price:void 0,baseValue:this.safeNumber(e,"session_bankrupcy"),quoteValue:void 0,timestamp:s,datetime:this.iso8601(s)})}async fetchGreeks(e,t={}){await this.loadMarkets();const s=this.market(e),i={instrument_name:s.id},r=await this.publicGetTicker(this.extend(i,t)),a=this.safeValue(r,"result",{});return this.parseGreeks(a,s)}parseGreeks(e,t=void 0){const s=this.safeInteger(e,"timestamp"),i=this.safeString(e,"instrument_name"),r=this.safeSymbol(i,t),a=this.safeValue(e,"greeks",{});return{symbol:r,timestamp:s,datetime:this.iso8601(s),delta:this.safeNumber(a,"delta"),gamma:this.safeNumber(a,"gamma"),theta:this.safeNumber(a,"theta"),vega:this.safeNumber(a,"vega"),rho:this.safeNumber(a,"rho"),bidSize:this.safeNumber(e,"best_bid_amount"),askSize:this.safeNumber(e,"best_ask_amount"),bidImpliedVolatility:this.safeNumber(e,"bid_iv"),askImpliedVolatility:this.safeNumber(e,"ask_iv"),markImpliedVolatility:this.safeNumber(e,"mark_iv"),bidPrice:this.safeNumber(e,"best_bid_price"),askPrice:this.safeNumber(e,"best_ask_price"),markPrice:this.safeNumber(e,"mark_price"),lastPrice:this.safeNumber(e,"last_price"),underlyingPrice:this.safeNumber(e,"underlying_price"),info:e}}async fetchOption(e,t={}){await this.loadMarkets();const s=this.market(e),i={instrument_name:s.id},r=await this.publicGetGetBookSummaryByInstrument(this.extend(i,t)),a=this.safeList(r,"result",[]),o=this.safeDict(a,0,{});return this.parseOption(o,void 0,s)}async fetchOptionChain(e,t={}){await this.loadMarkets();const s={currency:this.currency(e).id,kind:"option"},i=await this.publicGetGetBookSummaryByCurrency(this.extend(s,t)),r=this.safeList(i,"result",[]);return this.parseOptionChain(r,"base_currency","instrument_name")}parseOption(e,t=void 0,s=void 0){const i=this.safeString(e,"instrument_name");s=this.safeMarket(i,s);const r=this.safeString(e,"base_currency"),a=this.safeCurrencyCode(r,t),o=this.safeInteger(e,"timestamp");return{info:e,currency:a,symbol:s.symbol,timestamp:o,datetime:this.iso8601(o),impliedVolatility:void 0,openInterest:this.safeNumber(e,"open_interest"),bidPrice:this.safeNumber(e,"bid_price"),askPrice:this.safeNumber(e,"ask_price"),midPrice:this.safeNumber(e,"mid_price"),markPrice:this.safeNumber(e,"mark_price"),lastPrice:this.safeNumber(e,"last"),underlyingPrice:this.safeNumber(e,"underlying_price"),change:void 0,percentage:this.safeNumber(e,"price_change"),baseVolume:this.safeNumber(e,"volume"),quoteVolume:this.safeNumber(e,"volume_usd")}}nonce(){return this.milliseconds()}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/api/"+this.version+"/"+t+"/"+e;if("public"===t&&Object.keys(i).length&&(o+="?"+this.urlencode(i)),"private"===t){this.checkRequiredCredentials();const e=this.nonce().toString(),t=this.milliseconds().toString(),a="";Object.keys(i).length&&(o+="?"+this.urlencode(i));const d=t+"\n"+e+"\n"+(s+"\n"+o+"\n"+a+"\n"),h=this.hmac(this.encode(d),this.encode(this.secret),n.J);r={Authorization:"deri-hmac-sha256 id="+this.apiKey+",ts="+t+",sig="+h+",nonce="+e}}return{url:this.urls.api.rest+o,method:s,body:a,headers:r}}handleErrors(e,t,s,i,r,o,n,d,h){if(!n)return;const c=this.safeValue(n,"error");if(void 0!==c){const e=this.safeString(c,"code"),t=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions,e,t),new a.ExchangeError(t)}}}},8846:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(823),r=s(6689),a=s(9292),o=s(2194),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"digifinex",name:"DigiFinex",countries:["SG"],version:"v3",rateLimit:900,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!1,option:!1,addMargin:!0,cancelOrder:!0,cancelOrders:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCrossBorrowRate:!0,fetchCrossBorrowRates:!0,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!1,fetchLeverageTiers:!0,fetchMarginMode:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransfers:!0,fetchWithdrawals:!0,reduceMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!0,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","1h":"60","4h":"240","12h":"720","1d":"1D","1w":"1W"},urls:{logo:"https://user-images.githubusercontent.com/51840849/87443315-01283a00-c5fe-11ea-8628-c2a0feaf07ac.jpg",api:{rest:"https://openapi.digifinex.com"},www:"https://www.digifinex.com",doc:["https://docs.digifinex.com"],fees:"https://digifinex.zendesk.com/hc/en-us/articles/360000328422-Fee-Structure-on-DigiFinex",referral:"https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp"},api:{public:{spot:{get:["{market}/symbols","kline","margin/currencies","margin/symbols","markets","order_book","ping","spot/symbols","time","trades","trades/symbols","ticker","currencies"]},swap:{get:["public/api_weight","public/candles","public/candles_history","public/depth","public/funding_rate","public/funding_rate_history","public/instrument","public/instruments","public/ticker","public/tickers","public/time","public/trades"]}},private:{spot:{get:["{market}/financelog","{market}/mytrades","{market}/order","{market}/order/detail","{market}/order/current","{market}/order/history","margin/assets","margin/financelog","margin/mytrades","margin/order","margin/order/current","margin/order/history","margin/positions","otc/financelog","spot/assets","spot/financelog","spot/mytrades","spot/order","spot/order/current","spot/order/history","deposit/address","deposit/history","withdraw/history"],post:["{market}/order/cancel","{market}/order/new","{market}/order/batch_new","margin/order/cancel","margin/order/new","margin/position/close","spot/order/cancel","spot/order/new","transfer","withdraw/new","withdraw/cancel"]},swap:{get:["account/balance","account/positions","account/finance_record","account/trading_fee_rate","account/transfer_record","account/funding_fee","trade/history_orders","trade/history_trades","trade/open_orders","trade/order_info"],post:["account/leverage","account/position_mode","account/position_margin","trade/batch_cancel_order","trade/batch_order","trade/cancel_order","trade/order_place","follow/sponsor_order","follow/close_order","follow/cancel_order","follow/user_center_current","follow/user_center_history","follow/expert_current_open_order","follow/add_algo","follow/cancel_algo","follow/account_available","follow/plan_task","follow/instrument_list"]}}},fees:{trading:{tierBased:!0,percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},precisionMode:a.sh,exceptions:{exact:{10001:[r.BadRequest,"Wrong request method, please check it's a GET ot POST request"],10002:[r.AuthenticationError,"Invalid ApiKey"],10003:[r.AuthenticationError,"Sign doesn't match"],10004:[r.BadRequest,"Illegal request parameters"],10005:[r.DDoSProtection,"Request frequency exceeds the limit"],10006:[r.PermissionDenied,"Unauthorized to execute this request"],10007:[r.PermissionDenied,"IP address Unauthorized"],10008:[r.InvalidNonce,"Timestamp for this request is invalid, timestamp must within 1 minute"],10009:[r.NetworkError,"Unexist endpoint, please check endpoint URL"],10011:[r.AccountSuspended,"ApiKey expired. Please go to client side to re-create an ApiKey"],20001:[r.PermissionDenied,"Trade is not open for this trading pair"],20002:[r.PermissionDenied,"Trade of this trading pair is suspended"],20003:[r.InvalidOrder,"Invalid price or amount"],20007:[r.InvalidOrder,"Price precision error"],20008:[r.InvalidOrder,"Amount precision error"],20009:[r.InvalidOrder,"Amount is less than the minimum requirement"],20010:[r.InvalidOrder,"Cash Amount is less than the minimum requirement"],20011:[r.InsufficientFunds,"Insufficient balance"],20012:[r.BadRequest,"Invalid trade type, valid value: buy/sell)"],20013:[r.InvalidOrder,"No order info found"],20014:[r.BadRequest,"Invalid date, Valid format: 2018-07-25)"],20015:[r.BadRequest,"Date exceeds the limit"],20018:[r.PermissionDenied,"Your trading rights have been banned by the system"],20019:[r.BadSymbol,'Wrong trading pair symbol. Correct format:"usdt_btc". Quote asset is in the front'],20020:[r.DDoSProtection,"You have violated the API operation trading rules and temporarily forbid trading. At present, we have certain restrictions on the user's transaction rate and withdrawal rate."],5e4:[r.ExchangeError,"Exception error"],20021:[r.BadRequest,"Invalid currency"],20022:[r.BadRequest,"The ending timestamp must be larger than the starting timestamp"],20023:[r.BadRequest,"Invalid transfer type"],20024:[r.BadRequest,"Invalid amount"],20025:[r.BadRequest,"This currency is not transferable at the moment"],20026:[r.InsufficientFunds,"Transfer amount exceed your balance"],20027:[r.PermissionDenied,"Abnormal account status"],20028:[r.PermissionDenied,"Blacklist for transfer"],20029:[r.PermissionDenied,"Transfer amount exceed your daily limit"],20030:[r.BadRequest,"You have no position on this trading pair"],20032:[r.PermissionDenied,"Withdrawal limited"],20033:[r.BadRequest,"Wrong Withdrawal ID"],20034:[r.PermissionDenied,"Withdrawal service of this crypto has been closed"],20035:[r.PermissionDenied,"Withdrawal limit"],20036:[r.ExchangeError,"Withdrawal cancellation failed"],20037:[r.InvalidAddress,"The withdrawal address, Tag or chain type is not included in the withdrawal management list"],20038:[r.InvalidAddress,"The withdrawal address is not on the white list"],20039:[r.ExchangeError,"Can't be canceled in current status"],20040:[r.RateLimitExceeded,"Withdraw too frequently; limitation: 3 times a minute, 100 times a day"],20041:[r.PermissionDenied,"Beyond the daily withdrawal limit"],20042:[r.BadSymbol,"Current trading pair does not support API trading"],400002:[r.BadRequest,"Invalid Parameter"]},broad:{}},options:{defaultType:"spot",types:["spot","margin","otc"],createMarketBuyOrderRequiresPrice:!0,accountsByType:{spot:"1",margin:"2",OTC:"3"},networks:{ARBITRUM:"Arbitrum",AVALANCEC:"AVAX-CCHAIN",AVALANCEX:"AVAX-XCHAIN",BEP20:"BEP20",BSC:"BEP20",CARDANO:"Cardano",CELO:"Celo",CHILIZ:"Chiliz",COSMOS:"COSMOS",CRC20:"Crypto.com",CRONOS:"Crypto.com",DOGECOIN:"DogeChain",ERC20:"ERC20",ETH:"ERC20",ETHW:"ETHW",IOTA:"MIOTA",KLAYTN:"KLAY",MATIC:"Polygon",METIS:"MetisDAO",MOONBEAM:"GLMR",MOONRIVER:"Moonriver",OPTIMISM:"OPETH",POLYGON:"Polygon",RIPPLE:"XRP",SOLANA:"SOL",STELLAR:"Stella",TERRACLASSIC:"TerraClassic",TERRA:"Terra",TON:"Ton",TRC20:"TRC20",TRON:"TRC20",TRX:"TRC20",VECHAIN:"Vechain"}},commonCurrencies:{BHT:"Black House Test",EPS:"Epanus",FREE:"FreeRossDAO",MBN:"Mobilian Coin",TEL:"TEL666"}})}async fetchCurrencies(e={}){const t=await this.publicSpotGetCurrencies(e),s=this.safeValue(t,"data",[]),i={};for(let e=0;e0,d=this.safeInteger(t,"withdraw_status",1)>0,h=n&&d,c=this.safeString(t,"min_withdraw_fee"),l=this.safeString(t,"min_withdraw_amount"),u=this.safeString(t,"min_deposit_amount"),p=this.parseNumber(u),f=this.parseNumber(l),m=this.parseNumber(c),g=o.O.stringMin(c,o.O.stringMin(u,l)),v=this.parseNumber(g),y=this.safeString(t,"chain");let w;void 0!==y&&(w=this.networkIdToCode(y));const b={info:t,id:y,network:w,active:h,fee:m,precision:v,deposit:n,withdraw:d,limits:{amount:{min:void 0,max:void 0},withdraw:{min:f,max:void 0},deposit:{min:p,max:void 0}}};a in i?(Array.isArray(i[a].info)?i[a].info.push(t):i[a].info=[i[a].info,t],d&&(i[a].withdraw=!0,i[a].limits.withdraw.min=Math.min(i[a].limits.withdraw.min,f)),n&&(i[a].deposit=!0,i[a].limits.deposit.min=Math.min(i[a].limits.deposit.min,p)),h&&(i[a].active=!0)):i[a]={id:r,code:a,info:t,type:void 0,name:void 0,active:h,deposit:n,withdraw:d,fee:this.parseNumber(c),precision:void 0,limits:{amount:{min:void 0,max:void 0},withdraw:{min:f,max:void 0},deposit:{min:p,max:void 0}},networks:{}},void 0!==y?i[a].networks[y]=b:(i[a].active=h,i[a].fee=this.parseNumber(c),i[a].deposit=n,i[a].withdraw=d,i[a].limits={amount:{min:void 0,max:void 0},withdraw:{min:f,max:void 0},deposit:{min:p,max:void 0}}),i[a].precision=void 0===i[a].precision?v:Math.max(i[a].precision,v)}return i}async fetchMarkets(e={}){const t=this.safeValue(this.options,"fetchMarkets",{});return"fetch_markets_v2"===this.safeString(t,"method","fetch_markets_v2")?await this.fetchMarketsV2(e):await this.fetchMarketsV1(e)}async fetchMarketsV2(e={}){const t=this.safeString(this.options,"defaultType"),[s,i]=this.handleMarginModeAndParams("fetchMarketsV2",e),r=[];void 0!==s?r.push(this.publicSpotGetMarginSymbols(i)):r.push(this.publicSpotGetTradesSymbols(i)),r.push(this.publicSwapGetPublicInstruments(e));const a=await Promise.all(r),o=a[0],n=a[1],d=this.safeValue(o,"symbol_list",[]),h=this.safeValue(n,"data",[]),c=this.arrayConcat(d,h),l=[];for(let e=0;e1?(o=e[0],a=e[1]):a="limit"}return this.safeOrder({info:e,id:this.safeString2(e,"order_id","data"),clientOrderId:void 0,timestamp:s,datetime:this.iso8601(s),lastTradeTimestamp:i,symbol:d,type:a,timeInForce:r,postOnly:void 0,side:o,price:this.safeNumber(e,"price"),stopPrice:void 0,triggerPrice:void 0,amount:this.safeNumber2(e,"amount","size"),filled:this.safeNumber2(e,"executed_amount","filled_qty"),remaining:void 0,cost:void 0,average:this.safeNumber2(e,"avg_price","price_avg"),status:this.parseOrderStatus(this.safeString2(e,"status","state")),fee:{cost:this.safeNumber(e,"fee")},trades:void 0},t)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){let a,o;await this.loadMarkets(),void 0!==e&&(a=this.market(e)),[o,i]=this.handleMarketTypeAndParams("fetchOpenOrders",a,i);const[n,d]=this.handleMarginModeAndParams("fetchOpenOrders",i),h={},c="swap"===o;if(c?(void 0!==t&&(h.start_timestamp=t),void 0!==s&&(h.limit=s)):h.market=o,void 0!==a){h[c?"instrument_id":"symbol"]=a.id}let l;if(void 0!==n||"margin"===o)o="margin",l=await this.privateSpotGetMarginOrderCurrent(this.extend(h,d));else if("spot"===o)l=await this.privateSpotGetSpotOrderCurrent(this.extend(h,d));else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchOpenOrders() not support this market type");l=await this.privateSwapGetTradeOpenOrders(this.extend(h,d))}const u=this.safeList(l,"data",[]);return this.parseOrders(u,a,t,s)}async fetchOrders(e=void 0,t=void 0,s=void 0,i={}){let a,o;await this.loadMarkets(),void 0!==e&&(a=this.market(e)),[o,i]=this.handleMarketTypeAndParams("fetchOrders",a,i);const[n,d]=this.handleMarginModeAndParams("fetchOrders",i),h={};if("swap"===o?void 0!==t&&(h.start_timestamp=t):(h.market=o,void 0!==t&&(h.start_time=this.parseToInt(t/1e3))),void 0!==a){h["swap"===o?"instrument_id":"symbol"]=a.id}let c;if(void 0!==s&&(h.limit=s),void 0!==n||"margin"===o)o="margin",c=await this.privateSpotGetMarginOrderHistory(this.extend(h,d));else if("spot"===o)c=await this.privateSpotGetSpotOrderHistory(this.extend(h,d));else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchOrders() not support this market type");c=await this.privateSwapGetTradeHistoryOrders(this.extend(h,d))}const l=this.safeList(c,"data",[]);return this.parseOrders(l,a,t,s)}async fetchOrder(e,t=void 0,s={}){let i,a;await this.loadMarkets(),void 0!==t&&(i=this.market(t)),[a,s]=this.handleMarketTypeAndParams("fetchOrder",i,s);const[o,n]=this.handleMarginModeAndParams("fetchOrder",s),d={order_id:e};let h;if("swap"===a?void 0!==i&&(d.instrument_id=i.id):d.market=a,void 0!==o||"margin"===a)a="margin",h=await this.privateSpotGetMarginOrder(this.extend(d,n));else if("spot"===a)h=await this.privateSpotGetSpotOrder(this.extend(d,n));else{if("swap"!==a)throw new r.NotSupported(this.id+" fetchOrder() not support this market type");h=await this.privateSwapGetTradeOrderInfo(this.extend(d,n))}const c=this.safeValue(h,"data"),l="swap"===a?c:this.safeValue(c,0);if(void 0===l)throw new r.OrderNotFound(this.id+" fetchOrder() order "+e.toString()+" not found");return this.parseOrder(l,i)}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){let a;await this.loadMarkets();const o={};let n;void 0!==e&&(a=this.market(e)),[n,i]=this.handleMarketTypeAndParams("fetchMyTrades",a,i);const[d,h]=this.handleMarginModeAndParams("fetchMyTrades",i);"swap"===n?void 0!==t&&(o.start_timestamp=t):(o.market=n,void 0!==t&&(o.start_time=this.parseToInt(t/1e3)));let c;if(void 0!==e&&(o["swap"===n?"instrument_id":"symbol"]=a.id),void 0!==s&&(o.limit=s),void 0!==d||"margin"===n)n="margin",c=await this.privateSpotGetMarginMytrades(this.extend(o,h));else if("spot"===n)c=await this.privateSpotGetSpotMytrades(this.extend(o,h));else{if("swap"!==n)throw new r.NotSupported(this.id+" fetchMyTrades() not support this market type");c=await this.privateSwapGetTradeHistoryTrades(this.extend(o,h))}const l="swap"===n?"data":"list",u=this.safeList(c,l,[]);return this.parseTrades(u,a,t,s)}parseLedgerEntryType(e){return this.safeString({},e,e)}parseLedgerEntry(e,t=void 0){const s=this.parseLedgerEntryType(this.safeString2(e,"type","finance_type")),i=this.safeCurrencyCode(this.safeString2(e,"currency_mark","currency"),t),r=this.safeNumber2(e,"num","change"),a=this.safeNumber(e,"balance");let o=this.safeTimestamp(e,"time");return void 0===o&&(o=this.safeInteger(e,"timestamp")),{info:e,id:void 0,direction:void 0,account:void 0,referenceId:void 0,referenceAccount:void 0,type:s,currency:i,amount:r,before:void 0,after:a,status:void 0,timestamp:o,datetime:this.iso8601(o),fee:void 0}}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const a={};let o;[o,i]=this.handleMarketTypeAndParams("fetchLedger",void 0,i);const[n,d]=this.handleMarginModeAndParams("fetchLedger",i);"swap"===o?void 0!==t&&(a.start_timestamp=t):(a.market=o,void 0!==t&&(a.start_time=this.parseToInt(t/1e3)));const h="swap"===o?"currency":"currency_mark";let c,l,u;if(void 0!==e&&(c=this.currency(e),a[h]=c.id),void 0!==s&&(a.limit=s),void 0!==n||"margin"===o)o="margin",l=await this.privateSpotGetMarginFinancelog(this.extend(a,d));else if("spot"===o)l=await this.privateSpotGetSpotFinancelog(this.extend(a,d));else{if("swap"!==o)throw new r.NotSupported(this.id+" fetchLedger() not support this market type");l=await this.privateSwapGetAccountFinanceRecord(this.extend(a,d))}if("swap"===o)u=this.safeValue(l,"data",[]);else{const e=this.safeValue(l,"data",{});u=this.safeValue(e,"finance",[])}return this.parseLedger(u,c,t,s)}parseDepositAddress(e,t=void 0){const s=this.safeString(e,"address"),i=this.safeString(e,"addressTag"),r=this.safeStringUpper(e,"currency");return{info:e,currency:this.safeCurrencyCode(r),address:s,tag:i,network:void 0}}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s=this.currency(e),i={currency:s.id},a=await this.privateSpotGetDepositAddress(this.extend(i,t)),o=this.safeValue(a,"data",[]),n=this.parseDepositAddresses(o,[s.code]),d=this.safeValue(n,e);if(void 0===d)throw new r.InvalidAddress(this.id+" fetchDepositAddress() did not return an address for "+e+" - create the deposit address in the user settings on the exchange website first.");return d}async fetchTransactionsByType(e,t=void 0,s=void 0,i=void 0,r={}){let a;await this.loadMarkets();const o={};let n;void 0!==t&&(a=this.currency(t),o.currency=a.id),void 0!==i&&(o.size=Math.min(500,i)),n="deposit"===e?await this.privateSpotGetDepositHistory(this.extend(o,r)):await this.privateSpotGetWithdrawHistory(this.extend(o,r));const d=this.safeList(n,"data",[]);return this.parseTransactions(d,a,s,i,{type:e})}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactionsByType("deposit",e,t,s,i)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchTransactionsByType("withdrawal",e,t,s,i)}parseTransactionStatus(e){return this.safeString({1:"pending",2:"pending",3:"ok",4:"failed"},e,e)}parseTransaction(e,t=void 0){const s=this.safeString2(e,"id","withdraw_id"),i=this.safeString(e,"address"),r=this.safeString(e,"memo"),a=this.safeString(e,"hash"),o=this.safeStringUpper(e,"currency"),n=this.safeCurrencyCode(o,t),d=this.parse8601(this.safeString(e,"created_date")),h=this.parse8601(this.safeString(e,"finished_date")),c=this.parseTransactionStatus(this.safeString(e,"state")),l=this.safeNumber(e,"amount"),u=this.safeNumber(e,"fee");let p;void 0!==u&&(p={currency:n,cost:u});const f=this.safeString(e,"chain");return{info:e,id:s,txid:a,timestamp:d,datetime:this.iso8601(d),network:f,address:i,addressTo:i,addressFrom:void 0,tag:r,tagTo:r,tagFrom:void 0,type:void 0,amount:l,currency:n,status:c,updated:h,internal:void 0,comment:void 0,fee:p}}parseTransferStatus(e){return this.safeString({0:"ok"},e,e)}parseTransfer(e,t=void 0){let s,i;const r=this.safeInteger(e,"type");1===r?(s="spot",i="swap"):2===r&&(s="swap",i="spot");const a=this.safeInteger(e,"timestamp");return{info:e,id:this.safeString(e,"transfer_id"),timestamp:a,datetime:this.iso8601(a),currency:this.safeCurrencyCode(this.safeString(e,"currency"),t),amount:this.safeNumber(e,"amount"),fromAccount:s,toAccount:i,status:this.parseTransferStatus(this.safeString(e,"code"))}}async transfer(e,t,s,i,r={}){await this.loadMarkets();const a=this.currency(e),o=this.safeValue(this.options,"accountsByType",{}),n=this.safeString(o,s,s),d=this.safeString(o,i,i),h={currency_mark:a.id,num:this.currencyToPrecision(e,t),from:n,to:d},c=await this.privateSpotPostTransfer(this.extend(h,r));return this.parseTransfer(c,a)}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),this.checkAddress(s),await this.loadMarkets();const a=this.currency(e),o={address:s,amount:this.currencyToPrecision(e,t),currency:a.id};void 0!==i&&(o.memo=i);const n=await this.privateSpotPostWithdrawNew(this.extend(o,r));return this.parseTransaction(n,a)}async fetchBorrowInterest(e=void 0,t=void 0,s=void 0,i=void 0,r={}){await this.loadMarkets();const a={};let o;void 0!==t&&(o=this.market(t),a.symbol=o.id);const n=await this.privateSpotGetMarginPositions(this.extend(a,r)),d=this.safeValue(n,"positions"),h=this.parseBorrowInterests(d,o);return this.filterByCurrencySinceLimit(h,e,s,i)}parseBorrowInterest(e,t=void 0){const s=this.safeString(e,"symbol"),i=this.safeString(e,"amount"),r=this.safeString(e,"leverage_ratio"),a=o.O.stringDiv(i,r),n=o.O.stringSub(i,a),d=void 0===t?void 0:t.base,h=this.safeSymbol(s,t);return{account:h,symbol:h,currency:d,interest:void 0,interestRate:.001,amountBorrowed:this.parseNumber(n),timestamp:void 0,datetime:void 0,info:e}}async fetchCrossBorrowRate(e,t={}){await this.loadMarkets();const s=await this.privateSpotGetMarginAssets(this.extend({},t)),i=this.safeValue(s,"list",[]);let r=[];for(let t=0;t1)throw new r.BadRequest(this.id+" fetchPositions() symbols argument cannot contain more than 1 symbol");t=e[0]}else t=e;i=this.market(t)}[a,t]=this.handleMarketTypeAndParams("fetchPositions",i,t);const[o,n]=this.handleMarginModeAndParams("fetchPositions",t);if(void 0!==o&&(a="margin"),void 0!==i){s["swap"===a?"instrument_id":"symbol"]=i.id}let d;if("spot"===a||"margin"===a)d=await this.privateSpotGetMarginPositions(this.extend(s,n));else{if("swap"!==a)throw new r.NotSupported(this.id+" fetchPositions() not support this market type");d=await this.privateSwapGetAccountPositions(this.extend(s,n))}const h="swap"===a?"data":"positions",c=this.safeValue(d,h,[]),l=[];for(let e=0;e100)throw new r.BadRequest(this.id+" leverage should be between 1 and 100");const a={instrument_id:i.id,leverage:e},o=this.safeString2(this.options,"marginMode","defaultMarginMode");let n=this.safeStringLower2(s,"marginMode","defaultMarginMode",o);if(void 0!==n&&(n="cross"===n?"crossed":"isolated",a.margin_mode=n,s=this.omit(s,["marginMode","defaultMarginMode"])),"isolated"===n){const e=this.safeString(s,"side");void 0!==e?(a.side=e,s=this.omit(s,"side")):this.checkRequiredArgument("setLeverage",e,"side",["long","short"])}return await this.privateSwapPostAccountLeverage(this.extend(a,s))}async fetchTransfers(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets();const a={};void 0!==e&&(r=this.safeCurrencyCode(e),a.currency=r.id),void 0!==t&&(a.start_timestamp=t),void 0!==s&&(a.limit=s);const o=await this.privateSwapGetAccountTransferRecord(this.extend(a,i)),n=this.safeList(o,"data",[]);return this.parseTransfers(n,r,t,s)}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const s=await this.publicSwapGetPublicInstruments(t),i=this.safeValue(s,"data",[]);return e=this.marketSymbols(e),this.parseLeverageTiers(i,e,"instrument_id")}async fetchMarketLeverageTiers(e,t={}){await this.loadMarkets();const s=this.market(e);if(!s.swap)throw new r.BadRequest(this.id+" fetchMarketLeverageTiers() supports swap markets only");const i={instrument_id:s.id},a=await this.publicSwapGetPublicInstrument(this.extend(i,t)),o=this.safeValue(a,"data",{});return this.parseMarketLeverageTiers(o,s)}parseMarketLeverageTiers(e,t=void 0){const s=[],i=this.safeValue(e,"open_max_limits",{});for(let r=0;r{s.d(t,{Z:()=>d});var i=s(4680),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"exmo",name:"EXMO",countries:["LT"],rateLimit:350,version:"v1.1",has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,addMargin:!0,cancelOrder:!0,cancelOrders:!1,createDepositAddress:!1,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchCanceledOrders:!0,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:"emulated",fetchOrderBook:!0,fetchOrderBooks:!0,fetchOrderTrades:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactionFees:!0,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!0,setMargin:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1","5m":"5","15m":"15","30m":"30","45m":"45","1h":"60","2h":"120","3h":"180","4h":"240","1d":"D","1w":"W","1M":"M"},urls:{logo:"https://user-images.githubusercontent.com/1294454/27766491-1b0ea956-5eda-11e7-9225-40d67b481b8d.jpg",api:{public:"https://api.exmo.com",private:"https://api.exmo.com",web:"https://exmo.me"},www:"https://exmo.me",referral:"https://exmo.me/?ref=131685",doc:["https://exmo.me/en/api_doc?ref=131685"],fees:"https://exmo.com/en/docs/fees"},api:{web:{get:["ctrl/feesAndLimits","en/docs/fees"]},public:{get:["currency","currency/list/extended","order_book","pair_settings","ticker","trades","candles_history","required_amount","payments/providers/crypto/list"]},private:{post:["user_info","order_create","order_cancel","stop_market_order_create","stop_market_order_cancel","user_open_orders","user_trades","user_cancelled_orders","order_trades","deposit_address","withdraw_crypt","withdraw_get_txid","excode_create","excode_load","code_check","wallet_history","wallet_operations","margin/user/order/create","margin/user/order/update","margin/user/order/cancel","margin/user/position/close","margin/user/position/margin_add","margin/user/position/margin_remove","margin/currency/list","margin/pair/list","margin/settings","margin/funding/list","margin/user/info","margin/user/order/list","margin/user/order/history","margin/user/order/trades","margin/user/order/max_quantity","margin/user/position/list","margin/user/position/margin_remove_info","margin/user/position/margin_add_info","margin/user/wallet/list","margin/user/wallet/history","margin/user/trade/list","margin/trades","margin/liquidation/feed"]}},fees:{trading:{feeSide:"get",tierBased:!0,percentage:!0,maker:this.parseNumber("0.004"),taker:this.parseNumber("0.004")},transaction:{tierBased:!1,percentage:!1}},options:{networks:{ETH:"ERC20",TRX:"TRC20"},fetchTradingFees:{method:"fetchPrivateTradingFees"},margin:{fillResponseFromRequest:!0}},commonCurrencies:{GMT:"GMT Token"},precisionMode:o.sh,exceptions:{exact:{140434:r.BadRequest,40005:r.AuthenticationError,40009:r.InvalidNonce,40015:r.ExchangeError,40016:r.OnMaintenance,40017:r.AuthenticationError,40032:r.PermissionDenied,40033:r.PermissionDenied,40034:r.RateLimitExceeded,50052:r.InsufficientFunds,50054:r.InsufficientFunds,50304:r.OrderNotFound,50173:r.OrderNotFound,50277:r.InvalidOrder,50319:r.InvalidOrder,50321:r.InvalidOrder,50381:r.InvalidOrder},broad:{"range period is too long":r.BadRequest,"invalid syntax":r.BadRequest,"API rate limit exceeded":r.RateLimitExceeded}}})}async modifyMarginHelper(e,t,s,i={}){await this.loadMarkets();const r=this.market(e),a={position_id:r.id,quantity:t};let o;"add"===s?o=await this.privatePostMarginUserPositionMarginAdd(this.extend(a,i)):"reduce"===s&&(o=await this.privatePostMarginUserPositionMarginRemove(this.extend(a,i)));const n=this.parseMarginModification(o,r),d=this.safeValue(this.options,"margin",{});return this.safeBool(d,"fillResponseFromRequest",!0)&&(n.type=s,n.amount=t),n}parseMarginModification(e,t=void 0){return{info:e,symbol:this.safeSymbol(void 0,t),type:void 0,marginMode:"isolated",amount:void 0,total:void 0,code:this.safeValue(t,"quote"),status:"ok",timestamp:void 0,datetime:void 0}}async reduceMargin(e,t,s={}){return await this.modifyMarginHelper(e,t,"reduce",s)}async addMargin(e,t,s={}){return await this.modifyMarginHelper(e,t,"add",s)}async fetchTradingFees(e={}){const t=this.safeValue(this.options,"fetchTradingFees",{}),s=this.safeString(t,"method","fetchPrivateTradingFees"),i=this.safeString(e,"method",s);return e=this.omit(e,"method"),"fetchPrivateTradingFees"===i?await this.fetchPrivateTradingFees(e):await this.fetchPublicTradingFees(e)}async fetchPrivateTradingFees(e={}){await this.loadMarkets();const t=await this.privatePostMarginPairList(e),s=this.safeValue(t,"pairs",[]),i={};for(let e=0;e=0,s=e.split(" ")[0].replace("%",""),i=parseFloat(s);if(i>0&&t)throw new r.ExchangeError(this.id+" parseFixedFloatValue() detected an unsupported non-zero percentage-based fee "+e);return i}async fetchTransactionFees(e=void 0,t={}){await this.loadMarkets();const s=await this.publicGetPaymentsProvidersCryptoList(t),i={},r=Object.keys(s);for(let t=0;t=2}void 0===this.safeValue(s.networks,n)&&(s.networks[n]={withdraw:{fee:void 0,percentage:void 0},deposit:{fee:void 0,percentage:void 0}}),s.networks[n][a]={fee:this.parseFixedFloatValue(this.safeString(c,0)),percentage:h}}return this.assignDefaultDepositWithdrawFees(s)}async fetchCurrencies(e={}){const t=await this.publicGetCurrencyListExtended(e),s=await this.publicGetPaymentsProvidersCryptoList(e),i={};for(let e=0;e2048){const e=this.ids.length;throw new r.ExchangeError(this.id+" fetchOrderBooks() has "+e.toString()+" symbols exceeding max URL length, you are required to specify a list of symbols in the first argument to fetchOrderBooks")}}else i=this.marketIds(e),i=i.join(",");const a={pair:i};void 0!==t&&(a.limit=t);const o=await this.publicGetOrderBook(this.extend(a,s)),n={},d=Object.keys(o);for(let e=0;e=0&&(e="canceled"),this.safeString({cancel_started:"canceled"},e,e)}parseSide(e){return this.safeString({limit_buy:"buy",limit_sell:"sell",market_buy:"buy",market_sell:"sell",stop_buy:"buy",stop_sell:"sell",stop_limit_buy:"buy",stop_limit_sell:"sell",trailing_stop_buy:"buy",trailing_stop_sell:"sell",stop_market_sell:"sell",stop_market_buy:"buy",buy:"buy",sell:"sell"},e,e)}parseOrder(e,t=void 0){const s=this.safeString2(e,"order_id","parent_order_id"),i=this.safeIntegerProduct2(e,"event_time","created",1e-6),r=this.safeTimestamp(e,"created",i),a=this.safeString2(e,"type","order_type"),o=this.parseSide(a);let n;"pair"in e?n=e.pair:"in_currency"in e&&"out_currency"in e&&(n="buy"===o?e.in_currency+"_"+e.out_currency:e.out_currency+"_"+e.in_currency);const d=(t=this.safeMarket(n,t)).symbol;let h=this.safeString(e,"quantity");if(void 0===h){const t="buy"===o?"in_amount":"out_amount";h=this.safeString(e,t)}const c=this.safeString(e,"price"),l=this.safeString(e,"amount"),u=this.safeValue(e,"trades",[]),p=this.safeInteger(e,"client_id");let f,m=this.safeString(e,"stop_price");return"0"===m&&(m=void 0),"buy"!==a&&"sell"!==a&&(f=a),this.safeOrder({id:s,clientOrderId:p,datetime:this.iso8601(r),timestamp:r,lastTradeTimestamp:this.safeIntegerProduct(e,"updated",1e-6),status:this.parseStatus(this.safeString(e,"order_status")),symbol:d,type:f,timeInForce:void 0,postOnly:void 0,side:o,price:c,stopPrice:m,triggerPrice:m,cost:l,amount:h,filled:void 0,remaining:void 0,average:void 0,trades:u,fee:void 0,info:e},t)}async fetchCanceledOrders(e=void 0,t=void 0,s=void 0,i={}){let a;if(await this.loadMarkets(),[a,i]=this.handleMarginModeAndParams("fetchOrders",i),"cross"===a)throw new r.BadRequest(this.id+" only supports isolated margin");void 0===s&&(s=100);const o="isolated"!==a;if(void 0!==e){e=this.market(e).symbol}const n={limit:s};let d,h;if(n.offset=void 0!==t?s:0,n.limit=s,void 0!==e&&(d=this.market(e)),o)return h=await this.privatePostUserCancelledOrders(this.extend(n,i)),i=this.extend(i,{status:"canceled"}),this.parseOrders(h,d,t,s,i);{const e=await this.privatePostMarginUserOrderHistory(this.extend(n,i)),r=this.safeValue(e,"items"),a=this.parseOrders(r,d,t,s,i),o=[];for(let e=0;e1&&(a=e[1])}return this.checkAddress(r),{currency:e,address:r,tag:a,network:void 0,info:s}}getMarketFromTrades(e){const t=this.indexBy(e,"pair"),s=Object.keys(t);if(1===s.length)return this.markets[s[0]]}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),await this.loadMarkets();const a=this.currency(e),o={amount:t,currency:a.id,address:s};void 0!==i&&(o.invoice=i);const n=this.safeValue(this.options,"networks",{});let d=this.safeStringUpper(r,"network");d=this.safeString(n,d,d),void 0!==d&&(o.transport=d,r=this.omit(r,"network"));const h=await this.privatePostWithdrawCrypt(this.extend(o,r));return this.parseTransaction(h,a)}parseTransactionStatus(e){return this.safeString({transferred:"ok",paid:"ok",pending:"pending",processing:"pending",verifying:"pending"},e,e)}parseTransaction(e,t=void 0){const s=this.safeTimestamp2(e,"dt","created");let i=this.safeString(e,"amount");void 0!==i&&(i=a.O.stringAbs(i));let r=this.safeString(e,"txid");if(void 0===r){const t=this.safeValue(e,"extra",{}),s=this.safeString(t,"txid");""!==s&&(r=s)}const o=this.safeString(e,"type"),n=this.safeString2(e,"curr","currency"),d=this.safeCurrencyCode(n,t);let h,c;const l=this.safeString(e,"account");if("deposit"===o)c=l;else if("withdrawal"===o&&(h=l,void 0!==h)){const e=h.split(":");2===e.length&&(h=this.safeString(e,1),h=h.replace(" ",""))}const u={currency:void 0,cost:void 0,rate:void 0};if(!this.fees.transaction.percentage){const t="withdrawal"===o?"withdraw":"deposit";let s=this.safeString(e,"commission");if(void 0===s){const e=this.safeValue(this.options,"transactionFees",{}),i=this.safeValue(e,d,{});s=this.safeString(i,t)}"cashback"===this.safeString(e,"provider")&&(s="0"),void 0!==s&&("withdrawal"===o&&(i=a.O.stringSub(i,s)),u.cost=this.parseNumber(s),u.currency=d)}return{info:e,id:this.safeString2(e,"order_id","task_id"),txid:r,type:o,currency:d,network:this.safeString(e,"provider"),amount:this.parseNumber(i),status:this.parseTransactionStatus(this.safeStringLower(e,"status")),timestamp:s,datetime:this.iso8601(s),address:h,addressFrom:void 0,addressTo:h,tag:void 0,tagFrom:void 0,tagTo:void 0,updated:this.safeTimestamp(e,"updated"),comment:c,internal:void 0,fee:u}}async fetchDepositsWithdrawals(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};let a;void 0!==t&&(r.date=this.parseToInt(t/1e3)),void 0!==e&&(a=this.currency(e));const o=await this.privatePostWalletHistory(this.extend(r,i));return this.parseTransactions(o.history,a,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets();const a={type:"withdraw"};void 0!==s&&(a.limit=s),void 0!==e&&(r=this.currency(e),a.currency=r.id);const o=await this.privatePostWalletOperations(this.extend(a,i)),n=this.safeList(o,"items",[]);return this.parseTransactions(n,r,t,s)}async fetchWithdrawal(e,t=void 0,s={}){let i;await this.loadMarkets();const r={order_id:e,type:"withdraw"};void 0!==t&&(i=this.currency(t),r.currency=i.id);const a=await this.privatePostWalletOperations(this.extend(r,s)),o=this.safeValue(a,"items",[]),n=this.safeDict(o,0,{});return this.parseTransaction(n,i)}async fetchDeposit(e=void 0,t=void 0,s={}){let i;await this.loadMarkets();const r={order_id:e,type:"deposit"};void 0!==t&&(i=this.currency(t),r.currency=i.id);const a=await this.privatePostWalletOperations(this.extend(r,s)),o=this.safeValue(a,"items",[]),n=this.safeDict(o,0,{});return this.parseTransaction(n,i)}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets();const a={type:"deposit"};void 0!==s&&(a.limit=s),void 0!==e&&(r=this.currency(e),a.currency=r.id);const o=await this.privatePostWalletOperations(this.extend(a,i)),n=this.safeList(o,"items",[]);return this.parseTransactions(n,r,t,s)}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o=this.urls.api[t]+"/";if("web"!==t&&(o+=this.version+"/"),o+=e,"public"===t||"web"===t)Object.keys(i).length&&(o+="?"+this.urlencode(i));else if("private"===t){this.checkRequiredCredentials();const e=this.nonce();a=this.urlencode(this.extend({nonce:e},i)),r={"Content-Type":"application/x-www-form-urlencoded",Key:this.apiKey,Sign:this.hmac(this.encode(a),this.encode(this.secret),n.o)}}return{url:o,method:s,body:a,headers:r}}nonce(){return this.milliseconds()}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0!==n){if("error"in n&&!("result"in n)){const e=this.safeValue(n,"error",{}),t=this.safeString(e,"msg"),s=this.safeString(e,"code"),i=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,s,i),this.throwBroadlyMatchedException(this.exceptions.broad,t,i),new r.ExchangeError(i)}if("result"in n||"errmsg"in n){let e=this.safeBool(n,"result",!1);if("string"==typeof e&&(e="true"===e||"1"===e),!e){let e;const t=this.safeString2(n,"error","errmsg"),s=t.split(":");if(s.length>1){const t=s[0].split(" ");e=t.length>1?t[1]:t[0]}const i=this.id+" "+o;throw this.throwExactlyMatchedException(this.exceptions.exact,e,i),this.throwBroadlyMatchedException(this.exceptions.broad,t,i),new r.ExchangeError(i)}}}}}},5788:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(4714);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"fmfwio",name:"FMFW.io",countries:["KN"],urls:{logo:"https://user-images.githubusercontent.com/1294454/159177712-b685b40c-5269-4cea-ac83-f7894c49525d.jpg",api:{public:"https://api.fmfw.io/api/3",private:"https://api.fmfw.io/api/3"},www:"https://fmfw.io",doc:"https://api.fmfw.io/",fees:"https://fmfw.io/fees-and-limits",referral:"https://fmfw.io/referral/da948b21d6c92d69"},fees:{trading:{maker:this.parseNumber("0.005"),taker:this.parseNumber("0.005")}}})}}},7290:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(2465),r=s(2194),a=s(9292),o=s(6689),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"gate",name:"Gate.io",countries:["KR"],rateLimit:50,version:"v4",certified:!0,pro:!0,urls:{logo:"https://user-images.githubusercontent.com/1294454/31784029-0313c702-b509-11e7-9ccc-bc0da6a0e435.jpg",doc:"https://www.gate.io/docs/developers/apiv4/en/",www:"https://gate.io/",api:{public:{wallet:"https://api.gateio.ws/api/v4",futures:"https://api.gateio.ws/api/v4",margin:"https://api.gateio.ws/api/v4",delivery:"https://api.gateio.ws/api/v4",spot:"https://api.gateio.ws/api/v4",options:"https://api.gateio.ws/api/v4",sub_accounts:"https://api.gateio.ws/api/v4",earn:"https://api.gateio.ws/api/v4"},private:{withdrawals:"https://api.gateio.ws/api/v4",wallet:"https://api.gateio.ws/api/v4",futures:"https://api.gateio.ws/api/v4",margin:"https://api.gateio.ws/api/v4",delivery:"https://api.gateio.ws/api/v4",spot:"https://api.gateio.ws/api/v4",options:"https://api.gateio.ws/api/v4",subAccounts:"https://api.gateio.ws/api/v4",unified:"https://api.gateio.ws/api/v4",rebate:"https://api.gateio.ws/api/v4",earn:"https://api.gateio.ws/api/v4",account:"https://api.gateio.ws/api/v4",loan:"https://api.gateio.ws/api/v4"}},test:{public:{futures:"https://fx-api-testnet.gateio.ws/api/v4",delivery:"https://fx-api-testnet.gateio.ws/api/v4",options:"https://fx-api-testnet.gateio.ws/api/v4"},private:{futures:"https://fx-api-testnet.gateio.ws/api/v4",delivery:"https://fx-api-testnet.gateio.ws/api/v4",options:"https://fx-api-testnet.gateio.ws/api/v4"}},referral:{url:"https://www.gate.io/signup/2436035",discount:.2}},has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:!0,addMargin:!0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,createMarketBuyOrderWithCost:!0,createMarketOrder:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!1,createStopOrder:!0,createTakeProfitOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchGreeks:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLeverage:!0,fetchLeverages:!0,fetchLeverageTiers:!0,fetchLiquidations:!0,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!0,fetchMySettlementHistory:!0,fetchMyTrades:!0,fetchNetworkDepositAddress:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!0,fetchOpenOrders:!0,fetchOption:!0,fetchOptionChain:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!0,fetchPremiumIndexOHLCV:!1,fetchSettlementHistory:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactionFees:!0,fetchUnderlyingAssets:!0,fetchVolatilityHistory:!1,fetchWithdrawals:!0,reduceMargin:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!0,signIn:!1,transfer:!0,withdraw:!0},api:{public:{wallet:{get:{currency_chains:1}},spot:{get:{currencies:1,"currencies/{currency}":1,currency_pairs:1,"currency_pairs/{currency_pair}":1,tickers:1,order_book:1,trades:1,candlesticks:1,time:1}},margin:{get:{currency_pairs:1,"currency_pairs/{currency_pair}":1,funding_book:1,"cross/currencies":1,"cross/currencies/{currency}":1,"uni/currency_pairs":1,"uni/currency_pairs/{currency_pair}":1}},flash_swap:{get:{currencies:1}},futures:{get:{"{settle}/contracts":1,"{settle}/contracts/{contract}":1,"{settle}/order_book":1,"{settle}/trades":1,"{settle}/candlesticks":1,"{settle}/premium_index":1,"{settle}/tickers":1,"{settle}/funding_rate":1,"{settle}/insurance":1,"{settle}/contract_stats":1,"{settle}/index_constituents/{index}":1,"{settle}/liq_orders":1}},delivery:{get:{"{settle}/contracts":1,"{settle}/contracts/{contract}":1,"{settle}/order_book":1,"{settle}/trades":1,"{settle}/candlesticks":1,"{settle}/tickers":1,"{settle}/insurance":1}},options:{get:{underlyings:1,expirations:1,contracts:1,"contracts/{contract}":1,settlements:1,"settlements/{contract}":1,order_book:1,tickers:1,"underlying/tickers/{underlying}":1,candlesticks:1,"underlying/candlesticks":1,trades:1}},earn:{get:{"uni/currencies":1,"uni/currencies/{currency}":1}}},private:{withdrawals:{post:{withdrawals:20},delete:{"withdrawals/{withdrawal_id}":1}},wallet:{get:{deposit_address:1,withdrawals:1,deposits:1,sub_account_transfers:1,withdraw_status:1,sub_account_balances:2.5,sub_account_margin_balances:2.5,sub_account_futures_balances:2.5,sub_account_cross_margin_balances:2.5,saved_address:1,fee:1,total_balance:2.5,small_balance:1,small_balance_history:1},post:{transfers:2.5,sub_account_transfers:2.5,sub_account_to_sub_account:2.5,small_balance:1}},subAccounts:{get:{sub_accounts:2.5,"sub_accounts/{user_id}":2.5,"sub_accounts/{user_id}/keys":2.5,"sub_accounts/{user_id}/keys/{key}":2.5},post:{sub_accounts:2.5,"sub_accounts/{user_id}/keys":2.5,"sub_accounts/{user_id}/lock":2.5,"sub_accounts/{user_id}/unlock":2.5},put:{"sub_accounts/{user_id}/keys/{key}":2.5},delete:{"sub_accounts/{user_id}/keys/{key}":2.5}},unified:{get:{accounts:20/15,account_mode:20/15,borrowable:20/15,transferable:20/15,loans:20/15,loan_records:20/15,interest_records:20/15,estimate_rate:20/15,currency_discount_tiers:20/15},post:{account_mode:20/15,loans:200/15}},spot:{get:{fee:1,batch_fee:1,accounts:1,account_book:1,open_orders:1,orders:1,"orders/{order_id}":1,my_trades:1,price_orders:1,"price_orders/{order_id}":1},post:{batch_orders:.4,cross_liquidate_orders:1,orders:.4,cancel_batch_orders:20/75,countdown_cancel_all:20/75,amend_batch_orders:.4,price_orders:.4},delete:{orders:20/75,"orders/{order_id}":20/75,price_orders:20/75,"price_orders/{order_id}":20/75},patch:{"orders/{order_id}":.4}},margin:{get:{accounts:20/15,account_book:20/15,funding_accounts:20/15,auto_repay:20/15,transferable:20/15,loans:20/15,"loans/{loan_id}":20/15,"loans/{loan_id}/repayment":20/15,loan_records:20/15,"loan_records/{loan_record_id}":20/15,borrowable:20/15,"cross/accounts":20/15,"cross/account_book":20/15,"cross/loans":20/15,"cross/loans/{loan_id}":20/15,"cross/repayments":20/15,"cross/interest_records":20/15,"cross/transferable":20/15,"cross/estimate_rate":20/15,"cross/borrowable":20/15,"uni/estimate_rate":20/15,"uni/loans":20/15,"uni/loan_records":20/15,"uni/interest_records":20/15,"uni/borrowable":20/15},post:{auto_repay:20/15,loans:20/15,merged_loans:20/15,"loans/{loan_id}/repayment":20/15,"cross/loans":20/15,"cross/repayments":20/15,"uni/loans":20/15},patch:{"loans/{loan_id}":20/15,"loan_records/{loan_record_id}":20/15},delete:{"loans/{loan_id}":20/15}},flash_swap:{get:{currencies:1,currency_pairs:1,orders:1,"orders/{order_id}":1},post:{orders:1,"orders/preview":1}},futures:{get:{"{settle}/accounts":1,"{settle}/account_book":1,"{settle}/positions":1,"{settle}/positions/{contract}":1,"{settle}/dual_comp/positions/{contract}":1,"{settle}/orders":1,"{settle}/orders_timerange":1,"{settle}/orders/{order_id}":1,"{settle}/my_trades":1,"{settle}/my_trades_timerange":1,"{settle}/position_close":1,"{settle}/liquidates":1,"{settle}/auto_deleverages":1,"{settle}/fee":1,"{settle}/risk_limit_tiers":1,"{settle}/price_orders":1,"{settle}/price_orders/{order_id}":1},post:{"{settle}/positions/{contract}/margin":1,"{settle}/positions/{contract}/leverage":1,"{settle}/positions/{contract}/risk_limit":1,"{settle}/dual_mode":1,"{settle}/dual_comp/positions/{contract}/margin":1,"{settle}/dual_comp/positions/{contract}/leverage":1,"{settle}/dual_comp/positions/{contract}/risk_limit":1,"{settle}/orders":.4,"{settle}/batch_orders":.4,"{settle}/countdown_cancel_all":.4,"{settle}/batch_cancel_orders":.4,"{settle}/price_orders":.4},put:{"{settle}/orders/{order_id}":1},delete:{"{settle}/orders":20/75,"{settle}/orders/{order_id}":20/75,"{settle}/price_orders":20/75,"{settle}/price_orders/{order_id}":20/75}},delivery:{get:{"{settle}/accounts":20/15,"{settle}/account_book":20/15,"{settle}/positions":20/15,"{settle}/positions/{contract}":20/15,"{settle}/orders":20/15,"{settle}/orders/{order_id}":20/15,"{settle}/my_trades":20/15,"{settle}/position_close":20/15,"{settle}/liquidates":20/15,"{settle}/settlements":20/15,"{settle}/price_orders":20/15,"{settle}/price_orders/{order_id}":20/15},post:{"{settle}/positions/{contract}/margin":20/15,"{settle}/positions/{contract}/leverage":20/15,"{settle}/positions/{contract}/risk_limit":20/15,"{settle}/orders":20/15,"{settle}/price_orders":20/15},delete:{"{settle}/orders":20/15,"{settle}/orders/{order_id}":20/15,"{settle}/price_orders":20/15,"{settle}/price_orders/{order_id}":20/15}},options:{get:{my_settlements:20/15,accounts:20/15,account_book:20/15,positions:20/15,"positions/{contract}":20/15,position_close:20/15,orders:20/15,"orders/{order_id}":20/15,my_trades:20/15},post:{orders:20/15},delete:{orders:20/15,"orders/{order_id}":20/15}},earn:{get:{"uni/currencies":20/15,"uni/currencies/{currency}":20/15,"uni/lends":20/15,"uni/lend_records":20/15,"uni/interests/{currency}":20/15,"uni/interest_records":20/15,"uni/interest_status/{currency}":20/15},post:{"uni/lends":20/15},put:{"uni/interest_reinvest":20/15},patch:{"uni/lends":20/15}},loan:{get:{"collateral/orders":20/15,"collateral/orders/{order_id}":20/15,"collateral/repay_records":20/15,"collateral/collaterals":20/15,"collateral/total_amount":20/15,"collateral/ltv":20/15,"collateral/currencies":20/15,"multi_collateral/orders":20/15,"multi_collateral/orders/{order_id}":20/15,"multi_collateral/repay":20/15,"multi_collateral/mortgage":20/15,"multi_collateral/currency_quota":20/15,"multi_collateral/currencies":20/15,"multi_collateral/ltv":20/15,"multi_collateral/fixed_rate":20/15},post:{"collateral/orders":20/15,"collateral/repay":20/15,"collateral/collaterals":20/15,"multi_collateral/orders":20/15,"multi_collateral/repay":20/15,"multi_collateral/mortgage":20/15}},account:{get:{detail:20/15,stp_groups:20/15,"stp_groups/{stp_id}/users":20/15},post:{stp_groups:20/15,"stp_groups/{stp_id}/users":20/15},delete:{"stp_groups/{stp_id}/users":20/15}},rebate:{get:{"agency/transaction_history":20/15,"agency/commission_history":20/15}}}},timeframes:{"10s":"10s","1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","8h":"8h","1d":"1d","7d":"7d","1w":"7d"},commonCurrencies:{"88MPH":"MPH",AXIS:"Axis DeFi",BIFI:"Bitcoin File",BOX:"DefiBox",BYN:"BeyondFi",EGG:"Goose Finance",GTC:"Game.com",GTC_HT:"Game.com HT",GTC_BSC:"Game.com BSC",HIT:"HitChain",MM:"Million",MPH:"Morpher",POINT:"GatePoint",RAI:"Rai Reflex Index",SBTC:"Super Bitcoin",TNC:"Trinity Network Credit",VAI:"VAIOT",TRAC:"TRACO"},requiredCredentials:{apiKey:!0,secret:!0},headers:{"X-Gate-Channel-Id":"ccxt"},options:{sandboxMode:!1,createOrder:{expiration:86400},networks:{AVAXC:"AVAX_C",BEP20:"BSC",EOS:"EOS",ERC20:"ETH",GATECHAIN:"GTEVM",HRC20:"HT",KUSAMA:"KSMSM",NEAR:"NEAR",OKC:"OKT",OPTIMISM:"OPETH",POLKADOT:"DOTSM",TRC20:"TRX"},timeInForce:{GTC:"gtc",IOC:"ioc",PO:"poc",POC:"poc",FOK:"fok"},accountsByType:{funding:"spot",spot:"spot",margin:"margin",cross_margin:"cross_margin",cross:"cross_margin",isolated:"margin",swap:"futures",future:"delivery",futures:"futures",delivery:"delivery",option:"options",options:"options"},swap:{fetchMarkets:{settlementCurrencies:["usdt","btc"]}},future:{fetchMarkets:{settlementCurrencies:["usdt"]}}},precisionMode:a.sh,fees:{trading:{tierBased:!0,feeSide:"get",percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("1.5"),this.parseNumber("0.00185")],[this.parseNumber("3"),this.parseNumber("0.00175")],[this.parseNumber("6"),this.parseNumber("0.00165")],[this.parseNumber("12.5"),this.parseNumber("0.00155")],[this.parseNumber("25"),this.parseNumber("0.00145")],[this.parseNumber("75"),this.parseNumber("0.00135")],[this.parseNumber("200"),this.parseNumber("0.00125")],[this.parseNumber("500"),this.parseNumber("0.00115")],[this.parseNumber("1250"),this.parseNumber("0.00105")],[this.parseNumber("2500"),this.parseNumber("0.00095")],[this.parseNumber("3000"),this.parseNumber("0.00085")],[this.parseNumber("6000"),this.parseNumber("0.00075")],[this.parseNumber("11000"),this.parseNumber("0.00065")],[this.parseNumber("20000"),this.parseNumber("0.00055")],[this.parseNumber("40000"),this.parseNumber("0.00055")],[this.parseNumber("75000"),this.parseNumber("0.00055")]],taker:[[this.parseNumber("0"),this.parseNumber("0.002")],[this.parseNumber("1.5"),this.parseNumber("0.00195")],[this.parseNumber("3"),this.parseNumber("0.00185")],[this.parseNumber("6"),this.parseNumber("0.00175")],[this.parseNumber("12.5"),this.parseNumber("0.00165")],[this.parseNumber("25"),this.parseNumber("0.00155")],[this.parseNumber("75"),this.parseNumber("0.00145")],[this.parseNumber("200"),this.parseNumber("0.00135")],[this.parseNumber("500"),this.parseNumber("0.00125")],[this.parseNumber("1250"),this.parseNumber("0.00115")],[this.parseNumber("2500"),this.parseNumber("0.00105")],[this.parseNumber("3000"),this.parseNumber("0.00095")],[this.parseNumber("6000"),this.parseNumber("0.00085")],[this.parseNumber("11000"),this.parseNumber("0.00075")],[this.parseNumber("20000"),this.parseNumber("0.00065")],[this.parseNumber("40000"),this.parseNumber("0.00065")],[this.parseNumber("75000"),this.parseNumber("0.00065")]]}},swap:{tierBased:!0,feeSide:"base",percentage:!0,maker:this.parseNumber("0.0"),taker:this.parseNumber("0.0005"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.0000")],[this.parseNumber("1.5"),this.parseNumber("-0.00005")],[this.parseNumber("3"),this.parseNumber("-0.00005")],[this.parseNumber("6"),this.parseNumber("-0.00005")],[this.parseNumber("12.5"),this.parseNumber("-0.00005")],[this.parseNumber("25"),this.parseNumber("-0.00005")],[this.parseNumber("75"),this.parseNumber("-0.00005")],[this.parseNumber("200"),this.parseNumber("-0.00005")],[this.parseNumber("500"),this.parseNumber("-0.00005")],[this.parseNumber("1250"),this.parseNumber("-0.00005")],[this.parseNumber("2500"),this.parseNumber("-0.00005")],[this.parseNumber("3000"),this.parseNumber("-0.00008")],[this.parseNumber("6000"),this.parseNumber("-0.01000")],[this.parseNumber("11000"),this.parseNumber("-0.01002")],[this.parseNumber("20000"),this.parseNumber("-0.01005")],[this.parseNumber("40000"),this.parseNumber("-0.02000")],[this.parseNumber("75000"),this.parseNumber("-0.02005")]],taker:[[this.parseNumber("0"),this.parseNumber("0.00050")],[this.parseNumber("1.5"),this.parseNumber("0.00048")],[this.parseNumber("3"),this.parseNumber("0.00046")],[this.parseNumber("6"),this.parseNumber("0.00044")],[this.parseNumber("12.5"),this.parseNumber("0.00042")],[this.parseNumber("25"),this.parseNumber("0.00040")],[this.parseNumber("75"),this.parseNumber("0.00038")],[this.parseNumber("200"),this.parseNumber("0.00036")],[this.parseNumber("500"),this.parseNumber("0.00034")],[this.parseNumber("1250"),this.parseNumber("0.00032")],[this.parseNumber("2500"),this.parseNumber("0.00030")],[this.parseNumber("3000"),this.parseNumber("0.00030")],[this.parseNumber("6000"),this.parseNumber("0.00030")],[this.parseNumber("11000"),this.parseNumber("0.00030")],[this.parseNumber("20000"),this.parseNumber("0.00030")],[this.parseNumber("40000"),this.parseNumber("0.00030")],[this.parseNumber("75000"),this.parseNumber("0.00030")]]}}},exceptions:{exact:{INVALID_PARAM_VALUE:o.BadRequest,INVALID_PROTOCOL:o.BadRequest,INVALID_ARGUMENT:o.BadRequest,INVALID_REQUEST_BODY:o.BadRequest,MISSING_REQUIRED_PARAM:o.ArgumentsRequired,BAD_REQUEST:o.BadRequest,INVALID_CONTENT_TYPE:o.BadRequest,NOT_ACCEPTABLE:o.BadRequest,METHOD_NOT_ALLOWED:o.BadRequest,NOT_FOUND:o.ExchangeError,INVALID_CREDENTIALS:o.AuthenticationError,INVALID_KEY:o.AuthenticationError,IP_FORBIDDEN:o.AuthenticationError,READ_ONLY:o.PermissionDenied,INVALID_SIGNATURE:o.AuthenticationError,MISSING_REQUIRED_HEADER:o.AuthenticationError,REQUEST_EXPIRED:o.AuthenticationError,ACCOUNT_LOCKED:o.AccountSuspended,FORBIDDEN:o.PermissionDenied,SUB_ACCOUNT_NOT_FOUND:o.ExchangeError,SUB_ACCOUNT_LOCKED:o.AccountSuspended,MARGIN_BALANCE_EXCEPTION:o.ExchangeError,MARGIN_TRANSFER_FAILED:o.ExchangeError,TOO_MUCH_FUTURES_AVAILABLE:o.ExchangeError,FUTURES_BALANCE_NOT_ENOUGH:o.InsufficientFunds,ACCOUNT_EXCEPTION:o.ExchangeError,SUB_ACCOUNT_TRANSFER_FAILED:o.ExchangeError,ADDRESS_NOT_USED:o.ExchangeError,TOO_FAST:o.RateLimitExceeded,WITHDRAWAL_OVER_LIMIT:o.ExchangeError,API_WITHDRAW_DISABLED:o.ExchangeNotAvailable,INVALID_WITHDRAW_ID:o.ExchangeError,INVALID_WITHDRAW_CANCEL_STATUS:o.ExchangeError,INVALID_PRECISION:o.InvalidOrder,INVALID_CURRENCY:o.BadSymbol,INVALID_CURRENCY_PAIR:o.BadSymbol,POC_FILL_IMMEDIATELY:o.OrderImmediatelyFillable,ORDER_NOT_FOUND:o.OrderNotFound,CLIENT_ID_NOT_FOUND:o.OrderNotFound,ORDER_CLOSED:o.InvalidOrder,ORDER_CANCELLED:o.InvalidOrder,QUANTITY_NOT_ENOUGH:o.InvalidOrder,BALANCE_NOT_ENOUGH:o.InsufficientFunds,MARGIN_NOT_SUPPORTED:o.InvalidOrder,MARGIN_BALANCE_NOT_ENOUGH:o.InsufficientFunds,AMOUNT_TOO_LITTLE:o.InvalidOrder,AMOUNT_TOO_MUCH:o.InvalidOrder,REPEATED_CREATION:o.InvalidOrder,LOAN_NOT_FOUND:o.OrderNotFound,LOAN_RECORD_NOT_FOUND:o.OrderNotFound,NO_MATCHED_LOAN:o.ExchangeError,NOT_MERGEABLE:o.ExchangeError,NO_CHANGE:o.ExchangeError,REPAY_TOO_MUCH:o.ExchangeError,TOO_MANY_CURRENCY_PAIRS:o.InvalidOrder,TOO_MANY_ORDERS:o.InvalidOrder,TOO_MANY_REQUESTS:o.RateLimitExceeded,MIXED_ACCOUNT_TYPE:o.InvalidOrder,AUTO_BORROW_TOO_MUCH:o.ExchangeError,TRADE_RESTRICTED:o.InsufficientFunds,USER_NOT_FOUND:o.AccountNotEnabled,CONTRACT_NO_COUNTER:o.ExchangeError,CONTRACT_NOT_FOUND:o.BadSymbol,RISK_LIMIT_EXCEEDED:o.ExchangeError,INSUFFICIENT_AVAILABLE:o.InsufficientFunds,LIQUIDATE_IMMEDIATELY:o.InvalidOrder,LEVERAGE_TOO_HIGH:o.InvalidOrder,LEVERAGE_TOO_LOW:o.InvalidOrder,ORDER_NOT_OWNED:o.ExchangeError,ORDER_FINISHED:o.ExchangeError,POSITION_CROSS_MARGIN:o.ExchangeError,POSITION_IN_LIQUIDATION:o.ExchangeError,POSITION_IN_CLOSE:o.ExchangeError,POSITION_EMPTY:o.InvalidOrder,REMOVE_TOO_MUCH:o.ExchangeError,RISK_LIMIT_NOT_MULTIPLE:o.ExchangeError,RISK_LIMIT_TOO_HIGH:o.ExchangeError,RISK_LIMIT_TOO_lOW:o.ExchangeError,PRICE_TOO_DEVIATED:o.InvalidOrder,SIZE_TOO_LARGE:o.InvalidOrder,SIZE_TOO_SMALL:o.InvalidOrder,PRICE_OVER_LIQUIDATION:o.InvalidOrder,PRICE_OVER_BANKRUPT:o.InvalidOrder,ORDER_POC_IMMEDIATE:o.OrderImmediatelyFillable,INCREASE_POSITION:o.InvalidOrder,CONTRACT_IN_DELISTING:o.ExchangeError,INTERNAL:o.ExchangeNotAvailable,SERVER_ERROR:o.ExchangeNotAvailable,TOO_BUSY:o.ExchangeNotAvailable,CROSS_ACCOUNT_NOT_FOUND:o.ExchangeError,RISK_LIMIT_TOO_LOW:o.BadRequest,AUTO_TRIGGER_PRICE_LESS_LAST:o.InvalidOrder,AUTO_TRIGGER_PRICE_GREATE_LAST:o.InvalidOrder,POSITION_HOLDING:o.BadRequest,USER_LOAN_EXCEEDED:o.BadRequest},broad:{}}})}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}createExpiredOptionMarket(e){const t="USDT",s=t,i=e.split("-"),r=e.split("/"),a=e.split("_");let o,n=this.safeString(i,1);e.indexOf("/")>-1?o=this.safeString(r,0):(o=this.safeString(a,0),n=n.slice(2,8));const d=this.safeString(i,2),h=this.safeString(i,3),c=this.convertExpireDate(n),l=this.parse8601(c);return{id:o+"_"+t+"-20"+n+"-"+d+"-"+h,symbol:o+"/"+t+":"+s+"-"+n+"-"+d+"-"+h,base:o,quote:t,settle:s,baseId:o,quoteId:t,settleId:s,active:!1,type:"option",linear:void 0,inverse:void 0,spot:!1,swap:!1,future:!1,option:!0,margin:!1,contract:!0,contractSize:this.parseNumber("1"),expiry:l,expiryDatetime:c,optionType:"C"===h?"call":"put",strike:this.parseNumber(d),precision:{amount:this.parseNumber("1"),price:void 0},limits:{amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},info:void 0}}safeMarket(e=void 0,t=void 0,s=void 0,i=void 0){return void 0!==e&&(e.indexOf("-C")>-1||e.indexOf("-P")>-1)&&!(e in this.markets_by_id)?this.createExpiredOptionMarket(e):super.safeMarket(e,t,s,i)}async fetchMarkets(e={}){const t=this.safeBool(this.options,"sandboxMode",!1);let s=[this.fetchContractMarkets(e),this.fetchOptionMarkets(e)];if(!t){const t=[this.fetchSpotMarkets(e)];s=this.arrayConcat(s,t)}const i=await Promise.all(s),r=this.safeValue(i,0,[]),a=this.safeValue(i,1,[]),o=this.safeValue(i,2,[]),n=this.arrayConcat(r,a);return this.arrayConcat(n,o)}async fetchSpotMarkets(e={}){const t=await this.publicMarginGetCurrencyPairs(e),s=await this.publicSpotGetCurrencyPairs(e),i=this.indexBy(t,"id"),a=[];for(let e=0;e=0)throw new o.BadResponse(this.id+" New address is being generated for you, please wait a few seconds and try again to get the address.");if(e.indexOf(" ")>=0){const t=e.split(" ");l=t[0],c=t[1]}else l=e}}return this.checkAddress(l),{info:a,code:e,currency:e,address:l,tag:c,network:h}}async fetchTradingFee(e,t={}){await this.loadMarkets();const s=this.market(e),i={currency_pair:s.id},r=await this.privateWalletGetFee(this.extend(i,t));return this.parseTradingFee(r,s)}async fetchTradingFees(e={}){await this.loadMarkets();const t=await this.privateWalletGetFee(e);return this.parseTradingFees(t)}parseTradingFees(e){const t={};for(let s=0;s28)throw new o.BadRequest(this.id+" createOrder () clientOrderId or text param must be up to 28 characters");n=this.omit(n,["text","clientOrderId","textIsRequired"]),"t"!==c[0]&&(c="t-"+c),O.text=c}else l&&(O.text="t-"+this.uuid16())}else{if(d.option)throw new o.NotSupported(this.id+" createOrder() conditional option orders are not supported");if(h){if(O={initial:{contract:d.id,size:i,price:this.priceToPrecision(e,a)},settle:d.settleId},void 0===c){let t,i;f?(t="buy"===s?1:2,i=this.priceToPrecision(e,u)):m&&(t="buy"===s?2:1,i=this.priceToPrecision(e,p));const r=this.safeInteger(n,"price_type",0);if(r<0||r>2)throw new o.BadRequest(this.id+" createOrder () price_type should be 0 latest deal price, 1 mark price, 2 index price");n=this.omit(n,["price_type"]),O.trigger={price_type:r,price:this.priceToPrecision(e,i),rule:t}}void 0!==v&&(O.initial.reduce_only=v),void 0!==b&&(O.initial.tif=b)}else{const r=this.safeValue(this.options,"createOrder",{});let o;if([o,n]=this.getMarginMode(!0,n),void 0===b&&(b="gtc"),O={put:{type:t,side:s,price:this.priceToPrecision(e,a),amount:this.amountToPrecision(e,i),account:o,time_in_force:b},market:d.id},void 0===c){const t=this.safeInteger(r,"expiration"),i=this.safeInteger(n,"expiration",t);let a,o;f?(a="buy"===s?">=":"<=",o=this.priceToPrecision(e,u)):m&&(a="buy"===s?"<=":">=",o=this.priceToPrecision(e,p)),O.trigger={price:this.priceToPrecision(e,o),rule:a,expiration:i}}}}return this.extend(O,n)}async createMarketBuyOrderWithCost(e,t,s={}){await this.loadMarkets();if(!this.market(e).spot)throw new o.NotSupported(this.id+" createMarketBuyOrderWithCost() supports spot orders only");return s.createMarketBuyOrderRequiresPrice=!1,await this.createOrder(e,"market","buy",t,void 0,s)}async editOrder(e,t,s,i,a=void 0,n=void 0,d={}){await this.loadMarkets();const h=this.market(t),[c,l]=this.handleMarketTypeAndParams("editOrder",h,d),u=this.convertTypeToAccount(c);if("spot"===u&&!("limit"===s))throw new o.InvalidOrder(this.id+" editOrder() does not support "+s+" orders for "+c+" markets");const p={order_id:e,currency_pair:h.id,account:u};let f;return void 0!==a&&(h.spot?p.amount=this.amountToPrecision(t,a):p.size="sell"===i?r.O.stringNeg(this.amountToPrecision(t,a)):this.amountToPrecision(t,a)),void 0!==n&&(p.price=this.priceToPrecision(t,n)),h.spot?f=await this.privateSpotPatchOrdersOrderId(this.extend(p,l)):(p.settle=h.settleId,f=await this.privateFuturesPutSettleOrdersOrderId(this.extend(p,l))),this.parseOrder(f,h)}parseOrderStatus(e){return this.safeString({open:"open",_new:"open",filled:"closed",cancelled:"canceled",liquidated:"closed",ioc:"canceled",failed:"canceled",expired:"canceled",finished:"closed",finish:"closed",succeeded:"closed"},e,e)}parseOrder(e,t=void 0){if(!this.safeBool(e,"succeeded",!0))return this.safeOrder({clientOrderId:this.safeString(e,"text"),info:e,status:"rejected"});const s=this.safeValue2(e,"put","initial",{}),i=this.safeValue(e,"trigger",{});let a=this.safeString(s,"contract"),o=this.safeString(s,"type"),n=this.safeStringUpper2(s,"time_in_force","tif"),d=this.safeString2(s,"amount","size"),h=this.safeString(s,"side"),c=this.safeString(s,"price");a=this.safeString(e,"contract",a),o=this.safeString(e,"type",o),n=this.safeStringUpper2(e,"time_in_force","tif",n),"POC"===n&&(n="PO");const l="PO"===n;d=this.safeString2(e,"amount","size",d),h=this.safeString(e,"side",h),c=this.safeString(e,"price",c);let u=this.safeString(e,"left"),p=this.safeString(e,"filled_total");const f=this.safeNumber(i,"price");let m=this.safeNumber2(e,"avg_deal_price","fill_price");if(f&&(u=d,p="0"),a){o=r.O.stringEquals(c,"0")&&"IOC"===n?"market":"limit",h=r.O.stringGt(d,"0")?"buy":"sell"}const g=this.safeStringN(e,["finish_as","status","open"]);let v=this.safeInteger(e,"create_time_ms");void 0===v&&(v=this.safeTimestamp2(e,"create_time","ctime"));let y=this.safeInteger(e,"update_time_ms");void 0===y&&(y=this.safeTimestamp2(e,"update_time","finish_time"));let w="contract";("currency_pair"in e||"market"in e)&&(w="spot");const b=this.safeString2(e,"currency_pair","market",a),S=this.safeSymbol(b,t,"_",w),k=[],O=this.safeString(e,"gt_fee");O&&k.push({currency:"GT",cost:O});const T=this.safeString(e,"fee");T&&k.push({currency:this.safeCurrencyCode(this.safeString(e,"fee_currency")),cost:T});const P=this.safeString(e,"rebated_fee");P&&k.push({currency:this.safeCurrencyCode(this.safeString(e,"rebated_fee_currency")),cost:r.O.stringNeg(P)});const x=k.length>1,I=this.parseOrderStatus(g);let M=r.O.stringAbs(u);if("spot"===this.safeString(e,"account")){const t=this.safeString(e,"avg_deal_price");m=this.parseNumber(t),"market"===o&&"buy"===h&&(M=r.O.stringDiv(u,t),c=void 0,p=d,d=r.O.stringDiv(d,t))}return this.safeOrder({id:this.safeString(e,"id"),clientOrderId:this.safeString(e,"text"),timestamp:v,datetime:this.iso8601(v),lastTradeTimestamp:y,status:I,symbol:S,type:o,timeInForce:n,postOnly:l,reduceOnly:this.safeValue(e,"is_reduce_only"),side:h,price:c,stopPrice:f,triggerPrice:f,average:m,amount:r.O.stringAbs(d),cost:r.O.stringAbs(p),filled:void 0,remaining:M,fee:x?void 0:this.safeValue(k,0),fees:x?k:[],trades:void 0,info:e},t)}async fetchOrder(e,t=void 0,s={}){await this.loadMarkets();const i=this.safeValue2(s,"is_stop_order","stop",!1);s=this.omit(s,["is_stop_order","stop"]);let r=this.safeString2(s,"text","clientOrderId"),a=e;void 0!==r&&(s=this.omit(s,["text","clientOrderId"]),"t"!==r[0]&&(r="t-"+r),a=r);const n=void 0===t?void 0:this.market(t),[d,h]=this.handleMarketTypeAndParams("fetchOrder",n,s),c="swap"===d||"future"===d||"option"===d,[l,u]=c?this.prepareRequest(n,d,h):this.spotOrderPrepareRequest(n,i,h);let p;if(l.order_id=a,"spot"===d||"margin"===d)p=i?await this.privateSpotGetPriceOrdersOrderId(this.extend(l,u)):await this.privateSpotGetOrdersOrderId(this.extend(l,u));else if("swap"===d)p=i?await this.privateFuturesGetSettlePriceOrdersOrderId(this.extend(l,u)):await this.privateFuturesGetSettleOrdersOrderId(this.extend(l,u));else if("future"===d)p=i?await this.privateDeliveryGetSettlePriceOrdersOrderId(this.extend(l,u)):await this.privateDeliveryGetSettleOrdersOrderId(this.extend(l,u));else{if("option"!==d)throw new o.NotSupported(this.id+" fetchOrder() not support this market type");p=await this.privateOptionsGetOrdersOrderId(this.extend(l,u))}return this.parseOrder(p,n)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchOrdersByStatus("open",e,t,s,i)}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){return await this.fetchOrdersByStatus("finished",e,t,s,i)}async fetchOrdersByStatus(e,t=void 0,s=void 0,i=void 0,r={}){let a;await this.loadMarkets(),void 0!==t&&(a=this.market(t),t=a.symbol);const n=this.safeValue(r,"stop");r=this.omit(r,"stop");const[d,h]=this.handleMarketTypeAndParams("fetchOrdersByStatus",a,r),c="spot"===d||"margin"===d,[l,u]=c?this.multiOrderSpotPrepareRequest(a,n,h):this.prepareRequest(a,d,h);"closed"===e&&(e="finished"),l.status=e,void 0!==i&&(l.limit=i),void 0!==s&&c&&(l.from=this.parseToInt(s/1e3));const p=c&&"open"===e&&!n;let f;if("spot"===d||"margin"===d)f=p?await this.privateSpotGetOpenOrders(this.extend(l,u)):n?await this.privateSpotGetPriceOrders(this.extend(l,u)):await this.privateSpotGetOrders(this.extend(l,u));else if("swap"===d)f=n?await this.privateFuturesGetSettlePriceOrders(this.extend(l,u)):await this.privateFuturesGetSettleOrders(this.extend(l,u));else if("future"===d)f=n?await this.privateDeliveryGetSettlePriceOrders(this.extend(l,u)):await this.privateDeliveryGetSettleOrders(this.extend(l,u));else{if("option"!==d)throw new o.NotSupported(this.id+" fetchOrders() not support this market type");f=await this.privateOptionsGetOrders(this.extend(l,u))}let m=f;if(p){m=[];for(let e=0;e100)throw new o.BadRequest(this.id+" setLeverage() leverage should be between 1 and 100");await this.loadMarkets();const i=this.market(t),[r,a]=this.prepareRequest(i,void 0,s),n=this.safeString2(this.options,"marginMode","defaultMarginMode"),d=this.safeString(a,"cross_leverage_limit");let h,c=this.safeString(a,"marginMode",n),l=this.numberToString(e);if(void 0!==d&&(c="cross",l=d),"cross"===c||"cross_margin"===c?(r.cross_leverage_limit=l,r.leverage="0"):r.leverage=l,i.swap)h=await this.privateFuturesPostSettlePositionsContractLeverage(this.extend(r,a));else{if(!i.future)throw new o.NotSupported(this.id+" setLeverage() not support this market type");h=await this.privateDeliveryPostSettlePositionsContractLeverage(this.extend(r,a))}return h}parsePosition(e,t=void 0){const s=this.safeString(e,"contract");t=this.safeMarket(s,t,"_","contract");const i=this.safeString2(e,"size","accum_size");let a=this.safeString(e,"side");void 0===a&&(r.O.stringGt(i,"0")?a="long":r.O.stringLt(i,"0")&&(a="short"));const o=this.safeString(e,"maintenance_rate"),n=this.safeString(e,"value"),d=this.safeString(e,"leverage");let h;void 0!==d&&(h="0"===d?"cross":"isolated");let c,l=this.safeString(e,"pnl_fee");if(void 0===l){const e="0.00075";l=r.O.stringMul(e,n),c=r.O.stringAdd(r.O.stringDiv(n,d),l)}let u=this.safeTimestamp2(e,"open_time","first_open_time");return 0===u&&(u=void 0),this.safePosition({info:e,id:void 0,symbol:this.safeString(t,"symbol"),timestamp:u,datetime:this.iso8601(u),lastUpdateTimestamp:this.safeTimestamp2(e,"update_time","time"),initialMargin:this.parseNumber(c),initialMarginPercentage:this.parseNumber(r.O.stringDiv(c,n)),maintenanceMargin:this.parseNumber(r.O.stringMul(o,n)),maintenanceMarginPercentage:this.parseNumber(o),entryPrice:this.safeNumber(e,"entry_price"),notional:this.parseNumber(n),leverage:this.safeNumber(e,"leverage"),unrealizedPnl:this.safeNumber(e,"unrealised_pnl"),realizedPnl:this.safeNumber2(e,"realised_pnl","pnl"),contracts:this.parseNumber(r.O.stringAbs(i)),contractSize:this.safeNumber(t,"contractSize"),marginRatio:void 0,liquidationPrice:this.safeNumber(e,"liq_price"),markPrice:this.safeNumber(e,"mark_price"),lastPrice:void 0,collateral:this.safeNumber(e,"margin"),marginMode:h,side:a,percentage:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}async fetchPosition(e,t={}){await this.loadMarkets();const s=this.market(e);if(!s.contract)throw new o.BadRequest(this.id+" fetchPosition() supports contract markets only");let i={};[i,t]=this.prepareRequest(s,s.type,t);const r=this.extend(i,t);let a;return s.swap?a=await this.privateFuturesGetSettlePositionsContract(r):s.future?a=await this.privateDeliveryGetSettlePositionsContract(r):"option"===s.type&&(a=await this.privateOptionsGetPositionsContract(r)),this.parsePosition(a,s)}async fetchPositions(e=void 0,t={}){let s,i;if(await this.loadMarkets(),void 0!==(e=this.marketSymbols(e,void 0,!0,!0,!0))){e.length>0&&(s=this.market(e[0]))}let r,a={};if([i,t]=this.handleMarketTypeAndParams("fetchPositions",s,t),void 0!==i&&"spot"!==i||(i="swap"),"option"===i){if(void 0!==e){const e=s.id.split("-");a.underlying=this.safeString(e,0)}}else[a,t]=this.prepareRequest(void 0,i,t);return"swap"===i?r=await this.privateFuturesGetSettlePositions(this.extend(a,t)):"future"===i?r=await this.privateDeliveryGetSettlePositions(this.extend(a,t)):"option"===i&&(r=await this.privateOptionsGetPositions(this.extend(a,t))),this.parsePositions(r,e)}async fetchLeverageTiers(e=void 0,t={}){await this.loadMarkets();const[s,i]=this.handleMarketTypeAndParams("fetchLeverageTiers",void 0,t),[r,a]=this.prepareRequest(void 0,s,i);if("future"!==s&&"swap"!==s)throw new o.BadRequest(this.id+" fetchLeverageTiers only supports swap and future");let n;if("swap"===s)n=await this.publicFuturesGetSettleContracts(this.extend(r,a));else{if("future"!==s)throw new o.NotSupported(this.id+" fetchLeverageTiers() not support this market type");n=await this.publicDeliveryGetSettleContracts(this.extend(r,a))}return this.parseLeverageTiers(n,e,"name")}async fetchMarketLeverageTiers(e,t={}){await this.loadMarkets();const s=this.market(e),[i,r]=this.handleMarketTypeAndParams("fetchMarketLeverageTiers",s,t),[a,n]=this.prepareRequest(s,i,r);if("future"!==i&&"swap"!==i)throw new o.BadRequest(this.id+" fetchMarketLeverageTiers only supports swap and future");const d=await this.privateFuturesGetSettleRiskLimitTiers(this.extend(a,n));return this.parseMarketLeverageTiers(d,s)}parseEmulatedLeverageTiers(e,t=void 0){const s=this.safeString(e,"maintenance_rate"),i=this.safeString(e,"leverage_max"),a=this.safeString(e,"risk_limit_step"),o=this.safeString(e,"risk_limit_max"),n=r.O.stringDiv("1",i);let d=s,h=n,c="0";const l=[];for(;r.O.stringLt(c,o);){const i=r.O.stringAdd(c,a);l.push({tier:this.parseNumber(r.O.stringDiv(i,a)),currency:this.safeString(t,"settle"),minNotional:this.parseNumber(c),maxNotional:this.parseNumber(i),maintenanceMarginRate:this.parseNumber(d),maxLeverage:this.parseNumber(r.O.stringDiv("1",h)),info:e}),d=r.O.stringAdd(d,s),h=r.O.stringAdd(h,n),c=i}return l}parseMarketLeverageTiers(e,t=void 0){if(!Array.isArray(e))return this.parseEmulatedLeverageTiers(e,t);let s=0;const i=[];for(let r=0;r=0||s.indexOf("positions")>=0}if("GET"===s||"DELETE"===s||i||"PATCH"===s)Object.keys(c).length&&(t=this.urlencode(c),p+="?"+t),"PATCH"===s&&(a=this.json(c));else{const e=this.safeValue(c,"query",{});Object.keys(e).length&&(t=this.urlencode(e),p+="?"+t),c=this.omit(c,"query"),a=this.json(c)}const o=void 0===a?"":a,d=this.hash(this.encode(o),n.o),l=this.seconds().toString(),f="/api/"+this.version+u,m=[s.toUpperCase(),f,t,d,l].join("\n"),g=this.hmac(this.encode(m),this.encode(this.secret),n.o);r={KEY:this.apiKey,Timestamp:l,SIGN:g,"Content-Type":"application/json"}}return{url:p,method:s,body:a,headers:r}}async modifyMarginHelper(e,t,s={}){await this.loadMarkets();const i=this.market(e),[r,a]=this.prepareRequest(i,void 0,s);let n;if(r.change=this.numberToString(t),i.swap)n=await this.privateFuturesPostSettlePositionsContractMargin(this.extend(r,a));else{if(!i.future)throw new o.NotSupported(this.id+" modifyMarginHelper() not support this market type");n=await this.privateDeliveryPostSettlePositionsContractMargin(this.extend(r,a))}return this.parseMarginModification(n,i)}parseMarginModification(e,t=void 0){const s=this.safeString(e,"contract");t=this.safeMarket(s,t,"_","contract");const i=this.safeNumber(e,"margin");return{info:e,symbol:t.symbol,type:void 0,marginMode:"isolated",amount:void 0,total:i,code:this.safeValue(t,"quote"),status:"ok",timestamp:void 0,datetime:void 0}}async reduceMargin(e,t,s={}){return await this.modifyMarginHelper(e,-t,s)}async addMargin(e,t,s={}){return await this.modifyMarginHelper(e,t,s)}async fetchOpenInterestHistory(e,t="5m",s=void 0,i=void 0,r={}){await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchOpenInterestHistory","paginate",!1),a)return await this.fetchPaginatedCallDeterministic("fetchOpenInterestHistory",e,s,i,t,r,100);const n=this.market(e);if(!n.swap)throw new o.BadRequest(this.id+" fetchOpenInterest() supports swap markets only");const d={contract:n.id,settle:n.settleId,interval:this.safeString(this.timeframes,t,t)};void 0!==i&&(d.limit=i),void 0!==s&&(d.from=s);const h=await this.publicFuturesGetSettleContractStats(this.extend(d,r));return this.parseOpenInterests(h,n,s,i)}parseOpenInterest(e,t=void 0){const s=this.safeTimestamp(e,"time");return{symbol:this.safeString(t,"symbol"),openInterestAmount:this.safeNumber(e,"open_interest"),openInterestValue:this.safeNumber(e,"open_interest_usd"),timestamp:s,datetime:this.iso8601(s),info:e}}async fetchSettlementHistory(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new o.ArgumentsRequired(this.id+" fetchSettlementHistory() requires a symbol argument");await this.loadMarkets();const r=this.market(e);let a;if([a,i]=this.handleMarketTypeAndParams("fetchSettlementHistory",r,i),"option"!==a)throw new o.NotSupported(this.id+" fetchSettlementHistory() supports option markets only");const n=r.id.split("-"),d={underlying:this.safeString(n,0)};void 0!==t&&(d.from=t),void 0!==s&&(d.limit=s);const h=await this.publicOptionsGetSettlements(this.extend(d,i)),c=this.parseSettlements(h,r),l=this.sortBy(c,"timestamp");return this.filterBySymbolSinceLimit(l,e,t,s)}async fetchMySettlementHistory(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new o.ArgumentsRequired(this.id+" fetchMySettlementHistory() requires a symbol argument");await this.loadMarkets();const r=this.market(e);let a;if([a,i]=this.handleMarketTypeAndParams("fetchMySettlementHistory",r,i),"option"!==a)throw new o.NotSupported(this.id+" fetchMySettlementHistory() supports option markets only");const n=r.id,d=n.split("-"),h={underlying:this.safeString(d,0),contract:n};void 0!==t&&(h.from=t),void 0!==s&&(h.limit=s);const c=await this.privateOptionsGetMySettlements(this.extend(h,i)),l=this.safeValue(c,"result",{}),u=this.safeValue(l,"list",[]),p=this.parseSettlements(u,r),f=this.sortBy(p,"timestamp");return this.filterBySymbolSinceLimit(f,r.symbol,t,s)}parseSettlement(e,t){const s=this.safeTimestamp(e,"time"),i=this.safeString(e,"contract");return{info:e,symbol:this.safeSymbol(i,t),price:this.safeNumber(e,"settle_price"),timestamp:s,datetime:this.iso8601(s)}}parseSettlements(e,t){const s=[];for(let i=0;i10?parseInt(n):1e3*parseInt(n);const h=this.safeString(e,"balance"),c=this.safeString(e,"change"),l=this.parseNumber(r.O.stringSub(h,c));return{id:this.safeString(e,"id"),direction:s,account:void 0,referenceAccount:void 0,referenceId:void 0,type:this.parseLedgerEntryType(o),currency:this.safeCurrencyCode(a,t),amount:this.parseNumber(i),timestamp:d,datetime:this.iso8601(d),before:l,after:this.safeNumber(e,"balance"),status:void 0,fee:void 0,info:e}}parseLedgerEntryType(e){return this.safeString({deposit:"deposit",withdraw:"withdrawal",sub_account_transfer:"transfer",margin_in:"transfer",margin_out:"transfer",margin_funding_in:"transfer",margin_funding_out:"transfer",cross_margin_in:"transfer",cross_margin_out:"transfer",copy_trading_in:"transfer",copy_trading_out:"transfer",quant_in:"transfer",quant_out:"transfer",futures_in:"transfer",futures_out:"transfer",delivery_in:"transfer",delivery_out:"transfer",new_order:"trade",order_fill:"trade",referral_fee:"rebate",order_fee:"fee",interest:"interest",lend:"loan",redeem:"loan",profit:"interest",flash_swap_buy:"trade",flash_swap_sell:"trade",unknown:"unknown",set:"settlement",prem:"trade",point_refr:"rebate",point_fee:"fee",point_dnw:"deposit/withdraw",fund:"fee",refr:"rebate",fee:"fee",pnl:"trade",dnw:"deposit/withdraw"},e,e)}async setPositionMode(e,t=void 0,s={}){const i=void 0!==t?this.market(t):void 0,[r,a]=this.prepareRequest(i,"swap",s);return r.dual_mode=e,await this.privateFuturesPostSettleDualMode(this.extend(r,a))}async fetchUnderlyingAssets(e={}){let t;if(await this.loadMarkets(),[t,e]=this.handleMarketTypeAndParams("fetchUnderlyingAssets",void 0,e),void 0!==t&&"spot"!==t||(t="option"),"option"!==t)throw new o.NotSupported(this.id+" fetchUnderlyingAssets() supports option markets only");const s=await this.publicOptionsGetUnderlyings(e),i=[];for(let e=0;e{s.d(t,{Z:()=>r});var i=s(7290);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"gateio",alias:!0})}}},6743:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(8185),r=s(6689),a=s(2194),o=s(9292),n=s(7110);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"gemini",name:"Gemini",countries:["US"],rateLimit:100,version:"v1",pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createMarketOrder:!1,createOrder:!0,createReduceOnlyOrder:!1,fetchBalance:!0,fetchBidsAsks:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!1,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddressesByNetwork:!0,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:"emulated",postOnly:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/1294454/27816857-ce7be644-6096-11e7-82d6-3c257263229c.jpg",api:{public:"https://api.gemini.com",private:"https://api.gemini.com",web:"https://docs.gemini.com",webExchange:"https://exchange.gemini.com"},www:"https://gemini.com/",doc:["https://docs.gemini.com/rest-api","https://docs.sandbox.gemini.com"],test:{public:"https://api.sandbox.gemini.com",private:"https://api.sandbox.gemini.com",web:"https://docs.gemini.com",webExchange:"https://exchange.gemini.com"},fees:["https://gemini.com/api-fee-schedule","https://gemini.com/trading-fees","https://gemini.com/transfer-fees"]},api:{webExchange:{get:[""]},web:{get:["rest-api"]},public:{get:{"v1/symbols":5,"v1/symbols/details/{symbol}":5,"v1/staking/rates":5,"v1/pubticker/{symbol}":5,"v2/ticker/{symbol}":5,"v2/candles/{symbol}/{timeframe}":5,"v1/trades/{symbol}":5,"v1/auction/{symbol}":5,"v1/auction/{symbol}/history":5,"v1/pricefeed":5,"v1/book/{symbol}":5,"v1/earn/rates":5}},private:{post:{"v1/staking/unstake":1,"v1/staking/stake":1,"v1/staking/rewards":1,"v1/staking/history":1,"v1/order/new":1,"v1/order/cancel":1,"v1/wrap/{symbol}":1,"v1/order/cancel/session":1,"v1/order/cancel/all":1,"v1/order/status":1,"v1/orders":1,"v1/mytrades":1,"v1/notionalvolume":1,"v1/tradevolume":1,"v1/clearing/new":1,"v1/clearing/status":1,"v1/clearing/cancel":1,"v1/clearing/confirm":1,"v1/balances":1,"v1/balances/staking":1,"v1/notionalbalances/{currency}":1,"v1/transfers":1,"v1/addresses/{network}":1,"v1/deposit/{network}/newAddress":1,"v1/deposit/{currency}/newAddress":1,"v1/withdraw/{currency}":1,"v1/account/transfer/{currency}":1,"v1/payments/addbank":1,"v1/payments/methods":1,"v1/payments/sen/withdraw":1,"v1/balances/earn":1,"v1/earn/interest":1,"v1/earn/history":1,"v1/approvedAddresses/{network}/request":1,"v1/approvedAddresses/account/{network}":1,"v1/approvedAddresses/{network}/remove":1,"v1/account":1,"v1/account/create":1,"v1/account/list":1,"v1/heartbeat":1}}},precisionMode:o.sh,fees:{trading:{taker:.004,maker:.002}},httpExceptions:{400:r.BadRequest,403:r.PermissionDenied,404:r.OrderNotFound,406:r.InsufficientFunds,429:r.RateLimitExceeded,500:r.ExchangeError,502:r.ExchangeNotAvailable,503:r.OnMaintenance},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1hr","6h":"6hr","1d":"1day"},exceptions:{exact:{AuctionNotOpen:r.BadRequest,ClientOrderIdTooLong:r.BadRequest,ClientOrderIdMustBeString:r.BadRequest,ConflictingOptions:r.BadRequest,EndpointMismatch:r.BadRequest,EndpointNotFound:r.BadRequest,IneligibleTiming:r.BadRequest,InsufficientFunds:r.InsufficientFunds,InvalidJson:r.BadRequest,InvalidNonce:r.InvalidNonce,InvalidApiKey:r.AuthenticationError,InvalidOrderType:r.InvalidOrder,InvalidPrice:r.InvalidOrder,InvalidQuantity:r.InvalidOrder,InvalidSide:r.InvalidOrder,InvalidSignature:r.AuthenticationError,InvalidSymbol:r.BadRequest,InvalidTimestampInPayload:r.BadRequest,Maintenance:r.OnMaintenance,MarketNotOpen:r.InvalidOrder,MissingApikeyHeader:r.AuthenticationError,MissingOrderField:r.InvalidOrder,MissingRole:r.AuthenticationError,MissingPayloadHeader:r.AuthenticationError,MissingSignatureHeader:r.AuthenticationError,NoSSL:r.AuthenticationError,OptionsMustBeArray:r.BadRequest,OrderNotFound:r.OrderNotFound,RateLimit:r.RateLimitExceeded,System:r.ExchangeError,UnsupportedOption:r.BadRequest},broad:{"The Gemini Exchange is currently undergoing maintenance.":r.OnMaintenance,"We are investigating technical issues with the Gemini Exchange.":r.ExchangeNotAvailable,"Internal Server Error":r.ExchangeNotAvailable}},options:{fetchMarketsMethod:"fetch_markets_from_api",fetchMarketFromWebRetries:10,fetchMarketsFromAPI:{fetchDetailsForAllSymbols:!1,quoteCurrencies:["USDT","GUSD","USD","DAI","EUR","GBP","SGD","BTC","ETH","LTC","BCH"]},fetchMarkets:{webApiEnable:!0,webApiRetries:10},fetchUsdtMarkets:["btcusdt","ethusdt"],fetchCurrencies:{webApiEnable:!0,webApiRetries:5,webApiMuteFailure:!0},fetchTickerMethod:"fetchTickerV1",networks:{BTC:"bitcoin",ERC20:"ethereum",BCH:"bitcoincash",LTC:"litecoin",ZEC:"zcash",FIL:"filecoin",DOGE:"dogecoin",XTZ:"tezos",AVAXX:"avalanche",SOL:"solana",ATOM:"cosmos",DOT:"polkadot"},nonce:"milliseconds",conflictingMarkets:{paxgusd:{base:"PAXG",quote:"USD"}}}})}async fetchCurrencies(e={}){return await this.fetchCurrenciesFromWeb(e)}async fetchCurrenciesFromWeb(e={}){const t=await this.fetchWebEndpoint("fetchCurrencies","webExchangeGet",!0,'="currencyData">',"<\/script>");if(void 0===t)return;const s={};this.options.tradingPairs=this.safeList(t,"tradingPairs");const i=this.safeValue(t,"currencies",[]);for(let e=0;eSymbols and minimums'),s=this.id+" fetchMarketsFromWeb() the API doc HTML markup has changed, breaking the parser of order limits and precision info for markets.",i=t.split("tbody>");if(i.length<2)throw new r.NotSupported(s);const a=i[1].split("\n\n"),o=a.length;if(o<2)throw new r.NotSupported(s);const n=[];for(let e=1;e\n");if(i.length<5)throw new r.NotSupported(s);let o=i[0].replace("","");o=o.replace("*","");const d=i[1].replace("","").split(" "),h=this.safeNumber(d,0),c=i[2].replace("","").split(" "),l=o.length-0,u=l-3,p=i[3].replace("","").split(" "),f=this.safeStringLower(p,1,o.slice(u,l)),m=this.safeStringLower(c,1,o.replace(f,"")),g=this.safeCurrencyCode(m),v=this.safeCurrencyCode(f);n.push({id:o,symbol:g+"/"+v,base:g,quote:v,settle:void 0,baseId:m,quoteId:f,settleId:void 0,type:"spot",spot:!0,margin:!1,swap:!1,future:!1,option:!1,active:void 0,contract:!1,linear:void 0,inverse:void 0,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.safeNumber(c,0),price:this.safeNumber(p,0)},limits:{leverage:{min:void 0,max:void 0},amount:{min:h,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:void 0,info:t})}return n}parseMarketActive(e){return void 0===e||this.safeBool({open:!0,closed:!1,cancel_only:!0,post_only:!0,limit_only:!0},e,!0)}async fetchUSDTMarkets(e={}){if("test"in this.urls)return[];const t=this.safeValue(this.options,"fetchUsdtMarkets",[]),s=[];for(let i=0;i=0,c=d.replace("PERP",""),l=this.safeDict(this.options,"conflictingMarkets",{}),u=c.toLowerCase();if(u in l){const e=l[u];s=e.base,i=e.quote,h&&(r=e.quote)}else{const e=this.handleOption("fetchMarketsFromAPI","quoteCurrencies",[]);for(let t=0;t{s.d(t,{Z:()=>d});var i=s(9190),r=s(9292),a=s(2194),o=s(6689),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"hitbtc",name:"HitBTC",countries:["HK"],rateLimit:3.333,version:"3",has:{CORS:!1,spot:!0,margin:!0,swap:!0,future:!1,option:void 0,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closePosition:!1,createDepositAddress:!0,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowRateHistories:void 0,fetchBorrowRateHistory:void 0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositsWithdrawals:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:void 0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!0,fetchLeverageTiers:void 0,fetchLiquidations:!1,fetchMarginMode:"emulated",fetchMarginModes:!0,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!0,fetchOrders:!1,fetchOrderTrades:!0,fetchPosition:!0,fetchPositions:!0,fetchPremiumIndexOHLCV:!0,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!0,fetchTransactions:"emulated",fetchWithdrawals:!0,reduceMargin:!0,setLeverage:!0,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!0,withdraw:!0},precisionMode:r.sh,urls:{logo:"https://user-images.githubusercontent.com/1294454/27766555-8eaec20e-5edc-11e7-9c5b-6dc69fc42f5e.jpg",test:{public:"https://api.demo.hitbtc.com/api/3",private:"https://api.demo.hitbtc.com/api/3"},api:{public:"https://api.hitbtc.com/api/3",private:"https://api.hitbtc.com/api/3"},www:"https://hitbtc.com",referral:"https://hitbtc.com/?ref_id=5a5d39a65d466",doc:["https://api.hitbtc.com","https://github.com/hitbtc-com/hitbtc-api/blob/master/APIv2.md"],fees:["https://hitbtc.com/fees-and-limits","https://support.hitbtc.com/hc/en-us/articles/115005148605-Fees-and-limits"]},api:{public:{get:{"public/currency":10,"public/currency/{currency}":10,"public/symbol":10,"public/symbol/{symbol}":10,"public/ticker":10,"public/ticker/{symbol}":10,"public/price/rate":10,"public/price/history":10,"public/price/ticker":10,"public/price/ticker/{symbol}":10,"public/trades":10,"public/trades/{symbol}":10,"public/orderbook":10,"public/orderbook/{symbol}":10,"public/candles":10,"public/candles/{symbol}":10,"public/converted/candles":10,"public/converted/candles/{symbol}":10,"public/futures/info":10,"public/futures/info/{symbol}":10,"public/futures/history/funding":10,"public/futures/history/funding/{symbol}":10,"public/futures/candles/index_price":10,"public/futures/candles/index_price/{symbol}":10,"public/futures/candles/mark_price":10,"public/futures/candles/mark_price/{symbol}":10,"public/futures/candles/premium_index":10,"public/futures/candles/premium_index/{symbol}":10,"public/futures/candles/open_interest":10,"public/futures/candles/open_interest/{symbol}":10}},private:{get:{"spot/balance":15,"spot/balance/{currency}":15,"spot/order":1,"spot/order/{client_order_id}":1,"spot/fee":15,"spot/fee/{symbol}":15,"spot/history/order":15,"spot/history/trade":15,"margin/account":1,"margin/account/isolated/{symbol}":1,"margin/account/cross/{currency}":1,"margin/order":1,"margin/order/{client_order_id}":1,"margin/config":15,"margin/history/order":15,"margin/history/trade":15,"margin/history/positions":15,"margin/history/clearing":15,"futures/balance":15,"futures/balance/{currency}":15,"futures/account":1,"futures/account/isolated/{symbol}":1,"futures/order":1,"futures/order/{client_order_id}":1,"futures/config":15,"futures/fee":15,"futures/fee/{symbol}":15,"futures/history/order":15,"futures/history/trade":15,"futures/history/positions":15,"futures/history/clearing":15,"wallet/balance":30,"wallet/balance/{currency}":30,"wallet/crypto/address":30,"wallet/crypto/address/recent-deposit":30,"wallet/crypto/address/recent-withdraw":30,"wallet/crypto/address/check-mine":30,"wallet/transactions":30,"wallet/transactions/{tx_id}":30,"wallet/crypto/fee/estimate":30,"wallet/airdrops":30,"wallet/amount-locks":30,"sub-account":15,"sub-account/acl":15,"sub-account/balance/{subAccID}":15,"sub-account/crypto/address/{subAccID}/{currency}":15},post:{"spot/order":1,"spot/order/list":1,"margin/order":1,"margin/order/list":1,"futures/order":1,"futures/order/list":1,"wallet/crypto/address":30,"wallet/crypto/withdraw":30,"wallet/convert":30,"wallet/transfer":30,"wallet/internal/withdraw":30,"wallet/crypto/check-offchain-available":30,"wallet/crypto/fees/estimate":30,"wallet/airdrops/{id}/claim":30,"sub-account/freeze":15,"sub-account/activate":15,"sub-account/transfer":15,"sub-account/acl":15},patch:{"spot/order/{client_order_id}":1,"margin/order/{client_order_id}":1,"futures/order/{client_order_id}":1},delete:{"spot/order":1,"spot/order/{client_order_id}":1,"margin/position":1,"margin/position/isolated/{symbol}":1,"margin/order":1,"margin/order/{client_order_id}":1,"futures/position":1,"futures/position/{margin_mode}/{symbol}":1,"futures/order":1,"futures/order/{client_order_id}":1,"wallet/crypto/withdraw/{id}":30},put:{"margin/account/isolated/{symbol}":1,"futures/account/isolated/{symbol}":1,"wallet/crypto/withdraw/{id}":30}}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0009"),maker:this.parseNumber("0.0009"),tiers:{maker:[[this.parseNumber("0"),this.parseNumber("0.0009")],[this.parseNumber("10"),this.parseNumber("0.0007")],[this.parseNumber("100"),this.parseNumber("0.0006")],[this.parseNumber("500"),this.parseNumber("0.0005")],[this.parseNumber("1000"),this.parseNumber("0.0003")],[this.parseNumber("5000"),this.parseNumber("0.0002")],[this.parseNumber("10000"),this.parseNumber("0.0001")],[this.parseNumber("20000"),this.parseNumber("0")],[this.parseNumber("50000"),this.parseNumber("-0.0001")],[this.parseNumber("100000"),this.parseNumber("-0.0001")]],taker:[[this.parseNumber("0"),this.parseNumber("0.0009")],[this.parseNumber("10"),this.parseNumber("0.0008")],[this.parseNumber("100"),this.parseNumber("0.0007")],[this.parseNumber("500"),this.parseNumber("0.0007")],[this.parseNumber("1000"),this.parseNumber("0.0006")],[this.parseNumber("5000"),this.parseNumber("0.0006")],[this.parseNumber("10000"),this.parseNumber("0.0005")],[this.parseNumber("20000"),this.parseNumber("0.0004")],[this.parseNumber("50000"),this.parseNumber("0.0003")],[this.parseNumber("100000"),this.parseNumber("0.0002")]]}}},timeframes:{"1m":"M1","3m":"M3","5m":"M5","15m":"M15","30m":"M30","1h":"H1","4h":"H4","1d":"D1","1w":"D7","1M":"1M"},exceptions:{exact:{429:o.RateLimitExceeded,500:o.ExchangeError,503:o.ExchangeNotAvailable,504:o.ExchangeNotAvailable,600:o.PermissionDenied,800:o.ExchangeError,1002:o.AuthenticationError,1003:o.PermissionDenied,1004:o.AuthenticationError,1005:o.AuthenticationError,2001:o.BadSymbol,2002:o.BadRequest,2003:o.BadRequest,2010:o.BadRequest,2011:o.BadRequest,2012:o.BadRequest,2020:o.BadRequest,2022:o.BadRequest,2024:o.InvalidOrder,10001:o.BadRequest,10021:o.AccountSuspended,10022:o.BadRequest,20001:o.InsufficientFunds,20002:o.OrderNotFound,20003:o.ExchangeError,20004:o.ExchangeError,20005:o.ExchangeError,20006:o.ExchangeError,20007:o.ExchangeError,20008:o.InvalidOrder,20009:o.InvalidOrder,20010:o.OnMaintenance,20011:o.ExchangeError,20012:o.ExchangeError,20014:o.ExchangeError,20016:o.ExchangeError,20018:o.ExchangeError,20031:o.ExchangeError,20032:o.ExchangeError,20033:o.ExchangeError,20034:o.ExchangeError,20040:o.ExchangeError,20041:o.ExchangeError,20042:o.ExchangeError,20043:o.ExchangeError,20044:o.PermissionDenied,20045:o.InvalidOrder,20047:o.InvalidOrder,20048:o.InvalidOrder,20049:o.InvalidOrder,20080:o.ExchangeError,21001:o.ExchangeError,21003:o.AccountSuspended,21004:o.AccountSuspended,22004:o.ExchangeError,22008:o.ExchangeError},broad:{}},options:{defaultNetwork:"ERC20",defaultNetworks:{ETH:"ETH",USDT:"TRC20"},networks:{BTC:"btc",OMNI:"BTC",ETH:"eth",ERC20:"ETH",ETC:"ETC",BEP20:"BSC",TRC20:"TRX",NEAR:"NEAR",DGB:"DGB",AE:"AE",AR:"AR",ADA:"ADA",CHZ:"CHZ",ABBC:"ABBC",ALGO:"ALGO",APT:"APT",ATOM:"ATOM",AVAXC:"AVAC",AVAXX:"AVAX",BSV:"BCHSV",BEP2:"BNB",CELO:"CELO",CKB:"CKB",CTXC:"CTXC",DASH:"DASH",DCR:"DCR",DOGE:"doge",EGLD:"EGLD",EOS:"EOS",ETHW:"ETHW",EVER:"EVER",FET:"FET",FIL:"FIL",FLOW:"FLOW",GLMR:"GLMR",GRIN:"GRIN",HBAR:"HBAR",HIVE:"HIVE",HYDRA:"HYDRA",ICP:"ICP",ICX:"ICX",IOST:"IOST",IOTA:"IOTA",IOTX:"IOTX",KAVA:"KAVA",KLAY:"KIM",KOMODO:"KMD",KSM:"KSM",LSK:"LSK",LTC:"ltc",MINA:"MINA",MOVR:"MOVR",NANO:"NANO",NEO:"NEO",ONE:"ONE",ONT:"ONT",OPTIMISM:"OP",PLCU:"PLCU",MATIC:"POLYGON",QTUM:"QTUM",REI:"REI",OASIS:"ROSE",RVN:"RVN",SC:"SC",SCRT:"SCRT",SOL:"SOL",STEEM:"STEEM",THETA:"Theta",TRUE:"TRUE",VET:"VET",VSYS:"VSYS",WAVES:"WAVES",WAX:"WAX",XCH:"XCH",XEC:"XEC",NEM:"XEM",XLM:"XLM",XMR:"xmr",XRD:"XRD",XRP:"XRP",XTZ:"XTZ",XVG:"XVG",XYM:"XYM",ZEC:"ZEC",ZEN:"ZEN",ZIL:"ZIL"},accountsByType:{spot:"spot",funding:"wallet",future:"derivatives"},withdraw:{includeFee:!1}},commonCurrencies:{AUTO:"Cube",BCC:"BCC",BDP:"BidiPass",BET:"DAO.Casino",BIT:"BitRewards",BOX:"BOX Token",CPT:"Cryptaur",GET:"Themis",GMT:"GMT Token",HSR:"HC",IQ:"IQ.Cash",LNC:"LinkerCoin",PLA:"PlayChip",PNT:"Penta",SBTC:"Super Bitcoin",STEPN:"GMT",STX:"STOX",TV:"Tokenville",XMT:"MTL",XPNT:"PNT"}})}nonce(){return this.milliseconds()}async fetchMarkets(e={}){const t=await this.publicGetPublicSymbol(e),s=[],i=Object.keys(t);for(let e=0;ea)throw new o.BadRequest(this.id+" setLeverage() leverage should be between 1 and "+a.toString()+" for "+t);const n={symbol:i.id,leverage:e.toString(),margin_balance:this.amountToPrecision(t,r)};return await this.privatePutFuturesAccountIsolatedSymbol(this.extend(n,s))}async fetchDepositWithdrawFees(e=void 0,t={}){await this.loadMarkets();const s=await this.publicGetPublicCurrency(t);return this.parseDepositWithdrawFees(s,e)}parseDepositWithdrawFee(e,t=void 0){const s=this.safeValue(e,"networks",[]),i=this.depositWithdrawFee(e);for(let e=0;e{s.d(t,{Z:()=>r});var i=s(4714);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"hitbtc3",alias:!0})}}},8422:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(3727),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"hollaex",name:"HollaEx",countries:["KR"],rateLimit:250,version:"v2",pro:!0,has:{CORS:void 0,spot:!0,margin:void 0,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,createLimitBuyOrder:!0,createLimitSellOrder:!0,createMarketBuyOrder:!0,createMarketSellOrder:!0,createOrder:!0,createPostOnlyOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:"emulated",fetchDepositAddresses:!0,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrder:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!0,fetchOrders:!0,fetchPosition:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","1h":"1h","4h":"4h","1d":"1d","1w":"1w"},urls:{logo:"https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg",test:{rest:"https://api.sandbox.hollaex.com"},api:{rest:"https://api.hollaex.com"},www:"https://hollaex.com",doc:"https://apidocs.hollaex.com",referral:"https://pro.hollaex.com/signup?affiliation_code=QSWA6G"},precisionMode:o.sh,requiredCredentials:{apiKey:!0,secret:!0},api:{public:{get:{health:1,constants:1,kit:1,tiers:1,ticker:1,tickers:1,orderbook:1,orderbooks:1,trades:1,chart:1,charts:1,minicharts:1,"oracle/prices":1,"quick-trade":1,"udf/config":1,"udf/history":1,"udf/symbols":1}},private:{get:{user:1,"user/balance":1,"user/deposits":1,"user/withdrawals":1,"user/withdrawal/fee":1,"user/trades":1,orders:1,order:1},post:{"user/withdrawal":1,order:1},delete:{"order/all":1,order:1}}},fees:{trading:{tierBased:!0,percentage:!0,taker:.001,maker:.001}},exceptions:{broad:{"Invalid token":r.AuthenticationError,"Order not found":r.OrderNotFound,"Insufficient balance":r.InsufficientFunds,"Error 1001 - Order rejected. Order could not be submitted as this order was set to a post only order.":r.OrderImmediatelyFillable},exact:{400:r.BadRequest,403:r.AuthenticationError,404:r.BadRequest,405:r.BadRequest,410:r.BadRequest,429:r.BadRequest,500:r.NetworkError,503:r.NetworkError}},options:{"api-expires":this.parseToInt(this.timeout/1e3),networks:{BTC:"btc",ETH:"eth",ERC20:"eth",TRX:"trx",TRC20:"trx",XRP:"xrp",XLM:"xlm",BNB:"bnb",MATIC:"matic"}}})}async fetchMarkets(e={}){const t=await this.publicGetConstants(e),s=this.safeValue(t,"pairs",{}),i=Object.keys(s),r=[];for(let e=0;e=400&&e<=503){const t=this.id+" "+a,s=this.safeString(o,"message");this.throwBroadlyMatchedException(this.exceptions.broad,s,t);const i=e.toString();this.throwExactlyMatchedException(this.exceptions.exact,i,t)}}}},5939:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(2140),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"htx",name:"HTX",countries:["CN"],rateLimit:100,userAgent:this.userAgents.chrome100,certified:!0,version:"v1",hostname:"api.huobi.pro",pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!0,future:!0,option:void 0,addMargin:void 0,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,createDepositAddress:void 0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTrailingPercentOrder:!0,createTriggerOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBidsAsks:void 0,fetchBorrowInterest:!0,fetchBorrowRateHistories:void 0,fetchBorrowRateHistory:void 0,fetchCanceledOrders:void 0,fetchClosedOrder:void 0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:void 0,fetchDepositAddress:!0,fetchDepositAddresses:void 0,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!0,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!0,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!0,fetchL3OrderBook:void 0,fetchLastPrices:!0,fetchLedger:!0,fetchLedgerEntry:void 0,fetchLeverage:!1,fetchLeverageTiers:!0,fetchLiquidations:!0,fetchMarginAdjustmentHistory:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!0,fetchOpenInterestHistory:!0,fetchOpenOrder:void 0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:void 0,fetchOrders:!0,fetchOrderTrades:!0,fetchPosition:!0,fetchPositionHistory:"emulated",fetchPositions:!0,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!0,fetchSettlementHistory:!0,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTradingLimits:!0,fetchTransactionFee:void 0,fetchTransactionFees:void 0,fetchTransactions:void 0,fetchTransfers:void 0,fetchWithdrawAddresses:!0,fetchWithdrawal:void 0,fetchWithdrawals:!0,fetchWithdrawalWhitelist:void 0,reduceMargin:void 0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!0,setMarginMode:!1,setPositionMode:!0,signIn:void 0,transfer:!0,withdraw:!0},timeframes:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"60min","4h":"4hour","1d":"1day","1w":"1week","1M":"1mon","1y":"1year"},urls:{logo:"https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg",hostnames:{contract:"api.hbdm.com",spot:"api.huobi.pro",status:{spot:"status.huobigroup.com",future:{inverse:"status-dm.huobigroup.com",linear:"status-linear-swap.huobigroup.com"},swap:{inverse:"status-swap.huobigroup.com",linear:"status-linear-swap.huobigroup.com"}}},api:{status:"https://{hostname}",contract:"https://{hostname}",spot:"https://{hostname}",public:"https://{hostname}",private:"https://{hostname}",v2Public:"https://{hostname}",v2Private:"https://{hostname}"},www:"https://www.huobi.com",referral:{url:"https://www.huobi.com/en-us/v/register/double-invite/?inviter_id=11343840&invite_code=6rmm2223",discount:.15},doc:["https://huobiapi.github.io/docs/spot/v1/en/","https://huobiapi.github.io/docs/dm/v1/en/","https://huobiapi.github.io/docs/coin_margined_swap/v1/en/","https://huobiapi.github.io/docs/usdt_swap/v1/en/","https://www.huobi.com/en-us/opend/newApiPages/"],fees:"https://www.huobi.com/about/fee/"},api:{v2Public:{get:{"reference/currencies":1,"market-status":1}},v2Private:{get:{"account/ledger":1,"account/withdraw/quota":1,"account/withdraw/address":1,"account/deposit/address":1,"account/repayment":5,"reference/transact-fee-rate":1,"account/asset-valuation":.2,"point/account":5,"sub-user/user-list":1,"sub-user/user-state":1,"sub-user/account-list":1,"sub-user/deposit-address":1,"sub-user/query-deposit":1,"user/api-key":1,"user/uid":1,"algo-orders/opening":1,"algo-orders/history":1,"algo-orders/specific":1,"c2c/offers":1,"c2c/offer":1,"c2c/transactions":1,"c2c/repayment":1,"c2c/account":1,"etp/reference":1,"etp/transactions":5,"etp/transaction":5,"etp/rebalance":1,"etp/limit":1},post:{"account/transfer":1,"account/repayment":5,"point/transfer":5,"sub-user/management":1,"sub-user/creation":1,"sub-user/tradable-market":1,"sub-user/transferability":1,"sub-user/api-key-generation":1,"sub-user/api-key-modification":1,"sub-user/api-key-deletion":1,"sub-user/deduct-mode":1,"algo-orders":1,"algo-orders/cancel-all-after":1,"algo-orders/cancellation":1,"c2c/offer":1,"c2c/cancellation":1,"c2c/cancel-all":1,"c2c/repayment":1,"c2c/transfer":1,"etp/creation":5,"etp/redemption":5,"etp/{transactId}/cancel":10,"etp/batch-cancel":50}},public:{get:{"common/symbols":1,"common/currencys":1,"common/timestamp":1,"common/exchange":1,"settings/currencys":1}},private:{get:{"account/accounts":.2,"account/accounts/{id}/balance":.2,"account/accounts/{sub-uid}":1,"account/history":4,"cross-margin/loan-info":1,"margin/loan-info":1,"fee/fee-rate/get":1,"order/openOrders":.4,"order/orders":.4,"order/orders/{id}":.4,"order/orders/{id}/matchresults":.4,"order/orders/getClientOrder":.4,"order/history":1,"order/matchresults":1,"query/deposit-withdraw":1,"margin/loan-orders":.2,"margin/accounts/balance":.2,"cross-margin/loan-orders":1,"cross-margin/accounts/balance":1,"points/actions":1,"points/orders":1,"subuser/aggregate-balance":10,"stable-coin/exchange_rate":1,"stable-coin/quote":1},post:{"account/transfer":1,"futures/transfer":1,"order/batch-orders":.4,"order/orders/place":.2,"order/orders/submitCancelClientOrder":.2,"order/orders/batchCancelOpenOrders":.4,"order/orders/{id}/submitcancel":.2,"order/orders/batchcancel":.4,"dw/withdraw/api/create":1,"dw/withdraw-virtual/{id}/cancel":1,"dw/transfer-in/margin":10,"dw/transfer-out/margin":10,"margin/orders":10,"margin/orders/{id}/repay":10,"cross-margin/transfer-in":1,"cross-margin/transfer-out":1,"cross-margin/orders":1,"cross-margin/orders/{id}/repay":1,"stable-coin/exchange":1,"subuser/transfer":10}},status:{public:{spot:{get:{"api/v2/summary.json":1}},future:{inverse:{get:{"api/v2/summary.json":1}},linear:{get:{"api/v2/summary.json":1}}},swap:{inverse:{get:{"api/v2/summary.json":1}},linear:{get:{"api/v2/summary.json":1}}}}},spot:{public:{get:{"v2/market-status":1,"v1/common/symbols":1,"v1/common/currencys":1,"v2/settings/common/currencies":1,"v2/reference/currencies":1,"v1/common/timestamp":1,"v1/common/exchange":1,"v1/settings/common/chains":1,"v1/settings/common/currencys":1,"v1/settings/common/symbols":1,"v2/settings/common/symbols":1,"v1/settings/common/market-symbols":1,"market/history/candles":1,"market/history/kline":1,"market/detail/merged":1,"market/tickers":1,"market/detail":1,"market/depth":1,"market/trade":1,"market/history/trade":1,"market/etp":1,"v2/etp/reference":1,"v2/etp/rebalance":1}},private:{get:{"v1/account/accounts":.2,"v1/account/accounts/{account-id}/balance":.2,"v2/account/valuation":1,"v2/account/asset-valuation":.2,"v1/account/history":4,"v2/account/ledger":1,"v2/point/account":5,"v2/account/deposit/address":1,"v2/account/withdraw/quota":1,"v2/account/withdraw/address":1,"v2/reference/currencies":1,"v1/query/deposit-withdraw":1,"v1/query/withdraw/client-order-id":1,"v2/user/api-key":1,"v2/user/uid":1,"v2/sub-user/user-list":1,"v2/sub-user/user-state":1,"v2/sub-user/account-list":1,"v2/sub-user/deposit-address":1,"v2/sub-user/query-deposit":1,"v1/subuser/aggregate-balance":10,"v1/account/accounts/{sub-uid}":1,"v1/order/openOrders":.4,"v1/order/orders/{order-id}":.4,"v1/order/orders/getClientOrder":.4,"v1/order/orders/{order-id}/matchresult":.4,"v1/order/orders/{order-id}/matchresults":.4,"v1/order/orders":.4,"v1/order/history":1,"v1/order/matchresults":1,"v2/reference/transact-fee-rate":1,"v2/algo-orders/opening":1,"v2/algo-orders/history":1,"v2/algo-orders/specific":1,"v1/margin/loan-info":1,"v1/margin/loan-orders":.2,"v1/margin/accounts/balance":.2,"v1/cross-margin/loan-info":1,"v1/cross-margin/loan-orders":1,"v1/cross-margin/accounts/balance":1,"v2/account/repayment":5,"v1/stable-coin/quote":1,"v1/stable_coin/exchange_rate":1,"v2/etp/transactions":5,"v2/etp/transaction":5,"v2/etp/limit":1},post:{"v1/account/transfer":1,"v1/futures/transfer":1,"v2/point/transfer":5,"v2/account/transfer":1,"v1/dw/withdraw/api/create":1,"v1/dw/withdraw-virtual/{withdraw-id}/cancel":1,"v2/sub-user/deduct-mode":1,"v2/sub-user/creation":1,"v2/sub-user/management":1,"v2/sub-user/tradable-market":1,"v2/sub-user/transferability":1,"v2/sub-user/api-key-generation":1,"v2/sub-user/api-key-modification":1,"v2/sub-user/api-key-deletion":1,"v1/subuser/transfer":10,"v1/trust/user/active/credit":10,"v1/order/orders/place":.2,"v1/order/batch-orders":.4,"v1/order/auto/place":.2,"v1/order/orders/{order-id}/submitcancel":.2,"v1/order/orders/submitCancelClientOrder":.2,"v1/order/orders/batchCancelOpenOrders":.4,"v1/order/orders/batchcancel":.4,"v2/algo-orders/cancel-all-after":1,"v2/algo-orders":1,"v2/algo-orders/cancellation":1,"v2/account/repayment":5,"v1/dw/transfer-in/margin":10,"v1/dw/transfer-out/margin":10,"v1/margin/orders":10,"v1/margin/orders/{order-id}/repay":10,"v1/cross-margin/transfer-in":1,"v1/cross-margin/transfer-out":1,"v1/cross-margin/orders":1,"v1/cross-margin/orders/{order-id}/repay":1,"v1/stable-coin/exchange":1,"v2/etp/creation":5,"v2/etp/redemption":5,"v2/etp/{transactId}/cancel":10,"v2/etp/batch-cancel":50}}},contract:{public:{get:{"api/v1/timestamp":1,"heartbeat/":1,"api/v1/contract_contract_info":1,"api/v1/contract_index":1,"api/v1/contract_query_elements":1,"api/v1/contract_price_limit":1,"api/v1/contract_open_interest":1,"api/v1/contract_delivery_price":1,"market/depth":1,"market/bbo":1,"market/history/kline":1,"index/market/history/mark_price_kline":1,"market/detail/merged":1,"market/detail/batch_merged":1,"v2/market/detail/batch_merged":1,"market/trade":1,"market/history/trade":1,"api/v1/contract_risk_info":1,"api/v1/contract_insurance_fund":1,"api/v1/contract_adjustfactor":1,"api/v1/contract_his_open_interest":1,"api/v1/contract_ladder_margin":1,"api/v1/contract_api_state":1,"api/v1/contract_elite_account_ratio":1,"api/v1/contract_elite_position_ratio":1,"api/v1/contract_liquidation_orders":1,"api/v1/contract_settlement_records":1,"index/market/history/index":1,"index/market/history/basis":1,"api/v1/contract_estimated_settlement_price":1,"api/v3/contract_liquidation_orders":1,"swap-api/v1/swap_contract_info":1,"swap-api/v1/swap_index":1,"swap-api/v1/swap_query_elements":1,"swap-api/v1/swap_price_limit":1,"swap-api/v1/swap_open_interest":1,"swap-ex/market/depth":1,"swap-ex/market/bbo":1,"swap-ex/market/history/kline":1,"index/market/history/swap_mark_price_kline":1,"swap-ex/market/detail/merged":1,"v2/swap-ex/market/detail/batch_merged":1,"index/market/history/swap_premium_index_kline":1,"swap-ex/market/detail/batch_merged":1,"swap-ex/market/trade":1,"swap-ex/market/history/trade":1,"swap-api/v1/swap_risk_info":1,"swap-api/v1/swap_insurance_fund":1,"swap-api/v1/swap_adjustfactor":1,"swap-api/v1/swap_his_open_interest":1,"swap-api/v1/swap_ladder_margin":1,"swap-api/v1/swap_api_state":1,"swap-api/v1/swap_elite_account_ratio":1,"swap-api/v1/swap_elite_position_ratio":1,"swap-api/v1/swap_estimated_settlement_price":1,"swap-api/v1/swap_liquidation_orders":1,"swap-api/v1/swap_settlement_records":1,"swap-api/v1/swap_funding_rate":1,"swap-api/v1/swap_batch_funding_rate":1,"swap-api/v1/swap_historical_funding_rate":1,"swap-api/v3/swap_liquidation_orders":1,"index/market/history/swap_estimated_rate_kline":1,"index/market/history/swap_basis":1,"linear-swap-api/v1/swap_contract_info":1,"linear-swap-api/v1/swap_index":1,"linear-swap-api/v1/swap_query_elements":1,"linear-swap-api/v1/swap_price_limit":1,"linear-swap-api/v1/swap_open_interest":1,"linear-swap-ex/market/depth":1,"linear-swap-ex/market/bbo":1,"linear-swap-ex/market/history/kline":1,"index/market/history/linear_swap_mark_price_kline":1,"linear-swap-ex/market/detail/merged":1,"linear-swap-ex/market/detail/batch_merged":1,"v2/linear-swap-ex/market/detail/batch_merged":1,"linear-swap-ex/market/trade":1,"linear-swap-ex/market/history/trade":1,"linear-swap-api/v1/swap_risk_info":1,"swap-api/v1/linear-swap-api/v1/swap_insurance_fund":1,"linear-swap-api/v1/swap_adjustfactor":1,"linear-swap-api/v1/swap_cross_adjustfactor":1,"linear-swap-api/v1/swap_his_open_interest":1,"linear-swap-api/v1/swap_ladder_margin":1,"linear-swap-api/v1/swap_cross_ladder_margin":1,"linear-swap-api/v1/swap_api_state":1,"linear-swap-api/v1/swap_cross_transfer_state":1,"linear-swap-api/v1/swap_cross_trade_state":1,"linear-swap-api/v1/swap_elite_account_ratio":1,"linear-swap-api/v1/swap_elite_position_ratio":1,"linear-swap-api/v1/swap_liquidation_orders":1,"linear-swap-api/v1/swap_settlement_records":1,"linear-swap-api/v1/swap_funding_rate":1,"linear-swap-api/v1/swap_batch_funding_rate":1,"linear-swap-api/v1/swap_historical_funding_rate":1,"linear-swap-api/v3/swap_liquidation_orders":1,"index/market/history/linear_swap_premium_index_kline":1,"index/market/history/linear_swap_estimated_rate_kline":1,"index/market/history/linear_swap_basis":1,"linear-swap-api/v1/swap_estimated_settlement_price":1}},private:{get:{"api/v1/contract_sub_auth_list":1,"api/v1/contract_api_trading_status":1,"swap-api/v1/swap_sub_auth_list":1,"swap-api/v1/swap_api_trading_status":1,"linear-swap-api/v1/swap_sub_auth_list":1,"linear-swap-api/v1/swap_api_trading_status":1,"linear-swap-api/v1/swap_cross_position_side":1,"linear-swap-api/v1/swap_position_side":1,"linear-swap-api/v3/unified_account_info":1,"linear-swap-api/v3/fix_position_margin_change_record":1,"linear-swap-api/v3/swap_unified_account_type":1,"linear-swap-api/v3/linear_swap_overview_account_info":1},post:{"api/v1/contract_balance_valuation":1,"api/v1/contract_account_info":1,"api/v1/contract_position_info":1,"api/v1/contract_sub_auth":1,"api/v1/contract_sub_account_list":1,"api/v1/contract_sub_account_info_list":1,"api/v1/contract_sub_account_info":1,"api/v1/contract_sub_position_info":1,"api/v1/contract_financial_record":1,"api/v1/contract_financial_record_exact":1,"api/v1/contract_user_settlement_records":1,"api/v1/contract_order_limit":1,"api/v1/contract_fee":1,"api/v1/contract_transfer_limit":1,"api/v1/contract_position_limit":1,"api/v1/contract_account_position_info":1,"api/v1/contract_master_sub_transfer":1,"api/v1/contract_master_sub_transfer_record":1,"api/v1/contract_available_level_rate":1,"api/v3/contract_financial_record":1,"api/v3/contract_financial_record_exact":1,"api/v1/contract-cancel-after":1,"api/v1/contract_order":1,"api/v1/contract_batchorder":1,"api/v1/contract_cancel":1,"api/v1/contract_cancelall":1,"api/v1/contract_switch_lever_rate":1,"api/v1/lightning_close_position":1,"api/v1/contract_order_info":1,"api/v1/contract_order_detail":1,"api/v1/contract_openorders":1,"api/v1/contract_hisorders":1,"api/v1/contract_hisorders_exact":1,"api/v1/contract_matchresults":1,"api/v1/contract_matchresults_exact":1,"api/v3/contract_hisorders":1,"api/v3/contract_hisorders_exact":1,"api/v3/contract_matchresults":1,"api/v3/contract_matchresults_exact":1,"api/v1/contract_trigger_order":1,"api/v1/contract_trigger_cancel":1,"api/v1/contract_trigger_cancelall":1,"api/v1/contract_trigger_openorders":1,"api/v1/contract_trigger_hisorders":1,"api/v1/contract_tpsl_order":1,"api/v1/contract_tpsl_cancel":1,"api/v1/contract_tpsl_cancelall":1,"api/v1/contract_tpsl_openorders":1,"api/v1/contract_tpsl_hisorders":1,"api/v1/contract_relation_tpsl_order":1,"api/v1/contract_track_order":1,"api/v1/contract_track_cancel":1,"api/v1/contract_track_cancelall":1,"api/v1/contract_track_openorders":1,"api/v1/contract_track_hisorders":1,"swap-api/v1/swap_balance_valuation":1,"swap-api/v1/swap_account_info":1,"swap-api/v1/swap_position_info":1,"swap-api/v1/swap_account_position_info":1,"swap-api/v1/swap_sub_auth":1,"swap-api/v1/swap_sub_account_list":1,"swap-api/v1/swap_sub_account_info_list":1,"swap-api/v1/swap_sub_account_info":1,"swap-api/v1/swap_sub_position_info":1,"swap-api/v1/swap_financial_record":1,"swap-api/v1/swap_financial_record_exact":1,"swap-api/v1/swap_user_settlement_records":1,"swap-api/v1/swap_available_level_rate":1,"swap-api/v1/swap_order_limit":1,"swap-api/v1/swap_fee":1,"swap-api/v1/swap_transfer_limit":1,"swap-api/v1/swap_position_limit":1,"swap-api/v1/swap_master_sub_transfer":1,"swap-api/v1/swap_master_sub_transfer_record":1,"swap-api/v3/swap_financial_record":1,"swap-api/v3/swap_financial_record_exact":1,"swap-api/v1/swap-cancel-after":1,"swap-api/v1/swap_order":1,"swap-api/v1/swap_batchorder":1,"swap-api/v1/swap_cancel":1,"swap-api/v1/swap_cancelall":1,"swap-api/v1/swap_lightning_close_position":1,"swap-api/v1/swap_switch_lever_rate":1,"swap-api/v1/swap_order_info":1,"swap-api/v1/swap_order_detail":1,"swap-api/v1/swap_openorders":1,"swap-api/v1/swap_hisorders":1,"swap-api/v1/swap_hisorders_exact":1,"swap-api/v1/swap_matchresults":1,"swap-api/v1/swap_matchresults_exact":1,"swap-api/v3/swap_matchresults":1,"swap-api/v3/swap_matchresults_exact":1,"swap-api/v3/swap_hisorders":1,"swap-api/v3/swap_hisorders_exact":1,"swap-api/v1/swap_trigger_order":1,"swap-api/v1/swap_trigger_cancel":1,"swap-api/v1/swap_trigger_cancelall":1,"swap-api/v1/swap_trigger_openorders":1,"swap-api/v1/swap_trigger_hisorders":1,"swap-api/v1/swap_tpsl_order":1,"swap-api/v1/swap_tpsl_cancel":1,"swap-api/v1/swap_tpsl_cancelall":1,"swap-api/v1/swap_tpsl_openorders":1,"swap-api/v1/swap_tpsl_hisorders":1,"swap-api/v1/swap_relation_tpsl_order":1,"swap-api/v1/swap_track_order":1,"swap-api/v1/swap_track_cancel":1,"swap-api/v1/swap_track_cancelall":1,"swap-api/v1/swap_track_openorders":1,"swap-api/v1/swap_track_hisorders":1,"linear-swap-api/v1/swap_lever_position_limit":1,"linear-swap-api/v1/swap_cross_lever_position_limit":1,"linear-swap-api/v1/swap_balance_valuation":1,"linear-swap-api/v1/swap_account_info":1,"linear-swap-api/v1/swap_cross_account_info":1,"linear-swap-api/v1/swap_position_info":1,"linear-swap-api/v1/swap_cross_position_info":1,"linear-swap-api/v1/swap_account_position_info":1,"linear-swap-api/v1/swap_cross_account_position_info":1,"linear-swap-api/v1/swap_sub_auth":1,"linear-swap-api/v1/swap_sub_account_list":1,"linear-swap-api/v1/swap_cross_sub_account_list":1,"linear-swap-api/v1/swap_sub_account_info_list":1,"linear-swap-api/v1/swap_cross_sub_account_info_list":1,"linear-swap-api/v1/swap_sub_account_info":1,"linear-swap-api/v1/swap_cross_sub_account_info":1,"linear-swap-api/v1/swap_sub_position_info":1,"linear-swap-api/v1/swap_cross_sub_position_info":1,"linear-swap-api/v1/swap_financial_record":1,"linear-swap-api/v1/swap_financial_record_exact":1,"linear-swap-api/v1/swap_user_settlement_records":1,"linear-swap-api/v1/swap_cross_user_settlement_records":1,"linear-swap-api/v1/swap_available_level_rate":1,"linear-swap-api/v1/swap_cross_available_level_rate":1,"linear-swap-api/v1/swap_order_limit":1,"linear-swap-api/v1/swap_fee":1,"linear-swap-api/v1/swap_transfer_limit":1,"linear-swap-api/v1/swap_cross_transfer_limit":1,"linear-swap-api/v1/swap_position_limit":1,"linear-swap-api/v1/swap_cross_position_limit":1,"linear-swap-api/v1/swap_master_sub_transfer":1,"linear-swap-api/v1/swap_master_sub_transfer_record":1,"linear-swap-api/v1/swap_transfer_inner":1,"linear-swap-api/v3/swap_financial_record":1,"linear-swap-api/v3/swap_financial_record_exact":1,"linear-swap-api/v1/swap_order":1,"linear-swap-api/v1/swap_cross_order":1,"linear-swap-api/v1/swap_batchorder":1,"linear-swap-api/v1/swap_cross_batchorder":1,"linear-swap-api/v1/swap_cancel":1,"linear-swap-api/v1/swap_cross_cancel":1,"linear-swap-api/v1/swap_cancelall":1,"linear-swap-api/v1/swap_cross_cancelall":1,"linear-swap-api/v1/swap_switch_lever_rate":1,"linear-swap-api/v1/swap_cross_switch_lever_rate":1,"linear-swap-api/v1/swap_lightning_close_position":1,"linear-swap-api/v1/swap_cross_lightning_close_position":1,"linear-swap-api/v1/swap_order_info":1,"linear-swap-api/v1/swap_cross_order_info":1,"linear-swap-api/v1/swap_order_detail":1,"linear-swap-api/v1/swap_cross_order_detail":1,"linear-swap-api/v1/swap_openorders":1,"linear-swap-api/v1/swap_cross_openorders":1,"linear-swap-api/v1/swap_hisorders":1,"linear-swap-api/v1/swap_cross_hisorders":1,"linear-swap-api/v1/swap_hisorders_exact":1,"linear-swap-api/v1/swap_cross_hisorders_exact":1,"linear-swap-api/v1/swap_matchresults":1,"linear-swap-api/v1/swap_cross_matchresults":1,"linear-swap-api/v1/swap_matchresults_exact":1,"linear-swap-api/v1/swap_cross_matchresults_exact":1,"linear-swap-api/v1/linear-cancel-after":1,"linear-swap-api/v1/swap_switch_position_mode":1,"linear-swap-api/v1/swap_cross_switch_position_mode":1,"linear-swap-api/v3/swap_matchresults":1,"linear-swap-api/v3/swap_cross_matchresults":1,"linear-swap-api/v3/swap_matchresults_exact":1,"linear-swap-api/v3/swap_cross_matchresults_exact":1,"linear-swap-api/v3/swap_hisorders":1,"linear-swap-api/v3/swap_cross_hisorders":1,"linear-swap-api/v3/swap_hisorders_exact":1,"linear-swap-api/v3/swap_cross_hisorders_exact":1,"linear-swap-api/v3/fix_position_margin_change":1,"linear-swap-api/v3/swap_switch_account_type":1,"linear-swap-api/v3/linear_swap_fee_switch":1,"linear-swap-api/v1/swap_trigger_order":1,"linear-swap-api/v1/swap_cross_trigger_order":1,"linear-swap-api/v1/swap_trigger_cancel":1,"linear-swap-api/v1/swap_cross_trigger_cancel":1,"linear-swap-api/v1/swap_trigger_cancelall":1,"linear-swap-api/v1/swap_cross_trigger_cancelall":1,"linear-swap-api/v1/swap_trigger_openorders":1,"linear-swap-api/v1/swap_cross_trigger_openorders":1,"linear-swap-api/v1/swap_trigger_hisorders":1,"linear-swap-api/v1/swap_cross_trigger_hisorders":1,"linear-swap-api/v1/swap_tpsl_order":1,"linear-swap-api/v1/swap_cross_tpsl_order":1,"linear-swap-api/v1/swap_tpsl_cancel":1,"linear-swap-api/v1/swap_cross_tpsl_cancel":1,"linear-swap-api/v1/swap_tpsl_cancelall":1,"linear-swap-api/v1/swap_cross_tpsl_cancelall":1,"linear-swap-api/v1/swap_tpsl_openorders":1,"linear-swap-api/v1/swap_cross_tpsl_openorders":1,"linear-swap-api/v1/swap_tpsl_hisorders":1,"linear-swap-api/v1/swap_cross_tpsl_hisorders":1,"linear-swap-api/v1/swap_relation_tpsl_order":1,"linear-swap-api/v1/swap_cross_relation_tpsl_order":1,"linear-swap-api/v1/swap_track_order":1,"linear-swap-api/v1/swap_cross_track_order":1,"linear-swap-api/v1/swap_track_cancel":1,"linear-swap-api/v1/swap_cross_track_cancel":1,"linear-swap-api/v1/swap_track_cancelall":1,"linear-swap-api/v1/swap_cross_track_cancelall":1,"linear-swap-api/v1/swap_track_openorders":1,"linear-swap-api/v1/swap_cross_track_openorders":1,"linear-swap-api/v1/swap_track_hisorders":1,"linear-swap-api/v1/swap_cross_track_hisorders":1}}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},exceptions:{broad:{"contract is restricted of closing positions on API. Please contact customer service":r.OnMaintenance,maintain:r.OnMaintenance,"API key has no permission":r.PermissionDenied},exact:{403:r.AuthenticationError,1010:r.AccountNotEnabled,1003:r.AuthenticationError,1013:r.BadSymbol,1017:r.OrderNotFound,1034:r.InvalidOrder,1036:r.InvalidOrder,1039:r.InvalidOrder,1041:r.InvalidOrder,1047:r.InsufficientFunds,1048:r.InsufficientFunds,1051:r.InvalidOrder,1066:r.BadSymbol,1067:r.InvalidOrder,1094:r.InvalidOrder,1220:r.AccountNotEnabled,1303:r.BadRequest,1461:r.InvalidOrder,4007:r.BadRequest,"bad-request":r.BadRequest,"validation-format-error":r.BadRequest,"validation-constraints-required":r.BadRequest,"base-date-limit-error":r.BadRequest,"api-not-support-temp-addr":r.PermissionDenied,timeout:r.RequestTimeout,"gateway-internal-error":r.ExchangeNotAvailable,"account-frozen-balance-insufficient-error":r.InsufficientFunds,"invalid-amount":r.InvalidOrder,"order-limitorder-amount-min-error":r.InvalidOrder,"order-limitorder-amount-max-error":r.InvalidOrder,"order-marketorder-amount-min-error":r.InvalidOrder,"order-limitorder-price-min-error":r.InvalidOrder,"order-limitorder-price-max-error":r.InvalidOrder,"order-stop-order-hit-trigger":r.InvalidOrder,"order-value-min-error":r.InvalidOrder,"order-invalid-price":r.InvalidOrder,"order-holding-limit-failed":r.InvalidOrder,"order-orderprice-precision-error":r.InvalidOrder,"order-etp-nav-price-max-error":r.InvalidOrder,"order-orderstate-error":r.OrderNotFound,"order-queryorder-invalid":r.OrderNotFound,"order-update-error":r.ExchangeNotAvailable,"api-signature-check-failed":r.AuthenticationError,"api-signature-not-valid":r.AuthenticationError,"base-record-invalid":r.OrderNotFound,"base-symbol-trade-disabled":r.BadSymbol,"base-symbol-error":r.BadSymbol,"system-maintenance":r.OnMaintenance,"base-request-exceed-frequency-limit":r.RateLimitExceeded,"invalid symbol":r.BadSymbol,"symbol trade not open now":r.BadSymbol,"require-symbol":r.BadSymbol,"invalid-address":r.BadRequest,"base-currency-chain-error":r.BadRequest,"dw-insufficient-balance":r.InsufficientFunds,"base-withdraw-fee-error":r.BadRequest,"dw-withdraw-min-limit":r.BadRequest,"request limit":r.RateLimitExceeded}},precisionMode:o.sh,options:{fetchMarkets:{types:{spot:!0,linear:!0,inverse:!0}},fetchOHLCV:{useHistoricalEndpointForSpot:!0},withdraw:{includeFee:!1},defaultType:"spot",defaultSubType:"linear",defaultNetwork:"ERC20",defaultNetworks:{ETH:"ERC20",BTC:"BTC",USDT:"TRC20"},networks:{TRC20:"TRX",BTC:"BTC",ERC20:"ETH",SOL:"SOLANA",HRC20:"HECO",BEP20:"BSC",XMR:"XMR",LTC:"LTC",XRP:"XRP",XLM:"XLM",CRONOS:"CRO",CRO:"CRO",GLMR:"GLMR",POLYGON:"MATIC",MATIC:"MATIC",BTT:"BTT",CUBE:"CUBE",IOST:"IOST",NEO:"NEO",KLAY:"KLAY",EOS:"EOS",THETA:"THETA",NAS:"NAS",NULS:"NULS",QTUM:"QTUM",FTM:"FTM",CELO:"CELO",DOGE:"DOGE",DOGECHAIN:"DOGECHAIN",NEAR:"NEAR",STEP:"STEP",BITCI:"BITCI",CARDANO:"ADA",ADA:"ADA",ETC:"ETC",LUK:"LUK",MINEPLEX:"MINEPLEX",DASH:"DASH",ZEC:"ZEC",IOTA:"IOTA",NEON3:"NEON3",XEM:"XEM",HC:"HC",LSK:"LSK",DCR:"DCR",BTG:"BTG",STEEM:"STEEM",BTS:"BTS",ICX:"ICX",WAVES:"WAVES",CMT:"CMT",BTM:"BTM",VET:"VET",XZC:"XZC",ACT:"ACT",SMT:"SMT",BCD:"BCD",WAX:"WAX1",WICC:"WICC",ELF:"ELF",ZIL:"ZIL",ELA:"ELA",BCX:"BCX",SBTC:"SBTC",BIFI:"BIFI",CTXC:"CTXC",WAN:"WAN",POLYX:"POLYX",PAI:"PAI",WTC:"WTC",DGB:"DGB",XVG:"XVG",AAC:"AAC",AE:"AE",SEELE:"SEELE",BCV:"BCV",GRS:"GRS",ARDR:"ARDR",NANO:"NANO",ZEN:"ZEN",RBTC:"RBTC",BSV:"BSV",GAS:"GAS",XTZ:"XTZ",LAMB:"LAMB",CVNT1:"CVNT1",DOCK:"DOCK",SC:"SC",KMD:"KMD",ETN:"ETN",TOP:"TOP",IRIS:"IRIS",UGAS:"UGAS",TT:"TT",NEWTON:"NEWTON",VSYS:"VSYS",FSN:"FSN",BHD:"BHD",ONE:"ONE",EM:"EM",CKB:"CKB",EOSS:"EOSS",HIVE:"HIVE",RVN:"RVN",DOT:"DOT",KSM:"KSM",BAND:"BAND",OEP4:"OEP4",NBS:"NBS",FIS:"FIS",AR:"AR",HBAR:"HBAR",FIL:"FIL",MASS:"MASS",KAVA:"KAVA",XYM:"XYM",ENJ:"ENJ",CRUST:"CRUST",ICP:"ICP",CSPR:"CSPR",FLOW:"FLOW",IOTX:"IOTX",LAT:"LAT",APT:"APT",XCH:"XCH",MINA:"MINA",XEC:"ECASH",XPRT:"XPRT",CCA:"ACA",AOTI:"COTI",AKT:"AKT",ARS:"ARS",ASTR:"ASTR",AZERO:"AZERO",BLD:"BLD",BRISE:"BRISE",CORE:"CORE",DESO:"DESO",DFI:"DFI",EGLD:"EGLD",ERG:"ERG",ETHF:"ETHFAIR",ETHW:"ETHW",EVMOS:"EVMOS",FIO:"FIO",FLR:"FLR",FINSCHIA:"FINSCHIA",KMA:"KMA",KYVE:"KYVE",MEV:"MEV",MOVR:"MOVR",NODL:"NODL",OAS:"OAS",OSMO:"OSMO",PAYCOIN:"PAYCOIN",POKT:"POKT",PYG:"PYG",REI:"REI",SCRT:"SCRT",SDN:"SDN",SEI:"SEI",SGB:"SGB",SUI:"SUI",SXP:"SOLAR",SYS:"SYS",TENET:"TENET",TON:"TON",UNQ:"UNQ",UYU:"UYU",WEMIX:"WEMIX",XDC:"XDC",XPLA:"XPLA"},fetchOrdersByStatesMethod:"spot_private_get_v1_order_orders",createMarketBuyOrderRequiresPrice:!0,language:"en-US",broker:{id:"AA03022abc"},accountsByType:{spot:"pro",funding:"pro",future:"futures"},accountsById:{spot:"spot",margin:"margin",otc:"otc",point:"point","super-margin":"super-margin",investment:"investment",borrow:"borrow","grid-trading":"grid-trading","deposit-earning":"deposit-earning","otc-options":"otc-options"},typesByAccount:{pro:"spot",futures:"future"},spot:{stopOrderTypes:{"stop-limit":!0,"buy-stop-limit":!0,"sell-stop-limit":!0,"stop-limit-fok":!0,"buy-stop-limit-fok":!0,"sell-stop-limit-fok":!0},limitOrderTypes:{limit:!0,"buy-limit":!0,"sell-limit":!0,ioc:!0,"buy-ioc":!0,"sell-ioc":!0,"limit-maker":!0,"buy-limit-maker":!0,"sell-limit-maker":!0,"stop-limit":!0,"buy-stop-limit":!0,"sell-stop-limit":!0,"limit-fok":!0,"buy-limit-fok":!0,"sell-limit-fok":!0,"stop-limit-fok":!0,"buy-stop-limit-fok":!0,"sell-stop-limit-fok":!0}}},commonCurrencies:{GET:"Themis",GTC:"Game.com",HIT:"HitChain",PNT:"Penta",SBTC:"Super Bitcoin",SOUL:"Soulsaver",BIFI:"Bitcoin File"}})}async fetchStatus(e={}){let t;await this.loadMarkets(),[t,e]=this.handleMarketTypeAndParams("fetchStatus",void 0,e);const s=this.handleOption("fetchStatus","enableForContracts",!1);let i,r,a,o;if("spot"!==t&&s){const s=this.safeString(e,"subType",this.options.defaultSubType);"swap"===t?"linear"===s?i=await this.statusPublicSwapLinearGetApiV2SummaryJson():"inverse"===s&&(i=await this.statusPublicSwapInverseGetApiV2SummaryJson()):"future"===t?"linear"===s?i=await this.statusPublicFutureLinearGetApiV2SummaryJson():"inverse"===s&&(i=await this.statusPublicFutureInverseGetApiV2SummaryJson()):"contract"===t&&(i=await this.contractPublicGetHeartbeat())}else"spot"===t&&(i=await this.statusPublicSpotGetApiV2SummaryJson());if("contract"===t){const e=this.safeString(i,"status");r=void 0===e?void 0:"ok"===e?"ok":"maintenance",a=this.safeString(i,"ts")}else{const e=this.safeValue(i,"status",{});r="none"===this.safeString(e,"indicator")?"ok":"maintenance";const t=this.safeValue(i,"page",{}),s=this.safeString(t,"updated_at");a=this.parse8601(s),o=this.safeString(t,"url")}return{status:r,updated:a,eta:void 0,url:o,info:i}}async fetchTime(e={}){const t=this.safeValue(this.options,"fetchTime",{}),s=this.safeString(this.options,"defaultType","spot");let i,r=this.safeString(t,"type",s);return r=this.safeString(e,"type",r),i="future"===r||"swap"===r?await this.contractPublicGetApiV1Timestamp(e):await this.spotPublicGetV1CommonTimestamp(e),this.safeInteger2(i,"data","ts")}parseTradingFee(e,t=void 0){const s=this.safeString(e,"symbol");return{info:e,symbol:this.safeSymbol(s,t),maker:this.safeNumber(e,"actualMakerRate"),taker:this.safeNumber(e,"actualTakerRate"),percentage:void 0,tierBased:void 0}}async fetchTradingFee(e,t={}){await this.loadMarkets();const s=this.market(e),i={symbols:s.id},r=await this.spotPrivateGetV2ReferenceTransactFeeRate(this.extend(i,t)),a=this.safeValue(r,"data",[]),o=this.safeValue(a,0,{});return this.parseTradingFee(o,s)}async fetchTradingLimits(e=void 0,t={}){await this.loadMarkets(),void 0===e&&(e=this.symbols);const s={};for(let i=0;i=0?c="sell"===a?this.safeString(e,"field-cash-amount"):this.safeString(e,"amount"):(l=this.safeString2(e,"volume","amount"),c=this.safeStringN(e,["filled-cash-amount","field-cash-amount","trade_turnover"]));const u=this.safeStringN(e,["filled-amount","field-amount","trade_volume"]),p=this.safeString2(e,"price","order_price");let f,m=this.safeString2(e,"filled-fees","field-fees");if(m=this.safeString(e,"fee",m),void 0!==m){let s;const i=this.safeString(e,"fee_asset");s=void 0!==i?this.safeCurrencyCode(i):"sell"===a?t.quote:t.base,f={cost:m,currency:s}}const g=this.safeString2(e,"stop-price","trigger_price"),v=this.safeString(e,"trade_avg_price"),y=this.safeValue(e,"trades"),w=this.safeInteger(e,"reduce_only");let b;return void 0!==w&&(b=0!==w),this.safeOrder({info:e,id:r,clientOrderId:h,timestamp:d,datetime:this.iso8601(d),lastTradeTimestamp:void 0,symbol:t.symbol,type:o,timeInForce:void 0,postOnly:void 0,side:a,price:p,stopPrice:g,triggerPrice:g,average:v,cost:c,amount:l,filled:u,remaining:void 0,status:i,reduceOnly:b,fee:f,trades:y},t)}async createMarketBuyOrderWithCost(e,t,s={}){await this.loadMarkets();if(!this.market(e).spot)throw new r.NotSupported(this.id+" createMarketBuyOrderWithCost() supports spot orders only");return s.createMarketBuyOrderRequiresPrice=!1,await this.createOrder(e,"market","buy",t,void 0,s)}async createTrailingPercentOrder(e,t,s,i,a=void 0,o=void 0,n=void 0,d={}){if(void 0===o)throw new r.ArgumentsRequired(this.id+" createTrailingPercentOrder() requires a trailingPercent argument");if(void 0===n)throw new r.ArgumentsRequired(this.id+" createTrailingPercentOrder() requires a trailingTriggerPrice argument");return d.trailingPercent=o,d.trailingTriggerPrice=n,await this.createOrder(e,t,s,i,a,d)}async createSpotOrderRequest(e,t,s,i,o=void 0,n={}){await this.loadMarkets(),await this.loadAccounts();const d=this.market(e);let h;[h,n]=this.handleMarginModeAndParams("createOrder",n);const c={"account-id":await this.fetchAccountIdByType(d.type,h,e),symbol:d.id};let l=t.replace("buy-","");l=l.replace("sell-","");const u=this.safeValue(this.options,d.type,{}),p=this.safeString2(n,"stopPrice","stop-price");if(void 0===p){if(l in this.safeValue(u,"stopOrderTypes",{}))throw new r.ArgumentsRequired(this.id+" createOrder() requires a stopPrice or a stop-price parameter for a stop order")}else{const i="sell"===s?"lte":"gte",a=this.safeString(n,"operator",i);if(c["stop-price"]=this.priceToPrecision(e,p),c.operator=a,"limit"===l||"limit-fok"===l)l="stop-"+l;else if("stop-limit"!==l&&"stop-limit-fok"!==l)throw new r.NotSupported(this.id+" createOrder() does not support "+t+" orders")}let f;[f,n]=this.handlePostOnly("market"===l,"limit-maker"===l,n),f&&(l="limit-maker");const m=this.safeString(n,"timeInForce","GTC");"FOK"===m?l+="-fok":"IOC"===m&&(l="ioc"),c.type=s+"-"+l;const g=this.safeString2(n,"clientOrderId","client-order-id");if(void 0===g){const e=this.safeValue(this.options,"broker",{}),t=this.safeString(e,"id");c["client-order-id"]=t+this.uuid()}else c["client-order-id"]=g;if("cross"===h?c.source="super-margin-api":"isolated"===h?c.source="margin-api":"c2c"===h&&(c.source="c2c-margin-api"),"market"===l&&"buy"===s){let t,s=!0;[s,n]=this.handleOptionAndParams(n,"createOrder","createMarketBuyOrderRequiresPrice",!0);const d=this.safeNumber(n,"cost");if(n=this.omit(n,"cost"),void 0!==d)t=this.amountToPrecision(e,d);else if(s){if(void 0===o)throw new r.InvalidOrder(this.id+" createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument");{const s=this.numberToString(i),r=this.numberToString(o);t=this.amountToPrecision(e,a.O.stringMul(s,r))}}else t=this.amountToPrecision(e,i);c.amount=t}else c.amount=this.amountToPrecision(e,i);return l in this.safeValue(u,"limitOrderTypes",{})&&(c.price=this.priceToPrecision(e,o)),n=this.omit(n,["stopPrice","stop-price","clientOrderId","client-order-id","operator","timeInForce"]),this.extend(c,n)}createContractOrderRequest(e,t,s,i,r=void 0,o={}){const n={contract_code:this.market(e).id,volume:this.amountToPrecision(e,i),direction:s};let d;[d,o]=this.handlePostOnly("market"===t,"post_only"===t,o),d&&(t="post_only");const h=this.safeString(o,"timeInForce","GTC");"FOK"===h?t="fok":"IOC"===h&&(t="ioc");const c=this.safeNumber2(o,"stopPrice","trigger_price"),l=this.safeNumber2(o,"stopLossPrice","sl_trigger_price"),u=this.safeNumber2(o,"takeProfitPrice","tp_trigger_price"),p=this.safeString2(o,"trailingPercent","callback_rate"),f=this.safeNumber(o,"trailingTriggerPrice",r),m=void 0!==p,g=void 0!==l,v=void 0!==u;if(void 0!==c){const t=this.safeString2(o,"triggerType","trigger_type","le");n.trigger_type=t,n.trigger_price=this.priceToPrecision(e,c),void 0!==r&&(n.order_price=this.priceToPrecision(e,r))}else if(g||v)g?(n.sl_order_price_type=t,n.sl_trigger_price=this.priceToPrecision(e,l),void 0!==r&&(n.sl_order_price=this.priceToPrecision(e,r))):(n.tp_order_price_type=t,n.tp_trigger_price=this.priceToPrecision(e,u),void 0!==r&&(n.tp_order_price=this.priceToPrecision(e,r)));else if(m){const e=a.O.stringDiv(p,"100");n.callback_rate=this.parseToNumeric(e),n.active_price=f,n.order_price_type=this.safeString(o,"order_price_type","formula_price")}else{const s=this.safeInteger2(o,"client_order_id","clientOrderId");void 0!==s&&(n.client_order_id=s,o=this.omit(o,["clientOrderId"])),"limit"!==t&&"ioc"!==t&&"fok"!==t&&"post_only"!==t||(n.price=this.priceToPrecision(e,r))}if(!g&&!v){this.safeValue2(o,"reduceOnly","reduce_only",!1)&&(n.reduce_only=1),n.lever_rate=this.safeIntegerN(o,["leverRate","lever_rate","leverage"],1),m||(n.order_price_type=t)}const y=this.safeValue(this.options,"broker",{}),w=this.safeString(y,"id");return n.channel_code=w,o=this.omit(o,["reduceOnly","stopPrice","stopLossPrice","takeProfitPrice","triggerType","leverRate","timeInForce","leverage","trailingPercent","trailingTriggerPrice"]),this.extend(n,o)}async createOrder(e,t,s,i,a=void 0,o={}){await this.loadMarkets();const n=this.market(e),d=this.safeNumber2(o,"stopPrice","trigger_price"),h=this.safeNumber2(o,"stopLossPrice","sl_trigger_price"),c=this.safeNumber2(o,"takeProfitPrice","tp_trigger_price"),l=void 0!==this.safeNumber(o,"trailingPercent"),u=void 0!==d,p=void 0!==h,f=void 0!==c;let m,g,v;if(n.spot){if(l)throw new r.NotSupported(this.id+" createOrder() does not support trailing orders for spot markets");const n=await this.createSpotOrderRequest(e,t,s,i,a,o);m=await this.spotPrivatePostV1OrderOrdersPlace(n)}else{let r=this.createContractOrderRequest(e,t,s,i,a,o);if(n.linear){let e;[e,r]=this.handleMarginModeAndParams("createOrder",r),e=void 0===e?"cross":e,"isolated"===e?m=u?await this.contractPrivatePostLinearSwapApiV1SwapTriggerOrder(r):p||f?await this.contractPrivatePostLinearSwapApiV1SwapTpslOrder(r):l?await this.contractPrivatePostLinearSwapApiV1SwapTrackOrder(r):await this.contractPrivatePostLinearSwapApiV1SwapOrder(r):"cross"===e&&(m=u?await this.contractPrivatePostLinearSwapApiV1SwapCrossTriggerOrder(r):p||f?await this.contractPrivatePostLinearSwapApiV1SwapCrossTpslOrder(r):l?await this.contractPrivatePostLinearSwapApiV1SwapCrossTrackOrder(r):await this.contractPrivatePostLinearSwapApiV1SwapCrossOrder(r))}else n.inverse&&(n.swap?m=u?await this.contractPrivatePostSwapApiV1SwapTriggerOrder(r):p||f?await this.contractPrivatePostSwapApiV1SwapTpslOrder(r):l?await this.contractPrivatePostSwapApiV1SwapTrackOrder(r):await this.contractPrivatePostSwapApiV1SwapOrder(r):n.future&&(m=u?await this.contractPrivatePostApiV1ContractTriggerOrder(r):p||f?await this.contractPrivatePostApiV1ContractTpslOrder(r):l?await this.contractPrivatePostApiV1ContractTrackOrder(r):await this.contractPrivatePostApiV1ContractOrder(r)))}return n.spot?this.safeOrder({info:m,id:this.safeString(m,"data"),timestamp:void 0,datetime:void 0,lastTradeTimestamp:void 0,status:void 0,symbol:void 0,type:t,side:s,price:a,amount:i,filled:void 0,remaining:void 0,cost:void 0,trades:void 0,fee:void 0,clientOrderId:void 0,average:void 0},n):(p?(g=this.safeValue(m,"data",{}),v=this.safeValue(g,"sl_order",{})):f?(g=this.safeValue(m,"data",{}),v=this.safeValue(g,"tp_order",{})):v=this.safeValue(m,"data",{}),this.parseOrder(v,n))}async createOrders(e,t={}){await this.loadMarkets();const s=[];let i,a,o;for(let t=0;t0?this.parseToInt(e/1e3):0};return await this.v2PrivatePostAlgoOrdersCancelAllAfter(this.extend(s,t))}parseDepositAddress(e,t=void 0){const s=this.safeString(e,"address"),i=this.safeString(e,"addressTag"),r=this.safeString(e,"currency");t=this.safeCurrency(r,t);const a=this.safeCurrencyCode(r,t),o=this.safeString(e,"note"),n=this.safeString(e,"chain");return this.checkAddress(s),{currency:a,address:s,tag:i,network:this.networkIdToCode(n),note:o,info:e}}async fetchDepositAddressesByNetwork(e,t={}){await this.loadMarkets();const s=this.currency(e),i={currency:s.id},r=await this.spotPrivateGetV2AccountDepositAddress(this.extend(i,t)),a=this.safeValue(r,"data",[]),o=this.parseDepositAddresses(a,[s.code],!1);return this.indexBy(o,"network")}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s=this.currency(e),[i,r]=this.handleNetworkCodeAndParams(t),a=await this.fetchDepositAddressesByNetwork(e,r);return a[this.selectNetworkCodeFromUnifiedNetworks(s.code,i,a)]}async fetchWithdrawAddresses(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.currency(e),a={currency:r.id},o=await this.spotPrivateGetV2AccountWithdrawAddress(this.extend(a,i)),n=this.safeValue(o,"data",[]),d=this.parseDepositAddresses(n,[r.code],!1),h=[];for(let e=0;e100)&&(s=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"deposit",direct:"next",from:0};void 0!==r&&(a.currency=r.id),void 0!==s&&(a.size=s);const o=await this.spotPrivateGetV1QueryDepositWithdraw(this.extend(a,i));return this.parseTransactions(o.data,r,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){let r;(void 0===s||s>100)&&(s=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"withdraw",direct:"next",from:0};void 0!==r&&(a.currency=r.id),void 0!==s&&(a.size=s);const o=await this.spotPrivateGetV1QueryDepositWithdraw(this.extend(a,i));return this.parseTransactions(o.data,r,t,s)}parseTransaction(e,t=void 0){const s=this.safeInteger(e,"created-at"),i=this.safeCurrencyCode(this.safeString(e,"currency"));let r=this.safeString(e,"type");"withdraw"===r&&(r="withdrawal");let o=this.safeString(e,"fee");void 0!==o&&(o=a.O.stringAbs(o));const n=this.safeString(e,"chain");let d=this.safeString(e,"tx-hash");"ETH"===n&&d.indexOf("0x")<0&&(d="0x"+d);const h="FAST"===this.safeString(e,"sub-type");return{info:e,id:this.safeString2(e,"id","data"),txid:d,timestamp:s,datetime:this.iso8601(s),network:this.networkIdToCode(n),address:this.safeString(e,"address"),addressTo:void 0,addressFrom:void 0,tag:this.safeString(e,"address-tag"),tagTo:void 0,tagFrom:void 0,type:r,amount:this.safeNumber(e,"amount"),currency:i,status:this.parseTransactionStatus(this.safeString(e,"state")),updated:this.safeInteger(e,"updated-at"),comment:void 0,internal:h,fee:{currency:i,cost:this.parseNumber(o),rate:void 0}}}parseTransactionStatus(e){return this.safeString({unknown:"failed",confirming:"pending",confirmed:"ok",safe:"ok",orphan:"failed",submitted:"pending",canceled:"canceled",reexamine:"pending",reject:"failed",pass:"pending","wallet-reject":"failed","confirm-error":"failed",repealed:"failed","wallet-transfer":"pending","pre-transfer":"pending"},e,e)}async withdraw(e,t,s,i=void 0,o={}){[i,o]=this.handleWithdrawTagAndParams(i,o),await this.loadMarkets(),this.checkAddress(s);const n=this.currency(e),d={address:s,currency:n.id.toLowerCase()};let h;void 0!==i&&(d["addr-tag"]=i),[h,o]=this.handleNetworkCodeAndParams(o),void 0!==h&&(d.chain=this.networkCodeToId(h,e)),t=parseFloat(this.currencyToPrecision(e,t,h));const c=this.safeValue(this.options,"withdraw",{});if(this.safeBool(c,"includeFee",!1)){let s=this.safeNumber(o,"fee");if(void 0===s){const e=await this.fetchCurrencies();this.currencies=this.deepExtend(this.currencies,e);const t=this.safeValue(n.networks,h,{});if(s=this.safeNumber(t,"fee"),void 0===s)throw new r.ArgumentsRequired(this.id+' withdraw() function can not find withdraw fee for chosen network. You need to re-load markets with "exchange.loadMarkets(true)", or provide the "fee" parameter')}const i=this.currencyToPrecision(e,s,h);o=this.omit(o,"fee");const c=this.numberToString(t),l=a.O.stringSub(c,i),u=parseFloat(l);d.fee=parseFloat(i),t=parseFloat(this.currencyToPrecision(e,u,h))}d.amount=t;const l=await this.spotPrivatePostV1DwWithdrawApiCreate(this.extend(d,o));return this.parseTransaction(l,n)}parseTransfer(e,t=void 0){return{info:e,id:this.safeString(e,"data"),timestamp:void 0,datetime:void 0,currency:this.safeCurrencyCode(void 0,t),amount:void 0,fromAccount:void 0,toAccount:void 0,status:void 0}}async transfer(e,t,s,i,a={}){await this.loadMarkets();const o=this.currency(e),n={currency:o.id,amount:parseFloat(this.currencyToPrecision(e,t))};let d;[d,a]=this.handleSubTypeAndParams("transfer",void 0,a);let h=this.convertTypeToAccount(s),c=this.convertTypeToAccount(i);const l="cross"===c,u="cross"===h,p=this.inArray(c,this.ids),f=this.inArray(h,this.ids),m="pro"===h,g="pro"===c;if(m&&g)throw new r.BadRequest(this.id+" transfer () cannot make a transfer between "+s+" and "+i);let v;if("futures"===h||"futures"===c){let e=h+"-to-"+c;e=this.safeString(a,"type",e),n.type=e,v=await this.spotPrivatePostV1FuturesTransfer(this.extend(n,a))}else if(m&&l)v=await this.privatePostCrossMarginTransferIn(this.extend(n,a));else if(u&&g)v=await this.privatePostCrossMarginTransferOut(this.extend(n,a));else if(m&&p)n.symbol=c,v=await this.privatePostDwTransferInMargin(this.extend(n,a));else if(f&&g)n.symbol=h,v=await this.privatePostDwTransferOutMargin(this.extend(n,a));else{if("linear"===d){"swap"===h||"linear-swap"===s?h="linear-swap":c="linear-swap";let e=this.safeString(a,"symbol");a=this.omit(a,"symbol"),void 0!==e?(e=this.marketId(e),n["margin-account"]=e):n["margin-account"]="USDT"}n.from=m?"spot":h,n.to=g?"spot":c,v=await this.v2PrivatePostAccountTransfer(this.extend(n,a))}return this.parseTransfer(v,o)}async fetchIsolatedBorrowRates(e={}){await this.loadMarkets();const t=await this.spotPrivateGetV1MarginLoanInfo(e),s=this.safeValue(t,"data",[]);return this.parseIsolatedBorrowRates(s)}parseIsolatedBorrowRate(e,t=void 0){const s=this.safeString(e,"symbol"),i=this.safeSymbol(s,t),r=this.safeValue(e,"currencies",[]),a=this.safeValue(r,0),o=this.safeValue(r,1),n=this.safeString(a,"currency"),d=this.safeString(o,"currency");return{symbol:i,base:this.safeCurrencyCode(n),baseRate:this.safeNumber(a,"actual-rate"),quote:this.safeCurrencyCode(d),quoteRate:this.safeNumber(o,"actual-rate"),period:864e5,timestamp:void 0,datetime:void 0,info:e}}async fetchFundingRateHistory(e=void 0,t=void 0,s=void 0,i={}){if(void 0===e)throw new r.ArgumentsRequired(this.id+" fetchFundingRateHistory() requires a symbol argument");let a=!1;if([a,i]=this.handleOptionAndParams(i,"fetchFundingRateHistory","paginate"),a)return await this.fetchPaginatedCallCursor("fetchFundingRateHistory",e,t,s,i,"page_index","current_page",1,50);await this.loadMarkets();const o=this.market(e),n={contract_code:o.id};let d;if(o.inverse)d=await this.contractPublicGetSwapApiV1SwapHistoricalFundingRate(this.extend(n,i));else{if(!o.linear)throw new r.NotSupported(this.id+" fetchFundingRateHistory() supports inverse and linear swaps only");d=await this.contractPublicGetLinearSwapApiV1SwapHistoricalFundingRate(this.extend(n,i))}const h=this.safeValue(d,"data"),c=this.safeValue(h,"current_page"),l=this.safeValue(h,"data",[]),u=[];for(let e=0;e{s.d(t,{Z:()=>r});var i=s(5939);class r extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"huobi",alias:!0})}}},7034:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(7758),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"huobijp",name:"Huobi Japan",countries:["JP"],rateLimit:100,userAgent:this.userAgents.chrome39,certified:!1,version:"v1",hostname:"api-cloud.bittrade.co.jp",pro:!0,has:{CORS:void 0,spot:!0,margin:void 0,swap:!1,future:!1,option:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchAccounts:!0,fetchBalance:!0,fetchClosedOrders:!0,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchOrderTrades:!0,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingLimits:!0,fetchWithdrawals:!0,withdraw:!0},timeframes:{"1m":"1min","5m":"5min","15m":"15min","30m":"30min","1h":"60min","4h":"4hour","1d":"1day","1w":"1week","1M":"1mon","1y":"1year"},urls:{logo:"https://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpg",api:{market:"https://{hostname}",public:"https://{hostname}",private:"https://{hostname}",v2Public:"https://{hostname}",v2Private:"https://{hostname}"},www:"https://www.huobi.co.jp",referral:"https://www.huobi.co.jp/register/?invite_code=znnq3",doc:"https://api-doc.huobi.co.jp",fees:"https://www.huobi.co.jp/support/fee"},api:{v2Public:{get:{"reference/currencies":1,"market-status":1}},v2Private:{get:{"account/ledger":1,"account/withdraw/quota":1,"account/withdraw/address":1,"account/deposit/address":1,"account/repayment":5,"reference/transact-fee-rate":1,"account/asset-valuation":.2,"point/account":5,"sub-user/user-list":1,"sub-user/user-state":1,"sub-user/account-list":1,"sub-user/deposit-address":1,"sub-user/query-deposit":1,"user/api-key":1,"user/uid":1,"algo-orders/opening":1,"algo-orders/history":1,"algo-orders/specific":1,"c2c/offers":1,"c2c/offer":1,"c2c/transactions":1,"c2c/repayment":1,"c2c/account":1,"etp/reference":1,"etp/transactions":5,"etp/transaction":5,"etp/rebalance":1,"etp/limit":1},post:{"account/transfer":1,"account/repayment":5,"point/transfer":5,"sub-user/management":1,"sub-user/creation":1,"sub-user/tradable-market":1,"sub-user/transferability":1,"sub-user/api-key-generation":1,"sub-user/api-key-modification":1,"sub-user/api-key-deletion":1,"sub-user/deduct-mode":1,"algo-orders":1,"algo-orders/cancel-all-after":1,"algo-orders/cancellation":1,"c2c/offer":1,"c2c/cancellation":1,"c2c/cancel-all":1,"c2c/repayment":1,"c2c/transfer":1,"etp/creation":5,"etp/redemption":5,"etp/{transactId}/cancel":10,"etp/batch-cancel":50}},market:{get:{"history/kline":1,"detail/merged":1,depth:1,trade:1,"history/trade":1,detail:1,tickers:1,etp:1}},public:{get:{"common/symbols":1,"common/currencys":1,"common/timestamp":1,"common/exchange":1,"settings/currencys":1}},private:{get:{"account/accounts":.2,"account/accounts/{id}/balance":.2,"account/accounts/{sub-uid}":1,"account/history":4,"cross-margin/loan-info":1,"margin/loan-info":1,"fee/fee-rate/get":1,"order/openOrders":.4,"order/orders":.4,"order/orders/{id}":.4,"order/orders/{id}/matchresults":.4,"order/orders/getClientOrder":.4,"order/history":1,"order/matchresults":1,"query/deposit-withdraw":1,"margin/loan-orders":.2,"margin/accounts/balance":.2,"cross-margin/loan-orders":1,"cross-margin/accounts/balance":1,"points/actions":1,"points/orders":1,"subuser/aggregate-balance":10,"stable-coin/exchange_rate":1,"stable-coin/quote":1},post:{"account/transfer":1,"futures/transfer":1,"order/batch-orders":.4,"order/orders/place":.2,"order/orders/submitCancelClientOrder":.2,"order/orders/batchCancelOpenOrders":.4,"order/orders/{id}/submitcancel":.2,"order/orders/batchcancel":.4,"dw/withdraw/api/create":1,"dw/withdraw-virtual/{id}/cancel":1,"dw/transfer-in/margin":10,"dw/transfer-out/margin":10,"margin/orders":10,"margin/orders/{id}/repay":10,"cross-margin/transfer-in":1,"cross-margin/transfer-out":1,"cross-margin/orders":1,"cross-margin/orders/{id}/repay":1,"stable-coin/exchange":1,"subuser/transfer":10}}},fees:{trading:{feeSide:"get",tierBased:!1,percentage:!0,maker:this.parseNumber("0.002"),taker:this.parseNumber("0.002")}},precisionMode:o.sh,exceptions:{broad:{"contract is restricted of closing positions on API. Please contact customer service":r.OnMaintenance,maintain:r.OnMaintenance},exact:{"bad-request":r.BadRequest,"base-date-limit-error":r.BadRequest,"api-not-support-temp-addr":r.PermissionDenied,timeout:r.RequestTimeout,"gateway-internal-error":r.ExchangeNotAvailable,"account-frozen-balance-insufficient-error":r.InsufficientFunds,"invalid-amount":r.InvalidOrder,"order-limitorder-amount-min-error":r.InvalidOrder,"order-limitorder-amount-max-error":r.InvalidOrder,"order-marketorder-amount-min-error":r.InvalidOrder,"order-limitorder-price-min-error":r.InvalidOrder,"order-limitorder-price-max-error":r.InvalidOrder,"order-holding-limit-failed":r.InvalidOrder,"order-orderprice-precision-error":r.InvalidOrder,"order-etp-nav-price-max-error":r.InvalidOrder,"order-orderstate-error":r.OrderNotFound,"order-queryorder-invalid":r.OrderNotFound,"order-update-error":r.ExchangeNotAvailable,"api-signature-check-failed":r.AuthenticationError,"api-signature-not-valid":r.AuthenticationError,"base-record-invalid":r.OrderNotFound,"base-symbol-trade-disabled":r.BadSymbol,"base-symbol-error":r.BadSymbol,"system-maintenance":r.OnMaintenance,"invalid symbol":r.BadSymbol,"symbol trade not open now":r.BadSymbol,"invalid-address":r.BadRequest,"base-currency-chain-error":r.BadRequest,"dw-insufficient-balance":r.InsufficientFunds}},options:{defaultNetwork:"ERC20",networks:{ETH:"erc20",TRX:"trc20",HRC20:"hrc20",HECO:"hrc20",HT:"hrc20",ALGO:"algo",OMNI:""},fetchOrdersByStatesMethod:"private_get_order_orders",fetchOpenOrdersMethod:"fetch_open_orders_v1",createMarketBuyOrderRequiresPrice:!0,fetchMarketsMethod:"publicGetCommonSymbols",fetchBalanceMethod:"privateGetAccountAccountsIdBalance",createOrderMethod:"privatePostOrderOrdersPlace",language:"en-US",broker:{id:"AA03022abc"}},commonCurrencies:{GET:"Themis",GTC:"Game.com",HIT:"HitChain",PNT:"Penta",SBTC:"Super Bitcoin",BIFI:"Bitcoin File"}})}async fetchTime(e={}){const t=await this.publicGetCommonTimestamp(e);return this.safeInteger(t,"data")}async fetchTradingLimits(e=void 0,t={}){await this.loadMarkets(),void 0===e&&(e=this.symbols);const s={};for(let i=0;i100)&&(s=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"deposit",from:0};void 0!==r&&(a.currency=r.id),void 0!==s&&(a.size=s);const o=await this.privateGetQueryDepositWithdraw(this.extend(a,i));return this.parseTransactions(o.data,r,t,s)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){let r;(void 0===s||s>100)&&(s=100),await this.loadMarkets(),void 0!==e&&(r=this.currency(e));const a={type:"withdraw",from:0};void 0!==r&&(a.currency=r.id),void 0!==s&&(a.size=s);const o=await this.privateGetQueryDepositWithdraw(this.extend(a,i));return this.parseTransactions(o.data,r,t,s)}parseTransaction(e,t=void 0){const s=this.safeInteger(e,"created-at"),i=this.safeCurrencyCode(this.safeString(e,"currency"));let r=this.safeString(e,"type");"withdraw"===r&&(r="withdrawal");let o=this.safeString(e,"fee");return void 0!==o&&(o=a.O.stringAbs(o)),{info:e,id:this.safeString2(e,"id","data"),txid:this.safeString(e,"tx-hash"),timestamp:s,datetime:this.iso8601(s),network:this.safeStringUpper(e,"chain"),address:this.safeString(e,"address"),addressTo:void 0,addressFrom:void 0,tag:this.safeString(e,"address-tag"),tagTo:void 0,tagFrom:void 0,type:r,amount:this.safeNumber(e,"amount"),currency:i,status:this.parseTransactionStatus(this.safeString(e,"state")),updated:this.safeInteger(e,"updated-at"),comment:void 0,internal:void 0,fee:{currency:i,cost:this.parseNumber(o),rate:void 0}}}parseTransactionStatus(e){return this.safeString({unknown:"failed",confirming:"pending",confirmed:"ok",safe:"ok",orphan:"failed",submitted:"pending",canceled:"canceled",reexamine:"pending",reject:"failed",pass:"pending","wallet-reject":"failed","confirm-error":"failed",repealed:"failed","wallet-transfer":"pending","pre-transfer":"pending"},e,e)}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),await this.loadMarkets(),this.checkAddress(s);const a=this.currency(e),o={address:s,amount:t,currency:a.id.toLowerCase()};void 0!==i&&(o["addr-tag"]=i);const n=this.safeValue(this.options,"networks",{});let d=this.safeStringUpper(r,"network");d=this.safeStringLower(n,d,d),void 0!==d&&(o.chain="erc20"===d?a.id+d:d+a.id,r=this.omit(r,"network"));const h=await this.privatePostDwWithdrawApiCreate(this.extend(o,r));return this.parseTransaction(h,a)}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/";"market"===t?o+=t:"public"===t||"private"===t?o+=this.version:"v2Public"!==t&&"v2Private"!==t||(o+="v2"),o+="/"+this.implodeParams(e,i);const d=this.omit(i,this.extractParams(e));if("private"===t||"v2Private"===t){this.checkRequiredCredentials();const e=this.ymdhms(this.milliseconds(),"T");let t={SignatureMethod:"HmacSHA256",SignatureVersion:"2",AccessKeyId:this.apiKey,Timestamp:e};"POST"!==s&&(t=this.extend(t,d));const i=this.keysort(t);let h=this.urlencode(i);const c=[s,this.hostname,o,h].join("\n"),l=this.hmac(this.encode(c),this.encode(this.secret),n.J,"base64");h+="&"+this.urlencode({Signature:l}),o+="?"+h,"POST"===s?(a=this.json(d),r={"Content-Type":"application/json"}):r={"Content-Type":"application/x-www-form-urlencoded"}}else Object.keys(i).length&&(o+="?"+this.urlencode(i));return o=this.implodeParams(this.urls.api[t],{hostname:this.hostname})+o,{url:o,method:s,body:a,headers:r}}handleErrors(e,t,s,i,a,o,n,d,h){if(void 0!==n&&"status"in n){if("error"===this.safeString(n,"status")){const e=this.safeString(n,"err-code"),t=this.id+" "+o;this.throwBroadlyMatchedException(this.exceptions.broad,o,t),this.throwExactlyMatchedException(this.exceptions.exact,e,t);const s=this.safeString(n,"err-msg");throw this.throwExactlyMatchedException(this.exceptions.exact,s,t),new r.ExchangeError(t)}}}}},5959:(e,t,s)=>{s.d(t,{Z:()=>c});var i=s(8402),r=s(6689),a=s(2194),o=s(9292),n=s(6739),d=s(1339),h=s(6890);class c extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"hyperliquid",name:"Hyperliquid",countries:[],version:"v1",rateLimit:50,certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!0,future:!0,option:!1,addMargin:!0,borrowCrossMargin:!1,borrowIsolatedMargin:!1,cancelAllOrders:!1,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,cancelOrdersForSymbols:!0,closeAllPositions:!1,closePosition:!1,createMarketBuyOrderWithCost:!1,createMarketOrderWithCost:!1,createMarketSellOrderWithCost:!1,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!0,editOrder:!0,fetchAccounts:!1,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDeposits:!1,fetchDepositWithdrawFee:"emulated",fetchDepositWithdrawFees:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!0,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchLiquidations:!1,fetchMarginMode:void 0,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyLiquidations:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchOrderTrades:!1,fetchPosition:!0,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!1,fetchTickers:!1,fetchTime:!1,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,reduceMargin:!0,repayCrossMargin:!1,repayIsolatedMargin:!1,setLeverage:!0,setMarginMode:!0,setPositionMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":"1m","3m":"3m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","6h":"6h","12h":"12h","1d":"1d","3d":"3d","1w":"1w","1M":"1m"},hostname:"hyperliquid.xyz",urls:{logo:"https://github.com/ccxt/ccxt/assets/43336371/b371bc6c-4a8c-489f-87f4-20a913dd8d4b",api:{public:"https://api.{hostname}",private:"https://api.{hostname}"},test:{public:"https://api.hyperliquid-testnet.xyz",private:"https://api.hyperliquid-testnet.xyz"},www:"https://hyperliquid.xyz",doc:"https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api",fees:"https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees",referral:"https://app.hyperliquid.xyz/"},api:{public:{post:{info:1}},private:{post:{exchange:1}}},fees:{swap:{taker:this.parseNumber("0.00035"),maker:this.parseNumber("0.0001")},spot:{taker:this.parseNumber("0.00035"),maker:this.parseNumber("0.0001")}},requiredCredentials:{apiKey:!1,secret:!1,walletAddress:!0,privateKey:!0},exceptions:{exact:{},broad:{"Price must be divisible by tick size.":r.InvalidOrder,"Order must have minimum value of $10":r.InvalidOrder,"Insufficient margin to place order.":r.InvalidOrder,"Reduce only order would increase position.":r.InvalidOrder,"Post only order would have immediately matched,":r.InvalidOrder,"Order could not immediately match against any resting orders.":r.InvalidOrder,"Invalid TP/SL price.":r.InvalidOrder,"No liquidity available for market order.":r.InvalidOrder,"Order was never placed, already canceled, or filled.":r.OrderNotFound,"User or API Wallet ":r.InvalidOrder}},precisionMode:o.sh,commonCurrencies:{},options:{defaultType:"swap",sandboxMode:!1,defaultSlippage:.05,zeroAddress:"0x0000000000000000000000000000000000000000"}})}setSandboxMode(e){super.setSandboxMode(e),this.options.sandboxMode=e}async fetchCurrencies(e={}){const t=await this.publicPostInfo(this.extend({type:"meta"},e)),s=this.safeList(t,"universe",[]),i={};for(let e=0;e-1?i:i+"/USDC:USDC");const a=(t=void 0===this.safeString(s,"id")?this.safeMarket(r,void 0):this.safeMarket(r,t)).symbol,o=this.safeInteger2(e,"timestamp","statusTimestamp"),n=this.safeString(e,"status");let d=this.safeString(s,"side");return void 0!==d&&(d="A"===d?"sell":"buy"),this.safeOrder({info:e,id:this.safeString(s,"oid"),clientOrderId:this.safeString(s,"cloid"),timestamp:o,datetime:this.iso8601(o),lastTradeTimestamp:void 0,lastUpdateTimestamp:void 0,symbol:a,type:this.safeStringLower(s,"orderType"),timeInForce:this.safeStringUpper(s,"tif"),postOnly:void 0,reduceOnly:this.safeBool(s,"reduceOnly"),side:d,price:this.safeNumber(s,"limitPx"),triggerPrice:this.safeBool(s,"isTrigger")?this.safeNumber(s,"triggerPx"):void 0,amount:this.safeNumber2(s,"sz","totalSz"),cost:void 0,average:this.safeNumber(s,"avgPx"),filled:void 0,remaining:void 0,status:this.parseOrderStatus(n),fee:void 0,trades:void 0},t)}parseOrderStatus(e){return this.safeString({triggered:"open",filled:"closed"},e,e)}parseOrderType(e){return this.safeString({"stop limit":"limit","stop market":"market"},e,e)}async fetchMyTrades(e=void 0,t=void 0,s=void 0,i={}){let r;[r,i]=this.handlePublicAddress("fetchMyTrades",i),await this.loadMarkets();const a=this.safeMarket(e),o={user:r};void 0!==t?(o.type="userFillsByTime",o.startTime=t):o.type="userFills";const n=this.safeInteger(i,"until");i=this.omit(i,"until"),void 0!==n&&(o.endTime=n);const d=await this.publicPostInfo(this.extend(o,i));return this.parseTrades(d,a,t,s)}parseTrade(e,t=void 0){const s=this.safeInteger(e,"time"),i=this.safeString(e,"px"),r=this.safeString(e,"sz"),a=this.safeString(e,"coin")+"/USDC:USDC",o=(t=this.safeMarket(a,void 0)).symbol,n=this.safeString(e,"tid");let d=this.safeString(e,"side");void 0!==d&&(d="A"===d?"sell":"buy");const h=this.safeString(e,"fee");return this.safeTrade({info:e,timestamp:s,datetime:this.iso8601(s),symbol:o,id:n,order:this.safeString(e,"oid"),type:void 0,side:d,takerOrMaker:void 0,price:i,amount:r,cost:void 0,fee:{cost:h,currency:"USDC"}},t)}async fetchPosition(e,t={}){const s=await this.fetchPositions([e],t);return this.safeDict(s,0,{})}async fetchPositions(e=void 0,t={}){let s;await this.loadMarkets(),[s,t]=this.handlePublicAddress("fetchPositions",t),e=this.marketSymbols(e);const i={type:"clearinghouseState",user:s},r=await this.publicPostInfo(this.extend(i,t)),a=this.safeList(r,"assetPositions",[]),o=[];for(let e=0;e0?"short":"long");const h=this.safeNumber(s,"unrealizedPnl"),c=this.safeNumber(s,"marginUsed"),l=h/c*100;return this.safePosition({info:e,id:void 0,symbol:r,timestamp:void 0,datetime:void 0,isolated:o,hedged:void 0,side:d,contracts:this.safeNumber(s,"szi"),contractSize:void 0,entryPrice:this.safeNumber(s,"entryPx"),markPrice:void 0,notional:this.safeNumber(s,"positionValue"),leverage:this.safeNumber(a,"value"),collateral:void 0,initialMargin:c,maintenanceMargin:void 0,initialMarginPercentage:void 0,maintenanceMarginPercentage:void 0,unrealizedPnl:h,liquidationPrice:this.safeNumber(s,"liquidationPx"),marginMode:void 0,percentage:l})}async setMarginMode(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a symbol argument");await this.loadMarkets();const i=this.market(t),a=this.safeInteger(s,"leverage");if(void 0===a)throw new r.ArgumentsRequired(this.id+" setMarginMode() requires a leverage parameter");const o=this.parseToInt(i.baseId),n="cross"===e,d=this.milliseconds();s=this.omit(s,["leverage"]);const h={type:"updateLeverage",asset:o,isCross:n,leverage:a};let c=this.safeString(s,"vaultAddress");void 0!==c&&(s=this.omit(s,"vaultAddress"),c.startsWith("0x")&&(c=c.replace("0x","")));const l=this.extend(h,s),u={action:l,nonce:d,signature:this.signL1Action(l,d,c)};void 0!==c&&(u.vaultAddress=c);return await this.privatePostExchange(u)}async setLeverage(e,t=void 0,s={}){if(void 0===t)throw new r.ArgumentsRequired(this.id+" setLeverage() requires a symbol argument");await this.loadMarkets();const i=this.market(t),a="cross"===this.safeString(s,"marginMode","cross"),o=this.parseToInt(i.baseId),n=this.milliseconds();s=this.omit(s,"marginMode");const d={type:"updateLeverage",asset:o,isCross:a,leverage:e},h=this.formatVaultAddress(this.safeString(s,"vaultAddress")),c={action:d,nonce:n,signature:this.signL1Action(d,n,h)};void 0!==h&&(s=this.omit(s,"vaultAddress"),c.vaultAddress=h);return await this.privatePostExchange(this.extend(c,s))}async addMargin(e,t,s={}){return await this.modifyMarginHelper(e,t,"add",s)}async reduceMargin(e,t,s={}){return await this.modifyMarginHelper(e,t,"reduce",s)}async modifyMarginHelper(e,t,s,i={}){await this.loadMarkets();const r=this.market(e),o=this.parseToInt(r.baseId);let n=this.parseToInt(a.O.stringMul(this.amountToPrecision(e,t),"1000000"));"reduce"===s&&(n=-n);const d=this.milliseconds(),h={type:"updateIsolatedMargin",asset:o,isBuy:!0,ntli:n},c=this.formatVaultAddress(this.safeString(i,"vaultAddress")),l={action:h,nonce:d,signature:this.signL1Action(h,d,c)};void 0!==c&&(i=this.omit(i,"vaultAddress"),l.vaultAddress=c);const u=await this.privatePostExchange(this.extend(l,i));return this.extend(this.parseMarginModification(u,r),{code:this.safeString(u,"status")})}parseMarginModification(e,t=void 0){return{info:e,symbol:this.safeSymbol(void 0,t),type:void 0,marginMode:"isolated",amount:void 0,total:void 0,code:this.safeString(t,"settle"),status:void 0,timestamp:void 0,datetime:void 0}}async transfer(e,t,s,i,a={}){this.checkRequiredCredentials(),await this.loadMarkets();const o=this.safeBool(this.options,"sandboxMode"),n=this.milliseconds();if(this.inArray(s,["spot","swap","perp"])){if(!this.inArray(i,["spot","swap","perp"]))throw new r.NotSupported(this.id+"transfer() only support spot <> swap transfer");const e=this.formatVaultAddress(this.safeString(a,"vaultAddress"));a=this.omit(a,"vaultAddress");const s={type:"spotUser",classTransfer:{usdc:t,toPerp:"perp"===i||"swap"===i}},o=this.signL1Action(s,n,e),d={action:this.extend(s,a),nonce:n,signature:o};void 0!==e&&(d.vaultAddress=e);return await this.privatePostExchange(d)}if(this.checkAddress(i),void 0!==e&&"USDC"!==(e=e.toUpperCase()))throw new r.NotSupported(this.id+"withdraw() only support USDC");const d={destination:i,amount:this.numberToString(t),time:n},h={action:{chain:o?"ArbitrumTestnet":"Arbitrum",payload:d,type:"usdTransfer"},nonce:n,signature:this.buildTransferSig(d)};return await this.privatePostExchange(this.extend(h,a))}async withdraw(e,t,s,i=void 0,a={}){if(this.checkRequiredCredentials(),await this.loadMarkets(),this.checkAddress(s),void 0!==e&&"USDC"!==(e=e.toUpperCase()))throw new r.NotSupported(this.id+"withdraw() only support USDC");const o=this.safeBool(this.options,"sandboxMode"),n=this.milliseconds(),d={destination:s,usd:t.toString(),time:n},h={action:{chain:o?"ArbitrumTestnet":"Arbitrum",payload:d,type:"withdraw2"},nonce:n,signature:this.buildWithdrawSig(d)};return await this.privatePostExchange(this.extend(h,a))}formatVaultAddress(e=void 0){if(void 0!==e)return e.startsWith("0x")?e.replace("0x",""):e}handlePublicAddress(e,t){let s;[s,t]=this.handleOptionAndParams(t,e,"user");let i=s;if([i,t]=this.handleOptionAndParams(t,e,"address",s),void 0!==i&&""!==i)return[i,t];if(void 0!==this.walletAddress&&""!==this.walletAddress)return[this.walletAddress,t];throw new r.ArgumentsRequired(this.id+" "+e+"() requires a user parameter inside 'params' or the wallet address set")}coinToMarketId(e){return e.indexOf("/")>-1?e:e+"/USDC:USDC"}handleErrors(e,t,s,i,a,o,n,d,h){if(!n)return;let c;if("err"===this.safeString(n,"status",""))c=this.safeString(n,"response");else{const e=this.safeDict(n,"response",{}),t=this.safeDict(e,"data",{}),s=this.safeList(t,"statuses",[]),i=this.safeDict(s,0);c=this.safeString(i,"error")}const l=this.id+" "+o,u=void 0!==c&&""!==c;if(u&&(this.throwExactlyMatchedException(this.exceptions.exact,c,l),this.throwBroadlyMatchedException(this.exceptions.broad,c,l)),u)throw new r.ExchangeError(l)}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){const o=this.implodeHostname(this.urls.api[t])+"/"+e;return"POST"===s&&(r={"Content-Type":"application/json"},a=this.json(i)),{url:o,method:s,body:a,headers:r}}}},8232:(e,t,s)=>{s.d(t,{Z:()=>l});var i=s(5563),r=s(9292),a=s(6689),o=s(2194),n=s(1372),d=s(6739),h=s(1339),c=s(6890);class l extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"idex",name:"IDEX",countries:["US"],rateLimit:1e3,version:"v3",pro:!0,certified:!1,requiresWeb3:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDeposit:!0,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,fetchTransactions:!1,fetchWithdrawal:!0,fetchWithdrawals:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","6h":"6h","1d":"1d"},urls:{test:{MATIC:"https://api-sandbox-matic.idex.io"},logo:"https://user-images.githubusercontent.com/51840849/94481303-2f222100-01e0-11eb-97dd-bc14c5943a86.jpg",api:{MATIC:"https://api-matic.idex.io"},www:"https://idex.io",doc:["https://api-docs-v3.idex.io/"]},api:{public:{get:{ping:1,time:1,exchange:1,assets:1,markets:1,tickers:1,candles:1,trades:1,orderbook:1}},private:{get:{user:1,wallets:1,balances:1,orders:.1,fills:.1,deposits:1,withdrawals:1,wsToken:1},post:{wallets:1,orders:.1,"orders/test":.1,withdrawals:1},delete:{orders:.1}}},options:{defaultTimeInForce:"gtc",defaultSelfTradePrevention:"cn",network:"MATIC"},exceptions:{exact:{INVALID_ORDER_QUANTITY:a.InvalidOrder,INSUFFICIENT_FUNDS:a.InsufficientFunds,SERVICE_UNAVAILABLE:a.ExchangeNotAvailable,EXCEEDED_RATE_LIMIT:a.DDoSProtection,INVALID_PARAMETER:a.BadRequest,WALLET_NOT_ASSOCIATED:a.InvalidAddress,INVALID_WALLET_SIGNATURE:a.AuthenticationError}},requiredCredentials:{walletAddress:!0,privateKey:!0,apiKey:!0,secret:!0},precisionMode:r.sh,paddingMode:r.Z_,commonCurrencies:{}})}priceToPrecision(e,t){const s=this.market(e),i=this.safeValue(s,"info",{}),a=this.safeInteger(i,"quoteAssetPrecision");return t=this.decimalToPrecision(t,r.oU,s.precision.price,this.precisionMode),this.decimalToPrecision(t,r.tk,a,r.nr,r.Z_)}async fetchMarkets(e={}){const t=await this.publicGetMarkets(e),s=await this.publicGetExchange(),i=this.safeNumber(s,"makerFeeRate"),r=this.safeNumber(s,"takerFeeRate"),a=this.safeString(s,"makerTradeMinimum"),n=this.safeString(s,"takerTradeMinimum"),d=this.parseNumber(o.O.stringMin(a,n)),h=[];for(let e=0;e=0;if(t in f)l=f[t],m=this.priceToPrecision(e,r);else if(t in u)l=u[t],m=this.priceToPrecision(e,r);else{if("market"!==t)throw new a.BadRequest(this.id+" "+t+" is not a valid order type");l=0}let v=0;if("quoteOrderQuantity"in o){if("market"!==t)throw new a.NotSupported(this.id+" createOrder() quoteOrderQuantity is not supported for "+t+" orders, only supported for market orders");v=1,i=this.safeNumber(o,"quoteOrderQuantity")}const y="buy"===s?0:1,w=this.remove0xPrefix(this.walletAddress),b=this.safeString(this.options,"network","ETH"),S=this.getSupportedMapping(b,{ETH:1,BSC:2,MATIC:4}),k=this.amountToPrecision(e,i),O={gtc:0,ioc:2,fok:3},T=this.safeString(this.options,"defaultTimeInForce","gtc"),P=this.safeString(o,"timeInForce",T);let x;if(!(P in O)){const e=Object.keys(O).join(", ");throw new a.BadRequest(this.id+" "+P+" is not a valid timeInForce, please choose one of "+e)}x=O[P];const I={dc:0,co:1,cn:2,cb:3},M=this.safeString(this.options,"defaultSelfTradePrevention","cn"),A=this.safeString(o,"selfTradePrevention",M);let C;if(!(A in I)){const e=Object.keys(I).join(", ");throw new a.BadRequest(this.id+" "+A+" is not a valid selfTradePrevention, please choose one of "+e)}C=I[A];const E=[this.numberToBE(S,1),this.base16ToBinary(c),this.base16ToBinary(w),this.encode(h.id),this.numberToBE(l,1),this.numberToBE(y,1),this.encode(k),this.numberToBE(v,1)];if(g){const e=this.encode(m);E.push(e)}if(t in u){const e=this.encode(p||m);E.push(e)}const _=this.safeString(o,"clientOrderId");void 0!==_&&E.push(this.encode(_));const B=[this.numberToBE(x,1),this.numberToBE(C,1),this.numberToBE(0,8)],N=this.arrayConcat(E,B),R=this.binaryConcatArray(N),L=this.hash(R,d.fr,"hex"),V=this.signMessageString(L,this.privateKey),D={parameters:{nonce:c,market:h.id,side:s,type:t,wallet:this.walletAddress,selfTradePrevention:A},signature:V};let q;return"market"!==t&&(D.parameters.timeInForce=P),g&&(D.parameters.price=m),t in u&&(D.parameters.stopPrice=p||m),0===v?D.parameters.quantity=k:D.parameters.quoteOrderQuantity=k,void 0!==_&&(D.parameters.clientOrderId=_),q=n?await this.privatePostOrdersTest(D):await this.privatePostOrders(D),this.parseOrder(q,h)}async withdraw(e,t,s,i=void 0,r={}){[i,r]=this.handleWithdrawTagAndParams(i,r),this.checkRequiredCredentials(),await this.loadMarkets();const a=this.uuidv1(),o=this.currencyToPrecision(e,t),n=this.currency(e),h=this.remove0xPrefix(this.walletAddress),c=[this.base16ToBinary(a),this.base16ToBinary(h),this.encode(n.id),this.encode(o),this.numberToBE(1,1)],l=this.binaryConcatArray(c),u=this.hash(l,d.fr,"hex"),p=this.signMessageString(u,this.privateKey),f={parameters:{nonce:a,wallet:s,asset:n.id,quantity:o},signature:p},m=await this.privatePostWithdrawals(f);return this.parseTransaction(m,n)}async cancelAllOrders(e=void 0,t={}){let s;this.checkRequiredCredentials(),await this.loadMarkets(),void 0!==e&&(s=this.market(e));const i=this.uuidv1(),r={parameters:{nonce:i,wallet:this.walletAddress}},a=this.remove0xPrefix(this.walletAddress),o=[this.base16ToBinary(i),this.base16ToBinary(a)];void 0!==s&&(o.push(this.encode(s.id)),r.parameters.market=s.id);const n=this.binaryConcatArray(o),h=this.hash(n,d.fr,"hex"),c=this.signMessageString(h,this.privateKey);r.signature=c;const l=await this.privateDeleteOrders(this.extend(r,t));return this.parseOrders(l,s)}async cancelOrder(e,t=void 0,s={}){let i;this.checkRequiredCredentials(),await this.loadMarkets(),void 0!==t&&(i=this.market(t));const r=this.uuidv1(),a=this.remove0xPrefix(this.walletAddress),o=[this.base16ToBinary(r),this.base16ToBinary(a),this.encode(e)],n=this.binaryConcatArray(o),h=this.hash(n,d.fr,"hex"),c=this.signMessageString(h,this.privateKey),l={parameters:{nonce:r,wallet:this.walletAddress,orderId:e},signature:c},u=await this.privateDeleteOrders(this.extend(l,s)),p=this.safeDict(u,0);return this.parseOrder(p,i)}handleErrors(e,t,s,i,r,o,n,d,h){const c=this.safeString(n,"code"),l=this.safeString(n,"message");if(void 0!==c)throw this.throwExactlyMatchedException(this.exceptions.exact,c,l),new a.ExchangeError(this.id+" "+l)}async fetchDeposit(e,t=void 0,s={}){await this.loadMarkets();const i={nonce:this.uuidv1(),wallet:this.walletAddress,depositId:e},r=await this.privateGetDeposits(this.extend(i,s));return this.parseTransaction(r)}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){return i=this.extend({method:"privateGetDeposits"},i),await this.fetchTransactionsHelper(e,t,s,i)}async fetchStatus(e={}){return{status:"ok",updated:void 0,eta:void 0,url:void 0,info:await this.publicGetPing(e)}}async fetchTime(e={}){const t=await this.publicGetTime(e);return this.safeInteger(t,"serverTime")}async fetchWithdrawal(e,t=void 0,s={}){await this.loadMarkets();const i={nonce:this.uuidv1(),wallet:this.walletAddress,withdrawalId:e},r=await this.privateGetWithdrawals(this.extend(i,s));return this.parseTransaction(r)}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){return i=this.extend({method:"privateGetWithdrawals"},i),await this.fetchTransactionsHelper(e,t,s,i)}async fetchTransactionsHelper(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={nonce:this.uuidv1(),wallet:this.walletAddress};let o;void 0!==e&&(o=this.currency(e),r.asset=o.id),void 0!==t&&(r.start=t),void 0!==s&&(r.limit=s);const n=i.method;let d;if(i=this.omit(i,"method"),"privateGetDeposits"===n)d=await this.privateGetDeposits(this.extend(r,i));else{if("privateGetWithdrawals"!==n)throw new a.NotSupported(this.id+" fetchTransactionsHelper() not support this method");d=await this.privateGetWithdrawals(this.extend(r,i))}return this.parseTransactions(d,o,t,s)}parseTransactionStatus(e){return this.safeString({mined:"ok"},e,e)}parseTransaction(e,t=void 0){let s;"depositId"in e?s="deposit":("withdrawId"in e||"withdrawalId"in e)&&(s="withdrawal");let i=this.safeString2(e,"depositId","withdrawId");i=this.safeString(e,"withdrawalId",i);const r=this.safeCurrencyCode(this.safeString(e,"asset"),t),a=this.safeNumber(e,"quantity"),o=this.safeString(e,"txId"),n=this.safeInteger2(e,"txTime","time");let d;"fee"in e&&(d={cost:this.safeNumber(e,"fee"),currency:"ETH"});const h=this.safeString(e,"txStatus"),c=this.parseTransactionStatus(h),l=this.safeInteger(e,"confirmationTime");return{info:e,id:i,txid:o,timestamp:n,datetime:this.iso8601(n),network:void 0,address:void 0,addressTo:void 0,addressFrom:void 0,tag:void 0,tagTo:void 0,tagFrom:void 0,type:s,amount:a,currency:r,status:c,updated:l,comment:void 0,internal:void 0,fee:d}}calculateRateLimiterCost(e,t,s,i,r={}){const a=void 0!==this.apiKey,o=void 0!==this.secret,n=void 0!==this.walletAddress,d=void 0!==this.privateKey,h=this.safeValue(r,"cost",1);return a&&o&&n&&d?h/2:h}async fetchDepositAddress(e=void 0,t={}){const s={};s.nonce=this.uuidv1();const i=await this.privateGetWallets(this.extend(s,t));return this.parseDepositAddress(i)}parseDepositAddress(e,t=void 0){const s=e.length,i=this.safeDict(e,s-1),r=this.safeString(i,"address");return this.checkAddress(r),{info:e,currency:void 0,address:r,tag:void 0,network:"MATIC"}}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){const o=this.safeString(this.options,"network","ETH"),d=this.safeString(this.options,"version","v1");let h=this.urls.api[o]+"/"+d+"/"+e;let c;if(Object.keys(i).length>0&&("GET"===s?(c=this.urlencode(i),h=h+"?"+c):a=this.json(i)),r={"Content-Type":"application/json"},void 0!==this.apiKey&&(r["IDEX-API-Key"]=this.apiKey),"private"===t){let e;e="GET"===s?c:a,r["IDEX-HMAC-Signature"]=this.hmac(this.encode(e),this.encode(this.secret),n.J,"hex")}return{url:h,method:s,body:a,headers:r}}remove0xPrefix(e){return"0x"===e.slice(0,2)?e.slice(2):e}hashMessage(e){const t=this.base16ToBinary(this.remove0xPrefix(e)),s=this.encode("Ethereum Signed Message:\n"+t.byteLength);return"0x"+this.hash(this.binaryConcat(s,t),d.fr,"hex")}signHash(e,t){const s=(0,c.bu)(e.slice(-64),t.slice(-64),h.kA,void 0);return{r:"0x"+s.r,s:"0x"+s.s,v:27+s.v}}signMessage(e,t){return this.signHash(this.hashMessage(e),t.slice(-64))}signMessageString(e,t){const s=this.signMessage(e,t);return s.r+this.remove0xPrefix(s.s)+this.binaryToBase16(this.numberToBE(s.v,1))}}},9570:(e,t,s)=>{s.d(t,{Z:()=>n});var i=s(1106),r=s(2194),a=s(9292),o=s(1372);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"independentreserve",name:"Independent Reserve",countries:["AU","NZ"],rateLimit:1e3,pro:!0,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!0,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!0,reduceMargin:!1,setLeverage:!1,setMarginMode:!1,setPositionMode:!1},urls:{logo:"https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg",api:{public:"https://api.independentreserve.com/Public",private:"https://api.independentreserve.com/Private"},www:"https://www.independentreserve.com",doc:"https://www.independentreserve.com/API"},api:{public:{get:["GetValidPrimaryCurrencyCodes","GetValidSecondaryCurrencyCodes","GetValidLimitOrderTypes","GetValidMarketOrderTypes","GetValidOrderTypes","GetValidTransactionTypes","GetMarketSummary","GetOrderBook","GetAllOrders","GetTradeHistorySummary","GetRecentTrades","GetFxRates","GetOrderMinimumVolumes","GetCryptoWithdrawalFees"]},private:{post:["GetOpenOrders","GetClosedOrders","GetClosedFilledOrders","GetOrderDetails","GetAccounts","GetTransactions","GetFiatBankAccounts","GetDigitalCurrencyDepositAddress","GetDigitalCurrencyDepositAddresses","GetTrades","GetBrokerageFees","GetDigitalCurrencyWithdrawal","PlaceLimitOrder","PlaceMarketOrder","CancelOrder","SynchDigitalCurrencyDepositAddressWithBlockchain","RequestFiatWithdrawal","WithdrawFiatCurrency","WithdrawDigitalCurrency"]}},fees:{trading:{taker:this.parseNumber("0.005"),maker:this.parseNumber("0.005"),percentage:!0,tierBased:!1}},commonCurrencies:{PLA:"PlayChip"},precisionMode:a.sh})}async fetchMarkets(e={}){const t=await this.publicGetGetValidPrimaryCurrencyCodes(e),s=await this.publicGetGetValidSecondaryCurrencyCodes(e),i=await this.publicGetGetOrderMinimumVolumes(e),r=[];for(let e=0;e=0?d="buy":h.indexOf("Offer")>=0&&(d="sell"),h.indexOf("Market")>=0?h="market":h.indexOf("Limit")>=0&&(h="limit"));const c=this.parse8601(this.safeString(e,"CreatedTimestampUtc")),l=this.safeString(e,"VolumeFilled"),u=this.safeString(e,"FeePercent");let p;return void 0!==u&&void 0!==l&&(p=r.O.stringMul(u,l)),this.safeOrder({info:e,id:this.safeString(e,"OrderGuid"),clientOrderId:void 0,timestamp:c,datetime:this.iso8601(c),lastTradeTimestamp:void 0,symbol:s,type:h,timeInForce:void 0,postOnly:void 0,side:d,price:this.safeString(e,"Price"),stopPrice:void 0,triggerPrice:void 0,cost:this.safeString(e,"Value"),average:this.safeString(e,"AvgPrice"),amount:this.safeString2(e,"VolumeOrdered","Volume"),filled:l,remaining:this.safeString(e,"Outstanding"),status:this.parseOrderStatus(this.safeString(e,"Status")),fee:{rate:u,cost:p,currency:o},trades:void 0},t)}parseOrderStatus(e){return this.safeString({Open:"open",PartiallyFilled:"open",Filled:"closed",PartiallyFilledAndCancelled:"canceled",Cancelled:"canceled",PartiallyFilledAndExpired:"canceled",Expired:"canceled"},e,e)}async fetchOrder(e,t=void 0,s={}){await this.loadMarkets();const i=await this.privatePostGetOrderDetails(this.extend({orderGuid:e},s));let r;return void 0!==t&&(r=this.market(t)),this.parseOrder(i,r)}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.ordered({});let a;void 0!==e&&(a=this.market(e),r.primaryCurrencyCode=a.baseId,r.secondaryCurrencyCode=a.quoteId),void 0===s&&(s=50),r.pageIndex=1,r.pageSize=s;const o=await this.privatePostGetOpenOrders(this.extend(r,i)),n=this.safeList(o,"Data",[]);return this.parseOrders(n,a,t,s)}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.ordered({});let a;void 0!==e&&(a=this.market(e),r.primaryCurrencyCode=a.baseId,r.secondaryCurrencyCode=a.quoteId),void 0===s&&(s=50),r.pageIndex=1,r.pageSize=s;const o=await this.privatePostGetClosedOrders(this.extend(r,i)),n=this.safeList(o,"Data",[]);return this.parseOrders(n,a,t,s)}async fetchMyTrades(e=void 0,t=void 0,s=50,i={}){await this.loadMarkets();const r=this.safeInteger(i,"pageIndex",1);void 0===s&&(s=50);const a=this.ordered({pageIndex:r,pageSize:s}),o=await this.privatePostGetTrades(this.extend(a,i));let n;return void 0!==e&&(n=this.market(e)),this.parseTrades(o.Data,n,t,s)}parseTrade(e,t=void 0){const s=this.parse8601(e.TradeTimestampUtc),i=this.safeString(e,"TradeGuid"),a=this.safeString(e,"OrderGuid"),o=this.safeString2(e,"Price","SecondaryCurrencyTradePrice"),n=this.safeString2(e,"VolumeTraded","PrimaryCurrencyAmount"),d=this.parseNumber(o),h=this.parseNumber(n),c=this.parseNumber(r.O.stringMul(o,n)),l=this.safeString(e,"PrimaryCurrencyCode"),u=this.safeString(e,"SecondaryCurrencyCode");let p;void 0!==l&&void 0!==u&&(p=l+"/"+u);const f=this.safeSymbol(p,t,"/");let m=this.safeString(e,"OrderType");return void 0!==m&&(m.indexOf("Bid")>=0?m="buy":m.indexOf("Offer")>=0&&(m="sell")),this.safeTrade({id:i,info:e,timestamp:s,datetime:this.iso8601(s),symbol:f,order:a,type:void 0,side:m,takerOrMaker:void 0,price:d,amount:h,cost:c,fee:void 0},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.market(e),a={primaryCurrencyCode:r.baseId,secondaryCurrencyCode:r.quoteId,numberOfRecentTradesToRetrieve:50},o=await this.publicGetGetRecentTrades(this.extend(a,i));return this.parseTrades(o.Trades,r,t,s)}async fetchTradingFees(e={}){await this.loadMarkets();const t=await this.privatePostGetBrokerageFees(e),s={};for(let e=0;e{s.d(t,{Z:()=>n});var i=s(7872),r=s(6689),a=s(9292),o=s(7110);class n extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"indodax",name:"INDODAX",countries:["ID"],rateLimit:100,has:{CORS:void 0,spot:!0,margin:!1,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!1,cancelOrder:!0,cancelOrders:!1,closeAllPositions:!1,closePosition:!1,createDepositAddress:!1,createOrder:!0,createReduceOnlyOrder:!1,createStopLimitOrder:!1,createStopMarketOrder:!1,createStopOrder:!1,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDeposit:!1,fetchDepositAddress:"emulated",fetchDepositAddresses:!0,fetchDepositAddressesByNetwork:!1,fetchDeposits:!1,fetchDepositsWithdrawals:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLeverage:!1,fetchLeverageTiers:!1,fetchMarginMode:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!1,fetchPosition:!1,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!1,fetchPositionsForSymbol:!1,fetchPositionsHistory:!1,fetchPositionsRisk:!1,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!1,fetchTradingFees:!1,fetchTransactionFee:!0,fetchTransactionFees:!1,fetchTransactions:"emulated",fetchTransfer:!1,fetchTransfers:!1,fetchWithdrawal:!1,fetchWithdrawals:!1,reduceMargin:!1,setLeverage:!1,setMargin:!1,setMarginMode:!1,setPositionMode:!1,transfer:!1,withdraw:!0},version:"2.0",urls:{logo:"https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg",api:{public:"https://indodax.com",private:"https://indodax.com/tapi"},www:"https://www.indodax.com",doc:"https://github.com/btcid/indodax-official-api-docs",referral:"https://indodax.com/ref/testbitcoincoid/1"},api:{public:{get:{"api/server_time":5,"api/pairs":5,"api/price_increments":5,"api/summaries":5,"api/ticker/{pair}":5,"api/ticker_all":5,"api/trades/{pair}":5,"api/depth/{pair}":5,"tradingview/history_v2":5}},private:{post:{getInfo:4,transHistory:4,trade:1,tradeHistory:4,openOrders:4,orderHistory:4,getOrder:4,cancelOrder:4,withdrawFee:4,withdrawCoin:4,listDownline:4,checkDownline:4,createVoucher:4}}},fees:{trading:{tierBased:!1,percentage:!0,maker:0,taker:.003}},exceptions:{exact:{invalid_pair:r.BadSymbol,"Insufficient balance.":r.InsufficientFunds,"invalid order.":r.OrderNotFound,"Invalid credentials. API not found or session has expired.":r.AuthenticationError,"Invalid credentials. Bad sign.":r.AuthenticationError},broad:{"Minimum price":r.InvalidOrder,"Minimum order":r.InvalidOrder}},options:{recvWindow:5e3,timeDifference:0,adjustForTimeDifference:!1,networks:{XLM:"Stellar Token",BSC:"bep20",TRC20:"trc20",MATIC:"polygon"},timeframes:{"1m":"1","15m":"15","30m":"30","1h":"60","4h":"240","1d":"1D","3d":"3D","1w":"1W"}},commonCurrencies:{STR:"XLM",BCHABC:"BCH",BCHSV:"BSV",DRK:"DASH",NEM:"XEM"},precisionMode:a.sh})}nonce(){return this.milliseconds()-this.options.timeDifference}async fetchTime(e={}){const t=await this.publicGetApiServerTime(e);return this.safeInteger(t,"server_time")}async fetchMarkets(e={}){const t=await this.publicGetApiPairs(e),s=[];for(let e=0;e=0){e=[];const s=t.split(",");for(let t=0;t{s.d(t,{Z:()=>h});var i=s(3203),r=s(6689),a=s(2194),o=s(9292),n=s(1372),d=s(7110);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"kraken",name:"Kraken",countries:["US"],version:"0",rateLimit:1e3,certified:!1,pro:!0,has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,addMargin:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,createDepositAddress:!0,createOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTrailingAmountOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowInterest:!1,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDeposits:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchLedger:!0,fetchLedgerEntry:!0,fetchLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderTrades:"emulated",fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchWithdrawals:!0,setLeverage:!1,setMarginMode:!1,transfer:!0,withdraw:!0},timeframes:{"1m":1,"5m":5,"15m":15,"30m":30,"1h":60,"4h":240,"1d":1440,"1w":10080,"2w":21600},urls:{logo:"https://user-images.githubusercontent.com/51840849/76173629-fc67fb00-61b1-11ea-84fe-f2de582f58a3.jpg",api:{public:"https://api.kraken.com",private:"https://api.kraken.com",zendesk:"https://kraken.zendesk.com/api/v2/help_center/en-us/articles"},www:"https://www.kraken.com",doc:"https://docs.kraken.com/rest/",fees:"https://www.kraken.com/en-us/features/fee-schedule"},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0026"),maker:this.parseNumber("0.0016"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0026")],[this.parseNumber("50000"),this.parseNumber("0.0024")],[this.parseNumber("100000"),this.parseNumber("0.0022")],[this.parseNumber("250000"),this.parseNumber("0.0020")],[this.parseNumber("500000"),this.parseNumber("0.0018")],[this.parseNumber("1000000"),this.parseNumber("0.0016")],[this.parseNumber("2500000"),this.parseNumber("0.0014")],[this.parseNumber("5000000"),this.parseNumber("0.0012")],[this.parseNumber("10000000"),this.parseNumber("0.0001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0016")],[this.parseNumber("50000"),this.parseNumber("0.0014")],[this.parseNumber("100000"),this.parseNumber("0.0012")],[this.parseNumber("250000"),this.parseNumber("0.0010")],[this.parseNumber("500000"),this.parseNumber("0.0008")],[this.parseNumber("1000000"),this.parseNumber("0.0006")],[this.parseNumber("2500000"),this.parseNumber("0.0004")],[this.parseNumber("5000000"),this.parseNumber("0.0002")],[this.parseNumber("10000000"),this.parseNumber("0.0")]]}}},handleContentTypeApplicationZip:!0,api:{zendesk:{get:["360000292886","201893608"]},public:{get:{Assets:1,AssetPairs:1,Depth:1,OHLC:1,Spread:1,SystemStatus:1,Ticker:1,Time:1,Trades:1}},private:{post:{AddOrder:0,AddOrderBatch:0,AddExport:3,Balance:3,CancelAll:3,CancelAllOrdersAfter:3,CancelOrder:0,CancelOrderBatch:0,ClosedOrders:3,DepositAddresses:3,DepositMethods:3,DepositStatus:3,EditOrder:0,ExportStatus:3,GetWebSocketsToken:3,Ledgers:6,OpenOrders:3,OpenPositions:3,QueryLedgers:3,QueryOrders:3,QueryTrades:3,RetrieveExport:3,RemoveExport:3,BalanceEx:3,TradeBalance:3,TradesHistory:6,TradeVolume:3,Withdraw:3,WithdrawCancel:3,WithdrawInfo:3,WithdrawMethods:3,WithdrawAddresses:3,WithdrawStatus:3,WalletTransfer:3,CreateSubaccount:3,AccountTransfer:3,"Earn/Allocate":3,"Earn/Deallocate":3,"Earn/AllocateStatus":3,"Earn/DeallocateStatus":3,"Earn/Strategies":3,"Earn/Allocations":3}}},commonCurrencies:{LUNA:"LUNC",LUNA2:"LUNA",REPV2:"REP",REP:"REPV1",UST:"USTC",XBT:"BTC","XBT.M":"BTC.M",XDG:"DOGE"},options:{marketsByAltname:{},delistedMarketsById:{},inactiveCurrencies:["CAD","USD","JPY","GBP"],networks:{ETH:"ERC20",TRX:"TRC20"},depositMethods:{"1INCH":"1inch (1INCH)",AAVE:"Aave",ADA:"ADA",ALGO:"Algorand",ANKR:"ANKR (ANKR)",ANT:"Aragon (ANT)",ATOM:"Cosmos",AXS:"Axie Infinity Shards (AXS)",BADGER:"Bager DAO (BADGER)",BAL:"Balancer (BAL)",BAND:"Band Protocol (BAND)",BAT:"BAT",BCH:"Bitcoin Cash",BNC:"Bifrost (BNC)",BNT:"Bancor (BNT)",BTC:"Bitcoin",CHZ:"Chiliz (CHZ)",COMP:"Compound (COMP)",CQT:"\tCovalent Query Token (CQT)",CRV:"Curve DAO Token (CRV)",CTSI:"Cartesi (CTSI)",DAI:"Dai",DASH:"Dash",DOGE:"Dogecoin",DOT:"Polkadot",DYDX:"dYdX (DYDX)",ENJ:"Enjin Coin (ENJ)",EOS:"EOS",ETC:"Ether Classic (Hex)",ETH:"Ether (Hex)",EWT:"Energy Web Token",FEE:"Kraken Fee Credit",FIL:"Filecoin",FLOW:"Flow",GHST:"Aavegotchi (GHST)",GNO:"GNO",GRT:"GRT",ICX:"Icon",INJ:"Injective Protocol (INJ)",KAR:"Karura (KAR)",KAVA:"Kava",KEEP:"Keep Token (KEEP)",KNC:"Kyber Network (KNC)",KSM:"Kusama",LINK:"Link",LPT:"Livepeer Token (LPT)",LRC:"Loopring (LRC)",LSK:"Lisk",LTC:"Litecoin",MANA:"MANA",MATIC:"Polygon (MATIC)",MINA:"Mina",MIR:"Mirror Protocol (MIR)",MKR:"Maker (MKR)",MLN:"MLN",MOVR:"Moonriver (MOVR)",NANO:"NANO",OCEAN:"OCEAN",OGN:"Origin Protocol (OGN)",OMG:"OMG",OXT:"Orchid (OXT)",OXY:"Oxygen (OXY)",PAXG:"PAX (Gold)",PERP:"Perpetual Protocol (PERP)",PHA:"Phala (PHA)",QTUM:"QTUM",RARI:"Rarible (RARI)",RAY:"Raydium (RAY)",REN:"Ren Protocol (REN)",REP:"REPv2",REPV1:"REP",SAND:"The Sandbox (SAND)",SC:"Siacoin",SDN:"Shiden (SDN)",SOL:"Solana",SNX:"Synthetix Network (SNX)",SRM:"Serum",STORJ:"Storj (STORJ)",SUSHI:"Sushiswap (SUSHI)",TBTC:"tBTC",TRX:"Tron",UNI:"UNI",USDC:"USDC",USDT:"Tether USD (ERC20)","USDT-TRC20":"Tether USD (TRC20)",WAVES:"Waves",WBTC:"Wrapped Bitcoin (WBTC)",XLM:"Stellar XLM",XMR:"Monero",XRP:"Ripple XRP",XTZ:"XTZ",YFI:"YFI",ZEC:"Zcash (Transparent)",ZRX:"0x (ZRX)"},withdrawMethods:{Lightning:"Lightning",Bitcoin:"BTC",Ripple:"XRP",Litecoin:"LTC",Dogecoin:"DOGE",Stellar:"XLM",Ethereum:"ERC20","Arbitrum One":"Arbitrum",Polygon:"MATIC","Arbitrum Nova":"Arbitrum",Optimism:"Optimism","zkSync Era":"zkSync","Ethereum Classic":"ETC",Zcash:"ZEC",Monero:"XMR",Tron:"TRC20",Solana:"SOL",EOS:"EOS","Bitcoin Cash":"BCH",Cardano:"ADA",Qtum:"QTUM",Tezos:"XTZ",Cosmos:"ATOM",Nano:"NANO",Siacoin:"SC",Lisk:"LSK",Waves:"WAVES",ICON:"ICX",Algorand:"ALGO","Polygon - USDC.e":"MATIC","Arbitrum One - USDC.e":"Arbitrum",Polkadot:"DOT",Kava:"KAVA",Filecoin:"FIL",Kusama:"KSM",Flow:"FLOW","Energy Web":"EW",Mina:"MINA",Centrifuge:"CFG",Karura:"KAR",Moonriver:"MOVR",Shiden:"SDN",Khala:"PHA","Bifrost Kusama":"BNC",Songbird:"SGB","Terra classic":"LUNC",KILT:"KILT",Basilisk:"BSX",Flare:"FLR","Avalanche C-Chain":"AVAX",Kintsugi:"KINT",Altair:"AIR",Moonbeam:"GLMR",Acala:"ACA",Astar:"ASTR",Akash:"AKT",Robonomics:"XRT",Fantom:"FTM",Elrond:"EGLD",THORchain:"RUNE",Secret:"SCRT",Near:"NEAR","Internet Computer Protocol":"ICP",Picasso:"PICA","Crust Shadow":"CSM",Integritee:"TEER","Parallel Finance":"PARA",HydraDX:"HDX",Interlay:"INTR","Fetch.ai":"FET",NYM:"NYM","Terra 2.0":"LUNA2",Juno:"JUNO",Nodle:"NODL",Stacks:"STX","Ethereum PoW":"ETHW",Aptos:"APT",Sui:"SUI",Genshiro:"GENS",Aventus:"AVT",Sei:"SEI",OriginTrail:"OTP",Celestia:"TIA"}},precisionMode:o.sh,exceptions:{"EQuery:Invalid asset pair":r.BadSymbol,"EAPI:Invalid key":r.AuthenticationError,"EFunding:Unknown withdraw key":r.InvalidAddress,"EFunding:Invalid amount":r.InsufficientFunds,"EService:Unavailable":r.ExchangeNotAvailable,"EDatabase:Internal error":r.ExchangeNotAvailable,"EService:Busy":r.ExchangeNotAvailable,"EQuery:Unknown asset":r.BadSymbol,"EAPI:Rate limit exceeded":r.DDoSProtection,"EOrder:Rate limit exceeded":r.DDoSProtection,"EGeneral:Internal error":r.ExchangeNotAvailable,"EGeneral:Temporary lockout":r.DDoSProtection,"EGeneral:Permission denied":r.PermissionDenied,"EOrder:Unknown order":r.InvalidOrder,"EOrder:Order minimum not met":r.InvalidOrder,"EGeneral:Invalid arguments":r.BadRequest,"ESession:Invalid session":r.AuthenticationError,"EAPI:Invalid nonce":r.InvalidNonce,"EFunding:No funding method":r.BadRequest,"EFunding:Unknown asset":r.BadSymbol,"EService:Market in post_only mode":r.OnMaintenance,"EGeneral:Too many requests":r.DDoSProtection,"ETrade:User Locked":r.AccountSuspended}})}feeToPrecision(e,t){return this.decimalToPrecision(t,o.tk,this.markets[e].precision.amount,this.precisionMode)}async fetchMarkets(e={}){const t=await this.publicGetAssetPairs(e),s=this.safeValue(t,"result",{}),i=Object.keys(s);let r=[];for(let e=0;e=0,u=this.safeString(o,"altname"),p=this.safeValue(o,"fees_maker",[]),f=this.safeValue(p,0,[]),m=this.safeString(f,1);let g;void 0!==m&&(g=this.parseNumber(a.O.stringDiv(m,"100")));const v=this.safeValue(o,"fees",[]),y=this.safeValue(v,0,[]),w=this.safeString(y,1);let b;void 0!==w&&(b=this.parseNumber(a.O.stringDiv(w,"100")));const S=this.safeValue(o,"leverage_buy",[]),k=S.length,O=this.parseNumber(this.parsePrecision(this.safeString(o,"pair_decimals"))),T="online"===this.safeString(o,"status");r.push({id:t,wsId:this.safeString(o,"wsname"),symbol:l?u:h+"/"+c,base:h,quote:c,settle:void 0,baseId:n,quoteId:d,settleId:void 0,darkpool:l,altname:o.altname,type:"spot",spot:!0,margin:k>0,swap:!1,future:!1,option:!1,active:T,contract:!1,linear:void 0,inverse:void 0,taker:b,maker:g,contractSize:void 0,expiry:void 0,expiryDatetime:void 0,strike:void 0,optionType:void 0,precision:{amount:this.parseNumber(this.parsePrecision(this.safeString(o,"lot_decimals"))),price:O},limits:{leverage:{min:this.parseNumber("1"),max:this.safeNumber(S,k-1,1)},amount:{min:this.safeNumber(o,"ordermin"),max:void 0},price:{min:O,max:void 0},cost:{min:this.safeNumber(o,"costmin"),max:void 0}},created:void 0,info:o})}return r=this.appendInactiveMarkets(r),this.options.marketsByAltname=this.indexBy(r,"altname"),r}safeCurrency(e,t=void 0){return void 0!==e&&e.length>3&&(0!==e.indexOf("X")&&0!==e.indexOf("Z")||e.indexOf(".")>0||(e=e.slice(1))),super.safeCurrency(e,t)}appendInactiveMarkets(e){const t={amount:this.parseNumber("1e-8"),price:this.parseNumber("1e-8")},s={darkpool:!1,info:void 0,maker:void 0,taker:void 0,active:!1,precision:t,limits:{amount:{min:t.amount,max:void 0},price:{min:t.price,max:void 0},cost:{min:void 0,max:void 0}}},i=[];for(let t=0;t=0)throw new r.ExchangeError(this.id+" fetchTicker() does not provide a ticker for darkpool symbol "+e);const s=this.market(e),i={pair:s.id},a=(await this.publicGetTicker(this.extend(i,t))).result[s.id];return this.parseTicker(a,s)}parseOHLCV(e,t=void 0){return[this.safeTimestamp(e,0),this.safeNumber(e,1),this.safeNumber(e,2),this.safeNumber(e,3),this.safeNumber(e,4),this.safeNumber(e,6)]}async fetchOHLCV(e,t="1m",s=void 0,i=void 0,r={}){await this.loadMarkets();let a=!1;if([a,r]=this.handleOptionAndParams(r,"fetchOHLCV","paginate"),a)return await this.fetchPaginatedCallDeterministic("fetchOHLCV",e,s,i,t,r,720);const o=this.market(e),n=this.safeInteger(this.timeframes,t),d={pair:o.id};d.interval=void 0!==n?n:t,void 0!==s&&(d.since=this.numberToString(s)+"000000");const h=await this.publicGetOHLC(this.extend(d,r)),c=this.safeValue(h,"result",{}),l=this.safeList(c,o.id,[]);return this.parseOHLCVs(l,o,t,s,i)}parseLedgerEntryType(e){return this.safeString({trade:"trade",withdrawal:"transaction",deposit:"transaction",transfer:"transfer",margin:"margin"},e,e)}parseLedgerEntry(e,t=void 0){const s=this.safeString(e,"id");let i;const r=this.safeString(e,"refid"),o=this.parseLedgerEntryType(this.safeString(e,"type")),n=this.safeCurrencyCode(this.safeString(e,"asset"),t);let d=this.safeString(e,"amount");a.O.stringLt(d,"0")?(i="out",d=a.O.stringAbs(d)):i="in";const h=this.safeTimestamp(e,"time");return{info:e,id:s,direction:i,account:undefined,referenceId:r,referenceAccount:undefined,type:o,currency:n,amount:this.parseNumber(d),before:void 0,after:this.safeNumber(e,"balance"),status:"ok",timestamp:h,datetime:this.iso8601(h),fee:{cost:this.safeNumber(e,"fee"),currency:n}}}async fetchLedger(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r,a={};void 0!==e&&(r=this.currency(e),a.asset=r.id),void 0!==t&&(a.start=this.parseToInt(t/1e3)),[a,i]=this.handleUntilOption("end",a,i);const o=await this.privatePostLedgers(this.extend(a,i)),n=this.safeValue(o,"result",{}),d=this.safeValue(n,"ledger",{}),h=Object.keys(d),c=[];for(let e=0;e6&&(n=this.safeString(e,6))}else if("string"==typeof e)n=e;else if("ordertxid"in e){const c=this.safeString(e,"pair"),l=this.findMarketByAltnameOrId(c);if(void 0!==l?t=l:void 0!==c&&(t=this.getDelistedMarketById(c)),d=this.safeString(e,"ordertxid"),n=this.safeString2(e,"id","postxid"),s=this.safeTimestamp(e,"time"),i=this.safeString(e,"type"),r=this.safeString(e,"ordertype"),a=this.safeString(e,"price"),o=this.safeString(e,"vol"),"fee"in e){let s;void 0!==t&&(s=t.quote),h={cost:this.safeString(e,"fee"),currency:s}}}void 0!==t&&(c=t.symbol);const l=this.safeString(e,"cost");return this.safeTrade({id:n,order:d,info:e,timestamp:s,datetime:this.iso8601(s),symbol:c,type:r,side:i,takerOrMaker:void 0,price:a,amount:o,cost:l,fee:h},t)}async fetchTrades(e,t=void 0,s=void 0,i={}){await this.loadMarkets();const r=this.market(e),a=r.id,o={pair:a};void 0!==t&&(o.since=1e6*t,o.since=t.toString()+"000000"),void 0!==s&&(o.count=s);const n=(await this.publicGetTrades(this.extend(o,i))).result,d=n[a],h=d.length;if(h<=0)return[];const c=d[h-1],l=this.safeString(n,"last");return c.push(l),d[h-1]=c,this.parseTrades(d,r,t,s)}parseBalance(e){const t=this.safeValue(e,"result",{}),s={info:e,timestamp:void 0,datetime:void 0},i=Object.keys(t);for(let e=0;e-1,w=this.safeNumber(e,"price");if(void 0!==t&&(p=t.symbol,"fee"in e)){g={cost:this.safeString(e,"fee"),rate:void 0},v.indexOf("fciq")>=0?g.currency=t.quote:v.indexOf("fcib")>=0&&(g.currency=t.base)}const b=this.parseOrderStatus(this.safeString(e,"status"));let S=this.safeString2(e,"id","txid");if(void 0===S||S.startsWith("[")){const t=this.safeList(e,"txid");S=this.safeString(t,0)}const k=this.safeString(e,"userref"),O=this.safeValue(e,"trades",[]),T=[];for(let e=0;e=0)throw new r.OrderNotFound(this.id+" cancelOrder() error "+this.last_http_response);throw e}return i}async cancelOrders(e,t=void 0,s={}){const i={orders:e};return await this.privatePostCancelOrderBatch(this.extend(i,s))}async cancelAllOrders(e=void 0,t={}){return await this.loadMarkets(),await this.privatePostCancelAll(t)}async cancelAllOrdersAfter(e,t={}){if(e>864e5)throw new r.BadRequest(this.id+"cancelAllOrdersAfter timeout should be less than 86400000 milliseconds");await this.loadMarkets();const s={timeout:e>0?this.parseToInt(e/1e3):0};return await this.privatePostCancelAllOrdersAfter(this.extend(s,t))}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();const r={};void 0!==t&&(r.start=this.parseToInt(t/1e3));let a=i;const o=this.safeValue2(i,"userref","clientOrderId");void 0!==o&&(r.userref=o,a=this.omit(i,["userref","clientOrderId"]));const n=await this.privatePostOpenOrders(this.extend(r,a));let d;void 0!==e&&(d=this.market(e));const h=this.safeDict(n,"result",{}),c=this.safeDict(h,"open",{});return this.parseOrders(c,d,t,s)}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r={};void 0!==t&&(r.start=this.parseToInt(t/1e3));let a=i;const o=this.safeValue2(i,"userref","clientOrderId");void 0!==o&&(r.userref=o,a=this.omit(i,["userref","clientOrderId"])),[r,i]=this.handleUntilOption("end",r,i);const n=await this.privatePostClosedOrders(this.extend(r,a));let d;void 0!==e&&(d=this.market(e));const h=this.safeDict(n,"result",{}),c=this.safeDict(h,"closed",{});return this.parseOrders(c,d,t,s)}parseTransactionStatus(e){return this.safeString({Initial:"pending",Pending:"pending",Success:"ok",Settled:"pending",Failure:"failed",Partial:"ok"},e,e)}parseNetwork(e){const t=this.safeValue(this.options,"withdrawMethods",{});return this.safeString(t,e,e)}parseTransaction(e,t=void 0){const s=this.safeString(e,"refid"),i=this.safeString(e,"txid"),r=this.safeTimestamp(e,"time"),a=this.safeString(e,"asset"),o=this.safeCurrencyCode(a,t),n=this.safeString(e,"info"),d=this.safeNumber(e,"amount");let h=this.parseTransactionStatus(this.safeString(e,"status"));const c=this.safeString(e,"status-prop");("on-hold"===c||"cancel-pending"===c||"onhold"===c)&&(h="pending");const l=this.safeString(e,"type");let u=this.safeNumber(e,"fee");return void 0===u&&"deposit"===l&&(u=0),{info:e,id:s,currency:o,amount:d,network:this.parseNetwork(this.safeString(e,"network")),address:n,addressTo:void 0,addressFrom:void 0,tag:void 0,tagTo:void 0,tagFrom:void 0,status:h,type:l,updated:void 0,txid:i,timestamp:r,datetime:this.iso8601(r),comment:void 0,internal:void 0,fee:{currency:o,cost:u}}}parseTransactionsByType(e,t,s=void 0,i=void 0,r=void 0){const a=[];for(let s=0;s0){const e=s[i-1];e.next_cursor=t,s[i-1]=e}return s}async createDepositAddress(e,t={}){return await this.fetchDepositAddress(e,this.extend({new:"true"},t))}async fetchDepositMethods(e,t={}){await this.loadMarkets();const s={asset:this.currency(e).id},i=await this.privatePostDepositMethods(this.extend(s,t));return this.safeValue(i,"result")}async fetchDepositAddress(e,t={}){await this.loadMarkets();const s=this.currency(e);let i=this.safeStringUpper(t,"network");const a=this.safeValue(this.options,"networks",{});i=this.safeString(a,i,i),t=this.omit(t,"network"),"USDT"===e&&"TRC20"===i&&(e=e+"-"+i);const o=this.safeValue(this.options,"depositMethods",{}),n=this.safeString(o,e);let d=this.safeString(t,"method",n);if(void 0===d){const t=await this.fetchDepositMethods(e);if(void 0!==i)for(let e=0;e=0){d=s;break}}if(void 0===d){const e=this.safeValue(t,0,{});d=this.safeString(e,"method")}}const h={asset:s.id,method:d},c=await this.privatePostDepositAddresses(this.extend(h,t)),l=this.safeValue(c,"result",[]),u=this.safeValue(l,0,{});if(void 0===u)throw new r.InvalidAddress(this.id+" privatePostDepositAddresses() returned no addresses for "+e);return this.parseDepositAddress(u,s)}parseDepositAddress(e,t=void 0){const s=this.safeString(e,"address"),i=this.safeString(e,"tag"),r=(t=this.safeCurrency(void 0,t)).code;return this.checkAddress(s),{currency:r,address:s,tag:i,network:void 0,info:e}}async withdraw(e,t,s,i=void 0,a={}){if([i,a]=this.handleWithdrawTagAndParams(i,a),this.checkAddress(s),"key"in a){await this.loadMarkets();const i=this.currency(e),r={asset:i.id,amount:t,address:s},o=await this.privatePostWithdraw(this.extend(r,a)),n=this.safeDict(o,"result",{});return this.parseTransaction(n,i)}throw new r.ExchangeError(this.id+" withdraw() requires a 'key' parameter (withdrawal key name, as set up on your account)")}async fetchPositions(e=void 0,t={}){await this.loadMarkets();const s=await this.privatePostOpenPositions(this.extend({docalcs:"true",consolidation:"market"},t));e=this.marketSymbols(e);const i=this.safeList(s,"result"),r=this.parsePositions(i,e);return this.filterByArrayPositions(r,"symbol",e,!1)}parsePosition(e,t=void 0){const s=this.safeString(e,"pair"),i="buy"===this.safeString(e,"type")?"long":"short";return this.safePosition({info:e,id:void 0,symbol:this.safeSymbol(s,t),notional:void 0,marginMode:void 0,liquidationPrice:void 0,entryPrice:void 0,unrealizedPnl:this.safeNumber(e,"net"),realizedPnl:void 0,percentage:void 0,contracts:this.safeNumber(e,"vol"),contractSize:void 0,markPrice:void 0,lastPrice:void 0,side:i,hedged:void 0,timestamp:void 0,datetime:void 0,lastUpdateTimestamp:void 0,maintenanceMargin:void 0,maintenanceMarginPercentage:void 0,collateral:void 0,initialMargin:this.safeNumber(e,"margin"),initialMarginPercentage:void 0,leverage:this.safeNumber(e,"leverage"),marginRatio:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}parseAccountType(e){return this.safeString({spot:"Spot Wallet",swap:"Futures Wallet",future:"Futures Wallet"},e,e)}async transferOut(e,t,s={}){return await this.transfer(e,t,"spot","swap",s)}async transfer(e,t,s,i,a={}){await this.loadMarkets();const o=this.currency(e);s=this.parseAccountType(s),i=this.parseAccountType(i);const n={amount:this.currencyToPrecision(e,t),from:s,to:i,asset:o.id};if("Spot Wallet"!==s)throw new r.BadRequest(this.id+" transfer cannot transfer from "+s+" to "+i+". Use krakenfutures instead to transfer from the futures account.");const d=await this.privatePostWalletTransfer(this.extend(n,a)),h=this.parseTransfer(d,o);return this.extend(h,{amount:t,fromAccount:s,toAccount:i})}parseTransfer(e,t=void 0){const s=this.safeValue(e,"result",{});return{info:e,id:this.safeString(s,"refid"),timestamp:void 0,datetime:void 0,currency:this.safeString(t,"code"),amount:void 0,fromAccount:void 0,toAccount:void 0,status:"sucess"}}sign(e,t="public",s="GET",i={},r=void 0,a=void 0){let o="/"+this.version+"/"+t+"/"+e;if("public"===t)Object.keys(i).length&&(o+="?"+this.urlencodeNested(i));else if("private"===t){const t="CancelOrderBatch"===e;this.checkRequiredCredentials();const s=this.nonce().toString();a=t?this.json(this.extend({nonce:s},i)):this.urlencodeNested(this.extend({nonce:s},i));const h=this.encode(s+a),c=this.hash(h,n.J,"binary"),l=this.encode(o),u=this.binaryConcat(l,c),p=this.base64ToBinary(this.secret),f=this.hmac(u,p,d.o,"base64");(r={"API-Key":this.apiKey,"API-Sign":f})["Content-Type"]=t?"application/json":"application/x-www-form-urlencoded"}else o="/"+e;return o=this.urls.api[t]+o,{url:o,method:s,body:a,headers:r}}nonce(){return this.milliseconds()}handleErrors(e,t,s,i,a,o,n,d,h){if(520===e)throw new r.ExchangeNotAvailable(this.id+" "+e.toString()+" "+t);if(o.indexOf("Invalid order")>=0)throw new r.InvalidOrder(this.id+" "+o);if(o.indexOf("Invalid nonce")>=0)throw new r.InvalidNonce(this.id+" "+o);if(o.indexOf("Insufficient funds")>=0)throw new r.InsufficientFunds(this.id+" "+o);if(o.indexOf("Cancel pending")>=0)throw new r.CancelPending(this.id+" "+o);if(o.indexOf("Invalid arguments:volume")>=0)throw new r.InvalidOrder(this.id+" "+o);if(o.indexOf("Rate limit exceeded")>=0)throw new r.RateLimitExceeded(this.id+" "+o);if(void 0!==n&&"{"===o[0]&&"string"!=typeof n&&"error"in n){if(n.error.length){const e=this.id+" "+o;for(let t=0;t{s.d(t,{Z:()=>h});var i=s(3931),r=s(9292),a=s(6689),o=s(2194),n=s(1372),d=s(7110);class h extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"krakenfutures",name:"Kraken Futures",countries:["US"],version:"v3",userAgent:void 0,rateLimit:600,pro:!0,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:!1,cancelAllOrders:!0,cancelAllOrdersAfter:!0,cancelOrder:!0,cancelOrders:!0,createMarketOrder:!1,createOrder:!0,editOrder:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchDepositAddress:!1,fetchDepositAddresses:!1,fetchDepositAddressesByNetwork:!1,fetchFundingHistory:void 0,fetchFundingRate:"emulated",fetchFundingRateHistory:!0,fetchFundingRates:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchIsolatedPositions:!1,fetchLeverage:!0,fetchLeverages:!0,fetchLeverageTiers:!0,fetchMarketLeverageTiers:"emulated",fetchMarkets:!0,fetchMarkOHLCV:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!1,fetchOrderBook:!0,fetchOrders:!1,fetchPositions:!0,fetchPremiumIndexOHLCV:!1,fetchTickers:!0,fetchTrades:!0,setLeverage:!0,setMarginMode:!1,transfer:!0},urls:{test:{public:"https://demo-futures.kraken.com/derivatives/api/",private:"https://demo-futures.kraken.com/derivatives/api/",charts:"https://demo-futures.kraken.com/api/charts/",www:"https://demo-futures.kraken.com"},logo:"https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg",api:{charts:"https://futures.kraken.com/api/charts/",history:"https://futures.kraken.com/api/history/",feeschedules:"https://futures.kraken.com/api/feeschedules/",public:"https://futures.kraken.com/derivatives/api/",private:"https://futures.kraken.com/derivatives/api/"},www:"https://futures.kraken.com/",doc:["https://docs.futures.kraken.com/#introduction"],fees:"https://support.kraken.com/hc/en-us/articles/360022835771-Transaction-fees-and-rebates-for-Kraken-Futures",referral:void 0},api:{public:{get:["feeschedules","instruments","orderbook","tickers","history","historicalfundingrates"]},private:{get:["feeschedules/volumes","openpositions","notifications","accounts","openorders","recentorders","fills","transfers","leveragepreferences","pnlpreferences"],post:["sendorder","editorder","cancelorder","transfer","batchorder","cancelallorders","cancelallordersafter","withdrawal"],put:["leveragepreferences","pnlpreferences"]},charts:{get:["{price_type}/{symbol}/{interval}"]},history:{get:["orders","executions","triggers","accountlogcsv","account-log","market/{symbol}/orders","market/{symbol}/executions"]}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0005"),maker:this.parseNumber("0.0002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0005")],[this.parseNumber("100000"),this.parseNumber("0.0004")],[this.parseNumber("1000000"),this.parseNumber("0.0003")],[this.parseNumber("5000000"),this.parseNumber("0.00025")],[this.parseNumber("10000000"),this.parseNumber("0.0002")],[this.parseNumber("20000000"),this.parseNumber("0.00015")],[this.parseNumber("50000000"),this.parseNumber("0.000125")],[this.parseNumber("100000000"),this.parseNumber("0.0001")]],maker:[[this.parseNumber("0"),this.parseNumber("0.0002")],[this.parseNumber("100000"),this.parseNumber("0.0015")],[this.parseNumber("1000000"),this.parseNumber("0.000125")],[this.parseNumber("5000000"),this.parseNumber("0.0001")],[this.parseNumber("10000000"),this.parseNumber("0.000075")],[this.parseNumber("20000000"),this.parseNumber("0.00005")],[this.parseNumber("50000000"),this.parseNumber("0.000025")],[this.parseNumber("100000000"),this.parseNumber("0")]]}}},exceptions:{exact:{apiLimitExceeded:a.RateLimitExceeded,marketUnavailable:a.ContractUnavailable,requiredArgumentMissing:a.BadRequest,unavailable:a.ExchangeNotAvailable,authenticationError:a.AuthenticationError,accountInactive:a.ExchangeError,invalidAccount:a.BadRequest,invalidAmount:a.BadRequest,insufficientFunds:a.InsufficientFunds,"Bad Request":a.BadRequest,Unavailable:a.InsufficientFunds,invalidUnit:a.BadRequest,"Json Parse Error":a.ExchangeError,nonceBelowThreshold:a.InvalidNonce,nonceDuplicate:a.InvalidNonce,notFound:a.BadRequest,"Server Error":a.ExchangeError,unknownError:a.ExchangeError},broad:{invalidArgument:a.BadRequest,nonceBelowThreshold:a.InvalidNonce,nonceDuplicate:a.InvalidNonce}},precisionMode:r.sh,options:{access:{history:{GET:{orders:"private",executions:"private",triggers:"private",accountlogcsv:"private"}}},settlementCurrencies:{flex:["USDT","BTC","USD","GBP","EUR","USDC"]},symbol:{quoteIds:["USD","XBT"],reversed:!1},versions:{public:{GET:{historicalfundingrates:"v4"}},charts:{GET:{"{price_type}/{symbol}/{interval}":"v1"}},history:{GET:{orders:"v2",executions:"v2",triggers:"v2",accountlogcsv:"v2"}}},fetchTrades:{method:"historyGetMarketSymbolExecutions"}},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","4h":"4h","12h":"12h","1d":"1d","1w":"1w"}})}async fetchMarkets(e={}){const t=await this.publicGetInstruments(e),s=this.safeValue(t,"instruments",[]),i=[];for(let e=0;e=0;let d,h,c;if(n)o="index";else{d=a.indexOf("_vanilla")>=0,h=!d;const e=this.safeString(t,"lastTradingTime");o=void 0===e?"swap":"future",c=this.parse8601(e)}const l="swap"===o,u="future"===o;let p=r;const f=r.split("_"),m=this.safeString(f,1),g=m.slice(0,m.length-3),v="usd",y=this.safeCurrencyCode(g),w=this.safeCurrencyCode(v);let b,S;const k=this.safeString(t,"contractValueTradePrecision"),O=this.parseNumber(this.integerPrecisionToAmount(k)),T=this.safeNumber(t,"tickSize"),P=l||u||n;if(l||u){"futures_inverse"===this.safeString(t,"type")?(b=y,S=g,h=!0):(b=w,S=v,h=!1),d=!h,p=y+"/"+w+":"+b,u&&(p=p+"-"+this.yymmdd(c))}i.push({id:r,symbol:p,base:y,quote:w,settle:b,baseId:g,quoteId:v,settleId:S,type:o,spot:!1,margin:!1,swap:l,future:u,option:!1,index:n,active:void 0,contract:P,linear:d,inverse:h,contractSize:this.safeNumber(t,"contractSize"),maintenanceMarginRate:void 0,expiry:c,expiryDatetime:this.iso8601(c),strike:void 0,optionType:void 0,precision:{amount:O,price:T},limits:{leverage:{min:void 0,max:void 0},amount:{min:void 0,max:void 0},price:{min:void 0,max:void 0},cost:{min:void 0,max:void 0}},created:this.parse8601(this.safeString(t,"openingDate")),info:t})}const r=this.options.settlementCurrencies.flex,a=[];for(let e=0;e=0?m="taker":g.indexOf("maker")>=0&&(m="maker"));if("takerOrder"in e){s=this.safeInteger(e,"timestamp");const t=this.safeDict(e,"takerOrder",{});void 0!==t&&(c=this.safeStringLower(t,"direction"),m="taker")}return this.safeTrade({info:e,id:a,symbol:this.safeString(t,"symbol"),timestamp:s,datetime:this.iso8601(s),order:d,type:n,side:c,takerOrMaker:m,price:i,amount:f?r:void 0,cost:p,fee:void 0})}createOrderRequest(e,t,s,i,r=void 0,a={}){const o=this.market(e);e=o.symbol,t=this.safeString(a,"orderType",t);const n=this.safeString(a,"timeInForce");let d=!1;[d,a]=this.handlePostOnly("market"===t,"post"===t,a),d?t="post":"ioc"===n?t="ioc":"limit"===t?t="lmt":"market"===t&&(t="mkt");const h={symbol:o.id,side:s,size:this.amountToPrecision(e,i)},c=this.safeString2(a,"clientOrderId","cliOrdId");void 0!==c&&(h.cliOrdId=c);const l=this.safeString2(a,"triggerPrice","stopPrice"),u=void 0!==l,p=this.safeString(a,"stopLossPrice"),f=this.safeString(a,"takeProfitPrice"),m=void 0!==p,g=void 0!==f,v=m||g,y=this.safeString(a,"triggerSignal","last");let w=this.safeValue(a,"reduceOnly");return(v||u)&&(h.triggerSignal=y),u?(t="stp",h.stopPrice=this.priceToPrecision(e,l)):v&&(w=!0,m?(t="stp",h.stopPrice=this.priceToPrecision(e,p)):g&&(t="take_profit",h.stopPrice=this.priceToPrecision(e,f))),w&&(h.reduceOnly=!0),h.orderType=t,void 0!==r&&(h.limitPrice=this.priceToPrecision(e,r)),a=this.omit(a,["clientOrderId","timeInForce","triggerPrice","stopLossPrice","takeProfitPrice"]),this.extend(h,a)}async createOrder(e,t,s,i,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.createOrderRequest(e,t,s,i,r,a),d=await this.privatePostSendorder(n),h=this.safeValue(d,"sendStatus"),c=this.safeString(h,"status");return this.verifyOrderActionSuccess(c,"createOrder",["filled"]),this.parseOrder(h,o)}async createOrders(e,t={}){await this.loadMarkets();const s=[];for(let i=0;i0)for(let e=0;e0?this.parseToInt(e/1e3):0};return await this.privatePostCancelallordersafter(this.extend(s,t))}async fetchOpenOrders(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a=await this.privateGetOpenorders(i),o=this.safeList(a,"openOrders",[]);return this.parseOrders(o,r,t,s)}async fetchClosedOrders(e=void 0,t=void 0,s=void 0,i={}){let r;await this.loadMarkets(),void 0!==e&&(r=this.market(e));const a={};void 0!==s&&(a.count=s),void 0!==t&&(a.from=t);const o=await this.historyGetOrders(this.extend(a,i)),n=this.safeList(o,"elements",[]),d=[];for(let e=0;e0){let e="0.0";for(let t=0;t1)continue;const c=this.account();if(s)c.total=this.safeString(d,"quantity"),c.free=this.safeString(d,"available");else if(i)c.used="0.0",c.total=d;else{const t=this.safeValue(e,"auxiliary");c.free=this.safeString(t,"af"),c.total=this.safeString(t,"pv")}a[h]=c}return this.safeBalance(a)}async fetchFundingRates(e=void 0,t={}){await this.loadMarkets();const s=this.marketIds(e),i=await this.publicGetTickers(t),r=this.safeValue(i,"tickers"),a=[];for(let e=0;e{s.d(t,{Z:()=>d});var i=s(5792),r=s(6689),a=s(2194),o=s(9292),n=s(1372);class d extends i.Z{describe(){return this.deepExtend(super.describe(),{id:"kucoin",name:"KuCoin",countries:["SC"],rateLimit:10,version:"v2",certified:!0,pro:!0,comment:"Platform 2.0",quoteJsonNumbers:!1,has:{CORS:void 0,spot:!0,margin:!0,swap:!1,future:!1,option:!1,borrowCrossMargin:!0,borrowIsolatedMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!1,createDepositAddress:!0,createMarketBuyOrderWithCost:!0,createMarketOrderWithCost:!0,createMarketSellOrderWithCost:!0,createOrder:!0,createOrders:!0,createPostOnlyOrder:!0,createStopLimitOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTriggerOrder:!0,editOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBorrowInterest:!0,fetchBorrowRateHistories:!0,fetchBorrowRateHistory:!0,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!0,fetchDepositAddress:!0,fetchDepositAddressesByNetwork:!0,fetchDeposits:!0,fetchDepositWithdrawFee:!0,fetchDepositWithdrawFees:!0,fetchFundingHistory:!1,fetchFundingRate:!1,fetchFundingRateHistory:!1,fetchFundingRates:!1,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!0,fetchLedger:!0,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!1,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenInterest:!1,fetchOpenInterestHistory:!1,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrderBooks:!1,fetchOrdersByStatus:!0,fetchOrderTrades:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositionsHistory:!1,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTradingFees:!1,fetchTransactionFee:!0,fetchTransfers:!1,fetchWithdrawals:!0,repayCrossMargin:!0,repayIsolatedMargin:!0,setLeverage:!1,setMarginMode:!1,setPositionMode:!1,signIn:!1,transfer:!0,withdraw:!0},urls:{logo:"https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg",referral:"https://www.kucoin.com/ucenter/signup?rcode=E5wkqe",api:{public:"https://api.kucoin.com",private:"https://api.kucoin.com",futuresPrivate:"https://api-futures.kucoin.com",futuresPublic:"https://api-futures.kucoin.com",webExchange:"https://kucoin.com/_api",broker:"https://api-broker.kucoin.com"},www:"https://www.kucoin.com",doc:["https://docs.kucoin.com"]},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{public:{get:{currencies:4.5,"currencies/{currency}":4.5,symbols:6,"market/orderbook/level1":3,"market/allTickers":22.5,"market/stats":22.5,markets:4.5,"market/orderbook/level{level}_{limit}":6,"market/orderbook/level2_20":3,"market/orderbook/level2_100":6,"market/histories":4.5,"market/candles":4.5,prices:4.5,timestamp:4.5,status:4.5,"mark-price/{symbol}/current":3,"margin/config":25},post:{"bullet-public":15}},private:{get:{"user-info":30,accounts:7.5,"accounts/{accountId}":7.5,"accounts/ledgers":3,"hf/accounts/ledgers":2,"hf/margin/account/ledgers":2,"transaction-history":3,"sub/user":30,"sub-accounts/{subUserId}":22.5,"sub-accounts":30,"sub/api-key":30,"margin/account":40,"margin/accounts":15,"isolated/accounts":15,"deposit-addresses":7.5,deposits:7.5,"hist-deposits":7.5,withdrawals:30,"hist-withdrawals":30,"withdrawals/quotas":30,"accounts/transferable":30,"transfer-list":30,"base-fee":3,"trade-fees":3,"market/orderbook/level{level}":3,"market/orderbook/level2":3,"market/orderbook/level3":3,"hf/orders/active":2,"hf/orders/active/symbols":2,"hf/orders/done":2,"hf/orders/{orderId}":2,"hf/orders/client-order/{clientOid}":2,"hf/orders/dead-cancel-all/query":2,"hf/fills":2,orders:2,"limit/orders":3,"orders/{orderId}":2,"order/client-order/{clientOid}":3,fills:10,"limit/fills":20,"stop-order":8,"stop-order/{orderId}":3,"stop-order/queryOrderByClientOid":3,"oco/order/{orderId}":2,"oco/order/details/{orderId}":2,"oco/client-order/{clientOid}":2,"oco/orders":2,"hf/margin/orders/active":4,"hf/margin/orders/done":10,"hf/margin/orders/{orderId}":4,"hf/margin/orders/client-order/{clientOid}":5,"hf/margin/fills":5,"etf/info":25,"margin/currencies":20,"risk/limit/strategy":20,"isolated/symbols":20,"isolated/account/{symbol}":50,"margin/borrow":15,"margin/repay":15,"margin/interest":20,"project/list":10,"project/marketInterestRate":7.5,"redeem/orders":10,"purchase/orders":10,"broker/api/rebase/download":3},post:{"sub/user/created":22.5,"sub/api-key":30,"sub/api-key/update":45,"deposit-addresses":30,withdrawals:7.5,"accounts/universal-transfer":6,"accounts/sub-transfer":45,"accounts/inner-transfer":15,"transfer-out":30,"transfer-in":30,"hf/orders":1,"hf/orders/test":1,"hf/orders/sync":1,"hf/orders/multi":1,"hf/orders/multi/sync":1,"hf/orders/alter":3,"hf/orders/dead-cancel-all":2,orders:2,"orders/test":2,"orders/multi":3,"stop-order":2,"oco/order":2,"hf/margin/order":5,"hf/margin/order/test":5,"margin/order":5,"margin/order/test":5,"margin/borrow":15,"margin/repay":10,purchase:15,redeem:15,"lend/purchase/update":10,"bullet-private":10},delete:{"sub/api-key":45,"withdrawals/{withdrawalId}":30,"hf/orders/{orderId}":1,"hf/orders/sync/{orderId}":1,"hf/orders/client-order/{clientOid}":1,"hf/orders/sync/client-order/{clientOid}":1,"hf/orders/cancel/{orderId}":2,"hf/orders":2,"hf/orders/cancelAll":30,"orders/{orderId}":3,"order/client-order/{clientOid}":5,orders:20,"stop-order/{orderId}":3,"stop-order/cancelOrderByClientOid":5,"stop-order/cancel":3,"oco/order/{orderId}":3,"oco/client-order/{clientOid}":3,"oco/orders":3,"hf/margin/orders/{orderId}":5,"hf/margin/orders/client-order/{clientOid}":5,"hf/margin/orders":10}},futuresPublic:{get:{"contracts/active":4.5,"contracts/{symbol}":4.5,ticker:3,"level2/snapshot":4.5,"level2/depth20":7.5,"level2/depth100":15,"trade/history":7.5,"kline/query":4.5,"interest/query":7.5,"index/query":3,"mark-price/{symbol}/current":4.5,"premium/query":4.5,"trade-statistics":4.5,"funding-rate/{symbol}/current":3,"contract/funding-rates":7.5,timestamp:3,status:6,"level2/message/query":1.3953},post:{"bullet-public":15}},futuresPrivate:{get:{"transaction-history":3,"account-overview":7.5,"account-overview-all":9,"transfer-list":30,orders:3,stopOrders:9,recentDoneOrders:7.5,"orders/{orderId}":7.5,"orders/byClientOid":7.5,fills:7.5,recentFills:4.5,openOrderStatistics:15,position:3,positions:3,"margin/maxWithdrawMargin":15,"contracts/risk-limit/{symbol}":7.5,"funding-history":7.5},post:{"transfer-out":30,"transfer-in":30,orders:3,"orders/test":3,"orders/multi":4.5,"position/margin/auto-deposit-status":6,"margin/withdrawMargin":15,"position/margin/deposit-margin":6,"position/risk-limit-level/change":6,"bullet-private":15},delete:{"orders/{orderId}":1.5,"orders/client-order/{clientOid}":1.5,orders:45,stopOrders:22.5}},webExchange:{get:{"currency/currency/chain-info":1}},broker:{get:{"broker/nd/info":2,"broker/nd/account":2,"broker/nd/account/apikey":2,"broker/nd/rebase/download":3},post:{"broker/nd/transfer":1,"broker/nd/account":3,"broker/nd/account/apikey":3,"broker/nd/account/update-apikey":3},delete:{"broker/nd/account/apikey":3}}},timeframes:{"1m":"1min","3m":"3min","5m":"5min","15m":"15min","30m":"30min","1h":"1hour","2h":"2hour","4h":"4hour","6h":"6hour","8h":"8hour","12h":"12hour","1d":"1day","1w":"1week","1M":"1month"},precisionMode:o.sh,exceptions:{exact:{"order not exist":r.OrderNotFound,"order not exist.":r.OrderNotFound,order_not_exist:r.OrderNotFound,order_not_exist_or_not_allow_to_cancel:r.InvalidOrder,"Order size below the minimum requirement.":r.InvalidOrder,"The withdrawal amount is below the minimum requirement.":r.ExchangeError,"Unsuccessful! Exceeded the max. funds out-transfer limit":r.InsufficientFunds,"The amount increment is invalid.":r.BadRequest,400:r.BadRequest,401:r.AuthenticationError,403:r.NotSupported,404:r.NotSupported,405:r.NotSupported,415:r.NotSupported,429:r.RateLimitExceeded,500:r.ExchangeNotAvailable,503:r.ExchangeNotAvailable,101030:r.PermissionDenied,103e3:r.InvalidOrder,130101:r.BadRequest,130102:r.ExchangeError,130103:r.OrderNotFound,130104:r.ExchangeError,130105:r.InsufficientFunds,130106:r.NotSupported,130107:r.ExchangeError,130108:r.OrderNotFound,130201:r.PermissionDenied,130202:r.ExchangeError,130203:r.InsufficientFunds,130204:r.BadRequest,130301:r.InsufficientFunds,130302:r.PermissionDenied,130303:r.NotSupported,130304:r.NotSupported,130305:r.NotSupported,130306:r.NotSupported,130307:r.NotSupported,130308:r.InvalidOrder,130309:r.InvalidOrder,130310:r.ExchangeError,130311:r.InvalidOrder,130312:r.InvalidOrder,130313:r.InvalidOrder,130314:r.InvalidOrder,130315:r.NotSupported,126e3:r.ExchangeError,126001:r.NotSupported,126002:r.ExchangeError,126003:r.InvalidOrder,126004:r.ExchangeError,126005:r.PermissionDenied,126006:r.ExchangeError,126007:r.ExchangeError,126009:r.ExchangeError,126010:r.ExchangeError,126011:r.ExchangeError,126013:r.InsufficientFunds,126015:r.ExchangeError,126021:r.NotSupported,126022:r.InvalidOrder,126027:r.InvalidOrder,126028:r.InvalidOrder,126029:r.InvalidOrder,126030:r.InvalidOrder,126033:r.InvalidOrder,126034:r.InvalidOrder,126036:r.InvalidOrder,126037:r.ExchangeError,126038:r.ExchangeError,126039:r.ExchangeError,126041:r.ExchangeError,126042:r.ExchangeError,126043:r.OrderNotFound,126044:r.InvalidOrder,126045:r.NotSupported,126046:r.NotSupported,126047:r.PermissionDenied,126048:r.PermissionDenied,135005:r.ExchangeError,135018:r.ExchangeError,200004:r.InsufficientFunds,210014:r.InvalidOrder,210021:r.InsufficientFunds,230003:r.InsufficientFunds,26e4:r.InvalidAddress,260100:r.InsufficientFunds,3e5:r.InvalidOrder,4e5:r.BadSymbol,400001:r.AuthenticationError,400002:r.InvalidNonce,400003:r.AuthenticationError,400004:r.AuthenticationError,400005:r.AuthenticationError,400006:r.AuthenticationError,400007:r.AuthenticationError,400008:r.NotSupported,400100:r.InsufficientFunds,400200:r.InvalidOrder,400350:r.InvalidOrder,400370:r.InvalidOrder,400400:r.BadRequest,400401:r.AuthenticationError,400500:r.InvalidOrder,400600:r.BadSymbol,400760:r.InvalidOrder,401e3:r.BadRequest,408e3:r.BadRequest,411100:r.AccountSuspended,415e3:r.BadRequest,400303:r.PermissionDenied,5e5:r.ExchangeNotAvailable,260220:r.InvalidAddress,900014:r.BadRequest},broad:{"Exceeded the access frequency":r.RateLimitExceeded,"require more permission":r.PermissionDenied}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.001"),maker:this.parseNumber("0.001"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("50"),this.parseNumber("0.001")],[this.parseNumber("200"),this.parseNumber("0.0009")],[this.parseNumber("500"),this.parseNumber("0.0008")],[this.parseNumber("1000"),this.parseNumber("0.0007")],[this.parseNumber("2000"),this.parseNumber("0.0007")],[this.parseNumber("4000"),this.parseNumber("0.0006")],[this.parseNumber("8000"),this.parseNumber("0.0005")],[this.parseNumber("15000"),this.parseNumber("0.00045")],[this.parseNumber("25000"),this.parseNumber("0.0004")],[this.parseNumber("40000"),this.parseNumber("0.00035")],[this.parseNumber("60000"),this.parseNumber("0.0003")],[this.parseNumber("80000"),this.parseNumber("0.00025")]],maker:[[this.parseNumber("0"),this.parseNumber("0.001")],[this.parseNumber("50"),this.parseNumber("0.0009")],[this.parseNumber("200"),this.parseNumber("0.0007")],[this.parseNumber("500"),this.parseNumber("0.0005")],[this.parseNumber("1000"),this.parseNumber("0.0003")],[this.parseNumber("2000"),this.parseNumber("0")],[this.parseNumber("4000"),this.parseNumber("0")],[this.parseNumber("8000"),this.parseNumber("0")],[this.parseNumber("15000"),this.parseNumber("-0.00005")],[this.parseNumber("25000"),this.parseNumber("-0.00005")],[this.parseNumber("40000"),this.parseNumber("-0.00005")],[this.parseNumber("60000"),this.parseNumber("-0.00005")],[this.parseNumber("80000"),this.parseNumber("-0.00005")]]}},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{}}},commonCurrencies:{BIFI:"BIFIF",VAI:"VAIOT",WAX:"WAXP",ALT:"APTOSLAUNCHTOKEN",KALT:"ALT"},options:{version:"v1",symbolSeparator:"-",fetchMyTradesMethod:"private_get_fills",fetchCurrencies:{webApiEnable:!0,webApiRetries:1,webApiMuteFailure:!0},fetchMarkets:{fetchTickersFees:!0},withdraw:{includeFee:!1},versions:{public:{GET:{currencies:"v3","currencies/{currency}":"v3",symbols:"v2"}},private:{GET:{"user-info":"v2","hf/margin/account/ledgers":"v3","sub/user":"v2","sub-accounts":"v2","margin/accounts":"v3","isolated/accounts":"v3","deposit-addresses":"v1","market/orderbook/level2":"v3","market/orderbook/level3":"v3","market/orderbook/level{level}":"v3","oco/order/{orderId}":"v3","oco/order/details/{orderId}":"v3","oco/client-order/{clientOid}":"v3","oco/orders":"v3","hf/margin/orders/active":"v3","hf/margin/orders/done":"v3","hf/margin/orders/{orderId}":"v3","hf/margin/orders/client-order/{clientOid}":"v3","hf/margin/fills":"v3","etf/info":"v3","margin/currencies":"v3","margin/borrow":"v3","margin/repay":"v3","margin/interest":"v3","project/list":"v3","project/marketInterestRate":"v3","redeem/orders":"v3","purchase/orders":"v3"},POST:{"sub/user/created":"v2","accounts/universal-transfer":"v3","accounts/sub-transfer":"v2","accounts/inner-transfer":"v2","transfer-out":"v3","oco/order":"v3","hf/margin/order":"v3","hf/margin/order/test":"v3","margin/borrow":"v3","margin/repay":"v3",purchase:"v3",redeem:"v3","lend/purchase/update":"v3"},DELETE:{"hf/margin/orders/{orderId}":"v3","hf/margin/orders/client-order/{clientOid}":"v3","hf/margin/orders":"v3","oco/order/{orderId}":"v3","oco/client-order/{clientOid}":"v3","oco/orders":"v3"}},futuresPrivate:{POST:{"transfer-out":"v3"}}},partner:{spot:{id:"ccxt",key:"9e58cc35-5b5e-4133-92ec-166e3f077cb8"},future:{id:"ccxtfutures",key:"1b327198-f30c-4f14-a0ac-918871282f15"}},accountsByType:{spot:"trade",margin:"margin",cross:"margin",isolated:"isolated",main:"main",funding:"main",future:"contract",swap:"contract",mining:"pool",hf:"trade_hf"},networks:{BTC:"btc",BTCNATIVESEGWIT:"bech32",ERC20:"eth",TRC20:"trx",HRC20:"heco",MATIC:"matic",KCC:"kcc",SOL:"sol",ALGO:"algo",EOS:"eos",BEP20:"bsc",BEP2:"bnb",ARBONE:"arbitrum",AVAXX:"avax",AVAXC:"avaxc",TLOS:"tlos",CFX:"cfx",ACA:"aca",OPTIMISM:"optimism",ONT:"ont",GLMR:"glmr",CSPR:"cspr",KLAY:"klay",XRD:"xrd",RVN:"rvn",NEAR:"near",APT:"aptos",ETHW:"ethw",TON:"ton",BCH:"bch",BSV:"bchsv",BCHA:"bchabc",OSMO:"osmo",NANO:"nano",XLM:"xlm",VET:"vet",IOST:"iost",ZIL:"zil",XRP:"xrp",TOMO:"tomo",XMR:"xmr",COTI:"coti",XTZ:"xtz",ADA:"ada",WAX:"waxp",THETA:"theta",ONE:"one",IOTEX:"iotx",NULS:"nuls",KSM:"ksm",LTC:"ltc",WAVES:"waves",DOT:"dot",STEEM:"steem",QTUM:"qtum",DOGE:"doge",FIL:"fil",XYM:"xym",FLUX:"flux",ATOM:"atom",XDC:"xdc",KDA:"kda",ICP:"icp",CELO:"celo",LSK:"lsk",VSYS:"vsys",KAR:"kar",XCH:"xch",FLOW:"flow",BAND:"band",EGLD:"egld",HBAR:"hbar",XPR:"xpr",AR:"ar",FTM:"ftm",KAVA:"kava",KMA:"kma",XEC:"xec",IOTA:"iota",HNT:"hnt",ASTR:"astr",PDEX:"pdex",METIS:"metis",ZEC:"zec",POKT:"pokt",OASYS:"oas",OASIS:"oasis",ETC:"etc",AKT:"akt",FSN:"fsn",SCRT:"scrt",CFG:"cfg",ICX:"icx",KMD:"kmd",NEM:"NEM",STX:"stx",DGB:"dgb",DCR:"dcr",CKB:"ckb",ELA:"ela",HYDRA:"hydra",BTM:"btm",KARDIA:"kai",SXP:"sxp",NEBL:"nebl",ZEN:"zen",SDN:"sdn",LTO:"lto",WEMIX:"wemix",EVER:"ever",BNC:"bnc",BNCDOT:"bncdot",AION:"aion",GRIN:"grin",LOKI:"loki",QKC:"qkc",TT:"TT",PIVX:"pivx",SERO:"sero",METER:"meter",STATEMINE:"statemine",DVPN:"dvpn",XPRT:"xprt",MOVR:"movr",ERGO:"ergo",ABBC:"abbc",DIVI:"divi",PURA:"pura",DFI:"dfi",NEON3:"neon3",DOCK:"dock",TRUE:"true",CS:"cs",ORAI:"orai"},marginModes:{cross:"MARGIN_TRADE",isolated:"MARGIN_ISOLATED_TRADE",spot:"TRADE"}}})}nonce(){return this.milliseconds()}async fetchTime(e={}){const t=await this.publicGetTimestamp(e);return this.safeInteger(t,"data")}async fetchStatus(e={}){const t=await this.publicGetStatus(e),s=this.safeDict(t,"data",{});return{status:"open"===this.safeString(s,"status")?"ok":"maintenance",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){const t=await this.publicGetSymbols(e),s=this.safeList(t,"data"),i=this.safeDict(this.options,"fetchMarkets",{});let r={};this.safeBool(i,"fetchTickersFees",!0)&&(r=await this.publicGetMarketAllTickers(e));const o=this.safeDict(r,"data",{}),n=this.safeList(o,"ticker",[]),d=this.indexBy(n,"symbol"),h=[];for(let e=0;e1&&void 0===r&&e[1].length>1&&(r=e[1]),n=e[0]}let d=void 0===n?"withdrawal":"deposit";const h=this.safeString(e,"status");let c;const l=this.safeString(e,"fee");if(void 0!==l){let e;void 0!==o&&(e=a.O.stringDiv(l,o)),c={cost:this.parseNumber(l),rate:this.parseNumber(e),currency:i}}let u=this.safeInteger2(e,"createdAt","createAt"),p=this.safeInteger(e,"updatedAt");!("createdAt"in e)&&(d="address"in e?"withdrawal":"deposit",void 0!==u&&(u*=1e3),void 0!==p&&(p*=1e3));const f=this.safeBool(e,"isInner"),m=this.safeString(e,"memo");return{info:e,id:this.safeString2(e,"id","withdrawalId"),timestamp:u,datetime:this.iso8601(u),network:this.networkIdToCode(this.safeString(e,"chain")),address:r,addressTo:r,addressFrom:void 0,tag:m,tagTo:m,tagFrom:void 0,currency:i,amount:this.parseNumber(o),txid:n,type:d,status:this.parseTransactionStatus(h),comment:this.safeString(e,"remark"),internal:f,fee:c,updated:p}}async fetchDeposits(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchDeposits","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchDeposits",e,t,s,i);let a,o,n={};void 0!==e&&(a=this.currency(e),n.currency=a.id),void 0!==s&&(n.pageSize=s),[n,i]=this.handleUntilOption("endAt",n,i),void 0!==t&&t<1550448e6?(n.startAt=this.parseToInt(t/1e3),o=await this.privateGetHistDeposits(this.extend(n,i))):(void 0!==t&&(n.startAt=t),o=await this.privateGetDeposits(this.extend(n,i)));const d=o.data.items;return this.parseTransactions(d,a,t,s,{type:"deposit"})}async fetchWithdrawals(e=void 0,t=void 0,s=void 0,i={}){await this.loadMarkets();let r=!1;if([r,i]=this.handleOptionAndParams(i,"fetchWithdrawals","paginate"),r)return await this.fetchPaginatedCallDynamic("fetchWithdrawals",e,t,s,i);let a,o,n={};void 0!==e&&(a=this.currency(e),n.currency=a.id),void 0!==s&&(n.pageSize=s),[n,i]=this.handleUntilOption("endAt",n,i),void 0!==t&&t<1550448e6?(n.startAt=this.parseToInt(t/1e3),o=await this.privateGetHistWithdrawals(this.extend(n,i))):(void 0!==t&&(n.startAt=t),o=await this.privateGetWithdrawals(this.extend(n,i)));const d=o.data.items;return this.parseTransactions(d,a,t,s,{type:"withdrawal"})}parseBalanceHelper(e){const t=this.account();t.used=this.safeString2(e,"holdBalance","hold"),t.free=this.safeString2(e,"availableBalance","available"),t.total=this.safeString2(e,"totalBalance","total");const s=this.safeString(e,"liability"),i=this.safeString(e,"interest");return t.debt=a.O.stringAdd(s,i),t}async fetchBalance(e={}){await this.loadMarkets();const t=this.safeString(e,"code");let s;void 0!==t&&(s=this.currency(t));const i=this.safeString2(this.options,"fetchBalance","defaultType","spot"),r=this.safeString(e,"type",i),a=this.safeDict(this.options,"accountsByType");let o=this.safeString(a,r,r);e=this.omit(e,"type");this.safeBool(e,"hf",!1)&&(o="trade_hf"),e=this.omit(e,"hf");const[n,d]=this.handleMarginModeAndParams("fetchBalance",e);let h;const c={},l="isolated"===n||"isolated"===o,u="cross"===n||"margin"===o;let p;l?(void 0!==s&&(c.balanceCurrency=s.id),h=await this.privateGetIsolatedAccounts(this.extend(c,d))):u?h=await this.privateGetMarginAccount(this.extend(c,d)):(void 0!==s&&(c.currency=s.id),c.type=o,h=await this.privateGetAccounts(this.extend(c,d)));const f={info:h,timestamp:void 0,datetime:void 0};if(l){p=this.safeDict(h,"data",{});const e=this.safeValue(p,"assets",p);for(let t=0;t{s.d(t,{Z:()=>n});var i=s(6689),r=s(2194),a=s(9292),o=s(5667);class n extends o.Z{describe(){return this.deepExtend(super.describe(),{id:"kucoinfutures",name:"KuCoin Futures",countries:["SC"],rateLimit:75,version:"v1",certified:!0,pro:!0,comment:"Platform 2.0",quoteJsonNumbers:!1,has:{CORS:void 0,spot:!1,margin:!1,swap:!0,future:!0,option:!1,addMargin:!0,cancelAllOrders:!0,cancelOrder:!0,closeAllPositions:!1,closePosition:!0,closePositions:!1,createDepositAddress:!0,createOrder:!0,createOrders:!0,createReduceOnlyOrder:!0,createStopLimitOrder:!0,createStopLossOrder:!0,createStopMarketOrder:!0,createStopOrder:!0,createTakeProfitOrder:!0,createTriggerOrder:!0,fetchAccounts:!0,fetchBalance:!0,fetchBorrowRateHistories:!1,fetchBorrowRateHistory:!1,fetchClosedOrders:!0,fetchCrossBorrowRate:!1,fetchCrossBorrowRates:!1,fetchCurrencies:!1,fetchDepositAddress:!0,fetchDeposits:!0,fetchDepositWithdrawFee:!1,fetchDepositWithdrawFees:!1,fetchFundingHistory:!0,fetchFundingRate:!0,fetchFundingRateHistory:!0,fetchIndexOHLCV:!1,fetchIsolatedBorrowRate:!1,fetchIsolatedBorrowRates:!1,fetchL3OrderBook:!0,fetchLedger:!0,fetchLeverageTiers:!1,fetchMarginAdjustmentHistory:!1,fetchMarginMode:!1,fetchMarketLeverageTiers:!0,fetchMarkets:!0,fetchMarkOHLCV:!1,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchPosition:!0,fetchPositionHistory:!1,fetchPositionMode:!1,fetchPositions:!0,fetchPositionsHistory:!0,fetchPremiumIndexOHLCV:!1,fetchStatus:!0,fetchTicker:!0,fetchTickers:!0,fetchTime:!0,fetchTrades:!0,fetchTradingFee:!0,fetchTransactionFee:!1,fetchWithdrawals:!0,setLeverage:!1,setMarginMode:!1,transfer:!0,withdraw:void 0},urls:{logo:"https://user-images.githubusercontent.com/1294454/147508995-9e35030a-d046-43a1-a006-6fabd981b554.jpg",doc:["https://docs.kucoin.com/futures","https://docs.kucoin.com"],www:"https://futures.kucoin.com/",referral:"https://futures.kucoin.com/?rcode=E5wkqe",api:{public:"https://openapi-v2.kucoin.com",private:"https://openapi-v2.kucoin.com",futuresPrivate:"https://api-futures.kucoin.com",futuresPublic:"https://api-futures.kucoin.com",webExchange:"https://futures.kucoin.com/_api/web-front"}},requiredCredentials:{apiKey:!0,secret:!0,password:!0},api:{futuresPublic:{get:{"contracts/active":1,"contracts/{symbol}":1,"contracts/risk-limit/{symbol}":1,ticker:1,"level2/snapshot":1.33,"level2/depth{limit}":1,"level2/message/query":1,"level3/message/query":1,"level3/snapshot":1,"trade/history":1,"interest/query":1,"index/query":1,"mark-price/{symbol}/current":1,"premium/query":1,"funding-rate/{symbol}/current":1,timestamp:1,status:1,"kline/query":1},post:{"bullet-public":1}},futuresPrivate:{get:{"account-overview":1.33,"transaction-history":4.44,"deposit-address":1,"deposit-list":1,"withdrawals/quotas":1,"withdrawal-list":1,"transfer-list":1,orders:1.33,stopOrders:1,recentDoneOrders:1,"orders/{orderId}":1,"orders/byClientOid":1,fills:4.44,recentFills:4.44,openOrderStatistics:1,position:1,positions:4.44,"funding-history":4.44,"sub/api-key":1,"trade-statistics":1,"trade-fees":1,"history-positions":1},post:{withdrawals:1,"transfer-out":1,"transfer-in":1,orders:1.33,"orders/test":1.33,"position/margin/auto-deposit-status":1,"position/margin/deposit-margin":1,"position/risk-limit-level/change":1,"bullet-private":1,"sub/api-key":1,"sub/api-key/update":1},delete:{"withdrawals/{withdrawalId}":1,"cancel/transfer-out":1,"orders/{orderId}":1,orders:4.44,stopOrders:1,"sub/api-key":1,"orders/client-order/{clientOid}":1}},webExchange:{get:{"contract/{symbol}/funding-rates":1}}},precisionMode:a.sh,exceptions:{exact:{400:i.BadRequest,401:i.AuthenticationError,403:i.NotSupported,404:i.NotSupported,405:i.NotSupported,415:i.BadRequest,429:i.RateLimitExceeded,500:i.ExchangeNotAvailable,503:i.ExchangeNotAvailable,100001:i.InvalidOrder,100004:i.BadRequest,101030:i.PermissionDenied,200004:i.InsufficientFunds,230003:i.InsufficientFunds,260100:i.InsufficientFunds,300003:i.InsufficientFunds,300012:i.InvalidOrder,400001:i.AuthenticationError,400002:i.InvalidNonce,400003:i.AuthenticationError,400004:i.AuthenticationError,400005:i.AuthenticationError,400006:i.AuthenticationError,400007:i.AuthenticationError,404e3:i.NotSupported,400100:i.BadRequest,411100:i.AccountSuspended,5e5:i.ExchangeNotAvailable},broad:{"Position does not exist":i.OrderNotFound}},fees:{trading:{tierBased:!0,percentage:!0,taker:this.parseNumber("0.0006"),maker:this.parseNumber("0.0002"),tiers:{taker:[[this.parseNumber("0"),this.parseNumber("0.0006")],[this.parseNumber("50"),this.parseNumber("0.0006")],[this.parseNumber("200"),this.parseNumber("0.0006")],[this.parseNumber("500"),this.parseNumber("0.0005")],[this.parseNumber("1000"),this.parseNumber("0.0004")],[this.parseNumber("2000"),this.parseNumber("0.0004")],[this.parseNumber("4000"),this.parseNumber("0.00038")],[this.parseNumber("8000"),this.parseNumber("0.00035")],[this.parseNumber("15000"),this.parseNumber("0.00032")],[this.parseNumber("25000"),this.parseNumber("0.0003")],[this.parseNumber("40000"),this.parseNumber("0.0003")],[this.parseNumber("60000"),this.parseNumber("0.0003")],[this.parseNumber("80000"),this.parseNumber("0.0003")]],maker:[[this.parseNumber("0"),this.parseNumber("0.02")],[this.parseNumber("50"),this.parseNumber("0.015")],[this.parseNumber("200"),this.parseNumber("0.01")],[this.parseNumber("500"),this.parseNumber("0.01")],[this.parseNumber("1000"),this.parseNumber("0.01")],[this.parseNumber("2000"),this.parseNumber("0")],[this.parseNumber("4000"),this.parseNumber("0")],[this.parseNumber("8000"),this.parseNumber("0")],[this.parseNumber("15000"),this.parseNumber("-0.003")],[this.parseNumber("25000"),this.parseNumber("-0.006")],[this.parseNumber("40000"),this.parseNumber("-0.009")],[this.parseNumber("60000"),this.parseNumber("-0.012")],[this.parseNumber("80000"),this.parseNumber("-0.015")]]}},funding:{tierBased:!1,percentage:!1,withdraw:{},deposit:{}}},commonCurrencies:{HOT:"HOTNOW",EDGE:"DADI",WAX:"WAXP",TRY:"Trias",VAI:"VAIOT",XBT:"BTC"},timeframes:{"1m":1,"3m":void 0,"5m":5,"15m":15,"30m":30,"1h":60,"2h":120,"4h":240,"6h":void 0,"8h":480,"12h":720,"1d":1440,"1w":10080},options:{version:"v1",symbolSeparator:"-",defaultType:"swap",code:"USDT",marginModes:{},marginTypes:{},versions:{futuresPrivate:{POST:{"transfer-out":"v2"}},futuresPublic:{GET:{"level3/snapshot":"v2"}}},networks:{OMNI:"omni",ERC20:"eth",TRC20:"trx"}}})}async fetchStatus(e={}){const t=await this.futuresPublicGetStatus(e),s=this.safeValue(t,"data",{});return{status:"open"===this.safeString(s,"status")?"ok":"maintenance",updated:void 0,eta:void 0,url:void 0,info:t}}async fetchMarkets(e={}){const t=await this.futuresPublicGetContractsActive(e),s=[],i=this.safeValue(t,"data",[]);for(let e=0;e-1?"long":"short");const d=r.O.stringAbs(this.safeString(e,"posCost")),h=this.safeString(e,"posInit"),c=r.O.stringDiv(h,d),l=this.safeString(e,"unrealisedPnl"),u=this.safeValue(e,"crossMode");let p;return void 0!==u&&(p=u?"cross":"isolated"),this.safePosition({info:e,id:this.safeString2(e,"id","positionId"),symbol:this.safeString(t,"symbol"),timestamp:i,datetime:this.iso8601(i),lastUpdateTimestamp:this.safeInteger(e,"closeTime"),initialMargin:this.parseNumber(h),initialMarginPercentage:this.parseNumber(c),maintenanceMargin:this.safeNumber(e,"posMaint"),maintenanceMarginPercentage:this.safeNumber(e,"maintMarginReq"),entryPrice:this.safeNumber2(e,"avgEntryPrice","openPrice"),notional:this.parseNumber(d),leverage:this.safeNumber2(e,"realLeverage","leverage"),unrealizedPnl:this.parseNumber(l),contracts:this.parseNumber(r.O.stringAbs(a)),contractSize:this.safeValue(t,"contractSize"),realizedPnl:this.safeNumber2(e,"realisedPnl","pnl"),marginRatio:void 0,liquidationPrice:this.safeNumber(e,"liquidationPrice"),markPrice:this.safeNumber(e,"markPrice"),lastPrice:void 0,collateral:this.safeNumber(e,"maintMargin"),marginMode:p,side:o,percentage:void 0,stopLossPrice:void 0,takeProfitPrice:void 0})}async createOrder(e,t,s,i,r=void 0,a={}){await this.loadMarkets();const o=this.market(e),n=this.safeBool(a,"test",!1);a=this.omit(a,"test");const d=this.createContractOrderRequest(e,t,s,i,r,a);let h;h=n?await this.futuresPrivatePostOrdersTest(d):await this.futuresPrivatePostOrders(d);const c=this.safeDict(h,"data",{});return this.parseOrder(c,o)}async createOrders(e,t={}){await this.loadMarkets();const s=[];for(let t=0;t