ccxt 4.0.77 → 4.0.78

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
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.0.77';
183
+ const version = '4.0.78';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -3366,12 +3366,18 @@ class Exchange {
3366
3366
  precision = this.safeValue(networkItem, 'precision', precision);
3367
3367
  }
3368
3368
  if (precision === undefined) {
3369
- return fee;
3369
+ return this.forceString(fee);
3370
3370
  }
3371
3371
  else {
3372
3372
  return this.decimalToPrecision(fee, ROUND, precision, this.precisionMode, this.paddingMode);
3373
3373
  }
3374
3374
  }
3375
+ forceString(value) {
3376
+ if (typeof value !== 'string') {
3377
+ return this.numberToString(value);
3378
+ }
3379
+ return value;
3380
+ }
3375
3381
  isTickPrecision() {
3376
3382
  return this.precisionMode === TICK_SIZE;
3377
3383
  }
@@ -90,6 +90,7 @@ class bingx extends bingx$1 {
90
90
  'market/trades': 3,
91
91
  'market/depth': 3,
92
92
  'market/kline': 3,
93
+ 'ticker/24hr': 1,
93
94
  },
94
95
  },
95
96
  'private': {
@@ -98,7 +99,6 @@ class bingx extends bingx$1 {
98
99
  'trade/openOrders': 3,
99
100
  'trade/historyOrders': 3,
100
101
  'account/balance': 3,
101
- 'ticker/24hr': 1,
102
102
  },
103
103
  'post': {
104
104
  'trade/order': 3,
@@ -255,6 +255,7 @@ class bingx extends bingx$1 {
255
255
  '500': errors.ExchangeError,
256
256
  '504': errors.ExchangeError,
257
257
  '100001': errors.AuthenticationError,
258
+ '100412': errors.AuthenticationError,
258
259
  '100202': errors.InsufficientFunds,
259
260
  '100400': errors.BadRequest,
260
261
  '100440': errors.ExchangeError,
@@ -1097,7 +1098,7 @@ class bingx extends bingx$1 {
1097
1098
  };
1098
1099
  let response = undefined;
1099
1100
  if (market['spot']) {
1100
- response = await this.spotV1PrivateGetTicker24hr(this.extend(request, params));
1101
+ response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1101
1102
  }
1102
1103
  else {
1103
1104
  response = await this.swapV2PublicGetQuoteTicker(this.extend(request, params));
@@ -1137,15 +1138,21 @@ class bingx extends bingx$1 {
1137
1138
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
1138
1139
  */
1139
1140
  await this.loadMarkets();
1141
+ let market = undefined;
1140
1142
  if (symbols !== undefined) {
1141
1143
  symbols = this.marketSymbols(symbols);
1142
1144
  const firstSymbol = this.safeString(symbols, 0);
1143
- const market = this.market(firstSymbol);
1144
- if (!market['swap']) {
1145
- throw new errors.BadRequest(this.id + ' fetchTicker is only supported for swap markets.');
1146
- }
1145
+ market = this.market(firstSymbol);
1146
+ }
1147
+ let type = undefined;
1148
+ [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1149
+ let response = undefined;
1150
+ if (type === 'spot') {
1151
+ response = await this.spotV1PublicGetTicker24hr(params);
1152
+ }
1153
+ else {
1154
+ response = await this.swapV2PublicGetQuoteTicker(params);
1147
1155
  }
1148
- const response = await this.swapV2PublicGetQuoteTicker(params);
1149
1156
  //
1150
1157
  // {
1151
1158
  // "code": 0,
@@ -2826,31 +2833,25 @@ class bingx extends bingx$1 {
2826
2833
  this.parseTransaction(data);
2827
2834
  }
2828
2835
  parseParams(params) {
2829
- let result = '';
2830
2836
  const sortedParams = this.keysort(params);
2831
2837
  const keys = Object.keys(sortedParams);
2832
2838
  for (let i = 0; i < keys.length; i++) {
2833
2839
  const key = keys[i];
2834
- if (i > 0) {
2835
- result += '&';
2836
- }
2837
2840
  const value = sortedParams[key];
2838
2841
  if (Array.isArray(value)) {
2839
- result += key + '=[';
2842
+ let arrStr = '[';
2840
2843
  for (let j = 0; j < value.length; j++) {
2841
2844
  const arrayElement = value[j];
2842
2845
  if (j > 0) {
2843
- result += ',';
2846
+ arrStr += ',';
2844
2847
  }
2845
- result += arrayElement.toString();
2848
+ arrStr += arrayElement.toString();
2846
2849
  }
2847
- result += ']';
2848
- }
2849
- else {
2850
- result += key + '=' + value.toString();
2850
+ arrStr += ']';
2851
+ sortedParams[key] = arrStr;
2851
2852
  }
2852
2853
  }
2853
- return result;
2854
+ return sortedParams;
2854
2855
  }
2855
2856
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2856
2857
  const type = section[0];
@@ -2869,6 +2870,7 @@ class bingx extends bingx$1 {
2869
2870
  params = this.omit(params, this.extractParams(path));
2870
2871
  params = this.keysort(params);
2871
2872
  if (access === 'public') {
2873
+ params['timestamp'] = this.nonce();
2872
2874
  if (Object.keys(params).length) {
2873
2875
  url += '?' + this.urlencode(params);
2874
2876
  }
@@ -2876,8 +2878,9 @@ class bingx extends bingx$1 {
2876
2878
  else if (access === 'private') {
2877
2879
  this.checkRequiredCredentials();
2878
2880
  params['timestamp'] = this.nonce();
2879
- let query = this.parseParams(params);
2880
- const signature = this.hmac(this.encode(query), this.encode(this.secret), sha256.sha256);
2881
+ const parsedParams = this.parseParams(params);
2882
+ let query = this.urlencode(parsedParams);
2883
+ const signature = this.hmac(this.encode(this.rawencode(parsedParams)), this.encode(this.secret), sha256.sha256);
2881
2884
  if (Object.keys(params).length) {
2882
2885
  query = '?' + query + '&';
2883
2886
  }
@@ -221,6 +221,7 @@ class okx extends okx$1 {
221
221
  'tradingBot/grid/ai-param': 1,
222
222
  'tradingBot/grid/min-investment': 1,
223
223
  'tradingBot/public/rsi-back-testing': 1,
224
+ 'asset/exchange-list': 5 / 3,
224
225
  'finance/savings/lending-rate-summary': 5 / 3,
225
226
  'finance/savings/lending-rate-history': 5 / 3,
226
227
  // public broker
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
7
- declare const version = "4.0.76";
7
+ declare const version = "4.0.77";
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.77';
41
+ const version = '4.0.78';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -5,11 +5,11 @@ interface Exchange {
5
5
  spotV1PublicGetMarketTrades(params?: {}): Promise<implicitReturnType>;
6
6
  spotV1PublicGetMarketDepth(params?: {}): Promise<implicitReturnType>;
7
7
  spotV1PublicGetMarketKline(params?: {}): Promise<implicitReturnType>;
8
+ spotV1PublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
8
9
  spotV1PrivateGetTradeQuery(params?: {}): Promise<implicitReturnType>;
9
10
  spotV1PrivateGetTradeOpenOrders(params?: {}): Promise<implicitReturnType>;
10
11
  spotV1PrivateGetTradeHistoryOrders(params?: {}): Promise<implicitReturnType>;
11
12
  spotV1PrivateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
12
- spotV1PrivateGetTicker24hr(params?: {}): Promise<implicitReturnType>;
13
13
  spotV1PrivatePostTradeOrder(params?: {}): Promise<implicitReturnType>;
14
14
  spotV1PrivatePostTradeCancel(params?: {}): Promise<implicitReturnType>;
15
15
  spotV1PrivatePostTradeBatchOrders(params?: {}): Promise<implicitReturnType>;
@@ -59,6 +59,7 @@ interface okx {
59
59
  publicGetTradingBotGridAiParam(params?: {}): Promise<implicitReturnType>;
60
60
  publicGetTradingBotGridMinInvestment(params?: {}): Promise<implicitReturnType>;
61
61
  publicGetTradingBotPublicRsiBackTesting(params?: {}): Promise<implicitReturnType>;
62
+ publicGetAssetExchangeList(params?: {}): Promise<implicitReturnType>;
62
63
  publicGetFinanceSavingsLendingRateSummary(params?: {}): Promise<implicitReturnType>;
63
64
  publicGetFinanceSavingsLendingRateHistory(params?: {}): Promise<implicitReturnType>;
64
65
  publicGetFinanceSfpDcdProducts(params?: {}): Promise<implicitReturnType>;
@@ -59,6 +59,7 @@ interface okex {
59
59
  publicGetTradingBotGridAiParam(params?: {}): Promise<implicitReturnType>;
60
60
  publicGetTradingBotGridMinInvestment(params?: {}): Promise<implicitReturnType>;
61
61
  publicGetTradingBotPublicRsiBackTesting(params?: {}): Promise<implicitReturnType>;
62
+ publicGetAssetExchangeList(params?: {}): Promise<implicitReturnType>;
62
63
  publicGetFinanceSavingsLendingRateSummary(params?: {}): Promise<implicitReturnType>;
63
64
  publicGetFinanceSavingsLendingRateHistory(params?: {}): Promise<implicitReturnType>;
64
65
  publicGetFinanceSfpDcdProducts(params?: {}): Promise<implicitReturnType>;
@@ -59,6 +59,7 @@ interface Exchange {
59
59
  publicGetTradingBotGridAiParam(params?: {}): Promise<implicitReturnType>;
60
60
  publicGetTradingBotGridMinInvestment(params?: {}): Promise<implicitReturnType>;
61
61
  publicGetTradingBotPublicRsiBackTesting(params?: {}): Promise<implicitReturnType>;
62
+ publicGetAssetExchangeList(params?: {}): Promise<implicitReturnType>;
62
63
  publicGetFinanceSavingsLendingRateSummary(params?: {}): Promise<implicitReturnType>;
63
64
  publicGetFinanceSavingsLendingRateHistory(params?: {}): Promise<implicitReturnType>;
64
65
  publicGetFinanceSfpDcdProducts(params?: {}): Promise<implicitReturnType>;
@@ -734,6 +734,7 @@ export default class Exchange {
734
734
  amountToPrecision(symbol: string, amount: any): any;
735
735
  feeToPrecision(symbol: string, fee: any): any;
736
736
  currencyToPrecision(code: string, fee: any, networkCode?: any): any;
737
+ forceString(value: any): any;
737
738
  isTickPrecision(): boolean;
738
739
  isDecimalPrecision(): boolean;
739
740
  isSignificantPrecision(): boolean;
@@ -3361,12 +3361,18 @@ export default class Exchange {
3361
3361
  precision = this.safeValue(networkItem, 'precision', precision);
3362
3362
  }
3363
3363
  if (precision === undefined) {
3364
- return fee;
3364
+ return this.forceString(fee);
3365
3365
  }
3366
3366
  else {
3367
3367
  return this.decimalToPrecision(fee, ROUND, precision, this.precisionMode, this.paddingMode);
3368
3368
  }
3369
3369
  }
3370
+ forceString(value) {
3371
+ if (typeof value !== 'string') {
3372
+ return this.numberToString(value);
3373
+ }
3374
+ return value;
3375
+ }
3370
3376
  isTickPrecision() {
3371
3377
  return this.precisionMode === TICK_SIZE;
3372
3378
  }
package/js/src/bingx.d.ts CHANGED
@@ -205,7 +205,7 @@ export default class bingx extends Exchange {
205
205
  };
206
206
  fetchDepositWithdrawFees(codes?: string[], params?: {}): Promise<any>;
207
207
  withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<void>;
208
- parseParams(params: any): string;
208
+ parseParams(params: any): {};
209
209
  sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
210
210
  url: any;
211
211
  method: string;
package/js/src/bingx.js CHANGED
@@ -93,6 +93,7 @@ export default class bingx extends Exchange {
93
93
  'market/trades': 3,
94
94
  'market/depth': 3,
95
95
  'market/kline': 3,
96
+ 'ticker/24hr': 1,
96
97
  },
97
98
  },
98
99
  'private': {
@@ -101,7 +102,6 @@ export default class bingx extends Exchange {
101
102
  'trade/openOrders': 3,
102
103
  'trade/historyOrders': 3,
103
104
  'account/balance': 3,
104
- 'ticker/24hr': 1,
105
105
  },
106
106
  'post': {
107
107
  'trade/order': 3,
@@ -258,6 +258,7 @@ export default class bingx extends Exchange {
258
258
  '500': ExchangeError,
259
259
  '504': ExchangeError,
260
260
  '100001': AuthenticationError,
261
+ '100412': AuthenticationError,
261
262
  '100202': InsufficientFunds,
262
263
  '100400': BadRequest,
263
264
  '100440': ExchangeError,
@@ -1100,7 +1101,7 @@ export default class bingx extends Exchange {
1100
1101
  };
1101
1102
  let response = undefined;
1102
1103
  if (market['spot']) {
1103
- response = await this.spotV1PrivateGetTicker24hr(this.extend(request, params));
1104
+ response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
1104
1105
  }
1105
1106
  else {
1106
1107
  response = await this.swapV2PublicGetQuoteTicker(this.extend(request, params));
@@ -1140,15 +1141,21 @@ export default class bingx extends Exchange {
1140
1141
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
1141
1142
  */
1142
1143
  await this.loadMarkets();
1144
+ let market = undefined;
1143
1145
  if (symbols !== undefined) {
1144
1146
  symbols = this.marketSymbols(symbols);
1145
1147
  const firstSymbol = this.safeString(symbols, 0);
1146
- const market = this.market(firstSymbol);
1147
- if (!market['swap']) {
1148
- throw new BadRequest(this.id + ' fetchTicker is only supported for swap markets.');
1149
- }
1148
+ market = this.market(firstSymbol);
1149
+ }
1150
+ let type = undefined;
1151
+ [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1152
+ let response = undefined;
1153
+ if (type === 'spot') {
1154
+ response = await this.spotV1PublicGetTicker24hr(params);
1155
+ }
1156
+ else {
1157
+ response = await this.swapV2PublicGetQuoteTicker(params);
1150
1158
  }
1151
- const response = await this.swapV2PublicGetQuoteTicker(params);
1152
1159
  //
1153
1160
  // {
1154
1161
  // "code": 0,
@@ -2829,31 +2836,25 @@ export default class bingx extends Exchange {
2829
2836
  this.parseTransaction(data);
2830
2837
  }
2831
2838
  parseParams(params) {
2832
- let result = '';
2833
2839
  const sortedParams = this.keysort(params);
2834
2840
  const keys = Object.keys(sortedParams);
2835
2841
  for (let i = 0; i < keys.length; i++) {
2836
2842
  const key = keys[i];
2837
- if (i > 0) {
2838
- result += '&';
2839
- }
2840
2843
  const value = sortedParams[key];
2841
2844
  if (Array.isArray(value)) {
2842
- result += key + '=[';
2845
+ let arrStr = '[';
2843
2846
  for (let j = 0; j < value.length; j++) {
2844
2847
  const arrayElement = value[j];
2845
2848
  if (j > 0) {
2846
- result += ',';
2849
+ arrStr += ',';
2847
2850
  }
2848
- result += arrayElement.toString();
2851
+ arrStr += arrayElement.toString();
2849
2852
  }
2850
- result += ']';
2851
- }
2852
- else {
2853
- result += key + '=' + value.toString();
2853
+ arrStr += ']';
2854
+ sortedParams[key] = arrStr;
2854
2855
  }
2855
2856
  }
2856
- return result;
2857
+ return sortedParams;
2857
2858
  }
2858
2859
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2859
2860
  const type = section[0];
@@ -2872,6 +2873,7 @@ export default class bingx extends Exchange {
2872
2873
  params = this.omit(params, this.extractParams(path));
2873
2874
  params = this.keysort(params);
2874
2875
  if (access === 'public') {
2876
+ params['timestamp'] = this.nonce();
2875
2877
  if (Object.keys(params).length) {
2876
2878
  url += '?' + this.urlencode(params);
2877
2879
  }
@@ -2879,8 +2881,9 @@ export default class bingx extends Exchange {
2879
2881
  else if (access === 'private') {
2880
2882
  this.checkRequiredCredentials();
2881
2883
  params['timestamp'] = this.nonce();
2882
- let query = this.parseParams(params);
2883
- const signature = this.hmac(this.encode(query), this.encode(this.secret), sha256);
2884
+ const parsedParams = this.parseParams(params);
2885
+ let query = this.urlencode(parsedParams);
2886
+ const signature = this.hmac(this.encode(this.rawencode(parsedParams)), this.encode(this.secret), sha256);
2884
2887
  if (Object.keys(params).length) {
2885
2888
  query = '?' + query + '&';
2886
2889
  }
package/js/src/okx.js CHANGED
@@ -224,6 +224,7 @@ export default class okx extends Exchange {
224
224
  'tradingBot/grid/ai-param': 1,
225
225
  'tradingBot/grid/min-investment': 1,
226
226
  'tradingBot/public/rsi-back-testing': 1,
227
+ 'asset/exchange-list': 5 / 3,
227
228
  'finance/savings/lending-rate-summary': 5 / 3,
228
229
  'finance/savings/lending-rate-history': 5 / 3,
229
230
  // public broker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.0.77",
3
+ "version": "4.0.78",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
package/skip-tests.json CHANGED
@@ -630,7 +630,6 @@
630
630
  }
631
631
  },
632
632
  "currencycom": {
633
- "skip": true,
634
633
  "skipWs": true,
635
634
  "skipMethods": {
636
635
  "loadMarkets": {