ccxt 4.5.17 → 4.5.18
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 +8 -5
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/deepcoin.js +11 -0
- package/dist/cjs/src/apex.js +33 -15
- package/dist/cjs/src/base/Exchange.js +3 -3
- package/dist/cjs/src/base/ws/Client.js +8 -7
- package/dist/cjs/src/bigone.js +20 -0
- package/dist/cjs/src/binanceus.js +31 -1
- package/dist/cjs/src/blofin.js +4 -1
- package/dist/cjs/src/bybit.js +3 -0
- package/dist/cjs/src/deepcoin.js +3024 -0
- package/dist/cjs/src/pro/ascendex.js +2 -2
- package/dist/cjs/src/pro/binance.js +100 -3
- package/dist/cjs/src/pro/binanceus.js +19 -0
- package/dist/cjs/src/pro/blofin.js +11 -2
- package/dist/cjs/src/pro/deepcoin.js +1225 -0
- package/dist/cjs/src/pro/kraken.js +5 -1
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/bybit.d.ts +3 -0
- package/js/src/abstract/deepcoin.d.ts +60 -0
- package/js/src/abstract/deepcoin.js +11 -0
- package/js/src/apex.d.ts +2 -0
- package/js/src/apex.js +33 -15
- package/js/src/base/Exchange.js +3 -3
- package/js/src/base/ws/Client.js +8 -7
- package/js/src/bigone.js +20 -0
- package/js/src/binanceus.js +31 -1
- package/js/src/blofin.js +4 -1
- package/js/src/bybit.js +3 -0
- package/js/src/deepcoin.d.ts +498 -0
- package/js/src/deepcoin.js +3022 -0
- package/js/src/pro/ascendex.d.ts +1 -1
- package/js/src/pro/ascendex.js +2 -2
- package/js/src/pro/binance.d.ts +35 -1
- package/js/src/pro/binance.js +97 -3
- package/js/src/pro/binanceus.js +19 -0
- package/js/src/pro/blofin.d.ts +5 -0
- package/js/src/pro/blofin.js +11 -2
- package/js/src/pro/deepcoin.d.ts +169 -0
- package/js/src/pro/deepcoin.js +1224 -0
- package/js/src/pro/kraken.js +5 -1
- package/package.json +1 -1
|
@@ -271,7 +271,7 @@ class ascendex extends ascendex$1["default"] {
|
|
|
271
271
|
const orderbook = await this.watchPublic(channel, params);
|
|
272
272
|
return orderbook.limit();
|
|
273
273
|
}
|
|
274
|
-
async
|
|
274
|
+
async fetchOrderBookSnapshotCustom(symbol, limit = undefined, params = {}) {
|
|
275
275
|
const restOrderBook = await this.fetchRestOrderBookSafe(symbol, limit, params);
|
|
276
276
|
if (!(symbol in this.orderbooks)) {
|
|
277
277
|
this.orderbooks[symbol] = this.orderBook();
|
|
@@ -961,7 +961,7 @@ class ascendex extends ascendex$1["default"] {
|
|
|
961
961
|
}
|
|
962
962
|
this.orderbooks[symbol] = this.orderBook({});
|
|
963
963
|
if (this.options['defaultType'] === 'swap' || market['contract']) {
|
|
964
|
-
this.spawn(this.
|
|
964
|
+
this.spawn(this.fetchOrderBookSnapshotCustom, symbol);
|
|
965
965
|
}
|
|
966
966
|
else {
|
|
967
967
|
this.spawn(this.watchOrderBookSnapshot, symbol);
|
|
@@ -63,6 +63,19 @@ class binance extends binance$1["default"] {
|
|
|
63
63
|
'fetchTradesWs': true,
|
|
64
64
|
'fetchTradingFeesWs': false,
|
|
65
65
|
'fetchWithdrawalsWs': false,
|
|
66
|
+
'unWatchTicker': true,
|
|
67
|
+
'unWatchTickers': true,
|
|
68
|
+
'unWatchOHLCV': true,
|
|
69
|
+
'unWatchOHLCVForSymbols': true,
|
|
70
|
+
'unWatchOrderBook': true,
|
|
71
|
+
'unWatchOrderBookForSymbols': true,
|
|
72
|
+
'unWatchTrades': true,
|
|
73
|
+
'unWatchTradesForSymbols': true,
|
|
74
|
+
'unWatchMyTrades': false,
|
|
75
|
+
'unWatchOrders': false,
|
|
76
|
+
'unWatchPositions': false,
|
|
77
|
+
'unWatchMarkPrices': true,
|
|
78
|
+
'unWatchMarkPrice': true,
|
|
66
79
|
},
|
|
67
80
|
'urls': {
|
|
68
81
|
'test': {
|
|
@@ -1903,12 +1916,14 @@ class binance extends binance$1["default"] {
|
|
|
1903
1916
|
const isBidAsk = (channelName === 'bookTicker');
|
|
1904
1917
|
const subscriptionArgs = [];
|
|
1905
1918
|
const subMessageHashes = [];
|
|
1919
|
+
const messageHashes = [];
|
|
1906
1920
|
if (symbolsDefined) {
|
|
1907
1921
|
for (let i = 0; i < symbols.length; i++) {
|
|
1908
1922
|
const symbol = symbols[i];
|
|
1909
1923
|
const market = this.market(symbol);
|
|
1910
1924
|
subscriptionArgs.push(market['lowercaseId'] + '@' + channelName);
|
|
1911
1925
|
subMessageHashes.push(this.getMessageHash(channelName, market['symbol'], isBidAsk));
|
|
1926
|
+
messageHashes.push('unsubscribe:ticker:' + symbol);
|
|
1912
1927
|
}
|
|
1913
1928
|
}
|
|
1914
1929
|
else {
|
|
@@ -1922,6 +1937,7 @@ class binance extends binance$1["default"] {
|
|
|
1922
1937
|
subscriptionArgs.push('!' + channelName + '@arr');
|
|
1923
1938
|
}
|
|
1924
1939
|
subMessageHashes.push(this.getMessageHash(channelName, undefined, isBidAsk));
|
|
1940
|
+
messageHashes.push('unsubscribe:ticker');
|
|
1925
1941
|
}
|
|
1926
1942
|
let streamHash = channelName;
|
|
1927
1943
|
if (symbolsDefined) {
|
|
@@ -1938,11 +1954,91 @@ class binance extends binance$1["default"] {
|
|
|
1938
1954
|
'unsubscribe': true,
|
|
1939
1955
|
'id': requestId.toString(),
|
|
1940
1956
|
'subMessageHashes': subMessageHashes,
|
|
1941
|
-
'messageHashes':
|
|
1957
|
+
'messageHashes': messageHashes,
|
|
1942
1958
|
'symbols': symbols,
|
|
1943
1959
|
'topic': 'ticker',
|
|
1944
1960
|
};
|
|
1945
|
-
return await this.watchMultiple(url,
|
|
1961
|
+
return await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscription);
|
|
1962
|
+
}
|
|
1963
|
+
/**
|
|
1964
|
+
* @method
|
|
1965
|
+
* @name binance#unWatchMarkPrices
|
|
1966
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
1967
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Mark-Price-Stream
|
|
1968
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
1969
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1970
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1971
|
+
*/
|
|
1972
|
+
async unWatchMarkPrices(symbols = undefined, params = {}) {
|
|
1973
|
+
let channelName = undefined;
|
|
1974
|
+
[channelName, params] = this.handleOptionAndParams(params, 'watchMarkPrices', 'name', 'markPrice');
|
|
1975
|
+
await this.loadMarkets();
|
|
1976
|
+
const use1sFreq = this.safeBool(params, 'use1sFreq', true);
|
|
1977
|
+
const suffix = (use1sFreq) ? '@1s' : '';
|
|
1978
|
+
const methodName = 'watchMarkPrices';
|
|
1979
|
+
symbols = this.marketSymbols(symbols, undefined, true, false, true);
|
|
1980
|
+
let firstMarket = undefined;
|
|
1981
|
+
let marketType = undefined;
|
|
1982
|
+
const symbolsDefined = (symbols !== undefined);
|
|
1983
|
+
if (symbolsDefined) {
|
|
1984
|
+
firstMarket = this.market(symbols[0]);
|
|
1985
|
+
}
|
|
1986
|
+
[marketType, params] = this.handleMarketTypeAndParams(methodName, firstMarket, params);
|
|
1987
|
+
if (marketType !== 'swap' && marketType !== 'future') {
|
|
1988
|
+
throw new errors.NotSupported(this.id + ' ' + methodName + '() only supports swap markets');
|
|
1989
|
+
}
|
|
1990
|
+
const rawMarketType = 'future';
|
|
1991
|
+
const subscriptionArgs = [];
|
|
1992
|
+
const subMessageHashes = [];
|
|
1993
|
+
const messageHashes = [];
|
|
1994
|
+
if (symbolsDefined) {
|
|
1995
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
1996
|
+
const symbol = symbols[i];
|
|
1997
|
+
const market = this.market(symbol);
|
|
1998
|
+
const msgHash = this.getMessageHash(channelName, market['symbol'], false);
|
|
1999
|
+
subscriptionArgs.push(market['lowercaseId'] + '@' + channelName + suffix);
|
|
2000
|
+
subMessageHashes.push(msgHash);
|
|
2001
|
+
messageHashes.push('unsubscribe:' + msgHash);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
else {
|
|
2005
|
+
const msgHashNoSymbol = this.getMessageHash(channelName, undefined, false);
|
|
2006
|
+
subscriptionArgs.push('!' + channelName + '@arr');
|
|
2007
|
+
subMessageHashes.push(msgHashNoSymbol);
|
|
2008
|
+
messageHashes.push('unsubscribe:' + msgHashNoSymbol);
|
|
2009
|
+
}
|
|
2010
|
+
let streamHash = channelName;
|
|
2011
|
+
if (symbolsDefined) {
|
|
2012
|
+
streamHash = channelName + '::' + symbols.join(',');
|
|
2013
|
+
}
|
|
2014
|
+
const url = this.urls['api']['ws'][rawMarketType] + '/' + this.stream(rawMarketType, streamHash);
|
|
2015
|
+
const requestId = this.requestId(url);
|
|
2016
|
+
const request = {
|
|
2017
|
+
'method': 'UNSUBSCRIBE',
|
|
2018
|
+
'params': subscriptionArgs,
|
|
2019
|
+
'id': requestId,
|
|
2020
|
+
};
|
|
2021
|
+
const subscription = {
|
|
2022
|
+
'unsubscribe': true,
|
|
2023
|
+
'id': requestId.toString(),
|
|
2024
|
+
'subMessageHashes': subMessageHashes,
|
|
2025
|
+
'messageHashes': messageHashes,
|
|
2026
|
+
'symbols': symbols,
|
|
2027
|
+
'topic': 'ticker',
|
|
2028
|
+
};
|
|
2029
|
+
return await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscription);
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* @method
|
|
2033
|
+
* @name binance#unWatchMarkPrice
|
|
2034
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
2035
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/Mark-Price-Stream
|
|
2036
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2037
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2038
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2039
|
+
*/
|
|
2040
|
+
async unWatchMarkPrice(symbol, params = {}) {
|
|
2041
|
+
return await this.unWatchMarkPrices([symbol], params);
|
|
1946
2042
|
}
|
|
1947
2043
|
/**
|
|
1948
2044
|
* @method
|
|
@@ -2349,7 +2445,8 @@ class binance extends binance$1["default"] {
|
|
|
2349
2445
|
return extendedParams;
|
|
2350
2446
|
}
|
|
2351
2447
|
/**
|
|
2352
|
-
*
|
|
2448
|
+
* @name binance#ensureUserDataStreamWsSubscribeSignature
|
|
2449
|
+
* @description watches best bid & ask for symbols
|
|
2353
2450
|
* @param marketType {string} only support on 'spot'
|
|
2354
2451
|
* @see {@link https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/user-data-stream-requests#subscribe-to-user-data-stream-through-signature-subscription-user_data Binance User Data Stream Documentation}
|
|
2355
2452
|
* @returns Promise<number> The subscription ID for the user data stream
|
|
@@ -38,6 +38,25 @@ class binanceus extends binance["default"] {
|
|
|
38
38
|
'doc': 'https://github.com/binance-us/binance-official-api-docs',
|
|
39
39
|
'fees': 'https://www.binance.us/en/fee/schedule',
|
|
40
40
|
},
|
|
41
|
+
'has': {
|
|
42
|
+
'createOrderWithTakeProfitAndStopLossWs': false,
|
|
43
|
+
'createReduceOnlyOrderWs': false,
|
|
44
|
+
'createStopLossOrderWs': false,
|
|
45
|
+
'createTakeProfitOrderWs': false,
|
|
46
|
+
'fetchPositionForSymbolWs': false,
|
|
47
|
+
'fetchPositionsForSymbolWs': false,
|
|
48
|
+
'fetchPositionsWs': false,
|
|
49
|
+
'fetchPositionWs': false,
|
|
50
|
+
'unWatchPositions': false,
|
|
51
|
+
'watchLiquidations': false,
|
|
52
|
+
'watchLiquidationsForSymbols': false,
|
|
53
|
+
'watchMarkPrice': false,
|
|
54
|
+
'watchMarkPrices': false,
|
|
55
|
+
'watchMyLiquidations': false,
|
|
56
|
+
'watchMyLiquidationsForSymbols': false,
|
|
57
|
+
'watchPosition': false,
|
|
58
|
+
'watchPositions': false,
|
|
59
|
+
},
|
|
41
60
|
'options': {
|
|
42
61
|
'fetchCurrencies': false,
|
|
43
62
|
'quoteOrderQty': false,
|
|
@@ -484,10 +484,13 @@ class blofin extends blofin$1["default"] {
|
|
|
484
484
|
* @method
|
|
485
485
|
* @name biofin#watchOrders
|
|
486
486
|
* @description watches information on multiple orders made by the user
|
|
487
|
+
* @see https://docs.blofin.com/index.html#ws-order-channel
|
|
488
|
+
* @see https://docs.blofin.com/index.html#ws-algo-orders-channel
|
|
487
489
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
488
490
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
489
491
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
490
492
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
493
|
+
* @param {boolean} [params.trigger] set to true for trigger orders
|
|
491
494
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure
|
|
492
495
|
*/
|
|
493
496
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -500,16 +503,21 @@ class blofin extends blofin$1["default"] {
|
|
|
500
503
|
* @name blofin#watchOrdersForSymbols
|
|
501
504
|
* @description watches information on multiple orders made by the user across multiple symbols
|
|
502
505
|
* @see https://docs.blofin.com/index.html#ws-order-channel
|
|
506
|
+
* @see https://docs.blofin.com/index.html#ws-algo-orders-channel
|
|
503
507
|
* @param {string[]} symbols
|
|
504
508
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
505
509
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
506
510
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
511
|
+
* @param {boolean} [params.trigger] set to true for trigger orders
|
|
507
512
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure
|
|
508
513
|
*/
|
|
509
514
|
async watchOrdersForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
510
515
|
await this.authenticate();
|
|
511
516
|
await this.loadMarkets();
|
|
512
|
-
const
|
|
517
|
+
const trigger = this.safeValue2(params, 'stop', 'trigger');
|
|
518
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
519
|
+
const channel = trigger ? 'orders-algo' : 'orders';
|
|
520
|
+
const orders = await this.watchMultipleWrapper(false, channel, 'watchOrdersForSymbols', symbols, params);
|
|
513
521
|
if (this.newUpdates) {
|
|
514
522
|
const first = this.safeValue(orders, 0);
|
|
515
523
|
const tradeSymbol = this.safeString(first, 'symbol');
|
|
@@ -645,7 +653,7 @@ class blofin extends blofin$1["default"] {
|
|
|
645
653
|
messageHashes.push(channelName);
|
|
646
654
|
}
|
|
647
655
|
// private channel are difference, they only need plural channel name for multiple symbols
|
|
648
|
-
if (this.inArray(channelName, ['orders', 'positions'])) {
|
|
656
|
+
if (this.inArray(channelName, ['orders', 'orders-algo', 'positions'])) {
|
|
649
657
|
rawSubscriptions = [{ 'channel': channelName }];
|
|
650
658
|
}
|
|
651
659
|
const request = this.getSubscriptionRequest(rawSubscriptions);
|
|
@@ -683,6 +691,7 @@ class blofin extends blofin$1["default"] {
|
|
|
683
691
|
// private
|
|
684
692
|
'account': this.handleBalance,
|
|
685
693
|
'orders': this.handleOrders,
|
|
694
|
+
'orders-algo': this.handleOrders,
|
|
686
695
|
'positions': this.handlePositions,
|
|
687
696
|
};
|
|
688
697
|
let method = undefined;
|