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/js/src/coinex.d.ts
CHANGED
|
@@ -157,7 +157,7 @@ export default class coinex extends Exchange {
|
|
|
157
157
|
parseDepositWithdrawFee(fee: any, currency?: Currency): Dict;
|
|
158
158
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
159
159
|
parseLeverage(leverage: Dict, market?: Market): Leverage;
|
|
160
|
-
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position>;
|
|
160
|
+
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
161
161
|
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
|
162
162
|
nonce(): number;
|
|
163
163
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/hashkey.js
CHANGED
|
@@ -25,7 +25,6 @@ export default class hashkey extends Exchange {
|
|
|
25
25
|
'version': 'v1',
|
|
26
26
|
'certified': true,
|
|
27
27
|
'pro': true,
|
|
28
|
-
'hostname': '/api-glb',
|
|
29
28
|
'has': {
|
|
30
29
|
'CORS': undefined,
|
|
31
30
|
'spot': true,
|
|
@@ -146,7 +145,7 @@ export default class hashkey extends Exchange {
|
|
|
146
145
|
'www': 'https://global.hashkey.com/',
|
|
147
146
|
'doc': 'https://hashkeyglobal-apidoc.readme.io/',
|
|
148
147
|
'fees': 'https://support.global.hashkey.com/hc/en-us/articles/13199900083612-HashKey-Global-Fee-Structure',
|
|
149
|
-
'referral': '',
|
|
148
|
+
'referral': 'https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN',
|
|
150
149
|
},
|
|
151
150
|
'api': {
|
|
152
151
|
'public': {
|
|
@@ -2386,7 +2385,7 @@ export default class hashkey extends Exchange {
|
|
|
2386
2385
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2387
2386
|
/**
|
|
2388
2387
|
* @method
|
|
2389
|
-
* @name createMarketBuyOrderWithCost
|
|
2388
|
+
* @name hashkey#createMarketBuyOrderWithCost
|
|
2390
2389
|
* @description create a market buy order by providing the symbol and cost
|
|
2391
2390
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2392
2391
|
* @param {float} cost how much you want to trade in units of the quote currency
|
|
@@ -4175,7 +4174,7 @@ export default class hashkey extends Exchange {
|
|
|
4175
4174
|
async fetchTradingFees(params = {}) {
|
|
4176
4175
|
/**
|
|
4177
4176
|
* @method
|
|
4178
|
-
* @name
|
|
4177
|
+
* @name hashkey#fetchTradingFees
|
|
4179
4178
|
* @description *for spot markets only* fetch the trading fees for multiple markets
|
|
4180
4179
|
* @see https://developers.binance.com/docs/wallet/asset/trade-fee
|
|
4181
4180
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/kraken.js
CHANGED
|
@@ -1112,11 +1112,12 @@ export default class kraken extends Exchange {
|
|
|
1112
1112
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
1113
1113
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1114
1114
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
1115
|
+
* @param {int} [params.end] timestamp in seconds of the latest ledger entry
|
|
1115
1116
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
1116
1117
|
*/
|
|
1117
1118
|
// https://www.kraken.com/features/api#get-ledgers-info
|
|
1118
1119
|
await this.loadMarkets();
|
|
1119
|
-
|
|
1120
|
+
const request = {};
|
|
1120
1121
|
let currency = undefined;
|
|
1121
1122
|
if (code !== undefined) {
|
|
1122
1123
|
currency = this.currency(code);
|
|
@@ -1125,7 +1126,12 @@ export default class kraken extends Exchange {
|
|
|
1125
1126
|
if (since !== undefined) {
|
|
1126
1127
|
request['start'] = this.parseToInt(since / 1000);
|
|
1127
1128
|
}
|
|
1128
|
-
|
|
1129
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
1130
|
+
if (until !== undefined) {
|
|
1131
|
+
params = this.omit(params, ['until', 'till']);
|
|
1132
|
+
const untilDivided = Precise.stringDiv(until, '1000');
|
|
1133
|
+
request['end'] = this.parseToInt(Precise.stringAdd(untilDivided, '1'));
|
|
1134
|
+
}
|
|
1129
1135
|
const response = await this.privatePostLedgers(this.extend(request, params));
|
|
1130
1136
|
// { error: [],
|
|
1131
1137
|
// "result": { ledger: { 'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
|
|
@@ -2125,6 +2131,8 @@ export default class kraken extends Exchange {
|
|
|
2125
2131
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2126
2132
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
2127
2133
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2134
|
+
* @param {int} [params.until] timestamp in ms of the latest trade entry
|
|
2135
|
+
* @param {int} [params.end] timestamp in seconds of the latest trade entry
|
|
2128
2136
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
2129
2137
|
*/
|
|
2130
2138
|
await this.loadMarkets();
|
|
@@ -2138,6 +2146,12 @@ export default class kraken extends Exchange {
|
|
|
2138
2146
|
if (since !== undefined) {
|
|
2139
2147
|
request['start'] = this.parseToInt(since / 1000);
|
|
2140
2148
|
}
|
|
2149
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2150
|
+
if (until !== undefined) {
|
|
2151
|
+
params = this.omit(params, ['until', 'till']);
|
|
2152
|
+
const untilDivided = Precise.stringDiv(until, '1000');
|
|
2153
|
+
request['end'] = this.parseToInt(Precise.stringAdd(untilDivided, '1'));
|
|
2154
|
+
}
|
|
2141
2155
|
const response = await this.privatePostTradesHistory(this.extend(request, params));
|
|
2142
2156
|
//
|
|
2143
2157
|
// {
|
|
@@ -2553,6 +2567,8 @@ export default class kraken extends Exchange {
|
|
|
2553
2567
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
2554
2568
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
2555
2569
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2570
|
+
* @param {int} [params.until] timestamp in ms of the latest transaction entry
|
|
2571
|
+
* @param {int} [params.end] timestamp in seconds of the latest transaction entry
|
|
2556
2572
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2557
2573
|
*/
|
|
2558
2574
|
// https://www.kraken.com/en-us/help/api#deposit-status
|
|
@@ -2563,7 +2579,14 @@ export default class kraken extends Exchange {
|
|
|
2563
2579
|
request['asset'] = currency['id'];
|
|
2564
2580
|
}
|
|
2565
2581
|
if (since !== undefined) {
|
|
2566
|
-
|
|
2582
|
+
const sinceString = this.numberToString(since);
|
|
2583
|
+
request['start'] = Precise.stringDiv(sinceString, '1000');
|
|
2584
|
+
}
|
|
2585
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2586
|
+
if (until !== undefined) {
|
|
2587
|
+
params = this.omit(params, ['until', 'till']);
|
|
2588
|
+
const untilDivided = Precise.stringDiv(until, '1000');
|
|
2589
|
+
request['end'] = Precise.stringAdd(untilDivided, '1');
|
|
2567
2590
|
}
|
|
2568
2591
|
const response = await this.privatePostDepositStatus(this.extend(request, params));
|
|
2569
2592
|
//
|
|
@@ -2614,8 +2637,9 @@ export default class kraken extends Exchange {
|
|
|
2614
2637
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2615
2638
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
2616
2639
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2617
|
-
* @param {
|
|
2618
|
-
* @param {
|
|
2640
|
+
* @param {int} [params.until] timestamp in ms of the latest transaction entry
|
|
2641
|
+
* @param {int} [params.end] timestamp in seconds of the latest transaction entry
|
|
2642
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2619
2643
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2620
2644
|
*/
|
|
2621
2645
|
await this.loadMarkets();
|
|
@@ -2631,7 +2655,14 @@ export default class kraken extends Exchange {
|
|
|
2631
2655
|
request['asset'] = currency['id'];
|
|
2632
2656
|
}
|
|
2633
2657
|
if (since !== undefined) {
|
|
2634
|
-
|
|
2658
|
+
const sinceString = this.numberToString(since);
|
|
2659
|
+
request['start'] = Precise.stringDiv(sinceString, '1000');
|
|
2660
|
+
}
|
|
2661
|
+
const until = this.safeStringN(params, ['until', 'till']);
|
|
2662
|
+
if (until !== undefined) {
|
|
2663
|
+
params = this.omit(params, ['until', 'till']);
|
|
2664
|
+
const untilDivided = Precise.stringDiv(until, '1000');
|
|
2665
|
+
request['end'] = Precise.stringAdd(untilDivided, '1');
|
|
2635
2666
|
}
|
|
2636
2667
|
const response = await this.privatePostWithdrawStatus(this.extend(request, params));
|
|
2637
2668
|
//
|
package/js/src/kucoin.js
CHANGED
|
@@ -398,6 +398,7 @@ export default class kucoin extends Exchange {
|
|
|
398
398
|
'broker/nd/account': 2,
|
|
399
399
|
'broker/nd/account/apikey': 2,
|
|
400
400
|
'broker/nd/rebase/download': 3,
|
|
401
|
+
'asset/ndbroker/deposit/list': 1,
|
|
401
402
|
'broker/nd/transfer/detail': 1,
|
|
402
403
|
'broker/nd/deposit/detail': 1,
|
|
403
404
|
'broker/nd/withdraw/detail': 1,
|
|
@@ -689,6 +690,7 @@ export default class kucoin extends Exchange {
|
|
|
689
690
|
'purchase/orders': 'v3',
|
|
690
691
|
'margin/symbols': 'v3',
|
|
691
692
|
'affiliate/inviter/statistics': 'v2',
|
|
693
|
+
'asset/ndbroker/deposit/list': 'v1',
|
|
692
694
|
},
|
|
693
695
|
'POST': {
|
|
694
696
|
// account
|
package/js/src/pro/bitfinex.js
CHANGED
package/js/src/pro/bitfinex2.js
CHANGED
package/js/src/pro/bitget.d.ts
CHANGED
|
@@ -10,14 +10,17 @@ export default class bitget extends bitgetRest {
|
|
|
10
10
|
describe(): any;
|
|
11
11
|
getInstType(market: any, params?: {}): any[];
|
|
12
12
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
13
|
+
unWatchTicker(symbol: string, params?: {}): Promise<any>;
|
|
13
14
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
14
15
|
handleTicker(client: Client, message: any): void;
|
|
15
16
|
parseWsTicker(message: any, market?: any): Ticker;
|
|
16
17
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
18
|
+
unWatchOHLCV(symbol: string, timeframe?: string, params?: {}): Promise<any>;
|
|
17
19
|
handleOHLCV(client: Client, message: any): void;
|
|
18
20
|
parseWsOHLCV(ohlcv: any, market?: any): OHLCV;
|
|
19
21
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
20
22
|
unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
|
|
23
|
+
unWatchChannel(symbol: string, channel: string, messageHashTopic: string, params?: {}): Promise<any>;
|
|
21
24
|
watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
|
|
22
25
|
handleOrderBook(client: Client, message: any): void;
|
|
23
26
|
handleCheckSumError(client: Client, symbol: string, messageHash: string): Promise<void>;
|
|
@@ -25,6 +28,7 @@ export default class bitget extends bitgetRest {
|
|
|
25
28
|
handleDeltas(bookside: any, deltas: any): void;
|
|
26
29
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
27
30
|
watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
31
|
+
unWatchTrades(symbol: string, params?: {}): Promise<any>;
|
|
28
32
|
handleTrades(client: Client, message: any): void;
|
|
29
33
|
parseWsTrade(trade: any, market?: any): Trade;
|
|
30
34
|
watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
@@ -49,5 +53,9 @@ export default class bitget extends bitgetRest {
|
|
|
49
53
|
ping(client: Client): string;
|
|
50
54
|
handlePong(client: Client, message: any): any;
|
|
51
55
|
handleSubscriptionStatus(client: Client, message: any): any;
|
|
56
|
+
handleOrderBookUnSubscription(client: Client, message: any): void;
|
|
57
|
+
handleTradesUnSubscription(client: Client, message: any): void;
|
|
58
|
+
handleTickerUnSubscription(client: Client, message: any): void;
|
|
59
|
+
handleOHLCVUnSubscription(client: Client, message: any): void;
|
|
52
60
|
handleUnSubscriptionStatus(client: Client, message: any): any;
|
|
53
61
|
}
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import bitgetRest from '../bitget.js';
|
|
9
|
-
import { AuthenticationError, BadRequest, ArgumentsRequired, ChecksumError, ExchangeError, RateLimitExceeded } from '../base/errors.js';
|
|
9
|
+
import { AuthenticationError, BadRequest, ArgumentsRequired, ChecksumError, ExchangeError, RateLimitExceeded, UnsubscribeError } from '../base/errors.js';
|
|
10
10
|
import { Precise } from '../base/Precise.js';
|
|
11
11
|
import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
|
|
12
12
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
@@ -134,6 +134,19 @@ export default class bitget extends bitgetRest {
|
|
|
134
134
|
};
|
|
135
135
|
return await this.watchPublic(messageHash, args, params);
|
|
136
136
|
}
|
|
137
|
+
async unWatchTicker(symbol, params = {}) {
|
|
138
|
+
/**
|
|
139
|
+
* @method
|
|
140
|
+
* @name bitget#unWatchTicker
|
|
141
|
+
* @description unsubscribe from the ticker channel
|
|
142
|
+
* @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
|
|
143
|
+
* @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
|
|
144
|
+
* @param {string} symbol unified symbol of the market to unwatch the ticker for
|
|
145
|
+
* @returns {any} status of the unwatch request
|
|
146
|
+
*/
|
|
147
|
+
await this.loadMarkets();
|
|
148
|
+
return await this.unWatchChannel(symbol, 'ticker', 'ticker', params);
|
|
149
|
+
}
|
|
137
150
|
async watchTickers(symbols = undefined, params = {}) {
|
|
138
151
|
/**
|
|
139
152
|
* @method
|
|
@@ -346,6 +359,22 @@ export default class bitget extends bitgetRest {
|
|
|
346
359
|
}
|
|
347
360
|
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
348
361
|
}
|
|
362
|
+
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
363
|
+
/**
|
|
364
|
+
* @method
|
|
365
|
+
* @name bitget#unWatchOHLCV
|
|
366
|
+
* @description unsubscribe from the ohlcv channel
|
|
367
|
+
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
368
|
+
* @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
|
369
|
+
* @param {string} symbol unified symbol of the market to unwatch the ohlcv for
|
|
370
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
371
|
+
*/
|
|
372
|
+
await this.loadMarkets();
|
|
373
|
+
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
374
|
+
const interval = this.safeString(timeframes, timeframe);
|
|
375
|
+
const channel = 'candle' + interval;
|
|
376
|
+
return await this.unWatchChannel(symbol, channel, 'candles:' + timeframe, params);
|
|
377
|
+
}
|
|
349
378
|
handleOHLCV(client, message) {
|
|
350
379
|
//
|
|
351
380
|
// {
|
|
@@ -454,14 +483,18 @@ export default class bitget extends bitgetRest {
|
|
|
454
483
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
455
484
|
*/
|
|
456
485
|
await this.loadMarkets();
|
|
457
|
-
const market = this.market(symbol);
|
|
458
|
-
const messageHash = 'unsubscribe:orderbook:' + market['symbol'];
|
|
459
486
|
let channel = 'books';
|
|
460
487
|
const limit = this.safeInteger(params, 'limit');
|
|
461
488
|
if ((limit === 1) || (limit === 5) || (limit === 15)) {
|
|
462
489
|
params = this.omit(params, 'limit');
|
|
463
490
|
channel += limit.toString();
|
|
464
491
|
}
|
|
492
|
+
return await this.unWatchChannel(symbol, channel, 'orderbook', params);
|
|
493
|
+
}
|
|
494
|
+
async unWatchChannel(symbol, channel, messageHashTopic, params = {}) {
|
|
495
|
+
await this.loadMarkets();
|
|
496
|
+
const market = this.market(symbol);
|
|
497
|
+
const messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol'];
|
|
465
498
|
let instType = undefined;
|
|
466
499
|
[instType, params] = this.getInstType(market, params);
|
|
467
500
|
const args = {
|
|
@@ -685,6 +718,19 @@ export default class bitget extends bitgetRest {
|
|
|
685
718
|
}
|
|
686
719
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
687
720
|
}
|
|
721
|
+
async unWatchTrades(symbol, params = {}) {
|
|
722
|
+
/**
|
|
723
|
+
* @method
|
|
724
|
+
* @name bitget#unWatchTrades
|
|
725
|
+
* @description unsubscribe from the trades channel
|
|
726
|
+
* @see https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel
|
|
727
|
+
* @see https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel
|
|
728
|
+
* @param {string} symbol unified symbol of the market to unwatch the trades for
|
|
729
|
+
* @returns {any} status of the unwatch request
|
|
730
|
+
*/
|
|
731
|
+
await this.loadMarkets();
|
|
732
|
+
return await this.unWatchChannel(symbol, 'trade', 'trade', params);
|
|
733
|
+
}
|
|
688
734
|
handleTrades(client, message) {
|
|
689
735
|
//
|
|
690
736
|
// {
|
|
@@ -1871,6 +1917,112 @@ export default class bitget extends bitgetRest {
|
|
|
1871
1917
|
//
|
|
1872
1918
|
return message;
|
|
1873
1919
|
}
|
|
1920
|
+
handleOrderBookUnSubscription(client, message) {
|
|
1921
|
+
//
|
|
1922
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"books","instId":"BTCUSDT"}}
|
|
1923
|
+
//
|
|
1924
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1925
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1926
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1927
|
+
const instId = this.safeString(arg, 'instId');
|
|
1928
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
1929
|
+
const symbol = market['symbol'];
|
|
1930
|
+
const messageHash = 'unsubscribe:orderbook:' + market['symbol'];
|
|
1931
|
+
const subMessageHash = 'orderbook:' + symbol;
|
|
1932
|
+
if (symbol in this.orderbooks) {
|
|
1933
|
+
delete this.orderbooks[symbol];
|
|
1934
|
+
}
|
|
1935
|
+
if (subMessageHash in client.subscriptions) {
|
|
1936
|
+
delete client.subscriptions[subMessageHash];
|
|
1937
|
+
}
|
|
1938
|
+
if (messageHash in client.subscriptions) {
|
|
1939
|
+
delete client.subscriptions[messageHash];
|
|
1940
|
+
}
|
|
1941
|
+
const error = new UnsubscribeError(this.id + 'orderbook ' + symbol);
|
|
1942
|
+
client.reject(error, subMessageHash);
|
|
1943
|
+
client.resolve(true, messageHash);
|
|
1944
|
+
}
|
|
1945
|
+
handleTradesUnSubscription(client, message) {
|
|
1946
|
+
//
|
|
1947
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"trade","instId":"BTCUSDT"}}
|
|
1948
|
+
//
|
|
1949
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1950
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1951
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1952
|
+
const instId = this.safeString(arg, 'instId');
|
|
1953
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
1954
|
+
const symbol = market['symbol'];
|
|
1955
|
+
const messageHash = 'unsubscribe:trade:' + market['symbol'];
|
|
1956
|
+
const subMessageHash = 'trade:' + symbol;
|
|
1957
|
+
if (symbol in this.trades) {
|
|
1958
|
+
delete this.trades[symbol];
|
|
1959
|
+
}
|
|
1960
|
+
if (subMessageHash in client.subscriptions) {
|
|
1961
|
+
delete client.subscriptions[subMessageHash];
|
|
1962
|
+
}
|
|
1963
|
+
if (messageHash in client.subscriptions) {
|
|
1964
|
+
delete client.subscriptions[messageHash];
|
|
1965
|
+
}
|
|
1966
|
+
const error = new UnsubscribeError(this.id + 'trades ' + symbol);
|
|
1967
|
+
client.reject(error, subMessageHash);
|
|
1968
|
+
client.resolve(true, messageHash);
|
|
1969
|
+
}
|
|
1970
|
+
handleTickerUnSubscription(client, message) {
|
|
1971
|
+
//
|
|
1972
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"trade","instId":"BTCUSDT"}}
|
|
1973
|
+
//
|
|
1974
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
1975
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1976
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
1977
|
+
const instId = this.safeString(arg, 'instId');
|
|
1978
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
1979
|
+
const symbol = market['symbol'];
|
|
1980
|
+
const messageHash = 'unsubscribe:ticker:' + market['symbol'];
|
|
1981
|
+
const subMessageHash = 'ticker:' + symbol;
|
|
1982
|
+
if (symbol in this.tickers) {
|
|
1983
|
+
delete this.tickers[symbol];
|
|
1984
|
+
}
|
|
1985
|
+
if (subMessageHash in client.subscriptions) {
|
|
1986
|
+
delete client.subscriptions[subMessageHash];
|
|
1987
|
+
}
|
|
1988
|
+
if (messageHash in client.subscriptions) {
|
|
1989
|
+
delete client.subscriptions[messageHash];
|
|
1990
|
+
}
|
|
1991
|
+
const error = new UnsubscribeError(this.id + 'ticker ' + symbol);
|
|
1992
|
+
client.reject(error, subMessageHash);
|
|
1993
|
+
client.resolve(true, messageHash);
|
|
1994
|
+
}
|
|
1995
|
+
handleOHLCVUnSubscription(client, message) {
|
|
1996
|
+
//
|
|
1997
|
+
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
|
1998
|
+
//
|
|
1999
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
2000
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
2001
|
+
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
2002
|
+
const instId = this.safeString(arg, 'instId');
|
|
2003
|
+
const channel = this.safeString(arg, 'channel');
|
|
2004
|
+
const interval = channel.replace('candle', '');
|
|
2005
|
+
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
2006
|
+
const timeframe = this.findTimeframe(interval, timeframes);
|
|
2007
|
+
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2008
|
+
const symbol = market['symbol'];
|
|
2009
|
+
const messageHash = 'unsubscribe:candles:' + timeframe + ':' + market['symbol'];
|
|
2010
|
+
const subMessageHash = 'candles:' + timeframe + ':' + symbol;
|
|
2011
|
+
if (symbol in this.ohlcvs) {
|
|
2012
|
+
if (timeframe in this.ohlcvs[symbol]) {
|
|
2013
|
+
delete this.ohlcvs[symbol][timeframe];
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
if (subMessageHash in client.subscriptions) {
|
|
2017
|
+
delete client.subscriptions[subMessageHash];
|
|
2018
|
+
}
|
|
2019
|
+
if (messageHash in client.subscriptions) {
|
|
2020
|
+
delete client.subscriptions[messageHash];
|
|
2021
|
+
}
|
|
2022
|
+
const error = new UnsubscribeError(this.id + ' ohlcv ' + timeframe + ' ' + symbol);
|
|
2023
|
+
client.reject(error, subMessageHash);
|
|
2024
|
+
client.resolve(true, messageHash);
|
|
2025
|
+
}
|
|
1874
2026
|
handleUnSubscriptionStatus(client, message) {
|
|
1875
2027
|
//
|
|
1876
2028
|
// {
|
|
@@ -1900,23 +2052,16 @@ export default class bitget extends bitgetRest {
|
|
|
1900
2052
|
const channel = this.safeString(arg, 'channel');
|
|
1901
2053
|
if (channel === 'books') {
|
|
1902
2054
|
// for now only unWatchOrderBook is supporteod
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
if (subMessageHash in client.subscriptions) {
|
|
1914
|
-
delete client.subscriptions[subMessageHash];
|
|
1915
|
-
}
|
|
1916
|
-
if (messageHash in client.subscriptions) {
|
|
1917
|
-
delete client.subscriptions[messageHash];
|
|
1918
|
-
}
|
|
1919
|
-
client.resolve(true, messageHash);
|
|
2055
|
+
this.handleOrderBookUnSubscription(client, message);
|
|
2056
|
+
}
|
|
2057
|
+
else if (channel === 'trade') {
|
|
2058
|
+
this.handleTradesUnSubscription(client, message);
|
|
2059
|
+
}
|
|
2060
|
+
else if (channel === 'ticker') {
|
|
2061
|
+
this.handleTickerUnSubscription(client, message);
|
|
2062
|
+
}
|
|
2063
|
+
else if (channel.startsWith('candle')) {
|
|
2064
|
+
this.handleOHLCVUnSubscription(client, message);
|
|
1920
2065
|
}
|
|
1921
2066
|
}
|
|
1922
2067
|
return message;
|
package/js/src/pro/bitopro.js
CHANGED
package/js/src/pro/bitstamp.js
CHANGED
package/js/src/pro/cex.js
CHANGED
package/js/src/pro/coincheck.js
CHANGED
package/js/src/pro/coinone.js
CHANGED
package/js/src/pro/hashkey.js
CHANGED
package/js/src/pro/hitbtc.js
CHANGED
package/js/src/pro/hollaex.js
CHANGED
package/js/src/pro/htx.js
CHANGED
package/js/src/pro/huobijp.js
CHANGED
|
@@ -25,6 +25,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
25
25
|
'watchTicker': false,
|
|
26
26
|
'watchTickers': true,
|
|
27
27
|
'watchTrades': true,
|
|
28
|
+
'watchTradesForSymbols': false,
|
|
28
29
|
'watchPosition': false,
|
|
29
30
|
},
|
|
30
31
|
'urls': {
|
|
@@ -140,6 +141,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
140
141
|
* @method
|
|
141
142
|
* @name hyperliquid#watchOrderBook
|
|
142
143
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
144
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
143
145
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
144
146
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
145
147
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -213,6 +215,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
213
215
|
* @method
|
|
214
216
|
* @name hyperliquid#watchTickers
|
|
215
217
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
218
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
216
219
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
217
220
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
218
221
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -239,6 +242,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
239
242
|
* @method
|
|
240
243
|
* @name hyperliquid#watchMyTrades
|
|
241
244
|
* @description watches information on multiple trades made by the user
|
|
245
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
242
246
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
243
247
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
244
248
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -406,6 +410,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
406
410
|
* @method
|
|
407
411
|
* @name hyperliquid#watchTrades
|
|
408
412
|
* @description watches information on multiple trades made in a market
|
|
413
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
409
414
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
410
415
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
411
416
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -536,6 +541,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
536
541
|
* @method
|
|
537
542
|
* @name hyperliquid#watchOHLCV
|
|
538
543
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
544
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
539
545
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
540
546
|
* @param {string} timeframe the length of time each candle represents
|
|
541
547
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -621,6 +627,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
621
627
|
* @method
|
|
622
628
|
* @name hyperliquid#watchOrders
|
|
623
629
|
* @description watches information on multiple orders made by the user
|
|
630
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
624
631
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
625
632
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
626
633
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
package/js/src/pro/lbank.js
CHANGED
package/js/src/pro/luno.js
CHANGED