ccxt 4.1.100 → 4.2.2
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 +3 -3
- package/dist/ccxt.browser.js +1384 -1215
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bingx.js +76 -37
- package/dist/cjs/src/bitget.js +11 -6
- package/dist/cjs/src/bitstamp.js +37 -13
- 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/lykke.js +14 -3
- package/dist/cjs/src/poloniexfutures.js +22 -11
- package/dist/cjs/src/pro/binance.js +24 -21
- package/dist/cjs/src/pro/bitmart.js +85 -50
- package/dist/cjs/src/pro/bybit.js +7 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/binance.js +1 -0
- package/js/src/bingx.js +76 -37
- package/js/src/bitget.js +11 -6
- package/js/src/bitstamp.js +37 -13
- package/js/src/cex.js +6 -5
- package/js/src/deribit.js +38 -26
- package/js/src/kucoinfutures.js +9 -4
- package/js/src/lykke.js +14 -3
- package/js/src/poloniexfutures.js +22 -11
- package/js/src/pro/binance.js +24 -21
- package/js/src/pro/bitmart.js +85 -50
- package/js/src/pro/bybit.js +7 -2
- package/package.json +1 -1
- package/skip-tests.json +2 -1
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/bybit.js
CHANGED
|
@@ -889,10 +889,15 @@ export default class bybit extends bybitRest {
|
|
|
889
889
|
}
|
|
890
890
|
const trades = this.myTrades;
|
|
891
891
|
const symbols = {};
|
|
892
|
-
const method = spot ? 'parseWsTrade' : 'parseTrade';
|
|
893
892
|
for (let i = 0; i < data.length; i++) {
|
|
894
893
|
const rawTrade = data[i];
|
|
895
|
-
|
|
894
|
+
let parsed = undefined;
|
|
895
|
+
if (spot) {
|
|
896
|
+
parsed = this.parseWsTrade(rawTrade);
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
parsed = this.parseTrade(rawTrade);
|
|
900
|
+
}
|
|
896
901
|
const symbol = parsed['symbol'];
|
|
897
902
|
symbols[symbol] = true;
|
|
898
903
|
trades.append(parsed);
|
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": {
|