ccxt 4.3.69 → 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 +4 -4
- 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 +6 -0
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/blofin.js +63 -6
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbaseinternational.js +168 -2
- package/dist/cjs/src/cryptocom.js +9 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/poloniex.js +1 -0
- 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 +37 -12
- package/dist/cjs/src/pro/woo.js +5 -4
- package/js/ccxt.d.ts +4 -1
- 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 +1 -0
- package/js/src/base/Exchange.js +6 -0
- package/js/src/binance.js +1 -1
- package/js/src/blofin.d.ts +1 -1
- package/js/src/blofin.js +63 -6
- package/js/src/bybit.js +1 -1
- package/js/src/coinbaseinternational.d.ts +6 -1
- package/js/src/coinbaseinternational.js +168 -2
- package/js/src/cryptocom.js +10 -2
- package/js/src/hitbtc.js +1 -1
- package/js/src/poloniex.js +1 -0
- 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 +37 -12
- package/js/src/pro/woo.js +5 -4
- 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
|
}
|
|
@@ -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
|
}
|
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;
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.69";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
|
@@ -134,6 +134,7 @@ import bitruePro from './src/pro/bitrue.js';
|
|
|
134
134
|
import bitstampPro from './src/pro/bitstamp.js';
|
|
135
135
|
import bitvavoPro from './src/pro/bitvavo.js';
|
|
136
136
|
import blockchaincomPro from './src/pro/blockchaincom.js';
|
|
137
|
+
import blofinPro from './src/pro/blofin.js';
|
|
137
138
|
import bybitPro from './src/pro/bybit.js';
|
|
138
139
|
import cexPro from './src/pro/cex.js';
|
|
139
140
|
import coinbasePro from './src/pro/coinbase.js';
|
|
@@ -313,6 +314,7 @@ declare const pro: {
|
|
|
313
314
|
bitstamp: typeof bitstampPro;
|
|
314
315
|
bitvavo: typeof bitvavoPro;
|
|
315
316
|
blockchaincom: typeof blockchaincomPro;
|
|
317
|
+
blofin: typeof blofinPro;
|
|
316
318
|
bybit: typeof bybitPro;
|
|
317
319
|
cex: typeof cexPro;
|
|
318
320
|
coinbase: typeof coinbasePro;
|
|
@@ -388,6 +390,7 @@ declare const ccxt: {
|
|
|
388
390
|
bitstamp: typeof bitstampPro;
|
|
389
391
|
bitvavo: typeof bitvavoPro;
|
|
390
392
|
blockchaincom: typeof blockchaincomPro;
|
|
393
|
+
blofin: typeof blofinPro;
|
|
391
394
|
bybit: typeof bybitPro;
|
|
392
395
|
cex: typeof cexPro;
|
|
393
396
|
coinbase: typeof coinbasePro;
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.70';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -171,6 +171,7 @@ import bitruePro from './src/pro/bitrue.js';
|
|
|
171
171
|
import bitstampPro from './src/pro/bitstamp.js';
|
|
172
172
|
import bitvavoPro from './src/pro/bitvavo.js';
|
|
173
173
|
import blockchaincomPro from './src/pro/blockchaincom.js';
|
|
174
|
+
import blofinPro from './src/pro/blofin.js';
|
|
174
175
|
import bybitPro from './src/pro/bybit.js';
|
|
175
176
|
import cexPro from './src/pro/cex.js';
|
|
176
177
|
import coinbasePro from './src/pro/coinbase.js';
|
|
@@ -350,6 +351,7 @@ const pro = {
|
|
|
350
351
|
'bitstamp': bitstampPro,
|
|
351
352
|
'bitvavo': bitvavoPro,
|
|
352
353
|
'blockchaincom': blockchaincomPro,
|
|
354
|
+
'blofin': blofinPro,
|
|
353
355
|
'bybit': bybitPro,
|
|
354
356
|
'cex': cexPro,
|
|
355
357
|
'coinbase': coinbasePro,
|
|
@@ -8,7 +8,7 @@ interface Exchange {
|
|
|
8
8
|
v1PublicGetInstrumentsInstrument(params?: {}): Promise<implicitReturnType>;
|
|
9
9
|
v1PublicGetInstrumentsInstrumentQuote(params?: {}): Promise<implicitReturnType>;
|
|
10
10
|
v1PublicGetInstrumentsInstrumentFunding(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
|
|
11
|
+
v1PublicGetInstrumentsInstrumentCandles(params?: {}): Promise<implicitReturnType>;
|
|
12
12
|
v1PrivateGetOrders(params?: {}): Promise<implicitReturnType>;
|
|
13
13
|
v1PrivateGetOrdersId(params?: {}): Promise<implicitReturnType>;
|
|
14
14
|
v1PrivateGetPortfolios(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ascendex.js
CHANGED
|
@@ -3299,7 +3299,7 @@ export default class ascendex extends Exchange {
|
|
|
3299
3299
|
async fetchMarginModes(symbols = undefined, params = {}) {
|
|
3300
3300
|
/**
|
|
3301
3301
|
* @method
|
|
3302
|
-
* @name ascendex#
|
|
3302
|
+
* @name ascendex#fetchMarginModes
|
|
3303
3303
|
* @description fetches the set margin mode of the user
|
|
3304
3304
|
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
|
3305
3305
|
* @param {string[]} [symbols] a list of unified market symbols
|
|
@@ -708,6 +708,7 @@ export default class Exchange {
|
|
|
708
708
|
safeList(dictionaryOrList: any, key: IndexType, defaultValue?: any[]): any[] | undefined;
|
|
709
709
|
handleDeltas(orderbook: any, deltas: any): void;
|
|
710
710
|
handleDelta(bookside: any, delta: any): void;
|
|
711
|
+
handleDeltasWithKeys(bookSide: any, deltas: any, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): void;
|
|
711
712
|
getCacheIndex(orderbook: any, deltas: any): number;
|
|
712
713
|
findTimeframe(timeframe: any, timeframes?: any): string;
|
|
713
714
|
checkProxyUrlSettings(url?: Str, method?: Str, headers?: any, body?: any): any;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1648,6 +1648,12 @@ export default class Exchange {
|
|
|
1648
1648
|
handleDelta(bookside, delta) {
|
|
1649
1649
|
throw new NotSupported(this.id + ' handleDelta not supported yet');
|
|
1650
1650
|
}
|
|
1651
|
+
handleDeltasWithKeys(bookSide, deltas, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
1652
|
+
for (let i = 0; i < deltas.length; i++) {
|
|
1653
|
+
const bidAsk = this.parseBidAsk(deltas[i], priceKey, amountKey, countOrIdKey);
|
|
1654
|
+
bookSide.storeArray(bidAsk);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1651
1657
|
getCacheIndex(orderbook, deltas) {
|
|
1652
1658
|
// return the first index of the cache that can be applied to the orderbook or -1 if not possible
|
|
1653
1659
|
return -1;
|
package/js/src/binance.js
CHANGED
|
@@ -12639,7 +12639,7 @@ export default class binance extends Exchange {
|
|
|
12639
12639
|
async fetchMarginModes(symbols = undefined, params = {}) {
|
|
12640
12640
|
/**
|
|
12641
12641
|
* @method
|
|
12642
|
-
* @name binance#
|
|
12642
|
+
* @name binance#fetchMarginModes
|
|
12643
12643
|
* @description fetches margin modes ("isolated" or "cross") that the market for the symbol in in, with symbol=undefined all markets for a subType (linear/inverse) are returned
|
|
12644
12644
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Account-Information
|
|
12645
12645
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2
|
package/js/src/blofin.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export default class blofin extends Exchange {
|
|
|
56
56
|
previousFundingDatetime: any;
|
|
57
57
|
}>;
|
|
58
58
|
parseBalanceByType(type: any, response: any): Balances;
|
|
59
|
-
|
|
59
|
+
parseBalance(response: any): Balances;
|
|
60
60
|
parseFundingBalance(response: any): Balances;
|
|
61
61
|
parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
|
|
62
62
|
fetchBalance(params?: {}): Promise<Balances>;
|