ccxt 4.4.82 → 4.4.85
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 +5 -7
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -9
- package/dist/cjs/src/apex.js +2 -1
- package/dist/cjs/src/base/Exchange.js +15 -2
- package/dist/cjs/src/bitget.js +1 -3
- package/dist/cjs/src/bitrue.js +14 -35
- package/dist/cjs/src/bitso.js +33 -0
- package/dist/cjs/src/bitstamp.js +33 -0
- package/dist/cjs/src/blofin.js +154 -13
- package/dist/cjs/src/btcbox.js +25 -5
- package/dist/cjs/src/bybit.js +16 -40
- package/dist/cjs/src/cex.js +2 -4
- package/dist/cjs/src/coinbase.js +56 -40
- package/dist/cjs/src/coinbaseexchange.js +142 -32
- package/dist/cjs/src/coincatch.js +14 -67
- package/dist/cjs/src/coinex.js +29 -32
- package/dist/cjs/src/coinlist.js +16 -15
- package/dist/cjs/src/coinmetro.js +22 -11
- package/dist/cjs/src/coinone.js +8 -10
- package/dist/cjs/src/coinsph.js +126 -1
- package/dist/cjs/src/cryptocom.js +111 -1
- package/dist/cjs/src/cryptomus.js +43 -89
- package/dist/cjs/src/delta.js +76 -36
- package/dist/cjs/src/derive.js +46 -10
- package/dist/cjs/src/ellipx.js +175 -79
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/gemini.js +3 -5
- package/dist/cjs/src/hitbtc.js +56 -69
- package/dist/cjs/src/hyperliquid.js +2 -2
- package/dist/cjs/src/kraken.js +29 -24
- package/dist/cjs/src/kucoinfutures.js +6 -0
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/paradex.js +119 -3
- package/dist/cjs/src/pro/binance.js +31 -33
- package/dist/cjs/src/pro/bithumb.js +5 -3
- package/dist/cjs/src/pro/kraken.js +289 -79
- package/dist/cjs/src/pro/mexc.js +302 -8
- package/dist/cjs/src/pro/poloniex.js +6 -2
- package/examples/js/cli.js +127 -13
- package/js/ccxt.d.ts +2 -11
- package/js/ccxt.js +2 -8
- package/js/src/abstract/blofin.d.ts +8 -0
- package/js/src/abstract/btcbox.d.ts +1 -0
- package/js/src/apex.js +2 -1
- package/js/src/base/Exchange.d.ts +15 -1
- package/js/src/base/Exchange.js +15 -2
- package/js/src/base/types.d.ts +3 -0
- package/js/src/bitget.js +1 -3
- package/js/src/bitrue.js +14 -35
- package/js/src/bitso.js +33 -0
- package/js/src/bitstamp.js +33 -0
- package/js/src/blofin.d.ts +42 -2
- package/js/src/blofin.js +154 -13
- package/js/src/btcbox.js +25 -5
- package/js/src/bybit.js +16 -40
- package/js/src/cex.js +2 -4
- package/js/src/coinbase.js +56 -40
- package/js/src/coinbaseexchange.js +142 -32
- package/js/src/coincatch.js +14 -67
- package/js/src/coinex.js +28 -29
- package/js/src/coinlist.js +16 -15
- package/js/src/coinmetro.js +22 -11
- package/js/src/coinone.js +8 -10
- package/js/src/coinsph.d.ts +10 -1
- package/js/src/coinsph.js +126 -1
- package/js/src/cryptocom.d.ts +10 -1
- package/js/src/cryptocom.js +111 -1
- package/js/src/cryptomus.js +43 -89
- package/js/src/delta.js +76 -36
- package/js/src/derive.js +46 -10
- package/js/src/ellipx.d.ts +2 -3
- package/js/src/ellipx.js +175 -80
- package/js/src/gate.js +1 -1
- package/js/src/gemini.js +3 -5
- package/js/src/hitbtc.js +56 -69
- package/js/src/hyperliquid.js +2 -2
- package/js/src/kraken.js +29 -24
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +6 -0
- package/js/src/lbank.js +1 -1
- package/js/src/paradex.d.ts +12 -1
- package/js/src/paradex.js +119 -3
- package/js/src/pro/binance.d.ts +26 -26
- package/js/src/pro/binance.js +31 -33
- package/js/src/pro/bithumb.js +5 -3
- package/js/src/pro/kraken.d.ts +7 -6
- package/js/src/pro/kraken.js +290 -80
- package/js/src/pro/mexc.d.ts +58 -0
- package/js/src/pro/mexc.js +302 -8
- package/js/src/pro/poloniex.d.ts +1 -1
- package/js/src/pro/poloniex.js +6 -2
- package/package.json +1 -1
- package/js/src/abstract/bl3p.d.ts +0 -22
- package/js/src/abstract/bl3p.js +0 -11
- package/js/src/abstract/idex.d.ts +0 -29
- package/js/src/abstract/idex.js +0 -11
- package/js/src/bl3p.d.ts +0 -116
- package/js/src/bl3p.js +0 -552
- package/js/src/idex.d.ts +0 -312
- package/js/src/idex.js +0 -1961
- package/js/src/pro/idex.d.ts +0 -81
- package/js/src/pro/idex.js +0 -720
package/js/src/pro/mexc.js
CHANGED
|
@@ -34,6 +34,12 @@ export default class mexc extends mexcRest {
|
|
|
34
34
|
'watchBidsAsks': true,
|
|
35
35
|
'watchTrades': true,
|
|
36
36
|
'watchTradesForSymbols': false,
|
|
37
|
+
'unWatchTicker': true,
|
|
38
|
+
'unWatchTickers': true,
|
|
39
|
+
'unWatchBidsAsks': true,
|
|
40
|
+
'unWatchOHLCV': true,
|
|
41
|
+
'unWatchOrderBook': true,
|
|
42
|
+
'unWatchTrades': true,
|
|
37
43
|
},
|
|
38
44
|
'urls': {
|
|
39
45
|
'api': {
|
|
@@ -491,12 +497,15 @@ export default class mexc extends mexcRest {
|
|
|
491
497
|
}, market);
|
|
492
498
|
}
|
|
493
499
|
async watchSpotPublic(channel, messageHash, params = {}) {
|
|
500
|
+
const unsubscribed = this.safeBool(params, 'unsubscribed', false);
|
|
501
|
+
params = this.omit(params, ['unsubscribed']);
|
|
494
502
|
const url = this.urls['api']['ws']['spot'];
|
|
503
|
+
const method = (unsubscribed) ? 'UNSUBSCRIPTION' : 'SUBSCRIPTION';
|
|
495
504
|
const request = {
|
|
496
|
-
'method':
|
|
505
|
+
'method': method,
|
|
497
506
|
'params': [channel],
|
|
498
507
|
};
|
|
499
|
-
return await this.watch(url, messageHash, this.extend(request, params),
|
|
508
|
+
return await this.watch(url, messageHash, this.extend(request, params), messageHash);
|
|
500
509
|
}
|
|
501
510
|
async watchSpotPrivate(channel, messageHash, params = {}) {
|
|
502
511
|
this.checkRequiredCredentials();
|
|
@@ -788,12 +797,6 @@ export default class mexc extends mexcRest {
|
|
|
788
797
|
const messageHash = 'orderbook:' + symbol;
|
|
789
798
|
const subscription = this.safeValue(client.subscriptions, messageHash);
|
|
790
799
|
const limit = this.safeInteger(subscription, 'limit');
|
|
791
|
-
if (subscription === true) {
|
|
792
|
-
// we set client.subscriptions[messageHash] to 1
|
|
793
|
-
// once we have received the first delta and initialized the orderbook
|
|
794
|
-
client.subscriptions[messageHash] = 1;
|
|
795
|
-
this.orderbooks[symbol] = this.countedOrderBook({});
|
|
796
|
-
}
|
|
797
800
|
const storedOrderBook = this.orderbooks[symbol];
|
|
798
801
|
const nonce = this.safeInteger(storedOrderBook, 'nonce');
|
|
799
802
|
if (nonce === undefined) {
|
|
@@ -1415,6 +1418,297 @@ export default class mexc extends mexcRest {
|
|
|
1415
1418
|
this.balance[type] = this.safeBalance(this.balance[type]);
|
|
1416
1419
|
client.resolve(this.balance[type], messageHash);
|
|
1417
1420
|
}
|
|
1421
|
+
/**
|
|
1422
|
+
* @method
|
|
1423
|
+
* @name mexc#unWatchTicker
|
|
1424
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
1425
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1426
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1427
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1428
|
+
*/
|
|
1429
|
+
async unWatchTicker(symbol, params = {}) {
|
|
1430
|
+
await this.loadMarkets();
|
|
1431
|
+
const market = this.market(symbol);
|
|
1432
|
+
const messageHash = 'unsubscribe:ticker:' + market['symbol'];
|
|
1433
|
+
let url = undefined;
|
|
1434
|
+
let channel = undefined;
|
|
1435
|
+
if (market['spot']) {
|
|
1436
|
+
let miniTicker = false;
|
|
1437
|
+
[miniTicker, params] = this.handleOptionAndParams(params, 'watchTicker', 'miniTicker');
|
|
1438
|
+
if (miniTicker) {
|
|
1439
|
+
channel = 'spot@public.miniTicker.v3.api@' + market['id'] + '@UTC+8';
|
|
1440
|
+
}
|
|
1441
|
+
else {
|
|
1442
|
+
channel = 'spot@public.bookTicker.v3.api@' + market['id'];
|
|
1443
|
+
}
|
|
1444
|
+
url = this.urls['api']['ws']['spot'];
|
|
1445
|
+
params['unsubscribed'] = true;
|
|
1446
|
+
this.watchSpotPublic(channel, messageHash, params);
|
|
1447
|
+
}
|
|
1448
|
+
else {
|
|
1449
|
+
channel = 'unsub.ticker';
|
|
1450
|
+
const requestParams = {
|
|
1451
|
+
'symbol': market['id'],
|
|
1452
|
+
};
|
|
1453
|
+
url = this.urls['api']['ws']['swap'];
|
|
1454
|
+
this.watchSwapPublic(channel, messageHash, requestParams, params);
|
|
1455
|
+
}
|
|
1456
|
+
const client = this.client(url);
|
|
1457
|
+
this.handleUnsubscriptions(client, [messageHash]);
|
|
1458
|
+
return undefined;
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* @method
|
|
1462
|
+
* @name mexc#unWatchTickers
|
|
1463
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
1464
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
1465
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1466
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1467
|
+
*/
|
|
1468
|
+
async unWatchTickers(symbols = undefined, params = {}) {
|
|
1469
|
+
await this.loadMarkets();
|
|
1470
|
+
symbols = this.marketSymbols(symbols, undefined);
|
|
1471
|
+
const messageHashes = [];
|
|
1472
|
+
const firstSymbol = this.safeString(symbols, 0);
|
|
1473
|
+
let market = undefined;
|
|
1474
|
+
if (firstSymbol !== undefined) {
|
|
1475
|
+
market = this.market(firstSymbol);
|
|
1476
|
+
}
|
|
1477
|
+
let type = undefined;
|
|
1478
|
+
[type, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
|
|
1479
|
+
const isSpot = (type === 'spot');
|
|
1480
|
+
const url = (isSpot) ? this.urls['api']['ws']['spot'] : this.urls['api']['ws']['swap'];
|
|
1481
|
+
const request = {};
|
|
1482
|
+
if (isSpot) {
|
|
1483
|
+
let miniTicker = false;
|
|
1484
|
+
[miniTicker, params] = this.handleOptionAndParams(params, 'watchTickers', 'miniTicker');
|
|
1485
|
+
const topics = [];
|
|
1486
|
+
if (!miniTicker) {
|
|
1487
|
+
if (symbols === undefined) {
|
|
1488
|
+
throw new ArgumentsRequired(this.id + ' watchTickers required symbols argument for the bookTicker channel');
|
|
1489
|
+
}
|
|
1490
|
+
const marketIds = this.marketIds(symbols);
|
|
1491
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
1492
|
+
const marketId = marketIds[i];
|
|
1493
|
+
messageHashes.push('unsubscribe:ticker:' + symbols[i]);
|
|
1494
|
+
const channel = 'spot@public.bookTicker.v3.api@' + marketId;
|
|
1495
|
+
topics.push(channel);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1499
|
+
topics.push('spot@public.miniTickers.v3.api@UTC+8');
|
|
1500
|
+
if (symbols === undefined) {
|
|
1501
|
+
messageHashes.push('unsubscribe:spot:ticker');
|
|
1502
|
+
}
|
|
1503
|
+
else {
|
|
1504
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1505
|
+
messageHashes.push('unsubscribe:ticker:' + symbols[i]);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
request['method'] = 'UNSUBSCRIPTION';
|
|
1510
|
+
request['params'] = topics;
|
|
1511
|
+
}
|
|
1512
|
+
else {
|
|
1513
|
+
request['method'] = 'unsub.tickers';
|
|
1514
|
+
request['params'] = {};
|
|
1515
|
+
messageHashes.push('unsubscribe:ticker');
|
|
1516
|
+
}
|
|
1517
|
+
const client = this.client(url);
|
|
1518
|
+
this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
1519
|
+
this.handleUnsubscriptions(client, messageHashes);
|
|
1520
|
+
return undefined;
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* @method
|
|
1524
|
+
* @name mexc#unWatchBidsAsks
|
|
1525
|
+
* @description unWatches best bid & ask for symbols
|
|
1526
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
1527
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1528
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1529
|
+
*/
|
|
1530
|
+
async unWatchBidsAsks(symbols = undefined, params = {}) {
|
|
1531
|
+
await this.loadMarkets();
|
|
1532
|
+
symbols = this.marketSymbols(symbols, undefined, true, false, true);
|
|
1533
|
+
let marketType = undefined;
|
|
1534
|
+
if (symbols === undefined) {
|
|
1535
|
+
throw new ArgumentsRequired(this.id + ' watchBidsAsks required symbols argument');
|
|
1536
|
+
}
|
|
1537
|
+
const markets = this.marketsForSymbols(symbols);
|
|
1538
|
+
[marketType, params] = this.handleMarketTypeAndParams('watchBidsAsks', markets[0], params);
|
|
1539
|
+
const isSpot = marketType === 'spot';
|
|
1540
|
+
if (!isSpot) {
|
|
1541
|
+
throw new NotSupported(this.id + ' watchBidsAsks only support spot market');
|
|
1542
|
+
}
|
|
1543
|
+
const messageHashes = [];
|
|
1544
|
+
const topics = [];
|
|
1545
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1546
|
+
if (isSpot) {
|
|
1547
|
+
const market = this.market(symbols[i]);
|
|
1548
|
+
topics.push('spot@public.bookTicker.v3.api@' + market['id']);
|
|
1549
|
+
}
|
|
1550
|
+
messageHashes.push('unsubscribe:bidask:' + symbols[i]);
|
|
1551
|
+
}
|
|
1552
|
+
const url = this.urls['api']['ws']['spot'];
|
|
1553
|
+
const request = {
|
|
1554
|
+
'method': 'UNSUBSCRIPTION',
|
|
1555
|
+
'params': topics,
|
|
1556
|
+
};
|
|
1557
|
+
const client = this.client(url);
|
|
1558
|
+
this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
1559
|
+
this.handleUnsubscriptions(client, messageHashes);
|
|
1560
|
+
return undefined;
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* @method
|
|
1564
|
+
* @name mexc#unWatchOHLCV
|
|
1565
|
+
* @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1566
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1567
|
+
* @param {string} timeframe the length of time each candle represents
|
|
1568
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1569
|
+
* @param {object} [params.timezone] if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00'
|
|
1570
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
1571
|
+
*/
|
|
1572
|
+
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
1573
|
+
await this.loadMarkets();
|
|
1574
|
+
const market = this.market(symbol);
|
|
1575
|
+
symbol = market['symbol'];
|
|
1576
|
+
const timeframes = this.safeValue(this.options, 'timeframes', {});
|
|
1577
|
+
const timeframeId = this.safeString(timeframes, timeframe);
|
|
1578
|
+
const messageHash = 'unsubscribe:candles:' + symbol + ':' + timeframe;
|
|
1579
|
+
let url = undefined;
|
|
1580
|
+
if (market['spot']) {
|
|
1581
|
+
url = this.urls['api']['ws']['spot'];
|
|
1582
|
+
const channel = 'spot@public.kline.v3.api@' + market['id'] + '@' + timeframeId;
|
|
1583
|
+
params['unsubscribed'] = true;
|
|
1584
|
+
this.watchSpotPublic(channel, messageHash, params);
|
|
1585
|
+
}
|
|
1586
|
+
else {
|
|
1587
|
+
url = this.urls['api']['ws']['swap'];
|
|
1588
|
+
const channel = 'unsub.kline';
|
|
1589
|
+
const requestParams = {
|
|
1590
|
+
'symbol': market['id'],
|
|
1591
|
+
'interval': timeframeId,
|
|
1592
|
+
};
|
|
1593
|
+
this.watchSwapPublic(channel, messageHash, requestParams, params);
|
|
1594
|
+
}
|
|
1595
|
+
const client = this.client(url);
|
|
1596
|
+
this.handleUnsubscriptions(client, [messageHash]);
|
|
1597
|
+
return undefined;
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* @method
|
|
1601
|
+
* @name mexc#unWatchOrderBook
|
|
1602
|
+
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1603
|
+
* @param {string} symbol unified array of symbols
|
|
1604
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1605
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1606
|
+
*/
|
|
1607
|
+
async unWatchOrderBook(symbol, params = {}) {
|
|
1608
|
+
await this.loadMarkets();
|
|
1609
|
+
const market = this.market(symbol);
|
|
1610
|
+
symbol = market['symbol'];
|
|
1611
|
+
const messageHash = 'unsubscribe:orderbook:' + symbol;
|
|
1612
|
+
let url = undefined;
|
|
1613
|
+
if (market['spot']) {
|
|
1614
|
+
url = this.urls['api']['ws']['spot'];
|
|
1615
|
+
const channel = 'spot@public.increase.depth.v3.api@' + market['id'];
|
|
1616
|
+
params['unsubscribed'] = true;
|
|
1617
|
+
this.watchSpotPublic(channel, messageHash, params);
|
|
1618
|
+
}
|
|
1619
|
+
else {
|
|
1620
|
+
url = this.urls['api']['ws']['swap'];
|
|
1621
|
+
const channel = 'unsub.depth';
|
|
1622
|
+
const requestParams = {
|
|
1623
|
+
'symbol': market['id'],
|
|
1624
|
+
};
|
|
1625
|
+
this.watchSwapPublic(channel, messageHash, requestParams, params);
|
|
1626
|
+
}
|
|
1627
|
+
const client = this.client(url);
|
|
1628
|
+
this.handleUnsubscriptions(client, [messageHash]);
|
|
1629
|
+
return undefined;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* @method
|
|
1633
|
+
* @name mexc#unWatchTrades
|
|
1634
|
+
* @description unsubscribes from the trades channel
|
|
1635
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1636
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1637
|
+
* @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
|
|
1638
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
1639
|
+
*/
|
|
1640
|
+
async unWatchTrades(symbol, params = {}) {
|
|
1641
|
+
await this.loadMarkets();
|
|
1642
|
+
const market = this.market(symbol);
|
|
1643
|
+
symbol = market['symbol'];
|
|
1644
|
+
const messageHash = 'unsubscribe:trades:' + symbol;
|
|
1645
|
+
let url = undefined;
|
|
1646
|
+
if (market['spot']) {
|
|
1647
|
+
url = this.urls['api']['ws']['spot'];
|
|
1648
|
+
const channel = 'spot@public.deals.v3.api@' + market['id'];
|
|
1649
|
+
params['unsubscribed'] = true;
|
|
1650
|
+
this.watchSpotPublic(channel, messageHash, params);
|
|
1651
|
+
}
|
|
1652
|
+
else {
|
|
1653
|
+
url = this.urls['api']['ws']['swap'];
|
|
1654
|
+
const channel = 'unsub.deal';
|
|
1655
|
+
const requestParams = {
|
|
1656
|
+
'symbol': market['id'],
|
|
1657
|
+
};
|
|
1658
|
+
this.watchSwapPublic(channel, messageHash, requestParams, params);
|
|
1659
|
+
}
|
|
1660
|
+
const client = this.client(url);
|
|
1661
|
+
this.handleUnsubscriptions(client, [messageHash]);
|
|
1662
|
+
return undefined;
|
|
1663
|
+
}
|
|
1664
|
+
handleUnsubscriptions(client, messageHashes) {
|
|
1665
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
1666
|
+
const messageHash = messageHashes[i];
|
|
1667
|
+
const subMessageHash = messageHash.replace('unsubscribe:', '');
|
|
1668
|
+
this.cleanUnsubscription(client, subMessageHash, messageHash);
|
|
1669
|
+
if (messageHash.indexOf('ticker') >= 0) {
|
|
1670
|
+
const symbol = messageHash.replace('unsubscribe:ticker:', '');
|
|
1671
|
+
if (symbol.indexOf('unsubscribe') >= 0) {
|
|
1672
|
+
// unWatchTickers
|
|
1673
|
+
const symbols = Object.keys(this.tickers);
|
|
1674
|
+
for (let j = 0; j < symbols.length; j++) {
|
|
1675
|
+
delete this.tickers[symbols[j]];
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
else if (symbol in this.tickers) {
|
|
1679
|
+
delete this.tickers[symbol];
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
else if (messageHash.indexOf('bidask') >= 0) {
|
|
1683
|
+
const symbol = messageHash.replace('unsubscribe:bidask:', '');
|
|
1684
|
+
if (symbol in this.bidsasks) {
|
|
1685
|
+
delete this.bidsasks[symbol];
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
else if (messageHash.indexOf('candles') >= 0) {
|
|
1689
|
+
const splitHashes = messageHash.split(':');
|
|
1690
|
+
let symbol = this.safeString(splitHashes, 2);
|
|
1691
|
+
if (splitHashes.length > 4) {
|
|
1692
|
+
symbol += ':' + this.safeString(splitHashes, 3);
|
|
1693
|
+
}
|
|
1694
|
+
if (symbol in this.ohlcvs) {
|
|
1695
|
+
delete this.ohlcvs[symbol];
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
else if (messageHash.indexOf('orderbook') >= 0) {
|
|
1699
|
+
const symbol = messageHash.replace('unsubscribe:orderbook:', '');
|
|
1700
|
+
if (symbol in this.orderbooks) {
|
|
1701
|
+
delete this.orderbooks[symbol];
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
else if (messageHash.indexOf('trades') >= 0) {
|
|
1705
|
+
const symbol = messageHash.replace('unsubscribe:trades:', '');
|
|
1706
|
+
if (symbol in this.trades) {
|
|
1707
|
+
delete this.trades[symbol];
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1418
1712
|
async authenticate(subscriptionHash, params = {}) {
|
|
1419
1713
|
// we only need one listenKey since ccxt shares connections
|
|
1420
1714
|
let listenKey = this.safeString(this.options, 'listenKey');
|
package/js/src/pro/poloniex.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export default class poloniex extends poloniexRest {
|
|
|
66
66
|
* @param {string} [params.clientOrderId] client order id
|
|
67
67
|
* @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
68
68
|
*/
|
|
69
|
-
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<
|
|
69
|
+
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
70
70
|
/**
|
|
71
71
|
* @method
|
|
72
72
|
* @name poloniex#cancelOrdersWs
|
package/js/src/pro/poloniex.js
CHANGED
|
@@ -252,7 +252,9 @@ export default class poloniex extends poloniexRest {
|
|
|
252
252
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
const orders = await this.tradeRequest('createOrder', this.extend(request, params));
|
|
256
|
+
const order = this.safeDict(orders, 0);
|
|
257
|
+
return order;
|
|
256
258
|
}
|
|
257
259
|
/**
|
|
258
260
|
* @method
|
|
@@ -271,7 +273,9 @@ export default class poloniex extends poloniexRest {
|
|
|
271
273
|
const clientOrderIds = this.safeValue(params, 'clientOrderId', []);
|
|
272
274
|
params['clientOrderIds'] = this.arrayConcat(clientOrderIds, [clientOrderId]);
|
|
273
275
|
}
|
|
274
|
-
|
|
276
|
+
const orders = await this.cancelOrdersWs([id], symbol, params);
|
|
277
|
+
const order = this.safeDict(orders, 0);
|
|
278
|
+
return order;
|
|
275
279
|
}
|
|
276
280
|
/**
|
|
277
281
|
* @method
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { implicitReturnType } from '../base/types.js';
|
|
2
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
-
interface Exchange {
|
|
4
|
-
publicGetMarketTicker(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
publicGetMarketOrderbook(params?: {}): Promise<implicitReturnType>;
|
|
6
|
-
publicGetMarketTrades(params?: {}): Promise<implicitReturnType>;
|
|
7
|
-
privatePostMarketMoneyDepthFull(params?: {}): Promise<implicitReturnType>;
|
|
8
|
-
privatePostMarketMoneyOrderAdd(params?: {}): Promise<implicitReturnType>;
|
|
9
|
-
privatePostMarketMoneyOrderCancel(params?: {}): Promise<implicitReturnType>;
|
|
10
|
-
privatePostMarketMoneyOrderResult(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
privatePostMarketMoneyOrders(params?: {}): Promise<implicitReturnType>;
|
|
12
|
-
privatePostMarketMoneyOrdersHistory(params?: {}): Promise<implicitReturnType>;
|
|
13
|
-
privatePostMarketMoneyTradesFetch(params?: {}): Promise<implicitReturnType>;
|
|
14
|
-
privatePostGENMKTMoneyInfo(params?: {}): Promise<implicitReturnType>;
|
|
15
|
-
privatePostGENMKTMoneyDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
16
|
-
privatePostGENMKTMoneyNewDepositAddress(params?: {}): Promise<implicitReturnType>;
|
|
17
|
-
privatePostGENMKTMoneyWalletHistory(params?: {}): Promise<implicitReturnType>;
|
|
18
|
-
privatePostGENMKTMoneyWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
19
|
-
}
|
|
20
|
-
declare abstract class Exchange extends _Exchange {
|
|
21
|
-
}
|
|
22
|
-
export default Exchange;
|
package/js/src/abstract/bl3p.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// ----------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
-
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
-
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
-
|
|
7
|
-
// -------------------------------------------------------------------------------
|
|
8
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
-
class Exchange extends _Exchange {
|
|
10
|
-
}
|
|
11
|
-
export default Exchange;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { implicitReturnType } from '../base/types.js';
|
|
2
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
-
interface Exchange {
|
|
4
|
-
publicGetPing(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
publicGetTime(params?: {}): Promise<implicitReturnType>;
|
|
6
|
-
publicGetExchange(params?: {}): Promise<implicitReturnType>;
|
|
7
|
-
publicGetAssets(params?: {}): Promise<implicitReturnType>;
|
|
8
|
-
publicGetMarkets(params?: {}): Promise<implicitReturnType>;
|
|
9
|
-
publicGetTickers(params?: {}): Promise<implicitReturnType>;
|
|
10
|
-
publicGetCandles(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
publicGetTrades(params?: {}): Promise<implicitReturnType>;
|
|
12
|
-
publicGetOrderbook(params?: {}): Promise<implicitReturnType>;
|
|
13
|
-
privateGetUser(params?: {}): Promise<implicitReturnType>;
|
|
14
|
-
privateGetWallets(params?: {}): Promise<implicitReturnType>;
|
|
15
|
-
privateGetBalances(params?: {}): Promise<implicitReturnType>;
|
|
16
|
-
privateGetOrders(params?: {}): Promise<implicitReturnType>;
|
|
17
|
-
privateGetFills(params?: {}): Promise<implicitReturnType>;
|
|
18
|
-
privateGetDeposits(params?: {}): Promise<implicitReturnType>;
|
|
19
|
-
privateGetWithdrawals(params?: {}): Promise<implicitReturnType>;
|
|
20
|
-
privateGetWsToken(params?: {}): Promise<implicitReturnType>;
|
|
21
|
-
privatePostWallets(params?: {}): Promise<implicitReturnType>;
|
|
22
|
-
privatePostOrders(params?: {}): Promise<implicitReturnType>;
|
|
23
|
-
privatePostOrdersTest(params?: {}): Promise<implicitReturnType>;
|
|
24
|
-
privatePostWithdrawals(params?: {}): Promise<implicitReturnType>;
|
|
25
|
-
privateDeleteOrders(params?: {}): Promise<implicitReturnType>;
|
|
26
|
-
}
|
|
27
|
-
declare abstract class Exchange extends _Exchange {
|
|
28
|
-
}
|
|
29
|
-
export default Exchange;
|
package/js/src/abstract/idex.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// ----------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
-
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
-
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
-
|
|
7
|
-
// -------------------------------------------------------------------------------
|
|
8
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
9
|
-
class Exchange extends _Exchange {
|
|
10
|
-
}
|
|
11
|
-
export default Exchange;
|
package/js/src/bl3p.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import Exchange from './abstract/bl3p.js';
|
|
2
|
-
import type { Balances, Int, Market, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, IndexType, Currency, Num, TradingFees, Dict, DepositAddress } from './base/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* @class bl3p
|
|
5
|
-
* @augments Exchange
|
|
6
|
-
*/
|
|
7
|
-
export default class bl3p extends Exchange {
|
|
8
|
-
describe(): any;
|
|
9
|
-
parseBalance(response: any): Balances;
|
|
10
|
-
/**
|
|
11
|
-
* @method
|
|
12
|
-
* @name bl3p#fetchBalance
|
|
13
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
14
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance
|
|
15
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
16
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
17
|
-
*/
|
|
18
|
-
fetchBalance(params?: {}): Promise<Balances>;
|
|
19
|
-
parseBidAsk(bidask: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): number[];
|
|
20
|
-
/**
|
|
21
|
-
* @method
|
|
22
|
-
* @name bl3p#fetchOrderBook
|
|
23
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
24
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#22---orderbook
|
|
25
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
26
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
27
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
28
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
29
|
-
*/
|
|
30
|
-
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
31
|
-
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
32
|
-
/**
|
|
33
|
-
* @method
|
|
34
|
-
* @name bl3p#fetchTicker
|
|
35
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
36
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#21---ticker
|
|
37
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
38
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
39
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
40
|
-
*/
|
|
41
|
-
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
42
|
-
parseTrade(trade: Dict, market?: Market): Trade;
|
|
43
|
-
/**
|
|
44
|
-
* @method
|
|
45
|
-
* @name bl3p#fetchTrades
|
|
46
|
-
* @description get the list of most recent trades for a particular symbol
|
|
47
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/public_api/http.md#23---last-1000-trades
|
|
48
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
49
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
50
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
51
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
53
|
-
*/
|
|
54
|
-
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
55
|
-
/**
|
|
56
|
-
* @method
|
|
57
|
-
* @name bl3p#fetchTradingFees
|
|
58
|
-
* @description fetch the trading fees for multiple markets
|
|
59
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#35---get-account-info--balance
|
|
60
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
61
|
-
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
62
|
-
*/
|
|
63
|
-
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
64
|
-
/**
|
|
65
|
-
* @method
|
|
66
|
-
* @name bl3p#createOrder
|
|
67
|
-
* @description create a trade order
|
|
68
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/examples/nodejs/example.md#21---create-an-order
|
|
69
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
70
|
-
* @param {string} type 'market' or 'limit'
|
|
71
|
-
* @param {string} side 'buy' or 'sell'
|
|
72
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
73
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
74
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
75
|
-
*
|
|
76
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
77
|
-
* @param {int} [params.amount_funds] maximal EUR amount to spend (*1e5)
|
|
78
|
-
* @param {string} [params.fee_currency] 'EUR' or 'BTC'
|
|
79
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
80
|
-
*/
|
|
81
|
-
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<import("./base/types.js").Order>;
|
|
82
|
-
/**
|
|
83
|
-
* @method
|
|
84
|
-
* @name bl3p#cancelOrder
|
|
85
|
-
* @description cancels an open order
|
|
86
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#22---cancel-an-order
|
|
87
|
-
* @param {string} id order id
|
|
88
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
89
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
90
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
91
|
-
*/
|
|
92
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<import("./base/types.js").Order>;
|
|
93
|
-
/**
|
|
94
|
-
* @method
|
|
95
|
-
* @name bl3p#createDepositAddress
|
|
96
|
-
* @description create a currency deposit address
|
|
97
|
-
* @see https://github.com/BitonicNL/bl3p-api/blob/master/docs/authenticated_api/http.md#32---create-a-new-deposit-address
|
|
98
|
-
* @param {string} code unified currency code of the currency for the deposit address
|
|
99
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
100
|
-
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
101
|
-
*/
|
|
102
|
-
createDepositAddress(code: string, params?: {}): Promise<DepositAddress>;
|
|
103
|
-
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
104
|
-
info: any;
|
|
105
|
-
currency: string;
|
|
106
|
-
address: string;
|
|
107
|
-
tag: any;
|
|
108
|
-
network: any;
|
|
109
|
-
};
|
|
110
|
-
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
111
|
-
url: string;
|
|
112
|
-
method: string;
|
|
113
|
-
body: any;
|
|
114
|
-
headers: any;
|
|
115
|
-
};
|
|
116
|
-
}
|