ccxt 4.1.14 → 4.1.17

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.
Files changed (97) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +381 -169
  3. package/dist/ccxt.browser.min.js +9 -9
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +3 -0
  7. package/dist/cjs/src/bingx.js +9 -4
  8. package/dist/cjs/src/bitget.js +274 -132
  9. package/dist/cjs/src/bitmex.js +6 -3
  10. package/dist/cjs/src/bittrex.js +1 -0
  11. package/dist/cjs/src/btcalpha.js +2 -1
  12. package/dist/cjs/src/btcturk.js +3 -0
  13. package/dist/cjs/src/bybit.js +9 -2
  14. package/dist/cjs/src/coinone.js +13 -4
  15. package/dist/cjs/src/digifinex.js +9 -8
  16. package/dist/cjs/src/gate.js +2 -2
  17. package/dist/cjs/src/huobi.js +8 -0
  18. package/dist/cjs/src/kraken.js +2 -1
  19. package/dist/cjs/src/kucoin.js +1 -0
  20. package/dist/cjs/src/kucoinfutures.js +1 -0
  21. package/dist/cjs/src/kuna.js +1 -0
  22. package/dist/cjs/src/lbank.js +1 -0
  23. package/dist/cjs/src/lbank2.js +2 -0
  24. package/dist/cjs/src/luno.js +1 -0
  25. package/dist/cjs/src/lykke.js +2 -1
  26. package/dist/cjs/src/mercado.js +1 -0
  27. package/dist/cjs/src/mexc.js +4 -1
  28. package/dist/cjs/src/ndax.js +1 -0
  29. package/dist/cjs/src/novadax.js +1 -0
  30. package/dist/cjs/src/oceanex.js +1 -0
  31. package/dist/cjs/src/okx.js +3 -3
  32. package/dist/cjs/src/phemex.js +2 -0
  33. package/dist/cjs/src/pro/hollaex.js +1 -1
  34. package/dist/cjs/src/pro/mexc.js +1 -1
  35. package/dist/cjs/src/probit.js +1 -0
  36. package/dist/cjs/src/tidex.js +1 -0
  37. package/dist/cjs/src/timex.js +1 -0
  38. package/dist/cjs/src/tokocrypto.js +1 -0
  39. package/dist/cjs/src/upbit.js +1 -0
  40. package/dist/cjs/src/wavesexchange.js +1 -0
  41. package/dist/cjs/src/wazirx.js +2 -1
  42. package/dist/cjs/src/whitebit.js +2 -1
  43. package/dist/cjs/src/woo.js +1 -1
  44. package/dist/cjs/src/yobit.js +1 -0
  45. package/dist/cjs/src/zaif.js +1 -0
  46. package/dist/cjs/src/zonda.js +1 -0
  47. package/js/ccxt.d.ts +1 -1
  48. package/js/ccxt.js +1 -1
  49. package/js/src/abstract/btcturk.d.ts +3 -0
  50. package/js/src/ascendex.js +1 -1
  51. package/js/src/base/Exchange.d.ts +1 -0
  52. package/js/src/base/Exchange.js +3 -0
  53. package/js/src/bingx.js +9 -4
  54. package/js/src/bitget.js +274 -132
  55. package/js/src/bitmex.js +6 -3
  56. package/js/src/bittrex.js +1 -0
  57. package/js/src/btcalpha.js +2 -1
  58. package/js/src/btcturk.js +3 -0
  59. package/js/src/bybit.js +9 -2
  60. package/js/src/coinone.js +13 -4
  61. package/js/src/digifinex.d.ts +3 -28
  62. package/js/src/digifinex.js +9 -8
  63. package/js/src/gate.js +2 -2
  64. package/js/src/huobi.js +8 -0
  65. package/js/src/kraken.js +2 -1
  66. package/js/src/kucoin.js +1 -0
  67. package/js/src/kucoinfutures.js +1 -0
  68. package/js/src/kuna.js +1 -0
  69. package/js/src/lbank.js +1 -0
  70. package/js/src/lbank2.js +2 -0
  71. package/js/src/luno.js +1 -0
  72. package/js/src/lykke.js +2 -1
  73. package/js/src/mercado.js +1 -0
  74. package/js/src/mexc.js +4 -1
  75. package/js/src/ndax.js +1 -0
  76. package/js/src/novadax.js +1 -0
  77. package/js/src/oceanex.js +1 -0
  78. package/js/src/okx.js +3 -3
  79. package/js/src/phemex.d.ts +2 -0
  80. package/js/src/phemex.js +2 -0
  81. package/js/src/pro/hollaex.js +1 -1
  82. package/js/src/pro/mexc.js +1 -1
  83. package/js/src/probit.js +1 -0
  84. package/js/src/tidex.js +1 -0
  85. package/js/src/timex.d.ts +1 -0
  86. package/js/src/timex.js +1 -0
  87. package/js/src/tokocrypto.js +1 -0
  88. package/js/src/upbit.js +1 -0
  89. package/js/src/wavesexchange.js +1 -0
  90. package/js/src/wazirx.js +2 -1
  91. package/js/src/whitebit.js +2 -1
  92. package/js/src/woo.js +1 -1
  93. package/js/src/yobit.js +1 -0
  94. package/js/src/zaif.js +1 -0
  95. package/js/src/zonda.js +1 -0
  96. package/package.json +1 -1
  97. package/skip-tests.json +108 -5
@@ -6127,7 +6127,7 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6127
6127
  * @param {object} [params] extra parameters specific to the ascendex api endpoint
6128
6128
  * @returns {object} a [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#reduce-margin-structure}
6129
6129
  */
6130
- return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
6130
+ return await this.modifyMarginHelper(symbol, -amount, 'reduce', params);
6131
6131
  }
6132
6132
  async addMargin(symbol, amount, params = {}) {
6133
6133
  /**
@@ -7585,6 +7585,9 @@ class Exchange {
7585
7585
  convertToBigInt(value) {
7586
7586
  return BigInt(value); // used on XT
7587
7587
  }
7588
+ stringToCharsArray(value) {
7589
+ return value.split('');
7590
+ }
7588
7591
  valueIsDefined(value) {
7589
7592
  return value !== undefined && value !== null;
7590
7593
  }
@@ -26540,14 +26543,19 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26540
26543
  if (time === 0) {
26541
26544
  time = undefined;
26542
26545
  }
26543
- const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
26544
- const side = this.safeStringLower2(trade, 'side', 'S');
26545
26546
  const cost = this.safeString(trade, 'quoteQty');
26546
26547
  const type = (cost === undefined) ? 'spot' : 'swap';
26547
26548
  const currencyId = this.safeString2(trade, 'currency', 'N');
26548
26549
  const currencyCode = this.safeCurrencyCode(currencyId);
26549
26550
  const m = this.safeValue(trade, 'm', false);
26550
26551
  const marketId = this.safeString(trade, 's');
26552
+ const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
26553
+ let takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
26554
+ let side = this.safeStringLower2(trade, 'side', 'S');
26555
+ if (side === undefined) {
26556
+ side = (isBuyerMaker || m) ? 'sell' : 'buy';
26557
+ takeOrMaker = 'taker';
26558
+ }
26551
26559
  return this.safeTrade({
26552
26560
  'id': this.safeStringN(trade, ['id', 't']),
26553
26561
  'info': trade,
@@ -26557,7 +26565,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26557
26565
  'order': this.safeString2(trade, 'orderId', 'i'),
26558
26566
  'type': this.safeStringLower(trade, 'o'),
26559
26567
  'side': this.parseOrderSide(side),
26560
- 'takerOrMaker': (isBuyerMaker || m) ? 'maker' : 'taker',
26568
+ 'takerOrMaker': takeOrMaker,
26561
26569
  'price': this.safeString2(trade, 'price', 'p'),
26562
26570
  'amount': this.safeStringN(trade, ['qty', 'amount', 'q']),
26563
26571
  'cost': cost,
@@ -27213,7 +27221,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
27213
27221
  'info': position,
27214
27222
  'id': this.safeString(position, 'positionId'),
27215
27223
  'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
27216
- 'notional': this.safeString(position, 'positionAmt'),
27224
+ 'notional': this.safeNumber(position, 'positionAmt'),
27217
27225
  'marginMode': marginMode,
27218
27226
  'liquidationPrice': undefined,
27219
27227
  'entryPrice': this.safeNumber2(position, 'avgPrice', 'entryPrice'),
@@ -40319,7 +40327,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40319
40327
  'startTime': since,
40320
40328
  'endTime': this.milliseconds(),
40321
40329
  };
40322
- [request, params] = this.handleUntilOption('endTime', params, request);
40330
+ [request, params] = this.handleUntilOption('endTime', request, params);
40323
40331
  if (limit !== undefined) {
40324
40332
  request['pageSize'] = limit;
40325
40333
  }
@@ -41220,18 +41228,20 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41220
41228
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
41221
41229
  * @see https://bitgetlimited.github.io/apidoc/en/spot/#get-account-assets
41222
41230
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list
41231
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-assets
41232
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-assets
41223
41233
  * @param {object} [params] extra parameters specific to the bitget api endpoint
41224
41234
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
41225
41235
  */
41226
41236
  const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
41227
41237
  await this.loadMarkets();
41228
- const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
41229
- const method = this.getSupportedMapping(marketType, {
41230
- 'spot': 'privateSpotGetAccountAssets',
41231
- 'swap': 'privateMixGetAccountAccounts',
41232
- });
41233
41238
  const request = {};
41234
- if (marketType === 'swap') {
41239
+ let marketType = undefined;
41240
+ let marginMode = undefined;
41241
+ let response = undefined;
41242
+ [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
41243
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
41244
+ if ((marketType === 'swap') || (marketType === 'future')) {
41235
41245
  let subType = undefined;
41236
41246
  [subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
41237
41247
  let productType = (subType === 'linear') ? 'UMCBL' : 'DMCBL';
@@ -41239,45 +41249,106 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41239
41249
  productType = 'S' + productType;
41240
41250
  }
41241
41251
  request['productType'] = productType;
41252
+ response = await this.privateMixGetAccountAccounts(this.extend(request, params));
41253
+ }
41254
+ else if (marginMode === 'isolated') {
41255
+ response = await this.privateMarginGetIsolatedAccountAssets(this.extend(request, params));
41256
+ }
41257
+ else if (marginMode === 'cross') {
41258
+ response = await this.privateMarginGetCrossAccountAssets(this.extend(request, params));
41259
+ }
41260
+ else if (marketType === 'spot') {
41261
+ response = await this.privateSpotGetAccountAssets(this.extend(request, params));
41262
+ }
41263
+ else {
41264
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchBalance() does not support ' + marketType + ' accounts');
41242
41265
  }
41243
- const response = await this[method](this.extend(request, query));
41244
41266
  // spot
41267
+ //
41245
41268
  // {
41246
- // code: '00000',
41247
- // msg: 'success',
41248
- // requestTime: 1645928868827,
41249
- // data: [
41250
- // {
41251
- // coinId: 1,
41252
- // coinName: 'BTC',
41253
- // available: '0.00070000',
41254
- // frozen: '0.00000000',
41255
- // lock: '0.00000000',
41256
- // uTime: '1645921706000'
41257
- // }
41258
- // ]
41269
+ // "code": "00000",
41270
+ // "msg": "success",
41271
+ // "requestTime": 1697507299139,
41272
+ // "data": [
41273
+ // {
41274
+ // "coinId": 1,
41275
+ // "coinName": "BTC",
41276
+ // "available": "0.00000000",
41277
+ // "frozen": "0.00000000",
41278
+ // "lock": "0.00000000",
41279
+ // "uTime": "1697248128000"
41280
+ // },
41281
+ // ]
41259
41282
  // }
41260
41283
  //
41261
41284
  // swap
41285
+ //
41262
41286
  // {
41263
- // code: '00000',
41264
- // msg: 'success',
41265
- // requestTime: 1645928929251,
41266
- // data: [
41267
- // {
41268
- // marginCoin: 'USDT',
41269
- // locked: '0',
41270
- // available: '8.078525',
41271
- // crossMaxAvailable: '8.078525',
41272
- // fixedMaxAvailable: '8.078525',
41273
- // maxTransferOut: '8.078525',
41274
- // equity: '10.02508',
41275
- // usdtEquity: '10.02508',
41276
- // btcEquity: '0.00026057027'
41277
- // }
41278
- // ]
41287
+ // "code": "00000",
41288
+ // "msg": "success",
41289
+ // "requestTime": 1697507505367,
41290
+ // "data": [
41291
+ // {
41292
+ // "marginCoin": "STETH",
41293
+ // "locked": "0",
41294
+ // "available": "0",
41295
+ // "crossMaxAvailable": "0",
41296
+ // "fixedMaxAvailable": "0",
41297
+ // "maxTransferOut": "0",
41298
+ // "equity": "0",
41299
+ // "usdtEquity": "0",
41300
+ // "btcEquity": "0",
41301
+ // "crossRiskRate": "0",
41302
+ // "unrealizedPL": "0",
41303
+ // "bonus": "0"
41304
+ // },
41305
+ // ]
41279
41306
  // }
41280
- const data = this.safeValue(response, 'data');
41307
+ //
41308
+ // isolated margin
41309
+ //
41310
+ // {
41311
+ // "code": "00000",
41312
+ // "msg": "success",
41313
+ // "requestTime": 1697501436571,
41314
+ // "data": [
41315
+ // {
41316
+ // "symbol": "BTCUSDT",
41317
+ // "coin": "BTC",
41318
+ // "totalAmount": "0.00021654",
41319
+ // "available": "0.00021654",
41320
+ // "transferable": "0.00021654",
41321
+ // "frozen": "0",
41322
+ // "borrow": "0",
41323
+ // "interest": "0",
41324
+ // "net": "0.00021654",
41325
+ // "ctime": "1697248128071"
41326
+ // },
41327
+ // ]
41328
+ // }
41329
+ //
41330
+ // cross margin
41331
+ //
41332
+ // {
41333
+ // "code": "00000",
41334
+ // "msg": "success",
41335
+ // "requestTime": 1697515463804,
41336
+ // "data": [
41337
+ // {
41338
+ // "coin": "BTC",
41339
+ // "totalAmount": "0.00024996",
41340
+ // "available": "0.00024996",
41341
+ // "transferable": "0.00004994",
41342
+ // "frozen": "0",
41343
+ // "borrow": "0.0001",
41344
+ // "interest": "0.00000001",
41345
+ // "net": "0.00014995",
41346
+ // "ctime": "1697251265504"
41347
+ // },
41348
+ // ]
41349
+ // }
41350
+ //
41351
+ const data = this.safeValue(response, 'data', []);
41281
41352
  return this.parseBalance(data);
41282
41353
  }
41283
41354
  parseBalance(balance) {
@@ -41286,42 +41357,81 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41286
41357
  // spot
41287
41358
  //
41288
41359
  // {
41289
- // coinId: '1',
41290
- // coinName: 'BTC',
41291
- // available: '0.00099900',
41292
- // frozen: '0.00000000',
41293
- // lock: '0.00000000',
41294
- // uTime: '1661595535000'
41360
+ // "coinId": 1,
41361
+ // "coinName": "BTC",
41362
+ // "available": "0.00000000",
41363
+ // "frozen": "0.00000000",
41364
+ // "lock": "0.00000000",
41365
+ // "uTime": "1697248128000"
41295
41366
  // }
41296
41367
  //
41297
41368
  // swap
41298
41369
  //
41299
41370
  // {
41300
- // marginCoin: 'BTC',
41301
- // locked: '0.00001948',
41302
- // available: '0.00006622',
41303
- // crossMaxAvailable: '0.00004674',
41304
- // fixedMaxAvailable: '0.00004674',
41305
- // maxTransferOut: '0.00004674',
41306
- // equity: '0.00006622',
41307
- // usdtEquity: '1.734307497491',
41308
- // btcEquity: '0.000066229058',
41309
- // crossRiskRate: '0.066308887072',
41310
- // unrealizedPL: '0',
41311
- // bonus: '0'
41371
+ // "marginCoin": "STETH",
41372
+ // "locked": "0",
41373
+ // "available": "0",
41374
+ // "crossMaxAvailable": "0",
41375
+ // "fixedMaxAvailable": "0",
41376
+ // "maxTransferOut": "0",
41377
+ // "equity": "0",
41378
+ // "usdtEquity": "0",
41379
+ // "btcEquity": "0",
41380
+ // "crossRiskRate": "0",
41381
+ // "unrealizedPL": "0",
41382
+ // "bonus": "0"
41383
+ // }
41384
+ //
41385
+ // isolated margin
41386
+ //
41387
+ // {
41388
+ // "symbol": "BTCUSDT",
41389
+ // "coin": "BTC",
41390
+ // "totalAmount": "0.00021654",
41391
+ // "available": "0.00021654",
41392
+ // "transferable": "0.00021654",
41393
+ // "frozen": "0",
41394
+ // "borrow": "0",
41395
+ // "interest": "0",
41396
+ // "net": "0.00021654",
41397
+ // "ctime": "1697248128071"
41398
+ // }
41399
+ //
41400
+ // cross margin
41401
+ //
41402
+ // {
41403
+ // "coin": "BTC",
41404
+ // "totalAmount": "0.00024995",
41405
+ // "available": "0.00024995",
41406
+ // "transferable": "0.00004993",
41407
+ // "frozen": "0",
41408
+ // "borrow": "0.0001",
41409
+ // "interest": "0.00000001",
41410
+ // "net": "0.00014994",
41411
+ // "ctime": "1697251265504"
41312
41412
  // }
41313
41413
  //
41314
41414
  for (let i = 0; i < balance.length; i++) {
41315
41415
  const entry = balance[i];
41316
- const currencyId = this.safeString2(entry, 'coinName', 'marginCoin');
41317
- const code = this.safeCurrencyCode(currencyId);
41318
41416
  const account = this.account();
41319
- const spotAccountFree = this.safeString(entry, 'available');
41320
- const contractAccountFree = this.safeString(entry, 'maxTransferOut');
41321
- account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
41322
- const frozen = this.safeString(entry, 'frozen');
41323
- const locked = this.safeString2(entry, 'lock', 'locked');
41324
- account['used'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(frozen, locked);
41417
+ const currencyId = this.safeStringN(entry, ['coinName', 'marginCoin', 'coin']);
41418
+ const code = this.safeCurrencyCode(currencyId);
41419
+ const borrow = this.safeString(entry, 'borrow');
41420
+ if (borrow !== undefined) {
41421
+ const interest = this.safeString(entry, 'interest');
41422
+ account['free'] = this.safeString(entry, 'transferable');
41423
+ account['total'] = this.safeString(entry, 'totalAmount');
41424
+ account['debt'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(borrow, interest);
41425
+ }
41426
+ else {
41427
+ // Use transferable instead of available for swap and margin https://github.com/ccxt/ccxt/pull/19127
41428
+ const spotAccountFree = this.safeString(entry, 'available');
41429
+ const contractAccountFree = this.safeString(entry, 'maxTransferOut');
41430
+ account['free'] = (contractAccountFree !== undefined) ? contractAccountFree : spotAccountFree;
41431
+ const frozen = this.safeString(entry, 'frozen');
41432
+ const locked = this.safeString2(entry, 'lock', 'locked');
41433
+ account['used'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(frozen, locked);
41434
+ }
41325
41435
  result[code] = account;
41326
41436
  }
41327
41437
  return this.safeBalance(result);
@@ -41484,6 +41594,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41484
41594
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#place-stop-order
41485
41595
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#place-position-tpsl
41486
41596
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#place-plan-order
41597
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-place-order
41598
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-place-order
41487
41599
  * @param {string} symbol unified symbol of the market to create an order in
41488
41600
  * @param {string} type 'market' or 'limit'
41489
41601
  * @param {string} side 'buy' or 'sell' or 'open_long' or 'open_short' or 'close_long' or 'close_short'
@@ -41498,13 +41610,23 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41498
41610
  * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
41499
41611
  * @param {float} [params.stopLoss.triggerPrice] *swap only* stop loss trigger price
41500
41612
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
41613
+ * @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
41614
+ * @param {string} [params.loanType] *spot margin only* 'normal', 'autoLoan', 'autoRepay', or 'autoLoanAndRepay' default is 'normal'
41501
41615
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
41502
41616
  */
41503
41617
  await this.loadMarkets();
41504
41618
  const market = this.market(symbol);
41505
- const [marketType, query] = this.handleMarketTypeAndParams('createOrder', market, params);
41619
+ let marketType = undefined;
41620
+ let marginMode = undefined;
41621
+ let response = undefined;
41622
+ [marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
41623
+ [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
41624
+ const marketId = market['id'];
41625
+ const parts = marketId.split('_');
41626
+ const marginMarketId = this.safeStringUpper(parts, 0);
41627
+ const symbolRequest = (marginMode !== undefined) ? marginMarketId : marketId;
41506
41628
  const request = {
41507
- 'symbol': market['id'],
41629
+ 'symbol': symbolRequest,
41508
41630
  'orderType': type,
41509
41631
  };
41510
41632
  const isMarketOrder = type === 'market';
@@ -41526,12 +41648,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41526
41648
  if ((type === 'limit') && (triggerPrice === undefined)) {
41527
41649
  request['price'] = this.priceToPrecision(symbol, price);
41528
41650
  }
41651
+ // default triggerType to market price for unification
41652
+ const triggerType = this.safeString(params, 'triggerType', 'market_price');
41653
+ const reduceOnly = this.safeValue(params, 'reduceOnly', false);
41529
41654
  const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
41530
- let method = this.getSupportedMapping(marketType, {
41531
- 'spot': 'privateSpotPostTradeOrders',
41532
- 'swap': 'privateMixPostOrderPlaceOrder',
41533
- 'future': 'privateMixPostOrderPlaceOrder',
41534
- });
41535
41655
  const exchangeSpecificTifParam = this.safeStringN(params, ['force', 'timeInForceValue', 'timeInForce']);
41536
41656
  let postOnly = undefined;
41537
41657
  [postOnly, params] = this.handlePostOnly(isMarketOrder, exchangeSpecificTifParam === 'post_only', params);
@@ -41539,55 +41659,33 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41539
41659
  const timeInForce = this.safeStringLower(params, 'timeInForce', defaultTimeInForce);
41540
41660
  let timeInForceKey = 'timeInForceValue';
41541
41661
  if (marketType === 'spot') {
41542
- if (isStopLossOrTakeProfitTrigger || isStopLossOrTakeProfit) {
41543
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' createOrder() does not support stop loss/take profit orders on spot markets, only swap markets');
41544
- }
41545
- timeInForceKey = 'force';
41546
- let quantityKey = 'quantity';
41547
- let quantity = undefined;
41548
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
41549
- if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
41550
- if (price === undefined) {
41551
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' createOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
41552
- }
41553
- else {
41554
- const amountString = this.numberToString(amount);
41555
- const priceString = this.numberToString(price);
41556
- const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(amountString, priceString));
41557
- quantity = this.priceToPrecision(symbol, cost);
41558
- }
41559
- }
41560
- else {
41561
- quantity = this.amountToPrecision(symbol, amount);
41562
- }
41563
- if (clientOrderId !== undefined) {
41564
- request['clientOrderId'] = clientOrderId;
41565
- }
41566
- request['side'] = side;
41567
- if (triggerPrice !== undefined) {
41568
- quantityKey = 'size';
41569
- timeInForceKey = 'timeInForceValue';
41570
- // default triggerType to market price for unification
41571
- const triggerType = this.safeString(params, 'triggerType', 'market_price');
41572
- request['triggerType'] = triggerType;
41573
- request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
41574
- if (price !== undefined) {
41575
- request['executePrice'] = this.priceToPrecision(symbol, price);
41576
- }
41577
- method = 'privateSpotPostPlanPlacePlan';
41662
+ if (marginMode !== undefined) {
41663
+ timeInForceKey = 'timeInForce';
41578
41664
  }
41579
- if (quantity !== undefined) {
41580
- request[quantityKey] = quantity;
41665
+ else if (triggerPrice === undefined) {
41666
+ timeInForceKey = 'force';
41581
41667
  }
41582
41668
  }
41583
- else {
41669
+ if (postOnly) {
41670
+ request[timeInForceKey] = 'post_only';
41671
+ }
41672
+ else if (timeInForce === 'gtc') {
41673
+ const gtcRequest = (marginMode !== undefined) ? 'gtc' : 'normal';
41674
+ request[timeInForceKey] = gtcRequest;
41675
+ }
41676
+ else if (timeInForce === 'fok') {
41677
+ request[timeInForceKey] = 'fok';
41678
+ }
41679
+ else if (timeInForce === 'ioc') {
41680
+ request[timeInForceKey] = 'ioc';
41681
+ }
41682
+ params = this.omit(params, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'postOnly', 'reduceOnly']);
41683
+ if ((marketType === 'swap') || (marketType === 'future')) {
41584
41684
  request['marginCoin'] = market['settleId'];
41585
41685
  if (clientOrderId !== undefined) {
41586
41686
  request['clientOid'] = clientOrderId;
41587
41687
  }
41588
41688
  if (isTriggerOrder || isStopLossOrTakeProfitTrigger) {
41589
- // default triggerType to market price for unification
41590
- const triggerType = this.safeString(params, 'triggerType', 'market_price');
41591
41689
  request['triggerType'] = triggerType;
41592
41690
  }
41593
41691
  if (isStopLossOrTakeProfitTrigger) {
@@ -41597,7 +41695,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41597
41695
  request['holdSide'] = (side === 'buy') ? 'long' : 'short';
41598
41696
  }
41599
41697
  else {
41600
- const reduceOnly = this.safeValue(params, 'reduceOnly', false);
41601
41698
  request['size'] = this.amountToPrecision(symbol, amount);
41602
41699
  if (reduceOnly) {
41603
41700
  request['side'] = (side === 'buy') ? 'close_short' : 'close_long';
@@ -41619,7 +41716,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41619
41716
  if (price !== undefined) {
41620
41717
  request['executePrice'] = this.priceToPrecision(symbol, price);
41621
41718
  }
41622
- method = 'privateMixPostPlanPlacePlan';
41719
+ response = await this.privateMixPostPlanPlacePlan(this.extend(request, params));
41623
41720
  }
41624
41721
  else if (isStopLossOrTakeProfitTrigger) {
41625
41722
  if (isStopLossTriggerOrder) {
@@ -41630,9 +41727,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41630
41727
  request['triggerPrice'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
41631
41728
  request['planType'] = 'pos_profit';
41632
41729
  }
41633
- method = 'privateMixPostPlanPlacePositionsTPSL';
41730
+ response = await this.privateMixPostPlanPlacePositionsTPSL(this.extend(request, params));
41634
41731
  }
41635
- else if (isStopLossOrTakeProfit) {
41732
+ else {
41636
41733
  if (isStopLoss) {
41637
41734
  const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice');
41638
41735
  request['presetStopLossPrice'] = this.priceToPrecision(symbol, slTriggerPrice);
@@ -41641,22 +41738,75 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41641
41738
  const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice');
41642
41739
  request['presetTakeProfitPrice'] = this.priceToPrecision(symbol, tpTriggerPrice);
41643
41740
  }
41741
+ response = await this.privateMixPostOrderPlaceOrder(this.extend(request, params));
41644
41742
  }
41645
41743
  }
41646
- if (postOnly) {
41647
- request[timeInForceKey] = 'post_only';
41648
- }
41649
- else if (timeInForce === 'gtc') {
41650
- request[timeInForceKey] = 'normal';
41651
- }
41652
- else if (timeInForce === 'fok') {
41653
- request[timeInForceKey] = 'fok';
41744
+ else if (marketType === 'spot') {
41745
+ if (isStopLossOrTakeProfitTrigger || isStopLossOrTakeProfit) {
41746
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' createOrder() does not support stop loss/take profit orders on spot markets, only swap markets');
41747
+ }
41748
+ let quantity = undefined;
41749
+ const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
41750
+ if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
41751
+ if (price === undefined) {
41752
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' createOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
41753
+ }
41754
+ else {
41755
+ const amountString = this.numberToString(amount);
41756
+ const priceString = this.numberToString(price);
41757
+ const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(amountString, priceString));
41758
+ quantity = this.priceToPrecision(symbol, cost);
41759
+ }
41760
+ }
41761
+ else {
41762
+ quantity = this.amountToPrecision(symbol, amount);
41763
+ }
41764
+ request['side'] = side;
41765
+ if (triggerPrice !== undefined) {
41766
+ if (quantity !== undefined) {
41767
+ request['size'] = quantity;
41768
+ }
41769
+ request['triggerType'] = triggerType;
41770
+ request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
41771
+ if (price !== undefined) {
41772
+ request['executePrice'] = this.priceToPrecision(symbol, price);
41773
+ }
41774
+ if (clientOrderId !== undefined) {
41775
+ request['clientOrderId'] = clientOrderId;
41776
+ }
41777
+ response = await this.privateSpotPostPlanPlacePlan(this.extend(request, params));
41778
+ }
41779
+ else if (marginMode !== undefined) {
41780
+ request['loanType'] = 'normal';
41781
+ if (clientOrderId !== undefined) {
41782
+ request['clientOid'] = clientOrderId;
41783
+ }
41784
+ if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
41785
+ request['quoteAmount'] = quantity;
41786
+ }
41787
+ else {
41788
+ request['baseQuantity'] = quantity;
41789
+ }
41790
+ if (marginMode === 'isolated') {
41791
+ response = await this.privateMarginPostIsolatedOrderPlaceOrder(this.extend(request, params));
41792
+ }
41793
+ else if (marginMode === 'cross') {
41794
+ response = await this.privateMarginPostCrossOrderPlaceOrder(this.extend(request, params));
41795
+ }
41796
+ }
41797
+ else {
41798
+ if (clientOrderId !== undefined) {
41799
+ request['clientOrderId'] = clientOrderId;
41800
+ }
41801
+ if (quantity !== undefined) {
41802
+ request['quantity'] = quantity;
41803
+ }
41804
+ response = await this.privateSpotPostTradeOrders(this.extend(request, params));
41805
+ }
41654
41806
  }
41655
- else if (timeInForce === 'ioc') {
41656
- request[timeInForceKey] = 'ioc';
41807
+ else {
41808
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrder() does not support ' + marketType + ' orders');
41657
41809
  }
41658
- const omitted = this.omit(query, ['stopPrice', 'triggerType', 'stopLossPrice', 'takeProfitPrice', 'stopLoss', 'takeProfit', 'postOnly', 'reduceOnly']);
41659
- const response = await this[method](this.extend(request, omitted));
41660
41810
  //
41661
41811
  // {
41662
41812
  // "code": "00000",
@@ -41668,7 +41818,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
41668
41818
  // }
41669
41819
  // }
41670
41820
  //
41671
- const data = this.safeValue(response, 'data');
41821
+ const data = this.safeValue(response, 'data', {});
41672
41822
  return this.parseOrder(data, market);
41673
41823
  }
41674
41824
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
@@ -42523,7 +42673,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42523
42673
  if (since !== undefined) {
42524
42674
  request['before'] = since;
42525
42675
  }
42526
- [request, params] = this.handleUntilOption('after', params, request);
42676
+ [request, params] = this.handleUntilOption('after', request, params);
42527
42677
  const response = await this.privateSpotPostAccountBills(this.extend(request, params));
42528
42678
  //
42529
42679
  // {
@@ -42640,7 +42790,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42640
42790
  else if (orderId === undefined) {
42641
42791
  request['startTime'] = 0;
42642
42792
  }
42643
- [request, params] = this.handleUntilOption('endTime', params, request);
42793
+ [request, params] = this.handleUntilOption('endTime', request, params);
42644
42794
  if (!('endTime' in request) && (orderId === undefined)) {
42645
42795
  request['endTime'] = this.milliseconds();
42646
42796
  }
@@ -43554,7 +43704,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
43554
43704
  if (limit !== undefined) {
43555
43705
  request['limit'] = limit;
43556
43706
  }
43557
- [request, params] = this.handleUntilOption('after', params, request);
43707
+ [request, params] = this.handleUntilOption('after', request, params);
43558
43708
  const response = await this.privateSpotGetAccountTransferRecords(this.extend(request, params));
43559
43709
  //
43560
43710
  // {
@@ -49964,6 +50114,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
49964
50114
  'max': positionIsQuote ? maxOrderQty : undefined,
49965
50115
  },
49966
50116
  },
50117
+ 'created': this.parse8601(this.safeString(market, 'listing')),
49967
50118
  'info': market,
49968
50119
  });
49969
50120
  }
@@ -50344,6 +50495,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
50344
50495
  'Deposit': 'transaction',
50345
50496
  'Transfer': 'transfer',
50346
50497
  'AffiliatePayout': 'referral',
50498
+ 'SpotTrade': 'trade',
50347
50499
  };
50348
50500
  return this.safeString(types, type, type);
50349
50501
  }
@@ -50881,9 +51033,9 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
50881
51033
  const feeCurrencyCode = this.safeCurrencyCode(currencyId);
50882
51034
  const feeRateString = this.safeString(trade, 'commission');
50883
51035
  fee = {
50884
- 'cost': feeCostString,
51036
+ 'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(feeCostString),
50885
51037
  'currency': feeCurrencyCode,
50886
- 'rate': feeRateString,
51038
+ 'rate': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(feeRateString),
50887
51039
  };
50888
51040
  }
50889
51041
  // Trade or Funding
@@ -51411,7 +51563,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
51411
51563
  // }
51412
51564
  // ]
51413
51565
  //
51414
- return this.parsePositions(response, symbols);
51566
+ const results = this.parsePositions(response, symbols);
51567
+ return this.filterByArrayPositions(results, 'symbol', symbols, false);
51415
51568
  }
51416
51569
  parsePosition(position, market = undefined) {
51417
51570
  //
@@ -62609,6 +62762,7 @@ class bittrex extends _abstract_bittrex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
62609
62762
  'max': undefined,
62610
62763
  },
62611
62764
  },
62765
+ 'created': this.parse8601(this.safeString(market, 'createdAt')),
62612
62766
  'info': market,
62613
62767
  });
62614
62768
  }
@@ -68418,7 +68572,8 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
68418
68572
  // sell: '22521.11'
68419
68573
  // }
68420
68574
  //
68421
- const timestamp = this.safeIntegerProduct(ticker, 'timestamp', 1000000);
68575
+ const timestampStr = this.safeString(ticker, 'timestamp');
68576
+ const timestamp = parseInt(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(timestampStr, '1000000'));
68422
68577
  const marketId = this.safeString(ticker, 'pair');
68423
68578
  market = this.safeMarket(marketId, market, '_');
68424
68579
  const last = this.safeString(ticker, 'last');
@@ -71541,6 +71696,7 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
71541
71696
  'orderbook': 1,
71542
71697
  'ticker': 0.1,
71543
71698
  'trades': 1,
71699
+ 'ohlc': 1,
71544
71700
  'server/exchangeinfo': 1,
71545
71701
  },
71546
71702
  },
@@ -71552,6 +71708,8 @@ class btcturk extends _abstract_btcturk_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
71552
71708
  'users/transactions/trade': 1,
71553
71709
  },
71554
71710
  'post': {
71711
+ 'users/transactions/crypto': 1,
71712
+ 'users/transactions/fiat': 1,
71555
71713
  'order': 1,
71556
71714
  'cancelOrder': 1,
71557
71715
  },
@@ -75923,9 +76081,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75923
76081
  let fee = undefined;
75924
76082
  const feeCostString = this.safeString(order, 'cumExecFee');
75925
76083
  if (feeCostString !== undefined) {
76084
+ let feeCurrency = undefined;
76085
+ if (market['spot']) {
76086
+ feeCurrency = (side === 'buy') ? market['quote'] : market['base'];
76087
+ }
76088
+ else {
76089
+ feeCurrency = market['settle'];
76090
+ }
75926
76091
  fee = {
75927
76092
  'cost': feeCostString,
75928
- 'currency': market['settle'],
76093
+ 'currency': feeCurrency,
75929
76094
  };
75930
76095
  }
75931
76096
  let clientOrderId = this.safeString(order, 'orderLinkId');
@@ -76011,7 +76176,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76011
76176
  const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
76012
76177
  const length = result.length;
76013
76178
  if (length === 0) {
76014
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound('Order ' + id + ' does not exist.');
76179
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.OrderNotFound('Order ' + id.toString() + ' does not exist.');
76015
76180
  }
76016
76181
  if (length > 1) {
76017
76182
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' returned more than one order');
@@ -94879,10 +95044,19 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
94879
95044
  const id = this.safeString(order, 'orderId');
94880
95045
  const baseId = this.safeString(order, 'baseCurrency');
94881
95046
  const quoteId = this.safeString(order, 'targetCurrency');
94882
- const base = this.safeCurrencyCode(baseId, market['base']);
94883
- const quote = this.safeCurrencyCode(quoteId, market['quote']);
94884
- const symbol = base + '/' + quote;
94885
- market = this.safeMarket(symbol, market, '/');
95047
+ let base = undefined;
95048
+ let quote = undefined;
95049
+ if (baseId !== undefined) {
95050
+ base = this.safeCurrencyCode(baseId, this.safeString(market, 'base'));
95051
+ }
95052
+ if (quoteId !== undefined) {
95053
+ quote = this.safeCurrencyCode(quoteId, this.safeString(market, 'quote'));
95054
+ }
95055
+ let symbol = undefined;
95056
+ if ((base !== undefined) && (quote !== undefined)) {
95057
+ symbol = base + '/' + quote;
95058
+ market = this.safeMarket(symbol, market, '/');
95059
+ }
94886
95060
  const timestamp = this.safeTimestamp2(order, 'timestamp', 'updatedAt');
94887
95061
  let side = this.safeString2(order, 'type', 'side');
94888
95062
  if (side === 'ask') {
@@ -111751,14 +111925,16 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
111751
111925
  // "leverage_ratio": 3
111752
111926
  // }
111753
111927
  //
111754
- const symbol = this.safeString(info, 'symbol');
111928
+ const marketId = this.safeString(info, 'symbol');
111755
111929
  const amountString = this.safeString(info, 'amount');
111756
111930
  const leverageString = this.safeString(info, 'leverage_ratio');
111757
111931
  const amountInvested = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(amountString, leverageString);
111758
111932
  const amountBorrowed = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(amountString, amountInvested);
111759
111933
  const currency = (market === undefined) ? undefined : market['base'];
111934
+ const symbol = this.safeSymbol(marketId, market);
111760
111935
  return {
111761
- 'account': this.safeSymbol(symbol, market),
111936
+ 'account': symbol,
111937
+ 'symbol': symbol,
111762
111938
  'currency': currency,
111763
111939
  'interest': undefined,
111764
111940
  'interestRate': 0.001,
@@ -112238,10 +112414,9 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
112238
112414
  return position;
112239
112415
  }
112240
112416
  else {
112241
- return this.extend(position, {
112242
- 'collateral': this.safeNumber(response, 'margin'),
112243
- 'marginRatio': this.safeNumber(response, 'margin_rate'),
112244
- });
112417
+ position['collateral'] = this.safeNumber(response, 'margin');
112418
+ position['marginRatio'] = this.safeNumber(response, 'margin_rate');
112419
+ return position;
112245
112420
  }
112246
112421
  }
112247
112422
  parsePosition(position, market = undefined) {
@@ -112301,7 +112476,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
112301
112476
  else if (side === 'go_short') {
112302
112477
  side = 'short';
112303
112478
  }
112304
- return {
112479
+ return this.safePosition({
112305
112480
  'info': position,
112306
112481
  'id': undefined,
112307
112482
  'symbol': symbol,
@@ -112327,7 +112502,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
112327
112502
  'percentage': undefined,
112328
112503
  'stopLossPrice': undefined,
112329
112504
  'takeProfitPrice': undefined,
112330
- };
112505
+ });
112331
112506
  }
112332
112507
  async setLeverage(leverage, symbol = undefined, params = {}) {
112333
112508
  /**
@@ -116945,7 +117120,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
116945
117120
  'max': undefined,
116946
117121
  },
116947
117122
  },
116948
- 'created': this.safeIntegerProduct(market, 'create_time', 1000),
117123
+ 'created': this.safeTimestamp(market, 'create_time'),
116949
117124
  'info': market,
116950
117125
  });
116951
117126
  }
@@ -121376,7 +121551,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121376
121551
  // lsr_taker: '9.3765153315902'
121377
121552
  // }
121378
121553
  //
121379
- const timestamp = this.safeIntegerProduct(interest, 'time', 1000);
121554
+ const timestamp = this.safeTimestamp(interest, 'time');
121380
121555
  return {
121381
121556
  'symbol': this.safeString(market, 'symbol'),
121382
121557
  'openInterestAmount': this.safeNumber(interest, 'open_interest'),
@@ -130657,6 +130832,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
130657
130832
  // 7 Settlement Completed
130658
130833
  // 8 Delivered
130659
130834
  // 9 Suspending of Trade
130835
+ let created = undefined;
130836
+ let createdDate = this.safeString(market, 'create_date'); // i.e 20230101
130837
+ if (createdDate !== undefined) {
130838
+ const createdArray = this.stringToCharsArray(createdDate);
130839
+ createdDate = createdArray[0] + createdArray[1] + createdArray[2] + createdArray[3] + '-' + createdArray[4] + createdArray[5] + '-' + createdArray[6] + createdArray[7] + ' 00:00:00';
130840
+ created = this.parse8601(createdDate);
130841
+ }
130660
130842
  result.push({
130661
130843
  'id': id,
130662
130844
  'lowercaseId': lowercaseId,
@@ -130709,6 +130891,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
130709
130891
  'max': undefined,
130710
130892
  },
130711
130893
  },
130894
+ 'created': created,
130712
130895
  'info': market,
130713
130896
  });
130714
130897
  }
@@ -143328,6 +143511,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
143328
143511
  'max': undefined,
143329
143512
  },
143330
143513
  },
143514
+ 'created': undefined,
143331
143515
  'info': market,
143332
143516
  });
143333
143517
  }
@@ -143783,7 +143967,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
143783
143967
  else {
143784
143968
  direction = 'in';
143785
143969
  }
143786
- const timestamp = this.safeIntegerProduct(item, 'time', 1000);
143970
+ const timestamp = this.safeTimestamp(item, 'time');
143787
143971
  return {
143788
143972
  'info': item,
143789
143973
  'id': id,
@@ -148700,6 +148884,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
148700
148884
  'max': this.safeNumber(market, 'quoteMaxSize'),
148701
148885
  },
148702
148886
  },
148887
+ 'created': undefined,
148703
148888
  'info': market,
148704
148889
  });
148705
148890
  }
@@ -152470,6 +152655,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
152470
152655
  'max': this.safeNumber(market, 'quoteMaxSize'),
152471
152656
  },
152472
152657
  },
152658
+ 'created': this.safeInteger(market, 'firstOpenDate'),
152473
152659
  'info': market,
152474
152660
  });
152475
152661
  }
@@ -154817,6 +155003,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
154817
155003
  'max': undefined,
154818
155004
  },
154819
155005
  },
155006
+ 'created': undefined,
154820
155007
  'info': undefined,
154821
155008
  });
154822
155009
  }
@@ -157335,6 +157522,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
157335
157522
  'max': undefined,
157336
157523
  },
157337
157524
  },
157525
+ 'created': undefined,
157338
157526
  'info': id,
157339
157527
  });
157340
157528
  }
@@ -158425,6 +158613,7 @@ class lbank2 extends _abstract_lbank2_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
158425
158613
  'max': undefined,
158426
158614
  },
158427
158615
  },
158616
+ 'created': undefined,
158428
158617
  'info': market,
158429
158618
  });
158430
158619
  }
@@ -158521,6 +158710,7 @@ class lbank2 extends _abstract_lbank2_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
158521
158710
  'max': undefined,
158522
158711
  },
158523
158712
  },
158713
+ 'created': undefined,
158524
158714
  'info': market,
158525
158715
  });
158526
158716
  }
@@ -161026,6 +161216,7 @@ class luno extends _abstract_luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
161026
161216
  'max': undefined,
161027
161217
  },
161028
161218
  },
161219
+ 'created': undefined,
161029
161220
  'info': market,
161030
161221
  });
161031
161222
  }
@@ -162147,7 +162338,6 @@ class lykke extends _abstract_lykke_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
162147
162338
  'option': false,
162148
162339
  'contract': false,
162149
162340
  'active': true,
162150
- 'info': market,
162151
162341
  'linear': undefined,
162152
162342
  'inverse': undefined,
162153
162343
  'contractSize': undefined,
@@ -162177,6 +162367,8 @@ class lykke extends _abstract_lykke_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
162177
162367
  'max': undefined,
162178
162368
  },
162179
162369
  },
162370
+ 'created': undefined,
162371
+ 'info': market,
162180
162372
  });
162181
162373
  }
162182
162374
  return result;
@@ -163368,6 +163560,7 @@ class mercado extends _abstract_mercado_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
163368
163560
  'max': undefined,
163369
163561
  },
163370
163562
  },
163563
+ 'created': undefined,
163371
163564
  'info': coin,
163372
163565
  });
163373
163566
  }
@@ -165198,6 +165391,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
165198
165391
  'max': maxQuoteAmount,
165199
165392
  },
165200
165393
  },
165394
+ 'created': undefined,
165201
165395
  'info': market,
165202
165396
  });
165203
165397
  }
@@ -165309,6 +165503,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
165309
165503
  'max': undefined,
165310
165504
  },
165311
165505
  },
165506
+ 'created': undefined,
165312
165507
  'info': market,
165313
165508
  });
165314
165509
  }
@@ -166771,7 +166966,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
166771
166966
  }
166772
166967
  const [marketType] = this.handleMarketTypeAndParams('fetchOrdersByState', market, params);
166773
166968
  if (marketType === 'spot') {
166774
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOrdersByState() is not supported for ' + marketType);
166969
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrdersByState() is not supported for ' + marketType);
166775
166970
  }
166776
166971
  else {
166777
166972
  request['states'] = state;
@@ -168076,6 +168271,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
168076
168271
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
168077
168272
  */
168078
168273
  await this.loadMarkets();
168274
+ symbols = this.marketSymbols(symbols, 'swap', true, true);
168079
168275
  const response = await this.contractPublicGetDetail(params);
168080
168276
  //
168081
168277
  // {
@@ -169909,6 +170105,7 @@ class ndax extends _abstract_ndax_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
169909
170105
  'max': undefined,
169910
170106
  },
169911
170107
  },
170108
+ 'created': undefined,
169912
170109
  'info': market,
169913
170110
  });
169914
170111
  }
@@ -172153,6 +172350,7 @@ class novadax extends _abstract_novadax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
172153
172350
  'max': undefined,
172154
172351
  },
172155
172352
  },
172353
+ 'created': undefined,
172156
172354
  'info': market,
172157
172355
  });
172158
172356
  }
@@ -173631,6 +173829,7 @@ class oceanex extends _abstract_oceanex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
173631
173829
  'max': undefined,
173632
173830
  },
173633
173831
  },
173832
+ 'created': undefined,
173634
173833
  'info': market,
173635
173834
  });
173636
173835
  }
@@ -182221,7 +182420,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
182221
182420
  market = this.market(symbol);
182222
182421
  request['instId'] = market['id'];
182223
182422
  }
182224
- [request, params] = this.handleUntilOption('end', params, request);
182423
+ [request, params] = this.handleUntilOption('end', request, params);
182225
182424
  const [type, query] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
182226
182425
  request['instType'] = this.convertToInstrumentType(type);
182227
182426
  if (limit !== undefined) {
@@ -182340,7 +182539,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
182340
182539
  currency = this.currency(code);
182341
182540
  request['ccy'] = currency['id'];
182342
182541
  }
182343
- [request, params] = this.handleUntilOption('end', params, request);
182542
+ [request, params] = this.handleUntilOption('end', request, params);
182344
182543
  const response = await this[method](this.extend(request, query));
182345
182544
  //
182346
182545
  // privateGetAccountBills, privateGetAccountBillsArchive
@@ -182783,7 +182982,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
182783
182982
  if (limit !== undefined) {
182784
182983
  request['limit'] = limit; // default 100, max 100
182785
182984
  }
182786
- [request, params] = this.handleUntilOption('after', params, request);
182985
+ [request, params] = this.handleUntilOption('after', request, params);
182787
182986
  const response = await this.privateGetAssetDepositHistory(this.extend(request, params));
182788
182987
  //
182789
182988
  // {
@@ -186418,6 +186617,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
186418
186617
  'max': this.parseNumber(this.safeString(market, 'maxOrderQty')),
186419
186618
  },
186420
186619
  },
186620
+ 'created': undefined,
186421
186621
  'info': market,
186422
186622
  };
186423
186623
  }
@@ -186516,6 +186716,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
186516
186716
  'max': this.parseSafeNumber(this.safeString(market, 'maxOrderValue')),
186517
186717
  },
186518
186718
  },
186719
+ 'created': undefined,
186519
186720
  'info': market,
186520
186721
  };
186521
186722
  }
@@ -222178,7 +222379,7 @@ class hollaex extends _hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
222178
222379
  const messageHash = this.safeString(message, 'topic');
222179
222380
  const data = this.safeValue(message, 'data');
222180
222381
  const keys = Object.keys(data);
222181
- const timestamp = this.safeIntegerProduct(message, 'time', 1000);
222382
+ const timestamp = this.safeTimestamp(message, 'time');
222182
222383
  this.balance['info'] = data;
222183
222384
  this.balance['timestamp'] = timestamp;
222184
222385
  this.balance['datetime'] = this.iso8601(timestamp);
@@ -231386,7 +231587,7 @@ class mexc extends _mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
231386
231587
  // }
231387
231588
  //
231388
231589
  return [
231389
- this.safeIntegerProduct(ohlcv, 't', 1000),
231590
+ this.safeTimestamp(ohlcv, 't'),
231390
231591
  this.safeNumber(ohlcv, 'o'),
231391
231592
  this.safeNumber(ohlcv, 'h'),
231392
231593
  this.safeNumber(ohlcv, 'l'),
@@ -242309,6 +242510,7 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
242309
242510
  'max': this.safeNumber(market, 'max_cost'),
242310
242511
  },
242311
242512
  },
242513
+ 'created': undefined,
242312
242514
  'info': market,
242313
242515
  });
242314
242516
  }
@@ -253068,6 +253270,7 @@ class tidex extends _abstract_tidex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
253068
253270
  'max': undefined,
253069
253271
  },
253070
253272
  },
253273
+ 'created': undefined,
253071
253274
  'info': market,
253072
253275
  });
253073
253276
  }
@@ -255041,6 +255244,7 @@ class timex extends _abstract_timex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
255041
255244
  'max': undefined,
255042
255245
  },
255043
255246
  },
255247
+ 'created': undefined,
255044
255248
  'info': market,
255045
255249
  };
255046
255250
  }
@@ -256114,6 +256318,7 @@ class tokocrypto extends _abstract_tokocrypto_js__WEBPACK_IMPORTED_MODULE_0__/*
256114
256318
  'max': undefined,
256115
256319
  },
256116
256320
  },
256321
+ 'created': undefined,
256117
256322
  'info': market,
256118
256323
  };
256119
256324
  if ('PRICE_FILTER' in filtersByType) {
@@ -258384,6 +258589,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
258384
258589
  'max': undefined,
258385
258590
  },
258386
258591
  },
258592
+ 'created': undefined,
258387
258593
  'info': market,
258388
258594
  });
258389
258595
  }
@@ -260334,6 +260540,7 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
260334
260540
  'max': undefined,
260335
260541
  },
260336
260542
  },
260543
+ 'created': undefined,
260337
260544
  'info': entry,
260338
260545
  });
260339
260546
  }
@@ -262630,6 +262837,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
262630
262837
  'max': undefined,
262631
262838
  },
262632
262839
  },
262840
+ 'created': undefined,
262633
262841
  'info': market,
262634
262842
  });
262635
262843
  }
@@ -262958,7 +263166,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
262958
263166
  }, market);
262959
263167
  }
262960
263168
  parseBalance(response) {
262961
- const result = {};
263169
+ const result = { 'info': response };
262962
263170
  for (let i = 0; i < response.length; i++) {
262963
263171
  const balance = response[i];
262964
263172
  const id = this.safeString(balance, 'asset');
@@ -263686,6 +263894,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
263686
263894
  'max': this.safeNumber(market, 'maxTotal'),
263687
263895
  },
263688
263896
  },
263897
+ 'created': undefined,
263689
263898
  'info': market,
263690
263899
  };
263691
263900
  result.push(entry);
@@ -264162,7 +264371,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
264162
264371
  // ]
264163
264372
  // }
264164
264373
  //
264165
- const timestamp = this.safeIntegerProduct(response, 'timestamp', 1000);
264374
+ const timestamp = this.safeTimestamp(response, 'timestamp');
264166
264375
  return this.parseOrderBook(response, symbol, timestamp);
264167
264376
  }
264168
264377
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -265985,7 +266194,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
265985
266194
  'max': undefined,
265986
266195
  },
265987
266196
  },
265988
- 'created': this.safeIntegerProduct(market, 'created_time', 1000),
266197
+ 'created': this.safeTimestamp(market, 'created_time'),
265989
266198
  'info': market,
265990
266199
  });
265991
266200
  }
@@ -268638,6 +268847,7 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
268638
268847
  'max': undefined,
268639
268848
  },
268640
268849
  },
268850
+ 'created': undefined,
268641
268851
  'info': market,
268642
268852
  });
268643
268853
  }
@@ -269767,6 +269977,7 @@ class zaif extends _abstract_zaif_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
269767
269977
  'max': undefined,
269768
269978
  },
269769
269979
  },
269980
+ 'created': undefined,
269770
269981
  'info': market,
269771
269982
  });
269772
269983
  }
@@ -270675,6 +270886,7 @@ class zonda extends _abstract_zonda_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
270675
270886
  'max': undefined,
270676
270887
  },
270677
270888
  },
270889
+ 'created': undefined,
270678
270890
  'info': item,
270679
270891
  });
270680
270892
  }
@@ -277735,7 +277947,7 @@ SOFTWARE.
277735
277947
 
277736
277948
  //-----------------------------------------------------------------------------
277737
277949
  // this is updated by vss.js when building
277738
- const version = '4.1.14';
277950
+ const version = '4.1.17';
277739
277951
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
277740
277952
  //-----------------------------------------------------------------------------
277741
277953