ccxt 4.3.96 → 4.3.97
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +3 -0
- package/dist/cjs/src/coinex.js +16 -3
- package/dist/cjs/src/pro/gate.js +179 -0
- package/dist/cjs/src/pro/kucoin.js +132 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/binance.js +3 -0
- package/js/src/coinex.js +16 -3
- package/js/src/pro/gate.d.ts +7 -1
- package/js/src/pro/gate.js +180 -1
- package/js/src/pro/kucoin.d.ts +5 -1
- package/js/src/pro/kucoin.js +133 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
194
|
|
|
195
195
|
//-----------------------------------------------------------------------------
|
|
196
196
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.3.
|
|
197
|
+
const version = '4.3.97';
|
|
198
198
|
Exchange["default"].ccxtVersion = version;
|
|
199
199
|
const exchanges = {
|
|
200
200
|
'ace': ace,
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -4249,6 +4249,9 @@ class binance extends binance$1 {
|
|
|
4249
4249
|
const price = this.safeString(params, 'price');
|
|
4250
4250
|
const until = this.safeInteger(params, 'until');
|
|
4251
4251
|
params = this.omit(params, ['price', 'until']);
|
|
4252
|
+
if (since !== undefined && until !== undefined && limit === undefined) {
|
|
4253
|
+
limit = maxLimit;
|
|
4254
|
+
}
|
|
4252
4255
|
limit = (limit === undefined) ? defaultLimit : Math.min(limit, maxLimit);
|
|
4253
4256
|
const request = {
|
|
4254
4257
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -1210,7 +1210,10 @@ class coinex extends coinex$1 {
|
|
|
1210
1210
|
// "side": "buy",
|
|
1211
1211
|
// "order_id": 136915589622,
|
|
1212
1212
|
// "price": "64376",
|
|
1213
|
-
// "amount": "0.0001"
|
|
1213
|
+
// "amount": "0.0001",
|
|
1214
|
+
// "role": "taker",
|
|
1215
|
+
// "fee": "0.0299",
|
|
1216
|
+
// "fee_ccy": "USDT"
|
|
1214
1217
|
// }
|
|
1215
1218
|
//
|
|
1216
1219
|
const timestamp = this.safeInteger(trade, 'created_at');
|
|
@@ -1220,6 +1223,16 @@ class coinex extends coinex$1 {
|
|
|
1220
1223
|
}
|
|
1221
1224
|
const marketId = this.safeString(trade, 'market');
|
|
1222
1225
|
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
1226
|
+
const feeCostString = this.safeString(trade, 'fee');
|
|
1227
|
+
let fee = undefined;
|
|
1228
|
+
if (feeCostString !== undefined) {
|
|
1229
|
+
const feeCurrencyId = this.safeString(trade, 'fee_ccy');
|
|
1230
|
+
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1231
|
+
fee = {
|
|
1232
|
+
'cost': feeCostString,
|
|
1233
|
+
'currency': feeCurrencyCode,
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1223
1236
|
return this.safeTrade({
|
|
1224
1237
|
'info': trade,
|
|
1225
1238
|
'timestamp': timestamp,
|
|
@@ -1229,11 +1242,11 @@ class coinex extends coinex$1 {
|
|
|
1229
1242
|
'order': this.safeString(trade, 'order_id'),
|
|
1230
1243
|
'type': undefined,
|
|
1231
1244
|
'side': this.safeString(trade, 'side'),
|
|
1232
|
-
'takerOrMaker':
|
|
1245
|
+
'takerOrMaker': this.safeString(trade, 'role'),
|
|
1233
1246
|
'price': this.safeString(trade, 'price'),
|
|
1234
1247
|
'amount': this.safeString(trade, 'amount'),
|
|
1235
1248
|
'cost': this.safeString(trade, 'deal_money'),
|
|
1236
|
-
'fee':
|
|
1249
|
+
'fee': fee,
|
|
1237
1250
|
}, market);
|
|
1238
1251
|
}
|
|
1239
1252
|
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -385,6 +385,34 @@ class gate extends gate$1 {
|
|
|
385
385
|
const orderbook = await this.subscribePublic(url, messageHash, payload, channel, query, subscription);
|
|
386
386
|
return orderbook.limit();
|
|
387
387
|
}
|
|
388
|
+
async unWatchOrderBook(symbol, params = {}) {
|
|
389
|
+
/**
|
|
390
|
+
* @method
|
|
391
|
+
* @name gate#unWatchOrderBook
|
|
392
|
+
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
393
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
394
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
395
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
396
|
+
*/
|
|
397
|
+
await this.loadMarkets();
|
|
398
|
+
const market = this.market(symbol);
|
|
399
|
+
symbol = market['symbol'];
|
|
400
|
+
const marketId = market['id'];
|
|
401
|
+
let interval = '100ms';
|
|
402
|
+
[interval, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'interval', interval);
|
|
403
|
+
const messageType = this.getTypeByMarket(market);
|
|
404
|
+
const channel = messageType + '.order_book_update';
|
|
405
|
+
const subMessageHash = 'orderbook' + ':' + symbol;
|
|
406
|
+
const messageHash = 'unsubscribe:orderbook' + ':' + symbol;
|
|
407
|
+
const url = this.getUrlByMarket(market);
|
|
408
|
+
const payload = [marketId, interval];
|
|
409
|
+
const limit = this.safeInteger(params, 'limit', 100);
|
|
410
|
+
if (market['contract']) {
|
|
411
|
+
const stringLimit = limit.toString();
|
|
412
|
+
payload.push(stringLimit);
|
|
413
|
+
}
|
|
414
|
+
return await this.unSubscribePublicMultiple(url, 'orderbook', [symbol], [messageHash], [subMessageHash], payload, channel, params);
|
|
415
|
+
}
|
|
388
416
|
handleOrderBookSubscription(client, message, subscription) {
|
|
389
417
|
const symbol = this.safeString(subscription, 'symbol');
|
|
390
418
|
const limit = this.safeInteger(subscription, 'limit');
|
|
@@ -717,6 +745,42 @@ class gate extends gate$1 {
|
|
|
717
745
|
}
|
|
718
746
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
719
747
|
}
|
|
748
|
+
async unWatchTradesForSymbols(symbols, params = {}) {
|
|
749
|
+
/**
|
|
750
|
+
* @method
|
|
751
|
+
* @name gate#unWatchTradesForSymbols
|
|
752
|
+
* @description get the list of most recent trades for a particular symbol
|
|
753
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
754
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
755
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
756
|
+
*/
|
|
757
|
+
await this.loadMarkets();
|
|
758
|
+
symbols = this.marketSymbols(symbols);
|
|
759
|
+
const marketIds = this.marketIds(symbols);
|
|
760
|
+
const market = this.market(symbols[0]);
|
|
761
|
+
const messageType = this.getTypeByMarket(market);
|
|
762
|
+
const channel = messageType + '.trades';
|
|
763
|
+
const subMessageHashes = [];
|
|
764
|
+
const messageHashes = [];
|
|
765
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
766
|
+
const symbol = symbols[i];
|
|
767
|
+
subMessageHashes.push('trades:' + symbol);
|
|
768
|
+
messageHashes.push('unsubscribe:trades:' + symbol);
|
|
769
|
+
}
|
|
770
|
+
const url = this.getUrlByMarket(market);
|
|
771
|
+
return await this.unSubscribePublicMultiple(url, 'trades', symbols, messageHashes, subMessageHashes, marketIds, channel, params);
|
|
772
|
+
}
|
|
773
|
+
async unWatchTrades(symbol, params = {}) {
|
|
774
|
+
/**
|
|
775
|
+
* @method
|
|
776
|
+
* @name gate#unWatchTrades
|
|
777
|
+
* @description get the list of most recent trades for a particular symbol
|
|
778
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
779
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
780
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
781
|
+
*/
|
|
782
|
+
return await this.unWatchTradesForSymbols([symbol], params);
|
|
783
|
+
}
|
|
720
784
|
handleTrades(client, message) {
|
|
721
785
|
//
|
|
722
786
|
// {
|
|
@@ -1558,6 +1622,96 @@ class gate extends gate$1 {
|
|
|
1558
1622
|
delete client.subscriptions[id];
|
|
1559
1623
|
}
|
|
1560
1624
|
}
|
|
1625
|
+
handleUnSubscribe(client, message) {
|
|
1626
|
+
//
|
|
1627
|
+
// {
|
|
1628
|
+
// "time":1725534679,
|
|
1629
|
+
// "time_ms":1725534679786,
|
|
1630
|
+
// "id":2,
|
|
1631
|
+
// "conn_id":"fac539b443fd7002",
|
|
1632
|
+
// "trace_id":"efe1d282b630b4aa266b84bee177791a",
|
|
1633
|
+
// "channel":"spot.trades",
|
|
1634
|
+
// "event":"unsubscribe",
|
|
1635
|
+
// "payload":[
|
|
1636
|
+
// "LTC_USDT"
|
|
1637
|
+
// ],
|
|
1638
|
+
// "result":{
|
|
1639
|
+
// "status":"success"
|
|
1640
|
+
// },
|
|
1641
|
+
// "requestId":"efe1d282b630b4aa266b84bee177791a"
|
|
1642
|
+
// }
|
|
1643
|
+
//
|
|
1644
|
+
const id = this.safeString(message, 'id');
|
|
1645
|
+
const keys = Object.keys(client.subscriptions);
|
|
1646
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1647
|
+
const messageHash = keys[i];
|
|
1648
|
+
if (!(messageHash in client.subscriptions)) {
|
|
1649
|
+
continue;
|
|
1650
|
+
// the previous iteration can have deleted the messageHash from the subscriptions
|
|
1651
|
+
}
|
|
1652
|
+
if (messageHash.startsWith('unsubscribe')) {
|
|
1653
|
+
const subscription = client.subscriptions[messageHash];
|
|
1654
|
+
const subId = this.safeString(subscription, 'id');
|
|
1655
|
+
if (id !== subId) {
|
|
1656
|
+
continue;
|
|
1657
|
+
}
|
|
1658
|
+
const messageHashes = this.safeList(subscription, 'messageHashes', []);
|
|
1659
|
+
const subMessageHashes = this.safeList(subscription, 'subMessageHashes', []);
|
|
1660
|
+
for (let j = 0; j < messageHashes.length; j++) {
|
|
1661
|
+
const unsubHash = messageHashes[j];
|
|
1662
|
+
const subHash = subMessageHashes[j];
|
|
1663
|
+
if (unsubHash in client.subscriptions) {
|
|
1664
|
+
delete client.subscriptions[unsubHash];
|
|
1665
|
+
}
|
|
1666
|
+
if (subHash in client.subscriptions) {
|
|
1667
|
+
delete client.subscriptions[subHash];
|
|
1668
|
+
}
|
|
1669
|
+
const error = new errors.UnsubscribeError(this.id + ' ' + messageHash);
|
|
1670
|
+
client.reject(error, subHash);
|
|
1671
|
+
client.resolve(true, unsubHash);
|
|
1672
|
+
}
|
|
1673
|
+
this.cleanCache(subscription);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
cleanCache(subscription) {
|
|
1678
|
+
const topic = this.safeString(subscription, 'topic', '');
|
|
1679
|
+
const symbols = this.safeList(subscription, 'symbols', []);
|
|
1680
|
+
const symbolsLength = symbols.length;
|
|
1681
|
+
if (topic === 'ohlcv') {
|
|
1682
|
+
const symbolsAndTimeFrames = this.safeList(subscription, 'symbolsAndTimeframes', []);
|
|
1683
|
+
for (let i = 0; i < symbolsAndTimeFrames.length; i++) {
|
|
1684
|
+
const symbolAndTimeFrame = symbolsAndTimeFrames[i];
|
|
1685
|
+
const symbol = this.safeString(symbolAndTimeFrame, 0);
|
|
1686
|
+
const timeframe = this.safeString(symbolAndTimeFrame, 1);
|
|
1687
|
+
delete this.ohlcvs[symbol][timeframe];
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
else if (symbolsLength > 0) {
|
|
1691
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1692
|
+
const symbol = symbols[i];
|
|
1693
|
+
if (topic.endsWith('trades')) {
|
|
1694
|
+
delete this.trades[symbol];
|
|
1695
|
+
}
|
|
1696
|
+
else if (topic === 'orderbook') {
|
|
1697
|
+
delete this.orderbooks[symbol];
|
|
1698
|
+
}
|
|
1699
|
+
else if (topic === 'ticker') {
|
|
1700
|
+
delete this.tickers[symbol];
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
else {
|
|
1705
|
+
if (topic.endsWith('trades')) {
|
|
1706
|
+
// don't reset this.myTrades directly here
|
|
1707
|
+
// because in c# we need to use a different object
|
|
1708
|
+
const keys = Object.keys(this.trades);
|
|
1709
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1710
|
+
delete this.trades[keys[i]];
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1561
1715
|
handleMessage(client, message) {
|
|
1562
1716
|
//
|
|
1563
1717
|
// subscribe
|
|
@@ -1656,6 +1810,10 @@ class gate extends gate$1 {
|
|
|
1656
1810
|
this.handleSubscriptionStatus(client, message);
|
|
1657
1811
|
return;
|
|
1658
1812
|
}
|
|
1813
|
+
if (event === 'unsubscribe') {
|
|
1814
|
+
this.handleUnSubscribe(client, message);
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1659
1817
|
const channel = this.safeString(message, 'channel', '');
|
|
1660
1818
|
const channelParts = channel.split('.');
|
|
1661
1819
|
const channelType = this.safeValue(channelParts, 1);
|
|
@@ -1775,6 +1933,27 @@ class gate extends gate$1 {
|
|
|
1775
1933
|
const message = this.extend(request, params);
|
|
1776
1934
|
return await this.watchMultiple(url, messageHashes, message, messageHashes);
|
|
1777
1935
|
}
|
|
1936
|
+
async unSubscribePublicMultiple(url, topic, symbols, messageHashes, subMessageHashes, payload, channel, params = {}) {
|
|
1937
|
+
const requestId = this.requestId();
|
|
1938
|
+
const time = this.seconds();
|
|
1939
|
+
const request = {
|
|
1940
|
+
'id': requestId,
|
|
1941
|
+
'time': time,
|
|
1942
|
+
'channel': channel,
|
|
1943
|
+
'event': 'unsubscribe',
|
|
1944
|
+
'payload': payload,
|
|
1945
|
+
};
|
|
1946
|
+
const sub = {
|
|
1947
|
+
'id': requestId.toString(),
|
|
1948
|
+
'topic': topic,
|
|
1949
|
+
'unsubscribe': true,
|
|
1950
|
+
'messageHashes': messageHashes,
|
|
1951
|
+
'subMessageHashes': subMessageHashes,
|
|
1952
|
+
'symbols': symbols,
|
|
1953
|
+
};
|
|
1954
|
+
const message = this.extend(request, params);
|
|
1955
|
+
return await this.watchMultiple(url, messageHashes, message, messageHashes, sub);
|
|
1956
|
+
}
|
|
1778
1957
|
async authenticate(url, messageType) {
|
|
1779
1958
|
const channel = messageType + '.login';
|
|
1780
1959
|
const client = this.client(url);
|
|
@@ -154,6 +154,27 @@ class kucoin extends kucoin$1 {
|
|
|
154
154
|
}
|
|
155
155
|
return await this.watchMultiple(url, messageHashes, message, subscriptionHashes, subscription);
|
|
156
156
|
}
|
|
157
|
+
async unSubscribeMultiple(url, messageHashes, topic, subscriptionHashes, params = {}, subscription = undefined) {
|
|
158
|
+
const requestId = this.requestId().toString();
|
|
159
|
+
const request = {
|
|
160
|
+
'id': requestId,
|
|
161
|
+
'type': 'unsubscribe',
|
|
162
|
+
'topic': topic,
|
|
163
|
+
'response': true,
|
|
164
|
+
};
|
|
165
|
+
const message = this.extend(request, params);
|
|
166
|
+
if (subscription !== undefined) {
|
|
167
|
+
subscription[requestId] = requestId;
|
|
168
|
+
}
|
|
169
|
+
const client = this.client(url);
|
|
170
|
+
for (let i = 0; i < subscriptionHashes.length; i++) {
|
|
171
|
+
const subscriptionHash = subscriptionHashes[i];
|
|
172
|
+
if (!(subscriptionHash in client.subscriptions)) {
|
|
173
|
+
client.subscriptions[requestId] = subscriptionHash;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return await this.watchMultiple(url, messageHashes, message, subscriptionHashes, subscription);
|
|
177
|
+
}
|
|
157
178
|
async watchTicker(symbol, params = {}) {
|
|
158
179
|
/**
|
|
159
180
|
* @method
|
|
@@ -507,6 +528,51 @@ class kucoin extends kucoin$1 {
|
|
|
507
528
|
}
|
|
508
529
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
509
530
|
}
|
|
531
|
+
async unWatchTradesForSymbols(symbols, params = {}) {
|
|
532
|
+
/**
|
|
533
|
+
* @method
|
|
534
|
+
* @name kucoin#unWatchTradesForSymbols
|
|
535
|
+
* @description unWatches trades stream
|
|
536
|
+
* @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data
|
|
537
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
538
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
539
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
540
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
541
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
542
|
+
*/
|
|
543
|
+
await this.loadMarkets();
|
|
544
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
545
|
+
const marketIds = this.marketIds(symbols);
|
|
546
|
+
const url = await this.negotiate(false);
|
|
547
|
+
const messageHashes = [];
|
|
548
|
+
const subscriptionHashes = [];
|
|
549
|
+
const topic = '/market/match:' + marketIds.join(',');
|
|
550
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
551
|
+
const symbol = symbols[i];
|
|
552
|
+
messageHashes.push('unsubscribe:trades:' + symbol);
|
|
553
|
+
subscriptionHashes.push('trades:' + symbol);
|
|
554
|
+
}
|
|
555
|
+
const subscription = {
|
|
556
|
+
'messageHashes': messageHashes,
|
|
557
|
+
'subMessageHashes': subscriptionHashes,
|
|
558
|
+
'topic': 'trades',
|
|
559
|
+
'unsubscribe': true,
|
|
560
|
+
'symbols': symbols,
|
|
561
|
+
};
|
|
562
|
+
return await this.unSubscribeMultiple(url, messageHashes, topic, messageHashes, params, subscription);
|
|
563
|
+
}
|
|
564
|
+
async unWatchTrades(symbol, params = {}) {
|
|
565
|
+
/**
|
|
566
|
+
* @method
|
|
567
|
+
* @name kucoin#unWatchTrades
|
|
568
|
+
* @description unWatches trades stream
|
|
569
|
+
* @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data
|
|
570
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
571
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
572
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
573
|
+
*/
|
|
574
|
+
return await this.unWatchTradesForSymbols([symbol], params);
|
|
575
|
+
}
|
|
510
576
|
handleTrade(client, message) {
|
|
511
577
|
//
|
|
512
578
|
// {
|
|
@@ -791,6 +857,72 @@ class kucoin extends kucoin$1 {
|
|
|
791
857
|
if (method !== undefined) {
|
|
792
858
|
method.call(this, client, message, subscription);
|
|
793
859
|
}
|
|
860
|
+
const isUnSub = this.safeBool(subscription, 'unsubscribe', false);
|
|
861
|
+
if (isUnSub) {
|
|
862
|
+
const messageHashes = this.safeList(subscription, 'messageHashes', []);
|
|
863
|
+
const subMessageHashes = this.safeList(subscription, 'subMessageHashes', []);
|
|
864
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
865
|
+
const messageHash = messageHashes[i];
|
|
866
|
+
const subHash = subMessageHashes[i];
|
|
867
|
+
if (messageHash in client.subscriptions) {
|
|
868
|
+
delete client.subscriptions[messageHash];
|
|
869
|
+
}
|
|
870
|
+
if (subHash in client.subscriptions) {
|
|
871
|
+
delete client.subscriptions[subHash];
|
|
872
|
+
}
|
|
873
|
+
const error = new errors.UnsubscribeError(this.id + ' ' + subHash);
|
|
874
|
+
client.reject(error, subHash);
|
|
875
|
+
client.resolve(true, messageHash);
|
|
876
|
+
this.cleanCache(subscription);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
cleanCache(subscription) {
|
|
881
|
+
const topic = this.safeString(subscription, 'topic');
|
|
882
|
+
const symbols = this.safeList(subscription, 'symbols', []);
|
|
883
|
+
const symbolsLength = symbols.length;
|
|
884
|
+
if (symbolsLength > 0) {
|
|
885
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
886
|
+
const symbol = symbols[i];
|
|
887
|
+
if (topic === 'trades') {
|
|
888
|
+
if (symbol in this.trades) {
|
|
889
|
+
delete this.trades[symbol];
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
else if (topic === 'orderbook') {
|
|
893
|
+
if (symbol in this.orderbooks) {
|
|
894
|
+
delete this.orderbooks[symbol];
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
else if (topic === 'ticker') {
|
|
898
|
+
if (symbol in this.tickers) {
|
|
899
|
+
delete this.tickers[symbol];
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
else {
|
|
905
|
+
if (topic === 'myTrades') {
|
|
906
|
+
// don't reset this.myTrades directly here
|
|
907
|
+
// because in c# we need to use a different object
|
|
908
|
+
const keys = Object.keys(this.myTrades);
|
|
909
|
+
for (let i = 0; i < keys.length; i++) {
|
|
910
|
+
delete this.myTrades[keys[i]];
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
else if (topic === 'orders') {
|
|
914
|
+
const orderSymbols = Object.keys(this.orders);
|
|
915
|
+
for (let i = 0; i < orderSymbols.length; i++) {
|
|
916
|
+
delete this.orders[orderSymbols[i]];
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
else if (topic === 'ticker') {
|
|
920
|
+
const tickerSymbols = Object.keys(this.tickers);
|
|
921
|
+
for (let i = 0; i < tickerSymbols.length; i++) {
|
|
922
|
+
delete this.tickers[tickerSymbols[i]];
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
794
926
|
}
|
|
795
927
|
handleSystemStatus(client, message) {
|
|
796
928
|
//
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.96";
|
|
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.97';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/binance.js
CHANGED
|
@@ -4252,6 +4252,9 @@ export default class binance extends Exchange {
|
|
|
4252
4252
|
const price = this.safeString(params, 'price');
|
|
4253
4253
|
const until = this.safeInteger(params, 'until');
|
|
4254
4254
|
params = this.omit(params, ['price', 'until']);
|
|
4255
|
+
if (since !== undefined && until !== undefined && limit === undefined) {
|
|
4256
|
+
limit = maxLimit;
|
|
4257
|
+
}
|
|
4255
4258
|
limit = (limit === undefined) ? defaultLimit : Math.min(limit, maxLimit);
|
|
4256
4259
|
const request = {
|
|
4257
4260
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
package/js/src/coinex.js
CHANGED
|
@@ -1213,7 +1213,10 @@ export default class coinex extends Exchange {
|
|
|
1213
1213
|
// "side": "buy",
|
|
1214
1214
|
// "order_id": 136915589622,
|
|
1215
1215
|
// "price": "64376",
|
|
1216
|
-
// "amount": "0.0001"
|
|
1216
|
+
// "amount": "0.0001",
|
|
1217
|
+
// "role": "taker",
|
|
1218
|
+
// "fee": "0.0299",
|
|
1219
|
+
// "fee_ccy": "USDT"
|
|
1217
1220
|
// }
|
|
1218
1221
|
//
|
|
1219
1222
|
const timestamp = this.safeInteger(trade, 'created_at');
|
|
@@ -1223,6 +1226,16 @@ export default class coinex extends Exchange {
|
|
|
1223
1226
|
}
|
|
1224
1227
|
const marketId = this.safeString(trade, 'market');
|
|
1225
1228
|
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
1229
|
+
const feeCostString = this.safeString(trade, 'fee');
|
|
1230
|
+
let fee = undefined;
|
|
1231
|
+
if (feeCostString !== undefined) {
|
|
1232
|
+
const feeCurrencyId = this.safeString(trade, 'fee_ccy');
|
|
1233
|
+
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1234
|
+
fee = {
|
|
1235
|
+
'cost': feeCostString,
|
|
1236
|
+
'currency': feeCurrencyCode,
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1226
1239
|
return this.safeTrade({
|
|
1227
1240
|
'info': trade,
|
|
1228
1241
|
'timestamp': timestamp,
|
|
@@ -1232,11 +1245,11 @@ export default class coinex extends Exchange {
|
|
|
1232
1245
|
'order': this.safeString(trade, 'order_id'),
|
|
1233
1246
|
'type': undefined,
|
|
1234
1247
|
'side': this.safeString(trade, 'side'),
|
|
1235
|
-
'takerOrMaker':
|
|
1248
|
+
'takerOrMaker': this.safeString(trade, 'role'),
|
|
1236
1249
|
'price': this.safeString(trade, 'price'),
|
|
1237
1250
|
'amount': this.safeString(trade, 'amount'),
|
|
1238
1251
|
'cost': this.safeString(trade, 'deal_money'),
|
|
1239
|
-
'fee':
|
|
1252
|
+
'fee': fee,
|
|
1240
1253
|
}, market);
|
|
1241
1254
|
}
|
|
1242
1255
|
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
package/js/src/pro/gate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import gateRest from '../gate.js';
|
|
2
|
-
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Position, Balances, Liquidation, OrderType, OrderSide, Num, Market, MarketType, OrderRequest } from '../base/types.js';
|
|
2
|
+
import type { Int, Str, Strings, OrderBook, Order, Trade, Ticker, Tickers, OHLCV, Position, Balances, Dict, Liquidation, OrderType, OrderSide, Num, Market, MarketType, OrderRequest } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class gate extends gateRest {
|
|
5
5
|
describe(): any;
|
|
@@ -13,6 +13,7 @@ export default class gate extends gateRest {
|
|
|
13
13
|
fetchClosedOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
14
14
|
fetchOrdersByStatusWs(status: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
15
15
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
16
|
+
unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
|
|
16
17
|
handleOrderBookSubscription(client: Client, message: any, subscription: any): void;
|
|
17
18
|
handleOrderBook(client: Client, message: any): void;
|
|
18
19
|
getCacheIndex(orderBook: any, cache: any): any;
|
|
@@ -27,6 +28,8 @@ export default class gate extends gateRest {
|
|
|
27
28
|
handleTickerAndBidAsk(objectName: string, client: Client, message: any): void;
|
|
28
29
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
29
30
|
watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
31
|
+
unWatchTradesForSymbols(symbols: string[], params?: {}): Promise<any>;
|
|
32
|
+
unWatchTrades(symbol: string, params?: {}): Promise<any>;
|
|
30
33
|
handleTrades(client: Client, message: any): void;
|
|
31
34
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
32
35
|
handleOHLCV(client: Client, message: any): void;
|
|
@@ -47,6 +50,8 @@ export default class gate extends gateRest {
|
|
|
47
50
|
handleErrorMessage(client: Client, message: any): boolean;
|
|
48
51
|
handleBalanceSubscription(client: Client, message: any, subscription?: any): void;
|
|
49
52
|
handleSubscriptionStatus(client: Client, message: any): void;
|
|
53
|
+
handleUnSubscribe(client: Client, message: any): void;
|
|
54
|
+
cleanCache(subscription: Dict): void;
|
|
50
55
|
handleMessage(client: Client, message: any): void;
|
|
51
56
|
getUrlByMarket(market: any): any;
|
|
52
57
|
getTypeByMarket(market: Market): "spot" | "futures" | "options";
|
|
@@ -55,6 +60,7 @@ export default class gate extends gateRest {
|
|
|
55
60
|
requestId(): any;
|
|
56
61
|
subscribePublic(url: any, messageHash: any, payload: any, channel: any, params?: {}, subscription?: any): Promise<any>;
|
|
57
62
|
subscribePublicMultiple(url: any, messageHashes: any, payload: any, channel: any, params?: {}): Promise<any>;
|
|
63
|
+
unSubscribePublicMultiple(url: any, topic: any, symbols: any, messageHashes: any, subMessageHashes: any, payload: any, channel: any, params?: {}): Promise<any>;
|
|
58
64
|
authenticate(url: any, messageType: any): Promise<any>;
|
|
59
65
|
handleAuthenticationMessage(client: Client, message: any): void;
|
|
60
66
|
requestPrivate(url: any, reqParams: any, channel: any, requestId?: Str): Promise<any>;
|