ccxt 4.0.104 → 4.0.106
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 +89 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +81 -13
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +11 -1
- package/dist/cjs/src/bitmart.js +18 -7
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoin.js +5 -0
- package/dist/cjs/src/pro/bybit.js +42 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +11 -1
- package/js/src/bitmart.js +18 -7
- package/js/src/bybit.js +1 -1
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoin.js +5 -0
- package/js/src/pro/bybit.d.ts +1 -0
- package/js/src/pro/bybit.js +42 -1
- package/package.json +1 -1
- package/skip-tests.json +2 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -179,7 +179,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
179
179
|
|
|
180
180
|
//-----------------------------------------------------------------------------
|
|
181
181
|
// this is updated by vss.js when building
|
|
182
|
-
const version = '4.0.
|
|
182
|
+
const version = '4.0.106';
|
|
183
183
|
Exchange["default"].ccxtVersion = version;
|
|
184
184
|
const exchanges = {
|
|
185
185
|
'ace': ace,
|
|
@@ -2314,8 +2314,18 @@ class Exchange {
|
|
|
2314
2314
|
}
|
|
2315
2315
|
return result;
|
|
2316
2316
|
}
|
|
2317
|
-
marketSymbols(symbols, type = undefined) {
|
|
2317
|
+
marketSymbols(symbols, type = undefined, allowEmpty = true) {
|
|
2318
2318
|
if (symbols === undefined) {
|
|
2319
|
+
if (!allowEmpty) {
|
|
2320
|
+
throw new errors.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
2321
|
+
}
|
|
2322
|
+
return symbols;
|
|
2323
|
+
}
|
|
2324
|
+
const symbolsLength = symbols.length;
|
|
2325
|
+
if (symbolsLength === 0) {
|
|
2326
|
+
if (!allowEmpty) {
|
|
2327
|
+
throw new errors.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
2328
|
+
}
|
|
2319
2329
|
return symbols;
|
|
2320
2330
|
}
|
|
2321
2331
|
const result = [];
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -2199,8 +2199,10 @@ class bitmart extends bitmart$1 {
|
|
|
2199
2199
|
* @name bitmart#cancelAllOrders
|
|
2200
2200
|
* @description cancel all open orders in a market
|
|
2201
2201
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
|
2202
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
|
2202
2203
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
2203
2204
|
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
2205
|
+
* @param {string} [params.side] *spot only* 'buy' or 'sell'
|
|
2204
2206
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
2205
2207
|
*/
|
|
2206
2208
|
await this.loadMarkets();
|
|
@@ -2210,17 +2212,18 @@ class bitmart extends bitmart$1 {
|
|
|
2210
2212
|
market = this.market(symbol);
|
|
2211
2213
|
request['symbol'] = market['id'];
|
|
2212
2214
|
}
|
|
2215
|
+
let response = undefined;
|
|
2213
2216
|
let type = undefined;
|
|
2214
2217
|
[type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2215
|
-
if (type
|
|
2216
|
-
|
|
2218
|
+
if (type === 'spot') {
|
|
2219
|
+
response = await this.privatePostSpotV1CancelOrders(this.extend(request, params));
|
|
2217
2220
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
params = this.omit(params, 'side');
|
|
2221
|
+
else if (type === 'swap') {
|
|
2222
|
+
this.checkRequiredSymbol('cancelAllOrders', symbol);
|
|
2223
|
+
response = await this.privatePostContractPrivateCancelOrders(this.extend(request, params));
|
|
2222
2224
|
}
|
|
2223
|
-
|
|
2225
|
+
//
|
|
2226
|
+
// spot
|
|
2224
2227
|
//
|
|
2225
2228
|
// {
|
|
2226
2229
|
// "code": 1000,
|
|
@@ -2229,6 +2232,14 @@ class bitmart extends bitmart$1 {
|
|
|
2229
2232
|
// "data": {}
|
|
2230
2233
|
// }
|
|
2231
2234
|
//
|
|
2235
|
+
// swap
|
|
2236
|
+
//
|
|
2237
|
+
// {
|
|
2238
|
+
// "code": 1000,
|
|
2239
|
+
// "message": "Ok",
|
|
2240
|
+
// "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.70.16954131323145323"
|
|
2241
|
+
// }
|
|
2242
|
+
//
|
|
2232
2243
|
return response;
|
|
2233
2244
|
}
|
|
2234
2245
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -3603,7 +3603,6 @@ class bybit extends bybit$1 {
|
|
|
3603
3603
|
* @param {boolean} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
3604
3604
|
* @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
|
|
3605
3605
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
3606
|
-
* @param {int} [params.triggerDirection] *contract only* conditional orders, 1: triggered when market price rises to triggerPrice, 2: triggered when market price falls to triggerPrice
|
|
3607
3606
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
3608
3607
|
*/
|
|
3609
3608
|
await this.loadMarkets();
|
|
@@ -3711,6 +3710,7 @@ class bybit extends bybit$1 {
|
|
|
3711
3710
|
const isBuy = side === 'buy';
|
|
3712
3711
|
const ascending = stopLossTriggerPrice ? !isBuy : isBuy;
|
|
3713
3712
|
if (triggerPrice !== undefined) {
|
|
3713
|
+
request['triggerDirection'] = ascending ? 2 : 1;
|
|
3714
3714
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
3715
3715
|
}
|
|
3716
3716
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
@@ -1217,7 +1217,8 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1217
1217
|
let statusId = undefined;
|
|
1218
1218
|
let price = undefined;
|
|
1219
1219
|
let trades = [];
|
|
1220
|
-
|
|
1220
|
+
const orderEventsLength = orderEvents.length;
|
|
1221
|
+
if (orderEventsLength) {
|
|
1221
1222
|
const executions = [];
|
|
1222
1223
|
for (let i = 0; i < orderEvents.length; i++) {
|
|
1223
1224
|
const item = orderEvents[i];
|
|
@@ -1325,7 +1326,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1325
1326
|
return this.safeOrder({
|
|
1326
1327
|
'info': order,
|
|
1327
1328
|
'id': id,
|
|
1328
|
-
'clientOrderId': this.
|
|
1329
|
+
'clientOrderId': this.safeStringN(details, ['clientOrderId', 'clientId', 'cliOrdId']),
|
|
1329
1330
|
'timestamp': timestamp,
|
|
1330
1331
|
'datetime': this.iso8601(timestamp),
|
|
1331
1332
|
'lastTradeTimestamp': undefined,
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -1082,6 +1082,11 @@ class kucoin extends kucoin$1 {
|
|
|
1082
1082
|
const rawPrecision = this.safeString(entry, 'precision');
|
|
1083
1083
|
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
1084
1084
|
const chainsLength = chains.length;
|
|
1085
|
+
if (!chainsLength) {
|
|
1086
|
+
// https://t.me/KuCoin_API/173118
|
|
1087
|
+
isWithdrawEnabled = false;
|
|
1088
|
+
isDepositEnabled = false;
|
|
1089
|
+
}
|
|
1085
1090
|
for (let j = 0; j < chainsLength; j++) {
|
|
1086
1091
|
const chain = chains[j];
|
|
1087
1092
|
const chainId = this.safeString(chain, 'chain');
|
|
@@ -20,7 +20,7 @@ class bybit extends bybit$1 {
|
|
|
20
20
|
'watchOrderBookForSymbols': true,
|
|
21
21
|
'watchOrders': true,
|
|
22
22
|
'watchTicker': true,
|
|
23
|
-
'watchTickers':
|
|
23
|
+
'watchTickers': true,
|
|
24
24
|
'watchTrades': true,
|
|
25
25
|
'watchTradesForSymbols': true,
|
|
26
26
|
'watchPosition': undefined,
|
|
@@ -182,6 +182,36 @@ class bybit extends bybit$1 {
|
|
|
182
182
|
const topics = [topic];
|
|
183
183
|
return await this.watchTopics(url, messageHash, topics, params);
|
|
184
184
|
}
|
|
185
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
186
|
+
/**
|
|
187
|
+
* @method
|
|
188
|
+
* @name bybit#watchTickers
|
|
189
|
+
* @description n watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
190
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
|
|
191
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
|
|
192
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
193
|
+
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
194
|
+
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
195
|
+
*/
|
|
196
|
+
await this.loadMarkets();
|
|
197
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
198
|
+
const messageHash = 'tickers::' + symbols.join(',');
|
|
199
|
+
const url = this.getUrlByMarketType(symbols[0], false, params);
|
|
200
|
+
params = this.cleanParams(params);
|
|
201
|
+
const options = this.safeValue(this.options, 'watchTickers', {});
|
|
202
|
+
const topic = this.safeString(options, 'name', 'tickers');
|
|
203
|
+
const marketIds = this.marketIds(symbols);
|
|
204
|
+
const topics = [];
|
|
205
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
206
|
+
const marketId = marketIds[i];
|
|
207
|
+
topics.push(topic + '.' + marketId);
|
|
208
|
+
}
|
|
209
|
+
const ticker = await this.watchTopics(url, messageHash, topics, params);
|
|
210
|
+
if (this.newUpdates) {
|
|
211
|
+
return ticker;
|
|
212
|
+
}
|
|
213
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
214
|
+
}
|
|
185
215
|
handleTicker(client, message) {
|
|
186
216
|
//
|
|
187
217
|
// linear
|
|
@@ -312,6 +342,17 @@ class bybit extends bybit$1 {
|
|
|
312
342
|
this.tickers[symbol] = parsed;
|
|
313
343
|
const messageHash = 'ticker:' + symbol;
|
|
314
344
|
client.resolve(this.tickers[symbol], messageHash);
|
|
345
|
+
// watchTickers part
|
|
346
|
+
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
347
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
348
|
+
const messageHash = messageHashes[i];
|
|
349
|
+
const parts = messageHash.split('::');
|
|
350
|
+
const symbolsString = parts[1];
|
|
351
|
+
const symbols = symbolsString.split(',');
|
|
352
|
+
if (this.inArray(parsed['symbol'], symbols)) {
|
|
353
|
+
client.resolve(parsed, messageHash);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
315
356
|
}
|
|
316
357
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
317
358
|
/**
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.0.
|
|
7
|
+
declare const version = "4.0.105";
|
|
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.0.
|
|
41
|
+
const version = '4.0.106';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -620,7 +620,7 @@ export default class Exchange {
|
|
|
620
620
|
convertOHLCVToTradingView(ohlcvs: any, timestamp?: string, open?: string, high?: string, low?: string, close?: string, volume?: string, ms?: boolean): {};
|
|
621
621
|
fetchWebEndpoint(method: any, endpointMethod: any, returnAsJson: any, startRegex?: any, endRegex?: any): Promise<any>;
|
|
622
622
|
marketIds(symbols: any): any;
|
|
623
|
-
marketSymbols(symbols: any, type?: string): any;
|
|
623
|
+
marketSymbols(symbols: any, type?: string, allowEmpty?: boolean): any;
|
|
624
624
|
marketCodes(codes: any): any;
|
|
625
625
|
parseBidsAsks(bidasks: any, priceKey?: IndexType, amountKey?: IndexType): any[];
|
|
626
626
|
fetchL2OrderBook(symbol: string, limit?: Int, params?: {}): Promise<any>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -2309,8 +2309,18 @@ export default class Exchange {
|
|
|
2309
2309
|
}
|
|
2310
2310
|
return result;
|
|
2311
2311
|
}
|
|
2312
|
-
marketSymbols(symbols, type = undefined) {
|
|
2312
|
+
marketSymbols(symbols, type = undefined, allowEmpty = true) {
|
|
2313
2313
|
if (symbols === undefined) {
|
|
2314
|
+
if (!allowEmpty) {
|
|
2315
|
+
throw new ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
2316
|
+
}
|
|
2317
|
+
return symbols;
|
|
2318
|
+
}
|
|
2319
|
+
const symbolsLength = symbols.length;
|
|
2320
|
+
if (symbolsLength === 0) {
|
|
2321
|
+
if (!allowEmpty) {
|
|
2322
|
+
throw new ArgumentsRequired(this.id + ' empty list of symbols is not supported');
|
|
2323
|
+
}
|
|
2314
2324
|
return symbols;
|
|
2315
2325
|
}
|
|
2316
2326
|
const result = [];
|
package/js/src/bitmart.js
CHANGED
|
@@ -2202,8 +2202,10 @@ export default class bitmart extends Exchange {
|
|
|
2202
2202
|
* @name bitmart#cancelAllOrders
|
|
2203
2203
|
* @description cancel all open orders in a market
|
|
2204
2204
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
|
2205
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
|
2205
2206
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
2206
2207
|
* @param {object} [params] extra parameters specific to the bitmart api endpoint
|
|
2208
|
+
* @param {string} [params.side] *spot only* 'buy' or 'sell'
|
|
2207
2209
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
2208
2210
|
*/
|
|
2209
2211
|
await this.loadMarkets();
|
|
@@ -2213,17 +2215,18 @@ export default class bitmart extends Exchange {
|
|
|
2213
2215
|
market = this.market(symbol);
|
|
2214
2216
|
request['symbol'] = market['id'];
|
|
2215
2217
|
}
|
|
2218
|
+
let response = undefined;
|
|
2216
2219
|
let type = undefined;
|
|
2217
2220
|
[type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
2218
|
-
if (type
|
|
2219
|
-
|
|
2221
|
+
if (type === 'spot') {
|
|
2222
|
+
response = await this.privatePostSpotV1CancelOrders(this.extend(request, params));
|
|
2220
2223
|
}
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
params = this.omit(params, 'side');
|
|
2224
|
+
else if (type === 'swap') {
|
|
2225
|
+
this.checkRequiredSymbol('cancelAllOrders', symbol);
|
|
2226
|
+
response = await this.privatePostContractPrivateCancelOrders(this.extend(request, params));
|
|
2225
2227
|
}
|
|
2226
|
-
|
|
2228
|
+
//
|
|
2229
|
+
// spot
|
|
2227
2230
|
//
|
|
2228
2231
|
// {
|
|
2229
2232
|
// "code": 1000,
|
|
@@ -2232,6 +2235,14 @@ export default class bitmart extends Exchange {
|
|
|
2232
2235
|
// "data": {}
|
|
2233
2236
|
// }
|
|
2234
2237
|
//
|
|
2238
|
+
// swap
|
|
2239
|
+
//
|
|
2240
|
+
// {
|
|
2241
|
+
// "code": 1000,
|
|
2242
|
+
// "message": "Ok",
|
|
2243
|
+
// "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.70.16954131323145323"
|
|
2244
|
+
// }
|
|
2245
|
+
//
|
|
2235
2246
|
return response;
|
|
2236
2247
|
}
|
|
2237
2248
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/js/src/bybit.js
CHANGED
|
@@ -3606,7 +3606,6 @@ export default class bybit extends Exchange {
|
|
|
3606
3606
|
* @param {boolean} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
3607
3607
|
* @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
|
|
3608
3608
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
3609
|
-
* @param {int} [params.triggerDirection] *contract only* conditional orders, 1: triggered when market price rises to triggerPrice, 2: triggered when market price falls to triggerPrice
|
|
3610
3609
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
3611
3610
|
*/
|
|
3612
3611
|
await this.loadMarkets();
|
|
@@ -3714,6 +3713,7 @@ export default class bybit extends Exchange {
|
|
|
3714
3713
|
const isBuy = side === 'buy';
|
|
3715
3714
|
const ascending = stopLossTriggerPrice ? !isBuy : isBuy;
|
|
3716
3715
|
if (triggerPrice !== undefined) {
|
|
3716
|
+
request['triggerDirection'] = ascending ? 2 : 1;
|
|
3717
3717
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
3718
3718
|
}
|
|
3719
3719
|
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -1220,7 +1220,8 @@ export default class krakenfutures extends Exchange {
|
|
|
1220
1220
|
let statusId = undefined;
|
|
1221
1221
|
let price = undefined;
|
|
1222
1222
|
let trades = [];
|
|
1223
|
-
|
|
1223
|
+
const orderEventsLength = orderEvents.length;
|
|
1224
|
+
if (orderEventsLength) {
|
|
1224
1225
|
const executions = [];
|
|
1225
1226
|
for (let i = 0; i < orderEvents.length; i++) {
|
|
1226
1227
|
const item = orderEvents[i];
|
|
@@ -1328,7 +1329,7 @@ export default class krakenfutures extends Exchange {
|
|
|
1328
1329
|
return this.safeOrder({
|
|
1329
1330
|
'info': order,
|
|
1330
1331
|
'id': id,
|
|
1331
|
-
'clientOrderId': this.
|
|
1332
|
+
'clientOrderId': this.safeStringN(details, ['clientOrderId', 'clientId', 'cliOrdId']),
|
|
1332
1333
|
'timestamp': timestamp,
|
|
1333
1334
|
'datetime': this.iso8601(timestamp),
|
|
1334
1335
|
'lastTradeTimestamp': undefined,
|
package/js/src/kucoin.js
CHANGED
|
@@ -1085,6 +1085,11 @@ export default class kucoin extends Exchange {
|
|
|
1085
1085
|
const rawPrecision = this.safeString(entry, 'precision');
|
|
1086
1086
|
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
1087
1087
|
const chainsLength = chains.length;
|
|
1088
|
+
if (!chainsLength) {
|
|
1089
|
+
// https://t.me/KuCoin_API/173118
|
|
1090
|
+
isWithdrawEnabled = false;
|
|
1091
|
+
isDepositEnabled = false;
|
|
1092
|
+
}
|
|
1088
1093
|
for (let j = 0; j < chainsLength; j++) {
|
|
1089
1094
|
const chain = chains[j];
|
|
1090
1095
|
const chainId = this.safeString(chain, 'chain');
|
package/js/src/pro/bybit.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export default class bybit extends bybitRest {
|
|
|
7
7
|
getUrlByMarketType(symbol?: string, isPrivate?: boolean, method?: any, params?: {}): any;
|
|
8
8
|
cleanParams(params: any): any;
|
|
9
9
|
watchTicker(symbol: string, params?: {}): Promise<any>;
|
|
10
|
+
watchTickers(symbols?: string[], params?: {}): Promise<any>;
|
|
10
11
|
handleTicker(client: Client, message: any): void;
|
|
11
12
|
watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
12
13
|
watchOHLCVForSymbols(symbolsAndTimeframes: string[][], since?: Int, limit?: Int, params?: {}): Promise<import("../base/types.js").Dictionary<import("../base/types.js").Dictionary<import("../base/types.js").OHLCV[]>>>;
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -23,7 +23,7 @@ export default class bybit extends bybitRest {
|
|
|
23
23
|
'watchOrderBookForSymbols': true,
|
|
24
24
|
'watchOrders': true,
|
|
25
25
|
'watchTicker': true,
|
|
26
|
-
'watchTickers':
|
|
26
|
+
'watchTickers': true,
|
|
27
27
|
'watchTrades': true,
|
|
28
28
|
'watchTradesForSymbols': true,
|
|
29
29
|
'watchPosition': undefined,
|
|
@@ -185,6 +185,36 @@ export default class bybit extends bybitRest {
|
|
|
185
185
|
const topics = [topic];
|
|
186
186
|
return await this.watchTopics(url, messageHash, topics, params);
|
|
187
187
|
}
|
|
188
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
189
|
+
/**
|
|
190
|
+
* @method
|
|
191
|
+
* @name bybit#watchTickers
|
|
192
|
+
* @description n watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
193
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
|
|
194
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
|
|
195
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
196
|
+
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
197
|
+
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
198
|
+
*/
|
|
199
|
+
await this.loadMarkets();
|
|
200
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
201
|
+
const messageHash = 'tickers::' + symbols.join(',');
|
|
202
|
+
const url = this.getUrlByMarketType(symbols[0], false, params);
|
|
203
|
+
params = this.cleanParams(params);
|
|
204
|
+
const options = this.safeValue(this.options, 'watchTickers', {});
|
|
205
|
+
const topic = this.safeString(options, 'name', 'tickers');
|
|
206
|
+
const marketIds = this.marketIds(symbols);
|
|
207
|
+
const topics = [];
|
|
208
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
209
|
+
const marketId = marketIds[i];
|
|
210
|
+
topics.push(topic + '.' + marketId);
|
|
211
|
+
}
|
|
212
|
+
const ticker = await this.watchTopics(url, messageHash, topics, params);
|
|
213
|
+
if (this.newUpdates) {
|
|
214
|
+
return ticker;
|
|
215
|
+
}
|
|
216
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
217
|
+
}
|
|
188
218
|
handleTicker(client, message) {
|
|
189
219
|
//
|
|
190
220
|
// linear
|
|
@@ -315,6 +345,17 @@ export default class bybit extends bybitRest {
|
|
|
315
345
|
this.tickers[symbol] = parsed;
|
|
316
346
|
const messageHash = 'ticker:' + symbol;
|
|
317
347
|
client.resolve(this.tickers[symbol], messageHash);
|
|
348
|
+
// watchTickers part
|
|
349
|
+
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
350
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
351
|
+
const messageHash = messageHashes[i];
|
|
352
|
+
const parts = messageHash.split('::');
|
|
353
|
+
const symbolsString = parts[1];
|
|
354
|
+
const symbols = symbolsString.split(',');
|
|
355
|
+
if (this.inArray(parsed['symbol'], symbols)) {
|
|
356
|
+
client.resolve(parsed, messageHash);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
318
359
|
}
|
|
319
360
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
320
361
|
/**
|
package/package.json
CHANGED
package/skip-tests.json
CHANGED
|
@@ -366,7 +366,8 @@
|
|
|
366
366
|
},
|
|
367
367
|
"fetchTickers": {
|
|
368
368
|
"bid":"broken bid-ask",
|
|
369
|
-
"ask":"broken bid-ask"
|
|
369
|
+
"ask":"broken bid-ask",
|
|
370
|
+
"quoteVolume": "quoteVolume >= baseVolume * low is failing https://app.travis-ci.com/github/ccxt/ccxt/builds/266144312#L2220"
|
|
370
371
|
}
|
|
371
372
|
}
|
|
372
373
|
},
|