ccxt 4.0.76 → 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/README.md +3 -3
- package/dist/ccxt.browser.js +99 -28
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +7 -1
- package/dist/cjs/src/bingx.js +44 -26
- package/dist/cjs/src/gate.js +42 -0
- package/dist/cjs/src/okx.js +1 -0
- package/dist/cjs/src/pro/okx.js +3 -0
- package/dist/cjs/src/whitebit.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +1 -1
- package/js/src/abstract/gate.d.ts +24 -0
- package/js/src/abstract/gateio.d.ts +24 -0
- package/js/src/abstract/okex.d.ts +1 -0
- package/js/src/abstract/okex5.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +7 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +44 -26
- package/js/src/gate.js +42 -0
- package/js/src/okx.js +1 -0
- package/js/src/pro/okx.js +4 -1
- package/js/src/whitebit.js +1 -0
- package/package.json +1 -1
- package/skip-tests.json +0 -1
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,10 +1101,10 @@ export default class bingx extends Exchange {
|
|
|
1100
1101
|
};
|
|
1101
1102
|
let response = undefined;
|
|
1102
1103
|
if (market['spot']) {
|
|
1103
|
-
response = await this.
|
|
1104
|
+
response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
|
|
1104
1105
|
}
|
|
1105
1106
|
else {
|
|
1106
|
-
response = await this.
|
|
1107
|
+
response = await this.swapV2PublicGetQuoteTicker(this.extend(request, params));
|
|
1107
1108
|
}
|
|
1108
1109
|
//
|
|
1109
1110
|
// {
|
|
@@ -1126,7 +1127,8 @@ export default class bingx extends Exchange {
|
|
|
1126
1127
|
// }
|
|
1127
1128
|
//
|
|
1128
1129
|
const data = this.safeValue(response, 'data');
|
|
1129
|
-
|
|
1130
|
+
const ticker = this.safeValue(data, 0, data);
|
|
1131
|
+
return this.parseTicker(ticker, market);
|
|
1130
1132
|
}
|
|
1131
1133
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
1132
1134
|
/**
|
|
@@ -1139,15 +1141,21 @@ export default class bingx extends Exchange {
|
|
|
1139
1141
|
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
1140
1142
|
*/
|
|
1141
1143
|
await this.loadMarkets();
|
|
1144
|
+
let market = undefined;
|
|
1142
1145
|
if (symbols !== undefined) {
|
|
1143
1146
|
symbols = this.marketSymbols(symbols);
|
|
1144
1147
|
const firstSymbol = this.safeString(symbols, 0);
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
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);
|
|
1149
1158
|
}
|
|
1150
|
-
const response = await this.swapV2PublicGetQuoteTicker(params);
|
|
1151
1159
|
//
|
|
1152
1160
|
// {
|
|
1153
1161
|
// "code": 0,
|
|
@@ -1174,6 +1182,20 @@ export default class bingx extends Exchange {
|
|
|
1174
1182
|
return this.parseTickers(tickers, symbols);
|
|
1175
1183
|
}
|
|
1176
1184
|
parseTicker(ticker, market = undefined) {
|
|
1185
|
+
//
|
|
1186
|
+
// spot
|
|
1187
|
+
// {
|
|
1188
|
+
// symbol: 'BTC-USDT',
|
|
1189
|
+
// openPrice: '26032.08',
|
|
1190
|
+
// highPrice: '26178.86',
|
|
1191
|
+
// lowPrice: '25968.18',
|
|
1192
|
+
// lastPrice: '26113.60',
|
|
1193
|
+
// volume: '1161.79',
|
|
1194
|
+
// quoteVolume: '30288466.44',
|
|
1195
|
+
// openTime: '1693081020762',
|
|
1196
|
+
// closeTime: '1693167420762'
|
|
1197
|
+
// }
|
|
1198
|
+
// swap
|
|
1177
1199
|
//
|
|
1178
1200
|
// {
|
|
1179
1201
|
// "symbol": "BTC-USDT",
|
|
@@ -1191,15 +1213,15 @@ export default class bingx extends Exchange {
|
|
|
1191
1213
|
// }
|
|
1192
1214
|
//
|
|
1193
1215
|
const marketId = this.safeString(ticker, 'symbol');
|
|
1194
|
-
const
|
|
1195
|
-
const
|
|
1216
|
+
const change = this.safeString(ticker, 'priceChange');
|
|
1217
|
+
const type = (change === undefined) ? 'spot' : 'swap';
|
|
1218
|
+
const symbol = this.safeSymbol(marketId, market, undefined, type);
|
|
1196
1219
|
const open = this.safeString(ticker, 'openPrice');
|
|
1197
1220
|
const high = this.safeString(ticker, 'highPrice');
|
|
1198
1221
|
const low = this.safeString(ticker, 'lowPrice');
|
|
1199
1222
|
const close = this.safeString(ticker, 'lastPrice');
|
|
1200
1223
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
1201
1224
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
1202
|
-
const change = this.safeString(ticker, 'chapriceChangenge');
|
|
1203
1225
|
const percentage = this.safeString(ticker, 'priceChangePercent');
|
|
1204
1226
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
1205
1227
|
const datetime = this.iso8601(ts);
|
|
@@ -2814,31 +2836,25 @@ export default class bingx extends Exchange {
|
|
|
2814
2836
|
this.parseTransaction(data);
|
|
2815
2837
|
}
|
|
2816
2838
|
parseParams(params) {
|
|
2817
|
-
let result = '';
|
|
2818
2839
|
const sortedParams = this.keysort(params);
|
|
2819
2840
|
const keys = Object.keys(sortedParams);
|
|
2820
2841
|
for (let i = 0; i < keys.length; i++) {
|
|
2821
2842
|
const key = keys[i];
|
|
2822
|
-
if (i > 0) {
|
|
2823
|
-
result += '&';
|
|
2824
|
-
}
|
|
2825
2843
|
const value = sortedParams[key];
|
|
2826
2844
|
if (Array.isArray(value)) {
|
|
2827
|
-
|
|
2845
|
+
let arrStr = '[';
|
|
2828
2846
|
for (let j = 0; j < value.length; j++) {
|
|
2829
2847
|
const arrayElement = value[j];
|
|
2830
2848
|
if (j > 0) {
|
|
2831
|
-
|
|
2849
|
+
arrStr += ',';
|
|
2832
2850
|
}
|
|
2833
|
-
|
|
2851
|
+
arrStr += arrayElement.toString();
|
|
2834
2852
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
else {
|
|
2838
|
-
result += key + '=' + value.toString();
|
|
2853
|
+
arrStr += ']';
|
|
2854
|
+
sortedParams[key] = arrStr;
|
|
2839
2855
|
}
|
|
2840
2856
|
}
|
|
2841
|
-
return
|
|
2857
|
+
return sortedParams;
|
|
2842
2858
|
}
|
|
2843
2859
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
2844
2860
|
const type = section[0];
|
|
@@ -2857,6 +2873,7 @@ export default class bingx extends Exchange {
|
|
|
2857
2873
|
params = this.omit(params, this.extractParams(path));
|
|
2858
2874
|
params = this.keysort(params);
|
|
2859
2875
|
if (access === 'public') {
|
|
2876
|
+
params['timestamp'] = this.nonce();
|
|
2860
2877
|
if (Object.keys(params).length) {
|
|
2861
2878
|
url += '?' + this.urlencode(params);
|
|
2862
2879
|
}
|
|
@@ -2864,8 +2881,9 @@ export default class bingx extends Exchange {
|
|
|
2864
2881
|
else if (access === 'private') {
|
|
2865
2882
|
this.checkRequiredCredentials();
|
|
2866
2883
|
params['timestamp'] = this.nonce();
|
|
2867
|
-
|
|
2868
|
-
|
|
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);
|
|
2869
2887
|
if (Object.keys(params).length) {
|
|
2870
2888
|
query = '?' + query + '&';
|
|
2871
2889
|
}
|
package/js/src/gate.js
CHANGED
|
@@ -280,6 +280,29 @@ export default class gate extends Exchange {
|
|
|
280
280
|
'sub_accounts/{user_id}/keys/{key}': 1,
|
|
281
281
|
},
|
|
282
282
|
},
|
|
283
|
+
'portfolio': {
|
|
284
|
+
'get': {
|
|
285
|
+
'accounts': 1.5,
|
|
286
|
+
'account_mode': 1.5,
|
|
287
|
+
'borrowable': 1.5,
|
|
288
|
+
'transferable': 1.5,
|
|
289
|
+
'loans': 1.5,
|
|
290
|
+
'loan_records': 1.5,
|
|
291
|
+
'interest_records': 1.5,
|
|
292
|
+
'spot/orders': 1.5,
|
|
293
|
+
'spot/orders/{order_id}': 1.5,
|
|
294
|
+
},
|
|
295
|
+
'post': {
|
|
296
|
+
'loans': 1.5,
|
|
297
|
+
'spot/orders': 1.5,
|
|
298
|
+
},
|
|
299
|
+
'delete': {
|
|
300
|
+
'spot/orders/{order_id}': 1.5,
|
|
301
|
+
},
|
|
302
|
+
'patch': {
|
|
303
|
+
'spot/orders/{order_id}': 1.5,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
283
306
|
'spot': {
|
|
284
307
|
'get': {
|
|
285
308
|
'fee': 1,
|
|
@@ -473,6 +496,22 @@ export default class gate extends Exchange {
|
|
|
473
496
|
'uni/lends': 1.5,
|
|
474
497
|
},
|
|
475
498
|
},
|
|
499
|
+
'loan': {
|
|
500
|
+
'get': {
|
|
501
|
+
'collateral/orders': 1.5,
|
|
502
|
+
'collateral/orders/{order_id}': 1.5,
|
|
503
|
+
'collateral/repay_records': 1.5,
|
|
504
|
+
'collateral/collaterals': 1.5,
|
|
505
|
+
'collateral/total_amount': 1.5,
|
|
506
|
+
'collateral/ltv': 1.5,
|
|
507
|
+
'collateral/currencies': 1.5,
|
|
508
|
+
},
|
|
509
|
+
'post': {
|
|
510
|
+
'collateral/orders': 1.5,
|
|
511
|
+
'collateral/repay': 1.5,
|
|
512
|
+
'collateral/collaterals': 1.5,
|
|
513
|
+
},
|
|
514
|
+
},
|
|
476
515
|
'account': {
|
|
477
516
|
'get': {
|
|
478
517
|
'detail': 1.5,
|
|
@@ -483,6 +522,9 @@ export default class gate extends Exchange {
|
|
|
483
522
|
'stp_groups': 1.5,
|
|
484
523
|
'stp_groups/{stp_id}/users': 1.5,
|
|
485
524
|
},
|
|
525
|
+
'delete': {
|
|
526
|
+
'stp_groups/{stp_id}/users': 1.5,
|
|
527
|
+
},
|
|
486
528
|
},
|
|
487
529
|
'rebate': {
|
|
488
530
|
'get': {
|
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/js/src/pro/okx.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import okxRest from '../okx.js';
|
|
9
|
-
import { AuthenticationError, BadRequest, InvalidNonce } from '../base/errors.js';
|
|
9
|
+
import { ArgumentsRequired, AuthenticationError, BadRequest, InvalidNonce } from '../base/errors.js';
|
|
10
10
|
import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById } from '../base/ws/Cache.js';
|
|
11
11
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
@@ -233,6 +233,9 @@ export default class okx extends okxRest {
|
|
|
233
233
|
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
234
234
|
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
235
235
|
*/
|
|
236
|
+
if (this.isEmpty(symbols)) {
|
|
237
|
+
throw new ArgumentsRequired(this.id + ' watchTickers requires a list of symbols');
|
|
238
|
+
}
|
|
236
239
|
let channel = undefined;
|
|
237
240
|
[channel, params] = this.handleOptionAndParams(params, 'watchTickers', 'channel', 'tickers');
|
|
238
241
|
const newTickers = await this.subscribeMultiple('public', channel, symbols, params);
|
package/js/src/whitebit.js
CHANGED
|
@@ -256,6 +256,7 @@ export default class whitebit extends Exchange {
|
|
|
256
256
|
'422': OrderNotFound, // {"response":null,"status":422,"errors":{"orderId":["Finished order id 1295772653 not found on your account"]},"notification":null,"warning":"Finished order id 1295772653 not found on your account","_token":null}
|
|
257
257
|
},
|
|
258
258
|
'broad': {
|
|
259
|
+
'This action is unauthorized': PermissionDenied,
|
|
259
260
|
'Given amount is less than min amount': InvalidOrder,
|
|
260
261
|
'Total is less than': InvalidOrder,
|
|
261
262
|
'fee must be no less than': InvalidOrder,
|
package/package.json
CHANGED