ccxt 4.4.78 → 4.4.82
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 -12
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/apex.js +21 -31
- package/dist/cjs/src/ascendex.js +26 -5
- package/dist/cjs/src/base/Exchange.js +26 -3
- package/dist/cjs/src/base/functions/encode.js +1 -1
- package/dist/cjs/src/bigone.js +22 -14
- package/dist/cjs/src/binance.js +8 -0
- package/dist/cjs/src/bingx.js +16 -40
- package/dist/cjs/src/bitfinex.js +128 -88
- package/dist/cjs/src/bitget.js +60 -71
- package/dist/cjs/src/bitmart.js +7 -2
- package/dist/cjs/src/bitmex.js +12 -4
- package/dist/cjs/src/bitopro.js +5 -1
- package/dist/cjs/src/bitrue.js +2 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitteam.js +2 -0
- package/dist/cjs/src/bitvavo.js +28 -10
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +1 -1
- package/dist/cjs/src/bybit.js +34 -16
- package/dist/cjs/src/coinbase.js +4 -17
- package/dist/cjs/src/coinex.js +1 -0
- package/dist/cjs/src/coinlist.js +1 -0
- package/dist/cjs/src/coinone.js +1 -0
- package/dist/cjs/src/delta.js +4 -0
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/hollaex.js +1 -0
- package/dist/cjs/src/htx.js +9 -5
- package/dist/cjs/src/huobijp.js +1 -0
- package/dist/cjs/src/hyperliquid.js +16 -0
- package/dist/cjs/src/kraken.js +2 -0
- package/dist/cjs/src/okx.js +2 -3
- package/dist/cjs/src/oxfun.js +21 -1
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/binance.js +3 -3
- package/dist/cjs/src/pro/coinbase.js +43 -62
- package/dist/cjs/src/pro/hyperliquid.js +10 -2
- package/dist/cjs/src/pro/upbit.js +43 -0
- package/dist/cjs/src/timex.js +2 -2
- package/dist/cjs/src/upbit.js +43 -21
- package/dist/cjs/src/whitebit.js +65 -12
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/apex.js +21 -31
- package/js/src/ascendex.js +26 -5
- package/js/src/base/Exchange.d.ts +2 -1
- package/js/src/base/Exchange.js +26 -3
- package/js/src/base/functions/encode.d.ts +1 -1
- package/js/src/base/functions/encode.js +1 -1
- package/js/src/bigone.js +22 -14
- package/js/src/binance.js +8 -0
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +16 -40
- package/js/src/bitfinex.js +128 -88
- package/js/src/bitget.d.ts +1 -0
- package/js/src/bitget.js +60 -71
- package/js/src/bitmart.d.ts +1 -0
- package/js/src/bitmart.js +7 -2
- package/js/src/bitmex.js +12 -4
- package/js/src/bitopro.js +5 -1
- package/js/src/bitrue.js +2 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitteam.js +2 -0
- package/js/src/bitvavo.js +28 -10
- package/js/src/btcalpha.js +1 -1
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +1 -1
- package/js/src/bybit.js +34 -16
- package/js/src/coinbase.d.ts +0 -2
- package/js/src/coinbase.js +4 -17
- package/js/src/coinex.js +1 -0
- package/js/src/coinlist.js +1 -0
- package/js/src/coinone.js +1 -0
- package/js/src/delta.js +4 -0
- package/js/src/deribit.js +1 -0
- package/js/src/hollaex.js +1 -0
- package/js/src/htx.js +9 -5
- package/js/src/huobijp.js +1 -0
- package/js/src/hyperliquid.js +16 -0
- package/js/src/kraken.js +2 -0
- package/js/src/okx.js +2 -3
- package/js/src/oxfun.d.ts +10 -0
- package/js/src/oxfun.js +21 -1
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/binance.js +3 -3
- package/js/src/pro/coinbase.d.ts +4 -3
- package/js/src/pro/coinbase.js +43 -60
- package/js/src/pro/hyperliquid.js +10 -2
- package/js/src/pro/upbit.d.ts +16 -1
- package/js/src/pro/upbit.js +43 -0
- package/js/src/timex.js +2 -2
- package/js/src/upbit.d.ts +42 -20
- package/js/src/upbit.js +43 -21
- package/js/src/whitebit.js +65 -12
- package/package.json +1 -1
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -65,12 +65,12 @@ class binance extends binance$1 {
|
|
|
65
65
|
'urls': {
|
|
66
66
|
'test': {
|
|
67
67
|
'ws': {
|
|
68
|
-
'spot': 'wss://testnet.binance.vision/ws',
|
|
69
|
-
'margin': 'wss://testnet.binance.vision/ws',
|
|
68
|
+
'spot': 'wss://stream.testnet.binance.vision/ws',
|
|
69
|
+
'margin': 'wss://stream.testnet.binance.vision/ws',
|
|
70
70
|
'future': 'wss://fstream.binancefuture.com/ws',
|
|
71
71
|
'delivery': 'wss://dstream.binancefuture.com/ws',
|
|
72
72
|
'ws-api': {
|
|
73
|
-
'spot': 'wss://testnet.binance.vision/ws-api/v3',
|
|
73
|
+
'spot': 'wss://ws-api.testnet.binance.vision/ws-api/v3',
|
|
74
74
|
'future': 'wss://testnet.binancefuture.com/ws-fapi/v1',
|
|
75
75
|
'delivery': 'wss://testnet.binancefuture.com/ws-dapi/v1',
|
|
76
76
|
},
|
|
@@ -72,7 +72,7 @@ class coinbase extends coinbase$1 {
|
|
|
72
72
|
}
|
|
73
73
|
else if (symbol !== undefined) {
|
|
74
74
|
market = this.market(symbol);
|
|
75
|
-
messageHash = name + '::' +
|
|
75
|
+
messageHash = name + '::' + symbol;
|
|
76
76
|
productIds = [market['id']];
|
|
77
77
|
}
|
|
78
78
|
const url = this.urls['api']['ws'];
|
|
@@ -110,7 +110,7 @@ class coinbase extends coinbase$1 {
|
|
|
110
110
|
const market = this.market(symbol);
|
|
111
111
|
const marketId = market['id'];
|
|
112
112
|
productIds.push(marketId);
|
|
113
|
-
messageHashes.push(name + '::' +
|
|
113
|
+
messageHashes.push(name + '::' + symbol);
|
|
114
114
|
}
|
|
115
115
|
const url = this.urls['api']['ws'];
|
|
116
116
|
let subscribe = {
|
|
@@ -178,8 +178,11 @@ class coinbase extends coinbase$1 {
|
|
|
178
178
|
symbols = this.symbols;
|
|
179
179
|
}
|
|
180
180
|
const name = 'ticker_batch';
|
|
181
|
-
const
|
|
181
|
+
const ticker = await this.subscribeMultiple(name, false, symbols, params);
|
|
182
182
|
if (this.newUpdates) {
|
|
183
|
+
const tickers = {};
|
|
184
|
+
const symbol = ticker['symbol'];
|
|
185
|
+
tickers[symbol] = ticker;
|
|
183
186
|
return tickers;
|
|
184
187
|
}
|
|
185
188
|
return this.tickers;
|
|
@@ -275,47 +278,28 @@ class coinbase extends coinbase$1 {
|
|
|
275
278
|
//
|
|
276
279
|
//
|
|
277
280
|
const channel = this.safeString(message, 'channel');
|
|
278
|
-
const events = this.
|
|
281
|
+
const events = this.safeList(message, 'events', []);
|
|
279
282
|
const datetime = this.safeString(message, 'timestamp');
|
|
280
283
|
const timestamp = this.parse8601(datetime);
|
|
281
|
-
const newTickers = [];
|
|
282
284
|
for (let i = 0; i < events.length; i++) {
|
|
283
285
|
const tickersObj = events[i];
|
|
284
286
|
const tickers = this.safeList(tickersObj, 'tickers', []);
|
|
285
287
|
for (let j = 0; j < tickers.length; j++) {
|
|
286
288
|
const ticker = tickers[j];
|
|
289
|
+
const wsMarketId = this.safeString(ticker, 'product_id');
|
|
290
|
+
if (wsMarketId === undefined) {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
287
293
|
const result = this.parseWsTicker(ticker);
|
|
288
294
|
result['timestamp'] = timestamp;
|
|
289
295
|
result['datetime'] = datetime;
|
|
290
296
|
const symbol = result['symbol'];
|
|
291
297
|
this.tickers[symbol] = result;
|
|
292
|
-
const
|
|
293
|
-
if (wsMarketId === undefined) {
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
const messageHash = channel + '::' + wsMarketId;
|
|
297
|
-
newTickers.push(result);
|
|
298
|
+
const messageHash = channel + '::' + symbol;
|
|
298
299
|
client.resolve(result, messageHash);
|
|
299
|
-
|
|
300
|
-
client.resolve(result, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
301
|
-
}
|
|
300
|
+
this.tryResolveUsdc(client, messageHash, result);
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
|
-
const messageHashes = this.findMessageHashes(client, 'ticker_batch::');
|
|
305
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
306
|
-
const messageHash = messageHashes[i];
|
|
307
|
-
const parts = messageHash.split('::');
|
|
308
|
-
const symbolsString = parts[1];
|
|
309
|
-
const symbols = symbolsString.split(',');
|
|
310
|
-
const tickers = this.filterByArray(newTickers, 'symbol', symbols);
|
|
311
|
-
if (!this.isEmpty(tickers)) {
|
|
312
|
-
client.resolve(tickers, messageHash);
|
|
313
|
-
if (messageHash.endsWith('USD')) {
|
|
314
|
-
client.resolve(tickers, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return message;
|
|
319
303
|
}
|
|
320
304
|
parseWsTicker(ticker, market = undefined) {
|
|
321
305
|
//
|
|
@@ -483,13 +467,13 @@ class coinbase extends coinbase$1 {
|
|
|
483
467
|
// ]
|
|
484
468
|
// }
|
|
485
469
|
//
|
|
486
|
-
const events = this.
|
|
470
|
+
const events = this.safeList(message, 'events');
|
|
487
471
|
const event = this.safeValue(events, 0);
|
|
488
|
-
const trades = this.
|
|
489
|
-
const trade = this.
|
|
472
|
+
const trades = this.safeList(event, 'trades');
|
|
473
|
+
const trade = this.safeDict(trades, 0);
|
|
490
474
|
const marketId = this.safeString(trade, 'product_id');
|
|
491
|
-
const messageHash = 'market_trades::' + marketId;
|
|
492
475
|
const symbol = this.safeSymbol(marketId);
|
|
476
|
+
const messageHash = 'market_trades::' + symbol;
|
|
493
477
|
let tradesArray = this.safeValue(this.trades, symbol);
|
|
494
478
|
if (tradesArray === undefined) {
|
|
495
479
|
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
@@ -498,17 +482,14 @@ class coinbase extends coinbase$1 {
|
|
|
498
482
|
}
|
|
499
483
|
for (let i = 0; i < events.length; i++) {
|
|
500
484
|
const currentEvent = events[i];
|
|
501
|
-
const currentTrades = this.
|
|
485
|
+
const currentTrades = this.safeList(currentEvent, 'trades');
|
|
502
486
|
for (let j = 0; j < currentTrades.length; j++) {
|
|
503
487
|
const item = currentTrades[i];
|
|
504
488
|
tradesArray.append(this.parseTrade(item));
|
|
505
489
|
}
|
|
506
490
|
}
|
|
507
491
|
client.resolve(tradesArray, messageHash);
|
|
508
|
-
|
|
509
|
-
client.resolve(tradesArray, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
510
|
-
}
|
|
511
|
-
return message;
|
|
492
|
+
this.tryResolveUsdc(client, messageHash, tradesArray);
|
|
512
493
|
}
|
|
513
494
|
handleOrder(client, message) {
|
|
514
495
|
//
|
|
@@ -539,7 +520,7 @@ class coinbase extends coinbase$1 {
|
|
|
539
520
|
// ]
|
|
540
521
|
// }
|
|
541
522
|
//
|
|
542
|
-
const events = this.
|
|
523
|
+
const events = this.safeList(message, 'events');
|
|
543
524
|
const marketIds = [];
|
|
544
525
|
if (this.orders === undefined) {
|
|
545
526
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
|
@@ -547,7 +528,7 @@ class coinbase extends coinbase$1 {
|
|
|
547
528
|
}
|
|
548
529
|
for (let i = 0; i < events.length; i++) {
|
|
549
530
|
const event = events[i];
|
|
550
|
-
const responseOrders = this.
|
|
531
|
+
const responseOrders = this.safeList(event, 'orders');
|
|
551
532
|
for (let j = 0; j < responseOrders.length; j++) {
|
|
552
533
|
const responseOrder = responseOrders[j];
|
|
553
534
|
const parsed = this.parseWsOrder(responseOrder);
|
|
@@ -561,14 +542,12 @@ class coinbase extends coinbase$1 {
|
|
|
561
542
|
}
|
|
562
543
|
for (let i = 0; i < marketIds.length; i++) {
|
|
563
544
|
const marketId = marketIds[i];
|
|
564
|
-
const
|
|
545
|
+
const symbol = this.safeSymbol(marketId);
|
|
546
|
+
const messageHash = 'user::' + symbol;
|
|
565
547
|
client.resolve(this.orders, messageHash);
|
|
566
|
-
|
|
567
|
-
client.resolve(this.orders, messageHash + 'C'); // sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
|
568
|
-
}
|
|
548
|
+
this.tryResolveUsdc(client, messageHash, this.orders);
|
|
569
549
|
}
|
|
570
550
|
client.resolve(this.orders, 'user');
|
|
571
|
-
return message;
|
|
572
551
|
}
|
|
573
552
|
parseWsOrder(order, market = undefined) {
|
|
574
553
|
//
|
|
@@ -645,7 +624,7 @@ class coinbase extends coinbase$1 {
|
|
|
645
624
|
// {
|
|
646
625
|
// "side": "bid",
|
|
647
626
|
// "event_time": "1970-01-01T00:00:00Z",
|
|
648
|
-
// "price_level": "21921.
|
|
627
|
+
// "price_level": "21921.74",
|
|
649
628
|
// "new_quantity": "0.06317902"
|
|
650
629
|
// },
|
|
651
630
|
// {
|
|
@@ -659,36 +638,38 @@ class coinbase extends coinbase$1 {
|
|
|
659
638
|
// ]
|
|
660
639
|
// }
|
|
661
640
|
//
|
|
662
|
-
const events = this.
|
|
641
|
+
const events = this.safeList(message, 'events');
|
|
663
642
|
const datetime = this.safeString(message, 'timestamp');
|
|
664
643
|
for (let i = 0; i < events.length; i++) {
|
|
665
644
|
const event = events[i];
|
|
666
|
-
const updates = this.
|
|
645
|
+
const updates = this.safeList(event, 'updates', []);
|
|
667
646
|
const marketId = this.safeString(event, 'product_id');
|
|
668
647
|
// sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD, as they are aliases
|
|
669
648
|
const market = this.safeMarket(marketId);
|
|
670
|
-
const messageHash = 'level2::' + market['id'];
|
|
671
649
|
const symbol = market['symbol'];
|
|
650
|
+
const messageHash = 'level2::' + symbol;
|
|
672
651
|
const subscription = this.safeValue(client.subscriptions, messageHash, {});
|
|
673
652
|
const limit = this.safeInteger(subscription, 'limit');
|
|
674
653
|
const type = this.safeString(event, 'type');
|
|
675
654
|
if (type === 'snapshot') {
|
|
676
655
|
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
677
|
-
const orderbook = this.orderbooks[symbol];
|
|
678
|
-
this.handleOrderBookHelper(orderbook, updates);
|
|
679
|
-
orderbook['timestamp'] = this.parse8601(datetime);
|
|
680
|
-
orderbook['datetime'] = datetime;
|
|
681
|
-
orderbook['symbol'] = symbol;
|
|
682
|
-
client.resolve(orderbook, messageHash);
|
|
683
656
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
orderbook['datetime'] = datetime;
|
|
688
|
-
orderbook['timestamp'] = this.parse8601(datetime);
|
|
689
|
-
orderbook['symbol'] = symbol;
|
|
690
|
-
client.resolve(orderbook, messageHash);
|
|
657
|
+
// unknown bug, can't reproduce, but sometimes orderbook is undefined
|
|
658
|
+
if (!(symbol in this.orderbooks) && this.orderbooks[symbol] === undefined) {
|
|
659
|
+
continue;
|
|
691
660
|
}
|
|
661
|
+
const orderbook = this.orderbooks[symbol];
|
|
662
|
+
this.handleOrderBookHelper(orderbook, updates);
|
|
663
|
+
orderbook['timestamp'] = this.parse8601(datetime);
|
|
664
|
+
orderbook['datetime'] = datetime;
|
|
665
|
+
orderbook['symbol'] = symbol;
|
|
666
|
+
client.resolve(orderbook, messageHash);
|
|
667
|
+
this.tryResolveUsdc(client, messageHash, orderbook);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
tryResolveUsdc(client, messageHash, result) {
|
|
671
|
+
if (messageHash.endsWith('/USD') || messageHash.endsWith('-USD')) {
|
|
672
|
+
client.resolve(result, messageHash + 'C'); // when subscribing to BTC/USDC and coinbase returns BTC/USD, so resolve USDC too
|
|
692
673
|
}
|
|
693
674
|
}
|
|
694
675
|
handleSubscriptionStatus(client, message) {
|
|
@@ -95,7 +95,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
95
95
|
await this.loadMarkets();
|
|
96
96
|
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
97
97
|
const orders = await this.createOrdersWs([order], globalParams);
|
|
98
|
-
|
|
98
|
+
const parsedOrder = orders[0];
|
|
99
|
+
const orderInfo = this.safeDict(parsedOrder, 'info');
|
|
100
|
+
// handle potential error here
|
|
101
|
+
this.handleErrors(undefined, undefined, undefined, undefined, undefined, this.json(orderInfo), orderInfo, undefined, undefined);
|
|
102
|
+
return parsedOrder;
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* @method
|
|
@@ -132,7 +136,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
132
136
|
const dataObject = this.safeDict(responseObject, 'data', {});
|
|
133
137
|
const statuses = this.safeList(dataObject, 'statuses', []);
|
|
134
138
|
const first = this.safeDict(statuses, 0, {});
|
|
135
|
-
|
|
139
|
+
const parsedOrder = this.parseOrder(first, market);
|
|
140
|
+
const orderInfo = this.safeDict(parsedOrder, 'info');
|
|
141
|
+
// handle potential error here
|
|
142
|
+
this.handleErrors(undefined, undefined, undefined, undefined, undefined, this.json(orderInfo), orderInfo, undefined, undefined);
|
|
143
|
+
return parsedOrder;
|
|
136
144
|
}
|
|
137
145
|
/**
|
|
138
146
|
* @method
|
|
@@ -4,6 +4,7 @@ var upbit$1 = require('../upbit.js');
|
|
|
4
4
|
var Cache = require('../base/ws/Cache.js');
|
|
5
5
|
var sha256 = require('../static_dependencies/noble-hashes/sha256.js');
|
|
6
6
|
var rsa = require('../base/functions/rsa.js');
|
|
7
|
+
var errors = require('../base/errors.js');
|
|
7
8
|
|
|
8
9
|
// ----------------------------------------------------------------------------
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
@@ -17,6 +18,7 @@ class upbit extends upbit$1 {
|
|
|
17
18
|
'watchTickers': true,
|
|
18
19
|
'watchTrades': true,
|
|
19
20
|
'watchTradesForSymbols': true,
|
|
21
|
+
'watchOHLCV': true,
|
|
20
22
|
'watchOrders': true,
|
|
21
23
|
'watchMyTrades': true,
|
|
22
24
|
'watchBalance': true,
|
|
@@ -192,6 +194,26 @@ class upbit extends upbit$1 {
|
|
|
192
194
|
const orderbook = await this.watchPublic(symbol, 'orderbook');
|
|
193
195
|
return orderbook.limit();
|
|
194
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* @method
|
|
199
|
+
* @name upbit#watchOHLCV
|
|
200
|
+
* @description watches information an OHLCV with timestamp, openingPrice, highPrice, lowPrice, tradePrice, baseVolume in 1s.
|
|
201
|
+
* @see https://docs.upbit.com/kr/reference/websocket-candle for Upbit KR
|
|
202
|
+
* @see https://global-docs.upbit.com/reference/websocket-candle for Upbit Global
|
|
203
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
204
|
+
* @param {string} timeframe specifies the OHLCV candle interval to watch. As of now, Upbit only supports 1s candles.
|
|
205
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
206
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
207
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
208
|
+
* @returns {OHLCV[]} a list of [OHLCV structures]{@link https://docs.ccxt.com/#/?id=ohlcv-structure}
|
|
209
|
+
*/
|
|
210
|
+
async watchOHLCV(symbol, timeframe = '1s', since = undefined, limit = undefined, params = {}) {
|
|
211
|
+
if (timeframe !== '1s') {
|
|
212
|
+
throw new errors.NotSupported(this.id + ' watchOHLCV does not support' + timeframe + ' candle.');
|
|
213
|
+
}
|
|
214
|
+
const timeFrameOHLCV = 'candle.' + timeframe;
|
|
215
|
+
return await this.watchPublic(symbol, timeFrameOHLCV);
|
|
216
|
+
}
|
|
195
217
|
handleTicker(client, message) {
|
|
196
218
|
// 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 ... >
|
|
197
219
|
// { type: "ticker",
|
|
@@ -318,6 +340,26 @@ class upbit extends upbit$1 {
|
|
|
318
340
|
const messageHash = 'trade:' + marketId;
|
|
319
341
|
client.resolve(stored, messageHash);
|
|
320
342
|
}
|
|
343
|
+
handleOHLCV(client, message) {
|
|
344
|
+
// {
|
|
345
|
+
// type: 'candle.1s',
|
|
346
|
+
// code: 'KRW-USDT',
|
|
347
|
+
// candle_date_time_utc: '2025-04-22T09:50:34',
|
|
348
|
+
// candle_date_time_kst: '2025-04-22T18:50:34',
|
|
349
|
+
// opening_price: 1438,
|
|
350
|
+
// high_price: 1438,
|
|
351
|
+
// low_price: 1438,
|
|
352
|
+
// trade_price: 1438,
|
|
353
|
+
// candle_acc_trade_volume: 1145.8935,
|
|
354
|
+
// candle_acc_trade_price: 1647794.853,
|
|
355
|
+
// timestamp: 1745315434125,
|
|
356
|
+
// stream_type: 'REALTIME'
|
|
357
|
+
// }
|
|
358
|
+
const marketId = this.safeString(message, 'code');
|
|
359
|
+
const messageHash = 'candle.1s:' + marketId;
|
|
360
|
+
const ohlcv = this.parseOHLCV(message);
|
|
361
|
+
client.resolve(ohlcv, messageHash);
|
|
362
|
+
}
|
|
321
363
|
async authenticate(params = {}) {
|
|
322
364
|
this.checkRequiredCredentials();
|
|
323
365
|
const wsOptions = this.safeDict(this.options, 'ws', {});
|
|
@@ -633,6 +675,7 @@ class upbit extends upbit$1 {
|
|
|
633
675
|
'trade': this.handleTrades,
|
|
634
676
|
'myOrder': this.handleMyOrder,
|
|
635
677
|
'myAsset': this.handleBalance,
|
|
678
|
+
'candle.1s': this.handleOHLCV,
|
|
636
679
|
};
|
|
637
680
|
const methodName = this.safeString(message, 'type');
|
|
638
681
|
const method = this.safeValue(methods, methodName);
|
package/dist/cjs/src/timex.js
CHANGED
|
@@ -1554,7 +1554,7 @@ class timex extends timex$1 {
|
|
|
1554
1554
|
'currency': feeCurrency,
|
|
1555
1555
|
};
|
|
1556
1556
|
}
|
|
1557
|
-
return {
|
|
1557
|
+
return this.safeTrade({
|
|
1558
1558
|
'info': trade,
|
|
1559
1559
|
'id': id,
|
|
1560
1560
|
'timestamp': timestamp,
|
|
@@ -1568,7 +1568,7 @@ class timex extends timex$1 {
|
|
|
1568
1568
|
'cost': cost,
|
|
1569
1569
|
'takerOrMaker': takerOrMaker,
|
|
1570
1570
|
'fee': fee,
|
|
1571
|
-
};
|
|
1571
|
+
});
|
|
1572
1572
|
}
|
|
1573
1573
|
parseOHLCV(ohlcv, market = undefined) {
|
|
1574
1574
|
//
|
package/dist/cjs/src/upbit.js
CHANGED
|
@@ -490,7 +490,8 @@ class upbit extends upbit$1 {
|
|
|
490
490
|
/**
|
|
491
491
|
* @method
|
|
492
492
|
* @name upbit#fetchMarkets
|
|
493
|
-
* @see https://docs.upbit.com/reference
|
|
493
|
+
* @see https://docs.upbit.com/kr/reference/마켓-코드-조회
|
|
494
|
+
* @see https://global-docs.upbit.com/reference/listing-market-list
|
|
494
495
|
* @description retrieves data on all markets for upbit
|
|
495
496
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
496
497
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -586,7 +587,8 @@ class upbit extends upbit$1 {
|
|
|
586
587
|
/**
|
|
587
588
|
* @method
|
|
588
589
|
* @name upbit#fetchBalance
|
|
589
|
-
* @see https://docs.upbit.com/reference
|
|
590
|
+
* @see https://docs.upbit.com/kr/reference/전체-계좌-조회
|
|
591
|
+
* @see https://global-docs.upbit.com/reference/overall-account-inquiry
|
|
590
592
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
591
593
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
592
594
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
@@ -611,7 +613,8 @@ class upbit extends upbit$1 {
|
|
|
611
613
|
/**
|
|
612
614
|
* @method
|
|
613
615
|
* @name upbit#fetchOrderBooks
|
|
614
|
-
* @see https://docs.upbit.com/reference
|
|
616
|
+
* @see https://docs.upbit.com/kr/reference/호가-정보-조회
|
|
617
|
+
* @see https://global-docs.upbit.com/reference/order-book-list
|
|
615
618
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
|
|
616
619
|
* @param {string[]|undefined} symbols list of unified market symbols, all symbols fetched if undefined, default is undefined
|
|
617
620
|
* @param {int} [limit] not used by upbit fetchOrderBooks ()
|
|
@@ -680,7 +683,8 @@ class upbit extends upbit$1 {
|
|
|
680
683
|
/**
|
|
681
684
|
* @method
|
|
682
685
|
* @name upbit#fetchOrderBook
|
|
683
|
-
* @see https://docs.upbit.com/reference
|
|
686
|
+
* @see https://docs.upbit.com/kr/reference/호가-정보-조회
|
|
687
|
+
* @see https://global-docs.upbit.com/reference/order-book-list
|
|
684
688
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
685
689
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
686
690
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -750,7 +754,8 @@ class upbit extends upbit$1 {
|
|
|
750
754
|
/**
|
|
751
755
|
* @method
|
|
752
756
|
* @name upbit#fetchTickers
|
|
753
|
-
* @see https://docs.upbit.com/reference/ticker
|
|
757
|
+
* @see https://docs.upbit.com/kr/reference/ticker현재가-정보
|
|
758
|
+
* @see https://global-docs.upbit.com/reference/tickers
|
|
754
759
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
755
760
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
756
761
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -810,7 +815,8 @@ class upbit extends upbit$1 {
|
|
|
810
815
|
/**
|
|
811
816
|
* @method
|
|
812
817
|
* @name upbit#fetchTicker
|
|
813
|
-
* @see https://docs.upbit.com/reference/ticker
|
|
818
|
+
* @see https://docs.upbit.com/kr/reference/ticker현재가-정보
|
|
819
|
+
* @see https://global-docs.upbit.com/reference/tickers
|
|
814
820
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
815
821
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
816
822
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -895,7 +901,8 @@ class upbit extends upbit$1 {
|
|
|
895
901
|
/**
|
|
896
902
|
* @method
|
|
897
903
|
* @name upbit#fetchTrades
|
|
898
|
-
* @see https://docs.upbit.com/reference
|
|
904
|
+
* @see https://docs.upbit.com/kr/reference/최근-체결-내역
|
|
905
|
+
* @see https://global-docs.upbit.com/reference/today-trades-history
|
|
899
906
|
* @description get the list of most recent trades for a particular symbol
|
|
900
907
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
901
908
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -941,7 +948,8 @@ class upbit extends upbit$1 {
|
|
|
941
948
|
/**
|
|
942
949
|
* @method
|
|
943
950
|
* @name upbit#fetchTradingFee
|
|
944
|
-
* @see https://docs.upbit.com/reference
|
|
951
|
+
* @see https://docs.upbit.com/kr/reference/주문-가능-정보
|
|
952
|
+
* @see https://global-docs.upbit.com/reference/available-order-information
|
|
945
953
|
* @description fetch the trading fees for a market
|
|
946
954
|
* @param {string} symbol unified market symbol
|
|
947
955
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -972,7 +980,7 @@ class upbit extends upbit$1 {
|
|
|
972
980
|
// },
|
|
973
981
|
// "bid_account": {
|
|
974
982
|
// "currency": "KRW",
|
|
975
|
-
// "balance": "0.
|
|
983
|
+
// "balance": "0.34202415",
|
|
976
984
|
// "locked": "4999.99999922",
|
|
977
985
|
// "avg_buy_price": "0",
|
|
978
986
|
// "avg_buy_price_modified": true,
|
|
@@ -1054,7 +1062,8 @@ class upbit extends upbit$1 {
|
|
|
1054
1062
|
/**
|
|
1055
1063
|
* @method
|
|
1056
1064
|
* @name upbit#fetchOHLCV
|
|
1057
|
-
* @see https://docs.upbit.com/reference
|
|
1065
|
+
* @see https://docs.upbit.com/kr/reference/분minute-캔들-1
|
|
1066
|
+
* @see https://global-docs.upbit.com/reference/minutes
|
|
1058
1067
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1059
1068
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1060
1069
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -1149,7 +1158,7 @@ class upbit extends upbit$1 {
|
|
|
1149
1158
|
* @method
|
|
1150
1159
|
* @name upbit#createOrder
|
|
1151
1160
|
* @description create a trade order
|
|
1152
|
-
* @see https://docs.upbit.com/reference
|
|
1161
|
+
* @see https://docs.upbit.com/kr/reference/주문하기
|
|
1153
1162
|
* @see https://global-docs.upbit.com/reference/order
|
|
1154
1163
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1155
1164
|
* @param {string} type supports 'market' and 'limit'. if params.ordType is set to best, a best-type order will be created regardless of the value of type.
|
|
@@ -1262,7 +1271,8 @@ class upbit extends upbit$1 {
|
|
|
1262
1271
|
/**
|
|
1263
1272
|
* @method
|
|
1264
1273
|
* @name upbit#cancelOrder
|
|
1265
|
-
* @see https://docs.upbit.com/reference
|
|
1274
|
+
* @see https://docs.upbit.com/kr/reference/주문-취소
|
|
1275
|
+
* @see https://global-docs.upbit.com/reference/order-cancel
|
|
1266
1276
|
* @description cancels an open order
|
|
1267
1277
|
* @param {string} id order id
|
|
1268
1278
|
* @param {string} symbol not used by upbit cancelOrder ()
|
|
@@ -1299,7 +1309,8 @@ class upbit extends upbit$1 {
|
|
|
1299
1309
|
/**
|
|
1300
1310
|
* @method
|
|
1301
1311
|
* @name upbit#editOrder
|
|
1302
|
-
* @see https://docs.upbit.com/reference
|
|
1312
|
+
* @see https://docs.upbit.com/kr/reference/취소-후-재주문
|
|
1313
|
+
* @see https://global-docs.upbit.com/reference/cancel-and-new
|
|
1303
1314
|
* @description canceled existing order and create new order. It's only generated same side and symbol as the canceled order. it returns the data of the canceled order, except for `new_order_uuid` and `new_identifier`. to get the details of the new order, use `fetchOrder(new_order_uuid)`.
|
|
1304
1315
|
* @param {string} id the uuid of the previous order you want to edit.
|
|
1305
1316
|
* @param {string} symbol the symbol of the new order. it must be the same as the symbol of the previous order.
|
|
@@ -1418,7 +1429,8 @@ class upbit extends upbit$1 {
|
|
|
1418
1429
|
/**
|
|
1419
1430
|
* @method
|
|
1420
1431
|
* @name upbit#fetchDeposits
|
|
1421
|
-
* @see https://docs.upbit.com/reference
|
|
1432
|
+
* @see https://docs.upbit.com/kr/reference/입금-리스트-조회
|
|
1433
|
+
* @see https://global-docs.upbit.com/reference/deposit-list-inquiry
|
|
1422
1434
|
* @description fetch all deposits made to an account
|
|
1423
1435
|
* @param {string} code unified currency code
|
|
1424
1436
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
@@ -1463,6 +1475,7 @@ class upbit extends upbit$1 {
|
|
|
1463
1475
|
* @method
|
|
1464
1476
|
* @name upbit#fetchDeposit
|
|
1465
1477
|
* @description fetch information on a deposit
|
|
1478
|
+
* @see https://docs.upbit.com/kr/reference/개별-입금-조회
|
|
1466
1479
|
* @see https://global-docs.upbit.com/reference/individual-deposit-inquiry
|
|
1467
1480
|
* @param {string} id the unique id for the deposit
|
|
1468
1481
|
* @param {string} [code] unified currency code of the currency deposited
|
|
@@ -1501,7 +1514,8 @@ class upbit extends upbit$1 {
|
|
|
1501
1514
|
/**
|
|
1502
1515
|
* @method
|
|
1503
1516
|
* @name upbit#fetchWithdrawals
|
|
1504
|
-
* @see https://docs.upbit.com/reference
|
|
1517
|
+
* @see https://docs.upbit.com/kr/reference/전체-출금-조회
|
|
1518
|
+
* @see https://global-docs.upbit.com/reference/withdrawal-list-inquiry
|
|
1505
1519
|
* @description fetch all withdrawals made from an account
|
|
1506
1520
|
* @param {string} code unified currency code
|
|
1507
1521
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
@@ -1546,6 +1560,7 @@ class upbit extends upbit$1 {
|
|
|
1546
1560
|
* @method
|
|
1547
1561
|
* @name upbit#fetchWithdrawal
|
|
1548
1562
|
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
1563
|
+
* @see https://docs.upbit.com/kr/reference/개별-출금-조회
|
|
1549
1564
|
* @see https://global-docs.upbit.com/reference/individual-withdrawal-inquiry
|
|
1550
1565
|
* @param {string} id the unique id for the withdrawal
|
|
1551
1566
|
* @param {string} [code] unified currency code of the currency withdrawn
|
|
@@ -1845,6 +1860,7 @@ class upbit extends upbit$1 {
|
|
|
1845
1860
|
* @method
|
|
1846
1861
|
* @name upbit#fetchOpenOrders
|
|
1847
1862
|
* @description fetch all unfilled currently open orders
|
|
1863
|
+
* @see https://docs.upbit.com/kr/reference/대기-주문-조회
|
|
1848
1864
|
* @see https://global-docs.upbit.com/reference/open-order
|
|
1849
1865
|
* @param {string} symbol unified market symbol
|
|
1850
1866
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
@@ -1893,6 +1909,7 @@ class upbit extends upbit$1 {
|
|
|
1893
1909
|
* @method
|
|
1894
1910
|
* @name upbit#fetchClosedOrders
|
|
1895
1911
|
* @description fetches information on multiple closed orders made by the user
|
|
1912
|
+
* @see https://docs.upbit.com/kr/reference/종료-주문-조회
|
|
1896
1913
|
* @see https://global-docs.upbit.com/reference/closed-order
|
|
1897
1914
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1898
1915
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -1948,6 +1965,7 @@ class upbit extends upbit$1 {
|
|
|
1948
1965
|
* @method
|
|
1949
1966
|
* @name upbit#fetchCanceledOrders
|
|
1950
1967
|
* @description fetches information on multiple canceled orders made by the user
|
|
1968
|
+
* @see https://docs.upbit.com/kr/reference/종료-주문-조회
|
|
1951
1969
|
* @see https://global-docs.upbit.com/reference/closed-order
|
|
1952
1970
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1953
1971
|
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
@@ -2002,7 +2020,8 @@ class upbit extends upbit$1 {
|
|
|
2002
2020
|
/**
|
|
2003
2021
|
* @method
|
|
2004
2022
|
* @name upbit#fetchOrder
|
|
2005
|
-
* @see https://docs.upbit.com/reference
|
|
2023
|
+
* @see https://docs.upbit.com/kr/reference/개별-주문-조회
|
|
2024
|
+
* @see https://global-docs.upbit.com/reference/individual-order-inquiry
|
|
2006
2025
|
* @description fetches information on an order made by the user
|
|
2007
2026
|
* @param {string} id order id
|
|
2008
2027
|
* @param {string} symbol not used by upbit fetchOrder
|
|
@@ -2063,7 +2082,8 @@ class upbit extends upbit$1 {
|
|
|
2063
2082
|
/**
|
|
2064
2083
|
* @method
|
|
2065
2084
|
* @name upbit#fetchDepositAddresses
|
|
2066
|
-
* @see https://docs.upbit.com/reference
|
|
2085
|
+
* @see https://docs.upbit.com/kr/reference/전체-입금-주소-조회
|
|
2086
|
+
* @see https://global-docs.upbit.com/reference/general-deposit-address-inquiry
|
|
2067
2087
|
* @description fetch deposit addresses for multiple currencies and chain types
|
|
2068
2088
|
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
2069
2089
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2119,7 +2139,8 @@ class upbit extends upbit$1 {
|
|
|
2119
2139
|
/**
|
|
2120
2140
|
* @method
|
|
2121
2141
|
* @name upbit#fetchDepositAddress
|
|
2122
|
-
* @see https://docs.upbit.com/reference
|
|
2142
|
+
* @see https://docs.upbit.com/kr/reference/개별-입금-주소-조회
|
|
2143
|
+
* @see https://global-docs.upbit.com/reference/individual-deposit-address-inquiry
|
|
2123
2144
|
* @description fetch the deposit address for a currency associated with this account
|
|
2124
2145
|
* @param {string} code unified currency code
|
|
2125
2146
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2151,7 +2172,8 @@ class upbit extends upbit$1 {
|
|
|
2151
2172
|
/**
|
|
2152
2173
|
* @method
|
|
2153
2174
|
* @name upbit#createDepositAddress
|
|
2154
|
-
* @see https://docs.upbit.com/reference
|
|
2175
|
+
* @see https://docs.upbit.com/kr/reference/입금-주소-생성-요청
|
|
2176
|
+
* @see https://global-docs.upbit.com/reference/deposit-address-generation
|
|
2155
2177
|
* @description create a currency deposit address
|
|
2156
2178
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
2157
2179
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2189,8 +2211,8 @@ class upbit extends upbit$1 {
|
|
|
2189
2211
|
/**
|
|
2190
2212
|
* @method
|
|
2191
2213
|
* @name upbit#withdraw
|
|
2192
|
-
* @see https://docs.upbit.com/reference/디지털자산-출금하기
|
|
2193
|
-
* @see https://docs.upbit.com/reference
|
|
2214
|
+
* @see https://docs.upbit.com/kr/reference/디지털자산-출금하기
|
|
2215
|
+
* @see https://global-docs.upbit.com/reference/withdrawal-digital-assets
|
|
2194
2216
|
* @description make a withdrawal
|
|
2195
2217
|
* @param {string} code unified currency code
|
|
2196
2218
|
* @param {float} amount the amount to withdraw
|