ccxt 4.2.63 → 4.2.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/ccxt.js CHANGED
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
177
177
 
178
178
  //-----------------------------------------------------------------------------
179
179
  // this is updated by vss.js when building
180
- const version = '4.2.63';
180
+ const version = '4.2.64';
181
181
  Exchange["default"].ccxtVersion = version;
182
182
  const exchanges = {
183
183
  'ace': ace,
@@ -2785,14 +2785,12 @@ class binance extends binance$1 {
2785
2785
  }
2786
2786
  }
2787
2787
  const promises = await Promise.all(promisesRaw);
2788
- const spotMarkets = this.safeValue(this.safeValue(promises, 0), 'symbols', []);
2789
- const futureMarkets = this.safeValue(this.safeValue(promises, 1), 'symbols', []);
2790
- const deliveryMarkets = this.safeValue(this.safeValue(promises, 2), 'symbols', []);
2791
- const optionMarkets = this.safeValue(this.safeValue(promises, 3), 'optionSymbols', []);
2792
- let markets = spotMarkets;
2793
- markets = this.arrayConcat(markets, futureMarkets);
2794
- markets = this.arrayConcat(markets, deliveryMarkets);
2795
- markets = this.arrayConcat(markets, optionMarkets);
2788
+ let markets = [];
2789
+ for (let i = 0; i < fetchMarkets.length; i++) {
2790
+ const promise = this.safeDict(promises, i);
2791
+ const promiseMarkets = this.safeList2(promise, 'symbols', 'optionSymbols', []);
2792
+ markets = this.arrayConcat(markets, promiseMarkets);
2793
+ }
2796
2794
  //
2797
2795
  // spot / margin
2798
2796
  //
@@ -12181,7 +12179,7 @@ class binance extends binance$1 {
12181
12179
  * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
12182
12180
  * @param {string} symbol unified symbol of the market the order was made in
12183
12181
  * @param {object} [params] extra parameters specific to the exchange API endpoint
12184
- * @returns {object} struct of marginMode
12182
+ * @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
12185
12183
  */
12186
12184
  await this.loadMarkets();
12187
12185
  let market = undefined;
@@ -435,7 +435,7 @@ class bingx extends bingx$1 {
435
435
  // }
436
436
  // }
437
437
  //
438
- const data = this.safeValue(response, 'data');
438
+ const data = this.safeDict(response, 'data');
439
439
  return this.safeInteger(data, 'serverTime');
440
440
  }
441
441
  async fetchCurrencies(params = {}) {
@@ -490,14 +490,14 @@ class bingx extends bingx$1 {
490
490
  // ],
491
491
  // }
492
492
  //
493
- const data = this.safeValue(response, 'data', []);
493
+ const data = this.safeList(response, 'data', []);
494
494
  const result = {};
495
495
  for (let i = 0; i < data.length; i++) {
496
496
  const entry = data[i];
497
497
  const currencyId = this.safeString(entry, 'coin');
498
498
  const code = this.safeCurrencyCode(currencyId);
499
499
  const name = this.safeString(entry, 'name');
500
- const networkList = this.safeValue(entry, 'networkList');
500
+ const networkList = this.safeList(entry, 'networkList');
501
501
  const networks = {};
502
502
  let fee = undefined;
503
503
  let active = undefined;
@@ -507,8 +507,8 @@ class bingx extends bingx$1 {
507
507
  const rawNetwork = networkList[j];
508
508
  const network = this.safeString(rawNetwork, 'network');
509
509
  const networkCode = this.networkIdToCode(network);
510
- const isDefault = this.safeValue(rawNetwork, 'isDefault');
511
- withdrawEnabled = this.safeValue(rawNetwork, 'withdrawEnable');
510
+ const isDefault = this.safeBool(rawNetwork, 'isDefault');
511
+ withdrawEnabled = this.safeBool(rawNetwork, 'withdrawEnable');
512
512
  const limits = {
513
513
  'amounts': { 'min': this.safeNumber(rawNetwork, 'withdrawMin'), 'max': this.safeNumber(rawNetwork, 'withdrawMax') },
514
514
  };
@@ -569,8 +569,8 @@ class bingx extends bingx$1 {
569
569
  // }
570
570
  // }
571
571
  //
572
- const data = this.safeValue(response, 'data');
573
- const markets = this.safeValue(data, 'symbols', []);
572
+ const data = this.safeDict(response, 'data');
573
+ const markets = this.safeList(data, 'symbols', []);
574
574
  return this.parseMarkets(markets);
575
575
  }
576
576
  async fetchSwapMarkets(params) {
@@ -598,7 +598,7 @@ class bingx extends bingx$1 {
598
598
  // ]
599
599
  // }
600
600
  //
601
- const markets = this.safeValue(response, 'data', []);
601
+ const markets = this.safeList(response, 'data', []);
602
602
  return this.parseMarkets(markets);
603
603
  }
604
604
  parseMarket(market) {
@@ -625,7 +625,7 @@ class bingx extends bingx$1 {
625
625
  if (settle !== undefined) {
626
626
  symbol += ':' + settle;
627
627
  }
628
- const fees = this.safeValue(this.fees, type, {});
628
+ const fees = this.safeDict(this.fees, type, {});
629
629
  const contractSize = this.safeNumber(market, 'size');
630
630
  const isActive = this.safeString(market, 'status') === '1';
631
631
  const isInverse = (spot) ? undefined : false;
@@ -699,8 +699,8 @@ class bingx extends bingx$1 {
699
699
  requests.push(this.fetchSpotMarkets(params)); // sandbox is swap only
700
700
  }
701
701
  const promises = await Promise.all(requests);
702
- const spotMarkets = this.safeValue(promises, 0, []);
703
- const swapMarkets = this.safeValue(promises, 1, []);
702
+ const spotMarkets = this.safeList(promises, 0, []);
703
+ const swapMarkets = this.safeList(promises, 1, []);
704
704
  return this.arrayConcat(spotMarkets, swapMarkets);
705
705
  }
706
706
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -914,7 +914,7 @@ class bingx extends bingx$1 {
914
914
  // ]
915
915
  // }
916
916
  //
917
- const trades = this.safeValue(response, 'data', []);
917
+ const trades = this.safeList(response, 'data', []);
918
918
  return this.parseTrades(trades, market, since, limit);
919
919
  }
920
920
  parseTrade(trade, market = undefined) {
@@ -1010,9 +1010,9 @@ class bingx extends bingx$1 {
1010
1010
  const type = (cost === undefined) ? 'spot' : 'swap';
1011
1011
  const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
1012
1012
  const currencyCode = this.safeCurrencyCode(currencyId);
1013
- const m = this.safeValue(trade, 'm');
1013
+ const m = this.safeBool(trade, 'm');
1014
1014
  const marketId = this.safeString(trade, 's');
1015
- const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
1015
+ const isBuyerMaker = this.safeBool2(trade, 'buyerMaker', 'isBuyerMaker');
1016
1016
  let takeOrMaker = undefined;
1017
1017
  if ((isBuyerMaker !== undefined) || (m !== undefined)) {
1018
1018
  takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
@@ -1024,11 +1024,11 @@ class bingx extends bingx$1 {
1024
1024
  takeOrMaker = 'taker';
1025
1025
  }
1026
1026
  }
1027
- const isBuyer = this.safeValue(trade, 'isBuyer');
1027
+ const isBuyer = this.safeBool(trade, 'isBuyer');
1028
1028
  if (isBuyer !== undefined) {
1029
1029
  side = isBuyer ? 'buy' : 'sell';
1030
1030
  }
1031
- const isMaker = this.safeValue(trade, 'isMaker');
1031
+ const isMaker = this.safeBool(trade, 'isMaker');
1032
1032
  if (isMaker !== undefined) {
1033
1033
  takeOrMaker = isMaker ? 'maker' : 'taker';
1034
1034
  }
@@ -1138,7 +1138,7 @@ class bingx extends bingx$1 {
1138
1138
  // ]}
1139
1139
  // }
1140
1140
  //
1141
- const orderbook = this.safeValue(response, 'data', {});
1141
+ const orderbook = this.safeDict(response, 'data', {});
1142
1142
  const timestamp = this.safeInteger2(orderbook, 'T', 'ts');
1143
1143
  return this.parseOrderBook(orderbook, market['symbol'], timestamp, 'bids', 'asks', 0, 1);
1144
1144
  }
@@ -1174,7 +1174,7 @@ class bingx extends bingx$1 {
1174
1174
  // ]
1175
1175
  // }
1176
1176
  //
1177
- const data = this.safeValue(response, 'data', {});
1177
+ const data = this.safeList(response, 'data', []);
1178
1178
  return this.parseFundingRate(data, market);
1179
1179
  }
1180
1180
  async fetchFundingRates(symbols = undefined, params = {}) {
@@ -1190,7 +1190,7 @@ class bingx extends bingx$1 {
1190
1190
  await this.loadMarkets();
1191
1191
  symbols = this.marketSymbols(symbols, 'swap', true);
1192
1192
  const response = await this.swapV2PublicGetQuotePremiumIndex(this.extend(params));
1193
- const data = this.safeValue(response, 'data', []);
1193
+ const data = this.safeList(response, 'data', []);
1194
1194
  const filteredResponse = [];
1195
1195
  for (let i = 0; i < data.length; i++) {
1196
1196
  const item = data[i];
@@ -1287,7 +1287,7 @@ class bingx extends bingx$1 {
1287
1287
  // ]
1288
1288
  // }
1289
1289
  //
1290
- const data = this.safeValue(response, 'data', []);
1290
+ const data = this.safeList(response, 'data', []);
1291
1291
  const rates = [];
1292
1292
  for (let i = 0; i < data.length; i++) {
1293
1293
  const entry = data[i];
@@ -1332,7 +1332,7 @@ class bingx extends bingx$1 {
1332
1332
  // }
1333
1333
  // }
1334
1334
  //
1335
- const data = this.safeValue(response, 'data', {});
1335
+ const data = this.safeDict(response, 'data', {});
1336
1336
  return this.parseOpenInterest(data, market);
1337
1337
  }
1338
1338
  parseOpenInterest(interest, market = undefined) {
@@ -1666,7 +1666,7 @@ class bingx extends bingx$1 {
1666
1666
  // ]
1667
1667
  // }
1668
1668
  //
1669
- const positions = this.safeValue(response, 'data', []);
1669
+ const positions = this.safeList(response, 'data', []);
1670
1670
  return this.parsePositions(positions, symbols);
1671
1671
  }
1672
1672
  parsePosition(position, market = undefined) {
@@ -1701,7 +1701,7 @@ class bingx extends bingx$1 {
1701
1701
  //
1702
1702
  let marketId = this.safeString(position, 'symbol', '');
1703
1703
  marketId = marketId.replace('/', '-'); // standard return different format
1704
- const isolated = this.safeValue(position, 'isolated');
1704
+ const isolated = this.safeBool(position, 'isolated');
1705
1705
  let marginMode = undefined;
1706
1706
  if (isolated !== undefined) {
1707
1707
  marginMode = isolated ? 'isolated' : 'cross';
@@ -2086,7 +2086,7 @@ class bingx extends bingx$1 {
2086
2086
  const side = this.safeString(rawOrder, 'side');
2087
2087
  const amount = this.safeNumber(rawOrder, 'amount');
2088
2088
  const price = this.safeNumber(rawOrder, 'price');
2089
- const orderParams = this.safeValue(rawOrder, 'params', {});
2089
+ const orderParams = this.safeDict(rawOrder, 'params', {});
2090
2090
  const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
2091
2091
  ordersRequests.push(orderRequest);
2092
2092
  }
@@ -2146,8 +2146,8 @@ class bingx extends bingx$1 {
2146
2146
  // }
2147
2147
  // }
2148
2148
  //
2149
- const data = this.safeValue(response, 'data', {});
2150
- const result = this.safeValue(data, 'orders', []);
2149
+ const data = this.safeDict(response, 'data', {});
2150
+ const result = this.safeList(data, 'orders', []);
2151
2151
  return this.parseOrders(result, market);
2152
2152
  }
2153
2153
  parseOrderSide(side) {
@@ -2880,8 +2880,8 @@ class bingx extends bingx$1 {
2880
2880
  // }
2881
2881
  // }
2882
2882
  //
2883
- const data = this.safeValue(response, 'data', []);
2884
- const orders = this.safeValue(data, 'orders', []);
2883
+ const data = this.safeDict(response, 'data', {});
2884
+ const orders = this.safeList(data, 'orders', []);
2885
2885
  return this.parseOrders(orders, market, since, limit);
2886
2886
  }
2887
2887
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2995,7 +2995,7 @@ class bingx extends bingx$1 {
2995
2995
  */
2996
2996
  await this.loadMarkets();
2997
2997
  const currency = this.currency(code);
2998
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
2998
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
2999
2999
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
3000
3000
  const toId = this.safeString(accountsByType, toAccount, toAccount);
3001
3001
  const request = {
@@ -3038,7 +3038,7 @@ class bingx extends bingx$1 {
3038
3038
  if (code !== undefined) {
3039
3039
  currency = this.currency(code);
3040
3040
  }
3041
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
3041
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
3042
3042
  const fromAccount = this.safeString(params, 'fromAccount');
3043
3043
  const toAccount = this.safeString(params, 'toAccount');
3044
3044
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
@@ -3071,7 +3071,7 @@ class bingx extends bingx$1 {
3071
3071
  // ]
3072
3072
  // }
3073
3073
  //
3074
- const rows = this.safeValue(response, 'rows', []);
3074
+ const rows = this.safeList(response, 'rows', []);
3075
3075
  return this.parseTransfers(rows, currency, since, limit);
3076
3076
  }
3077
3077
  parseTransfer(transfer, currency = undefined) {
@@ -3079,7 +3079,7 @@ class bingx extends bingx$1 {
3079
3079
  const timestamp = this.safeInteger(transfer, 'timestamp');
3080
3080
  const currencyCode = this.safeCurrencyCode(undefined, currency);
3081
3081
  const status = this.safeString(transfer, 'status');
3082
- const accountsById = this.safeValue(this.options, 'accountsById', {});
3082
+ const accountsById = this.safeDict(this.options, 'accountsById', {});
3083
3083
  const typeId = this.safeString(transfer, 'type');
3084
3084
  const typeIdSplit = typeId.split('_');
3085
3085
  const fromId = this.safeString(typeIdSplit, 0);
@@ -3137,7 +3137,7 @@ class bingx extends bingx$1 {
3137
3137
  // }
3138
3138
  // }
3139
3139
  //
3140
- const data = this.safeValue(this.safeValue(response, 'data'), 'data');
3140
+ const data = this.safeList(this.safeDict(response, 'data'), 'data');
3141
3141
  const parsed = this.parseDepositAddresses(data, [currency['code']], false);
3142
3142
  return this.indexBy(parsed, 'network');
3143
3143
  }
@@ -3590,8 +3590,8 @@ class bingx extends bingx$1 {
3590
3590
  let fills = undefined;
3591
3591
  if (market['spot']) {
3592
3592
  response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
3593
- const data = this.safeValue(response, 'data', []);
3594
- fills = this.safeValue(data, 'fills', []);
3593
+ const data = this.safeDict(response, 'data', {});
3594
+ fills = this.safeList(data, 'fills', []);
3595
3595
  //
3596
3596
  // {
3597
3597
  // "code": 0,
@@ -3622,8 +3622,8 @@ class bingx extends bingx$1 {
3622
3622
  params = this.omit(params, 'tradingUnit');
3623
3623
  request['tradingUnit'] = tradingUnit;
3624
3624
  response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
3625
- const data = this.safeValue(response, 'data', []);
3626
- fills = this.safeValue(data, 'fill_orders', []);
3625
+ const data = this.safeDict(response, 'data', {});
3626
+ fills = this.safeList(data, 'fill_orders', []);
3627
3627
  //
3628
3628
  // {
3629
3629
  // "code": "0",
@@ -3676,7 +3676,7 @@ class bingx extends bingx$1 {
3676
3676
  // ]
3677
3677
  // }
3678
3678
  //
3679
- const networkList = this.safeValue(fee, 'networkList', []);
3679
+ const networkList = this.safeList(fee, 'networkList', []);
3680
3680
  const networkListLength = networkList.length;
3681
3681
  const result = {
3682
3682
  'info': fee,
@@ -3694,7 +3694,7 @@ class bingx extends bingx$1 {
3694
3694
  for (let i = 0; i < networkListLength; i++) {
3695
3695
  const network = networkList[i];
3696
3696
  const networkId = this.safeString(network, 'network');
3697
- const isDefault = this.safeValue(network, 'isDefault');
3697
+ const isDefault = this.safeBool(network, 'isDefault');
3698
3698
  const currencyCode = this.safeString(currency, 'code');
3699
3699
  const networkCode = this.networkIdToCode(networkId, currencyCode);
3700
3700
  result['networks'][networkCode] = {
@@ -3849,8 +3849,8 @@ class bingx extends bingx$1 {
3849
3849
  // }
3850
3850
  // }
3851
3851
  //
3852
- const data = this.safeValue(response, 'data', {});
3853
- const liquidations = this.safeValue(data, 'orders', []);
3852
+ const data = this.safeDict(response, 'data', {});
3853
+ const liquidations = this.safeList(data, 'orders', []);
3854
3854
  return this.parseLiquidations(liquidations, market, since, limit);
3855
3855
  }
3856
3856
  parseLiquidation(liquidation, market = undefined) {
@@ -3923,7 +3923,7 @@ class bingx extends bingx$1 {
3923
3923
  // }
3924
3924
  // }
3925
3925
  //
3926
- const data = this.safeValue(response, 'data');
3926
+ const data = this.safeDict(response, 'data');
3927
3927
  return this.parseOrder(data);
3928
3928
  }
3929
3929
  async closeAllPositions(params = {}) {
@@ -3961,8 +3961,8 @@ class bingx extends bingx$1 {
3961
3961
  // }
3962
3962
  // }
3963
3963
  //
3964
- const data = this.safeValue(response, 'data', {});
3965
- const success = this.safeValue(data, 'success', []);
3964
+ const data = this.safeDict(response, 'data', {});
3965
+ const success = this.safeList(data, 'success', []);
3966
3966
  const positions = [];
3967
3967
  for (let i = 0; i < success.length; i++) {
3968
3968
  const position = this.parsePosition({ 'positionId': success[i] });
@@ -4175,7 +4175,7 @@ class bingx extends bingx$1 {
4175
4175
  * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
4176
4176
  * @param {string} symbol unified symbol of the market to fetch the margin mode for
4177
4177
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4178
- * @returns {object} Struct of MarginMode
4178
+ * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
4179
4179
  */
4180
4180
  await this.loadMarkets();
4181
4181
  const market = this.market(symbol);
@@ -84,7 +84,7 @@ class bitget extends bitget$1 {
84
84
  'fetchLeverage': true,
85
85
  'fetchLeverageTiers': false,
86
86
  'fetchLiquidations': false,
87
- 'fetchMarginMode': false,
87
+ 'fetchMarginMode': true,
88
88
  'fetchMarketLeverageTiers': true,
89
89
  'fetchMarkets': true,
90
90
  'fetchMarkOHLCV': true,
@@ -8304,6 +8304,74 @@ class bitget extends bitget$1 {
8304
8304
  const orderInfo = this.safeValue(data, 'successList', []);
8305
8305
  return this.parsePositions(orderInfo, undefined, params);
8306
8306
  }
8307
+ async fetchMarginMode(symbol, params = {}) {
8308
+ /**
8309
+ * @method
8310
+ * @name bitget#fetchMarginMode
8311
+ * @description fetches the margin mode of a trading pair
8312
+ * @see https://www.bitget.com/api-doc/contract/account/Get-Single-Account
8313
+ * @param {string} symbol unified symbol of the market to fetch the margin mode for
8314
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8315
+ * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
8316
+ */
8317
+ await this.loadMarkets();
8318
+ const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
8319
+ let market = undefined;
8320
+ if (sandboxMode) {
8321
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
8322
+ market = this.market(sandboxSymbol);
8323
+ }
8324
+ else {
8325
+ market = this.market(symbol);
8326
+ }
8327
+ let productType = undefined;
8328
+ [productType, params] = this.handleProductTypeAndParams(market, params);
8329
+ const request = {
8330
+ 'symbol': market['id'],
8331
+ 'marginCoin': market['settleId'],
8332
+ 'productType': productType,
8333
+ };
8334
+ const response = await this.privateMixGetV2MixAccountAccount(this.extend(request, params));
8335
+ //
8336
+ // {
8337
+ // "code": "00000",
8338
+ // "msg": "success",
8339
+ // "requestTime": 1709791216652,
8340
+ // "data": {
8341
+ // "marginCoin": "USDT",
8342
+ // "locked": "0",
8343
+ // "available": "19.88811074",
8344
+ // "crossedMaxAvailable": "19.88811074",
8345
+ // "isolatedMaxAvailable": "19.88811074",
8346
+ // "maxTransferOut": "19.88811074",
8347
+ // "accountEquity": "19.88811074",
8348
+ // "usdtEquity": "19.888110749166",
8349
+ // "btcEquity": "0.000302183391",
8350
+ // "crossedRiskRate": "0",
8351
+ // "crossedMarginLeverage": 20,
8352
+ // "isolatedLongLever": 20,
8353
+ // "isolatedShortLever": 20,
8354
+ // "marginMode": "crossed",
8355
+ // "posMode": "hedge_mode",
8356
+ // "unrealizedPL": "0",
8357
+ // "coupon": "0",
8358
+ // "crossedUnrealizedPL": "0",
8359
+ // "isolatedUnrealizedPL": ""
8360
+ // }
8361
+ // }
8362
+ //
8363
+ const data = this.safeDict(response, 'data', {});
8364
+ return this.parseMarginMode(data, market);
8365
+ }
8366
+ parseMarginMode(marginMode, market = undefined) {
8367
+ let marginType = this.safeString(marginMode, 'marginMode');
8368
+ marginType = (marginType === 'crossed') ? 'cross' : marginType;
8369
+ return {
8370
+ 'info': marginMode,
8371
+ 'symbol': market['symbol'],
8372
+ 'marginMode': marginType,
8373
+ };
8374
+ }
8307
8375
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
8308
8376
  if (!response) {
8309
8377
  return undefined; // fallback to default error handler
@@ -378,7 +378,7 @@ class blofin extends blofin$1 {
378
378
  const strikePrice = undefined;
379
379
  const optionType = undefined;
380
380
  const tickSize = this.safeString(market, 'tickSize');
381
- const fees = this.safeValue2(this.fees, type, 'trading', {});
381
+ const fees = this.safeDict2(this.fees, type, 'trading', {});
382
382
  const taker = this.safeNumber(fees, 'taker');
383
383
  const maker = this.safeNumber(fees, 'maker');
384
384
  let maxLeverage = this.safeString(market, 'maxLeverage', '100');
@@ -479,7 +479,7 @@ class blofin extends blofin$1 {
479
479
  // }
480
480
  //
481
481
  const data = this.safeList(response, 'data', []);
482
- const first = this.safeValue(data, 0, {});
482
+ const first = this.safeDict(data, 0, {});
483
483
  const timestamp = this.safeInteger(first, 'ts');
484
484
  return this.parseOrderBook(first, symbol, timestamp);
485
485
  }
@@ -535,7 +535,7 @@ class blofin extends blofin$1 {
535
535
  };
536
536
  const response = await this.publicGetMarketTickers(this.extend(request, params));
537
537
  const data = this.safeList(response, 'data', []);
538
- const first = this.safeValue(data, 0, {});
538
+ const first = this.safeDict(data, 0, {});
539
539
  return this.parseTicker(first, market);
540
540
  }
541
541
  async fetchTickers(symbols = undefined, params = {}) {
@@ -995,8 +995,8 @@ class blofin extends blofin$1 {
995
995
  if (postOnly) {
996
996
  request['type'] = 'post_only';
997
997
  }
998
- const stopLoss = this.safeValue(params, 'stopLoss');
999
- const takeProfit = this.safeValue(params, 'takeProfit');
998
+ const stopLoss = this.safeDict(params, 'stopLoss');
999
+ const takeProfit = this.safeDict(params, 'takeProfit');
1000
1000
  params = this.omit(params, ['stopLoss', 'takeProfit']);
1001
1001
  const isStopLoss = stopLoss !== undefined;
1002
1002
  const isTakeProfit = takeProfit !== undefined;
@@ -1289,7 +1289,7 @@ class blofin extends blofin$1 {
1289
1289
  const side = this.safeString(rawOrder, 'side');
1290
1290
  const amount = this.safeValue(rawOrder, 'amount');
1291
1291
  const price = this.safeValue(rawOrder, 'price');
1292
- const orderParams = this.safeValue(rawOrder, 'params', {});
1292
+ const orderParams = this.safeDict(rawOrder, 'params', {});
1293
1293
  const extendedParams = this.extend(orderParams, params); // the request does not accept extra params since it's a list, so we're extending each order with the common params
1294
1294
  const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams);
1295
1295
  ordersRequests.push(orderRequest);
@@ -1328,7 +1328,7 @@ class blofin extends blofin$1 {
1328
1328
  if (limit !== undefined) {
1329
1329
  request['limit'] = limit; // default 100, max 100
1330
1330
  }
1331
- const isStop = this.safeValueN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
1331
+ const isStop = this.safeBoolN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
1332
1332
  let method = undefined;
1333
1333
  [method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'privateGetTradeOrdersPending');
1334
1334
  const query = this.omit(params, ['method', 'stop', 'trigger', 'tpsl', 'TPSL']);
@@ -1656,7 +1656,7 @@ class blofin extends blofin$1 {
1656
1656
  await this.loadMarkets();
1657
1657
  const market = this.market(symbol);
1658
1658
  const request = [];
1659
- const options = this.safeValue(this.options, 'cancelOrders', {});
1659
+ const options = this.safeDict(this.options, 'cancelOrders', {});
1660
1660
  const defaultMethod = this.safeString(options, 'method', 'privatePostTradeCancelBatchOrders');
1661
1661
  let method = this.safeString(params, 'method', defaultMethod);
1662
1662
  const clientOrderIds = this.parseIds(this.safeValue(params, 'clientOrderId'));
@@ -1723,7 +1723,7 @@ class blofin extends blofin$1 {
1723
1723
  */
1724
1724
  await this.loadMarkets();
1725
1725
  const currency = this.currency(code);
1726
- const accountsByType = this.safeValue(this.options, 'accountsByType', {});
1726
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
1727
1727
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
1728
1728
  const toId = this.safeString(accountsByType, toAccount, toAccount);
1729
1729
  const request = {
@@ -2056,7 +2056,7 @@ class blofin extends blofin$1 {
2056
2056
  request['clientOrderId'] = clientOrderId;
2057
2057
  }
2058
2058
  const response = await this.privatePostTradeClosePosition(this.extend(request, params));
2059
- return this.safeValue(response, 'data');
2059
+ return this.safeDict(response, 'data');
2060
2060
  }
2061
2061
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2062
2062
  /**
@@ -2091,7 +2091,7 @@ class blofin extends blofin$1 {
2091
2091
  if (since !== undefined) {
2092
2092
  request['begin'] = since;
2093
2093
  }
2094
- const isStop = this.safeValueN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
2094
+ const isStop = this.safeBoolN(params, ['stop', 'trigger', 'tpsl', 'TPSL'], false);
2095
2095
  let method = undefined;
2096
2096
  [method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'privateGetTradeOrdersHistory');
2097
2097
  const query = this.omit(params, ['method', 'stop', 'trigger', 'tpsl', 'TPSL']);