ccxt 4.2.90 → 4.2.92

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/deribit.js CHANGED
@@ -700,117 +700,130 @@ export default class deribit extends Exchange {
700
700
  * @name deribit#fetchMarkets
701
701
  * @description retrieves data on all markets for deribit
702
702
  * @see https://docs.deribit.com/#public-get_currencies
703
+ * @see https://docs.deribit.com/#public-get_instruments
703
704
  * @param {object} [params] extra parameters specific to the exchange API endpoint
704
705
  * @returns {object[]} an array of objects representing market data
705
706
  */
706
- const currenciesResponse = await this.publicGetGetCurrencies(params);
707
- //
708
- // {
709
- // "jsonrpc": "2.0",
710
- // "result": [
711
- // {
712
- // "withdrawal_priorities": [
713
- // { value: 0.15, name: "very_low" },
714
- // { value: 1.5, name: "very_high" },
715
- // ],
716
- // "withdrawal_fee": 0.0005,
717
- // "min_withdrawal_fee": 0.0005,
718
- // "min_confirmations": 1,
719
- // "fee_precision": 4,
720
- // "currency_long": "Bitcoin",
721
- // "currency": "BTC",
722
- // "coin_type": "BITCOIN"
723
- // }
724
- // ],
725
- // "usIn": 1583761588590479,
726
- // "usOut": 1583761588590544,
727
- // "usDiff": 65,
728
- // "testnet": false
729
- // }
730
- //
731
- const parsedMarkets = {};
732
- const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
707
+ const instrumentsResponses = [];
733
708
  const result = [];
734
- for (let i = 0; i < currenciesResult.length; i++) {
735
- const currencyId = this.safeString(currenciesResult[i], 'currency');
736
- const request = {
737
- 'currency': currencyId,
738
- };
739
- const instrumentsResponse = await this.publicGetGetInstruments(this.extend(request, params));
709
+ const parsedMarkets = {};
710
+ let fetchAllMarkets = undefined;
711
+ [fetchAllMarkets, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'fetchAllMarkets', true);
712
+ if (fetchAllMarkets) {
713
+ const instrumentsResponse = await this.publicGetGetInstruments(params);
714
+ instrumentsResponses.push(instrumentsResponse);
715
+ }
716
+ else {
717
+ const currenciesResponse = await this.publicGetGetCurrencies(params);
740
718
  //
741
719
  // {
742
- // "jsonrpc":"2.0",
743
- // "result":[
720
+ // "jsonrpc": "2.0",
721
+ // "result": [
744
722
  // {
745
- // "tick_size":0.0005,
746
- // "taker_commission":0.0003,
747
- // "strike":52000.0,
748
- // "settlement_period":"month",
749
- // "settlement_currency":"BTC",
750
- // "quote_currency":"BTC",
751
- // "option_type":"put", // put, call
752
- // "min_trade_amount":0.1,
753
- // "maker_commission":0.0003,
754
- // "kind":"option",
755
- // "is_active":true,
756
- // "instrument_name":"BTC-24JUN22-52000-P",
757
- // "expiration_timestamp":1656057600000,
758
- // "creation_timestamp":1648199543000,
759
- // "counter_currency":"USD",
760
- // "contract_size":1.0,
761
- // "block_trade_commission":0.0003,
762
- // "base_currency":"BTC"
763
- // },
764
- // {
765
- // "tick_size":0.5,
766
- // "taker_commission":0.0005,
767
- // "settlement_period":"month", // month, week
768
- // "settlement_currency":"BTC",
769
- // "quote_currency":"USD",
770
- // "min_trade_amount":10.0,
771
- // "max_liquidation_commission":0.0075,
772
- // "max_leverage":50,
773
- // "maker_commission":0.0,
774
- // "kind":"future",
775
- // "is_active":true,
776
- // "instrument_name":"BTC-27MAY22",
777
- // "future_type":"reversed",
778
- // "expiration_timestamp":1653638400000,
779
- // "creation_timestamp":1648195209000,
780
- // "counter_currency":"USD",
781
- // "contract_size":10.0,
782
- // "block_trade_commission":0.0001,
783
- // "base_currency":"BTC"
784
- // },
785
- // {
786
- // "tick_size":0.5,
787
- // "taker_commission":0.0005,
788
- // "settlement_period":"perpetual",
789
- // "settlement_currency":"BTC",
790
- // "quote_currency":"USD",
791
- // "min_trade_amount":10.0,
792
- // "max_liquidation_commission":0.0075,
793
- // "max_leverage":50,
794
- // "maker_commission":0.0,
795
- // "kind":"future",
796
- // "is_active":true,
797
- // "instrument_name":"BTC-PERPETUAL",
798
- // "future_type":"reversed",
799
- // "expiration_timestamp":32503708800000,
800
- // "creation_timestamp":1534242287000,
801
- // "counter_currency":"USD",
802
- // "contract_size":10.0,
803
- // "block_trade_commission":0.0001,
804
- // "base_currency":"BTC"
805
- // },
723
+ // "withdrawal_priorities": [
724
+ // { value: 0.15, name: "very_low" },
725
+ // { value: 1.5, name: "very_high" },
726
+ // ],
727
+ // "withdrawal_fee": 0.0005,
728
+ // "min_withdrawal_fee": 0.0005,
729
+ // "min_confirmations": 1,
730
+ // "fee_precision": 4,
731
+ // "currency_long": "Bitcoin",
732
+ // "currency": "BTC",
733
+ // "coin_type": "BITCOIN"
734
+ // }
806
735
  // ],
807
- // "usIn":1648691472831791,
808
- // "usOut":1648691472831896,
809
- // "usDiff":105,
810
- // "testnet":false
736
+ // "usIn": 1583761588590479,
737
+ // "usOut": 1583761588590544,
738
+ // "usDiff": 65,
739
+ // "testnet": false
811
740
  // }
812
741
  //
813
- const instrumentsResult = this.safeValue(instrumentsResponse, 'result', []);
742
+ const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
743
+ for (let i = 0; i < currenciesResult.length; i++) {
744
+ const currencyId = this.safeString(currenciesResult[i], 'currency');
745
+ const request = {
746
+ 'currency': currencyId,
747
+ };
748
+ const instrumentsResponse = await this.publicGetGetInstruments(this.extend(request, params));
749
+ //
750
+ // {
751
+ // "jsonrpc":"2.0",
752
+ // "result":[
753
+ // {
754
+ // "tick_size":0.0005,
755
+ // "taker_commission":0.0003,
756
+ // "strike":52000.0,
757
+ // "settlement_period":"month",
758
+ // "settlement_currency":"BTC",
759
+ // "quote_currency":"BTC",
760
+ // "option_type":"put", // put, call
761
+ // "min_trade_amount":0.1,
762
+ // "maker_commission":0.0003,
763
+ // "kind":"option",
764
+ // "is_active":true,
765
+ // "instrument_name":"BTC-24JUN22-52000-P",
766
+ // "expiration_timestamp":1656057600000,
767
+ // "creation_timestamp":1648199543000,
768
+ // "counter_currency":"USD",
769
+ // "contract_size":1.0,
770
+ // "block_trade_commission":0.0003,
771
+ // "base_currency":"BTC"
772
+ // },
773
+ // {
774
+ // "tick_size":0.5,
775
+ // "taker_commission":0.0005,
776
+ // "settlement_period":"month", // month, week
777
+ // "settlement_currency":"BTC",
778
+ // "quote_currency":"USD",
779
+ // "min_trade_amount":10.0,
780
+ // "max_liquidation_commission":0.0075,
781
+ // "max_leverage":50,
782
+ // "maker_commission":0.0,
783
+ // "kind":"future",
784
+ // "is_active":true,
785
+ // "instrument_name":"BTC-27MAY22",
786
+ // "future_type":"reversed",
787
+ // "expiration_timestamp":1653638400000,
788
+ // "creation_timestamp":1648195209000,
789
+ // "counter_currency":"USD",
790
+ // "contract_size":10.0,
791
+ // "block_trade_commission":0.0001,
792
+ // "base_currency":"BTC"
793
+ // },
794
+ // {
795
+ // "tick_size":0.5,
796
+ // "taker_commission":0.0005,
797
+ // "settlement_period":"perpetual",
798
+ // "settlement_currency":"BTC",
799
+ // "quote_currency":"USD",
800
+ // "min_trade_amount":10.0,
801
+ // "max_liquidation_commission":0.0075,
802
+ // "max_leverage":50,
803
+ // "maker_commission":0.0,
804
+ // "kind":"future",
805
+ // "is_active":true,
806
+ // "instrument_name":"BTC-PERPETUAL",
807
+ // "future_type":"reversed",
808
+ // "expiration_timestamp":32503708800000,
809
+ // "creation_timestamp":1534242287000,
810
+ // "counter_currency":"USD",
811
+ // "contract_size":10.0,
812
+ // "block_trade_commission":0.0001,
813
+ // "base_currency":"BTC"
814
+ // },
815
+ // ],
816
+ // "usIn":1648691472831791,
817
+ // "usOut":1648691472831896,
818
+ // "usDiff":105,
819
+ // "testnet":false
820
+ // }
821
+ //
822
+ instrumentsResponses.push(instrumentsResponse);
823
+ }
824
+ }
825
+ for (let i = 0; i < instrumentsResponses.length; i++) {
826
+ const instrumentsResult = this.safeValue(instrumentsResponses[i], 'result', []);
814
827
  for (let k = 0; k < instrumentsResult.length; k++) {
815
828
  const market = instrumentsResult[k];
816
829
  const kind = this.safeString(market, 'kind');
package/js/src/gemini.js CHANGED
@@ -446,7 +446,8 @@ export default class gemini extends Exchange {
446
446
  // '<td>0.01 USD', // quote currency price increment
447
447
  // '</tr>'
448
448
  // ]
449
- const marketId = cells[0].replace('<td>', '');
449
+ let marketId = cells[0].replace('<td>', '');
450
+ marketId = marketId.replace('*', '');
450
451
  // const base = this.safeCurrencyCode (baseId);
451
452
  const minAmountString = cells[1].replace('<td>', '');
452
453
  const minAmountParts = minAmountString.split(' ');
@@ -104,7 +104,8 @@ export default class kraken extends Exchange {
104
104
  info: any;
105
105
  };
106
106
  withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
107
- fetchPositions(symbols?: Strings, params?: {}): Promise<any>;
107
+ fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
108
+ parsePosition(position: any, market?: Market): import("./base/types.js").Position;
108
109
  parseAccountType(account: any): string;
109
110
  transferOut(code: string, amount: any, params?: {}): Promise<TransferEntry>;
110
111
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
package/js/src/kraken.js CHANGED
@@ -599,10 +599,7 @@ export default class kraken extends Exchange {
599
599
  if (currencyId !== undefined) {
600
600
  if (currencyId.length > 3) {
601
601
  if ((currencyId.indexOf('X') === 0) || (currencyId.indexOf('Z') === 0)) {
602
- if (currencyId.indexOf('.') > 0) {
603
- return super.safeCurrency(currencyId, currency);
604
- }
605
- else {
602
+ if (!(currencyId.indexOf('.') > 0)) {
606
603
  currencyId = currencyId.slice(1);
607
604
  }
608
605
  }
@@ -651,8 +648,13 @@ export default class kraken extends Exchange {
651
648
  // {
652
649
  // "error": [],
653
650
  // "result": {
654
- // "ADA": { "aclass": "currency", "altname": "ADA", "decimals": 8, "display_decimals": 6 },
655
- // "BCH": { "aclass": "currency", "altname": "BCH", "decimals": 10, "display_decimals": 5 },
651
+ // "BCH": {
652
+ // "aclass": "currency",
653
+ // "altname": "BCH",
654
+ // "decimals": 10,
655
+ // "display_decimals": 5
656
+ // "status": "enabled",
657
+ // },
656
658
  // ...
657
659
  // },
658
660
  // }
@@ -667,15 +669,15 @@ export default class kraken extends Exchange {
667
669
  // see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
668
670
  // to add support for multiple withdrawal/deposit methods and
669
671
  // differentiated fees for each particular method
670
- const code = this.safeCurrencyCode(this.safeString(currency, 'altname'));
672
+ const code = this.safeCurrencyCode(id);
671
673
  const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals')));
672
674
  // assumes all currencies are active except those listed above
673
- const active = !this.inArray(code, this.options['inactiveCurrencies']);
675
+ const active = this.safeString(currency, 'status') === 'enabled';
674
676
  result[code] = {
675
677
  'id': id,
676
678
  'code': code,
677
679
  'info': currency,
678
- 'name': code,
680
+ 'name': this.safeString(currency, 'altname'),
679
681
  'active': active,
680
682
  'deposit': undefined,
681
683
  'withdraw': undefined,
@@ -2704,15 +2706,15 @@ export default class kraken extends Exchange {
2704
2706
  * @name kraken#fetchPositions
2705
2707
  * @description fetch all open positions
2706
2708
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions
2707
- * @param {string[]|undefined} symbols not used by kraken fetchPositions ()
2709
+ * @param {string[]} [symbols] not used by kraken fetchPositions ()
2708
2710
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2709
2711
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
2710
2712
  */
2711
2713
  await this.loadMarkets();
2712
2714
  const request = {
2713
- // 'txid': 'comma delimited list of transaction ids to restrict output to',
2714
- // 'docalcs': false, // whether or not to include profit/loss calculations
2715
- // 'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
2715
+ // 'txid': 'comma delimited list of transaction ids to restrict output to',
2716
+ 'docalcs': 'true',
2717
+ 'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
2716
2718
  };
2717
2719
  const response = await this.privatePostOpenPositions(this.extend(request, params));
2718
2720
  //
@@ -2760,9 +2762,58 @@ export default class kraken extends Exchange {
2760
2762
  // ]
2761
2763
  // }
2762
2764
  //
2763
- const result = this.safeValue(response, 'result');
2764
- // todo unify parsePosition/parsePositions
2765
- return result;
2765
+ symbols = this.marketSymbols(symbols);
2766
+ const result = this.safeList(response, 'result');
2767
+ const results = this.parsePositions(result, symbols);
2768
+ return this.filterByArrayPositions(results, 'symbol', symbols, false);
2769
+ }
2770
+ parsePosition(position, market = undefined) {
2771
+ //
2772
+ // {
2773
+ // "pair": "ETHUSDT",
2774
+ // "positions": "1",
2775
+ // "type": "buy",
2776
+ // "leverage": "2.00000",
2777
+ // "cost": "28.49800",
2778
+ // "fee": "0.07979",
2779
+ // "vol": "0.02000000",
2780
+ // "vol_closed": "0.00000000",
2781
+ // "margin": "14.24900"
2782
+ // }
2783
+ //
2784
+ const marketId = this.safeString(position, 'pair');
2785
+ const rawSide = this.safeString(position, 'type');
2786
+ const side = (rawSide === 'buy') ? 'long' : 'short';
2787
+ return this.safePosition({
2788
+ 'info': position,
2789
+ 'id': undefined,
2790
+ 'symbol': this.safeSymbol(marketId, market),
2791
+ 'notional': undefined,
2792
+ 'marginMode': undefined,
2793
+ 'liquidationPrice': undefined,
2794
+ 'entryPrice': undefined,
2795
+ 'unrealizedPnl': this.safeNumber(position, 'net'),
2796
+ 'realizedPnl': undefined,
2797
+ 'percentage': undefined,
2798
+ 'contracts': this.safeNumber(position, 'vol'),
2799
+ 'contractSize': undefined,
2800
+ 'markPrice': undefined,
2801
+ 'lastPrice': undefined,
2802
+ 'side': side,
2803
+ 'hedged': undefined,
2804
+ 'timestamp': undefined,
2805
+ 'datetime': undefined,
2806
+ 'lastUpdateTimestamp': undefined,
2807
+ 'maintenanceMargin': undefined,
2808
+ 'maintenanceMarginPercentage': undefined,
2809
+ 'collateral': undefined,
2810
+ 'initialMargin': this.safeNumber(position, 'margin'),
2811
+ 'initialMarginPercentage': undefined,
2812
+ 'leverage': this.safeNumber(position, 'leverage'),
2813
+ 'marginRatio': undefined,
2814
+ 'stopLossPrice': undefined,
2815
+ 'takeProfitPrice': undefined,
2816
+ });
2766
2817
  }
2767
2818
  parseAccountType(account) {
2768
2819
  const accountByType = {
package/js/src/okx.js CHANGED
@@ -1222,7 +1222,7 @@ export default class okx extends Exchange {
1222
1222
  // ]
1223
1223
  // }
1224
1224
  //
1225
- const data = this.safeValue(response, 'data', []);
1225
+ const data = this.safeList(response, 'data', []);
1226
1226
  const dataLength = data.length;
1227
1227
  const update = {
1228
1228
  'updated': undefined,
@@ -1270,8 +1270,8 @@ export default class okx extends Exchange {
1270
1270
  // "msg": ""
1271
1271
  // }
1272
1272
  //
1273
- const data = this.safeValue(response, 'data', []);
1274
- const first = this.safeValue(data, 0, {});
1273
+ const data = this.safeList(response, 'data', []);
1274
+ const first = this.safeDict(data, 0, {});
1275
1275
  return this.safeInteger(first, 'ts');
1276
1276
  }
1277
1277
  async fetchAccounts(params = {}) {
@@ -1303,7 +1303,7 @@ export default class okx extends Exchange {
1303
1303
  // "msg": ""
1304
1304
  // }
1305
1305
  //
1306
- const data = this.safeValue(response, 'data', []);
1306
+ const data = this.safeList(response, 'data', []);
1307
1307
  const result = [];
1308
1308
  for (let i = 0; i < data.length; i++) {
1309
1309
  const account = data[i];
@@ -1328,7 +1328,7 @@ export default class okx extends Exchange {
1328
1328
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1329
1329
  * @returns {object[]} an array of objects representing market data
1330
1330
  */
1331
- const types = this.safeValue(this.options, 'fetchMarkets');
1331
+ const types = this.safeList(this.options, 'fetchMarkets', []);
1332
1332
  let promises = [];
1333
1333
  let result = [];
1334
1334
  for (let i = 0; i < types.length; i++) {
@@ -1432,7 +1432,7 @@ export default class okx extends Exchange {
1432
1432
  }
1433
1433
  }
1434
1434
  const tickSize = this.safeString(market, 'tickSz');
1435
- const fees = this.safeValue2(this.fees, type, 'trading', {});
1435
+ const fees = this.safeDict2(this.fees, type, 'trading', {});
1436
1436
  let maxLeverage = this.safeString(market, 'lever', '1');
1437
1437
  maxLeverage = Precise.stringMax(maxLeverage, '1');
1438
1438
  const maxSpotCost = this.safeNumber(market, 'maxMktSz');
@@ -1491,7 +1491,7 @@ export default class okx extends Exchange {
1491
1491
  'instType': this.convertToInstrumentType(type),
1492
1492
  };
1493
1493
  if (type === 'option') {
1494
- const optionsUnderlying = this.safeValue(this.options, 'defaultUnderlying', ['BTC-USD', 'ETH-USD']);
1494
+ const optionsUnderlying = this.safeList(this.options, 'defaultUnderlying', ['BTC-USD', 'ETH-USD']);
1495
1495
  const promises = [];
1496
1496
  for (let i = 0; i < optionsUnderlying.length; i++) {
1497
1497
  const underlying = optionsUnderlying[i];
@@ -1501,8 +1501,8 @@ export default class okx extends Exchange {
1501
1501
  const promisesResult = await Promise.all(promises);
1502
1502
  let markets = [];
1503
1503
  for (let i = 0; i < promisesResult.length; i++) {
1504
- const res = this.safeValue(promisesResult, i, {});
1505
- const options = this.safeValue(res, 'data', []);
1504
+ const res = this.safeDict(promisesResult, i, {});
1505
+ const options = this.safeList(res, 'data', []);
1506
1506
  markets = this.arrayConcat(markets, options);
1507
1507
  }
1508
1508
  return this.parseMarkets(markets);
@@ -1541,7 +1541,7 @@ export default class okx extends Exchange {
1541
1541
  // "msg": ""
1542
1542
  // }
1543
1543
  //
1544
- const dataResponse = this.safeValue(response, 'data', []);
1544
+ const dataResponse = this.safeList(response, 'data', []);
1545
1545
  return this.parseMarkets(dataResponse);
1546
1546
  }
1547
1547
  safeNetwork(networkId) {
@@ -1618,7 +1618,7 @@ export default class okx extends Exchange {
1618
1618
  // "msg": ""
1619
1619
  // }
1620
1620
  //
1621
- const data = this.safeValue(response, 'data', []);
1621
+ const data = this.safeList(response, 'data', []);
1622
1622
  const result = {};
1623
1623
  const dataByCurrencyId = this.groupBy(data, 'ccy');
1624
1624
  const currencyIds = Object.keys(dataByCurrencyId);
@@ -1634,11 +1634,11 @@ export default class okx extends Exchange {
1634
1634
  let maxPrecision = undefined;
1635
1635
  for (let j = 0; j < chains.length; j++) {
1636
1636
  const chain = chains[j];
1637
- const canDeposit = this.safeValue(chain, 'canDep');
1637
+ const canDeposit = this.safeBool(chain, 'canDep');
1638
1638
  depositEnabled = (canDeposit) ? canDeposit : depositEnabled;
1639
- const canWithdraw = this.safeValue(chain, 'canWd');
1639
+ const canWithdraw = this.safeBool(chain, 'canWd');
1640
1640
  withdrawEnabled = (canWithdraw) ? canWithdraw : withdrawEnabled;
1641
- const canInternal = this.safeValue(chain, 'canInternal');
1641
+ const canInternal = this.safeBool(chain, 'canInternal');
1642
1642
  const active = (canDeposit && canWithdraw && canInternal) ? true : false;
1643
1643
  currencyActive = (active) ? active : currencyActive;
1644
1644
  const networkId = this.safeString(chain, 'chain');
@@ -1671,7 +1671,7 @@ export default class okx extends Exchange {
1671
1671
  };
1672
1672
  }
1673
1673
  }
1674
- const firstChain = this.safeValue(chains, 0);
1674
+ const firstChain = this.safeDict(chains, 0, {});
1675
1675
  result[code] = {
1676
1676
  'info': undefined,
1677
1677
  'code': code,
@@ -1747,8 +1747,8 @@ export default class okx extends Exchange {
1747
1747
  // ]
1748
1748
  // }
1749
1749
  //
1750
- const data = this.safeValue(response, 'data', []);
1751
- const first = this.safeValue(data, 0, {});
1750
+ const data = this.safeList(response, 'data', []);
1751
+ const first = this.safeDict(data, 0, {});
1752
1752
  const timestamp = this.safeInteger(first, 'ts');
1753
1753
  return this.parseOrderBook(first, symbol, timestamp);
1754
1754
  }
@@ -1849,7 +1849,7 @@ export default class okx extends Exchange {
1849
1849
  // ]
1850
1850
  // }
1851
1851
  //
1852
- const data = this.safeValue(response, 'data', []);
1852
+ const data = this.safeList(response, 'data', []);
1853
1853
  const first = this.safeDict(data, 0, {});
1854
1854
  return this.parseTicker(first, market);
1855
1855
  }
@@ -1872,7 +1872,7 @@ export default class okx extends Exchange {
1872
1872
  'instType': this.convertToInstrumentType(marketType),
1873
1873
  };
1874
1874
  if (marketType === 'option') {
1875
- const defaultUnderlying = this.safeValue(this.options, 'defaultUnderlying', 'BTC-USD');
1875
+ const defaultUnderlying = this.safeString(this.options, 'defaultUnderlying', 'BTC-USD');
1876
1876
  const currencyId = this.safeString2(params, 'uly', 'marketId', defaultUnderlying);
1877
1877
  if (currencyId === undefined) {
1878
1878
  throw new ArgumentsRequired(this.id + ' fetchTickers() requires an underlying uly or marketId parameter for options markets');
@@ -2138,7 +2138,7 @@ export default class okx extends Exchange {
2138
2138
  }
2139
2139
  const price = this.safeString(params, 'price');
2140
2140
  params = this.omit(params, 'price');
2141
- const options = this.safeValue(this.options, 'fetchOHLCV', {});
2141
+ const options = this.safeDict(this.options, 'fetchOHLCV', {});
2142
2142
  const timezone = this.safeString(options, 'timezone', 'UTC');
2143
2143
  if (limit === undefined) {
2144
2144
  limit = 100; // default 100, max 100
@@ -2271,7 +2271,7 @@ export default class okx extends Exchange {
2271
2271
  // }
2272
2272
  //
2273
2273
  const rates = [];
2274
- const data = this.safeValue(response, 'data', []);
2274
+ const data = this.safeList(response, 'data', []);
2275
2275
  for (let i = 0; i < data.length; i++) {
2276
2276
  const rate = data[i];
2277
2277
  const timestamp = this.safeInteger(rate, 'fundingTime');
@@ -2296,10 +2296,10 @@ export default class okx extends Exchange {
2296
2296
  }
2297
2297
  parseTradingBalance(response) {
2298
2298
  const result = { 'info': response };
2299
- const data = this.safeValue(response, 'data', []);
2300
- const first = this.safeValue(data, 0, {});
2299
+ const data = this.safeList(response, 'data', []);
2300
+ const first = this.safeDict(data, 0, {});
2301
2301
  const timestamp = this.safeInteger(first, 'uTime');
2302
- const details = this.safeValue(first, 'details', []);
2302
+ const details = this.safeList(first, 'details', []);
2303
2303
  for (let i = 0; i < details.length; i++) {
2304
2304
  const balance = details[i];
2305
2305
  const currencyId = this.safeString(balance, 'ccy');
@@ -2324,7 +2324,7 @@ export default class okx extends Exchange {
2324
2324
  }
2325
2325
  parseFundingBalance(response) {
2326
2326
  const result = { 'info': response };
2327
- const data = this.safeValue(response, 'data', []);
2327
+ const data = this.safeList(response, 'data', []);
2328
2328
  for (let i = 0; i < data.length; i++) {
2329
2329
  const balance = data[i];
2330
2330
  const currencyId = this.safeString(balance, 'ccy');
@@ -2408,8 +2408,8 @@ export default class okx extends Exchange {
2408
2408
  // "msg": ""
2409
2409
  // }
2410
2410
  //
2411
- const data = this.safeValue(response, 'data', []);
2412
- const first = this.safeValue(data, 0, {});
2411
+ const data = this.safeList(response, 'data', []);
2412
+ const first = this.safeDict(data, 0, {});
2413
2413
  return this.parseTradingFee(first, market);
2414
2414
  }
2415
2415
  async fetchBalance(params = {}) {
@@ -2897,8 +2897,8 @@ export default class okx extends Exchange {
2897
2897
  else {
2898
2898
  response = await this.privatePostTradeBatchOrders(request);
2899
2899
  }
2900
- const data = this.safeValue(response, 'data', []);
2901
- const first = this.safeValue(data, 0);
2900
+ const data = this.safeList(response, 'data', []);
2901
+ const first = this.safeDict(data, 0, {});
2902
2902
  const order = this.parseOrder(first, market);
2903
2903
  order['type'] = type;
2904
2904
  order['side'] = side;
@@ -4409,7 +4409,7 @@ export default class okx extends Exchange {
4409
4409
  // ]
4410
4410
  // }
4411
4411
  //
4412
- const data = this.safeValue(response, 'data', []);
4412
+ const data = this.safeList(response, 'data', []);
4413
4413
  return this.parseLedger(data, currency, since, limit);
4414
4414
  }
4415
4415
  parseLedgerEntryType(type) {
@@ -20,6 +20,7 @@ export default class bitmex extends bitmexRest {
20
20
  handleMyTrades(client: Client, message: any): void;
21
21
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
22
22
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
23
+ watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
23
24
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
24
25
  handleOHLCV(client: Client, message: any): void;
25
26
  watchHeartbeat(params?: {}): Promise<any>;