ccxt 4.2.44 → 4.2.46
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/CHANGELOG.md +3099 -8415
- package/README.md +4 -4
- package/change.sh +4 -2
- package/dist/ccxt.browser.js +1242 -195
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +48 -0
- package/dist/cjs/src/base/ws/Cache.js +13 -5
- package/dist/cjs/src/base/ws/OrderBook.js +2 -2
- package/dist/cjs/src/binance.js +407 -21
- package/dist/cjs/src/bingx.js +43 -5
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bithumb.js +5 -0
- package/dist/cjs/src/bitstamp.js +1 -1
- package/dist/cjs/src/btcturk.js +11 -0
- package/dist/cjs/src/bybit.js +96 -43
- package/dist/cjs/src/coinbase.js +228 -38
- package/dist/cjs/src/coincheck.js +11 -0
- package/dist/cjs/src/coinmate.js +114 -1
- package/dist/cjs/src/coinspot.js +7 -0
- package/dist/cjs/src/cryptocom.js +2 -2
- package/dist/cjs/src/deribit.js +1 -1
- package/dist/cjs/src/hitbtc.js +2 -0
- package/dist/cjs/src/idex.js +60 -1
- package/dist/cjs/src/latoken.js +3 -0
- package/dist/cjs/src/mercado.js +3 -0
- package/dist/cjs/src/oceanex.js +3 -0
- package/dist/cjs/src/okx.js +1 -0
- package/dist/cjs/src/pro/bitget.js +12 -8
- package/dist/cjs/src/pro/bitmart.js +11 -11
- package/dist/cjs/src/pro/bitmex.js +4 -4
- package/dist/cjs/src/pro/cex.js +2 -2
- package/dist/cjs/src/pro/gate.js +76 -42
- package/dist/cjs/src/pro/gemini.js +4 -3
- package/dist/cjs/src/pro/hitbtc.js +1 -0
- package/dist/cjs/src/probit.js +3 -3
- package/dist/cjs/src/timex.js +65 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bequant.d.ts +2 -0
- package/js/src/abstract/bitcoincom.d.ts +2 -0
- package/js/src/abstract/bithumb.d.ts +5 -0
- package/js/src/abstract/coinbase.d.ts +1 -0
- package/js/src/abstract/coinmate.d.ts +12 -0
- package/js/src/abstract/fmfwio.d.ts +2 -0
- package/js/src/abstract/hitbtc.d.ts +2 -0
- package/js/src/abstract/hitbtc3.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +12 -6
- package/js/src/base/Exchange.js +48 -0
- package/js/src/base/ws/Cache.d.ts +5 -1
- package/js/src/base/ws/Cache.js +13 -5
- package/js/src/base/ws/OrderBook.d.ts +5 -1
- package/js/src/base/ws/OrderBook.js +3 -3
- package/js/src/binance.d.ts +2 -1
- package/js/src/binance.js +407 -21
- package/js/src/bingx.d.ts +2 -1
- package/js/src/bingx.js +43 -5
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bithumb.js +5 -0
- package/js/src/bitstamp.js +1 -1
- package/js/src/btcturk.js +11 -0
- package/js/src/bybit.d.ts +4 -1
- package/js/src/bybit.js +96 -43
- package/js/src/coinbase.d.ts +10 -4
- package/js/src/coinbase.js +228 -38
- package/js/src/coincheck.js +11 -0
- package/js/src/coinmate.d.ts +3 -1
- package/js/src/coinmate.js +114 -1
- package/js/src/coinspot.js +7 -0
- package/js/src/cryptocom.js +2 -2
- package/js/src/deribit.js +1 -1
- package/js/src/hitbtc.js +2 -0
- package/js/src/idex.d.ts +14 -0
- package/js/src/idex.js +60 -1
- package/js/src/latoken.js +3 -0
- package/js/src/mercado.js +3 -0
- package/js/src/oceanex.js +3 -0
- package/js/src/okx.js +1 -0
- package/js/src/pro/bitget.js +12 -8
- package/js/src/pro/bitmart.js +11 -11
- package/js/src/pro/bitmex.js +4 -4
- package/js/src/pro/cex.js +2 -2
- package/js/src/pro/gate.d.ts +4 -0
- package/js/src/pro/gate.js +76 -42
- package/js/src/pro/gemini.js +4 -3
- package/js/src/pro/hitbtc.js +1 -0
- package/js/src/probit.js +3 -3
- package/js/src/timex.d.ts +14 -0
- package/js/src/timex.js +65 -0
- package/package.json +1 -1
- package/skip-tests.json +4 -0
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -272,6 +272,7 @@ class gate extends gate$1 {
|
|
|
272
272
|
/**
|
|
273
273
|
* @method
|
|
274
274
|
* @name gate#watchTicker
|
|
275
|
+
* @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
|
|
275
276
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
276
277
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
277
278
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -280,45 +281,21 @@ class gate extends gate$1 {
|
|
|
280
281
|
await this.loadMarkets();
|
|
281
282
|
const market = this.market(symbol);
|
|
282
283
|
symbol = market['symbol'];
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'name', 'tickers');
|
|
287
|
-
const channel = messageType + '.' + topic;
|
|
288
|
-
const messageHash = 'ticker:' + symbol;
|
|
289
|
-
const payload = [marketId];
|
|
290
|
-
return await this.subscribePublic(url, messageHash, payload, channel, query);
|
|
284
|
+
params['callerMethodName'] = 'watchTicker';
|
|
285
|
+
const result = await this.watchTickers([symbol], params);
|
|
286
|
+
return this.safeValue(result, symbol);
|
|
291
287
|
}
|
|
292
288
|
async watchTickers(symbols = undefined, params = {}) {
|
|
293
289
|
/**
|
|
294
290
|
* @method
|
|
295
291
|
* @name gate#watchTickers
|
|
292
|
+
* @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
|
|
296
293
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
297
294
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
298
295
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
299
296
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
300
297
|
*/
|
|
301
|
-
await this.
|
|
302
|
-
symbols = this.marketSymbols(symbols);
|
|
303
|
-
if (symbols === undefined) {
|
|
304
|
-
throw new errors.ArgumentsRequired(this.id + ' watchTickers requires symbols');
|
|
305
|
-
}
|
|
306
|
-
const market = this.market(symbols[0]);
|
|
307
|
-
const messageType = this.getTypeByMarket(market);
|
|
308
|
-
const marketIds = this.marketIds(symbols);
|
|
309
|
-
const [topic, query] = this.handleOptionAndParams(params, 'watchTicker', 'method', 'tickers');
|
|
310
|
-
const channel = messageType + '.' + topic;
|
|
311
|
-
const messageHash = 'tickers';
|
|
312
|
-
const url = this.getUrlByMarket(market);
|
|
313
|
-
const ticker = await this.subscribePublic(url, messageHash, marketIds, channel, query);
|
|
314
|
-
let result = {};
|
|
315
|
-
if (this.newUpdates) {
|
|
316
|
-
result[ticker['symbol']] = ticker;
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
result = this.tickers;
|
|
320
|
-
}
|
|
321
|
-
return this.filterByArray(result, 'symbol', symbols, true);
|
|
298
|
+
return await this.subscribeWatchTickersAndBidsAsks(symbols, 'watchTickers', this.extend({ 'method': 'tickers' }, params));
|
|
322
299
|
}
|
|
323
300
|
handleTicker(client, message) {
|
|
324
301
|
//
|
|
@@ -338,6 +315,24 @@ class gate extends gate$1 {
|
|
|
338
315
|
// "low_24h": "42721.03"
|
|
339
316
|
// }
|
|
340
317
|
// }
|
|
318
|
+
//
|
|
319
|
+
this.handleTickerAndBidAsk('ticker', client, message);
|
|
320
|
+
}
|
|
321
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
322
|
+
/**
|
|
323
|
+
* @method
|
|
324
|
+
* @name gate#watchBidsAsks
|
|
325
|
+
* @see https://www.gate.io/docs/developers/apiv4/ws/en/#best-bid-or-ask-price
|
|
326
|
+
* @see https://www.gate.io/docs/developers/apiv4/ws/en/#order-book-channel
|
|
327
|
+
* @description watches best bid & ask for symbols
|
|
328
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
329
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
330
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
331
|
+
*/
|
|
332
|
+
return await this.subscribeWatchTickersAndBidsAsks(symbols, 'watchBidsAsks', this.extend({ 'method': 'book_ticker' }, params));
|
|
333
|
+
}
|
|
334
|
+
handleBidAsk(client, message) {
|
|
335
|
+
//
|
|
341
336
|
// {
|
|
342
337
|
// "time": 1671363004,
|
|
343
338
|
// "time_ms": 1671363004235,
|
|
@@ -354,24 +349,63 @@ class gate extends gate$1 {
|
|
|
354
349
|
// }
|
|
355
350
|
// }
|
|
356
351
|
//
|
|
352
|
+
this.handleTickerAndBidAsk('bidask', client, message);
|
|
353
|
+
}
|
|
354
|
+
async subscribeWatchTickersAndBidsAsks(symbols = undefined, callerMethodName = undefined, params = {}) {
|
|
355
|
+
await this.loadMarkets();
|
|
356
|
+
[callerMethodName, params] = this.handleParamString(params, 'callerMethodName', callerMethodName);
|
|
357
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
358
|
+
const market = this.market(symbols[0]);
|
|
359
|
+
const messageType = this.getTypeByMarket(market);
|
|
360
|
+
const marketIds = this.marketIds(symbols);
|
|
361
|
+
let channelName = undefined;
|
|
362
|
+
[channelName, params] = this.handleOptionAndParams(params, callerMethodName, 'method');
|
|
363
|
+
const url = this.getUrlByMarket(market);
|
|
364
|
+
const channel = messageType + '.' + channelName;
|
|
365
|
+
const isWatchTickers = callerMethodName.indexOf('watchTicker') >= 0;
|
|
366
|
+
const prefix = isWatchTickers ? 'ticker' : 'bidask';
|
|
367
|
+
const messageHashes = [];
|
|
368
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
369
|
+
const symbol = symbols[i];
|
|
370
|
+
messageHashes.push(prefix + ':' + symbol);
|
|
371
|
+
}
|
|
372
|
+
const tickerOrBidAsk = await this.subscribePublicMultiple(url, messageHashes, marketIds, channel, params);
|
|
373
|
+
if (this.newUpdates) {
|
|
374
|
+
const items = {};
|
|
375
|
+
items[tickerOrBidAsk['symbol']] = tickerOrBidAsk;
|
|
376
|
+
return items;
|
|
377
|
+
}
|
|
378
|
+
const result = isWatchTickers ? this.tickers : this.bidsasks;
|
|
379
|
+
return this.filterByArray(result, 'symbol', symbols, true);
|
|
380
|
+
}
|
|
381
|
+
handleTickerAndBidAsk(objectName, client, message) {
|
|
357
382
|
const channel = this.safeString(message, 'channel');
|
|
358
383
|
const parts = channel.split('.');
|
|
359
384
|
const rawMarketType = this.safeString(parts, 0);
|
|
360
385
|
const marketType = (rawMarketType === 'futures') ? 'contract' : 'spot';
|
|
361
|
-
let
|
|
362
|
-
if (
|
|
363
|
-
|
|
386
|
+
let results = [];
|
|
387
|
+
if (marketType === 'contract') {
|
|
388
|
+
results = this.safeList(message, 'result', []);
|
|
364
389
|
}
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
|
|
390
|
+
else {
|
|
391
|
+
const rawTicker = this.safeDict(message, 'result', {});
|
|
392
|
+
results = [rawTicker];
|
|
393
|
+
}
|
|
394
|
+
const isTicker = (objectName === 'ticker'); // whether ticker or bid-ask
|
|
395
|
+
for (let i = 0; i < results.length; i++) {
|
|
396
|
+
const rawTicker = results[i];
|
|
397
|
+
const marketId = this.safeString(rawTicker, 's');
|
|
368
398
|
const market = this.safeMarket(marketId, undefined, '_', marketType);
|
|
369
|
-
const
|
|
370
|
-
const symbol =
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
399
|
+
const parsedItem = this.parseTicker(rawTicker, market);
|
|
400
|
+
const symbol = parsedItem['symbol'];
|
|
401
|
+
if (isTicker) {
|
|
402
|
+
this.tickers[symbol] = parsedItem;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
this.bidsasks[symbol] = parsedItem;
|
|
406
|
+
}
|
|
407
|
+
const messageHash = objectName + ':' + symbol;
|
|
408
|
+
client.resolve(parsedItem, messageHash);
|
|
375
409
|
}
|
|
376
410
|
}
|
|
377
411
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
@@ -1172,7 +1206,7 @@ class gate extends gate$1 {
|
|
|
1172
1206
|
'orders': this.handleOrder,
|
|
1173
1207
|
'positions': this.handlePositions,
|
|
1174
1208
|
'tickers': this.handleTicker,
|
|
1175
|
-
'book_ticker': this.
|
|
1209
|
+
'book_ticker': this.handleBidAsk,
|
|
1176
1210
|
'trades': this.handleTrades,
|
|
1177
1211
|
'order_book_update': this.handleOrderBook,
|
|
1178
1212
|
'balances': this.handleBalance,
|
|
@@ -460,10 +460,11 @@ class gemini extends gemini$1 {
|
|
|
460
460
|
const market = this.safeMarket(marketId.toLowerCase());
|
|
461
461
|
const symbol = market['symbol'];
|
|
462
462
|
const messageHash = 'orderbook:' + symbol;
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
463
|
+
if (!(symbol in this.orderbooks)) {
|
|
464
|
+
const ob = this.orderBook();
|
|
465
|
+
this.orderbooks[symbol] = ob;
|
|
466
466
|
}
|
|
467
|
+
const orderbook = this.orderbooks[symbol];
|
|
467
468
|
const bids = orderbook['bids'];
|
|
468
469
|
const asks = orderbook['asks'];
|
|
469
470
|
for (let i = 0; i < rawOrderBookChanges.length; i++) {
|
|
@@ -408,6 +408,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
408
408
|
const messageHash = channel + '::' + symbol;
|
|
409
409
|
client.resolve(newTickers, messageHash);
|
|
410
410
|
}
|
|
411
|
+
client.resolve(newTickers, 'tickers');
|
|
411
412
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
412
413
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
413
414
|
const messageHash = messageHashes[i];
|
package/dist/cjs/src/probit.js
CHANGED
|
@@ -1589,12 +1589,12 @@ class probit extends probit$1 {
|
|
|
1589
1589
|
const currencyId = this.safeString(transaction, 'currency_id');
|
|
1590
1590
|
const code = this.safeCurrencyCode(currencyId);
|
|
1591
1591
|
const status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
1592
|
-
const
|
|
1592
|
+
const feeCostString = this.safeString(transaction, 'fee');
|
|
1593
1593
|
let fee = undefined;
|
|
1594
|
-
if (
|
|
1594
|
+
if (feeCostString !== undefined && feeCostString !== '0') {
|
|
1595
1595
|
fee = {
|
|
1596
1596
|
'currency': code,
|
|
1597
|
-
'cost':
|
|
1597
|
+
'cost': this.parseNumber(feeCostString),
|
|
1598
1598
|
};
|
|
1599
1599
|
}
|
|
1600
1600
|
return {
|
package/dist/cjs/src/timex.js
CHANGED
|
@@ -41,6 +41,9 @@ class timex extends timex$1 {
|
|
|
41
41
|
'fetchCrossBorrowRates': false,
|
|
42
42
|
'fetchCurrencies': true,
|
|
43
43
|
'fetchDeposit': false,
|
|
44
|
+
'fetchDepositAddress': true,
|
|
45
|
+
'fetchDepositAddresses': false,
|
|
46
|
+
'fetchDepositAddressesByNetwork': false,
|
|
44
47
|
'fetchDeposits': true,
|
|
45
48
|
'fetchFundingHistory': false,
|
|
46
49
|
'fetchFundingRate': false,
|
|
@@ -1521,7 +1524,69 @@ class timex extends timex$1 {
|
|
|
1521
1524
|
'trades': rawTrades,
|
|
1522
1525
|
}, market);
|
|
1523
1526
|
}
|
|
1527
|
+
async fetchDepositAddress(code, params = {}) {
|
|
1528
|
+
/**
|
|
1529
|
+
* @method
|
|
1530
|
+
* @name timex#fetchDepositAddress
|
|
1531
|
+
* @description fetch the deposit address for a currency associated with this account, does not accept params["network"]
|
|
1532
|
+
* @param {string} code unified currency code
|
|
1533
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1534
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1535
|
+
*/
|
|
1536
|
+
await this.loadMarkets();
|
|
1537
|
+
const currency = this.currency(code);
|
|
1538
|
+
const request = {
|
|
1539
|
+
'symbol': currency['code'],
|
|
1540
|
+
};
|
|
1541
|
+
const response = await this.currenciesGetSSymbol(this.extend(request, params));
|
|
1542
|
+
//
|
|
1543
|
+
// {
|
|
1544
|
+
// id: '1',
|
|
1545
|
+
// currency: {
|
|
1546
|
+
// symbol: 'BTC',
|
|
1547
|
+
// name: 'Bitcoin',
|
|
1548
|
+
// address: '0x8370fbc6ddec1e18b4e41e72ed943e238458487c',
|
|
1549
|
+
// decimals: '8',
|
|
1550
|
+
// tradeDecimals: '20',
|
|
1551
|
+
// fiatSymbol: 'BTC',
|
|
1552
|
+
// depositEnabled: true,
|
|
1553
|
+
// withdrawalEnabled: true,
|
|
1554
|
+
// transferEnabled: true,
|
|
1555
|
+
// active: true
|
|
1556
|
+
// }
|
|
1557
|
+
// }
|
|
1558
|
+
//
|
|
1559
|
+
const data = this.safeDict(response, 'currency', {});
|
|
1560
|
+
return this.parseDepositAddress(data, currency);
|
|
1561
|
+
}
|
|
1562
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
1563
|
+
//
|
|
1564
|
+
// {
|
|
1565
|
+
// symbol: 'BTC',
|
|
1566
|
+
// name: 'Bitcoin',
|
|
1567
|
+
// address: '0x8370fbc6ddec1e18b4e41e72ed943e238458487c',
|
|
1568
|
+
// decimals: '8',
|
|
1569
|
+
// tradeDecimals: '20',
|
|
1570
|
+
// fiatSymbol: 'BTC',
|
|
1571
|
+
// depositEnabled: true,
|
|
1572
|
+
// withdrawalEnabled: true,
|
|
1573
|
+
// transferEnabled: true,
|
|
1574
|
+
// active: true
|
|
1575
|
+
// }
|
|
1576
|
+
//
|
|
1577
|
+
const currencyId = this.safeString(depositAddress, 'symbol');
|
|
1578
|
+
return {
|
|
1579
|
+
'info': depositAddress,
|
|
1580
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
1581
|
+
'address': this.safeString(depositAddress, 'address'),
|
|
1582
|
+
'tag': undefined,
|
|
1583
|
+
'network': undefined,
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1524
1586
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
1587
|
+
const paramsToExtract = this.extractParams(path);
|
|
1588
|
+
path = this.implodeParams(path, params);
|
|
1589
|
+
params = this.omit(params, paramsToExtract);
|
|
1525
1590
|
let url = this.urls['api']['rest'] + '/' + api + '/' + path;
|
|
1526
1591
|
if (Object.keys(params).length) {
|
|
1527
1592
|
url += '?' + this.urlencodeWithArrayRepeat(params);
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } 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, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.45";
|
|
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, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.46';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -17,6 +17,8 @@ interface hitbtc {
|
|
|
17
17
|
publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
18
18
|
publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
22
|
publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
23
|
publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
24
|
publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
|
|
@@ -17,6 +17,8 @@ interface fmfwio {
|
|
|
17
17
|
publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
18
18
|
publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
22
|
publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
23
|
publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
24
|
publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
|
|
@@ -6,6 +6,11 @@ interface Exchange {
|
|
|
6
6
|
publicGetOrderbookALLQuoteId(params?: {}): Promise<implicitReturnType>;
|
|
7
7
|
publicGetOrderbookBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
|
|
8
8
|
publicGetTransactionHistoryBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
|
|
9
|
+
publicGetNetworkInfo(params?: {}): Promise<implicitReturnType>;
|
|
10
|
+
publicGetAssetsstatusMultichainALL(params?: {}): Promise<implicitReturnType>;
|
|
11
|
+
publicGetAssetsstatusMultichainCurrency(params?: {}): Promise<implicitReturnType>;
|
|
12
|
+
publicGetWithdrawMinimumALL(params?: {}): Promise<implicitReturnType>;
|
|
13
|
+
publicGetWithdrawMinimumCurrency(params?: {}): Promise<implicitReturnType>;
|
|
9
14
|
publicGetAssetsstatusALL(params?: {}): Promise<implicitReturnType>;
|
|
10
15
|
publicGetAssetsstatusBaseId(params?: {}): Promise<implicitReturnType>;
|
|
11
16
|
publicGetCandlestickBaseIdQuoteIdInterval(params?: {}): Promise<implicitReturnType>;
|
|
@@ -2,6 +2,7 @@ import { implicitReturnType } from '../base/types.js';
|
|
|
2
2
|
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
3
|
interface Exchange {
|
|
4
4
|
v2PublicGetCurrencies(params?: {}): Promise<implicitReturnType>;
|
|
5
|
+
v2PublicGetCurrenciesCrypto(params?: {}): Promise<implicitReturnType>;
|
|
5
6
|
v2PublicGetTime(params?: {}): Promise<implicitReturnType>;
|
|
6
7
|
v2PublicGetExchangeRates(params?: {}): Promise<implicitReturnType>;
|
|
7
8
|
v2PublicGetUsersUserId(params?: {}): Promise<implicitReturnType>;
|
|
@@ -3,6 +3,8 @@ import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
|
3
3
|
interface Exchange {
|
|
4
4
|
publicGetOrderBook(params?: {}): Promise<implicitReturnType>;
|
|
5
5
|
publicGetTicker(params?: {}): Promise<implicitReturnType>;
|
|
6
|
+
publicGetTickerAll(params?: {}): Promise<implicitReturnType>;
|
|
7
|
+
publicGetProducts(params?: {}): Promise<implicitReturnType>;
|
|
6
8
|
publicGetTransactions(params?: {}): Promise<implicitReturnType>;
|
|
7
9
|
publicGetTradingPairs(params?: {}): Promise<implicitReturnType>;
|
|
8
10
|
privatePostBalances(params?: {}): Promise<implicitReturnType>;
|
|
@@ -47,6 +49,16 @@ interface Exchange {
|
|
|
47
49
|
privatePostUnconfirmedEthereumDeposits(params?: {}): Promise<implicitReturnType>;
|
|
48
50
|
privatePostUnconfirmedLitecoinDeposits(params?: {}): Promise<implicitReturnType>;
|
|
49
51
|
privatePostUnconfirmedRippleDeposits(params?: {}): Promise<implicitReturnType>;
|
|
52
|
+
privatePostCancelAllOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
53
|
+
privatePostWithdrawVirtualCurrency(params?: {}): Promise<implicitReturnType>;
|
|
54
|
+
privatePostVirtualCurrencyDepositAddresses(params?: {}): Promise<implicitReturnType>;
|
|
55
|
+
privatePostUnconfirmedVirtualCurrencyDeposits(params?: {}): Promise<implicitReturnType>;
|
|
56
|
+
privatePostAdaWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
57
|
+
privatePostAdaDepositAddresses(params?: {}): Promise<implicitReturnType>;
|
|
58
|
+
privatePostUnconfirmedAdaDeposits(params?: {}): Promise<implicitReturnType>;
|
|
59
|
+
privatePostSolWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
60
|
+
privatePostSolDepositAddresses(params?: {}): Promise<implicitReturnType>;
|
|
61
|
+
privatePostUnconfirmedSolDeposits(params?: {}): Promise<implicitReturnType>;
|
|
50
62
|
}
|
|
51
63
|
declare abstract class Exchange extends _Exchange {
|
|
52
64
|
}
|
|
@@ -17,6 +17,8 @@ interface hitbtc {
|
|
|
17
17
|
publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
18
18
|
publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
22
|
publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
23
|
publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
24
|
publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
|
|
@@ -17,6 +17,8 @@ interface Exchange {
|
|
|
17
17
|
publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
18
18
|
publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
22
|
publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
23
|
publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
24
|
publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
|
|
@@ -17,6 +17,8 @@ interface hitbtc {
|
|
|
17
17
|
publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
18
18
|
publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
22
|
publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
23
|
publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
24
|
publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
|
package/js/src/abstract/okx.d.ts
CHANGED
|
@@ -245,6 +245,7 @@ interface Exchange {
|
|
|
245
245
|
privatePostAccountQuickMarginBorrowRepay(params?: {}): Promise<implicitReturnType>;
|
|
246
246
|
privatePostAccountBorrowRepay(params?: {}): Promise<implicitReturnType>;
|
|
247
247
|
privatePostAccountSimulatedMargin(params?: {}): Promise<implicitReturnType>;
|
|
248
|
+
privatePostAccountPositionBuilder(params?: {}): Promise<implicitReturnType>;
|
|
248
249
|
privatePostAccountSetRiskOffsetType(params?: {}): Promise<implicitReturnType>;
|
|
249
250
|
privatePostAccountActivateOption(params?: {}): Promise<implicitReturnType>;
|
|
250
251
|
privatePostAccountSetAutoLoan(params?: {}): Promise<implicitReturnType>;
|
|
@@ -5,6 +5,8 @@ import WsClient from './ws/WsClient.js';
|
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
6
|
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Str, Num, MarketInterface, CurrencyInterface, Account } from './types.js';
|
|
7
7
|
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation, FundingHistory, Greeks } from './types.js';
|
|
8
|
+
import { ArrayCache } from './ws/Cache.js';
|
|
9
|
+
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
8
10
|
/**
|
|
9
11
|
* @class Exchange
|
|
10
12
|
*/
|
|
@@ -73,14 +75,15 @@ export default class Exchange {
|
|
|
73
75
|
walletAddress: string;
|
|
74
76
|
token: string;
|
|
75
77
|
balance: {};
|
|
76
|
-
orderbooks:
|
|
77
|
-
tickers:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
orderbooks: Dictionary<Ob>;
|
|
79
|
+
tickers: Dictionary<Ticker>;
|
|
80
|
+
bidsasks: Dictionary<Ticker>;
|
|
81
|
+
orders: ArrayCache;
|
|
82
|
+
triggerOrders: ArrayCache;
|
|
83
|
+
trades: Dictionary<ArrayCache>;
|
|
81
84
|
transactions: {};
|
|
82
85
|
ohlcvs: any;
|
|
83
|
-
myTrades:
|
|
86
|
+
myTrades: ArrayCache;
|
|
84
87
|
positions: any;
|
|
85
88
|
urls: {
|
|
86
89
|
logo?: string;
|
|
@@ -744,7 +747,10 @@ export default class Exchange {
|
|
|
744
747
|
setHeaders(headers: any): any;
|
|
745
748
|
marketId(symbol: string): string;
|
|
746
749
|
symbol(symbol: string): string;
|
|
750
|
+
handleParamString(params: object, paramName: string, defaultValue?: any): [string, object];
|
|
747
751
|
resolvePath(path: any, params: any): any[];
|
|
752
|
+
getListFromObjectValues(objects: any, key: IndexType): any[];
|
|
753
|
+
getSymbolsForMarketType(marketType?: string, subType?: string, symbolWithActiveStatus?: boolean, symbolWithUnknownStatus?: boolean): any[];
|
|
748
754
|
filterByArray(objects: any, key: IndexType, values?: any, indexed?: boolean): any;
|
|
749
755
|
fetch2(path: any, api?: any, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
|
|
750
756
|
request(path: any, api?: any, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -59,6 +59,7 @@ export default class Exchange {
|
|
|
59
59
|
this.balance = {};
|
|
60
60
|
this.orderbooks = {};
|
|
61
61
|
this.tickers = {};
|
|
62
|
+
this.bidsasks = {};
|
|
62
63
|
this.orders = undefined;
|
|
63
64
|
this.triggerOrders = undefined;
|
|
64
65
|
this.transactions = {};
|
|
@@ -3426,12 +3427,46 @@ export default class Exchange {
|
|
|
3426
3427
|
const market = this.market(symbol);
|
|
3427
3428
|
return this.safeString(market, 'symbol', symbol);
|
|
3428
3429
|
}
|
|
3430
|
+
handleParamString(params, paramName, defaultValue = undefined) {
|
|
3431
|
+
const value = this.safeString(params, paramName, defaultValue);
|
|
3432
|
+
if (value !== undefined) {
|
|
3433
|
+
params = this.omit(params, paramName);
|
|
3434
|
+
}
|
|
3435
|
+
return [value, params];
|
|
3436
|
+
}
|
|
3429
3437
|
resolvePath(path, params) {
|
|
3430
3438
|
return [
|
|
3431
3439
|
this.implodeParams(path, params),
|
|
3432
3440
|
this.omit(params, this.extractParams(path)),
|
|
3433
3441
|
];
|
|
3434
3442
|
}
|
|
3443
|
+
getListFromObjectValues(objects, key) {
|
|
3444
|
+
const newArray = this.toArray(objects);
|
|
3445
|
+
const results = [];
|
|
3446
|
+
for (let i = 0; i < newArray.length; i++) {
|
|
3447
|
+
results.push(newArray[i][key]);
|
|
3448
|
+
}
|
|
3449
|
+
return results;
|
|
3450
|
+
}
|
|
3451
|
+
getSymbolsForMarketType(marketType = undefined, subType = undefined, symbolWithActiveStatus = true, symbolWithUnknownStatus = true) {
|
|
3452
|
+
let filteredMarkets = this.markets;
|
|
3453
|
+
if (marketType !== undefined) {
|
|
3454
|
+
filteredMarkets = this.filterBy(filteredMarkets, 'type', marketType);
|
|
3455
|
+
}
|
|
3456
|
+
if (subType !== undefined) {
|
|
3457
|
+
this.checkRequiredArgument('getSymbolsForMarketType', subType, 'subType', ['linear', 'inverse', 'quanto']);
|
|
3458
|
+
filteredMarkets = this.filterBy(filteredMarkets, 'subType', subType);
|
|
3459
|
+
}
|
|
3460
|
+
const activeStatuses = [];
|
|
3461
|
+
if (symbolWithActiveStatus) {
|
|
3462
|
+
activeStatuses.push(true);
|
|
3463
|
+
}
|
|
3464
|
+
if (symbolWithUnknownStatus) {
|
|
3465
|
+
activeStatuses.push(undefined);
|
|
3466
|
+
}
|
|
3467
|
+
filteredMarkets = this.filterByArray(filteredMarkets, 'active', activeStatuses, false);
|
|
3468
|
+
return this.getListFromObjectValues(filteredMarkets, 'symbol');
|
|
3469
|
+
}
|
|
3435
3470
|
filterByArray(objects, key, values = undefined, indexed = true) {
|
|
3436
3471
|
objects = this.toArray(objects);
|
|
3437
3472
|
// return all of them if no values were passed
|
|
@@ -4357,6 +4392,19 @@ export default class Exchange {
|
|
|
4357
4392
|
return depositAddress;
|
|
4358
4393
|
}
|
|
4359
4394
|
}
|
|
4395
|
+
else if (this.has['fetchDepositAddressesByNetwork']) {
|
|
4396
|
+
const network = this.safeString(params, 'network');
|
|
4397
|
+
params = this.omit(params, 'network');
|
|
4398
|
+
const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
|
|
4399
|
+
if (network !== undefined) {
|
|
4400
|
+
return this.safeDict(addressStructures, network);
|
|
4401
|
+
}
|
|
4402
|
+
else {
|
|
4403
|
+
const keys = Object.keys(addressStructures);
|
|
4404
|
+
const key = this.safeString(keys, 0);
|
|
4405
|
+
return this.safeDict(addressStructures, key);
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4360
4408
|
else {
|
|
4361
4409
|
throw new NotSupported(this.id + ' fetchDepositAddress() is not supported yet');
|
|
4362
4410
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
interface CustomArray extends Array {
|
|
2
|
+
hashmap: object;
|
|
3
|
+
}
|
|
1
4
|
declare class BaseCache extends Array {
|
|
2
5
|
constructor(maxSize?: any);
|
|
3
6
|
clear(): void;
|
|
4
7
|
}
|
|
5
|
-
declare class ArrayCache extends BaseCache {
|
|
8
|
+
declare class ArrayCache extends BaseCache implements CustomArray {
|
|
9
|
+
hashmap: object;
|
|
6
10
|
constructor(maxSize?: any);
|
|
7
11
|
getLimit(symbol: any, limit: any): any;
|
|
8
12
|
append(item: any): void;
|
package/js/src/base/ws/Cache.js
CHANGED
|
@@ -22,6 +22,7 @@ class BaseCache extends Array {
|
|
|
22
22
|
class ArrayCache extends BaseCache {
|
|
23
23
|
constructor(maxSize = undefined) {
|
|
24
24
|
super(maxSize);
|
|
25
|
+
this.hashmap = {};
|
|
25
26
|
Object.defineProperty(this, 'nestedNewUpdatesBySymbol', {
|
|
26
27
|
__proto__: null,
|
|
27
28
|
value: false,
|
|
@@ -47,6 +48,12 @@ class ArrayCache extends BaseCache {
|
|
|
47
48
|
value: false,
|
|
48
49
|
writable: true,
|
|
49
50
|
});
|
|
51
|
+
Object.defineProperty(this, 'hashmap', {
|
|
52
|
+
__proto__: null,
|
|
53
|
+
value: {},
|
|
54
|
+
writable: true,
|
|
55
|
+
enumerable: false,
|
|
56
|
+
});
|
|
50
57
|
}
|
|
51
58
|
getLimit(symbol, limit) {
|
|
52
59
|
let newUpdatesValue = undefined;
|
|
@@ -126,6 +133,7 @@ class ArrayCacheByTimestamp extends BaseCache {
|
|
|
126
133
|
if (item[0] in this.hashmap) {
|
|
127
134
|
const reference = this.hashmap[item[0]];
|
|
128
135
|
if (reference !== item) {
|
|
136
|
+
// eslint-disable-next-line
|
|
129
137
|
for (const prop in item) {
|
|
130
138
|
reference[prop] = item[prop];
|
|
131
139
|
}
|
|
@@ -151,11 +159,11 @@ class ArrayCacheBySymbolById extends ArrayCache {
|
|
|
151
159
|
constructor(maxSize = undefined) {
|
|
152
160
|
super(maxSize);
|
|
153
161
|
this.nestedNewUpdatesBySymbol = true;
|
|
154
|
-
Object.defineProperty(this, 'hashmap', {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
})
|
|
162
|
+
// Object.defineProperty (this, 'hashmap', {
|
|
163
|
+
// __proto__: null, // make it invisible
|
|
164
|
+
// value: {},
|
|
165
|
+
// writable: true,
|
|
166
|
+
// })
|
|
159
167
|
}
|
|
160
168
|
append(item) {
|
|
161
169
|
const byId = this.hashmap[item.symbol] = this.hashmap[item.symbol] || {};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
6
|
|
|
7
7
|
/* eslint-disable max-classes-per-file */
|
|
8
|
-
// @ts-nocheck
|
|
8
|
+
// @ts-nocheck
|
|
9
9
|
import { iso8601 } from '../../base/functions/time.js';
|
|
10
10
|
import { extend } from '../../base/functions/generic.js';
|
|
11
11
|
import { Asks, Bids, CountedAsks, CountedBids, IndexedAsks, IndexedBids,
|
|
@@ -14,14 +14,14 @@ import { Asks, Bids, CountedAsks, CountedBids, IndexedAsks, IndexedBids,
|
|
|
14
14
|
// IncrementalIndexedAsks,
|
|
15
15
|
// IncrementalIndexedBids, // check this
|
|
16
16
|
} from './OrderBookSide.js';
|
|
17
|
-
// ----------------------------------------------------------------------------
|
|
18
|
-
// overwrites absolute volumes at price levels
|
|
19
17
|
class OrderBook {
|
|
20
18
|
constructor(snapshot = {}, depth = undefined) {
|
|
19
|
+
this.cache = []; // make prop visible so we use typed OrderBooks
|
|
21
20
|
Object.defineProperty(this, 'cache', {
|
|
22
21
|
__proto__: null,
|
|
23
22
|
value: [],
|
|
24
23
|
writable: true,
|
|
24
|
+
enumerable: false,
|
|
25
25
|
});
|
|
26
26
|
depth = depth || Number.MAX_SAFE_INTEGER;
|
|
27
27
|
const defaults = {
|