ccxt 4.5.22 → 4.5.23
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 +2 -2
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/bullish.js +11 -0
- package/dist/cjs/src/base/Exchange.js +3 -2
- package/dist/cjs/src/base/ws/WsClient.js +15 -0
- package/dist/cjs/src/binance.js +159 -36
- package/dist/cjs/src/bingx.js +2 -1
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bullish.js +2919 -0
- package/dist/cjs/src/bybit.js +34 -37
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/hyperliquid.js +115 -12
- package/dist/cjs/src/kucoin.js +22 -3
- package/dist/cjs/src/mexc.js +7 -0
- package/dist/cjs/src/okx.js +117 -63
- package/dist/cjs/src/paradex.js +78 -3
- package/dist/cjs/src/pro/binance.js +131 -29
- package/dist/cjs/src/pro/bullish.js +781 -0
- package/dist/cjs/src/pro/coinbase.js +2 -2
- package/dist/cjs/src/pro/hyperliquid.js +75 -15
- package/dist/cjs/src/pro/upbit.js +28 -82
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/bullish.d.ts +65 -0
- package/js/src/abstract/bullish.js +5 -0
- package/js/src/abstract/kucoin.d.ts +15 -0
- package/js/src/abstract/kucoinfutures.d.ts +15 -0
- package/js/src/abstract/mexc.d.ts +7 -0
- package/js/src/abstract/myokx.d.ts +90 -39
- package/js/src/abstract/okx.d.ts +90 -39
- package/js/src/abstract/okxus.d.ts +90 -39
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +3 -2
- package/js/src/base/ws/Client.d.ts +1 -0
- package/js/src/base/ws/WsClient.js +15 -0
- package/js/src/binance.d.ts +14 -5
- package/js/src/binance.js +159 -36
- package/js/src/bingx.js +2 -1
- package/js/src/bitmart.js +1 -0
- package/js/src/bullish.d.ts +446 -0
- package/js/src/bullish.js +2912 -0
- package/js/src/bybit.js +34 -37
- package/js/src/gate.js +2 -2
- package/js/src/htx.js +4 -1
- package/js/src/hyperliquid.d.ts +24 -0
- package/js/src/hyperliquid.js +115 -12
- package/js/src/kucoin.js +22 -3
- package/js/src/mexc.js +7 -0
- package/js/src/okx.js +117 -63
- package/js/src/paradex.d.ts +15 -1
- package/js/src/paradex.js +78 -3
- package/js/src/pro/binance.d.ts +7 -0
- package/js/src/pro/binance.js +131 -29
- package/js/src/pro/bullish.d.ts +108 -0
- package/js/src/pro/bullish.js +774 -0
- package/js/src/pro/coinbase.js +2 -2
- package/js/src/pro/hyperliquid.d.ts +13 -1
- package/js/src/pro/hyperliquid.js +75 -15
- package/js/src/pro/upbit.d.ts +0 -1
- package/js/src/pro/upbit.js +28 -82
- package/package.json +2 -2
package/js/src/pro/coinbase.js
CHANGED
|
@@ -784,7 +784,7 @@ export default class coinbase extends coinbaseRest {
|
|
|
784
784
|
'type': this.safeString(order, 'order_type'),
|
|
785
785
|
'timeInForce': undefined,
|
|
786
786
|
'postOnly': undefined,
|
|
787
|
-
'side': this.
|
|
787
|
+
'side': this.safeStringLower2(order, 'side', 'order_side'),
|
|
788
788
|
'price': this.safeString(order, 'limit_price'),
|
|
789
789
|
'stopPrice': stopPrice,
|
|
790
790
|
'triggerPrice': stopPrice,
|
|
@@ -793,7 +793,7 @@ export default class coinbase extends coinbaseRest {
|
|
|
793
793
|
'average': this.safeString(order, 'avg_price'),
|
|
794
794
|
'filled': this.safeString(order, 'cumulative_quantity'),
|
|
795
795
|
'remaining': this.safeString(order, 'leaves_quantity'),
|
|
796
|
-
'status': this.
|
|
796
|
+
'status': this.parseOrderStatus(this.safeString(order, 'status')),
|
|
797
797
|
'fee': {
|
|
798
798
|
'amount': this.safeString(order, 'total_fees'),
|
|
799
799
|
'currency': this.safeString(market, 'quote'),
|
|
@@ -120,6 +120,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
120
120
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
121
121
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
122
122
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
123
|
+
* @param {string} [params.dex] for for hip3 tokens subscription, eg: 'xyz' or 'flx`, if symbols are provided we will infer it from the first symbol's market
|
|
123
124
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
124
125
|
*/
|
|
125
126
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
@@ -146,9 +147,20 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
146
147
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
147
148
|
*/
|
|
148
149
|
watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
149
|
-
handleWsTickers(client: Client, message: any):
|
|
150
|
+
handleWsTickers(client: Client, message: any): boolean;
|
|
150
151
|
parseWsTicker(rawTicker: any, market?: Market): Ticker;
|
|
151
152
|
handleMyTrades(client: Client, message: any): void;
|
|
153
|
+
/**
|
|
154
|
+
* @method
|
|
155
|
+
* @name hyperliquid#watchTrades
|
|
156
|
+
* @description watches information on multiple trades made in a market
|
|
157
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
158
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
159
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
160
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
161
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
162
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
163
|
+
*/
|
|
152
164
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
153
165
|
/**
|
|
154
166
|
* @method
|
|
@@ -303,6 +303,11 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
303
303
|
async watchTicker(symbol, params = {}) {
|
|
304
304
|
const market = this.market(symbol);
|
|
305
305
|
symbol = market['symbol'];
|
|
306
|
+
// try to infer dex from market
|
|
307
|
+
const dexName = this.safeString(this.safeDict(market, 'info', {}), 'dex');
|
|
308
|
+
if (dexName) {
|
|
309
|
+
params = this.extend(params, { 'dex': dexName });
|
|
310
|
+
}
|
|
306
311
|
const tickers = await this.watchTickers([symbol], params);
|
|
307
312
|
return tickers[symbol];
|
|
308
313
|
}
|
|
@@ -313,12 +318,13 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
313
318
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
314
319
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
315
320
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
321
|
+
* @param {string} [params.dex] for for hip3 tokens subscription, eg: 'xyz' or 'flx`, if symbols are provided we will infer it from the first symbol's market
|
|
316
322
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
317
323
|
*/
|
|
318
324
|
async watchTickers(symbols = undefined, params = {}) {
|
|
319
325
|
await this.loadMarkets();
|
|
320
326
|
symbols = this.marketSymbols(symbols, undefined, true);
|
|
321
|
-
|
|
327
|
+
let messageHash = 'tickers';
|
|
322
328
|
const url = this.urls['api']['ws']['public'];
|
|
323
329
|
const request = {
|
|
324
330
|
'method': 'subscribe',
|
|
@@ -327,6 +333,21 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
327
333
|
'user': '0x0000000000000000000000000000000000000000',
|
|
328
334
|
},
|
|
329
335
|
};
|
|
336
|
+
let defaultDex = this.safeString(params, 'dex');
|
|
337
|
+
const firstSymbol = this.safeString(symbols, 0);
|
|
338
|
+
if (firstSymbol !== undefined) {
|
|
339
|
+
const market = this.market(firstSymbol);
|
|
340
|
+
const dexName = this.safeString(this.safeDict(market, 'info', {}), 'dex');
|
|
341
|
+
if (dexName !== undefined) {
|
|
342
|
+
defaultDex = dexName;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (defaultDex !== undefined) {
|
|
346
|
+
params = this.omit(params, 'dex');
|
|
347
|
+
messageHash = 'tickers:' + defaultDex;
|
|
348
|
+
request['subscription']['type'] = 'allMids';
|
|
349
|
+
request['subscription']['dex'] = defaultDex;
|
|
350
|
+
}
|
|
330
351
|
const tickers = await this.watch(url, messageHash, this.extend(request, params), messageHash);
|
|
331
352
|
if (this.newUpdates) {
|
|
332
353
|
return this.filterByArrayTickers(tickers, 'symbol', symbols);
|
|
@@ -394,6 +415,19 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
394
415
|
return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
|
|
395
416
|
}
|
|
396
417
|
handleWsTickers(client, message) {
|
|
418
|
+
// hip3 mids
|
|
419
|
+
// {
|
|
420
|
+
// channel: 'allMids',
|
|
421
|
+
// data: {
|
|
422
|
+
// dex: 'flx',
|
|
423
|
+
// mids: {
|
|
424
|
+
// 'flx:COIN': '270.075',
|
|
425
|
+
// 'flx:CRCL': '78.8175',
|
|
426
|
+
// 'flx:NVDA': '180.64',
|
|
427
|
+
// 'flx:TSLA': '436.075'
|
|
428
|
+
// }
|
|
429
|
+
// }
|
|
430
|
+
// }
|
|
397
431
|
//
|
|
398
432
|
// {
|
|
399
433
|
// "channel": "webData2",
|
|
@@ -440,13 +474,36 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
440
474
|
// }
|
|
441
475
|
// }
|
|
442
476
|
//
|
|
477
|
+
// handle hip3 mids
|
|
478
|
+
const channel = this.safeString(message, 'channel');
|
|
479
|
+
if (channel === 'allMids') {
|
|
480
|
+
const data = this.safeDict(message, 'data', {});
|
|
481
|
+
const mids = this.safeDict(data, 'mids', {});
|
|
482
|
+
if (mids !== undefined) {
|
|
483
|
+
const keys = Object.keys(mids);
|
|
484
|
+
for (let i = 0; i < keys.length; i++) {
|
|
485
|
+
const name = keys[i];
|
|
486
|
+
const marketId = this.coinToMarketId(name);
|
|
487
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'swap');
|
|
488
|
+
const symbol = market['symbol'];
|
|
489
|
+
const ticker = this.parseWsTicker({
|
|
490
|
+
'price': this.safeNumber(mids, name),
|
|
491
|
+
}, market);
|
|
492
|
+
this.tickers[symbol] = ticker;
|
|
493
|
+
}
|
|
494
|
+
const messageHash = 'tickers:' + this.safeString(data, 'dex');
|
|
495
|
+
client.resolve(this.tickers, messageHash);
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
443
499
|
// spot
|
|
444
500
|
const rawData = this.safeDict(message, 'data', {});
|
|
445
501
|
const spotAssets = this.safeList(rawData, 'spotAssetCtxs', []);
|
|
446
502
|
const parsedTickers = [];
|
|
447
503
|
for (let i = 0; i < spotAssets.length; i++) {
|
|
448
504
|
const assetObject = spotAssets[i];
|
|
449
|
-
const
|
|
505
|
+
const coin = this.safeString(assetObject, 'coin');
|
|
506
|
+
const marketId = this.coinToMarketId(coin);
|
|
450
507
|
const market = this.safeMarket(marketId, undefined, undefined, 'spot');
|
|
451
508
|
const symbol = market['symbol'];
|
|
452
509
|
const ticker = this.parseWsTicker(assetObject, market);
|
|
@@ -459,8 +516,9 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
459
516
|
const assetCtxs = this.safeList(rawData, 'assetCtxs', []);
|
|
460
517
|
for (let i = 0; i < universe.length; i++) {
|
|
461
518
|
const data = this.extend(this.safeDict(universe, i, {}), this.safeDict(assetCtxs, i, {}));
|
|
462
|
-
const
|
|
463
|
-
const
|
|
519
|
+
const coin = this.safeString(data, 'name');
|
|
520
|
+
const marketId = this.coinToMarketId(coin);
|
|
521
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'swap');
|
|
464
522
|
const symbol = market['symbol'];
|
|
465
523
|
const ticker = this.parseWsTicker(data, market);
|
|
466
524
|
this.tickers[symbol] = ticker;
|
|
@@ -468,6 +526,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
468
526
|
}
|
|
469
527
|
const tickers = this.indexBy(parsedTickers, 'symbol');
|
|
470
528
|
client.resolve(tickers, 'tickers');
|
|
529
|
+
return true;
|
|
471
530
|
}
|
|
472
531
|
parseWsTicker(rawTicker, market = undefined) {
|
|
473
532
|
return this.parseTicker(rawTicker, market);
|
|
@@ -529,18 +588,18 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
529
588
|
const messageHash = 'myTrades';
|
|
530
589
|
client.resolve(trades, messageHash);
|
|
531
590
|
}
|
|
591
|
+
/**
|
|
592
|
+
* @method
|
|
593
|
+
* @name hyperliquid#watchTrades
|
|
594
|
+
* @description watches information on multiple trades made in a market
|
|
595
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
596
|
+
* @param {string} symbol unified market symbol of the market trades were made in
|
|
597
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
598
|
+
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
599
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
600
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
601
|
+
*/
|
|
532
602
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
533
|
-
// s
|
|
534
|
-
// @method
|
|
535
|
-
// @name hyperliquid#watchTrades
|
|
536
|
-
// @description watches information on multiple trades made in a market
|
|
537
|
-
// @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
|
538
|
-
// @param {string} symbol unified market symbol of the market trades were made in
|
|
539
|
-
// @param {int} [since] the earliest time in ms to fetch trades for
|
|
540
|
-
// @param {int} [limit] the maximum number of trade structures to retrieve
|
|
541
|
-
// @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
542
|
-
// @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
543
|
-
//
|
|
544
603
|
await this.loadMarkets();
|
|
545
604
|
const market = this.market(symbol);
|
|
546
605
|
symbol = market['symbol'];
|
|
@@ -1078,6 +1137,7 @@ export default class hyperliquid extends hyperliquidRest {
|
|
|
1078
1137
|
'orderUpdates': this.handleOrder,
|
|
1079
1138
|
'userFills': this.handleMyTrades,
|
|
1080
1139
|
'webData2': this.handleWsTickers,
|
|
1140
|
+
'allMids': this.handleWsTickers,
|
|
1081
1141
|
'post': this.handleWsPost,
|
|
1082
1142
|
'subscriptionResponse': this.handleSubscriptionResponse,
|
|
1083
1143
|
};
|
package/js/src/pro/upbit.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Int, Str, Order, OrderBook, Trade, Ticker, Balances, Tickers, Stri
|
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class upbit extends upbitRest {
|
|
5
5
|
describe(): any;
|
|
6
|
-
watchPublic(symbol: string, channel: any, params?: {}): Promise<any>;
|
|
7
6
|
watchPublicMultiple(symbols: Strings, channel: any, params?: {}): Promise<any>;
|
|
8
7
|
/**
|
|
9
8
|
* @method
|
package/js/src/pro/upbit.js
CHANGED
|
@@ -30,11 +30,13 @@ export default class upbit extends upbitRest {
|
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
async
|
|
33
|
+
async watchPublicMultiple(symbols, channel, params = {}) {
|
|
34
34
|
await this.loadMarkets();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (symbols === undefined) {
|
|
36
|
+
symbols = this.symbols;
|
|
37
|
+
}
|
|
38
|
+
symbols = this.marketSymbols(symbols);
|
|
39
|
+
const marketIds = this.marketIds(symbols);
|
|
38
40
|
const url = this.implodeParams(this.urls['api']['ws'], {
|
|
39
41
|
'hostname': this.hostname,
|
|
40
42
|
});
|
|
@@ -44,16 +46,18 @@ export default class upbit extends upbitRest {
|
|
|
44
46
|
client.subscriptions[subscriptionsKey] = {};
|
|
45
47
|
}
|
|
46
48
|
const subscriptions = client.subscriptions[subscriptionsKey];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
messageHash
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const messageHashes = [];
|
|
50
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
51
|
+
const marketId = marketIds[i];
|
|
52
|
+
const symbol = symbols[i];
|
|
53
|
+
const messageHash = channel + ':' + symbol;
|
|
54
|
+
messageHashes.push(messageHash);
|
|
55
|
+
if (!(messageHash in subscriptions)) {
|
|
56
|
+
subscriptions[messageHash] = {
|
|
57
|
+
'type': channel,
|
|
58
|
+
'codes': [marketId],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
62
|
const finalMessage = [
|
|
59
63
|
{
|
|
@@ -65,34 +69,7 @@ export default class upbit extends upbitRest {
|
|
|
65
69
|
const key = channelKeys[i];
|
|
66
70
|
finalMessage.push(subscriptions[key]);
|
|
67
71
|
}
|
|
68
|
-
return await this.
|
|
69
|
-
}
|
|
70
|
-
async watchPublicMultiple(symbols, channel, params = {}) {
|
|
71
|
-
await this.loadMarkets();
|
|
72
|
-
if (symbols === undefined) {
|
|
73
|
-
symbols = this.symbols;
|
|
74
|
-
}
|
|
75
|
-
symbols = this.marketSymbols(symbols);
|
|
76
|
-
const marketIds = this.marketIds(symbols);
|
|
77
|
-
const url = this.implodeParams(this.urls['api']['ws'], {
|
|
78
|
-
'hostname': this.hostname,
|
|
79
|
-
});
|
|
80
|
-
const messageHashes = [];
|
|
81
|
-
for (let i = 0; i < marketIds.length; i++) {
|
|
82
|
-
messageHashes.push(channel + ':' + marketIds[i]);
|
|
83
|
-
}
|
|
84
|
-
const request = [
|
|
85
|
-
{
|
|
86
|
-
'ticket': this.uuid(),
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
'type': channel,
|
|
90
|
-
'codes': marketIds,
|
|
91
|
-
// 'isOnlySnapshot': false,
|
|
92
|
-
// 'isOnlyRealtime': false,
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
72
|
+
return await this.watchMultiple(url, messageHashes, finalMessage, messageHashes);
|
|
96
73
|
}
|
|
97
74
|
/**
|
|
98
75
|
* @method
|
|
@@ -104,7 +81,7 @@ export default class upbit extends upbitRest {
|
|
|
104
81
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
105
82
|
*/
|
|
106
83
|
async watchTicker(symbol, params = {}) {
|
|
107
|
-
return await this.
|
|
84
|
+
return await this.watchPublicMultiple([symbol], 'ticker');
|
|
108
85
|
}
|
|
109
86
|
/**
|
|
110
87
|
* @method
|
|
@@ -150,37 +127,7 @@ export default class upbit extends upbitRest {
|
|
|
150
127
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
151
128
|
*/
|
|
152
129
|
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
153
|
-
await this.
|
|
154
|
-
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
155
|
-
const channel = 'trade';
|
|
156
|
-
const messageHashes = [];
|
|
157
|
-
const url = this.implodeParams(this.urls['api']['ws'], {
|
|
158
|
-
'hostname': this.hostname,
|
|
159
|
-
});
|
|
160
|
-
if (symbols !== undefined) {
|
|
161
|
-
for (let i = 0; i < symbols.length; i++) {
|
|
162
|
-
const market = this.market(symbols[i]);
|
|
163
|
-
const marketId = market['id'];
|
|
164
|
-
const symbol = market['symbol'];
|
|
165
|
-
this.options[channel] = this.safeValue(this.options, channel, {});
|
|
166
|
-
this.options[channel][symbol] = true;
|
|
167
|
-
messageHashes.push(channel + ':' + marketId);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const optionSymbols = Object.keys(this.options[channel]);
|
|
171
|
-
const marketIds = this.marketIds(optionSymbols);
|
|
172
|
-
const request = [
|
|
173
|
-
{
|
|
174
|
-
'ticket': this.uuid(),
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
'type': channel,
|
|
178
|
-
'codes': marketIds,
|
|
179
|
-
// 'isOnlySnapshot': false,
|
|
180
|
-
// 'isOnlyRealtime': false,
|
|
181
|
-
},
|
|
182
|
-
];
|
|
183
|
-
const trades = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
130
|
+
const trades = await this.watchPublicMultiple(symbols, 'trade');
|
|
184
131
|
if (this.newUpdates) {
|
|
185
132
|
const first = this.safeValue(trades, 0);
|
|
186
133
|
const tradeSymbol = this.safeString(first, 'symbol');
|
|
@@ -199,7 +146,7 @@ export default class upbit extends upbitRest {
|
|
|
199
146
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
200
147
|
*/
|
|
201
148
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
202
|
-
const orderbook = await this.
|
|
149
|
+
const orderbook = await this.watchPublicMultiple([symbol], 'orderbook');
|
|
203
150
|
return orderbook.limit();
|
|
204
151
|
}
|
|
205
152
|
/**
|
|
@@ -220,7 +167,7 @@ export default class upbit extends upbitRest {
|
|
|
220
167
|
throw new NotSupported(this.id + ' watchOHLCV does not support' + timeframe + ' candle.');
|
|
221
168
|
}
|
|
222
169
|
const timeFrameOHLCV = 'candle.' + timeframe;
|
|
223
|
-
return await this.
|
|
170
|
+
return await this.watchPublicMultiple([symbol], timeFrameOHLCV);
|
|
224
171
|
}
|
|
225
172
|
handleTicker(client, message) {
|
|
226
173
|
// 2020-03-17T23:07:36.511Z "onMessage" <Buffer 7b 22 74 79 70 65 22 3a 22 74 69 63 6b 65 72 22 2c 22 63 6f 64 65 22 3a 22 42 54 43 2d 45 54 48 22 2c 22 6f 70 65 6e 69 6e 67 5f 70 72 69 63 65 22 3a ... >
|
|
@@ -259,11 +206,10 @@ export default class upbit extends upbitRest {
|
|
|
259
206
|
// "acc_trade_price_24h": 2.5955306323568927,
|
|
260
207
|
// "acc_trade_volume_24h": 118.38798416,
|
|
261
208
|
// "stream_type": "SNAPSHOT" }
|
|
262
|
-
const marketId = this.safeString(message, 'code');
|
|
263
|
-
const messageHash = 'ticker:' + marketId;
|
|
264
209
|
const ticker = this.parseTicker(message);
|
|
265
210
|
const symbol = ticker['symbol'];
|
|
266
211
|
this.tickers[symbol] = ticker;
|
|
212
|
+
const messageHash = 'ticker:' + symbol;
|
|
267
213
|
client.resolve(ticker, messageHash);
|
|
268
214
|
}
|
|
269
215
|
handleOrderBook(client, message) {
|
|
@@ -317,7 +263,7 @@ export default class upbit extends upbitRest {
|
|
|
317
263
|
const datetime = this.iso8601(timestamp);
|
|
318
264
|
orderbook['timestamp'] = timestamp;
|
|
319
265
|
orderbook['datetime'] = datetime;
|
|
320
|
-
const messageHash = 'orderbook:' +
|
|
266
|
+
const messageHash = 'orderbook:' + symbol;
|
|
321
267
|
client.resolve(orderbook, messageHash);
|
|
322
268
|
}
|
|
323
269
|
handleTrades(client, message) {
|
|
@@ -344,8 +290,7 @@ export default class upbit extends upbitRest {
|
|
|
344
290
|
this.trades[symbol] = stored;
|
|
345
291
|
}
|
|
346
292
|
stored.append(trade);
|
|
347
|
-
const
|
|
348
|
-
const messageHash = 'trade:' + marketId;
|
|
293
|
+
const messageHash = 'trade:' + symbol;
|
|
349
294
|
client.resolve(stored, messageHash);
|
|
350
295
|
}
|
|
351
296
|
handleOHLCV(client, message) {
|
|
@@ -364,7 +309,8 @@ export default class upbit extends upbitRest {
|
|
|
364
309
|
// stream_type: 'REALTIME'
|
|
365
310
|
// }
|
|
366
311
|
const marketId = this.safeString(message, 'code');
|
|
367
|
-
const
|
|
312
|
+
const symbol = this.safeSymbol(marketId, undefined);
|
|
313
|
+
const messageHash = 'candle.1s:' + symbol;
|
|
368
314
|
const ohlcv = this.parseOHLCV(message);
|
|
369
315
|
client.resolve(ohlcv, messageHash);
|
|
370
316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccxt",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.23",
|
|
4
4
|
"description": "A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go",
|
|
5
5
|
"unpkg": "dist/ccxt.browser.min.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"buildGO": "go build -C go ./v4 && go build -C go ./v4/pro",
|
|
41
41
|
"formatGO": "go fmt -C go v4 tests",
|
|
42
42
|
"transpileGOWs": "tsx build/goTranspiler.ts --ws",
|
|
43
|
-
"transpileGORest": "tsx build/goTranspiler.ts
|
|
43
|
+
"transpileGORest": "tsx build/goTranspiler.ts",
|
|
44
44
|
"transpileGO": "npm run transpileGORest && npm run transpileGOWs",
|
|
45
45
|
"buildCSTests": "dotnet build cs/tests/tests.csproj",
|
|
46
46
|
"buildCSRelease": "dotnet build cs --configuration Release",
|