ccxt 4.2.90 → 4.2.91
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/CHANGELOG.md +44 -16
- package/README.md +3 -3
- package/dist/ccxt.browser.js +339 -161
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -9
- package/dist/cjs/src/coinbase.js +3 -1
- package/dist/cjs/src/gemini.js +2 -1
- package/dist/cjs/src/kraken.js +11 -9
- package/dist/cjs/src/okx.js +30 -30
- package/dist/cjs/src/pro/bitmex.js +39 -18
- package/dist/cjs/src/pro/kucoin.js +91 -0
- package/dist/cjs/src/pro/kucoinfutures.js +151 -82
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +1 -9
- package/js/src/coinbase.js +3 -1
- package/js/src/gemini.js +2 -1
- package/js/src/kraken.js +11 -9
- package/js/src/okx.js +30 -30
- package/js/src/pro/bitmex.d.ts +1 -0
- package/js/src/pro/bitmex.js +39 -18
- package/js/src/pro/kucoin.d.ts +4 -0
- package/js/src/pro/kucoin.js +91 -0
- package/js/src/pro/kucoinfutures.d.ts +9 -5
- package/js/src/pro/kucoinfutures.js +151 -82
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
12
12
|
'has': {
|
|
13
13
|
'ws': true,
|
|
14
14
|
'watchTicker': true,
|
|
15
|
+
'watchTickers': true,
|
|
16
|
+
'watchBidsAsks': true,
|
|
15
17
|
'watchTrades': true,
|
|
16
18
|
'watchOrderBook': true,
|
|
17
19
|
'watchOrders': true,
|
|
@@ -41,9 +43,6 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
41
43
|
'snapshotDelay': 20,
|
|
42
44
|
'snapshotMaxRetries': 3,
|
|
43
45
|
},
|
|
44
|
-
'watchTicker': {
|
|
45
|
-
'name': 'contractMarket/tickerV2', // market/ticker
|
|
46
|
-
},
|
|
47
46
|
'watchPosition': {
|
|
48
47
|
'fetchPositionSnapshot': true,
|
|
49
48
|
'awaitPositionSnapshot': true, // whether to wait for the position snapshot before providing updates
|
|
@@ -146,7 +145,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
146
145
|
}
|
|
147
146
|
return await this.watch(url, messageHash, message, subscriptionHash, subscription);
|
|
148
147
|
}
|
|
149
|
-
async subscribeMultiple(url, messageHashes, topic, subscriptionHashes,
|
|
148
|
+
async subscribeMultiple(url, messageHashes, topic, subscriptionHashes, subscriptionArgs, params = {}) {
|
|
150
149
|
const requestId = this.requestId().toString();
|
|
151
150
|
const request = {
|
|
152
151
|
'id': requestId,
|
|
@@ -154,24 +153,14 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
154
153
|
'topic': topic,
|
|
155
154
|
'response': true,
|
|
156
155
|
};
|
|
157
|
-
|
|
158
|
-
const subscriptionRequest = {
|
|
159
|
-
'id': requestId,
|
|
160
|
-
};
|
|
161
|
-
if (subscription === undefined) {
|
|
162
|
-
subscription = subscriptionRequest;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
subscription = this.extend(subscriptionRequest, subscription);
|
|
166
|
-
}
|
|
167
|
-
return await this.watchMultiple(url, messageHashes, message, subscriptionHashes, subscription);
|
|
156
|
+
return await this.watchMultiple(url, messageHashes, this.extend(request, params), subscriptionHashes, subscriptionArgs);
|
|
168
157
|
}
|
|
169
158
|
async watchTicker(symbol, params = {}) {
|
|
170
159
|
/**
|
|
171
160
|
* @method
|
|
172
161
|
* @name kucoinfutures#watchTicker
|
|
173
162
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
174
|
-
* @see https://
|
|
163
|
+
* @see https://www.kucoin.com/docs/websocket/futures-trading/public-channels/get-ticker
|
|
175
164
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
176
165
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
177
166
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -179,30 +168,48 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
179
168
|
await this.loadMarkets();
|
|
180
169
|
const market = this.market(symbol);
|
|
181
170
|
symbol = market['symbol'];
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
171
|
+
params['callerMethodName'] = 'watchTicker';
|
|
172
|
+
const tickers = await this.watchTickers([symbol], params);
|
|
173
|
+
return tickers[symbol];
|
|
174
|
+
}
|
|
175
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
176
|
+
/**
|
|
177
|
+
* @method
|
|
178
|
+
* @name kucoinfutures#watchTickers
|
|
179
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
180
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
181
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
182
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
183
|
+
*/
|
|
184
|
+
await this.loadMarkets();
|
|
185
|
+
const ticker = await this.watchMultiRequest('watchTickers', '/contractMarket/ticker:', symbols, params);
|
|
186
|
+
if (this.newUpdates) {
|
|
187
|
+
const tickers = {};
|
|
188
|
+
tickers[ticker['symbol']] = ticker;
|
|
189
|
+
return tickers;
|
|
190
|
+
}
|
|
191
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
188
192
|
}
|
|
189
193
|
handleTicker(client, message) {
|
|
190
194
|
//
|
|
191
|
-
//
|
|
195
|
+
// ticker (v1)
|
|
192
196
|
//
|
|
193
197
|
// {
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
198
|
+
// "subject": "ticker",
|
|
199
|
+
// "topic": "/contractMarket/ticker:XBTUSDM",
|
|
200
|
+
// "data": {
|
|
201
|
+
// "symbol": "XBTUSDM", //Market of the symbol
|
|
202
|
+
// "sequence": 45, //Sequence number which is used to judge the continuity of the pushed messages
|
|
203
|
+
// "side": "sell", //Transaction side of the last traded taker order
|
|
204
|
+
// "price": "3600.0", //Filled price
|
|
205
|
+
// "size": 16, //Filled quantity
|
|
206
|
+
// "tradeId": "5c9dcf4170744d6f5a3d32fb", //Order ID
|
|
207
|
+
// "bestBidSize": 795, //Best bid size
|
|
208
|
+
// "bestBidPrice": "3200.0", //Best bid
|
|
209
|
+
// "bestAskPrice": "3600.0", //Best ask size
|
|
210
|
+
// "bestAskSize": 284, //Best ask
|
|
211
|
+
// "ts": 1553846081210004941 //Filled time - nanosecond
|
|
212
|
+
// }
|
|
206
213
|
// }
|
|
207
214
|
//
|
|
208
215
|
const data = this.safeValue(message, 'data', {});
|
|
@@ -210,9 +217,95 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
210
217
|
const market = this.safeMarket(marketId, undefined, '-');
|
|
211
218
|
const ticker = this.parseTicker(data, market);
|
|
212
219
|
this.tickers[market['symbol']] = ticker;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
220
|
+
client.resolve(ticker, this.getMessageHash('ticker', market['symbol']));
|
|
221
|
+
}
|
|
222
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
223
|
+
/**
|
|
224
|
+
* @method
|
|
225
|
+
* @name kucoinfutures#watchBidsAsks
|
|
226
|
+
* @see https://www.kucoin.com/docs/websocket/futures-trading/public-channels/get-ticker-v2
|
|
227
|
+
* @description watches best bid & ask for symbols
|
|
228
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
229
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
230
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
231
|
+
*/
|
|
232
|
+
const ticker = await this.watchMultiRequest('watchBidsAsks', '/contractMarket/tickerV2:', symbols, params);
|
|
233
|
+
if (this.newUpdates) {
|
|
234
|
+
const tickers = {};
|
|
235
|
+
tickers[ticker['symbol']] = ticker;
|
|
236
|
+
return tickers;
|
|
237
|
+
}
|
|
238
|
+
return this.filterByArray(this.bidsasks, 'symbol', symbols);
|
|
239
|
+
}
|
|
240
|
+
async watchMultiRequest(methodName, channelName, symbols = undefined, params = {}) {
|
|
241
|
+
await this.loadMarkets();
|
|
242
|
+
[methodName, params] = this.handleParamString(params, 'callerMethodName', methodName);
|
|
243
|
+
const isBidsAsks = (methodName === 'watchBidsAsks');
|
|
244
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, false);
|
|
245
|
+
const length = symbols.length;
|
|
246
|
+
if (length > 100) {
|
|
247
|
+
throw new errors.ArgumentsRequired(this.id + ' ' + methodName + '() accepts a maximum of 100 symbols');
|
|
248
|
+
}
|
|
249
|
+
const messageHashes = [];
|
|
250
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
251
|
+
const symbol = symbols[i];
|
|
252
|
+
const market = this.market(symbol);
|
|
253
|
+
const prefix = isBidsAsks ? 'bidask' : 'ticker';
|
|
254
|
+
messageHashes.push(this.getMessageHash(prefix, market['symbol']));
|
|
255
|
+
}
|
|
256
|
+
const url = await this.negotiate(false);
|
|
257
|
+
const marketIds = this.marketIds(symbols);
|
|
258
|
+
const joined = marketIds.join(',');
|
|
259
|
+
const requestId = this.requestId().toString();
|
|
260
|
+
const request = {
|
|
261
|
+
'id': requestId,
|
|
262
|
+
'type': 'subscribe',
|
|
263
|
+
'topic': channelName + joined,
|
|
264
|
+
'response': true,
|
|
265
|
+
};
|
|
266
|
+
const subscription = {
|
|
267
|
+
'id': requestId,
|
|
268
|
+
};
|
|
269
|
+
return await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscription);
|
|
270
|
+
}
|
|
271
|
+
handleBidAsk(client, message) {
|
|
272
|
+
//
|
|
273
|
+
// arrives one symbol dict
|
|
274
|
+
//
|
|
275
|
+
// {
|
|
276
|
+
// "subject": "tickerV2",
|
|
277
|
+
// "topic": "/contractMarket/tickerV2:XBTUSDM",
|
|
278
|
+
// "data": {
|
|
279
|
+
// "symbol": "XBTUSDM", //Market of the symbol
|
|
280
|
+
// "bestBidSize": 795, // Best bid size
|
|
281
|
+
// "bestBidPrice": 3200.0, // Best bid
|
|
282
|
+
// "bestAskPrice": 3600.0, // Best ask
|
|
283
|
+
// "bestAskSize": 284, // Best ask size
|
|
284
|
+
// "ts": 1553846081210004941 // Filled time - nanosecond
|
|
285
|
+
// }
|
|
286
|
+
// }
|
|
287
|
+
//
|
|
288
|
+
const parsedTicker = this.parseWsBidAsk(message);
|
|
289
|
+
const symbol = parsedTicker['symbol'];
|
|
290
|
+
this.bidsasks[symbol] = parsedTicker;
|
|
291
|
+
client.resolve(parsedTicker, this.getMessageHash('bidask', symbol));
|
|
292
|
+
}
|
|
293
|
+
parseWsBidAsk(ticker, market = undefined) {
|
|
294
|
+
const data = this.safeDict(ticker, 'data', {});
|
|
295
|
+
const marketId = this.safeString(data, 'symbol');
|
|
296
|
+
market = this.safeMarket(marketId, market);
|
|
297
|
+
const symbol = this.safeString(market, 'symbol');
|
|
298
|
+
const timestamp = this.safeIntegerProduct(data, 'ts', 0.000001);
|
|
299
|
+
return this.safeTicker({
|
|
300
|
+
'symbol': symbol,
|
|
301
|
+
'timestamp': timestamp,
|
|
302
|
+
'datetime': this.iso8601(timestamp),
|
|
303
|
+
'ask': this.safeNumber(data, 'bestAskPrice'),
|
|
304
|
+
'askVolume': this.safeNumber(data, 'bestAskSize'),
|
|
305
|
+
'bid': this.safeNumber(data, 'bestBidPrice'),
|
|
306
|
+
'bidVolume': this.safeNumber(data, 'bestBidSize'),
|
|
307
|
+
'info': ticker,
|
|
308
|
+
}, market);
|
|
216
309
|
}
|
|
217
310
|
async watchPosition(symbol = undefined, params = {}) {
|
|
218
311
|
/**
|
|
@@ -431,7 +524,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
431
524
|
messageHashes.push('trades:' + symbol);
|
|
432
525
|
subscriptionHashes.push('/contractMarket/execution:' + marketId);
|
|
433
526
|
}
|
|
434
|
-
const trades = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes, params);
|
|
527
|
+
const trades = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes, undefined, params);
|
|
435
528
|
if (this.newUpdates) {
|
|
436
529
|
const first = this.safeValue(trades, 0);
|
|
437
530
|
const tradeSymbol = this.safeString(first, 'symbol');
|
|
@@ -517,9 +610,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
517
610
|
const marketIds = this.marketIds(symbols);
|
|
518
611
|
const url = await this.negotiate(false);
|
|
519
612
|
const topic = '/contractMarket/level2:' + marketIds.join(',');
|
|
520
|
-
const
|
|
521
|
-
'method': this.handleOrderBookSubscription,
|
|
522
|
-
'symbols': symbols,
|
|
613
|
+
const subscriptionArgs = {
|
|
523
614
|
'limit': limit,
|
|
524
615
|
};
|
|
525
616
|
const subscriptionHashes = [];
|
|
@@ -530,7 +621,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
530
621
|
messageHashes.push('orderbook:' + symbol);
|
|
531
622
|
subscriptionHashes.push('/contractMarket/level2:' + marketId);
|
|
532
623
|
}
|
|
533
|
-
const orderbook = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes,
|
|
624
|
+
const orderbook = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes, subscriptionArgs, params);
|
|
534
625
|
return orderbook.limit();
|
|
535
626
|
}
|
|
536
627
|
handleDelta(orderbook, delta) {
|
|
@@ -581,11 +672,13 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
581
672
|
const marketId = this.safeString(topicParts, 1);
|
|
582
673
|
const symbol = this.safeSymbol(marketId, undefined, '-');
|
|
583
674
|
const messageHash = 'orderbook:' + symbol;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
675
|
+
if (!(symbol in this.orderbooks)) {
|
|
676
|
+
const subscriptionArgs = this.safeDict(client.subscriptions, topic, {});
|
|
677
|
+
const limit = this.safeInteger(subscriptionArgs, 'limit');
|
|
678
|
+
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
588
679
|
}
|
|
680
|
+
const storedOrderBook = this.orderbooks[symbol];
|
|
681
|
+
const nonce = this.safeInteger(storedOrderBook, 'nonce');
|
|
589
682
|
const deltaEnd = this.safeInteger(data, 'sequence');
|
|
590
683
|
if (nonce === undefined) {
|
|
591
684
|
const cacheLength = storedOrderBook.cache.length;
|
|
@@ -631,39 +724,6 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
631
724
|
}
|
|
632
725
|
return cache.length;
|
|
633
726
|
}
|
|
634
|
-
handleOrderBookSubscription(client, message, subscription) {
|
|
635
|
-
const limit = this.safeInteger(subscription, 'limit');
|
|
636
|
-
const symbols = this.safeValue(subscription, 'symbols');
|
|
637
|
-
if (symbols === undefined) {
|
|
638
|
-
const symbol = this.safeString(subscription, 'symbol');
|
|
639
|
-
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
for (let i = 0; i < symbols.length; i++) {
|
|
643
|
-
const symbol = symbols[i];
|
|
644
|
-
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
// moved snapshot initialization to handleOrderBook to fix
|
|
648
|
-
// https://github.com/ccxt/ccxt/issues/6820
|
|
649
|
-
// the general idea is to fetch the snapshot after the first delta
|
|
650
|
-
// but not before, because otherwise we cannot synchronize the feed
|
|
651
|
-
}
|
|
652
|
-
handleSubscriptionStatus(client, message) {
|
|
653
|
-
//
|
|
654
|
-
// {
|
|
655
|
-
// "id": "1578090438322",
|
|
656
|
-
// "type": "ack"
|
|
657
|
-
// }
|
|
658
|
-
//
|
|
659
|
-
const id = this.safeString(message, 'id');
|
|
660
|
-
const subscriptionsById = this.indexBy(client.subscriptions, 'id');
|
|
661
|
-
const subscription = this.safeValue(subscriptionsById, id, {});
|
|
662
|
-
const method = this.safeValue(subscription, 'method');
|
|
663
|
-
if (method !== undefined) {
|
|
664
|
-
method.call(this, client, message, subscription);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
727
|
handleSystemStatus(client, message) {
|
|
668
728
|
//
|
|
669
729
|
// todo: answer the question whether handleSystemStatus should be renamed
|
|
@@ -922,7 +982,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
922
982
|
const subject = this.safeString(message, 'subject');
|
|
923
983
|
const methods = {
|
|
924
984
|
'level2': this.handleOrderBook,
|
|
925
|
-
'
|
|
985
|
+
'ticker': this.handleTicker,
|
|
986
|
+
'tickerV2': this.handleBidAsk,
|
|
926
987
|
'availableBalance.change': this.handleBalance,
|
|
927
988
|
'match': this.handleTrade,
|
|
928
989
|
'orderChange': this.handleOrder,
|
|
@@ -936,6 +997,15 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
936
997
|
method.call(this, client, message);
|
|
937
998
|
}
|
|
938
999
|
}
|
|
1000
|
+
getMessageHash(elementName, symbol = undefined) {
|
|
1001
|
+
// elementName can be 'ticker', 'bidask', ...
|
|
1002
|
+
if (symbol !== undefined) {
|
|
1003
|
+
return elementName + '@' + symbol;
|
|
1004
|
+
}
|
|
1005
|
+
else {
|
|
1006
|
+
return elementName + 's@all';
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
939
1009
|
ping(client) {
|
|
940
1010
|
// kucoin does not support built-in ws protocol-level ping-pong
|
|
941
1011
|
// instead it requires a custom json-based text ping-pong
|
|
@@ -975,7 +1045,6 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
975
1045
|
const methods = {
|
|
976
1046
|
// 'heartbeat': this.handleHeartbeat,
|
|
977
1047
|
'welcome': this.handleSystemStatus,
|
|
978
|
-
'ack': this.handleSubscriptionStatus,
|
|
979
1048
|
'message': this.handleSubject,
|
|
980
1049
|
'pong': this.handlePong,
|
|
981
1050
|
'error': this.handleErrorMessage,
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ExchangeClosedByUser } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.90";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
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, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ExchangeClosedByUser } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.91';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -2082,7 +2082,7 @@ export default class Exchange {
|
|
|
2082
2082
|
parseToInt(number) {
|
|
2083
2083
|
// Solve Common parseInt misuse ex: parseInt ((since / 1000).toString ())
|
|
2084
2084
|
// using a number as parameter which is not valid in ts
|
|
2085
|
-
const stringifiedNumber =
|
|
2085
|
+
const stringifiedNumber = this.numberToString(number);
|
|
2086
2086
|
const convertedNumber = parseFloat(stringifiedNumber);
|
|
2087
2087
|
return parseInt(convertedNumber);
|
|
2088
2088
|
}
|
|
@@ -4575,13 +4575,6 @@ export default class Exchange {
|
|
|
4575
4575
|
if (!this.substituteCommonCurrencyCodes) {
|
|
4576
4576
|
return code;
|
|
4577
4577
|
}
|
|
4578
|
-
// if the provided code already exists as a value in commonCurrencies dict, then we should not again transform it
|
|
4579
|
-
// more details at: https://github.com/ccxt/ccxt/issues/21112#issuecomment-2031293691
|
|
4580
|
-
const commonCurrencies = Object.values(this.commonCurrencies);
|
|
4581
|
-
const exists = this.inArray(code, commonCurrencies);
|
|
4582
|
-
if (exists) {
|
|
4583
|
-
return code;
|
|
4584
|
-
}
|
|
4585
4578
|
return this.safeString(this.commonCurrencies, code, code);
|
|
4586
4579
|
}
|
|
4587
4580
|
currency(code) {
|
|
@@ -5232,7 +5225,6 @@ export default class Exchange {
|
|
|
5232
5225
|
* @returns {object} objects with withdraw and deposit fees, indexed by currency codes
|
|
5233
5226
|
*/
|
|
5234
5227
|
const depositWithdrawFees = {};
|
|
5235
|
-
codes = this.marketCodes(codes);
|
|
5236
5228
|
const isArray = Array.isArray(response);
|
|
5237
5229
|
let responseKeys = response;
|
|
5238
5230
|
if (!isArray) {
|
package/js/src/coinbase.js
CHANGED
|
@@ -331,6 +331,7 @@ export default class coinbase extends Exchange {
|
|
|
331
331
|
'CGLD': 'CELO',
|
|
332
332
|
},
|
|
333
333
|
'options': {
|
|
334
|
+
'brokerId': 'ccxt',
|
|
334
335
|
'stablePairs': ['BUSD-USD', 'CBETH-ETH', 'DAI-USD', 'GUSD-USD', 'GYEN-USD', 'PAX-USD', 'PAX-USDT', 'USDC-EUR', 'USDC-GBP', 'USDT-EUR', 'USDT-GBP', 'USDT-USD', 'USDT-USDC', 'WBTC-BTC'],
|
|
335
336
|
'fetchCurrencies': {
|
|
336
337
|
'expires': 5000,
|
|
@@ -2341,8 +2342,9 @@ export default class coinbase extends Exchange {
|
|
|
2341
2342
|
*/
|
|
2342
2343
|
await this.loadMarkets();
|
|
2343
2344
|
const market = this.market(symbol);
|
|
2345
|
+
const id = this.safeString(this.options, 'brokerId', 'ccxt');
|
|
2344
2346
|
let request = {
|
|
2345
|
-
'client_order_id': this.uuid(),
|
|
2347
|
+
'client_order_id': id + '-' + this.uuid(),
|
|
2346
2348
|
'product_id': market['id'],
|
|
2347
2349
|
'side': side.toUpperCase(),
|
|
2348
2350
|
};
|
package/js/src/gemini.js
CHANGED
|
@@ -446,7 +446,8 @@ export default class gemini extends Exchange {
|
|
|
446
446
|
// '<td>0.01 USD', // quote currency price increment
|
|
447
447
|
// '</tr>'
|
|
448
448
|
// ]
|
|
449
|
-
|
|
449
|
+
let marketId = cells[0].replace('<td>', '');
|
|
450
|
+
marketId = marketId.replace('*', '');
|
|
450
451
|
// const base = this.safeCurrencyCode (baseId);
|
|
451
452
|
const minAmountString = cells[1].replace('<td>', '');
|
|
452
453
|
const minAmountParts = minAmountString.split(' ');
|
package/js/src/kraken.js
CHANGED
|
@@ -599,10 +599,7 @@ export default class kraken extends Exchange {
|
|
|
599
599
|
if (currencyId !== undefined) {
|
|
600
600
|
if (currencyId.length > 3) {
|
|
601
601
|
if ((currencyId.indexOf('X') === 0) || (currencyId.indexOf('Z') === 0)) {
|
|
602
|
-
if (currencyId.indexOf('.') > 0) {
|
|
603
|
-
return super.safeCurrency(currencyId, currency);
|
|
604
|
-
}
|
|
605
|
-
else {
|
|
602
|
+
if (!(currencyId.indexOf('.') > 0)) {
|
|
606
603
|
currencyId = currencyId.slice(1);
|
|
607
604
|
}
|
|
608
605
|
}
|
|
@@ -651,8 +648,13 @@ export default class kraken extends Exchange {
|
|
|
651
648
|
// {
|
|
652
649
|
// "error": [],
|
|
653
650
|
// "result": {
|
|
654
|
-
// "
|
|
655
|
-
//
|
|
651
|
+
// "BCH": {
|
|
652
|
+
// "aclass": "currency",
|
|
653
|
+
// "altname": "BCH",
|
|
654
|
+
// "decimals": 10,
|
|
655
|
+
// "display_decimals": 5
|
|
656
|
+
// "status": "enabled",
|
|
657
|
+
// },
|
|
656
658
|
// ...
|
|
657
659
|
// },
|
|
658
660
|
// }
|
|
@@ -667,15 +669,15 @@ export default class kraken extends Exchange {
|
|
|
667
669
|
// see: https://support.kraken.com/hc/en-us/articles/201893608-What-are-the-withdrawal-fees-
|
|
668
670
|
// to add support for multiple withdrawal/deposit methods and
|
|
669
671
|
// differentiated fees for each particular method
|
|
670
|
-
const code = this.safeCurrencyCode(
|
|
672
|
+
const code = this.safeCurrencyCode(id);
|
|
671
673
|
const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals')));
|
|
672
674
|
// assumes all currencies are active except those listed above
|
|
673
|
-
const active =
|
|
675
|
+
const active = this.safeString(currency, 'status') === 'enabled';
|
|
674
676
|
result[code] = {
|
|
675
677
|
'id': id,
|
|
676
678
|
'code': code,
|
|
677
679
|
'info': currency,
|
|
678
|
-
'name':
|
|
680
|
+
'name': this.safeString(currency, 'altname'),
|
|
679
681
|
'active': active,
|
|
680
682
|
'deposit': undefined,
|
|
681
683
|
'withdraw': undefined,
|