ccxt 4.3.86 → 4.3.88
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 +6 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +2 -1
- package/dist/cjs/src/base/Exchange.js +2 -2
- package/dist/cjs/src/base/errors.js +8 -1
- package/dist/cjs/src/bingx.js +7 -1
- package/dist/cjs/src/hashkey.js +3 -4
- package/dist/cjs/src/kraken.js +37 -6
- package/dist/cjs/src/kucoin.js +2 -0
- package/dist/cjs/src/pro/bitfinex.js +1 -0
- package/dist/cjs/src/pro/bitfinex2.js +1 -0
- package/dist/cjs/src/pro/bitget.js +164 -19
- package/dist/cjs/src/pro/bitopro.js +1 -0
- package/dist/cjs/src/pro/bitstamp.js +1 -0
- package/dist/cjs/src/pro/blockchaincom.js +1 -0
- package/dist/cjs/src/pro/cex.js +1 -0
- package/dist/cjs/src/pro/coincheck.js +1 -0
- package/dist/cjs/src/pro/coinone.js +1 -0
- package/dist/cjs/src/pro/hashkey.js +1 -0
- package/dist/cjs/src/pro/hitbtc.js +1 -0
- package/dist/cjs/src/pro/hollaex.js +1 -0
- package/dist/cjs/src/pro/htx.js +1 -0
- package/dist/cjs/src/pro/huobijp.js +1 -0
- package/dist/cjs/src/pro/hyperliquid.js +7 -0
- package/dist/cjs/src/pro/independentreserve.js +1 -0
- package/dist/cjs/src/pro/lbank.js +1 -0
- package/dist/cjs/src/pro/luno.js +1 -0
- package/dist/cjs/src/pro/ndax.js +5 -0
- package/dist/cjs/src/pro/okcoin.js +7 -0
- package/dist/cjs/src/pro/onetrading.js +1 -0
- package/dist/cjs/src/pro/p2b.js +34 -7
- package/dist/cjs/src/pro/paradex.js +1 -0
- package/dist/cjs/src/pro/poloniex.js +36 -3
- package/dist/cjs/src/pro/poloniexfutures.js +1 -0
- package/dist/cjs/src/pro/probit.js +2 -0
- package/dist/cjs/src/pro/upbit.js +48 -3
- package/dist/cjs/src/pro/vertex.js +1 -0
- package/dist/cjs/src/pro/wazirx.js +3 -0
- package/dist/cjs/src/pro/whitebit.js +9 -0
- package/dist/cjs/src/upbit.js +1 -1
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +3 -3
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +2 -2
- package/js/src/base/errorHierarchy.d.ts +1 -0
- package/js/src/base/errorHierarchy.js +1 -0
- package/js/src/base/errors.d.ts +5 -1
- package/js/src/base/errors.js +8 -2
- package/js/src/bingx.js +7 -1
- package/js/src/coinex.d.ts +1 -1
- package/js/src/hashkey.js +3 -4
- package/js/src/kraken.js +37 -6
- package/js/src/kucoin.js +2 -0
- package/js/src/pro/bitfinex.js +1 -0
- package/js/src/pro/bitfinex2.js +1 -0
- package/js/src/pro/bitget.d.ts +8 -0
- package/js/src/pro/bitget.js +165 -20
- package/js/src/pro/bitopro.js +1 -0
- package/js/src/pro/bitstamp.js +1 -0
- package/js/src/pro/blockchaincom.js +1 -0
- package/js/src/pro/cex.js +1 -0
- package/js/src/pro/coincheck.js +1 -0
- package/js/src/pro/coinone.js +1 -0
- package/js/src/pro/hashkey.js +1 -0
- package/js/src/pro/hitbtc.js +1 -0
- package/js/src/pro/hollaex.js +1 -0
- package/js/src/pro/htx.js +1 -0
- package/js/src/pro/huobijp.js +1 -0
- package/js/src/pro/hyperliquid.js +7 -0
- package/js/src/pro/independentreserve.js +1 -0
- package/js/src/pro/lbank.js +1 -0
- package/js/src/pro/luno.js +1 -0
- package/js/src/pro/ndax.js +5 -0
- package/js/src/pro/okcoin.js +7 -0
- package/js/src/pro/onetrading.js +1 -0
- package/js/src/pro/p2b.d.ts +1 -0
- package/js/src/pro/p2b.js +34 -7
- package/js/src/pro/paradex.js +1 -0
- package/js/src/pro/poloniex.d.ts +1 -0
- package/js/src/pro/poloniex.js +36 -3
- package/js/src/pro/poloniexfutures.js +1 -0
- package/js/src/pro/probit.js +2 -0
- package/js/src/pro/upbit.d.ts +1 -0
- package/js/src/pro/upbit.js +48 -3
- package/js/src/pro/vertex.js +1 -0
- package/js/src/pro/wazirx.js +3 -0
- package/js/src/pro/whitebit.js +9 -0
- package/js/src/upbit.js +1 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -196,7 +196,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
196
196
|
|
|
197
197
|
//-----------------------------------------------------------------------------
|
|
198
198
|
// this is updated by vss.js when building
|
|
199
|
-
const version = '4.3.
|
|
199
|
+
const version = '4.3.88';
|
|
200
200
|
Exchange["default"].ccxtVersion = version;
|
|
201
201
|
const exchanges = {
|
|
202
202
|
'ace': ace,
|
|
@@ -431,6 +431,7 @@ exports.OrderNotFound = errors.OrderNotFound;
|
|
|
431
431
|
exports.PermissionDenied = errors.PermissionDenied;
|
|
432
432
|
exports.RateLimitExceeded = errors.RateLimitExceeded;
|
|
433
433
|
exports.RequestTimeout = errors.RequestTimeout;
|
|
434
|
+
exports.UnsubscribeError = errors.UnsubscribeError;
|
|
434
435
|
exports.errors = errors;
|
|
435
436
|
exports.ace = ace;
|
|
436
437
|
exports.alpaca = alpaca;
|
|
@@ -5999,7 +5999,7 @@ class Exchange {
|
|
|
5999
5999
|
errors$1 = 0;
|
|
6000
6000
|
result = this.arrayConcat(result, response);
|
|
6001
6001
|
const last = this.safeValue(response, responseLength - 1);
|
|
6002
|
-
paginationTimestamp = this.safeInteger(last, 'timestamp')
|
|
6002
|
+
paginationTimestamp = this.safeInteger(last, 'timestamp') + 1;
|
|
6003
6003
|
if ((until !== undefined) && (paginationTimestamp >= until)) {
|
|
6004
6004
|
break;
|
|
6005
6005
|
}
|
|
@@ -6449,7 +6449,7 @@ class Exchange {
|
|
|
6449
6449
|
*/
|
|
6450
6450
|
if (this.has['fetchPositionsHistory']) {
|
|
6451
6451
|
const positions = await this.fetchPositionsHistory([symbol], since, limit, params);
|
|
6452
|
-
return
|
|
6452
|
+
return positions;
|
|
6453
6453
|
}
|
|
6454
6454
|
else {
|
|
6455
6455
|
throw new errors.NotSupported(this.id + ' fetchPositionHistory () is not supported yet');
|
|
@@ -237,7 +237,13 @@ class CancelPending extends OperationFailed {
|
|
|
237
237
|
this.name = 'CancelPending';
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
class UnsubscribeError extends BaseError {
|
|
241
|
+
constructor(message) {
|
|
242
|
+
super(message);
|
|
243
|
+
this.name = 'UnsubscribeError';
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
var errors = { 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 };
|
|
241
247
|
|
|
242
248
|
exports.AccountNotEnabled = AccountNotEnabled;
|
|
243
249
|
exports.AccountSuspended = AccountSuspended;
|
|
@@ -278,4 +284,5 @@ exports.OrderNotFound = OrderNotFound;
|
|
|
278
284
|
exports.PermissionDenied = PermissionDenied;
|
|
279
285
|
exports.RateLimitExceeded = RateLimitExceeded;
|
|
280
286
|
exports.RequestTimeout = RequestTimeout;
|
|
287
|
+
exports.UnsubscribeError = UnsubscribeError;
|
|
281
288
|
exports["default"] = errors;
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -747,7 +747,13 @@ class bingx extends bingx$1 {
|
|
|
747
747
|
}
|
|
748
748
|
const fees = this.safeDict(this.fees, type, {});
|
|
749
749
|
const contractSize = (swap) ? this.parseNumber('1') : undefined;
|
|
750
|
-
|
|
750
|
+
let isActive = false;
|
|
751
|
+
if ((this.safeString(market, 'apiStateOpen') === 'true') && (this.safeString(market, 'apiStateClose') === 'true')) {
|
|
752
|
+
isActive = true; // swap active
|
|
753
|
+
}
|
|
754
|
+
else if (this.safeBool(market, 'apiStateSell') && this.safeBool(market, 'apiStateBuy')) {
|
|
755
|
+
isActive = true; // spot active
|
|
756
|
+
}
|
|
751
757
|
const isInverse = (spot) ? undefined : checkIsInverse;
|
|
752
758
|
const isLinear = (spot) ? undefined : checkIsLinear;
|
|
753
759
|
let timeOnline = this.safeInteger(market, 'timeOnline');
|
package/dist/cjs/src/hashkey.js
CHANGED
|
@@ -22,7 +22,6 @@ class hashkey extends hashkey$1 {
|
|
|
22
22
|
'version': 'v1',
|
|
23
23
|
'certified': true,
|
|
24
24
|
'pro': true,
|
|
25
|
-
'hostname': '/api-glb',
|
|
26
25
|
'has': {
|
|
27
26
|
'CORS': undefined,
|
|
28
27
|
'spot': true,
|
|
@@ -143,7 +142,7 @@ class hashkey extends hashkey$1 {
|
|
|
143
142
|
'www': 'https://global.hashkey.com/',
|
|
144
143
|
'doc': 'https://hashkeyglobal-apidoc.readme.io/',
|
|
145
144
|
'fees': 'https://support.global.hashkey.com/hc/en-us/articles/13199900083612-HashKey-Global-Fee-Structure',
|
|
146
|
-
'referral': '',
|
|
145
|
+
'referral': 'https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN',
|
|
147
146
|
},
|
|
148
147
|
'api': {
|
|
149
148
|
'public': {
|
|
@@ -2383,7 +2382,7 @@ class hashkey extends hashkey$1 {
|
|
|
2383
2382
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2384
2383
|
/**
|
|
2385
2384
|
* @method
|
|
2386
|
-
* @name createMarketBuyOrderWithCost
|
|
2385
|
+
* @name hashkey#createMarketBuyOrderWithCost
|
|
2387
2386
|
* @description create a market buy order by providing the symbol and cost
|
|
2388
2387
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2389
2388
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
@@ -4172,7 +4171,7 @@ class hashkey extends hashkey$1 {
|
|
|
4172
4171
|
async fetchTradingFees(params = {}) {
|
|
4173
4172
|
/**
|
|
4174
4173
|
* @method
|
|
4175
|
-
* @name
|
|
4174
|
+
* @name hashkey#fetchTradingFees
|
|
4176
4175
|
* @description *for spot markets only* fetch the trading fees for multiple markets
|
|
4177
4176
|
* @see https://developers.binance.com/docs/wallet/asset/trade-fee
|
|
4178
4177
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1109,11 +1109,12 @@ class kraken extends kraken$1 {
|
|
|
1109
1109
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
1110
1110
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1111
1111
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
1112
|
+
* @param {int} [params.end] timestamp in seconds of the latest ledger entry
|
|
1112
1113
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
1113
1114
|
*/
|
|
1114
1115
|
// https://www.kraken.com/features/api#get-ledgers-info
|
|
1115
1116
|
await this.loadMarkets();
|
|
1116
|
-
|
|
1117
|
+
const request = {};
|
|
1117
1118
|
let currency = undefined;
|
|
1118
1119
|
if (code !== undefined) {
|
|
1119
1120
|
currency = this.currency(code);
|
|
@@ -1122,7 +1123,12 @@ class kraken extends kraken$1 {
|
|
|
1122
1123
|
if (since !== undefined) {
|
|
1123
1124
|
request['start'] = this.parseToInt(since / 1000);
|
|
1124
1125
|
}
|
|
1125
|
-
|
|
1126
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
1127
|
+
if (until !== undefined) {
|
|
1128
|
+
params = this.omit(params, ['until', 'till']);
|
|
1129
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
1130
|
+
request['end'] = this.parseToInt(Precise["default"].stringAdd(untilDivided, '1'));
|
|
1131
|
+
}
|
|
1126
1132
|
const response = await this.privatePostLedgers(this.extend(request, params));
|
|
1127
1133
|
// { error: [],
|
|
1128
1134
|
// "result": { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
|
|
@@ -2122,6 +2128,8 @@ class kraken extends kraken$1 {
|
|
|
2122
2128
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2123
2129
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
2124
2130
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2131
|
+
* @param {int} [params.until] timestamp in ms of the latest trade entry
|
|
2132
|
+
* @param {int} [params.end] timestamp in seconds of the latest trade entry
|
|
2125
2133
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2126
2134
|
*/
|
|
2127
2135
|
await this.loadMarkets();
|
|
@@ -2135,6 +2143,12 @@ class kraken extends kraken$1 {
|
|
|
2135
2143
|
if (since !== undefined) {
|
|
2136
2144
|
request['start'] = this.parseToInt(since / 1000);
|
|
2137
2145
|
}
|
|
2146
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2147
|
+
if (until !== undefined) {
|
|
2148
|
+
params = this.omit(params, ['until', 'till']);
|
|
2149
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
2150
|
+
request['end'] = this.parseToInt(Precise["default"].stringAdd(untilDivided, '1'));
|
|
2151
|
+
}
|
|
2138
2152
|
const response = await this.privatePostTradesHistory(this.extend(request, params));
|
|
2139
2153
|
//
|
|
2140
2154
|
// {
|
|
@@ -2550,6 +2564,8 @@ class kraken extends kraken$1 {
|
|
|
2550
2564
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
2551
2565
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
2552
2566
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2567
|
+
* @param {int} [params.until] timestamp in ms of the latest transaction entry
|
|
2568
|
+
* @param {int} [params.end] timestamp in seconds of the latest transaction entry
|
|
2553
2569
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2554
2570
|
*/
|
|
2555
2571
|
// https://www.kraken.com/en-us/help/api#deposit-status
|
|
@@ -2560,7 +2576,14 @@ class kraken extends kraken$1 {
|
|
|
2560
2576
|
request['asset'] = currency['id'];
|
|
2561
2577
|
}
|
|
2562
2578
|
if (since !== undefined) {
|
|
2563
|
-
|
|
2579
|
+
const sinceString = this.numberToString(since);
|
|
2580
|
+
request['start'] = Precise["default"].stringDiv(sinceString, '1000');
|
|
2581
|
+
}
|
|
2582
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2583
|
+
if (until !== undefined) {
|
|
2584
|
+
params = this.omit(params, ['until', 'till']);
|
|
2585
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
2586
|
+
request['end'] = Precise["default"].stringAdd(untilDivided, '1');
|
|
2564
2587
|
}
|
|
2565
2588
|
const response = await this.privatePostDepositStatus(this.extend(request, params));
|
|
2566
2589
|
//
|
|
@@ -2611,8 +2634,9 @@ class kraken extends kraken$1 {
|
|
|
2611
2634
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2612
2635
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
2613
2636
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2614
|
-
* @param {
|
|
2615
|
-
* @param {
|
|
2637
|
+
* @param {int} [params.until] timestamp in ms of the latest transaction entry
|
|
2638
|
+
* @param {int} [params.end] timestamp in seconds of the latest transaction entry
|
|
2639
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2616
2640
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2617
2641
|
*/
|
|
2618
2642
|
await this.loadMarkets();
|
|
@@ -2628,7 +2652,14 @@ class kraken extends kraken$1 {
|
|
|
2628
2652
|
request['asset'] = currency['id'];
|
|
2629
2653
|
}
|
|
2630
2654
|
if (since !== undefined) {
|
|
2631
|
-
|
|
2655
|
+
const sinceString = this.numberToString(since);
|
|
2656
|
+
request['start'] = Precise["default"].stringDiv(sinceString, '1000');
|
|
2657
|
+
}
|
|
2658
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2659
|
+
if (until !== undefined) {
|
|
2660
|
+
params = this.omit(params, ['until', 'till']);
|
|
2661
|
+
const untilDivided = Precise["default"].stringDiv(until, '1000');
|
|
2662
|
+
request['end'] = Precise["default"].stringAdd(untilDivided, '1');
|
|
2632
2663
|
}
|
|
2633
2664
|
const response = await this.privatePostWithdrawStatus(this.extend(request, params));
|
|
2634
2665
|
//
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -395,6 +395,7 @@ class kucoin extends kucoin$1 {
|
|
|
395
395
|
'broker/nd/account': 2,
|
|
396
396
|
'broker/nd/account/apikey': 2,
|
|
397
397
|
'broker/nd/rebase/download': 3,
|
|
398
|
+
'asset/ndbroker/deposit/list': 1,
|
|
398
399
|
'broker/nd/transfer/detail': 1,
|
|
399
400
|
'broker/nd/deposit/detail': 1,
|
|
400
401
|
'broker/nd/withdraw/detail': 1,
|
|
@@ -686,6 +687,7 @@ class kucoin extends kucoin$1 {
|
|
|
686
687
|
'purchase/orders': 'v3',
|
|
687
688
|
'margin/symbols': 'v3',
|
|
688
689
|
'affiliate/inviter/statistics': 'v2',
|
|
690
|
+
'asset/ndbroker/deposit/list': 'v1',
|
|
689
691
|
},
|
|
690
692
|
'POST': {
|
|
691
693
|
// account
|
|
@@ -131,6 +131,19 @@ class bitget extends bitget$1 {
|
|
|
131
131
|
};
|
|
132
132
|
return await this.watchPublic(messageHash, args, params);
|
|
133
133
|
}
|
|
134
|
+
async unWatchTicker(symbol, params = {}) {
|
|
135
|
+
/**
|
|
136
|
+
* @method
|
|
137
|
+
* @name bitget#unWatchTicker
|
|
138
|
+
* @description unsubscribe from the ticker channel
|
|
139
|
+
* @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
|
|
140
|
+
* @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
|
|
141
|
+
* @param {string} symbol unified symbol of the market to unwatch the ticker for
|
|
142
|
+
* @returns {any} status of the unwatch request
|
|
143
|
+
*/
|
|
144
|
+
await this.loadMarkets();
|
|
145
|
+
return await this.unWatchChannel(symbol, 'ticker', 'ticker', params);
|
|
146
|
+
}
|
|
134
147
|
async watchTickers(symbols = undefined, params = {}) {
|
|
135
148
|
/**
|
|
136
149
|
* @method
|
|
@@ -343,6 +356,22 @@ class bitget extends bitget$1 {
|
|
|
343
356
|
}
|
|
344
357
|
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
345
358
|
}
|
|
359
|
+
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
360
|
+
/**
|
|
361
|
+
* @method
|
|
362
|
+
* @name bitget#unWatchOHLCV
|
|
363
|
+
* @description unsubscribe from the ohlcv channel
|
|
364
|
+
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
365
|
+
* @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
|
366
|
+
* @param {string} symbol unified symbol of the market to unwatch the ohlcv for
|
|
367
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
368
|
+
*/
|
|
369
|
+
await this.loadMarkets();
|
|
370
|
+
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
371
|
+
const interval = this.safeString(timeframes, timeframe);
|
|
372
|
+
const channel = 'candle' + interval;
|
|
373
|
+
return await this.unWatchChannel(symbol, channel, 'candles:' + timeframe, params);
|
|
374
|
+
}
|
|
346
375
|
handleOHLCV(client, message) {
|
|
347
376
|
//
|
|
348
377
|
// {
|
|
@@ -451,14 +480,18 @@ class bitget extends bitget$1 {
|
|
|
451
480
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
452
481
|
*/
|
|
453
482
|
await this.loadMarkets();
|
|
454
|
-
const market = this.market(symbol);
|
|
455
|
-
const messageHash = 'unsubscribe:orderbook:' + market['symbol'];
|
|
456
483
|
let channel = 'books';
|
|
457
484
|
const limit = this.safeInteger(params, 'limit');
|
|
458
485
|
if ((limit === 1) || (limit === 5) || (limit === 15)) {
|
|
459
486
|
params = this.omit(params, 'limit');
|
|
460
487
|
channel += limit.toString();
|
|
461
488
|
}
|
|
489
|
+
return await this.unWatchChannel(symbol, channel, 'orderbook', params);
|
|
490
|
+
}
|
|
491
|
+
async unWatchChannel(symbol, channel, messageHashTopic, params = {}) {
|
|
492
|
+
await this.loadMarkets();
|
|
493
|
+
const market = this.market(symbol);
|
|
494
|
+
const messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol'];
|
|
462
495
|
let instType = undefined;
|
|
463
496
|
[instType, params] = this.getInstType(market, params);
|
|
464
497
|
const args = {
|
|
@@ -682,6 +715,19 @@ class bitget extends bitget$1 {
|
|
|
682
715
|
}
|
|
683
716
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
684
717
|
}
|
|
718
|
+
async unWatchTrades(symbol, params = {}) {
|
|
719
|
+
/**
|
|
720
|
+
* @method
|
|
721
|
+
* @name bitget#unWatchTrades
|
|
722
|
+
* @description unsubscribe from the trades channel
|
|
723
|
+
* @see https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel
|
|
724
|
+
* @see https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel
|
|
725
|
+
* @param {string} symbol unified symbol of the market to unwatch the trades for
|
|
726
|
+
* @returns {any} status of the unwatch request
|
|
727
|
+
*/
|
|
728
|
+
await this.loadMarkets();
|
|
729
|
+
return await this.unWatchChannel(symbol, 'trade', 'trade', params);
|
|
730
|
+
}
|
|
685
731
|
handleTrades(client, message) {
|
|
686
732
|
//
|
|
687
733
|
// {
|
|
@@ -1868,6 +1914,112 @@ class bitget extends bitget$1 {
|
|
|
1868
1914
|
//
|
|
1869
1915
|
return message;
|
|
1870
1916
|
}
|
|
1917
|
+
handleOrderBookUnSubscription(client, message) {
|
|
1918
|
+
//
|
|
1919
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"books","instId":"BTCUSDT"}}
|
|
1920
|
+
//
|
|
1921
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1922
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1923
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1924
|
+
const instId = this.safeString(arg, 'instId');
|
|
1925
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
1926
|
+
const symbol = market['symbol'];
|
|
1927
|
+
const messageHash = 'unsubscribe:orderbook:' + market['symbol'];
|
|
1928
|
+
const subMessageHash = 'orderbook:' + symbol;
|
|
1929
|
+
if (symbol in this.orderbooks) {
|
|
1930
|
+
delete this.orderbooks[symbol];
|
|
1931
|
+
}
|
|
1932
|
+
if (subMessageHash in client.subscriptions) {
|
|
1933
|
+
delete client.subscriptions[subMessageHash];
|
|
1934
|
+
}
|
|
1935
|
+
if (messageHash in client.subscriptions) {
|
|
1936
|
+
delete client.subscriptions[messageHash];
|
|
1937
|
+
}
|
|
1938
|
+
const error = new errors.UnsubscribeError(this.id + 'orderbook ' + symbol);
|
|
1939
|
+
client.reject(error, subMessageHash);
|
|
1940
|
+
client.resolve(true, messageHash);
|
|
1941
|
+
}
|
|
1942
|
+
handleTradesUnSubscription(client, message) {
|
|
1943
|
+
//
|
|
1944
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"trade","instId":"BTCUSDT"}}
|
|
1945
|
+
//
|
|
1946
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1947
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1948
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1949
|
+
const instId = this.safeString(arg, 'instId');
|
|
1950
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
1951
|
+
const symbol = market['symbol'];
|
|
1952
|
+
const messageHash = 'unsubscribe:trade:' + market['symbol'];
|
|
1953
|
+
const subMessageHash = 'trade:' + symbol;
|
|
1954
|
+
if (symbol in this.trades) {
|
|
1955
|
+
delete this.trades[symbol];
|
|
1956
|
+
}
|
|
1957
|
+
if (subMessageHash in client.subscriptions) {
|
|
1958
|
+
delete client.subscriptions[subMessageHash];
|
|
1959
|
+
}
|
|
1960
|
+
if (messageHash in client.subscriptions) {
|
|
1961
|
+
delete client.subscriptions[messageHash];
|
|
1962
|
+
}
|
|
1963
|
+
const error = new errors.UnsubscribeError(this.id + 'trades ' + symbol);
|
|
1964
|
+
client.reject(error, subMessageHash);
|
|
1965
|
+
client.resolve(true, messageHash);
|
|
1966
|
+
}
|
|
1967
|
+
handleTickerUnSubscription(client, message) {
|
|
1968
|
+
//
|
|
1969
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"trade","instId":"BTCUSDT"}}
|
|
1970
|
+
//
|
|
1971
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1972
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1973
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1974
|
+
const instId = this.safeString(arg, 'instId');
|
|
1975
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
1976
|
+
const symbol = market['symbol'];
|
|
1977
|
+
const messageHash = 'unsubscribe:ticker:' + market['symbol'];
|
|
1978
|
+
const subMessageHash = 'ticker:' + symbol;
|
|
1979
|
+
if (symbol in this.tickers) {
|
|
1980
|
+
delete this.tickers[symbol];
|
|
1981
|
+
}
|
|
1982
|
+
if (subMessageHash in client.subscriptions) {
|
|
1983
|
+
delete client.subscriptions[subMessageHash];
|
|
1984
|
+
}
|
|
1985
|
+
if (messageHash in client.subscriptions) {
|
|
1986
|
+
delete client.subscriptions[messageHash];
|
|
1987
|
+
}
|
|
1988
|
+
const error = new errors.UnsubscribeError(this.id + 'ticker ' + symbol);
|
|
1989
|
+
client.reject(error, subMessageHash);
|
|
1990
|
+
client.resolve(true, messageHash);
|
|
1991
|
+
}
|
|
1992
|
+
handleOHLCVUnSubscription(client, message) {
|
|
1993
|
+
//
|
|
1994
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
|
1995
|
+
//
|
|
1996
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1997
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1998
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1999
|
+
const instId = this.safeString(arg, 'instId');
|
|
2000
|
+
const channel = this.safeString(arg, 'channel');
|
|
2001
|
+
const interval = channel.replace('candle', '');
|
|
2002
|
+
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
2003
|
+
const timeframe = this.findTimeframe(interval, timeframes);
|
|
2004
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2005
|
+
const symbol = market['symbol'];
|
|
2006
|
+
const messageHash = 'unsubscribe:candles:' + timeframe + ':' + market['symbol'];
|
|
2007
|
+
const subMessageHash = 'candles:' + timeframe + ':' + symbol;
|
|
2008
|
+
if (symbol in this.ohlcvs) {
|
|
2009
|
+
if (timeframe in this.ohlcvs[symbol]) {
|
|
2010
|
+
delete this.ohlcvs[symbol][timeframe];
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
if (subMessageHash in client.subscriptions) {
|
|
2014
|
+
delete client.subscriptions[subMessageHash];
|
|
2015
|
+
}
|
|
2016
|
+
if (messageHash in client.subscriptions) {
|
|
2017
|
+
delete client.subscriptions[messageHash];
|
|
2018
|
+
}
|
|
2019
|
+
const error = new errors.UnsubscribeError(this.id + ' ohlcv ' + timeframe + ' ' + symbol);
|
|
2020
|
+
client.reject(error, subMessageHash);
|
|
2021
|
+
client.resolve(true, messageHash);
|
|
2022
|
+
}
|
|
1871
2023
|
handleUnSubscriptionStatus(client, message) {
|
|
1872
2024
|
//
|
|
1873
2025
|
// {
|
|
@@ -1897,23 +2049,16 @@ class bitget extends bitget$1 {
|
|
|
1897
2049
|
const channel = this.safeString(arg, 'channel');
|
|
1898
2050
|
if (channel === 'books') {
|
|
1899
2051
|
// for now only unWatchOrderBook is supporteod
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
if (subMessageHash in client.subscriptions) {
|
|
1911
|
-
delete client.subscriptions[subMessageHash];
|
|
1912
|
-
}
|
|
1913
|
-
if (messageHash in client.subscriptions) {
|
|
1914
|
-
delete client.subscriptions[messageHash];
|
|
1915
|
-
}
|
|
1916
|
-
client.resolve(true, messageHash);
|
|
2052
|
+
this.handleOrderBookUnSubscription(client, message);
|
|
2053
|
+
}
|
|
2054
|
+
else if (channel === 'trade') {
|
|
2055
|
+
this.handleTradesUnSubscription(client, message);
|
|
2056
|
+
}
|
|
2057
|
+
else if (channel === 'ticker') {
|
|
2058
|
+
this.handleTickerUnSubscription(client, message);
|
|
2059
|
+
}
|
|
2060
|
+
else if (channel.startsWith('candle')) {
|
|
2061
|
+
this.handleOHLCVUnSubscription(client, message);
|
|
1917
2062
|
}
|
|
1918
2063
|
}
|
|
1919
2064
|
return message;
|
package/dist/cjs/src/pro/cex.js
CHANGED
package/dist/cjs/src/pro/htx.js
CHANGED
|
@@ -22,6 +22,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
22
22
|
'watchTicker': false,
|
|
23
23
|
'watchTickers': true,
|
|
24
24
|
'watchTrades': true,
|
|
25
|
+
'watchTradesForSymbols': false,
|
|
25
26
|
'watchPosition': false,
|
|
26
27
|
},
|
|
27
28
|
'urls': {
|
|
@@ -137,6 +138,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
137
138
|
* @method
|
|
138
139
|
* @name hyperliquid#watchOrderBook
|
|
139
140
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
141
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
140
142
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
141
143
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
142
144
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -210,6 +212,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
210
212
|
* @method
|
|
211
213
|
* @name hyperliquid#watchTickers
|
|
212
214
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
215
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
213
216
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
214
217
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
215
218
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -236,6 +239,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
236
239
|
* @method
|
|
237
240
|
* @name hyperliquid#watchMyTrades
|
|
238
241
|
* @description watches information on multiple trades made by the user
|
|
242
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
239
243
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
240
244
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
241
245
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -403,6 +407,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
403
407
|
* @method
|
|
404
408
|
* @name hyperliquid#watchTrades
|
|
405
409
|
* @description watches information on multiple trades made in a market
|
|
410
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
406
411
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
407
412
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
408
413
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -533,6 +538,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
533
538
|
* @method
|
|
534
539
|
* @name hyperliquid#watchOHLCV
|
|
535
540
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
541
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
536
542
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
537
543
|
* @param {string} timeframe the length of time each candle represents
|
|
538
544
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -618,6 +624,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
618
624
|
* @method
|
|
619
625
|
* @name hyperliquid#watchOrders
|
|
620
626
|
* @description watches information on multiple orders made by the user
|
|
627
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
621
628
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
622
629
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
623
630
|
* @param {int} [limit] the maximum number of order structures to retrieve
|