ccxt 4.3.12 → 4.3.14

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/js/src/bybit.js CHANGED
@@ -325,6 +325,7 @@ export default class bybit extends Exchange {
325
325
  'v5/account/fee-rate': 10,
326
326
  'v5/account/info': 5,
327
327
  'v5/account/transaction-log': 1,
328
+ 'v5/account/contract-transaction-log': 1,
328
329
  'v5/account/smp-group': 1,
329
330
  'v5/account/mmp-state': 5,
330
331
  // asset
@@ -1106,7 +1107,7 @@ export default class bybit extends Exchange {
1106
1107
  return this.milliseconds() - this.options['timeDifference'];
1107
1108
  }
1108
1109
  addPaginationCursorToResult(response) {
1109
- const result = this.safeValue(response, 'result', {});
1110
+ const result = this.safeDict(response, 'result', {});
1110
1111
  const data = this.safeValueN(result, ['list', 'rows', 'data', 'dataList'], []);
1111
1112
  const paginationCursor = this.safeString2(result, 'nextPageCursor', 'cursor');
1112
1113
  const dataLength = data.length;
@@ -1126,8 +1127,8 @@ export default class bybit extends Exchange {
1126
1127
  // The API key of user id must own one of permissions will be allowed to call following API endpoints.
1127
1128
  // SUB UID: "Account Transfer"
1128
1129
  // MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
1129
- const enableUnifiedMargin = this.safeValue(this.options, 'enableUnifiedMargin');
1130
- const enableUnifiedAccount = this.safeValue(this.options, 'enableUnifiedAccount');
1130
+ const enableUnifiedMargin = this.safeBool(this.options, 'enableUnifiedMargin');
1131
+ const enableUnifiedAccount = this.safeBool(this.options, 'enableUnifiedAccount');
1131
1132
  if (enableUnifiedMargin === undefined || enableUnifiedAccount === undefined) {
1132
1133
  if (this.options['enableDemoTrading']) {
1133
1134
  // info endpoint is not available in demo trading
@@ -1177,7 +1178,7 @@ export default class bybit extends Exchange {
1177
1178
  // "time": 1676891757649
1178
1179
  // }
1179
1180
  //
1180
- const result = this.safeValue(response, 'result', {});
1181
+ const result = this.safeDict(response, 'result', {});
1181
1182
  this.options['enableUnifiedMargin'] = this.safeInteger(result, 'unified') === 1;
1182
1183
  this.options['enableUnifiedAccount'] = this.safeInteger(result, 'uta') === 1;
1183
1184
  }
@@ -1339,15 +1340,15 @@ export default class bybit extends Exchange {
1339
1340
  // "time": 1672194582264
1340
1341
  // }
1341
1342
  //
1342
- const data = this.safeValue(response, 'result', []);
1343
- const rows = this.safeValue(data, 'rows', []);
1343
+ const data = this.safeDict(response, 'result', {});
1344
+ const rows = this.safeList(data, 'rows', []);
1344
1345
  const result = {};
1345
1346
  for (let i = 0; i < rows.length; i++) {
1346
1347
  const currency = rows[i];
1347
1348
  const currencyId = this.safeString(currency, 'coin');
1348
1349
  const code = this.safeCurrencyCode(currencyId);
1349
1350
  const name = this.safeString(currency, 'name');
1350
- const chains = this.safeValue(currency, 'chains', []);
1351
+ const chains = this.safeList(currency, 'chains', []);
1351
1352
  const networks = {};
1352
1353
  let minPrecision = undefined;
1353
1354
  let minWithdrawFeeString = undefined;
@@ -1440,7 +1441,7 @@ export default class bybit extends Exchange {
1440
1441
  await this.loadTimeDifference();
1441
1442
  }
1442
1443
  const promisesUnresolved = [];
1443
- const fetchMarkets = this.safeValue(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
1444
+ const fetchMarkets = this.safeList(this.options, 'fetchMarkets', ['spot', 'linear', 'inverse']);
1444
1445
  for (let i = 0; i < fetchMarkets.length; i++) {
1445
1446
  const marketType = fetchMarkets[i];
1446
1447
  if (marketType === 'spot') {
@@ -1462,12 +1463,12 @@ export default class bybit extends Exchange {
1462
1463
  }
1463
1464
  }
1464
1465
  const promises = await Promise.all(promisesUnresolved);
1465
- const spotMarkets = this.safeValue(promises, 0, []);
1466
- const linearMarkets = this.safeValue(promises, 1, []);
1467
- const inverseMarkets = this.safeValue(promises, 2, []);
1468
- const btcOptionMarkets = this.safeValue(promises, 3, []);
1469
- const ethOptionMarkets = this.safeValue(promises, 4, []);
1470
- const solOptionMarkets = this.safeValue(promises, 5, []);
1466
+ const spotMarkets = this.safeList(promises, 0, []);
1467
+ const linearMarkets = this.safeList(promises, 1, []);
1468
+ const inverseMarkets = this.safeList(promises, 2, []);
1469
+ const btcOptionMarkets = this.safeList(promises, 3, []);
1470
+ const ethOptionMarkets = this.safeList(promises, 4, []);
1471
+ const solOptionMarkets = this.safeList(promises, 5, []);
1471
1472
  const futureMarkets = this.arrayConcat(linearMarkets, inverseMarkets);
1472
1473
  let optionMarkets = this.arrayConcat(btcOptionMarkets, ethOptionMarkets);
1473
1474
  optionMarkets = this.arrayConcat(optionMarkets, solOptionMarkets);
@@ -1510,8 +1511,8 @@ export default class bybit extends Exchange {
1510
1511
  // "time": 1672712468011
1511
1512
  // }
1512
1513
  //
1513
- const responseResult = this.safeValue(response, 'result', {});
1514
- const markets = this.safeValue(responseResult, 'list', []);
1514
+ const responseResult = this.safeDict(response, 'result', {});
1515
+ const markets = this.safeList(responseResult, 'list', []);
1515
1516
  const result = [];
1516
1517
  const takerFee = this.parseNumber('0.001');
1517
1518
  const makerFee = this.parseNumber('0.001');
@@ -1525,8 +1526,8 @@ export default class bybit extends Exchange {
1525
1526
  const symbol = base + '/' + quote;
1526
1527
  const status = this.safeString(market, 'status');
1527
1528
  const active = (status === 'Trading');
1528
- const lotSizeFilter = this.safeValue(market, 'lotSizeFilter');
1529
- const priceFilter = this.safeValue(market, 'priceFilter');
1529
+ const lotSizeFilter = this.safeDict(market, 'lotSizeFilter');
1530
+ const priceFilter = this.safeDict(market, 'priceFilter');
1530
1531
  const quotePrecision = this.safeNumber(lotSizeFilter, 'quotePrecision');
1531
1532
  result.push({
1532
1533
  'id': id,
@@ -1586,15 +1587,15 @@ export default class bybit extends Exchange {
1586
1587
  params = this.extend(params);
1587
1588
  params['limit'] = 1000; // minimize number of requests
1588
1589
  const response = await this.publicGetV5MarketInstrumentsInfo(params);
1589
- const data = this.safeValue(response, 'result', {});
1590
- let markets = this.safeValue(data, 'list', []);
1590
+ const data = this.safeDict(response, 'result', {});
1591
+ let markets = this.safeList(data, 'list', []);
1591
1592
  let paginationCursor = this.safeString(data, 'nextPageCursor');
1592
1593
  if (paginationCursor !== undefined) {
1593
1594
  while (paginationCursor !== undefined) {
1594
1595
  params['cursor'] = paginationCursor;
1595
1596
  const responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1596
- const dataNew = this.safeValue(responseInner, 'result', {});
1597
- const rawMarkets = this.safeValue(dataNew, 'list', []);
1597
+ const dataNew = this.safeDict(responseInner, 'result', {});
1598
+ const rawMarkets = this.safeList(dataNew, 'list', []);
1598
1599
  const rawMarketsLength = rawMarkets.length;
1599
1600
  if (rawMarketsLength === 0) {
1600
1601
  break;
@@ -1676,9 +1677,9 @@ export default class bybit extends Exchange {
1676
1677
  settle = this.safeCurrencyCode(settleId);
1677
1678
  }
1678
1679
  let symbol = base + '/' + quote;
1679
- const lotSizeFilter = this.safeValue(market, 'lotSizeFilter', {});
1680
- const priceFilter = this.safeValue(market, 'priceFilter', {});
1681
- const leverage = this.safeValue(market, 'leverageFilter', {});
1680
+ const lotSizeFilter = this.safeDict(market, 'lotSizeFilter', {});
1681
+ const priceFilter = this.safeDict(market, 'priceFilter', {});
1682
+ const leverage = this.safeDict(market, 'leverageFilter', {});
1682
1683
  const status = this.safeString(market, 'status');
1683
1684
  const swap = linearPerpetual || inversePerpetual;
1684
1685
  const future = inverseFutures || linearFutures;
@@ -1762,8 +1763,8 @@ export default class bybit extends Exchange {
1762
1763
  'category': 'option',
1763
1764
  };
1764
1765
  const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1765
- const data = this.safeValue(response, 'result', {});
1766
- let markets = this.safeValue(data, 'list', []);
1766
+ const data = this.safeDict(response, 'result', {});
1767
+ let markets = this.safeList(data, 'list', []);
1767
1768
  if (this.options['loadAllOptions']) {
1768
1769
  request['limit'] = 1000;
1769
1770
  let paginationCursor = this.safeString(data, 'nextPageCursor');
@@ -1771,8 +1772,8 @@ export default class bybit extends Exchange {
1771
1772
  while (paginationCursor !== undefined) {
1772
1773
  request['cursor'] = paginationCursor;
1773
1774
  const responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1774
- const dataNew = this.safeValue(responseInner, 'result', {});
1775
- const rawMarkets = this.safeValue(dataNew, 'list', []);
1775
+ const dataNew = this.safeDict(responseInner, 'result', {});
1776
+ const rawMarkets = this.safeList(dataNew, 'list', []);
1776
1777
  const rawMarketsLength = rawMarkets.length;
1777
1778
  if (rawMarketsLength === 0) {
1778
1779
  break;
@@ -1827,8 +1828,8 @@ export default class bybit extends Exchange {
1827
1828
  const base = this.safeCurrencyCode(baseId);
1828
1829
  const quote = this.safeCurrencyCode(quoteId);
1829
1830
  const settle = this.safeCurrencyCode(settleId);
1830
- const lotSizeFilter = this.safeValue(market, 'lotSizeFilter', {});
1831
- const priceFilter = this.safeValue(market, 'priceFilter', {});
1831
+ const lotSizeFilter = this.safeDict(market, 'lotSizeFilter', {});
1832
+ const priceFilter = this.safeDict(market, 'priceFilter', {});
1832
1833
  const status = this.safeString(market, 'status');
1833
1834
  const expiry = this.safeInteger(market, 'deliveryTime');
1834
1835
  const splitId = id.split('-');
@@ -2081,8 +2082,8 @@ export default class bybit extends Exchange {
2081
2082
  // "time": 1672376496682
2082
2083
  // }
2083
2084
  //
2084
- const result = this.safeValue(response, 'result', []);
2085
- const tickers = this.safeValue(result, 'list', []);
2085
+ const result = this.safeDict(response, 'result', {});
2086
+ const tickers = this.safeList(result, 'list', []);
2086
2087
  const rawTicker = this.safeDict(tickers, 0);
2087
2088
  return this.parseTicker(rawTicker, market);
2088
2089
  }
@@ -2188,7 +2189,7 @@ export default class bybit extends Exchange {
2188
2189
  // "time": 1672376496682
2189
2190
  // }
2190
2191
  //
2191
- const result = this.safeValue(response, 'result', {});
2192
+ const result = this.safeDict(response, 'result', {});
2192
2193
  const tickerList = this.safeList(result, 'list', []);
2193
2194
  return this.parseTickers(tickerList, parsedSymbols);
2194
2195
  }
@@ -2327,7 +2328,7 @@ export default class bybit extends Exchange {
2327
2328
  // "time": 1672025956592
2328
2329
  // }
2329
2330
  //
2330
- const result = this.safeValue(response, 'result', {});
2331
+ const result = this.safeDict(response, 'result', {});
2331
2332
  const ohlcvs = this.safeList(result, 'list', []);
2332
2333
  return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
2333
2334
  }
@@ -2543,8 +2544,8 @@ export default class bybit extends Exchange {
2543
2544
  // }
2544
2545
  //
2545
2546
  const rates = [];
2546
- const result = this.safeValue(response, 'result');
2547
- const resultList = this.safeValue(result, 'list');
2547
+ const result = this.safeDict(response, 'result');
2548
+ const resultList = this.safeList(result, 'list');
2548
2549
  for (let i = 0; i < resultList.length; i++) {
2549
2550
  const entry = resultList[i];
2550
2551
  const timestamp = this.safeInteger(entry, 'fundingRateTimestamp');
@@ -2678,7 +2679,7 @@ export default class bybit extends Exchange {
2678
2679
  side = isBuyer ? 'buy' : 'sell';
2679
2680
  }
2680
2681
  }
2681
- const isMaker = this.safeValue(trade, 'isMaker');
2682
+ const isMaker = this.safeBool(trade, 'isMaker');
2682
2683
  let takerOrMaker = undefined;
2683
2684
  if (isMaker !== undefined) {
2684
2685
  takerOrMaker = isMaker ? 'maker' : 'taker';
@@ -2804,7 +2805,7 @@ export default class bybit extends Exchange {
2804
2805
  // "time": 1672053054358
2805
2806
  // }
2806
2807
  //
2807
- const result = this.safeValue(response, 'result', {});
2808
+ const result = this.safeDict(response, 'result', {});
2808
2809
  const trades = this.safeList(result, 'list', []);
2809
2810
  return this.parseTrades(trades, market, since, limit);
2810
2811
  }
@@ -2874,7 +2875,7 @@ export default class bybit extends Exchange {
2874
2875
  // "time": 1672765737734
2875
2876
  // }
2876
2877
  //
2877
- const result = this.safeValue(response, 'result', []);
2878
+ const result = this.safeDict(response, 'result', {});
2878
2879
  const timestamp = this.safeInteger(result, 'ts');
2879
2880
  return this.parseOrderBook(result, symbol, timestamp, 'b', 'a');
2880
2881
  }
@@ -2987,7 +2988,7 @@ export default class bybit extends Exchange {
2987
2988
  'timestamp': timestamp,
2988
2989
  'datetime': this.iso8601(timestamp),
2989
2990
  };
2990
- const responseResult = this.safeValue(response, 'result', {});
2991
+ const responseResult = this.safeDict(response, 'result', {});
2991
2992
  const currencyList = this.safeValueN(responseResult, ['loanAccountList', 'list', 'balance']);
2992
2993
  if (currencyList === undefined) {
2993
2994
  // usdc wallet
@@ -3002,7 +3003,7 @@ export default class bybit extends Exchange {
3002
3003
  const entry = currencyList[i];
3003
3004
  const accountType = this.safeString(entry, 'accountType');
3004
3005
  if (accountType === 'UNIFIED' || accountType === 'CONTRACT' || accountType === 'SPOT') {
3005
- const coins = this.safeValue(entry, 'coin');
3006
+ const coins = this.safeList(entry, 'coin');
3006
3007
  for (let j = 0; j < coins.length; j++) {
3007
3008
  const account = this.account();
3008
3009
  const coinEntry = coins[j];
@@ -3067,7 +3068,7 @@ export default class bybit extends Exchange {
3067
3068
  type = 'contract';
3068
3069
  }
3069
3070
  }
3070
- const accountTypes = this.safeValue(this.options, 'accountsByType', {});
3071
+ const accountTypes = this.safeDict(this.options, 'accountsByType', {});
3071
3072
  const unifiedType = this.safeStringUpper(accountTypes, type, type);
3072
3073
  let marginMode = undefined;
3073
3074
  [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
@@ -3395,7 +3396,7 @@ export default class bybit extends Exchange {
3395
3396
  const rawTimeInForce = this.safeString(order, 'timeInForce');
3396
3397
  const timeInForce = this.parseTimeInForce(rawTimeInForce);
3397
3398
  const stopPrice = this.omitZero(this.safeString(order, 'triggerPrice'));
3398
- const reduceOnly = this.safeValue(order, 'reduceOnly');
3399
+ const reduceOnly = this.safeBool(order, 'reduceOnly');
3399
3400
  let takeProfitPrice = this.omitZero(this.safeString(order, 'takeProfit'));
3400
3401
  let stopLossPrice = this.omitZero(this.safeString(order, 'stopLoss'));
3401
3402
  const triggerDirection = this.safeString(order, 'triggerDirection');
@@ -3435,7 +3436,7 @@ export default class bybit extends Exchange {
3435
3436
  'type': type,
3436
3437
  'timeInForce': timeInForce,
3437
3438
  'postOnly': undefined,
3438
- 'reduceOnly': this.safeValue(order, 'reduceOnly'),
3439
+ 'reduceOnly': this.safeBool(order, 'reduceOnly'),
3439
3440
  'side': side,
3440
3441
  'price': price,
3441
3442
  'stopPrice': stopPrice,
@@ -3536,7 +3537,7 @@ export default class bybit extends Exchange {
3536
3537
  const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3537
3538
  const isTrailingAmountOrder = trailingAmount !== undefined;
3538
3539
  const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
3539
- const options = this.safeValue(this.options, 'createOrder', {});
3540
+ const options = this.safeDict(this.options, 'createOrder', {});
3540
3541
  const defaultMethod = this.safeString(options, 'method', 'privatePostV5OrderCreate');
3541
3542
  let response = undefined;
3542
3543
  if (isTrailingAmountOrder || (defaultMethod === 'privatePostV5PositionTradingStop')) {
@@ -3835,10 +3836,10 @@ export default class bybit extends Exchange {
3835
3836
  'request': ordersRequests,
3836
3837
  };
3837
3838
  const response = await this.privatePostV5OrderCreateBatch(this.extend(request, params));
3838
- const result = this.safeValue(response, 'result', {});
3839
- const data = this.safeValue(result, 'list', []);
3840
- const retInfo = this.safeValue(response, 'retExtInfo', {});
3841
- const codes = this.safeValue(retInfo, 'list', []);
3839
+ const result = this.safeDict(response, 'result', {});
3840
+ const data = this.safeList(result, 'list', []);
3841
+ const retInfo = this.safeDict(response, 'retExtInfo', {});
3842
+ const codes = this.safeList(retInfo, 'list', []);
3842
3843
  // extend the error with the unsuccessful orders
3843
3844
  for (let i = 0; i < codes.length; i++) {
3844
3845
  const code = codes[i];
@@ -4032,7 +4033,7 @@ export default class bybit extends Exchange {
4032
4033
  response = await this.privatePostOptionUsdcOpenapiPrivateV1ReplaceOrder(this.extend(request, params));
4033
4034
  }
4034
4035
  else {
4035
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
4036
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
4036
4037
  const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
4037
4038
  const stopLossPrice = this.safeValue(params, 'stopLossPrice');
4038
4039
  const isStopLossOrder = stopLossPrice !== undefined;
@@ -4199,7 +4200,7 @@ export default class bybit extends Exchange {
4199
4200
  // "time": 1672217093461
4200
4201
  // }
4201
4202
  //
4202
- const result = this.safeValue(response, 'result', {});
4203
+ const result = this.safeDict(response, 'result', {});
4203
4204
  return this.safeOrder({
4204
4205
  'info': response,
4205
4206
  'id': this.safeString(result, 'orderId'),
@@ -4216,7 +4217,7 @@ export default class bybit extends Exchange {
4216
4217
  // 'orderLinkId': 'string', // one of order_id, stop_order_id or order_link_id is required
4217
4218
  // 'orderId': id,
4218
4219
  };
4219
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
4220
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
4220
4221
  params = this.omit(params, ['stop', 'trigger']);
4221
4222
  if (id !== undefined) { // The user can also use argument params["order_link_id"]
4222
4223
  request['orderId'] = id;
@@ -4497,7 +4498,7 @@ export default class bybit extends Exchange {
4497
4498
  response = await this.privatePostOptionUsdcOpenapiPrivateV1CancelAll(this.extend(request, params));
4498
4499
  }
4499
4500
  else {
4500
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
4501
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
4501
4502
  if (isStop) {
4502
4503
  request['orderFilter'] = 'StopOrder';
4503
4504
  }
@@ -4571,7 +4572,7 @@ export default class bybit extends Exchange {
4571
4572
  request['settleCoin'] = this.safeString(params, 'settleCoin', defaultSettle);
4572
4573
  }
4573
4574
  }
4574
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
4575
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
4575
4576
  params = this.omit(params, ['stop', 'trigger']);
4576
4577
  if (isStop) {
4577
4578
  request['orderFilter'] = 'StopOrder';
@@ -4605,8 +4606,8 @@ export default class bybit extends Exchange {
4605
4606
  // "time": 1676962409398
4606
4607
  // }
4607
4608
  //
4608
- const result = this.safeValue(response, 'result', []);
4609
- const orders = this.safeValue(result, 'list');
4609
+ const result = this.safeDict(response, 'result', {});
4610
+ const orders = this.safeList(result, 'list');
4610
4611
  if (!Array.isArray(orders)) {
4611
4612
  return response;
4612
4613
  }
@@ -4639,7 +4640,7 @@ export default class bybit extends Exchange {
4639
4640
  else {
4640
4641
  request['category'] = 'OPTION';
4641
4642
  }
4642
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
4643
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
4643
4644
  params = this.omit(params, ['stop', 'trigger']);
4644
4645
  if (isStop) {
4645
4646
  request['orderFilter'] = 'StopOrder';
@@ -4695,7 +4696,7 @@ export default class bybit extends Exchange {
4695
4696
  // "retMsg": "Success."
4696
4697
  // }
4697
4698
  //
4698
- const result = this.safeValue(response, 'result', {});
4699
+ const result = this.safeDict(response, 'result', {});
4699
4700
  const data = this.safeList(result, 'dataList', []);
4700
4701
  return this.parseOrders(data, market, since, limit);
4701
4702
  }
@@ -5123,8 +5124,8 @@ export default class bybit extends Exchange {
5123
5124
  [type, params] = this.handleMarketTypeAndParams('fetchUsdcOpenOrders', market, params);
5124
5125
  request['category'] = (type === 'swap') ? 'perpetual' : 'option';
5125
5126
  const response = await this.privatePostOptionUsdcOpenapiPrivateV1QueryActiveOrders(this.extend(request, params));
5126
- const result = this.safeValue(response, 'result', {});
5127
- const orders = this.safeValue(result, 'dataList', []);
5127
+ const result = this.safeDict(response, 'result', {});
5128
+ const orders = this.safeList(result, 'dataList', []);
5128
5129
  //
5129
5130
  // {
5130
5131
  // "retCode": 0,
@@ -5197,7 +5198,7 @@ export default class bybit extends Exchange {
5197
5198
  return await this.fetchUsdcOpenOrders(symbol, since, limit, params);
5198
5199
  }
5199
5200
  request['category'] = type;
5200
- const isStop = this.safeValue2(params, 'stop', 'trigger', false);
5201
+ const isStop = this.safeBool2(params, 'stop', 'trigger', false);
5201
5202
  params = this.omit(params, ['stop', 'trigger']);
5202
5203
  if (isStop) {
5203
5204
  request['orderFilter'] = 'StopOrder';
@@ -5323,7 +5324,7 @@ export default class bybit extends Exchange {
5323
5324
  // "retMsg": "Success."
5324
5325
  // }
5325
5326
  //
5326
- const result = this.safeValue(response, 'result', {});
5327
+ const result = this.safeDict(response, 'result', {});
5327
5328
  const dataList = this.safeList(result, 'dataList', []);
5328
5329
  return this.parseTrades(dataList, market, since, limit);
5329
5330
  }
@@ -5474,8 +5475,8 @@ export default class bybit extends Exchange {
5474
5475
  // "time": 1672192792860
5475
5476
  // }
5476
5477
  //
5477
- const result = this.safeValue(response, 'result', []);
5478
- const chains = this.safeValue(result, 'chains', []);
5478
+ const result = this.safeDict(response, 'result', {});
5479
+ const chains = this.safeList(result, 'chains', []);
5479
5480
  const coin = this.safeString(result, 'coin');
5480
5481
  currency = this.currency(coin);
5481
5482
  const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
@@ -5523,8 +5524,8 @@ export default class bybit extends Exchange {
5523
5524
  // "time": 1672192792860
5524
5525
  // }
5525
5526
  //
5526
- const result = this.safeValue(response, 'result', {});
5527
- const chains = this.safeValue(result, 'chains', []);
5527
+ const result = this.safeDict(response, 'result', {});
5528
+ const chains = this.safeList(result, 'chains', []);
5528
5529
  const chainsIndexedById = this.indexBy(chains, 'chain');
5529
5530
  const selectedNetworkId = this.selectNetworkIdFromRawNetworks(code, networkCode, chainsIndexedById);
5530
5531
  const addressObject = this.safeDict(chainsIndexedById, selectedNetworkId, {});
@@ -6232,14 +6233,14 @@ export default class bybit extends Exchange {
6232
6233
  // "retMsg": "Success."
6233
6234
  // }
6234
6235
  //
6235
- const result = this.safeValue(response, 'result', {});
6236
- const positions = this.safeValue(result, 'dataList', []);
6236
+ const result = this.safeDict(response, 'result', {});
6237
+ const positions = this.safeList(result, 'dataList', []);
6237
6238
  const results = [];
6238
6239
  for (let i = 0; i < positions.length; i++) {
6239
6240
  let rawPosition = positions[i];
6240
6241
  if (('data' in rawPosition) && ('is_valid' in rawPosition)) {
6241
6242
  // futures only
6242
- rawPosition = this.safeValue(rawPosition, 'data');
6243
+ rawPosition = this.safeDict(rawPosition, 'data');
6243
6244
  }
6244
6245
  results.push(this.parsePosition(rawPosition, market));
6245
6246
  }
@@ -6352,7 +6353,7 @@ export default class bybit extends Exchange {
6352
6353
  let rawPosition = positions[i];
6353
6354
  if (('data' in rawPosition) && ('is_valid' in rawPosition)) {
6354
6355
  // futures only
6355
- rawPosition = this.safeValue(rawPosition, 'data');
6356
+ rawPosition = this.safeDict(rawPosition, 'data');
6356
6357
  }
6357
6358
  results.push(this.parsePosition(rawPosition));
6358
6359
  }
@@ -6839,7 +6840,7 @@ export default class bybit extends Exchange {
6839
6840
  let market = this.market(symbol);
6840
6841
  const subType = market['linear'] ? 'linear' : 'inverse';
6841
6842
  const category = this.safeString(params, 'category', subType);
6842
- const intervals = this.safeValue(this.options, 'intervals');
6843
+ const intervals = this.safeDict(this.options, 'intervals');
6843
6844
  const interval = this.safeString(intervals, timeframe); // 5min,15min,30min,1h,4h,1d
6844
6845
  if (interval === undefined) {
6845
6846
  throw new BadRequest(this.id + ' fetchOpenInterestHistory() cannot use the ' + timeframe + ' timeframe');
@@ -6884,7 +6885,7 @@ export default class bybit extends Exchange {
6884
6885
  // "time": 1672053548579
6885
6886
  // }
6886
6887
  //
6887
- const result = this.safeValue(response, 'result', {});
6888
+ const result = this.safeDict(response, 'result', {});
6888
6889
  const data = this.addPaginationCursorToResult(response);
6889
6890
  const id = this.safeString(result, 'symbol');
6890
6891
  market = this.safeMarket(id, market, undefined, 'contract');
@@ -6908,7 +6909,7 @@ export default class bybit extends Exchange {
6908
6909
  throw new BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
6909
6910
  }
6910
6911
  const timeframe = this.safeString(params, 'interval', '1h');
6911
- const intervals = this.safeValue(this.options, 'intervals');
6912
+ const intervals = this.safeDict(this.options, 'intervals');
6912
6913
  const interval = this.safeString(intervals, timeframe); // 5min,15min,30min,1h,4h,1d
6913
6914
  if (interval === undefined) {
6914
6915
  throw new BadRequest(this.id + ' fetchOpenInterest() cannot use the ' + timeframe + ' timeframe');
@@ -6944,7 +6945,7 @@ export default class bybit extends Exchange {
6944
6945
  // "time": 1672053548579
6945
6946
  // }
6946
6947
  //
6947
- const result = this.safeValue(response, 'result', {});
6948
+ const result = this.safeDict(response, 'result', {});
6948
6949
  const id = this.safeString(result, 'symbol');
6949
6950
  market = this.safeMarket(id, market, undefined, 'contract');
6950
6951
  const data = this.addPaginationCursorToResult(response);
@@ -7034,7 +7035,7 @@ export default class bybit extends Exchange {
7034
7035
  // }
7035
7036
  //
7036
7037
  const timestamp = this.safeInteger(response, 'time');
7037
- const data = this.safeValue(response, 'result', {});
7038
+ const data = this.safeDict(response, 'result', {});
7038
7039
  data['timestamp'] = timestamp;
7039
7040
  return this.parseBorrowRate(data, currency);
7040
7041
  }
@@ -7100,8 +7101,8 @@ export default class bybit extends Exchange {
7100
7101
  // }
7101
7102
  // }
7102
7103
  //
7103
- const data = this.safeValue(response, 'result', {});
7104
- const rows = this.safeValue(data, 'loanAccountList', []);
7104
+ const data = this.safeDict(response, 'result', {});
7105
+ const rows = this.safeList(data, 'loanAccountList', []);
7105
7106
  const interest = this.parseBorrowInterests(rows, undefined);
7106
7107
  return this.filterByCurrencySinceLimit(interest, code, since, limit);
7107
7108
  }
@@ -7144,7 +7145,7 @@ export default class bybit extends Exchange {
7144
7145
  */
7145
7146
  await this.loadMarkets();
7146
7147
  const transferId = this.safeString(params, 'transferId', this.uuid());
7147
- const accountTypes = this.safeValue(this.options, 'accountsByType', {});
7148
+ const accountTypes = this.safeDict(this.options, 'accountsByType', {});
7148
7149
  const fromId = this.safeString(accountTypes, fromAccount, fromAccount);
7149
7150
  const toId = this.safeString(accountTypes, toAccount, toAccount);
7150
7151
  const currency = this.currency(code);
@@ -7169,7 +7170,7 @@ export default class bybit extends Exchange {
7169
7170
  // }
7170
7171
  //
7171
7172
  const timestamp = this.safeInteger(response, 'time');
7172
- const transfer = this.safeValue(response, 'result', {});
7173
+ const transfer = this.safeDict(response, 'result', {});
7173
7174
  const statusRaw = this.safeStringN(response, ['retCode', 'retMsg']);
7174
7175
  const status = this.parseTransferStatus(statusRaw);
7175
7176
  return this.extend(this.parseTransfer(transfer, currency), {
@@ -7269,7 +7270,7 @@ export default class bybit extends Exchange {
7269
7270
  // "time": 1662617848970
7270
7271
  // }
7271
7272
  //
7272
- const result = this.safeValue(response, 'result', {});
7273
+ const result = this.safeDict(response, 'result', {});
7273
7274
  const transaction = this.parseMarginLoan(result, currency);
7274
7275
  return this.extend(transaction, {
7275
7276
  'symbol': undefined,
@@ -7305,7 +7306,7 @@ export default class bybit extends Exchange {
7305
7306
  // "time": 1662618298452
7306
7307
  // }
7307
7308
  //
7308
- const result = this.safeValue(response, 'result', {});
7309
+ const result = this.safeDict(response, 'result', {});
7309
7310
  const transaction = this.parseMarginLoan(result, currency);
7310
7311
  return this.extend(transaction, {
7311
7312
  'symbol': undefined,
@@ -7368,7 +7369,7 @@ export default class bybit extends Exchange {
7368
7369
  const timestamp = this.safeInteger(transfer, 'timestamp');
7369
7370
  const fromAccountId = this.safeString(transfer, 'fromAccountType');
7370
7371
  const toAccountId = this.safeString(transfer, 'toAccountType');
7371
- const accountIds = this.safeValue(this.options, 'accountsById', {});
7372
+ const accountIds = this.safeDict(this.options, 'accountsById', {});
7372
7373
  const fromAccount = this.safeString(accountIds, fromAccountId, fromAccountId);
7373
7374
  const toAccount = this.safeString(accountIds, toAccountId, toAccountId);
7374
7375
  return {
@@ -7419,8 +7420,8 @@ export default class bybit extends Exchange {
7419
7420
  // "time": 1672054488010
7420
7421
  // }
7421
7422
  //
7422
- const result = this.safeValue(response, 'result');
7423
- const tiers = this.safeValue(result, 'list');
7423
+ const result = this.safeDict(response, 'result');
7424
+ const tiers = this.safeList(result, 'list');
7424
7425
  return this.parseMarketLeverageTiers(tiers, market);
7425
7426
  }
7426
7427
  async fetchMarketLeverageTiers(symbol, params = {}) {
@@ -7510,9 +7511,9 @@ export default class bybit extends Exchange {
7510
7511
  // "time": 1676360412576
7511
7512
  // }
7512
7513
  //
7513
- const result = this.safeValue(response, 'result', {});
7514
- const fees = this.safeValue(result, 'list', []);
7515
- const first = this.safeValue(fees, 0, {});
7514
+ const result = this.safeDict(response, 'result', {});
7515
+ const fees = this.safeList(result, 'list', []);
7516
+ const first = this.safeDict(fees, 0, {});
7516
7517
  return this.parseTradingFee(first, market);
7517
7518
  }
7518
7519
  async fetchTradingFees(params = {}) {
@@ -7549,8 +7550,8 @@ export default class bybit extends Exchange {
7549
7550
  // "time": 1676360412576
7550
7551
  // }
7551
7552
  //
7552
- let fees = this.safeValue(response, 'result', {});
7553
- fees = this.safeValue(fees, 'list', []);
7553
+ let fees = this.safeDict(response, 'result', {});
7554
+ fees = this.safeList(fees, 'list', []);
7554
7555
  const result = {};
7555
7556
  for (let i = 0; i < fees.length; i++) {
7556
7557
  const fee = this.parseTradingFee(fees[i]);
@@ -7580,7 +7581,7 @@ export default class bybit extends Exchange {
7580
7581
  // ]
7581
7582
  // }
7582
7583
  //
7583
- const chains = this.safeValue(fee, 'chains', []);
7584
+ const chains = this.safeList(fee, 'chains', []);
7584
7585
  const chainsLength = chains.length;
7585
7586
  const result = {
7586
7587
  'info': fee,
@@ -7655,7 +7656,7 @@ export default class bybit extends Exchange {
7655
7656
  // "time": 1672194582264
7656
7657
  // }
7657
7658
  //
7658
- const data = this.safeValue(response, 'result', {});
7659
+ const data = this.safeDict(response, 'result', {});
7659
7660
  const rows = this.safeList(data, 'rows', []);
7660
7661
  return this.parseDepositWithdrawFees(rows, codes, 'coin');
7661
7662
  }
@@ -7709,8 +7710,8 @@ export default class bybit extends Exchange {
7709
7710
  // "time": 1689043527231
7710
7711
  // }
7711
7712
  //
7712
- const result = this.safeValue(response, 'result', {});
7713
- const data = this.safeValue(result, 'list', []);
7713
+ const result = this.safeDict(response, 'result', {});
7714
+ const data = this.safeList(result, 'list', []);
7714
7715
  const settlements = this.parseSettlements(data, market);
7715
7716
  const sorted = this.sortBy(settlements, 'timestamp');
7716
7717
  return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
@@ -7770,8 +7771,8 @@ export default class bybit extends Exchange {
7770
7771
  // "time": 1689043527231
7771
7772
  // }
7772
7773
  //
7773
- const result = this.safeValue(response, 'result', {});
7774
- const data = this.safeValue(result, 'list', []);
7774
+ const result = this.safeDict(response, 'result', {});
7775
+ const data = this.safeList(result, 'list', []);
7775
7776
  const settlements = this.parseSettlements(data, market);
7776
7777
  const sorted = this.sortBy(settlements, 'timestamp');
7777
7778
  return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
@@ -7874,7 +7875,7 @@ export default class bybit extends Exchange {
7874
7875
  // ]
7875
7876
  // }
7876
7877
  //
7877
- const volatility = this.safeValue(response, 'result', []);
7878
+ const volatility = this.safeList(response, 'result', []);
7878
7879
  return this.parseVolatilityHistory(volatility);
7879
7880
  }
7880
7881
  parseVolatilityHistory(volatility) {
@@ -7956,8 +7957,8 @@ export default class bybit extends Exchange {
7956
7957
  // }
7957
7958
  //
7958
7959
  const timestamp = this.safeInteger(response, 'time');
7959
- const result = this.safeValue(response, 'result', {});
7960
- const data = this.safeValue(result, 'list', []);
7960
+ const result = this.safeDict(response, 'result', {});
7961
+ const data = this.safeList(result, 'list', []);
7961
7962
  const greeks = this.parseGreeks(data[0], market);
7962
7963
  return this.extend(greeks, {
7963
7964
  'timestamp': timestamp,