ccxt 4.2.91 → 4.2.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -212,13 +212,13 @@ console.log(version, Object.keys(exchanges));
212
212
 
213
213
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
214
214
 
215
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.91/dist/ccxt.browser.js
216
- * unpkg: https://unpkg.com/ccxt@4.2.91/dist/ccxt.browser.js
215
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.93/dist/ccxt.browser.js
216
+ * unpkg: https://unpkg.com/ccxt@4.2.93/dist/ccxt.browser.js
217
217
 
218
218
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
219
219
 
220
220
  ```HTML
221
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.91/dist/ccxt.browser.js"></script>
221
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.93/dist/ccxt.browser.js"></script>
222
222
  ```
223
223
 
224
224
  Creates a global `ccxt` object:
package/build.sh CHANGED
@@ -87,7 +87,7 @@ build_and_test_all () {
87
87
  if [[ "$last_commit_message" == *"skip-tests"* ]]; then
88
88
  echo "[SKIP-TESTS] Will skip tests!"
89
89
  exit
90
- fi
90
+ fi
91
91
  run_tests
92
92
  fi
93
93
  exit
@@ -10667,14 +10667,34 @@ class Exchange {
10667
10667
  // marketIdKey should only be undefined when response is a dictionary
10668
10668
  symbols = this.marketSymbols(symbols);
10669
10669
  const tiers = {};
10670
- for (let i = 0; i < response.length; i++) {
10671
- const item = response[i];
10672
- const id = this.safeString(item, marketIdKey);
10673
- const market = this.safeMarket(id, undefined, undefined, 'swap');
10674
- const symbol = market['symbol'];
10675
- const contract = this.safeBool(market, 'contract', false);
10676
- if (contract && ((symbols === undefined) || this.inArray(symbol, symbols))) {
10677
- tiers[symbol] = this.parseMarketLeverageTiers(item, market);
10670
+ let symbolsLength = 0;
10671
+ if (symbols !== undefined) {
10672
+ symbolsLength = symbols.length;
10673
+ }
10674
+ const noSymbols = (symbols === undefined) || (symbolsLength === 0);
10675
+ if (Array.isArray(response)) {
10676
+ for (let i = 0; i < response.length; i++) {
10677
+ const item = response[i];
10678
+ const id = this.safeString(item, marketIdKey);
10679
+ const market = this.safeMarket(id, undefined, undefined, 'swap');
10680
+ const symbol = market['symbol'];
10681
+ const contract = this.safeBool(market, 'contract', false);
10682
+ if (contract && (noSymbols || this.inArray(symbol, symbols))) {
10683
+ tiers[symbol] = this.parseMarketLeverageTiers(item, market);
10684
+ }
10685
+ }
10686
+ }
10687
+ else {
10688
+ const keys = Object.keys(response);
10689
+ for (let i = 0; i < keys.length; i++) {
10690
+ const marketId = keys[i];
10691
+ const item = response[marketId];
10692
+ const market = this.safeMarket(marketId, undefined, undefined, 'swap');
10693
+ const symbol = market['symbol'];
10694
+ const contract = this.safeBool(market, 'contract', false);
10695
+ if (contract && (noSymbols || this.inArray(symbol, symbols))) {
10696
+ tiers[symbol] = this.parseMarketLeverageTiers(item, market);
10697
+ }
10678
10698
  }
10679
10699
  }
10680
10700
  return tiers;
@@ -13027,7 +13047,7 @@ class Exchange {
13027
13047
  return reconstructedDate;
13028
13048
  }
13029
13049
  convertMarketIdExpireDate(date) {
13030
- // parse 19JAN24 to 240119
13050
+ // parse 03JAN24 to 240103
13031
13051
  const monthMappping = {
13032
13052
  'JAN': '01',
13033
13053
  'FEB': '02',
@@ -13042,6 +13062,10 @@ class Exchange {
13042
13062
  'NOV': '11',
13043
13063
  'DEC': '12',
13044
13064
  };
13065
+ // if exchange omits first zero and provides i.e. '3JAN24' instead of '03JAN24'
13066
+ if (date.length === 6) {
13067
+ date = '0' + date;
13068
+ }
13045
13069
  const year = date.slice(0, 2);
13046
13070
  const monthName = date.slice(2, 5);
13047
13071
  const month = this.safeString(monthMappping, monthName);
@@ -13983,13 +14007,13 @@ function crc32(str, signed = false) {
13983
14007
 
13984
14008
 
13985
14009
  /* ------------------------------------------------------------------------ */
13986
- const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = object => ((typeof object === 'string') &&
14010
+ const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedObject = (object) => ((typeof object === 'string') &&
13987
14011
  (object.length >= 2) &&
13988
- ((object[0] === '{') || (object[0] === '['))), binaryToString = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode, stringToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.decode, stringToBase64 = string => _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.encode(_static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.decode(string)), base64ToString = string => _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode(_static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.decode(string)), base64ToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.decode, binaryToBase64 = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.encode, base16ToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base16 */ .YU.decode, binaryToBase16 = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base16 */ .YU.encode, base58ToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base58 */ .Jq.decode, binaryToBase58 = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base58 */ .Jq.encode, binaryConcat = _static_dependencies_noble_curves_abstract_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .concatBytes */ .eV, binaryConcatArray = (arr) => (0,_static_dependencies_noble_curves_abstract_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .concatBytes */ .eV)(...arr), urlencode = object => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object), urlencodeNested = object => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object) // implemented only in python
13989
- , urlencodeWithArrayRepeat = object => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object, { arrayFormat: 'repeat' }), rawencode = object => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object, { encode: false }), encode = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.decode // lol
14012
+ ((object[0] === '{') || (object[0] === '['))), binaryToString = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode, stringToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.decode, stringToBase64 = (string) => _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.encode(_static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.decode(string)), base64ToString = (string) => _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode(_static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.decode(string)), base64ToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.decode, binaryToBase64 = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base64 */ .US.encode, base16ToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base16 */ .YU.decode, binaryToBase16 = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base16 */ .YU.encode, base58ToBinary = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base58 */ .Jq.decode, binaryToBase58 = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .base58 */ .Jq.encode, binaryConcat = _static_dependencies_noble_curves_abstract_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .concatBytes */ .eV, binaryConcatArray = (arr) => (0,_static_dependencies_noble_curves_abstract_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .concatBytes */ .eV)(...arr), urlencode = (object) => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object), urlencodeNested = (object) => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object) // implemented only in python
14013
+ , urlencodeWithArrayRepeat = (object) => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object, { arrayFormat: 'repeat' }), rawencode = (object) => _static_dependencies_qs_index_cjs__WEBPACK_IMPORTED_MODULE_0___default().stringify(object, { encode: false }), encode = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.decode // lol
13990
14014
  , decode = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_1__/* .utf8 */ .KA.encode
13991
14015
  // Url-safe-base64 without equals signs, with + replaced by - and slashes replaced by underscores
13992
- , urlencodeBase64 = base64string => base64string.replace(/[=]+$/, '')
14016
+ , urlencodeBase64 = (base64string) => base64string.replace(/[=]+$/, '')
13993
14017
  .replace(/\+/g, '-')
13994
14018
  .replace(/\//g, '_'), numberToLE = (n, padding) => (0,_static_dependencies_noble_curves_abstract_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .numberToBytesLE */ .S5)(BigInt(n), padding), numberToBE = (n, padding) => (0,_static_dependencies_noble_curves_abstract_utils_js__WEBPACK_IMPORTED_MODULE_2__/* .numberToBytesBE */ .tL)(BigInt(n), padding);
13995
14019
  function packb(req) {
@@ -84538,6 +84562,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
84538
84562
  'v5/broker/earning-record': 5,
84539
84563
  'v5/broker/earnings-info': 5,
84540
84564
  'v5/broker/account-info': 5,
84565
+ 'v5/broker/asset/query-sub-member-deposit-record': 10,
84541
84566
  },
84542
84567
  'post': {
84543
84568
  // Legacy option USDC
@@ -107253,36 +107278,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
107253
107278
  const data = this.safeValue(response, 'data', {});
107254
107279
  return this.parseLeverageTiers(data, symbols, undefined);
107255
107280
  }
107256
- parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
107257
- //
107258
- // {
107259
- // "BTCUSD": [
107260
- // ["500001", "100", "0.005"],
107261
- // ["1000001", "50", "0.01"],
107262
- // ["2000001", "30", "0.015"],
107263
- // ["5000001", "20", "0.02"],
107264
- // ["10000001", "15", "0.025"],
107265
- // ["20000001", "10", "0.03"]
107266
- // ],
107267
- // ...
107268
- // }
107269
- //
107270
- const tiers = {};
107271
- const marketIds = Object.keys(response);
107272
- for (let i = 0; i < marketIds.length; i++) {
107273
- const marketId = marketIds[i];
107274
- const market = this.safeMarket(marketId, undefined, undefined, 'spot');
107275
- const symbol = this.safeString(market, 'symbol');
107276
- let symbolsLength = 0;
107277
- if (symbols !== undefined) {
107278
- symbolsLength = symbols.length;
107279
- }
107280
- if (symbol !== undefined && (symbolsLength === 0 || this.inArray(symbols, symbol))) {
107281
- tiers[symbol] = this.parseMarketLeverageTiers(response[marketId], market);
107282
- }
107283
- }
107284
- return tiers;
107285
- }
107286
107281
  parseMarketLeverageTiers(item, market = undefined) {
107287
107282
  const tiers = [];
107288
107283
  let minNotional = 0;
@@ -127444,117 +127439,130 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
127444
127439
  * @name deribit#fetchMarkets
127445
127440
  * @description retrieves data on all markets for deribit
127446
127441
  * @see https://docs.deribit.com/#public-get_currencies
127442
+ * @see https://docs.deribit.com/#public-get_instruments
127447
127443
  * @param {object} [params] extra parameters specific to the exchange API endpoint
127448
127444
  * @returns {object[]} an array of objects representing market data
127449
127445
  */
127450
- const currenciesResponse = await this.publicGetGetCurrencies(params);
127451
- //
127452
- // {
127453
- // "jsonrpc": "2.0",
127454
- // "result": [
127455
- // {
127456
- // "withdrawal_priorities": [
127457
- // { value: 0.15, name: "very_low" },
127458
- // { value: 1.5, name: "very_high" },
127459
- // ],
127460
- // "withdrawal_fee": 0.0005,
127461
- // "min_withdrawal_fee": 0.0005,
127462
- // "min_confirmations": 1,
127463
- // "fee_precision": 4,
127464
- // "currency_long": "Bitcoin",
127465
- // "currency": "BTC",
127466
- // "coin_type": "BITCOIN"
127467
- // }
127468
- // ],
127469
- // "usIn": 1583761588590479,
127470
- // "usOut": 1583761588590544,
127471
- // "usDiff": 65,
127472
- // "testnet": false
127473
- // }
127474
- //
127475
- const parsedMarkets = {};
127476
- const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
127446
+ const instrumentsResponses = [];
127477
127447
  const result = [];
127478
- for (let i = 0; i < currenciesResult.length; i++) {
127479
- const currencyId = this.safeString(currenciesResult[i], 'currency');
127480
- const request = {
127481
- 'currency': currencyId,
127482
- };
127483
- const instrumentsResponse = await this.publicGetGetInstruments(this.extend(request, params));
127448
+ const parsedMarkets = {};
127449
+ let fetchAllMarkets = undefined;
127450
+ [fetchAllMarkets, params] = this.handleOptionAndParams(params, 'fetchMarkets', 'fetchAllMarkets', true);
127451
+ if (fetchAllMarkets) {
127452
+ const instrumentsResponse = await this.publicGetGetInstruments(params);
127453
+ instrumentsResponses.push(instrumentsResponse);
127454
+ }
127455
+ else {
127456
+ const currenciesResponse = await this.publicGetGetCurrencies(params);
127484
127457
  //
127485
127458
  // {
127486
- // "jsonrpc":"2.0",
127487
- // "result":[
127488
- // {
127489
- // "tick_size":0.0005,
127490
- // "taker_commission":0.0003,
127491
- // "strike":52000.0,
127492
- // "settlement_period":"month",
127493
- // "settlement_currency":"BTC",
127494
- // "quote_currency":"BTC",
127495
- // "option_type":"put", // put, call
127496
- // "min_trade_amount":0.1,
127497
- // "maker_commission":0.0003,
127498
- // "kind":"option",
127499
- // "is_active":true,
127500
- // "instrument_name":"BTC-24JUN22-52000-P",
127501
- // "expiration_timestamp":1656057600000,
127502
- // "creation_timestamp":1648199543000,
127503
- // "counter_currency":"USD",
127504
- // "contract_size":1.0,
127505
- // "block_trade_commission":0.0003,
127506
- // "base_currency":"BTC"
127507
- // },
127508
- // {
127509
- // "tick_size":0.5,
127510
- // "taker_commission":0.0005,
127511
- // "settlement_period":"month", // month, week
127512
- // "settlement_currency":"BTC",
127513
- // "quote_currency":"USD",
127514
- // "min_trade_amount":10.0,
127515
- // "max_liquidation_commission":0.0075,
127516
- // "max_leverage":50,
127517
- // "maker_commission":0.0,
127518
- // "kind":"future",
127519
- // "is_active":true,
127520
- // "instrument_name":"BTC-27MAY22",
127521
- // "future_type":"reversed",
127522
- // "expiration_timestamp":1653638400000,
127523
- // "creation_timestamp":1648195209000,
127524
- // "counter_currency":"USD",
127525
- // "contract_size":10.0,
127526
- // "block_trade_commission":0.0001,
127527
- // "base_currency":"BTC"
127528
- // },
127459
+ // "jsonrpc": "2.0",
127460
+ // "result": [
127529
127461
  // {
127530
- // "tick_size":0.5,
127531
- // "taker_commission":0.0005,
127532
- // "settlement_period":"perpetual",
127533
- // "settlement_currency":"BTC",
127534
- // "quote_currency":"USD",
127535
- // "min_trade_amount":10.0,
127536
- // "max_liquidation_commission":0.0075,
127537
- // "max_leverage":50,
127538
- // "maker_commission":0.0,
127539
- // "kind":"future",
127540
- // "is_active":true,
127541
- // "instrument_name":"BTC-PERPETUAL",
127542
- // "future_type":"reversed",
127543
- // "expiration_timestamp":32503708800000,
127544
- // "creation_timestamp":1534242287000,
127545
- // "counter_currency":"USD",
127546
- // "contract_size":10.0,
127547
- // "block_trade_commission":0.0001,
127548
- // "base_currency":"BTC"
127549
- // },
127462
+ // "withdrawal_priorities": [
127463
+ // { value: 0.15, name: "very_low" },
127464
+ // { value: 1.5, name: "very_high" },
127465
+ // ],
127466
+ // "withdrawal_fee": 0.0005,
127467
+ // "min_withdrawal_fee": 0.0005,
127468
+ // "min_confirmations": 1,
127469
+ // "fee_precision": 4,
127470
+ // "currency_long": "Bitcoin",
127471
+ // "currency": "BTC",
127472
+ // "coin_type": "BITCOIN"
127473
+ // }
127550
127474
  // ],
127551
- // "usIn":1648691472831791,
127552
- // "usOut":1648691472831896,
127553
- // "usDiff":105,
127554
- // "testnet":false
127475
+ // "usIn": 1583761588590479,
127476
+ // "usOut": 1583761588590544,
127477
+ // "usDiff": 65,
127478
+ // "testnet": false
127555
127479
  // }
127556
127480
  //
127557
- const instrumentsResult = this.safeValue(instrumentsResponse, 'result', []);
127481
+ const currenciesResult = this.safeValue(currenciesResponse, 'result', []);
127482
+ for (let i = 0; i < currenciesResult.length; i++) {
127483
+ const currencyId = this.safeString(currenciesResult[i], 'currency');
127484
+ const request = {
127485
+ 'currency': currencyId,
127486
+ };
127487
+ const instrumentsResponse = await this.publicGetGetInstruments(this.extend(request, params));
127488
+ //
127489
+ // {
127490
+ // "jsonrpc":"2.0",
127491
+ // "result":[
127492
+ // {
127493
+ // "tick_size":0.0005,
127494
+ // "taker_commission":0.0003,
127495
+ // "strike":52000.0,
127496
+ // "settlement_period":"month",
127497
+ // "settlement_currency":"BTC",
127498
+ // "quote_currency":"BTC",
127499
+ // "option_type":"put", // put, call
127500
+ // "min_trade_amount":0.1,
127501
+ // "maker_commission":0.0003,
127502
+ // "kind":"option",
127503
+ // "is_active":true,
127504
+ // "instrument_name":"BTC-24JUN22-52000-P",
127505
+ // "expiration_timestamp":1656057600000,
127506
+ // "creation_timestamp":1648199543000,
127507
+ // "counter_currency":"USD",
127508
+ // "contract_size":1.0,
127509
+ // "block_trade_commission":0.0003,
127510
+ // "base_currency":"BTC"
127511
+ // },
127512
+ // {
127513
+ // "tick_size":0.5,
127514
+ // "taker_commission":0.0005,
127515
+ // "settlement_period":"month", // month, week
127516
+ // "settlement_currency":"BTC",
127517
+ // "quote_currency":"USD",
127518
+ // "min_trade_amount":10.0,
127519
+ // "max_liquidation_commission":0.0075,
127520
+ // "max_leverage":50,
127521
+ // "maker_commission":0.0,
127522
+ // "kind":"future",
127523
+ // "is_active":true,
127524
+ // "instrument_name":"BTC-27MAY22",
127525
+ // "future_type":"reversed",
127526
+ // "expiration_timestamp":1653638400000,
127527
+ // "creation_timestamp":1648195209000,
127528
+ // "counter_currency":"USD",
127529
+ // "contract_size":10.0,
127530
+ // "block_trade_commission":0.0001,
127531
+ // "base_currency":"BTC"
127532
+ // },
127533
+ // {
127534
+ // "tick_size":0.5,
127535
+ // "taker_commission":0.0005,
127536
+ // "settlement_period":"perpetual",
127537
+ // "settlement_currency":"BTC",
127538
+ // "quote_currency":"USD",
127539
+ // "min_trade_amount":10.0,
127540
+ // "max_liquidation_commission":0.0075,
127541
+ // "max_leverage":50,
127542
+ // "maker_commission":0.0,
127543
+ // "kind":"future",
127544
+ // "is_active":true,
127545
+ // "instrument_name":"BTC-PERPETUAL",
127546
+ // "future_type":"reversed",
127547
+ // "expiration_timestamp":32503708800000,
127548
+ // "creation_timestamp":1534242287000,
127549
+ // "counter_currency":"USD",
127550
+ // "contract_size":10.0,
127551
+ // "block_trade_commission":0.0001,
127552
+ // "base_currency":"BTC"
127553
+ // },
127554
+ // ],
127555
+ // "usIn":1648691472831791,
127556
+ // "usOut":1648691472831896,
127557
+ // "usDiff":105,
127558
+ // "testnet":false
127559
+ // }
127560
+ //
127561
+ instrumentsResponses.push(instrumentsResponse);
127562
+ }
127563
+ }
127564
+ for (let i = 0; i < instrumentsResponses.length; i++) {
127565
+ const instrumentsResult = this.safeValue(instrumentsResponses[i], 'result', []);
127558
127566
  for (let k = 0; k < instrumentsResult.length; k++) {
127559
127567
  const market = instrumentsResult[k];
127560
127568
  const kind = this.safeString(market, 'kind');
@@ -134175,55 +134183,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
134175
134183
  //
134176
134184
  const data = this.safeValue(response, 'data', []);
134177
134185
  symbols = this.marketSymbols(symbols);
134178
- return this.parseLeverageTiers(data, symbols, 'symbol');
134179
- }
134180
- parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
134181
- //
134182
- // [
134183
- // {
134184
- // "instrument_id": "BTCUSDTPERP",
134185
- // "type": "REAL",
134186
- // "contract_type": "PERPETUAL",
134187
- // "base_currency": "BTC",
134188
- // "quote_currency": "USDT",
134189
- // "clear_currency": "USDT",
134190
- // "contract_value": "0.001",
134191
- // "contract_value_currency": "BTC",
134192
- // "is_inverse": false,
134193
- // "is_trading": true,
134194
- // "status": "ONLINE",
134195
- // "price_precision": 1,
134196
- // "tick_size": "0.1",
134197
- // "min_order_amount": 1,
134198
- // "open_max_limits": [
134199
- // {
134200
- // "leverage": "50",
134201
- // "max_limit": "1000000"
134202
- // }
134203
- // ]
134204
- // },
134205
- // ]
134206
- //
134207
- const tiers = {};
134208
- const result = {};
134209
- for (let i = 0; i < response.length; i++) {
134210
- const entry = response[i];
134211
- const marketId = this.safeString(entry, 'instrument_id');
134212
- const market = this.safeMarket(marketId);
134213
- const symbol = this.safeSymbol(marketId, market);
134214
- let symbolsLength = 0;
134215
- tiers[symbol] = this.parseMarketLeverageTiers(response[i], market);
134216
- if (symbols !== undefined) {
134217
- symbolsLength = symbols.length;
134218
- if (this.inArray(symbol, symbols)) {
134219
- result[symbol] = this.parseMarketLeverageTiers(response[i], market);
134220
- }
134221
- }
134222
- if (symbol !== undefined && (symbolsLength === 0 || this.inArray(symbols, symbol))) {
134223
- result[symbol] = this.parseMarketLeverageTiers(response[i], market);
134224
- }
134225
- }
134226
- return result;
134186
+ return this.parseLeverageTiers(data, symbols, 'instrument_id');
134227
134187
  }
134228
134188
  async fetchMarketLeverageTiers(symbol, params = {}) {
134229
134189
  /**
@@ -172649,15 +172609,15 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
172649
172609
  * @name kraken#fetchPositions
172650
172610
  * @description fetch all open positions
172651
172611
  * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions
172652
- * @param {string[]|undefined} symbols not used by kraken fetchPositions ()
172612
+ * @param {string[]} [symbols] not used by kraken fetchPositions ()
172653
172613
  * @param {object} [params] extra parameters specific to the exchange API endpoint
172654
172614
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
172655
172615
  */
172656
172616
  await this.loadMarkets();
172657
172617
  const request = {
172658
- // 'txid': 'comma delimited list of transaction ids to restrict output to',
172659
- // 'docalcs': false, // whether or not to include profit/loss calculations
172660
- // 'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
172618
+ // 'txid': 'comma delimited list of transaction ids to restrict output to',
172619
+ 'docalcs': 'true',
172620
+ 'consolidation': 'market', // what to consolidate the positions data around, market will consolidate positions based on market pair
172661
172621
  };
172662
172622
  const response = await this.privatePostOpenPositions(this.extend(request, params));
172663
172623
  //
@@ -172705,9 +172665,58 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
172705
172665
  // ]
172706
172666
  // }
172707
172667
  //
172708
- const result = this.safeValue(response, 'result');
172709
- // todo unify parsePosition/parsePositions
172710
- return result;
172668
+ symbols = this.marketSymbols(symbols);
172669
+ const result = this.safeList(response, 'result');
172670
+ const results = this.parsePositions(result, symbols);
172671
+ return this.filterByArrayPositions(results, 'symbol', symbols, false);
172672
+ }
172673
+ parsePosition(position, market = undefined) {
172674
+ //
172675
+ // {
172676
+ // "pair": "ETHUSDT",
172677
+ // "positions": "1",
172678
+ // "type": "buy",
172679
+ // "leverage": "2.00000",
172680
+ // "cost": "28.49800",
172681
+ // "fee": "0.07979",
172682
+ // "vol": "0.02000000",
172683
+ // "vol_closed": "0.00000000",
172684
+ // "margin": "14.24900"
172685
+ // }
172686
+ //
172687
+ const marketId = this.safeString(position, 'pair');
172688
+ const rawSide = this.safeString(position, 'type');
172689
+ const side = (rawSide === 'buy') ? 'long' : 'short';
172690
+ return this.safePosition({
172691
+ 'info': position,
172692
+ 'id': undefined,
172693
+ 'symbol': this.safeSymbol(marketId, market),
172694
+ 'notional': undefined,
172695
+ 'marginMode': undefined,
172696
+ 'liquidationPrice': undefined,
172697
+ 'entryPrice': undefined,
172698
+ 'unrealizedPnl': this.safeNumber(position, 'net'),
172699
+ 'realizedPnl': undefined,
172700
+ 'percentage': undefined,
172701
+ 'contracts': this.safeNumber(position, 'vol'),
172702
+ 'contractSize': undefined,
172703
+ 'markPrice': undefined,
172704
+ 'lastPrice': undefined,
172705
+ 'side': side,
172706
+ 'hedged': undefined,
172707
+ 'timestamp': undefined,
172708
+ 'datetime': undefined,
172709
+ 'lastUpdateTimestamp': undefined,
172710
+ 'maintenanceMargin': undefined,
172711
+ 'maintenanceMarginPercentage': undefined,
172712
+ 'collateral': undefined,
172713
+ 'initialMargin': this.safeNumber(position, 'margin'),
172714
+ 'initialMarginPercentage': undefined,
172715
+ 'leverage': this.safeNumber(position, 'leverage'),
172716
+ 'marginRatio': undefined,
172717
+ 'stopLossPrice': undefined,
172718
+ 'takeProfitPrice': undefined,
172719
+ });
172711
172720
  }
172712
172721
  parseAccountType(account) {
172713
172722
  const accountByType = {
@@ -285223,12 +285232,11 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
285223
285232
  const result = await this.fetchTransactions(code, since, limit, this.extend(request, params));
285224
285233
  return result;
285225
285234
  }
285226
- async fetchTransactions(code = undefined, since = undefined, limit = undefined, params = {}) {
285235
+ async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
285227
285236
  /**
285228
285237
  * @method
285229
- * @name probit#fetchTransactions
285230
- * @deprecated
285231
- * @description use fetchDepositsWithdrawals instead
285238
+ * @name probit#fetchDepositsWithdrawals
285239
+ * @description fetch history of deposits and withdrawals
285232
285240
  * @see https://docs-en.probit.com/reference/transferpayment
285233
285241
  * @param {string} code unified currency code
285234
285242
  * @param {int} [since] the earliest time in ms to fetch transactions for
@@ -325545,7 +325553,7 @@ SOFTWARE.
325545
325553
 
325546
325554
  //-----------------------------------------------------------------------------
325547
325555
  // this is updated by vss.js when building
325548
- const version = '4.2.91';
325556
+ const version = '4.2.93';
325549
325557
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
325550
325558
  //-----------------------------------------------------------------------------
325551
325559