ccxt 4.1.99 → 4.2.1
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 +101 -100
- package/dist/ccxt.browser.js +2874 -458
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/bitteam.js +9 -0
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/bitget.js +14 -6
- package/dist/cjs/src/bitteam.js +2309 -0
- package/dist/cjs/src/cex.js +6 -5
- package/dist/cjs/src/deribit.js +38 -26
- package/dist/cjs/src/kucoinfutures.js +9 -4
- package/dist/cjs/src/mexc.js +3 -3
- package/dist/cjs/src/okx.js +5 -4
- package/dist/cjs/src/pro/bitmart.js +85 -50
- package/dist/cjs/src/pro/kucoin.js +10 -2
- package/dist/cjs/src/pro/kucoinfutures.js +10 -2
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/bitteam.d.ts +32 -0
- package/js/src/abstract/bitteam.js +11 -0
- package/js/src/base/types.d.ts +1 -0
- package/js/src/bequant.js +1 -1
- package/js/src/bitget.js +14 -6
- package/js/src/bitteam.d.ts +46 -0
- package/js/src/bitteam.js +2310 -0
- package/js/src/cex.js +6 -5
- package/js/src/deribit.js +38 -26
- package/js/src/kucoinfutures.js +9 -4
- package/js/src/mexc.js +3 -3
- package/js/src/okx.js +5 -4
- package/js/src/pro/bitmart.js +85 -50
- package/js/src/pro/kucoin.js +10 -2
- package/js/src/pro/kucoinfutures.js +10 -2
- package/package.json +1 -1
- package/skip-tests.json +15 -1
package/js/src/cex.js
CHANGED
|
@@ -1171,14 +1171,16 @@ export default class cex extends Exchange {
|
|
|
1171
1171
|
*/
|
|
1172
1172
|
await this.loadMarkets();
|
|
1173
1173
|
const request = {};
|
|
1174
|
-
let method = 'privatePostOpenOrders';
|
|
1175
1174
|
let market = undefined;
|
|
1175
|
+
let orders = undefined;
|
|
1176
1176
|
if (symbol !== undefined) {
|
|
1177
1177
|
market = this.market(symbol);
|
|
1178
1178
|
request['pair'] = market['id'];
|
|
1179
|
-
|
|
1179
|
+
orders = await this.privatePostOpenOrdersPair(this.extend(request, params));
|
|
1180
|
+
}
|
|
1181
|
+
else {
|
|
1182
|
+
orders = await this.privatePostOpenOrders(this.extend(request, params));
|
|
1180
1183
|
}
|
|
1181
|
-
const orders = await this[method](this.extend(request, params));
|
|
1182
1184
|
for (let i = 0; i < orders.length; i++) {
|
|
1183
1185
|
orders[i] = this.extend(orders[i], { 'status': 'open' });
|
|
1184
1186
|
}
|
|
@@ -1200,10 +1202,9 @@ export default class cex extends Exchange {
|
|
|
1200
1202
|
throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
1201
1203
|
}
|
|
1202
1204
|
await this.loadMarkets();
|
|
1203
|
-
const method = 'privatePostArchivedOrdersPair';
|
|
1204
1205
|
const market = this.market(symbol);
|
|
1205
1206
|
const request = { 'pair': market['id'] };
|
|
1206
|
-
const response = await this
|
|
1207
|
+
const response = await this.privatePostArchivedOrdersPair(this.extend(request, params));
|
|
1207
1208
|
return this.parseOrders(response, market, since, limit);
|
|
1208
1209
|
}
|
|
1209
1210
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
package/js/src/deribit.js
CHANGED
|
@@ -1320,14 +1320,19 @@ export default class deribit extends Exchange {
|
|
|
1320
1320
|
'instrument_name': market['id'],
|
|
1321
1321
|
'include_old': true,
|
|
1322
1322
|
};
|
|
1323
|
-
const method = (since === undefined) ? 'publicGetGetLastTradesByInstrument' : 'publicGetGetLastTradesByInstrumentAndTime';
|
|
1324
1323
|
if (since !== undefined) {
|
|
1325
1324
|
request['start_timestamp'] = since;
|
|
1326
1325
|
}
|
|
1327
1326
|
if (limit !== undefined) {
|
|
1328
1327
|
request['count'] = Math.min(limit, 1000); // default 10
|
|
1329
1328
|
}
|
|
1330
|
-
|
|
1329
|
+
let response = undefined;
|
|
1330
|
+
if (since === undefined) {
|
|
1331
|
+
response = await this.publicGetGetLastTradesByInstrument(this.extend(request, params));
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
response = await this.publicGetGetLastTradesByInstrumentAndTime(this.extend(request, params));
|
|
1335
|
+
}
|
|
1331
1336
|
//
|
|
1332
1337
|
// {
|
|
1333
1338
|
// "jsonrpc":"2.0",
|
|
@@ -1824,9 +1829,14 @@ export default class deribit extends Exchange {
|
|
|
1824
1829
|
request['time_in_force'] = 'fill_or_kill';
|
|
1825
1830
|
}
|
|
1826
1831
|
}
|
|
1827
|
-
const method = 'privateGet' + this.capitalize(side);
|
|
1828
1832
|
params = this.omit(params, ['timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'reduceOnly']);
|
|
1829
|
-
|
|
1833
|
+
let response = undefined;
|
|
1834
|
+
if (this.capitalize(side) === 'Buy') {
|
|
1835
|
+
response = await this.privateGetBuy(this.extend(request, params));
|
|
1836
|
+
}
|
|
1837
|
+
else {
|
|
1838
|
+
response = await this.privateGetSell(this.extend(request, params));
|
|
1839
|
+
}
|
|
1830
1840
|
//
|
|
1831
1841
|
// {
|
|
1832
1842
|
// "jsonrpc": "2.0",
|
|
@@ -1941,16 +1951,15 @@ export default class deribit extends Exchange {
|
|
|
1941
1951
|
*/
|
|
1942
1952
|
await this.loadMarkets();
|
|
1943
1953
|
const request = {};
|
|
1944
|
-
let
|
|
1954
|
+
let response = undefined;
|
|
1945
1955
|
if (symbol === undefined) {
|
|
1946
|
-
|
|
1956
|
+
response = await this.privateGetCancelAll(this.extend(request, params));
|
|
1947
1957
|
}
|
|
1948
1958
|
else {
|
|
1949
|
-
method = 'privateGetCancelAllByInstrument';
|
|
1950
1959
|
const market = this.market(symbol);
|
|
1951
1960
|
request['instrument_name'] = market['id'];
|
|
1961
|
+
response = await this.privateGetCancelAllByInstrument(this.extend(request, params));
|
|
1952
1962
|
}
|
|
1953
|
-
const response = await this[method](this.extend(request, params));
|
|
1954
1963
|
return response;
|
|
1955
1964
|
}
|
|
1956
1965
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -1967,19 +1976,18 @@ export default class deribit extends Exchange {
|
|
|
1967
1976
|
await this.loadMarkets();
|
|
1968
1977
|
const request = {};
|
|
1969
1978
|
let market = undefined;
|
|
1970
|
-
let
|
|
1979
|
+
let response = undefined;
|
|
1971
1980
|
if (symbol === undefined) {
|
|
1972
1981
|
const code = this.codeFromOptions('fetchOpenOrders', params);
|
|
1973
1982
|
const currency = this.currency(code);
|
|
1974
1983
|
request['currency'] = currency['id'];
|
|
1975
|
-
|
|
1984
|
+
response = await this.privateGetGetOpenOrdersByCurrency(this.extend(request, params));
|
|
1976
1985
|
}
|
|
1977
1986
|
else {
|
|
1978
1987
|
market = this.market(symbol);
|
|
1979
1988
|
request['instrument_name'] = market['id'];
|
|
1980
|
-
|
|
1989
|
+
response = await this.privateGetGetOpenOrdersByInstrument(this.extend(request, params));
|
|
1981
1990
|
}
|
|
1982
|
-
const response = await this[method](this.extend(request, params));
|
|
1983
1991
|
const result = this.safeValue(response, 'result', []);
|
|
1984
1992
|
return this.parseOrders(result, market, since, limit);
|
|
1985
1993
|
}
|
|
@@ -1997,19 +2005,18 @@ export default class deribit extends Exchange {
|
|
|
1997
2005
|
await this.loadMarkets();
|
|
1998
2006
|
const request = {};
|
|
1999
2007
|
let market = undefined;
|
|
2000
|
-
let
|
|
2008
|
+
let response = undefined;
|
|
2001
2009
|
if (symbol === undefined) {
|
|
2002
2010
|
const code = this.codeFromOptions('fetchClosedOrders', params);
|
|
2003
2011
|
const currency = this.currency(code);
|
|
2004
2012
|
request['currency'] = currency['id'];
|
|
2005
|
-
|
|
2013
|
+
response = await this.privateGetGetOrderHistoryByCurrency(this.extend(request, params));
|
|
2006
2014
|
}
|
|
2007
2015
|
else {
|
|
2008
2016
|
market = this.market(symbol);
|
|
2009
2017
|
request['instrument_name'] = market['id'];
|
|
2010
|
-
|
|
2018
|
+
response = await this.privateGetGetOrderHistoryByInstrument(this.extend(request, params));
|
|
2011
2019
|
}
|
|
2012
|
-
const response = await this[method](this.extend(request, params));
|
|
2013
2020
|
const result = this.safeValue(response, 'result', []);
|
|
2014
2021
|
return this.parseOrders(result, market, since, limit);
|
|
2015
2022
|
}
|
|
@@ -2082,34 +2089,33 @@ export default class deribit extends Exchange {
|
|
|
2082
2089
|
'include_old': true,
|
|
2083
2090
|
};
|
|
2084
2091
|
let market = undefined;
|
|
2085
|
-
|
|
2092
|
+
if (limit !== undefined) {
|
|
2093
|
+
request['count'] = limit; // default 10
|
|
2094
|
+
}
|
|
2095
|
+
let response = undefined;
|
|
2086
2096
|
if (symbol === undefined) {
|
|
2087
2097
|
const code = this.codeFromOptions('fetchMyTrades', params);
|
|
2088
2098
|
const currency = this.currency(code);
|
|
2089
2099
|
request['currency'] = currency['id'];
|
|
2090
2100
|
if (since === undefined) {
|
|
2091
|
-
|
|
2101
|
+
response = await this.privateGetGetUserTradesByCurrency(this.extend(request, params));
|
|
2092
2102
|
}
|
|
2093
2103
|
else {
|
|
2094
|
-
method = 'privateGetGetUserTradesByCurrencyAndTime';
|
|
2095
2104
|
request['start_timestamp'] = since;
|
|
2105
|
+
response = await this.privateGetGetUserTradesByCurrencyAndTime(this.extend(request, params));
|
|
2096
2106
|
}
|
|
2097
2107
|
}
|
|
2098
2108
|
else {
|
|
2099
2109
|
market = this.market(symbol);
|
|
2100
2110
|
request['instrument_name'] = market['id'];
|
|
2101
2111
|
if (since === undefined) {
|
|
2102
|
-
|
|
2112
|
+
response = await this.privateGetGetUserTradesByInstrument(this.extend(request, params));
|
|
2103
2113
|
}
|
|
2104
2114
|
else {
|
|
2105
|
-
method = 'privateGetGetUserTradesByInstrumentAndTime';
|
|
2106
2115
|
request['start_timestamp'] = since;
|
|
2116
|
+
response = await this.privateGetGetUserTradesByInstrumentAndTime(this.extend(request, params));
|
|
2107
2117
|
}
|
|
2108
2118
|
}
|
|
2109
|
-
if (limit !== undefined) {
|
|
2110
|
-
request['count'] = limit; // default 10
|
|
2111
|
-
}
|
|
2112
|
-
const response = await this[method](this.extend(request, params));
|
|
2113
2119
|
//
|
|
2114
2120
|
// {
|
|
2115
2121
|
// "jsonrpc": "2.0",
|
|
@@ -2643,7 +2649,13 @@ export default class deribit extends Exchange {
|
|
|
2643
2649
|
const transferOptions = this.safeValue(this.options, 'transfer', {});
|
|
2644
2650
|
method = this.safeString(transferOptions, 'method', 'privateGetSubmitTransferToSubaccount');
|
|
2645
2651
|
}
|
|
2646
|
-
|
|
2652
|
+
let response = undefined;
|
|
2653
|
+
if (method === 'privateGetSubmitTransferToUser') {
|
|
2654
|
+
response = await this.privateGetSubmitTransferToUser(this.extend(request, params));
|
|
2655
|
+
}
|
|
2656
|
+
else {
|
|
2657
|
+
response = await this.privateGetSubmitTransferToSubaccount(this.extend(request, params));
|
|
2658
|
+
}
|
|
2647
2659
|
//
|
|
2648
2660
|
// {
|
|
2649
2661
|
// "jsonrpc": "2.0",
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -1735,14 +1735,18 @@ export default class kucoinfutures extends kucoin {
|
|
|
1735
1735
|
const cancelExist = this.safeValue(order, 'cancelExist', false);
|
|
1736
1736
|
let status = isActive ? 'open' : 'closed';
|
|
1737
1737
|
status = cancelExist ? 'canceled' : status;
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1738
|
+
let fee = undefined;
|
|
1739
|
+
if (feeCost !== undefined) {
|
|
1740
|
+
fee = {
|
|
1741
|
+
'currency': feeCurrency,
|
|
1742
|
+
'cost': feeCost,
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1742
1745
|
const clientOrderId = this.safeString(order, 'clientOid');
|
|
1743
1746
|
const timeInForce = this.safeString(order, 'timeInForce');
|
|
1744
1747
|
const stopPrice = this.safeNumber(order, 'stopPrice');
|
|
1745
1748
|
const postOnly = this.safeValue(order, 'postOnly');
|
|
1749
|
+
const reduceOnly = this.safeValue(order, 'reduceOnly');
|
|
1746
1750
|
const lastUpdateTimestamp = this.safeInteger(order, 'updatedAt');
|
|
1747
1751
|
return this.safeOrder({
|
|
1748
1752
|
'id': orderId,
|
|
@@ -1751,6 +1755,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
1751
1755
|
'type': type,
|
|
1752
1756
|
'timeInForce': timeInForce,
|
|
1753
1757
|
'postOnly': postOnly,
|
|
1758
|
+
'reduceOnly': reduceOnly,
|
|
1754
1759
|
'side': side,
|
|
1755
1760
|
'amount': amount,
|
|
1756
1761
|
'price': price,
|
package/js/src/mexc.js
CHANGED
|
@@ -445,7 +445,7 @@ export default class mexc extends Exchange {
|
|
|
445
445
|
'BCH': 'BCH',
|
|
446
446
|
'TRC20': 'Tron(TRC20)',
|
|
447
447
|
'ERC20': 'Ethereum(ERC20)',
|
|
448
|
-
'BEP20': '
|
|
448
|
+
'BEP20': 'BNB Smart Chain(BEP20)',
|
|
449
449
|
'OPTIMISM': 'Optimism(OP)',
|
|
450
450
|
'SOL': 'Solana(SOL)',
|
|
451
451
|
'CRC20': 'CRONOS',
|
|
@@ -1043,7 +1043,7 @@ export default class mexc extends Exchange {
|
|
|
1043
1043
|
'Algorand(ALGO)': 'ALGO',
|
|
1044
1044
|
'ArbitrumOne(ARB)': 'ARBONE',
|
|
1045
1045
|
'AvalancheCChain(AVAXCCHAIN)': 'AVAXC',
|
|
1046
|
-
'
|
|
1046
|
+
'BNB Smart Chain(BEP20)': 'BEP20',
|
|
1047
1047
|
'Polygon(MATIC)': 'MATIC',
|
|
1048
1048
|
'Optimism(OP)': 'OPTIMISM',
|
|
1049
1049
|
'Solana(SOL)': 'SOL',
|
|
@@ -4357,8 +4357,8 @@ export default class mexc extends Exchange {
|
|
|
4357
4357
|
/**
|
|
4358
4358
|
* @method
|
|
4359
4359
|
* @name mexc3#createDepositAddress
|
|
4360
|
-
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#generate-deposit-address-supporting-network
|
|
4361
4360
|
* @description create a currency deposit address
|
|
4361
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#generate-deposit-address-supporting-network
|
|
4362
4362
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
4363
4363
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4364
4364
|
* @param {string} [params.network] the blockchain network name
|
package/js/src/okx.js
CHANGED
|
@@ -874,8 +874,8 @@ export default class okx extends Exchange {
|
|
|
874
874
|
'ALGO': 'Algorand',
|
|
875
875
|
'BHP': 'BHP',
|
|
876
876
|
'APT': 'Aptos',
|
|
877
|
-
'ARBONE': 'Arbitrum
|
|
878
|
-
'AVAXC': 'Avalanche C
|
|
877
|
+
'ARBONE': 'Arbitrum One',
|
|
878
|
+
'AVAXC': 'Avalanche C',
|
|
879
879
|
'AVAXX': 'Avalanche X-Chain',
|
|
880
880
|
'ARK': 'ARK',
|
|
881
881
|
'AR': 'Arweave',
|
|
@@ -4469,15 +4469,16 @@ export default class okx extends Exchange {
|
|
|
4469
4469
|
// },
|
|
4470
4470
|
//
|
|
4471
4471
|
if (chain === 'USDT-Polygon') {
|
|
4472
|
-
networkData = this.
|
|
4472
|
+
networkData = this.safeValue2(networksById, 'USDT-Polygon-Bridge', 'USDT-Polygon');
|
|
4473
4473
|
}
|
|
4474
4474
|
const network = this.safeString(networkData, 'network');
|
|
4475
|
+
const networkCode = this.networkIdToCode(network, code);
|
|
4475
4476
|
this.checkAddress(address);
|
|
4476
4477
|
return {
|
|
4477
4478
|
'currency': code,
|
|
4478
4479
|
'address': address,
|
|
4479
4480
|
'tag': tag,
|
|
4480
|
-
'network':
|
|
4481
|
+
'network': networkCode,
|
|
4481
4482
|
'info': depositAddress,
|
|
4482
4483
|
};
|
|
4483
4484
|
}
|
package/js/src/pro/bitmart.js
CHANGED
|
@@ -54,7 +54,7 @@ export default class bitmart extends bitmartRest {
|
|
|
54
54
|
'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
|
|
55
55
|
},
|
|
56
56
|
'watchOrderBook': {
|
|
57
|
-
'depth': '
|
|
57
|
+
'depth': 'depth/increase100', // depth/increase100, depth5, depth20, depth50
|
|
58
58
|
},
|
|
59
59
|
'ws': {
|
|
60
60
|
'inflate': true,
|
|
@@ -1072,6 +1072,7 @@ export default class bitmart extends bitmartRest {
|
|
|
1072
1072
|
* @method
|
|
1073
1073
|
* @name bitmart#watchOrderBook
|
|
1074
1074
|
* @see https://developer-pro.bitmart.com/en/spot/#public-depth-all-channel
|
|
1075
|
+
* @see https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel
|
|
1075
1076
|
* @see https://developer-pro.bitmart.com/en/futures/#public-depth-channel
|
|
1076
1077
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1077
1078
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
@@ -1081,11 +1082,14 @@ export default class bitmart extends bitmartRest {
|
|
|
1081
1082
|
*/
|
|
1082
1083
|
await this.loadMarkets();
|
|
1083
1084
|
const options = this.safeValue(this.options, 'watchOrderBook', {});
|
|
1084
|
-
|
|
1085
|
+
let depth = this.safeString(options, 'depth', 'depth/increase100');
|
|
1085
1086
|
symbol = this.symbol(symbol);
|
|
1086
1087
|
const market = this.market(symbol);
|
|
1087
1088
|
let type = 'spot';
|
|
1088
1089
|
[type, params] = this.handleMarketTypeAndParams('watchOrderBook', market, params);
|
|
1090
|
+
if (type === 'swap' && depth === 'depth/increase100') {
|
|
1091
|
+
depth = 'depth50';
|
|
1092
|
+
}
|
|
1089
1093
|
const orderbook = await this.subscribe(depth, symbol, type, params);
|
|
1090
1094
|
return orderbook.limit();
|
|
1091
1095
|
}
|
|
@@ -1134,46 +1138,72 @@ export default class bitmart extends bitmartRest {
|
|
|
1134
1138
|
}
|
|
1135
1139
|
handleOrderBook(client, message) {
|
|
1136
1140
|
//
|
|
1137
|
-
// spot
|
|
1138
|
-
//
|
|
1139
|
-
//
|
|
1140
|
-
//
|
|
1141
|
-
//
|
|
1142
|
-
//
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1145
|
-
//
|
|
1146
|
-
//
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
//
|
|
1141
|
+
// spot depth-all
|
|
1142
|
+
// {
|
|
1143
|
+
// "data": [
|
|
1144
|
+
// {
|
|
1145
|
+
// "asks": [
|
|
1146
|
+
// [ '46828.38', "0.21847" ],
|
|
1147
|
+
// [ '46830.68', "0.08232" ],
|
|
1148
|
+
// ...
|
|
1149
|
+
// ],
|
|
1150
|
+
// "bids": [
|
|
1151
|
+
// [ '46820.78', "0.00444" ],
|
|
1152
|
+
// [ '46814.33', "0.00234" ],
|
|
1153
|
+
// ...
|
|
1154
|
+
// ],
|
|
1155
|
+
// "ms_t": 1631044962431,
|
|
1156
|
+
// "symbol": "BTC_USDT"
|
|
1157
|
+
// }
|
|
1158
|
+
// ],
|
|
1159
|
+
// "table": "spot/depth5"
|
|
1160
|
+
// }
|
|
1161
|
+
// spot increse depth snapshot
|
|
1162
|
+
// {
|
|
1163
|
+
// "data":[
|
|
1164
|
+
// {
|
|
1165
|
+
// "asks":[
|
|
1166
|
+
// [
|
|
1167
|
+
// "43652.52",
|
|
1168
|
+
// "0.02039"
|
|
1150
1169
|
// ],
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
//
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
//
|
|
1170
|
+
// ...
|
|
1171
|
+
// ],
|
|
1172
|
+
// "bids":[
|
|
1173
|
+
// [
|
|
1174
|
+
// "43652.51",
|
|
1175
|
+
// "0.00500"
|
|
1176
|
+
// ],
|
|
1177
|
+
// ...
|
|
1178
|
+
// ],
|
|
1179
|
+
// "ms_t":1703376836487,
|
|
1180
|
+
// "symbol":"BTC_USDT",
|
|
1181
|
+
// "type":"snapshot", // or update
|
|
1182
|
+
// "version":2141731
|
|
1183
|
+
// }
|
|
1184
|
+
// ],
|
|
1185
|
+
// "table":"spot/depth/increase100"
|
|
1186
|
+
// }
|
|
1157
1187
|
// swap
|
|
1158
|
-
//
|
|
1159
|
-
//
|
|
1160
|
-
//
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1164
|
-
//
|
|
1165
|
-
//
|
|
1166
|
-
//
|
|
1167
|
-
//
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
//
|
|
1172
|
-
//
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1175
|
-
//
|
|
1176
|
-
//
|
|
1188
|
+
// {
|
|
1189
|
+
// "group":"futures/depth50:BTCUSDT",
|
|
1190
|
+
// "data":{
|
|
1191
|
+
// "symbol":"BTCUSDT",
|
|
1192
|
+
// "way":1,
|
|
1193
|
+
// "depths":[
|
|
1194
|
+
// {
|
|
1195
|
+
// "price":"39509.8",
|
|
1196
|
+
// "vol":"2379"
|
|
1197
|
+
// },
|
|
1198
|
+
// {
|
|
1199
|
+
// "price":"39509.6",
|
|
1200
|
+
// "vol":"6815"
|
|
1201
|
+
// },
|
|
1202
|
+
// ...
|
|
1203
|
+
// ],
|
|
1204
|
+
// "ms_t":1701566021194
|
|
1205
|
+
// }
|
|
1206
|
+
// }
|
|
1177
1207
|
//
|
|
1178
1208
|
const data = this.safeValue(message, 'data');
|
|
1179
1209
|
if (data === undefined) {
|
|
@@ -1182,12 +1212,16 @@ export default class bitmart extends bitmartRest {
|
|
|
1182
1212
|
const depths = this.safeValue(data, 'depths');
|
|
1183
1213
|
const isSpot = (depths === undefined);
|
|
1184
1214
|
const table = this.safeString2(message, 'table', 'group');
|
|
1185
|
-
|
|
1186
|
-
const
|
|
1187
|
-
let
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1215
|
+
// find limit subscribed to
|
|
1216
|
+
const limitsToCheck = ['100', '50', '20', '10', '5'];
|
|
1217
|
+
let limit = 0;
|
|
1218
|
+
for (let i = 0; i < limitsToCheck.length; i++) {
|
|
1219
|
+
const limitString = limitsToCheck[i];
|
|
1220
|
+
if (table.indexOf(limitString) >= 0) {
|
|
1221
|
+
limit = this.parseToInt(limitString);
|
|
1222
|
+
break;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1191
1225
|
if (isSpot) {
|
|
1192
1226
|
for (let i = 0; i < data.length; i++) {
|
|
1193
1227
|
const update = data[i];
|
|
@@ -1199,7 +1233,10 @@ export default class bitmart extends bitmartRest {
|
|
|
1199
1233
|
orderbook['symbol'] = symbol;
|
|
1200
1234
|
this.orderbooks[symbol] = orderbook;
|
|
1201
1235
|
}
|
|
1202
|
-
|
|
1236
|
+
const type = this.safeValue(update, 'type');
|
|
1237
|
+
if ((type === 'snapshot') || (!(table.indexOf('increase') >= 0))) {
|
|
1238
|
+
orderbook.reset({});
|
|
1239
|
+
}
|
|
1203
1240
|
this.handleOrderBookMessage(client, update, orderbook);
|
|
1204
1241
|
const timestamp = this.safeInteger(update, 'ms_t');
|
|
1205
1242
|
orderbook['timestamp'] = timestamp;
|
|
@@ -1391,9 +1428,7 @@ export default class bitmart extends bitmartRest {
|
|
|
1391
1428
|
}
|
|
1392
1429
|
else {
|
|
1393
1430
|
const methods = {
|
|
1394
|
-
'
|
|
1395
|
-
'depth20': this.handleOrderBook,
|
|
1396
|
-
'depth50': this.handleOrderBook,
|
|
1431
|
+
'depth': this.handleOrderBook,
|
|
1397
1432
|
'ticker': this.handleTicker,
|
|
1398
1433
|
'trade': this.handleTrade,
|
|
1399
1434
|
'kline': this.handleOHLCV,
|
package/js/src/pro/kucoin.js
CHANGED
|
@@ -53,8 +53,9 @@ export default class kucoin extends kucoinRest {
|
|
|
53
53
|
negotiate(privateChannel, params = {}) {
|
|
54
54
|
const connectId = privateChannel ? 'private' : 'public';
|
|
55
55
|
const urls = this.safeValue(this.options, 'urls', {});
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const spawaned = this.safeValue(urls, connectId);
|
|
57
|
+
if (spawaned !== undefined) {
|
|
58
|
+
return spawaned;
|
|
58
59
|
}
|
|
59
60
|
// we store an awaitable to the url
|
|
60
61
|
// so that multiple calls don't asynchronously
|
|
@@ -1025,6 +1026,13 @@ export default class kucoin extends kucoinRest {
|
|
|
1025
1026
|
// }
|
|
1026
1027
|
//
|
|
1027
1028
|
const data = this.safeString(message, 'data', '');
|
|
1029
|
+
if (data === 'token is expired') {
|
|
1030
|
+
let type = 'public';
|
|
1031
|
+
if (client.url.indexOf('connectId=private') >= 0) {
|
|
1032
|
+
type = 'private';
|
|
1033
|
+
}
|
|
1034
|
+
this.options['urls'][type] = undefined;
|
|
1035
|
+
}
|
|
1028
1036
|
this.handleErrors(undefined, undefined, client.url, undefined, undefined, data, message, undefined, undefined);
|
|
1029
1037
|
}
|
|
1030
1038
|
handleMessage(client, message) {
|
|
@@ -63,8 +63,9 @@ export default class kucoinfutures extends kucoinfuturesRest {
|
|
|
63
63
|
negotiate(privateChannel, params = {}) {
|
|
64
64
|
const connectId = privateChannel ? 'private' : 'public';
|
|
65
65
|
const urls = this.safeValue(this.options, 'urls', {});
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const spawaned = this.safeValue(urls, connectId);
|
|
67
|
+
if (spawaned !== undefined) {
|
|
68
|
+
return spawaned;
|
|
68
69
|
}
|
|
69
70
|
// we store an awaitable to the url
|
|
70
71
|
// so that multiple calls don't asynchronously
|
|
@@ -954,6 +955,13 @@ export default class kucoinfutures extends kucoinfuturesRest {
|
|
|
954
955
|
// }
|
|
955
956
|
//
|
|
956
957
|
const data = this.safeString(message, 'data', '');
|
|
958
|
+
if (data === 'token is expired') {
|
|
959
|
+
let type = 'public';
|
|
960
|
+
if (client.url.indexOf('connectId=private') >= 0) {
|
|
961
|
+
type = 'private';
|
|
962
|
+
}
|
|
963
|
+
this.options['urls'][type] = undefined;
|
|
964
|
+
}
|
|
957
965
|
this.handleErrors(undefined, undefined, client.url, undefined, undefined, data, message, undefined, undefined);
|
|
958
966
|
}
|
|
959
967
|
handleMessage(client, message) {
|
package/package.json
CHANGED
package/skip-tests.json
CHANGED
|
@@ -712,7 +712,8 @@
|
|
|
712
712
|
"skipMethods": {
|
|
713
713
|
"proxies": "probably they do not permit our proxy location",
|
|
714
714
|
"loadMarkets": {
|
|
715
|
-
"active":"is undefined"
|
|
715
|
+
"active":"is undefined",
|
|
716
|
+
"currencyIdAndCode": "messes codes"
|
|
716
717
|
},
|
|
717
718
|
"fetchOHLCV": "unexpected issue",
|
|
718
719
|
"fetchCurrencies": {
|
|
@@ -1650,5 +1651,18 @@
|
|
|
1650
1651
|
"ask": "invalid"
|
|
1651
1652
|
}
|
|
1652
1653
|
}
|
|
1654
|
+
},
|
|
1655
|
+
"bitteam": {
|
|
1656
|
+
"skipPhpAsync": true,
|
|
1657
|
+
"skipMethods": {
|
|
1658
|
+
"loadMarkets": {
|
|
1659
|
+
"taker": "is undefined",
|
|
1660
|
+
"maker": "is undefined"
|
|
1661
|
+
},
|
|
1662
|
+
"fetchCurrencies": {
|
|
1663
|
+
"deposit": "not provided",
|
|
1664
|
+
"withdraw": "not provided"
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1653
1667
|
}
|
|
1654
1668
|
}
|