ccxt 4.4.87 → 4.4.88

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
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.4.87';
197
+ const version = '4.4.88';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'alpaca': alpaca,
@@ -746,7 +746,9 @@ class Exchange {
746
746
  this.options['cachedCurrencies'] = currencies;
747
747
  }
748
748
  const markets = await this.fetchMarkets(params);
749
- delete this.options['cachedCurrencies'];
749
+ if ('cachedCurrencies' in this.options) {
750
+ delete this.options['cachedCurrencies'];
751
+ }
750
752
  return this.setMarkets(markets, currencies);
751
753
  }
752
754
  /**
@@ -2346,20 +2346,9 @@ class bybit extends bybit$1 {
2346
2346
  // 'baseCoin': '', Base coin. For option only
2347
2347
  // 'expDate': '', Expiry date. e.g., 25DEC22. For option only
2348
2348
  };
2349
- if (market['spot']) {
2350
- request['category'] = 'spot';
2351
- }
2352
- else {
2353
- if (market['option']) {
2354
- request['category'] = 'option';
2355
- }
2356
- else if (market['linear']) {
2357
- request['category'] = 'linear';
2358
- }
2359
- else if (market['inverse']) {
2360
- request['category'] = 'inverse';
2361
- }
2362
- }
2349
+ let category = undefined;
2350
+ [category, params] = this.getBybitType('fetchTicker', market, params);
2351
+ request['category'] = category;
2363
2352
  const response = await this.publicGetV5MarketTickers(this.extend(request, params));
2364
2353
  //
2365
2354
  // {
@@ -2460,28 +2449,16 @@ class bybit extends bybit$1 {
2460
2449
  // 'baseCoin': '', // Base coin. For option only
2461
2450
  // 'expDate': '', // Expiry date. e.g., 25DEC22. For option only
2462
2451
  };
2463
- let type = undefined;
2464
- [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
2465
- // Calls like `.fetchTickers (undefined, {subType:'inverse'})` should be supported for this exchange, so
2466
- // as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2467
- // with higher priority and only default to spot, if `subType` is not set in params
2468
- const passedSubType = this.safeString(params, 'subType');
2469
- let subType = undefined;
2470
- [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
2471
- // only if passedSubType is undefined, then use spot
2472
- if (type === 'spot' && passedSubType === undefined) {
2473
- request['category'] = 'spot';
2474
- }
2475
- else if (type === 'option') {
2452
+ let category = undefined;
2453
+ [category, params] = this.getBybitType('fetchTickers', market, params);
2454
+ request['category'] = category;
2455
+ if (category === 'option') {
2476
2456
  request['category'] = 'option';
2477
2457
  if (code === undefined) {
2478
2458
  code = 'BTC';
2479
2459
  }
2480
2460
  request['baseCoin'] = code;
2481
2461
  }
2482
- else if (type === 'swap' || type === 'future' || subType !== undefined) {
2483
- request['category'] = subType;
2484
- }
2485
2462
  const response = await this.publicGetV5MarketTickers(this.extend(request, params));
2486
2463
  //
2487
2464
  // {
@@ -4082,18 +4059,9 @@ class bybit extends bybit$1 {
4082
4059
  request['price'] = priceString;
4083
4060
  }
4084
4061
  }
4085
- if (market['spot']) {
4086
- request['category'] = 'spot';
4087
- }
4088
- else if (market['option']) {
4089
- request['category'] = 'option';
4090
- }
4091
- else if (market['linear']) {
4092
- request['category'] = 'linear';
4093
- }
4094
- else if (market['inverse']) {
4095
- request['category'] = 'inverse';
4096
- }
4062
+ let category = undefined;
4063
+ [category, params] = this.getBybitType('createOrderRequest', market, params);
4064
+ request['category'] = category;
4097
4065
  const cost = this.safeString(params, 'cost');
4098
4066
  params = this.omit(params, 'cost');
4099
4067
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -4322,18 +4290,9 @@ class bybit extends bybit$1 {
4322
4290
  // Valid for option only.
4323
4291
  // 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
4324
4292
  };
4325
- if (market['spot']) {
4326
- request['category'] = 'spot';
4327
- }
4328
- else if (market['linear']) {
4329
- request['category'] = 'linear';
4330
- }
4331
- else if (market['inverse']) {
4332
- request['category'] = 'inverse';
4333
- }
4334
- else if (market['option']) {
4335
- request['category'] = 'option';
4336
- }
4293
+ let category = undefined;
4294
+ [category, params] = this.getBybitType('editOrderRequest', market, params);
4295
+ request['category'] = category;
4337
4296
  if (amount !== undefined) {
4338
4297
  request['qty'] = this.getAmount(symbol, amount);
4339
4298
  }
@@ -4539,18 +4498,9 @@ class bybit extends bybit$1 {
4539
4498
  if (id !== undefined) { // The user can also use argument params["orderLinkId"]
4540
4499
  request['orderId'] = id;
4541
4500
  }
4542
- if (market['spot']) {
4543
- request['category'] = 'spot';
4544
- }
4545
- else if (market['linear']) {
4546
- request['category'] = 'linear';
4547
- }
4548
- else if (market['inverse']) {
4549
- request['category'] = 'inverse';
4550
- }
4551
- else if (market['option']) {
4552
- request['category'] = 'option';
4553
- }
4501
+ let category = undefined;
4502
+ [category, params] = this.getBybitType('cancelOrderRequest', market, params);
4503
+ request['category'] = category;
4554
4504
  return this.extend(request, params);
4555
4505
  }
4556
4506
  /**
@@ -7600,18 +7550,7 @@ class bybit extends bybit$1 {
7600
7550
  'symbol': market['id'],
7601
7551
  };
7602
7552
  let category = undefined;
7603
- if (market['linear']) {
7604
- category = 'linear';
7605
- }
7606
- else if (market['inverse']) {
7607
- category = 'inverse';
7608
- }
7609
- else if (market['spot']) {
7610
- category = 'spot';
7611
- }
7612
- else {
7613
- category = 'option';
7614
- }
7553
+ [category, params] = this.getBybitType('fetchTradingFee', market, params);
7615
7554
  request['category'] = category;
7616
7555
  const response = await this.privateGetV5AccountFeeRate(this.extend(request, params));
7617
7556
  //
@@ -7859,10 +7798,10 @@ class bybit extends bybit$1 {
7859
7798
  }
7860
7799
  let type = undefined;
7861
7800
  [type, params] = this.getBybitType('fetchMySettlementHistory', market, params);
7862
- if (type === 'spot' || type === 'inverse') {
7801
+ if (type === 'spot') {
7863
7802
  throw new errors.NotSupported(this.id + ' fetchMySettlementHistory() is not supported for spot market');
7864
7803
  }
7865
- request['category'] = 'linear';
7804
+ request['category'] = type;
7866
7805
  if (limit !== undefined) {
7867
7806
  request['limit'] = limit;
7868
7807
  }
@@ -44,16 +44,16 @@ class modetrade extends modetrade$1 {
44
44
  'createConvertTrade': false,
45
45
  'createDepositAddress': false,
46
46
  'createMarketBuyOrderWithCost': false,
47
- 'createMarketOrder': false,
47
+ 'createMarketOrder': true,
48
48
  'createMarketOrderWithCost': false,
49
49
  'createMarketSellOrderWithCost': false,
50
50
  'createOrder': true,
51
51
  'createOrderWithTakeProfitAndStopLoss': true,
52
52
  'createReduceOnlyOrder': true,
53
- 'createStopLimitOrder': false,
53
+ 'createStopLimitOrder': true,
54
54
  'createStopLossOrder': true,
55
- 'createStopMarketOrder': false,
56
- 'createStopOrder': false,
55
+ 'createStopMarketOrder': true,
56
+ 'createStopOrder': true,
57
57
  'createTakeProfitOrder': true,
58
58
  'createTrailingAmountOrder': false,
59
59
  'createTrailingPercentOrder': false,
@@ -292,7 +292,7 @@ class modetrade extends modetrade$1 {
292
292
  },
293
293
  'options': {
294
294
  'sandboxMode': false,
295
- 'brokerId': 'CCXT',
295
+ 'brokerId': 'CCXTMODE',
296
296
  'verifyingContractAddress': '0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203',
297
297
  },
298
298
  'features': {
@@ -2149,7 +2149,7 @@ class modetrade extends modetrade$1 {
2149
2149
  const code = this.safeCurrencyCode(this.safeString(balance, 'token'));
2150
2150
  const account = this.account();
2151
2151
  account['total'] = this.safeString(balance, 'holding');
2152
- account['frozen'] = this.safeString(balance, 'frozen');
2152
+ account['used'] = this.safeString(balance, 'frozen');
2153
2153
  result[code] = account;
2154
2154
  }
2155
2155
  return this.safeBalance(result);
@@ -2765,7 +2765,7 @@ class modetrade extends modetrade$1 {
2765
2765
  if (isPostOrPut && isOrder) {
2766
2766
  const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2767
2767
  if (!isSandboxMode) {
2768
- const brokerId = this.safeString(this.options, 'brokerId', 'CCXT');
2768
+ const brokerId = this.safeString(this.options, 'brokerId', 'CCXTMODE');
2769
2769
  if (path === 'batch-order') {
2770
2770
  const ordersList = this.safeList(params, 'orders', []);
2771
2771
  for (let i = 0; i < ordersList.length; i++) {
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, 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, ConstructorArgs } 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.86";
7
+ declare const version = "4.4.87";
8
8
  import alpaca from './src/alpaca.js';
9
9
  import apex from './src/apex.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, 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';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.86';
41
+ const version = '4.4.87';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import alpaca from './src/alpaca.js';
@@ -728,7 +728,9 @@ export default class Exchange {
728
728
  this.options['cachedCurrencies'] = currencies;
729
729
  }
730
730
  const markets = await this.fetchMarkets(params);
731
- delete this.options['cachedCurrencies'];
731
+ if ('cachedCurrencies' in this.options) {
732
+ delete this.options['cachedCurrencies'];
733
+ }
732
734
  return this.setMarkets(markets, currencies);
733
735
  }
734
736
  /**
package/js/src/bybit.js CHANGED
@@ -2349,20 +2349,9 @@ export default class bybit extends Exchange {
2349
2349
  // 'baseCoin': '', Base coin. For option only
2350
2350
  // 'expDate': '', Expiry date. e.g., 25DEC22. For option only
2351
2351
  };
2352
- if (market['spot']) {
2353
- request['category'] = 'spot';
2354
- }
2355
- else {
2356
- if (market['option']) {
2357
- request['category'] = 'option';
2358
- }
2359
- else if (market['linear']) {
2360
- request['category'] = 'linear';
2361
- }
2362
- else if (market['inverse']) {
2363
- request['category'] = 'inverse';
2364
- }
2365
- }
2352
+ let category = undefined;
2353
+ [category, params] = this.getBybitType('fetchTicker', market, params);
2354
+ request['category'] = category;
2366
2355
  const response = await this.publicGetV5MarketTickers(this.extend(request, params));
2367
2356
  //
2368
2357
  // {
@@ -2463,28 +2452,16 @@ export default class bybit extends Exchange {
2463
2452
  // 'baseCoin': '', // Base coin. For option only
2464
2453
  // 'expDate': '', // Expiry date. e.g., 25DEC22. For option only
2465
2454
  };
2466
- let type = undefined;
2467
- [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
2468
- // Calls like `.fetchTickers (undefined, {subType:'inverse'})` should be supported for this exchange, so
2469
- // as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2470
- // with higher priority and only default to spot, if `subType` is not set in params
2471
- const passedSubType = this.safeString(params, 'subType');
2472
- let subType = undefined;
2473
- [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
2474
- // only if passedSubType is undefined, then use spot
2475
- if (type === 'spot' && passedSubType === undefined) {
2476
- request['category'] = 'spot';
2477
- }
2478
- else if (type === 'option') {
2455
+ let category = undefined;
2456
+ [category, params] = this.getBybitType('fetchTickers', market, params);
2457
+ request['category'] = category;
2458
+ if (category === 'option') {
2479
2459
  request['category'] = 'option';
2480
2460
  if (code === undefined) {
2481
2461
  code = 'BTC';
2482
2462
  }
2483
2463
  request['baseCoin'] = code;
2484
2464
  }
2485
- else if (type === 'swap' || type === 'future' || subType !== undefined) {
2486
- request['category'] = subType;
2487
- }
2488
2465
  const response = await this.publicGetV5MarketTickers(this.extend(request, params));
2489
2466
  //
2490
2467
  // {
@@ -4085,18 +4062,9 @@ export default class bybit extends Exchange {
4085
4062
  request['price'] = priceString;
4086
4063
  }
4087
4064
  }
4088
- if (market['spot']) {
4089
- request['category'] = 'spot';
4090
- }
4091
- else if (market['option']) {
4092
- request['category'] = 'option';
4093
- }
4094
- else if (market['linear']) {
4095
- request['category'] = 'linear';
4096
- }
4097
- else if (market['inverse']) {
4098
- request['category'] = 'inverse';
4099
- }
4065
+ let category = undefined;
4066
+ [category, params] = this.getBybitType('createOrderRequest', market, params);
4067
+ request['category'] = category;
4100
4068
  const cost = this.safeString(params, 'cost');
4101
4069
  params = this.omit(params, 'cost');
4102
4070
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -4325,18 +4293,9 @@ export default class bybit extends Exchange {
4325
4293
  // Valid for option only.
4326
4294
  // 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
4327
4295
  };
4328
- if (market['spot']) {
4329
- request['category'] = 'spot';
4330
- }
4331
- else if (market['linear']) {
4332
- request['category'] = 'linear';
4333
- }
4334
- else if (market['inverse']) {
4335
- request['category'] = 'inverse';
4336
- }
4337
- else if (market['option']) {
4338
- request['category'] = 'option';
4339
- }
4296
+ let category = undefined;
4297
+ [category, params] = this.getBybitType('editOrderRequest', market, params);
4298
+ request['category'] = category;
4340
4299
  if (amount !== undefined) {
4341
4300
  request['qty'] = this.getAmount(symbol, amount);
4342
4301
  }
@@ -4542,18 +4501,9 @@ export default class bybit extends Exchange {
4542
4501
  if (id !== undefined) { // The user can also use argument params["orderLinkId"]
4543
4502
  request['orderId'] = id;
4544
4503
  }
4545
- if (market['spot']) {
4546
- request['category'] = 'spot';
4547
- }
4548
- else if (market['linear']) {
4549
- request['category'] = 'linear';
4550
- }
4551
- else if (market['inverse']) {
4552
- request['category'] = 'inverse';
4553
- }
4554
- else if (market['option']) {
4555
- request['category'] = 'option';
4556
- }
4504
+ let category = undefined;
4505
+ [category, params] = this.getBybitType('cancelOrderRequest', market, params);
4506
+ request['category'] = category;
4557
4507
  return this.extend(request, params);
4558
4508
  }
4559
4509
  /**
@@ -7607,18 +7557,7 @@ export default class bybit extends Exchange {
7607
7557
  'symbol': market['id'],
7608
7558
  };
7609
7559
  let category = undefined;
7610
- if (market['linear']) {
7611
- category = 'linear';
7612
- }
7613
- else if (market['inverse']) {
7614
- category = 'inverse';
7615
- }
7616
- else if (market['spot']) {
7617
- category = 'spot';
7618
- }
7619
- else {
7620
- category = 'option';
7621
- }
7560
+ [category, params] = this.getBybitType('fetchTradingFee', market, params);
7622
7561
  request['category'] = category;
7623
7562
  const response = await this.privateGetV5AccountFeeRate(this.extend(request, params));
7624
7563
  //
@@ -7866,10 +7805,10 @@ export default class bybit extends Exchange {
7866
7805
  }
7867
7806
  let type = undefined;
7868
7807
  [type, params] = this.getBybitType('fetchMySettlementHistory', market, params);
7869
- if (type === 'spot' || type === 'inverse') {
7808
+ if (type === 'spot') {
7870
7809
  throw new NotSupported(this.id + ' fetchMySettlementHistory() is not supported for spot market');
7871
7810
  }
7872
- request['category'] = 'linear';
7811
+ request['category'] = type;
7873
7812
  if (limit !== undefined) {
7874
7813
  request['limit'] = limit;
7875
7814
  }
@@ -47,16 +47,16 @@ export default class modetrade extends Exchange {
47
47
  'createConvertTrade': false,
48
48
  'createDepositAddress': false,
49
49
  'createMarketBuyOrderWithCost': false,
50
- 'createMarketOrder': false,
50
+ 'createMarketOrder': true,
51
51
  'createMarketOrderWithCost': false,
52
52
  'createMarketSellOrderWithCost': false,
53
53
  'createOrder': true,
54
54
  'createOrderWithTakeProfitAndStopLoss': true,
55
55
  'createReduceOnlyOrder': true,
56
- 'createStopLimitOrder': false,
56
+ 'createStopLimitOrder': true,
57
57
  'createStopLossOrder': true,
58
- 'createStopMarketOrder': false,
59
- 'createStopOrder': false,
58
+ 'createStopMarketOrder': true,
59
+ 'createStopOrder': true,
60
60
  'createTakeProfitOrder': true,
61
61
  'createTrailingAmountOrder': false,
62
62
  'createTrailingPercentOrder': false,
@@ -295,7 +295,7 @@ export default class modetrade extends Exchange {
295
295
  },
296
296
  'options': {
297
297
  'sandboxMode': false,
298
- 'brokerId': 'CCXT',
298
+ 'brokerId': 'CCXTMODE',
299
299
  'verifyingContractAddress': '0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203',
300
300
  },
301
301
  'features': {
@@ -2152,7 +2152,7 @@ export default class modetrade extends Exchange {
2152
2152
  const code = this.safeCurrencyCode(this.safeString(balance, 'token'));
2153
2153
  const account = this.account();
2154
2154
  account['total'] = this.safeString(balance, 'holding');
2155
- account['frozen'] = this.safeString(balance, 'frozen');
2155
+ account['used'] = this.safeString(balance, 'frozen');
2156
2156
  result[code] = account;
2157
2157
  }
2158
2158
  return this.safeBalance(result);
@@ -2768,7 +2768,7 @@ export default class modetrade extends Exchange {
2768
2768
  if (isPostOrPut && isOrder) {
2769
2769
  const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2770
2770
  if (!isSandboxMode) {
2771
- const brokerId = this.safeString(this.options, 'brokerId', 'CCXT');
2771
+ const brokerId = this.safeString(this.options, 'brokerId', 'CCXTMODE');
2772
2772
  if (path === 'batch-order') {
2773
2773
  const ordersList = this.safeList(params, 'orders', []);
2774
2774
  for (let i = 0; i < ordersList.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.4.87",
3
+ "version": "4.4.88",
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",