ccxt 4.3.68 → 4.3.70
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 -6
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +3 -1
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +365 -353
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bingx.js +134 -75
- package/dist/cjs/src/blofin.js +63 -6
- package/dist/cjs/src/btcbox.js +2 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbaseinternational.js +247 -3
- package/dist/cjs/src/cryptocom.js +9 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/hyperliquid.js +0 -3
- package/dist/cjs/src/kucoin.js +12 -5
- package/dist/cjs/src/oxfun.js +2 -2
- package/dist/cjs/src/poloniex.js +34 -33
- package/dist/cjs/src/poloniexfutures.js +26 -26
- package/dist/cjs/src/pro/blofin.js +665 -0
- package/dist/cjs/src/pro/coinbaseinternational.js +154 -9
- package/dist/cjs/src/pro/cryptocom.js +3 -1
- package/dist/cjs/src/pro/hitbtc.js +26 -8
- package/dist/cjs/src/pro/okx.js +7 -0
- package/dist/cjs/src/pro/poloniex.js +50 -25
- package/dist/cjs/src/pro/poloniexfutures.js +5 -5
- package/dist/cjs/src/pro/woo.js +5 -4
- package/js/ccxt.d.ts +6 -3
- package/js/ccxt.js +3 -1
- package/js/src/abstract/coinbaseinternational.d.ts +1 -1
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +108 -82
- package/js/src/base/Exchange.js +365 -353
- package/js/src/base/types.d.ts +0 -2
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +1 -1
- package/js/src/bingx.d.ts +2 -2
- package/js/src/bingx.js +134 -75
- package/js/src/bitget.d.ts +2 -2
- package/js/src/bitmart.d.ts +2 -2
- package/js/src/bitrue.d.ts +2 -2
- package/js/src/blofin.d.ts +1 -1
- package/js/src/blofin.js +63 -6
- package/js/src/btcbox.js +2 -1
- package/js/src/bybit.d.ts +2 -2
- package/js/src/bybit.js +1 -1
- package/js/src/coinbaseinternational.d.ts +17 -1
- package/js/src/coinbaseinternational.js +247 -3
- package/js/src/coinex.d.ts +2 -2
- package/js/src/coinlist.d.ts +2 -2
- package/js/src/cryptocom.js +10 -2
- package/js/src/deribit.d.ts +2 -2
- package/js/src/digifinex.d.ts +2 -2
- package/js/src/hitbtc.js +1 -1
- package/js/src/hyperliquid.js +0 -3
- package/js/src/kucoin.js +12 -5
- package/js/src/latoken.d.ts +2 -2
- package/js/src/mexc.d.ts +2 -2
- package/js/src/okx.d.ts +2 -2
- package/js/src/oxfun.d.ts +1 -1
- package/js/src/oxfun.js +2 -2
- package/js/src/phemex.d.ts +2 -2
- package/js/src/poloniex.js +34 -33
- package/js/src/poloniexfutures.js +26 -26
- package/js/src/pro/blofin.d.ts +39 -0
- package/js/src/pro/blofin.js +668 -0
- package/js/src/pro/coinbaseinternational.d.ts +5 -1
- package/js/src/pro/coinbaseinternational.js +155 -10
- package/js/src/pro/cryptocom.js +4 -2
- package/js/src/pro/hitbtc.d.ts +1 -1
- package/js/src/pro/hitbtc.js +26 -8
- package/js/src/pro/okx.js +7 -0
- package/js/src/pro/poloniex.js +50 -25
- package/js/src/pro/poloniexfutures.js +5 -5
- package/js/src/pro/woo.js +5 -4
- package/js/src/woo.d.ts +2 -2
- package/package.json +1 -1
|
@@ -19,12 +19,12 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
19
19
|
'watchTicker': true,
|
|
20
20
|
'watchBalance': false,
|
|
21
21
|
'watchMyTrades': false,
|
|
22
|
-
'watchOHLCV':
|
|
22
|
+
'watchOHLCV': true,
|
|
23
23
|
'watchOHLCVForSymbols': false,
|
|
24
24
|
'watchOrders': false,
|
|
25
25
|
'watchOrdersForSymbols': false,
|
|
26
26
|
'watchPositions': false,
|
|
27
|
-
'watchTickers':
|
|
27
|
+
'watchTickers': true,
|
|
28
28
|
'createOrderWs': false,
|
|
29
29
|
'editOrderWs': false,
|
|
30
30
|
'cancelOrderWs': false,
|
|
@@ -50,6 +50,14 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
50
50
|
'tradesLimit': 1000,
|
|
51
51
|
'ordersLimit': 1000,
|
|
52
52
|
'myTradesLimit': 1000,
|
|
53
|
+
'timeframes': {
|
|
54
|
+
'1m': 'CANDLES_ONE_MINUTE',
|
|
55
|
+
'5m': 'CANDLES_FIVE_MINUTES',
|
|
56
|
+
'30m': 'CANDLES_THIRTY_MINUTES',
|
|
57
|
+
'1h': 'CANDLES_ONE_HOUR',
|
|
58
|
+
'2h': 'CANDLES_TWO_HOURS',
|
|
59
|
+
'1d': 'CANDLES_ONE_DAY',
|
|
60
|
+
},
|
|
53
61
|
},
|
|
54
62
|
'exceptions': {
|
|
55
63
|
'exact': {
|
|
@@ -73,16 +81,20 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
73
81
|
this.checkRequiredCredentials();
|
|
74
82
|
let market = undefined;
|
|
75
83
|
let messageHash = name;
|
|
76
|
-
let productIds =
|
|
84
|
+
let productIds = undefined;
|
|
77
85
|
if (symbols === undefined) {
|
|
78
|
-
symbols = this.
|
|
86
|
+
symbols = this.getActiveSymbols();
|
|
79
87
|
}
|
|
80
88
|
const symbolsLength = symbols.length;
|
|
89
|
+
const messageHashes = [];
|
|
81
90
|
if (symbolsLength > 1) {
|
|
82
91
|
const parsedSymbols = this.marketSymbols(symbols);
|
|
83
92
|
const marketIds = this.marketIds(parsedSymbols);
|
|
84
93
|
productIds = marketIds;
|
|
85
|
-
|
|
94
|
+
for (let i = 0; i < parsedSymbols.length; i++) {
|
|
95
|
+
messageHashes.push(name + '::' + parsedSymbols[i]);
|
|
96
|
+
}
|
|
97
|
+
// messageHash = messageHash + '::' + parsedSymbols.join (',');
|
|
86
98
|
}
|
|
87
99
|
else if (symbolsLength === 1) {
|
|
88
100
|
market = this.market(symbols[0]);
|
|
@@ -98,13 +110,19 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
98
110
|
const signature = this.hmac(this.encode(auth), this.base64ToBinary(this.secret), sha256.sha256, 'base64');
|
|
99
111
|
const subscribe = {
|
|
100
112
|
'type': 'SUBSCRIBE',
|
|
101
|
-
'product_ids': productIds,
|
|
113
|
+
// 'product_ids': productIds,
|
|
102
114
|
'channels': [name],
|
|
103
115
|
'time': timestamp,
|
|
104
116
|
'key': this.apiKey,
|
|
105
117
|
'passphrase': this.password,
|
|
106
118
|
'signature': signature,
|
|
107
119
|
};
|
|
120
|
+
if (productIds !== undefined) {
|
|
121
|
+
subscribe['product_ids'] = productIds;
|
|
122
|
+
}
|
|
123
|
+
if (symbolsLength > 1) {
|
|
124
|
+
return await this.watchMultiple(url, messageHashes, this.extend(subscribe, params), messageHashes);
|
|
125
|
+
}
|
|
108
126
|
return await this.watch(url, messageHash, this.extend(subscribe, params), messageHash);
|
|
109
127
|
}
|
|
110
128
|
async subscribeMultiple(name, symbols = undefined, params = {}) {
|
|
@@ -193,6 +211,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
193
211
|
* @see https://docs.cloud.coinbase.com/intx/docs/websocket-channels#instruments-channel
|
|
194
212
|
* @param {string} [symbol] unified symbol of the market to fetch the ticker for
|
|
195
213
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
214
|
+
* @param {string} [params.channel] the channel to watch, 'LEVEL1' or 'INSTRUMENTS', default is 'LEVEL1'
|
|
196
215
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
197
216
|
*/
|
|
198
217
|
await this.loadMarkets();
|
|
@@ -200,6 +219,40 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
200
219
|
[channel, params] = this.handleOptionAndParams(params, 'watchTicker', 'channel', 'LEVEL1');
|
|
201
220
|
return await this.subscribe(channel, [symbol], params);
|
|
202
221
|
}
|
|
222
|
+
getActiveSymbols() {
|
|
223
|
+
const symbols = this.symbols;
|
|
224
|
+
const output = [];
|
|
225
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
226
|
+
const symbol = symbols[i];
|
|
227
|
+
const market = this.markets[symbol];
|
|
228
|
+
if (market['active']) {
|
|
229
|
+
output.push(symbol);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return output;
|
|
233
|
+
}
|
|
234
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
235
|
+
/**
|
|
236
|
+
* @method
|
|
237
|
+
* @name coinbaseinternational#watchTickers
|
|
238
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
239
|
+
* @see https://docs.cloud.coinbase.com/intx/docs/websocket-channels#instruments-channel
|
|
240
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
241
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
242
|
+
* @param {string} [params.channel] the channel to watch, 'LEVEL1' or 'INSTRUMENTS', default is 'INSTLEVEL1UMENTS'
|
|
243
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
244
|
+
*/
|
|
245
|
+
await this.loadMarkets();
|
|
246
|
+
let channel = undefined;
|
|
247
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchTickers', 'channel', 'LEVEL1');
|
|
248
|
+
const ticker = await this.subscribe(channel, symbols, params);
|
|
249
|
+
if (this.newUpdates) {
|
|
250
|
+
const result = {};
|
|
251
|
+
result[ticker['symbol']] = ticker;
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
255
|
+
}
|
|
203
256
|
handleInstrument(client, message) {
|
|
204
257
|
//
|
|
205
258
|
// {
|
|
@@ -257,6 +310,33 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
257
310
|
// "channel":"INSTRUMENTS",
|
|
258
311
|
// "type":"SNAPSHOT"
|
|
259
312
|
// }
|
|
313
|
+
// instruments
|
|
314
|
+
// {
|
|
315
|
+
// sequence: 0,
|
|
316
|
+
// instrument_type: 'PERP',
|
|
317
|
+
// instrument_mode: 'standard',
|
|
318
|
+
// base_asset_name: 'BTC',
|
|
319
|
+
// quote_asset_name: 'USDC',
|
|
320
|
+
// base_increment: '0.0001',
|
|
321
|
+
// quote_increment: '0.1',
|
|
322
|
+
// avg_daily_quantity: '502.8845',
|
|
323
|
+
// avg_daily_volume: '3.1495242961566668E7',
|
|
324
|
+
// total30_day_quantity: '15086.535',
|
|
325
|
+
// total30_day_volume: '9.44857288847E8',
|
|
326
|
+
// total24_hour_quantity: '5.0',
|
|
327
|
+
// total24_hour_volume: '337016.5',
|
|
328
|
+
// base_imf: '0.1',
|
|
329
|
+
// min_quantity: '0.0001',
|
|
330
|
+
// position_size_limit: '800',
|
|
331
|
+
// funding_interval: '3600000000000',
|
|
332
|
+
// trading_state: 'trading',
|
|
333
|
+
// last_updated_time: '2024-07-30T15:00:00Z',
|
|
334
|
+
// default_initial_margin: '0.2',
|
|
335
|
+
// base_asset_multiplier: '1.0',
|
|
336
|
+
// channel: 'INSTRUMENTS',
|
|
337
|
+
// type: 'SNAPSHOT',
|
|
338
|
+
// time: '2024-07-30T15:26:56.766Z',
|
|
339
|
+
// }
|
|
260
340
|
//
|
|
261
341
|
const marketId = this.safeString(ticker, 'product_id');
|
|
262
342
|
const datetime = this.safeString(ticker, 'time');
|
|
@@ -279,8 +359,8 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
279
359
|
'change': undefined,
|
|
280
360
|
'percentage': undefined,
|
|
281
361
|
'average': undefined,
|
|
282
|
-
'baseVolume': this.
|
|
283
|
-
'quoteVolume': this.
|
|
362
|
+
'baseVolume': this.safeString2(ticker, 'total_24_hour_quantity', 'total24_hour_quantity'),
|
|
363
|
+
'quoteVolume': this.safeString2(ticker, 'total_24_hour_volume', 'total24_hour_volume'),
|
|
284
364
|
});
|
|
285
365
|
}
|
|
286
366
|
handleTicker(client, message) {
|
|
@@ -352,6 +432,68 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
352
432
|
'previousClose': undefined,
|
|
353
433
|
});
|
|
354
434
|
}
|
|
435
|
+
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
436
|
+
/**
|
|
437
|
+
* @method
|
|
438
|
+
* @name coinbaseinternational#watchOHLCV
|
|
439
|
+
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
440
|
+
* @see https://docs.cdp.coinbase.com/intx/docs/websocket-channels#candles-channel
|
|
441
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
442
|
+
* @param {string} timeframe the length of time each candle represents
|
|
443
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
444
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
445
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
446
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
447
|
+
*/
|
|
448
|
+
await this.loadMarkets();
|
|
449
|
+
const market = this.market(symbol);
|
|
450
|
+
symbol = market['symbol'];
|
|
451
|
+
const options = this.safeDict(this.options, 'timeframes', {});
|
|
452
|
+
const interval = this.safeString(options, timeframe, timeframe);
|
|
453
|
+
const ohlcv = await this.subscribe(interval, [symbol], params);
|
|
454
|
+
if (this.newUpdates) {
|
|
455
|
+
limit = ohlcv.getLimit(symbol, limit);
|
|
456
|
+
}
|
|
457
|
+
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
458
|
+
}
|
|
459
|
+
handleOHLCV(client, message) {
|
|
460
|
+
//
|
|
461
|
+
// {
|
|
462
|
+
// "sequence": 0,
|
|
463
|
+
// "product_id": "BTC-PERP",
|
|
464
|
+
// "channel": "CANDLES_ONE_MINUTE",
|
|
465
|
+
// "type": "SNAPSHOT",
|
|
466
|
+
// "candles": [
|
|
467
|
+
// {
|
|
468
|
+
// "time": "2023-05-10T14:58:47.000Z",
|
|
469
|
+
// "low": "28787.8",
|
|
470
|
+
// "high": "28788.8",
|
|
471
|
+
// "open": "28788.8",
|
|
472
|
+
// "close": "28787.8",
|
|
473
|
+
// "volume": "0.466"
|
|
474
|
+
// },
|
|
475
|
+
// ]
|
|
476
|
+
// }
|
|
477
|
+
//
|
|
478
|
+
const messageHash = this.safeString(message, 'channel');
|
|
479
|
+
const marketId = this.safeString(message, 'product_id');
|
|
480
|
+
const market = this.safeMarket(marketId);
|
|
481
|
+
const symbol = market['symbol'];
|
|
482
|
+
const timeframe = this.findTimeframe(messageHash);
|
|
483
|
+
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
|
484
|
+
if (this.safeValue(this.ohlcvs[symbol], timeframe) === undefined) {
|
|
485
|
+
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
486
|
+
this.ohlcvs[symbol][timeframe] = new Cache.ArrayCacheByTimestamp(limit);
|
|
487
|
+
}
|
|
488
|
+
const stored = this.ohlcvs[symbol][timeframe];
|
|
489
|
+
const data = this.safeList(message, 'candles', []);
|
|
490
|
+
for (let i = 0; i < data.length; i++) {
|
|
491
|
+
const tick = data[i];
|
|
492
|
+
const parsed = this.parseOHLCV(tick, market);
|
|
493
|
+
stored.append(parsed);
|
|
494
|
+
}
|
|
495
|
+
client.resolve(stored, messageHash + '::' + symbol);
|
|
496
|
+
}
|
|
355
497
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
356
498
|
/**
|
|
357
499
|
* @method
|
|
@@ -633,7 +775,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
633
775
|
if (this.handleErrorMessage(client, message)) {
|
|
634
776
|
return;
|
|
635
777
|
}
|
|
636
|
-
const channel = this.safeString(message, 'channel');
|
|
778
|
+
const channel = this.safeString(message, 'channel', '');
|
|
637
779
|
const methods = {
|
|
638
780
|
'SUBSCRIPTIONS': this.handleSubscriptionStatus,
|
|
639
781
|
'INSTRUMENTS': this.handleInstrument,
|
|
@@ -648,6 +790,9 @@ class coinbaseinternational extends coinbaseinternational$1 {
|
|
|
648
790
|
const errorMessage = this.safeString(message, 'message');
|
|
649
791
|
throw new errors.ExchangeError(errorMessage);
|
|
650
792
|
}
|
|
793
|
+
if (channel.indexOf('CANDLES') > -1) {
|
|
794
|
+
this.handleOHLCV(client, message);
|
|
795
|
+
}
|
|
651
796
|
const method = this.safeValue(methods, channel);
|
|
652
797
|
if (method !== undefined) {
|
|
653
798
|
method.call(this, client, message);
|
|
@@ -886,6 +886,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
886
886
|
// "message": "invalid channel {"channels":["trade.BTCUSD-PERP"]}"
|
|
887
887
|
// }
|
|
888
888
|
//
|
|
889
|
+
const id = this.safeString(message, 'id');
|
|
889
890
|
const errorCode = this.safeString(message, 'code');
|
|
890
891
|
try {
|
|
891
892
|
if (errorCode && errorCode !== '0') {
|
|
@@ -895,6 +896,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
895
896
|
if (messageString !== undefined) {
|
|
896
897
|
this.throwBroadlyMatchedException(this.exceptions['broad'], messageString, feedback);
|
|
897
898
|
}
|
|
899
|
+
throw new errors.ExchangeError(feedback);
|
|
898
900
|
}
|
|
899
901
|
return false;
|
|
900
902
|
}
|
|
@@ -907,7 +909,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
907
909
|
}
|
|
908
910
|
}
|
|
909
911
|
else {
|
|
910
|
-
client.reject(e);
|
|
912
|
+
client.reject(e, id);
|
|
911
913
|
}
|
|
912
914
|
return true;
|
|
913
915
|
}
|
|
@@ -1212,7 +1212,9 @@ class hitbtc extends hitbtc$1 {
|
|
|
1212
1212
|
return message;
|
|
1213
1213
|
}
|
|
1214
1214
|
handleMessage(client, message) {
|
|
1215
|
-
this.handleError(client, message)
|
|
1215
|
+
if (this.handleError(client, message)) {
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1216
1218
|
let channel = this.safeString2(message, 'ch', 'method');
|
|
1217
1219
|
if (channel !== undefined) {
|
|
1218
1220
|
const splitChannel = channel.split('/');
|
|
@@ -1291,13 +1293,29 @@ class hitbtc extends hitbtc$1 {
|
|
|
1291
1293
|
//
|
|
1292
1294
|
const error = this.safeValue(message, 'error');
|
|
1293
1295
|
if (error !== undefined) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1296
|
+
try {
|
|
1297
|
+
const code = this.safeValue(error, 'code');
|
|
1298
|
+
const errorMessage = this.safeString(error, 'message');
|
|
1299
|
+
const description = this.safeString(error, 'description');
|
|
1300
|
+
const feedback = this.id + ' ' + description;
|
|
1301
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
|
|
1302
|
+
this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
|
|
1303
|
+
throw new errors.ExchangeError(feedback); // unknown message
|
|
1304
|
+
}
|
|
1305
|
+
catch (e) {
|
|
1306
|
+
if (e instanceof errors.AuthenticationError) {
|
|
1307
|
+
const messageHash = 'authenticated';
|
|
1308
|
+
client.reject(e, messageHash);
|
|
1309
|
+
if (messageHash in client.subscriptions) {
|
|
1310
|
+
delete client.subscriptions[messageHash];
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
else {
|
|
1314
|
+
const id = this.safeString(message, 'id');
|
|
1315
|
+
client.reject(e, id);
|
|
1316
|
+
}
|
|
1317
|
+
return true;
|
|
1318
|
+
}
|
|
1301
1319
|
}
|
|
1302
1320
|
return undefined;
|
|
1303
1321
|
}
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -1896,6 +1896,13 @@ class okx extends okx$1 {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
1898
|
catch (e) {
|
|
1899
|
+
// if the message contains an id, it means it is a response to a request
|
|
1900
|
+
// so we only reject that promise, instead of deleting all futures, destroying the authentication future
|
|
1901
|
+
const id = this.safeString(message, 'id');
|
|
1902
|
+
if (id !== undefined) {
|
|
1903
|
+
client.reject(e, id);
|
|
1904
|
+
return false;
|
|
1905
|
+
}
|
|
1899
1906
|
client.reject(e);
|
|
1900
1907
|
return false;
|
|
1901
1908
|
}
|
|
@@ -78,7 +78,7 @@ class poloniex extends poloniex$1 {
|
|
|
78
78
|
* @ignore
|
|
79
79
|
* @method
|
|
80
80
|
* @description authenticates the user to access private web socket channels
|
|
81
|
-
* @see https://docs.poloniex.com
|
|
81
|
+
* @see https://api-docs.poloniex.com/spot/websocket/authentication
|
|
82
82
|
* @returns {object} response from exchange
|
|
83
83
|
*/
|
|
84
84
|
this.checkRequiredCredentials();
|
|
@@ -184,7 +184,7 @@ class poloniex extends poloniex$1 {
|
|
|
184
184
|
/**
|
|
185
185
|
* @method
|
|
186
186
|
* @name poloniex#createOrderWs
|
|
187
|
-
* @see https://docs.poloniex.com
|
|
187
|
+
* @see https://api-docs.poloniex.com/spot/websocket/trade-request#create-order
|
|
188
188
|
* @description create a trade order
|
|
189
189
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
190
190
|
* @param {string} type 'market' or 'limit'
|
|
@@ -254,7 +254,7 @@ class poloniex extends poloniex$1 {
|
|
|
254
254
|
/**
|
|
255
255
|
* @method
|
|
256
256
|
* @name poloniex#cancelOrderWs
|
|
257
|
-
* @see https://docs.poloniex.com
|
|
257
|
+
* @see https://api-docs.poloniex.com/spot/websocket/trade-request#cancel-multiple-orders
|
|
258
258
|
* @description cancel multiple orders
|
|
259
259
|
* @param {string} id order id
|
|
260
260
|
* @param {string} [symbol] unified market symbol
|
|
@@ -273,7 +273,7 @@ class poloniex extends poloniex$1 {
|
|
|
273
273
|
/**
|
|
274
274
|
* @method
|
|
275
275
|
* @name poloniex#cancelOrdersWs
|
|
276
|
-
* @see https://docs.poloniex.com
|
|
276
|
+
* @see https://api-docs.poloniex.com/spot/websocket/trade-request#cancel-multiple-orders
|
|
277
277
|
* @description cancel multiple orders
|
|
278
278
|
* @param {string[]} ids order ids
|
|
279
279
|
* @param {string} symbol unified market symbol, default is undefined
|
|
@@ -292,7 +292,7 @@ class poloniex extends poloniex$1 {
|
|
|
292
292
|
/**
|
|
293
293
|
* @method
|
|
294
294
|
* @name poloniex#cancelAllOrdersWs
|
|
295
|
-
* @see https://docs.poloniex.com
|
|
295
|
+
* @see https://api-docs.poloniex.com/spot/websocket/trade-request#cancel-all-orders
|
|
296
296
|
* @description cancel all open orders of a type. Only applicable to Option in Portfolio Margin mode, and MMP privilege is required.
|
|
297
297
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
298
298
|
* @param {object} [params] extra parameters specific to the poloniex api endpoint
|
|
@@ -329,7 +329,7 @@ class poloniex extends poloniex$1 {
|
|
|
329
329
|
* @method
|
|
330
330
|
* @name poloniex#watchOHLCV
|
|
331
331
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
332
|
-
* @see https://docs.poloniex.com
|
|
332
|
+
* @see https://api-docs.poloniex.com/spot/websocket/market-data#candlesticks
|
|
333
333
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
334
334
|
* @param {string} timeframe the length of time each candle represents
|
|
335
335
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -354,7 +354,7 @@ class poloniex extends poloniex$1 {
|
|
|
354
354
|
* @method
|
|
355
355
|
* @name poloniex#watchTicker
|
|
356
356
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
357
|
-
* @see https://docs.poloniex.com
|
|
357
|
+
* @see https://api-docs.poloniex.com/spot/websocket/market-data#ticker
|
|
358
358
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
359
359
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
360
360
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -369,7 +369,7 @@ class poloniex extends poloniex$1 {
|
|
|
369
369
|
* @method
|
|
370
370
|
* @name poloniex#watchTicker
|
|
371
371
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
372
|
-
* @see https://docs.poloniex.com
|
|
372
|
+
* @see https://api-docs.poloniex.com/spot/websocket/market-data#ticker
|
|
373
373
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
374
374
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
375
375
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -388,7 +388,7 @@ class poloniex extends poloniex$1 {
|
|
|
388
388
|
* @method
|
|
389
389
|
* @name poloniex#watchTrades
|
|
390
390
|
* @description get the list of most recent trades for a particular symbol
|
|
391
|
-
* @see https://docs.poloniex.com
|
|
391
|
+
* @see https://api-docs.poloniex.com/spot/websocket/market-data#trades
|
|
392
392
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
393
393
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
394
394
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -409,7 +409,7 @@ class poloniex extends poloniex$1 {
|
|
|
409
409
|
* @method
|
|
410
410
|
* @name poloniex#watchOrderBook
|
|
411
411
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
412
|
-
* @see https://docs.poloniex.com
|
|
412
|
+
* @see https://api-docs.poloniex.com/spot/websocket/market-data#book-level-2
|
|
413
413
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
414
414
|
* @param {int} [limit] not used by poloniex watchOrderBook
|
|
415
415
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -427,7 +427,7 @@ class poloniex extends poloniex$1 {
|
|
|
427
427
|
* @method
|
|
428
428
|
* @name poloniex#watchOrders
|
|
429
429
|
* @description watches information on multiple orders made by the user
|
|
430
|
-
* @see https://docs.poloniex.com
|
|
430
|
+
* @see https://api-docs.poloniex.com/spot/websocket/order
|
|
431
431
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
432
432
|
* @param {int} [since] not used by poloniex watchOrders
|
|
433
433
|
* @param {int} [limit] not used by poloniex watchOrders
|
|
@@ -452,7 +452,7 @@ class poloniex extends poloniex$1 {
|
|
|
452
452
|
* @method
|
|
453
453
|
* @name poloniex#watchMyTrades
|
|
454
454
|
* @description watches information on multiple trades made by the user using orders stream
|
|
455
|
-
* @see https://docs.poloniex.com
|
|
455
|
+
* @see https://api-docs.poloniex.com/spot/websocket/order
|
|
456
456
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
457
457
|
* @param {int} [since] not used by poloniex watchMyTrades
|
|
458
458
|
* @param {int} [limit] not used by poloniex watchMyTrades
|
|
@@ -478,7 +478,7 @@ class poloniex extends poloniex$1 {
|
|
|
478
478
|
* @method
|
|
479
479
|
* @name poloniex#watchBalance
|
|
480
480
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
481
|
-
* @see https://docs.poloniex.com
|
|
481
|
+
* @see https://api-docs.poloniex.com/spot/websocket/balance
|
|
482
482
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
483
483
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
484
484
|
*/
|
|
@@ -1176,15 +1176,7 @@ class poloniex extends poloniex$1 {
|
|
|
1176
1176
|
this.handleAuthenticate(client, message);
|
|
1177
1177
|
}
|
|
1178
1178
|
else if (type === undefined) {
|
|
1179
|
-
|
|
1180
|
-
const item = this.safeValue(data, 0);
|
|
1181
|
-
const orderId = this.safeString(item, 'orderId');
|
|
1182
|
-
if (orderId === '0') {
|
|
1183
|
-
this.handleErrorMessage(client, item);
|
|
1184
|
-
}
|
|
1185
|
-
else {
|
|
1186
|
-
this.handleOrderRequest(client, message);
|
|
1187
|
-
}
|
|
1179
|
+
this.handleOrderRequest(client, message);
|
|
1188
1180
|
}
|
|
1189
1181
|
else {
|
|
1190
1182
|
const data = this.safeValue(message, 'data', []);
|
|
@@ -1212,12 +1204,45 @@ class poloniex extends poloniex$1 {
|
|
|
1212
1204
|
// "event": "error",
|
|
1213
1205
|
// "message": "Platform in maintenance mode"
|
|
1214
1206
|
// }
|
|
1207
|
+
// {
|
|
1208
|
+
// "id":"1722386782048",
|
|
1209
|
+
// "data":[
|
|
1210
|
+
// {
|
|
1211
|
+
// "orderId":0,
|
|
1212
|
+
// "clientOrderId":null,
|
|
1213
|
+
// "message":"available insufficient",
|
|
1214
|
+
// "code":21721
|
|
1215
|
+
// }
|
|
1216
|
+
// ]
|
|
1217
|
+
// }
|
|
1215
1218
|
//
|
|
1219
|
+
const id = this.safeString(message, 'id');
|
|
1216
1220
|
const event = this.safeString(message, 'event');
|
|
1217
|
-
const
|
|
1221
|
+
const data = this.safeList(message, 'data');
|
|
1222
|
+
const first = this.safeDict(data, 0);
|
|
1223
|
+
const orderId = this.safeString(first, 'orderId');
|
|
1218
1224
|
if ((event === 'error') || (orderId === '0')) {
|
|
1219
|
-
|
|
1220
|
-
|
|
1225
|
+
try {
|
|
1226
|
+
const error = this.safeString(first, 'message');
|
|
1227
|
+
const code = this.safeString(first, 'code');
|
|
1228
|
+
const feedback = this.id + ' ' + this.json(message);
|
|
1229
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
|
|
1230
|
+
this.throwBroadlyMatchedException(this.exceptions['broad'], error, feedback);
|
|
1231
|
+
throw new errors.ExchangeError(feedback);
|
|
1232
|
+
}
|
|
1233
|
+
catch (e) {
|
|
1234
|
+
if (e instanceof errors.AuthenticationError) {
|
|
1235
|
+
const messageHash = 'authenticated';
|
|
1236
|
+
client.reject(e, messageHash);
|
|
1237
|
+
if (messageHash in client.subscriptions) {
|
|
1238
|
+
delete client.subscriptions[messageHash];
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
client.reject(e, id);
|
|
1243
|
+
}
|
|
1244
|
+
return true;
|
|
1245
|
+
}
|
|
1221
1246
|
}
|
|
1222
1247
|
return false;
|
|
1223
1248
|
}
|
|
@@ -239,7 +239,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
239
239
|
* @method
|
|
240
240
|
* @name poloniexfutures#watchTicker
|
|
241
241
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
242
|
-
* @see https://
|
|
242
|
+
* @see https://api-docs.poloniex.com/futures/websocket/public#get-real-time-symbol-ticker
|
|
243
243
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
244
244
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
245
245
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -254,7 +254,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
254
254
|
* @method
|
|
255
255
|
* @name poloniexfutures#watchTrades
|
|
256
256
|
* @description get the list of most recent trades for a particular symbol
|
|
257
|
-
* @see https://
|
|
257
|
+
* @see https://api-docs.poloniex.com/futures/websocket/public#full-matching-engine-datalevel-3
|
|
258
258
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
259
259
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
260
260
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -277,7 +277,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
277
277
|
* @method
|
|
278
278
|
* @name poloniexfutures#watchOrderBook
|
|
279
279
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
280
|
-
* @see https://
|
|
280
|
+
* @see https://api-docs.poloniex.com/futures/websocket/public#level-2-market-data
|
|
281
281
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
282
282
|
* @param {int} [limit] not used by poloniexfutures watchOrderBook
|
|
283
283
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -307,7 +307,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
307
307
|
* @method
|
|
308
308
|
* @name poloniexfutures#watchOrders
|
|
309
309
|
* @description watches information on multiple orders made by the user
|
|
310
|
-
* @see https://
|
|
310
|
+
* @see https://api-docs.poloniex.com/futures/websocket/user-messages#private-messages
|
|
311
311
|
* @param {string} symbol filter by unified market symbol of the market orders were made in
|
|
312
312
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
313
313
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -334,7 +334,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
334
334
|
* @method
|
|
335
335
|
* @name poloniexfutures#watchBalance
|
|
336
336
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
337
|
-
* @see https://
|
|
337
|
+
* @see https://api-docs.poloniex.com/futures/websocket/user-messages#account-balance-events
|
|
338
338
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
339
339
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
340
340
|
*/
|
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -27,7 +27,7 @@ class woo extends woo$1 {
|
|
|
27
27
|
'api': {
|
|
28
28
|
'ws': {
|
|
29
29
|
'public': 'wss://wss.woo.org/ws/stream',
|
|
30
|
-
'private': 'wss://wss.woo.
|
|
30
|
+
'private': 'wss://wss.woo.org/v2/ws/private/stream',
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
'test': {
|
|
@@ -72,7 +72,8 @@ class woo extends woo$1 {
|
|
|
72
72
|
return newValue;
|
|
73
73
|
}
|
|
74
74
|
async watchPublic(messageHash, message) {
|
|
75
|
-
const
|
|
75
|
+
const urlUid = (this.uid) ? '/' + this.uid : '';
|
|
76
|
+
const url = this.urls['api']['ws']['public'] + urlUid;
|
|
76
77
|
const requestId = this.requestId(url);
|
|
77
78
|
const subscribe = {
|
|
78
79
|
'id': requestId,
|
|
@@ -466,7 +467,7 @@ class woo extends woo$1 {
|
|
|
466
467
|
const marketId = this.safeString(trade, 'symbol');
|
|
467
468
|
market = this.safeMarket(marketId, market);
|
|
468
469
|
const symbol = market['symbol'];
|
|
469
|
-
const price = this.
|
|
470
|
+
const price = this.safeString2(trade, 'executedPrice', 'price');
|
|
470
471
|
const amount = this.safeString2(trade, 'executedQuantity', 'size');
|
|
471
472
|
const cost = Precise["default"].stringMul(price, amount);
|
|
472
473
|
const side = this.safeStringLower(trade, 'side');
|
|
@@ -504,7 +505,7 @@ class woo extends woo$1 {
|
|
|
504
505
|
checkRequiredUid(error = true) {
|
|
505
506
|
if (!this.uid) {
|
|
506
507
|
if (error) {
|
|
507
|
-
throw new errors.AuthenticationError(this.id + ' requires `uid` credential');
|
|
508
|
+
throw new errors.AuthenticationError(this.id + ' requires `uid` credential (woox calls it `application_id`)');
|
|
508
509
|
}
|
|
509
510
|
else {
|
|
510
511
|
return false;
|