ccxt 4.3.64 → 4.3.65

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/dist/cjs/ccxt.js CHANGED
@@ -191,7 +191,7 @@ var xt$1 = require('./src/pro/xt.js');
191
191
 
192
192
  //-----------------------------------------------------------------------------
193
193
  // this is updated by vss.js when building
194
- const version = '4.3.64';
194
+ const version = '4.3.65';
195
195
  Exchange["default"].ccxtVersion = version;
196
196
  const exchanges = {
197
197
  'ace': ace,
@@ -3050,7 +3050,7 @@ class bybit extends bybit$1 {
3050
3050
  * @see https://bybit-exchange.github.io/docs/v5/asset/all-balance
3051
3051
  * @see https://bybit-exchange.github.io/docs/v5/account/wallet-balance
3052
3052
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3053
- * @param {string} [params.type] wallet type, ['spot', 'swap', 'fund']
3053
+ * @param {string} [params.type] wallet type, ['spot', 'swap', 'funding']
3054
3054
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
3055
3055
  */
3056
3056
  await this.loadMarkets();
@@ -3058,10 +3058,18 @@ class bybit extends bybit$1 {
3058
3058
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
3059
3059
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
3060
3060
  let type = undefined;
3061
- [type, params] = this.getBybitType('fetchBalance', undefined, params);
3061
+ // don't use getBybitType here
3062
+ [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
3063
+ let subType = undefined;
3064
+ [subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
3065
+ if ((type === 'swap') || (type === 'future')) {
3066
+ type = subType;
3067
+ }
3068
+ const lowercaseRawType = (type !== undefined) ? type.toLowerCase() : undefined;
3062
3069
  const isSpot = (type === 'spot');
3063
3070
  const isLinear = (type === 'linear');
3064
3071
  const isInverse = (type === 'inverse');
3072
+ const isFunding = (lowercaseRawType === 'fund') || (lowercaseRawType === 'funding');
3065
3073
  if (isUnifiedAccount) {
3066
3074
  if (isInverse) {
3067
3075
  type = 'contract';
@@ -3083,10 +3091,10 @@ class bybit extends bybit$1 {
3083
3091
  if (isSpot && (marginMode !== undefined)) {
3084
3092
  response = await this.privateGetV5SpotCrossMarginTradeAccount(this.extend(request, params));
3085
3093
  }
3086
- else if (unifiedType === 'FUND') {
3094
+ else if (isFunding) {
3087
3095
  // use this endpoint only we have no other choice
3088
3096
  // because it requires transfer permission
3089
- request['accountType'] = unifiedType;
3097
+ request['accountType'] = 'FUND';
3090
3098
  response = await this.privateGetV5AssetTransferQueryAccountCoinsBalance(this.extend(request, params));
3091
3099
  }
3092
3100
  else {
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, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, TransferEntries, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, 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 } from './src/base/errors.js';
7
- declare const version = "4.3.63";
7
+ declare const version = "4.3.64";
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
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, 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 } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.64';
41
+ const version = '4.3.65';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bybit.js CHANGED
@@ -3053,7 +3053,7 @@ export default class bybit extends Exchange {
3053
3053
  * @see https://bybit-exchange.github.io/docs/v5/asset/all-balance
3054
3054
  * @see https://bybit-exchange.github.io/docs/v5/account/wallet-balance
3055
3055
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3056
- * @param {string} [params.type] wallet type, ['spot', 'swap', 'fund']
3056
+ * @param {string} [params.type] wallet type, ['spot', 'swap', 'funding']
3057
3057
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
3058
3058
  */
3059
3059
  await this.loadMarkets();
@@ -3061,10 +3061,18 @@ export default class bybit extends Exchange {
3061
3061
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
3062
3062
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
3063
3063
  let type = undefined;
3064
- [type, params] = this.getBybitType('fetchBalance', undefined, params);
3064
+ // don't use getBybitType here
3065
+ [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
3066
+ let subType = undefined;
3067
+ [subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
3068
+ if ((type === 'swap') || (type === 'future')) {
3069
+ type = subType;
3070
+ }
3071
+ const lowercaseRawType = (type !== undefined) ? type.toLowerCase() : undefined;
3065
3072
  const isSpot = (type === 'spot');
3066
3073
  const isLinear = (type === 'linear');
3067
3074
  const isInverse = (type === 'inverse');
3075
+ const isFunding = (lowercaseRawType === 'fund') || (lowercaseRawType === 'funding');
3068
3076
  if (isUnifiedAccount) {
3069
3077
  if (isInverse) {
3070
3078
  type = 'contract';
@@ -3086,10 +3094,10 @@ export default class bybit extends Exchange {
3086
3094
  if (isSpot && (marginMode !== undefined)) {
3087
3095
  response = await this.privateGetV5SpotCrossMarginTradeAccount(this.extend(request, params));
3088
3096
  }
3089
- else if (unifiedType === 'FUND') {
3097
+ else if (isFunding) {
3090
3098
  // use this endpoint only we have no other choice
3091
3099
  // because it requires transfer permission
3092
- request['accountType'] = unifiedType;
3100
+ request['accountType'] = 'FUND';
3093
3101
  response = await this.privateGetV5AssetTransferQueryAccountCoinsBalance(this.extend(request, params));
3094
3102
  }
3095
3103
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.64",
3
+ "version": "4.3.65",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",