ccxt 4.4.69 → 4.4.70

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.
@@ -249,6 +249,8 @@ class bybit extends bybit$1 {
249
249
  // institutional lending
250
250
  'v5/ins-loan/product-infos': 5,
251
251
  'v5/ins-loan/ensure-tokens-convert': 5,
252
+ // earn
253
+ 'v5/earn/product': 5,
252
254
  },
253
255
  },
254
256
  'private': {
@@ -407,6 +409,9 @@ class bybit extends bybit$1 {
407
409
  'v5/broker/earnings-info': 5,
408
410
  'v5/broker/account-info': 5,
409
411
  'v5/broker/asset/query-sub-member-deposit-record': 10,
412
+ // earn
413
+ 'v5/earn/order': 5,
414
+ 'v5/earn/position': 5,
410
415
  },
411
416
  'post': {
412
417
  // spot
@@ -542,6 +547,8 @@ class bybit extends bybit$1 {
542
547
  'v5/broker/award/info': 5,
543
548
  'v5/broker/award/distribute-award': 5,
544
549
  'v5/broker/award/distribution-record': 5,
550
+ // earn
551
+ 'v5/earn/place-order': 5,
545
552
  },
546
553
  },
547
554
  },
@@ -325,6 +325,7 @@ class coinbase extends coinbase$1 {
325
325
  'INSUFFICIENT_FUND': errors.BadRequest,
326
326
  'PERMISSION_DENIED': errors.PermissionDenied,
327
327
  'INVALID_ARGUMENT': errors.BadRequest,
328
+ 'PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE': errors.InvalidOrder,
328
329
  },
329
330
  'broad': {
330
331
  'request timestamp expired': errors.InvalidNonce,
@@ -5083,20 +5084,39 @@ class coinbase extends coinbase$1 {
5083
5084
  // ]
5084
5085
  // }
5085
5086
  // or
5086
- // {
5087
+ // {
5088
+ // "success": false,
5089
+ // "error_response": {
5087
5090
  // "error": "UNKNOWN_FAILURE_REASON",
5088
5091
  // "message": "",
5089
5092
  // "error_details": "",
5090
- // "preview_failure_reason": "PREVIEW_STOP_PRICE_BELOW_LAST_TRADE_PRICE"
5091
- // }
5093
+ // "preview_failure_reason": "PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE"
5094
+ // },
5095
+ // "order_configuration": {
5096
+ // "stop_limit_stop_limit_gtc": {
5097
+ // "base_size": "0.0001",
5098
+ // "limit_price": "2000",
5099
+ // "stop_price": "2005",
5100
+ // "stop_direction": "STOP_DIRECTION_STOP_DOWN",
5101
+ // "reduce_only": false
5102
+ // }
5103
+ // }
5104
+ // }
5092
5105
  //
5093
5106
  let errorCode = this.safeString(response, 'error');
5094
5107
  if (errorCode !== undefined) {
5095
- const errorMessage = this.safeString2(response, 'error_description', 'preview_failure_reason');
5108
+ const errorMessage = this.safeString2(response, 'error_description', 'error');
5096
5109
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
5097
5110
  this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
5098
5111
  throw new errors.ExchangeError(feedback);
5099
5112
  }
5113
+ const errorResponse = this.safeDict(response, 'error_response');
5114
+ if (errorResponse !== undefined) {
5115
+ const errorMessageInner = this.safeString2(errorResponse, 'preview_failure_reason', 'preview_failure_reason');
5116
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorMessageInner, feedback);
5117
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessageInner, feedback);
5118
+ throw new errors.ExchangeError(feedback);
5119
+ }
5100
5120
  const errors$1 = this.safeList(response, 'errors');
5101
5121
  if (errors$1 !== undefined) {
5102
5122
  if (Array.isArray(errors$1)) {
@@ -1810,12 +1810,13 @@ class hyperliquid extends hyperliquid$1 {
1810
1810
  const isTrigger = (stopLossPrice || takeProfitPrice);
1811
1811
  const reduceOnly = this.safeBool(orderParams, 'reduceOnly', false);
1812
1812
  orderParams = this.omit(orderParams, ['slippage', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'clientOrderId', 'client_id', 'postOnly', 'reduceOnly']);
1813
- let px = price.toString();
1813
+ let px = this.numberToString(price);
1814
1814
  if (isMarket) {
1815
- px = (isBuy) ? Precise["default"].stringMul(price.toString(), Precise["default"].stringAdd('1', slippage)) : Precise["default"].stringMul(price.toString(), Precise["default"].stringSub('1', slippage));
1815
+ px = (isBuy) ? Precise["default"].stringMul(px, Precise["default"].stringAdd('1', slippage)) : Precise["default"].stringMul(px, Precise["default"].stringSub('1', slippage));
1816
+ px = this.priceToPrecision(symbol, px);
1816
1817
  }
1817
1818
  else {
1818
- px = this.priceToPrecision(symbol, price.toString());
1819
+ px = this.priceToPrecision(symbol, px);
1819
1820
  }
1820
1821
  const sz = this.amountToPrecision(symbol, amount);
1821
1822
  const orderType = {};
@@ -2327,6 +2328,11 @@ class hyperliquid extends hyperliquid$1 {
2327
2328
  }
2328
2329
  const totalAmount = this.safeString2(entry, 'origSz', 'totalSz');
2329
2330
  const remaining = this.safeString(entry, 'sz');
2331
+ const tif = this.safeStringUpper(entry, 'tif');
2332
+ let postOnly = undefined;
2333
+ if (tif !== undefined) {
2334
+ postOnly = (tif === 'ALO');
2335
+ }
2330
2336
  return this.safeOrder({
2331
2337
  'info': order,
2332
2338
  'id': this.safeString(entry, 'oid'),
@@ -2337,8 +2343,8 @@ class hyperliquid extends hyperliquid$1 {
2337
2343
  'lastUpdateTimestamp': this.safeInteger(order, 'statusTimestamp'),
2338
2344
  'symbol': symbol,
2339
2345
  'type': this.parseOrderType(this.safeStringLower(entry, 'orderType')),
2340
- 'timeInForce': this.safeStringUpper(entry, 'tif'),
2341
- 'postOnly': undefined,
2346
+ 'timeInForce': tif,
2347
+ 'postOnly': postOnly,
2342
2348
  'reduceOnly': this.safeBool(entry, 'reduceOnly'),
2343
2349
  'side': side,
2344
2350
  'price': this.safeString(entry, 'limitPx'),
@@ -2460,6 +2466,11 @@ class hyperliquid extends hyperliquid$1 {
2460
2466
  side = (side === 'A') ? 'sell' : 'buy';
2461
2467
  }
2462
2468
  const fee = this.safeString(trade, 'fee');
2469
+ let takerOrMaker = undefined;
2470
+ const crossed = this.safeBool(trade, 'crossed');
2471
+ if (crossed !== undefined) {
2472
+ takerOrMaker = crossed ? 'taker' : 'maker';
2473
+ }
2463
2474
  return this.safeTrade({
2464
2475
  'info': trade,
2465
2476
  'timestamp': timestamp,
@@ -2469,7 +2480,7 @@ class hyperliquid extends hyperliquid$1 {
2469
2480
  'order': this.safeString(trade, 'oid'),
2470
2481
  'type': undefined,
2471
2482
  'side': side,
2472
- 'takerOrMaker': undefined,
2483
+ 'takerOrMaker': takerOrMaker,
2473
2484
  'price': price,
2474
2485
  'amount': amount,
2475
2486
  'cost': undefined,
@@ -3043,7 +3054,7 @@ class hyperliquid extends hyperliquid$1 {
3043
3054
  'tagTo': undefined,
3044
3055
  'tagFrom': undefined,
3045
3056
  'type': undefined,
3046
- 'amount': this.safeInteger(delta, 'usdc'),
3057
+ 'amount': this.safeNumber(delta, 'usdc'),
3047
3058
  'currency': undefined,
3048
3059
  'status': this.safeString(transaction, 'status'),
3049
3060
  'updated': undefined,
@@ -307,7 +307,9 @@ class okx extends okx$1 {
307
307
  'trade/easy-convert-currency-list': 20,
308
308
  'trade/easy-convert-history': 20,
309
309
  'trade/one-click-repay-currency-list': 20,
310
+ 'trade/one-click-repay-currency-list-v2': 20,
310
311
  'trade/one-click-repay-history': 20,
312
+ 'trade/one-click-repay-history-v2': 20,
311
313
  'trade/account-rate-limit': 1,
312
314
  // asset
313
315
  'asset/currencies': 5 / 3,
@@ -464,6 +466,7 @@ class okx extends okx$1 {
464
466
  'trade/cancel-advance-algos': 1,
465
467
  'trade/easy-convert': 20,
466
468
  'trade/one-click-repay': 20,
469
+ 'trade/one-click-repay-v2': 20,
467
470
  'trade/mass-cancel': 4,
468
471
  'trade/cancel-all-after': 10,
469
472
  // asset
@@ -3159,6 +3162,7 @@ class okx extends okx$1 {
3159
3162
  * @param {string} [params.trailingPercent] the percent to trail away from the current market price
3160
3163
  * @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
3161
3164
  * @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
3165
+ * @param {string} [params.marginMode] 'cross' or 'isolated', the default is 'cross'
3162
3166
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3163
3167
  */
3164
3168
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -45,6 +45,10 @@ class bitget extends bitget$1 {
45
45
  'public': 'wss://ws.bitget.com/v2/ws/public',
46
46
  'private': 'wss://ws.bitget.com/v2/ws/private',
47
47
  },
48
+ 'demo': {
49
+ 'public': 'wss://wspap.bitget.com/v2/ws/public',
50
+ 'private': 'wss://wspap.bitget.com/v2/ws/private',
51
+ },
48
52
  },
49
53
  },
50
54
  'options': {
@@ -1165,7 +1169,7 @@ class bitget extends bitget$1 {
1165
1169
  else {
1166
1170
  [instType, params] = this.getInstType(market, params);
1167
1171
  }
1168
- if (type === 'spot') {
1172
+ if (type === 'spot' && (symbol !== undefined)) {
1169
1173
  subscriptionHash = subscriptionHash + ':' + symbol;
1170
1174
  }
1171
1175
  if (isTrigger) {
@@ -1779,7 +1783,14 @@ class bitget extends bitget$1 {
1779
1783
  client.resolve(this.balance, messageHash);
1780
1784
  }
1781
1785
  async watchPublic(messageHash, args, params = {}) {
1782
- const url = this.urls['api']['ws']['public'];
1786
+ let url = this.urls['api']['ws']['public'];
1787
+ const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1788
+ if (sandboxMode) {
1789
+ const instType = this.safeString(args, 'instType');
1790
+ if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1791
+ url = this.urls['api']['demo']['public'];
1792
+ }
1793
+ }
1783
1794
  const request = {
1784
1795
  'op': 'subscribe',
1785
1796
  'args': [args],
@@ -1788,7 +1799,14 @@ class bitget extends bitget$1 {
1788
1799
  return await this.watch(url, messageHash, message, messageHash);
1789
1800
  }
1790
1801
  async unWatchPublic(messageHash, args, params = {}) {
1791
- const url = this.urls['api']['ws']['public'];
1802
+ let url = this.urls['api']['ws']['public'];
1803
+ const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1804
+ if (sandboxMode) {
1805
+ const instType = this.safeString(args, 'instType');
1806
+ if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1807
+ url = this.urls['api']['demo']['public'];
1808
+ }
1809
+ }
1792
1810
  const request = {
1793
1811
  'op': 'unsubscribe',
1794
1812
  'args': [args],
@@ -1797,7 +1815,15 @@ class bitget extends bitget$1 {
1797
1815
  return await this.watch(url, messageHash, message, messageHash);
1798
1816
  }
1799
1817
  async watchPublicMultiple(messageHashes, argsArray, params = {}) {
1800
- const url = this.urls['api']['ws']['public'];
1818
+ let url = this.urls['api']['ws']['public'];
1819
+ const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1820
+ if (sandboxMode) {
1821
+ const argsArrayFirst = this.safeDict(argsArray, 0, {});
1822
+ const instType = this.safeString(argsArrayFirst, 'instType');
1823
+ if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1824
+ url = this.urls['api']['demo']['public'];
1825
+ }
1826
+ }
1801
1827
  const request = {
1802
1828
  'op': 'subscribe',
1803
1829
  'args': argsArray,
@@ -1807,7 +1833,7 @@ class bitget extends bitget$1 {
1807
1833
  }
1808
1834
  async authenticate(params = {}) {
1809
1835
  this.checkRequiredCredentials();
1810
- const url = this.urls['api']['ws']['private'];
1836
+ const url = this.safeString(params, 'url');
1811
1837
  const client = this.client(url);
1812
1838
  const messageHash = 'authenticated';
1813
1839
  const future = client.future(messageHash);
@@ -1834,8 +1860,15 @@ class bitget extends bitget$1 {
1834
1860
  return await future;
1835
1861
  }
1836
1862
  async watchPrivate(messageHash, subscriptionHash, args, params = {}) {
1837
- await this.authenticate();
1838
- const url = this.urls['api']['ws']['private'];
1863
+ let url = this.urls['api']['ws']['private'];
1864
+ const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1865
+ if (sandboxMode) {
1866
+ const instType = this.safeString(args, 'instType');
1867
+ if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1868
+ url = this.urls['api']['demo']['private'];
1869
+ }
1870
+ }
1871
+ await this.authenticate({ 'url': url });
1839
1872
  const request = {
1840
1873
  'op': 'subscribe',
1841
1874
  'args': [args],
@@ -1563,6 +1563,7 @@ class bybit extends bybit$1 {
1563
1563
  * @param {int} [since] the earliest time in ms to fetch liquidations for
1564
1564
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
1565
1565
  * @param {object} [params] exchange specific parameters for the bitmex api endpoint
1566
+ * @param {string} [params.method] exchange specific method, supported: liquidation, allLiquidation
1566
1567
  * @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
1567
1568
  */
1568
1569
  async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
@@ -1571,8 +1572,10 @@ class bybit extends bybit$1 {
1571
1572
  symbol = market['symbol'];
1572
1573
  const url = await this.getUrlByMarketType(symbol, false, 'watchLiquidations', params);
1573
1574
  params = this.cleanParams(params);
1575
+ let method = undefined;
1576
+ [method, params] = this.handleOptionAndParams(params, 'watchLiquidations', 'method', 'liquidation');
1574
1577
  const messageHash = 'liquidations::' + symbol;
1575
- const topic = 'liquidation.' + market['id'];
1578
+ const topic = method + '.' + market['id'];
1576
1579
  const newLiquidation = await this.watchTopics(url, [messageHash], [topic], params);
1577
1580
  if (this.newUpdates) {
1578
1581
  return newLiquidation;
@@ -1581,53 +1584,97 @@ class bybit extends bybit$1 {
1581
1584
  }
1582
1585
  handleLiquidation(client, message) {
1583
1586
  //
1584
- // {
1585
- // "data": {
1586
- // "price": "0.03803",
1587
- // "side": "Buy",
1588
- // "size": "1637",
1589
- // "symbol": "GALAUSDT",
1590
- // "updatedTime": 1673251091822
1591
- // },
1592
- // "topic": "liquidation.GALAUSDT",
1593
- // "ts": 1673251091822,
1594
- // "type": "snapshot"
1595
- // }
1587
+ // {
1588
+ // "data": {
1589
+ // "price": "0.03803",
1590
+ // "side": "Buy",
1591
+ // "size": "1637",
1592
+ // "symbol": "GALAUSDT",
1593
+ // "updatedTime": 1673251091822
1594
+ // },
1595
+ // "topic": "liquidation.GALAUSDT",
1596
+ // "ts": 1673251091822,
1597
+ // "type": "snapshot"
1598
+ // }
1596
1599
  //
1597
- const rawLiquidation = this.safeDict(message, 'data', {});
1598
- const marketId = this.safeString(rawLiquidation, 'symbol');
1599
- const market = this.safeMarket(marketId, undefined, '', 'contract');
1600
- const symbol = market['symbol'];
1601
- const liquidation = this.parseWsLiquidation(rawLiquidation, market);
1602
- let liquidations = this.safeValue(this.liquidations, symbol);
1603
- if (liquidations === undefined) {
1604
- const limit = this.safeInteger(this.options, 'liquidationsLimit', 1000);
1605
- liquidations = new Cache.ArrayCache(limit);
1606
- }
1607
- liquidations.append(liquidation);
1608
- this.liquidations[symbol] = liquidations;
1609
- client.resolve([liquidation], 'liquidations');
1610
- client.resolve([liquidation], 'liquidations::' + symbol);
1600
+ // {
1601
+ // "topic": "allLiquidation.ROSEUSDT",
1602
+ // "type": "snapshot",
1603
+ // "ts": 1739502303204,
1604
+ // "data": [
1605
+ // {
1606
+ // "T": 1739502302929,
1607
+ // "s": "ROSEUSDT",
1608
+ // "S": "Sell",
1609
+ // "v": "20000",
1610
+ // "p": "0.04499"
1611
+ // }
1612
+ // ]
1613
+ // }
1614
+ //
1615
+ if (Array.isArray(message['data'])) {
1616
+ const rawLiquidations = this.safeList(message, 'data', []);
1617
+ for (let i = 0; i < rawLiquidations.length; i++) {
1618
+ const rawLiquidation = rawLiquidations[i];
1619
+ const marketId = this.safeString(rawLiquidation, 's');
1620
+ const market = this.safeMarket(marketId, undefined, '', 'contract');
1621
+ const symbol = market['symbol'];
1622
+ const liquidation = this.parseWsLiquidation(rawLiquidation, market);
1623
+ let liquidations = this.safeValue(this.liquidations, symbol);
1624
+ if (liquidations === undefined) {
1625
+ const limit = this.safeInteger(this.options, 'liquidationsLimit', 1000);
1626
+ liquidations = new Cache.ArrayCache(limit);
1627
+ }
1628
+ liquidations.append(liquidation);
1629
+ this.liquidations[symbol] = liquidations;
1630
+ client.resolve([liquidation], 'liquidations');
1631
+ client.resolve([liquidation], 'liquidations::' + symbol);
1632
+ }
1633
+ }
1634
+ else {
1635
+ const rawLiquidation = this.safeDict(message, 'data', {});
1636
+ const marketId = this.safeString(rawLiquidation, 'symbol');
1637
+ const market = this.safeMarket(marketId, undefined, '', 'contract');
1638
+ const symbol = market['symbol'];
1639
+ const liquidation = this.parseWsLiquidation(rawLiquidation, market);
1640
+ let liquidations = this.safeValue(this.liquidations, symbol);
1641
+ if (liquidations === undefined) {
1642
+ const limit = this.safeInteger(this.options, 'liquidationsLimit', 1000);
1643
+ liquidations = new Cache.ArrayCache(limit);
1644
+ }
1645
+ liquidations.append(liquidation);
1646
+ this.liquidations[symbol] = liquidations;
1647
+ client.resolve([liquidation], 'liquidations');
1648
+ client.resolve([liquidation], 'liquidations::' + symbol);
1649
+ }
1611
1650
  }
1612
1651
  parseWsLiquidation(liquidation, market = undefined) {
1613
1652
  //
1614
- // {
1615
- // "price": "0.03803",
1616
- // "side": "Buy",
1617
- // "size": "1637",
1618
- // "symbol": "GALAUSDT",
1619
- // "updatedTime": 1673251091822
1620
- // }
1653
+ // {
1654
+ // "price": "0.03803",
1655
+ // "side": "Buy",
1656
+ // "size": "1637",
1657
+ // "symbol": "GALAUSDT",
1658
+ // "updatedTime": 1673251091822
1659
+ // }
1660
+ //
1661
+ // {
1662
+ // "T": 1739502302929,
1663
+ // "s": "ROSEUSDT",
1664
+ // "S": "Sell",
1665
+ // "v": "20000",
1666
+ // "p": "0.04499"
1667
+ // }
1621
1668
  //
1622
- const marketId = this.safeString(liquidation, 'symbol');
1669
+ const marketId = this.safeString2(liquidation, 'symbol', 's');
1623
1670
  market = this.safeMarket(marketId, market, '', 'contract');
1624
- const timestamp = this.safeInteger(liquidation, 'updatedTime');
1671
+ const timestamp = this.safeInteger2(liquidation, 'updatedTime', 'T');
1625
1672
  return this.safeLiquidation({
1626
1673
  'info': liquidation,
1627
1674
  'symbol': market['symbol'],
1628
- 'contracts': this.safeNumber(liquidation, 'size'),
1675
+ 'contracts': this.safeNumber2(liquidation, 'size', 'v'),
1629
1676
  'contractSize': this.safeNumber(market, 'contractSize'),
1630
- 'price': this.safeNumber(liquidation, 'price'),
1677
+ 'price': this.safeNumber2(liquidation, 'price', 'p'),
1631
1678
  'baseValue': undefined,
1632
1679
  'quoteValue': undefined,
1633
1680
  'timestamp': timestamp,
@@ -2441,6 +2488,7 @@ class bybit extends bybit$1 {
2441
2488
  'user.openapi.perp.trade': this.handleMyTrades,
2442
2489
  'position': this.handlePositions,
2443
2490
  'liquidation': this.handleLiquidation,
2491
+ 'allLiquidation': this.handleLiquidation,
2444
2492
  'pong': this.handlePong,
2445
2493
  'order.create': this.handleOrderWs,
2446
2494
  'order.amend': this.handleOrderWs,
@@ -134,7 +134,6 @@ class tradeogre extends tradeogre$1 {
134
134
  },
135
135
  'private': {
136
136
  'get': {
137
- 'account/balance': 1,
138
137
  'account/balances': 1,
139
138
  'account/order/{uuid}': 1,
140
139
  },
@@ -144,6 +143,7 @@ class tradeogre extends tradeogre$1 {
144
143
  'order/cancel': 1,
145
144
  'orders': 1,
146
145
  'account/orders': 1,
146
+ 'account/balance': 1,
147
147
  },
148
148
  },
149
149
  },
@@ -596,11 +596,29 @@ class tradeogre extends tradeogre$1 {
596
596
  * @name tradeogre#fetchBalance
597
597
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
598
598
  * @param {object} [params] extra parameters specific to the exchange API endpoint
599
+ * @param {string} [params.currency] currency to fetch the balance for
599
600
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
600
601
  */
601
602
  async fetchBalance(params = {}) {
602
603
  await this.loadMarkets();
603
- const response = await this.privateGetAccountBalances(params);
604
+ let response = undefined;
605
+ const currency = this.safeString(params, 'currency');
606
+ if (currency !== undefined) {
607
+ response = await this.privatePostAccountBalance(params);
608
+ const singleCurrencyresult = {
609
+ 'info': response,
610
+ };
611
+ const code = this.safeCurrencyCode(currency);
612
+ const account = {
613
+ 'total': this.safeNumber(response, 'balance'),
614
+ 'free': this.safeNumber(response, 'available'),
615
+ };
616
+ singleCurrencyresult[code] = account;
617
+ return this.safeBalance(singleCurrencyresult);
618
+ }
619
+ else {
620
+ response = await this.privateGetAccountBalances(params);
621
+ }
604
622
  const result = this.safeDict(response, 'balances', {});
605
623
  return this.parseBalance(result);
606
624
  }
@@ -764,11 +782,11 @@ class tradeogre extends tradeogre$1 {
764
782
  'side': this.safeString(order, 'type'),
765
783
  'price': this.safeString(order, 'price'),
766
784
  'triggerPrice': undefined,
767
- 'amount': this.safeString(order, 'quantity'),
785
+ 'amount': undefined,
768
786
  'cost': undefined,
769
787
  'average': undefined,
770
788
  'filled': this.safeString(order, 'fulfilled'),
771
- 'remaining': undefined,
789
+ 'remaining': this.safeString(order, 'quantity'),
772
790
  'status': undefined,
773
791
  'fee': {
774
792
  'currency': undefined,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.68";
7
+ declare const version = "4.4.69";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -32,7 +32,7 @@ import * as errors from './src/base/errors.js';
32
32
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
33
33
  //-----------------------------------------------------------------------------
34
34
  // this is updated by vss.js when building
35
- const version = '4.4.69';
35
+ const version = '4.4.70';
36
36
  Exchange.ccxtVersion = version;
37
37
  //-----------------------------------------------------------------------------
38
38
  import ace from './src/ace.js';
@@ -55,6 +55,7 @@ interface Exchange {
55
55
  publicGetV5CryptoLoanLoanableData(params?: {}): Promise<implicitReturnType>;
56
56
  publicGetV5InsLoanProductInfos(params?: {}): Promise<implicitReturnType>;
57
57
  publicGetV5InsLoanEnsureTokensConvert(params?: {}): Promise<implicitReturnType>;
58
+ publicGetV5EarnProduct(params?: {}): Promise<implicitReturnType>;
58
59
  privateGetV5MarketInstrumentsInfo(params?: {}): Promise<implicitReturnType>;
59
60
  privateGetV2PrivateWalletFundRecords(params?: {}): Promise<implicitReturnType>;
60
61
  privateGetSpotV3PrivateOrder(params?: {}): Promise<implicitReturnType>;
@@ -191,6 +192,8 @@ interface Exchange {
191
192
  privateGetV5BrokerEarningsInfo(params?: {}): Promise<implicitReturnType>;
192
193
  privateGetV5BrokerAccountInfo(params?: {}): Promise<implicitReturnType>;
193
194
  privateGetV5BrokerAssetQuerySubMemberDepositRecord(params?: {}): Promise<implicitReturnType>;
195
+ privateGetV5EarnOrder(params?: {}): Promise<implicitReturnType>;
196
+ privateGetV5EarnPosition(params?: {}): Promise<implicitReturnType>;
194
197
  privatePostSpotV3PrivateOrder(params?: {}): Promise<implicitReturnType>;
195
198
  privatePostSpotV3PrivateCancelOrder(params?: {}): Promise<implicitReturnType>;
196
199
  privatePostSpotV3PrivateCancelOrders(params?: {}): Promise<implicitReturnType>;
@@ -306,6 +309,7 @@ interface Exchange {
306
309
  privatePostV5BrokerAwardInfo(params?: {}): Promise<implicitReturnType>;
307
310
  privatePostV5BrokerAwardDistributeAward(params?: {}): Promise<implicitReturnType>;
308
311
  privatePostV5BrokerAwardDistributionRecord(params?: {}): Promise<implicitReturnType>;
312
+ privatePostV5EarnPlaceOrder(params?: {}): Promise<implicitReturnType>;
309
313
  }
310
314
  declare abstract class Exchange extends _Exchange {
311
315
  }
@@ -106,7 +106,9 @@ interface okx {
106
106
  privateGetTradeEasyConvertCurrencyList(params?: {}): Promise<implicitReturnType>;
107
107
  privateGetTradeEasyConvertHistory(params?: {}): Promise<implicitReturnType>;
108
108
  privateGetTradeOneClickRepayCurrencyList(params?: {}): Promise<implicitReturnType>;
109
+ privateGetTradeOneClickRepayCurrencyListV2(params?: {}): Promise<implicitReturnType>;
109
110
  privateGetTradeOneClickRepayHistory(params?: {}): Promise<implicitReturnType>;
111
+ privateGetTradeOneClickRepayHistoryV2(params?: {}): Promise<implicitReturnType>;
110
112
  privateGetTradeAccountRateLimit(params?: {}): Promise<implicitReturnType>;
111
113
  privateGetAssetCurrencies(params?: {}): Promise<implicitReturnType>;
112
114
  privateGetAssetBalances(params?: {}): Promise<implicitReturnType>;
@@ -249,6 +251,7 @@ interface okx {
249
251
  privatePostTradeCancelAdvanceAlgos(params?: {}): Promise<implicitReturnType>;
250
252
  privatePostTradeEasyConvert(params?: {}): Promise<implicitReturnType>;
251
253
  privatePostTradeOneClickRepay(params?: {}): Promise<implicitReturnType>;
254
+ privatePostTradeOneClickRepayV2(params?: {}): Promise<implicitReturnType>;
252
255
  privatePostTradeMassCancel(params?: {}): Promise<implicitReturnType>;
253
256
  privatePostTradeCancelAllAfter(params?: {}): Promise<implicitReturnType>;
254
257
  privatePostAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -106,7 +106,9 @@ interface Exchange {
106
106
  privateGetTradeEasyConvertCurrencyList(params?: {}): Promise<implicitReturnType>;
107
107
  privateGetTradeEasyConvertHistory(params?: {}): Promise<implicitReturnType>;
108
108
  privateGetTradeOneClickRepayCurrencyList(params?: {}): Promise<implicitReturnType>;
109
+ privateGetTradeOneClickRepayCurrencyListV2(params?: {}): Promise<implicitReturnType>;
109
110
  privateGetTradeOneClickRepayHistory(params?: {}): Promise<implicitReturnType>;
111
+ privateGetTradeOneClickRepayHistoryV2(params?: {}): Promise<implicitReturnType>;
110
112
  privateGetTradeAccountRateLimit(params?: {}): Promise<implicitReturnType>;
111
113
  privateGetAssetCurrencies(params?: {}): Promise<implicitReturnType>;
112
114
  privateGetAssetBalances(params?: {}): Promise<implicitReturnType>;
@@ -249,6 +251,7 @@ interface Exchange {
249
251
  privatePostTradeCancelAdvanceAlgos(params?: {}): Promise<implicitReturnType>;
250
252
  privatePostTradeEasyConvert(params?: {}): Promise<implicitReturnType>;
251
253
  privatePostTradeOneClickRepay(params?: {}): Promise<implicitReturnType>;
254
+ privatePostTradeOneClickRepayV2(params?: {}): Promise<implicitReturnType>;
252
255
  privatePostTradeMassCancel(params?: {}): Promise<implicitReturnType>;
253
256
  privatePostTradeCancelAllAfter(params?: {}): Promise<implicitReturnType>;
254
257
  privatePostAssetTransfer(params?: {}): Promise<implicitReturnType>;
@@ -7,7 +7,6 @@ interface Exchange {
7
7
  publicGetHistoryMarket(params?: {}): Promise<implicitReturnType>;
8
8
  publicGetChartIntervalMarketTimestamp(params?: {}): Promise<implicitReturnType>;
9
9
  publicGetChartIntervalMarket(params?: {}): Promise<implicitReturnType>;
10
- privateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
11
10
  privateGetAccountBalances(params?: {}): Promise<implicitReturnType>;
12
11
  privateGetAccountOrderUuid(params?: {}): Promise<implicitReturnType>;
13
12
  privatePostOrderBuy(params?: {}): Promise<implicitReturnType>;
@@ -15,6 +14,7 @@ interface Exchange {
15
14
  privatePostOrderCancel(params?: {}): Promise<implicitReturnType>;
16
15
  privatePostOrders(params?: {}): Promise<implicitReturnType>;
17
16
  privatePostAccountOrders(params?: {}): Promise<implicitReturnType>;
17
+ privatePostAccountBalance(params?: {}): Promise<implicitReturnType>;
18
18
  }
19
19
  declare abstract class Exchange extends _Exchange {
20
20
  }
@@ -1568,7 +1568,6 @@ export default class Exchange {
1568
1568
  },
1569
1569
  'commonCurrencies': {
1570
1570
  'XBT': 'BTC',
1571
- 'BCC': 'BCH',
1572
1571
  'BCHSV': 'BSV',
1573
1572
  },
1574
1573
  'precisionMode': TICK_SIZE,
@@ -542,9 +542,9 @@ export interface MarginModes extends Dictionary<MarginMode> {
542
542
  }
543
543
  export interface OptionChain extends Dictionary<Option> {
544
544
  }
545
- export interface IsolatedBorrowRates extends Dictionary<IsolatedBorrowRates> {
545
+ export interface IsolatedBorrowRates extends Dictionary<IsolatedBorrowRate> {
546
546
  }
547
- export interface CrossBorrowRates extends Dictionary<CrossBorrowRates> {
547
+ export interface CrossBorrowRates extends Dictionary<CrossBorrowRate> {
548
548
  }
549
549
  export interface LeverageTiers extends Dictionary<LeverageTier[]> {
550
550
  }
package/js/src/binance.js CHANGED
@@ -8792,7 +8792,7 @@ export default class binance extends Exchange {
8792
8792
  const internalInteger = this.safeInteger(transaction, 'transferType');
8793
8793
  let internal = undefined;
8794
8794
  if (internalInteger !== undefined) {
8795
- internal = internalInteger ? true : false;
8795
+ internal = (internalInteger !== 0) ? true : false;
8796
8796
  }
8797
8797
  const network = this.safeString(transaction, 'network');
8798
8798
  return {