ccxt 4.5.3 → 4.5.4
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 +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +67 -5
- package/dist/cjs/src/base/functions/encode.js +8 -0
- package/dist/cjs/src/base/functions/rsa.js +14 -1
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/binance.js +7 -4
- package/dist/cjs/src/bitvavo.js +8 -0
- package/dist/cjs/src/bybit.js +20 -6
- package/dist/cjs/src/coinbase.js +28 -10
- package/dist/cjs/src/coincatch.js +32 -19
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +3 -2
- package/dist/cjs/src/okx.js +2 -1
- package/dist/cjs/src/pro/bitget.js +111 -14
- package/dist/cjs/src/pro/bybit.js +64 -8
- package/dist/cjs/src/pro/coinex.js +10 -11
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/myokx.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/okxus.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +67 -5
- package/js/src/base/functions/encode.d.ts +2 -1
- package/js/src/base/functions/encode.js +8 -1
- package/js/src/base/functions/rsa.js +16 -3
- package/js/src/binance.js +7 -4
- package/js/src/bitvavo.js +8 -0
- package/js/src/bybit.js +20 -6
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +28 -10
- package/js/src/coincatch.d.ts +2 -0
- package/js/src/coincatch.js +32 -19
- package/js/src/delta.js +1 -0
- package/js/src/kucoinfutures.js +3 -2
- package/js/src/okx.js +2 -1
- package/js/src/pro/bitget.d.ts +3 -1
- package/js/src/pro/bitget.js +111 -14
- package/js/src/pro/bybit.d.ts +4 -0
- package/js/src/pro/bybit.js +64 -8
- package/js/src/pro/coinex.js +11 -12
- package/package.json +3 -3
package/js/src/pro/bybit.js
CHANGED
|
@@ -1244,11 +1244,13 @@ export default class bybit extends bybitRest {
|
|
|
1244
1244
|
* @name bybit#watchMyTrades
|
|
1245
1245
|
* @description watches information on multiple trades made by the user
|
|
1246
1246
|
* @see https://bybit-exchange.github.io/docs/v5/websocket/private/execution
|
|
1247
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution
|
|
1247
1248
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1248
1249
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1249
1250
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
1250
1251
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1251
1252
|
* @param {boolean} [params.unifiedMargin] use unified margin account
|
|
1253
|
+
* @param {boolean} [params.executionFast] use fast execution
|
|
1252
1254
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1253
1255
|
*/
|
|
1254
1256
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -1266,7 +1268,12 @@ export default class bybit extends bybitRest {
|
|
|
1266
1268
|
'unified': 'execution',
|
|
1267
1269
|
'usdc': 'user.openapi.perp.trade',
|
|
1268
1270
|
};
|
|
1269
|
-
|
|
1271
|
+
let topic = this.safeValue(topicByMarket, this.getPrivateType(url));
|
|
1272
|
+
let executionFast = false;
|
|
1273
|
+
[executionFast, params] = this.handleOptionAndParams(params, 'watchMyTrades', 'executionFast', false);
|
|
1274
|
+
if (executionFast) {
|
|
1275
|
+
topic = 'execution.fast';
|
|
1276
|
+
}
|
|
1270
1277
|
const trades = await this.watchTopics(url, [messageHash], [topic], params);
|
|
1271
1278
|
if (this.newUpdates) {
|
|
1272
1279
|
limit = trades.getLimit(symbol, limit);
|
|
@@ -1278,9 +1285,11 @@ export default class bybit extends bybitRest {
|
|
|
1278
1285
|
* @name bybit#unWatchMyTrades
|
|
1279
1286
|
* @description unWatches information on multiple trades made by the user
|
|
1280
1287
|
* @see https://bybit-exchange.github.io/docs/v5/websocket/private/execution
|
|
1288
|
+
* @see https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution
|
|
1281
1289
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1282
1290
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1283
1291
|
* @param {boolean} [params.unifiedMargin] use unified margin account
|
|
1292
|
+
* @param {boolean} [params.executionFast] use fast execution
|
|
1284
1293
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1285
1294
|
*/
|
|
1286
1295
|
async unWatchMyTrades(symbol = undefined, params = {}) {
|
|
@@ -1298,7 +1307,12 @@ export default class bybit extends bybitRest {
|
|
|
1298
1307
|
'unified': 'execution',
|
|
1299
1308
|
'usdc': 'user.openapi.perp.trade',
|
|
1300
1309
|
};
|
|
1301
|
-
|
|
1310
|
+
let topic = this.safeValue(topicByMarket, this.getPrivateType(url));
|
|
1311
|
+
let executionFast = false;
|
|
1312
|
+
[executionFast, params] = this.handleOptionAndParams(params, 'watchMyTrades', 'executionFast', false);
|
|
1313
|
+
if (executionFast) {
|
|
1314
|
+
topic = 'execution.fast';
|
|
1315
|
+
}
|
|
1302
1316
|
return await this.unWatchTopics(url, 'myTrades', [], [messageHash], [subHash], [topic], params);
|
|
1303
1317
|
}
|
|
1304
1318
|
handleMyTrades(client, message) {
|
|
@@ -1364,8 +1378,31 @@ export default class bybit extends bybitRest {
|
|
|
1364
1378
|
// ]
|
|
1365
1379
|
// }
|
|
1366
1380
|
//
|
|
1381
|
+
// execution.fast
|
|
1382
|
+
//
|
|
1383
|
+
// {
|
|
1384
|
+
// "topic": "execution.fast",
|
|
1385
|
+
// "creationTime": 1757405601981,
|
|
1386
|
+
// "data": [
|
|
1387
|
+
// {
|
|
1388
|
+
// "category": "linear",
|
|
1389
|
+
// "symbol": "BTCUSDT",
|
|
1390
|
+
// "execId": "ffcac6ac-7571-536d-a28a-847dd7d08a0f",
|
|
1391
|
+
// "execPrice": "112529.6",
|
|
1392
|
+
// "execQty": "0.001",
|
|
1393
|
+
// "orderId": "6e25ab73-7a55-4ae7-adc2-8ea95f167c85",
|
|
1394
|
+
// "isMaker": false,
|
|
1395
|
+
// "orderLinkId": "test-00001",
|
|
1396
|
+
// "side": "Buy",
|
|
1397
|
+
// "execTime": "1757405601977",
|
|
1398
|
+
// "seq": 9515624038
|
|
1399
|
+
// }
|
|
1400
|
+
// ]
|
|
1401
|
+
// }
|
|
1402
|
+
//
|
|
1367
1403
|
const topic = this.safeString(message, 'topic');
|
|
1368
1404
|
const spot = topic === 'ticketInfo';
|
|
1405
|
+
const executionFast = topic === 'execution.fast';
|
|
1369
1406
|
let data = this.safeValue(message, 'data', []);
|
|
1370
1407
|
if (!Array.isArray(data)) {
|
|
1371
1408
|
data = this.safeValue(data, 'result', []);
|
|
@@ -1380,12 +1417,15 @@ export default class bybit extends bybitRest {
|
|
|
1380
1417
|
for (let i = 0; i < data.length; i++) {
|
|
1381
1418
|
const rawTrade = data[i];
|
|
1382
1419
|
let parsed = undefined;
|
|
1383
|
-
if (spot) {
|
|
1420
|
+
if (spot && !executionFast) {
|
|
1384
1421
|
parsed = this.parseWsTrade(rawTrade);
|
|
1385
1422
|
}
|
|
1386
1423
|
else {
|
|
1387
1424
|
// filter unified trades
|
|
1388
|
-
|
|
1425
|
+
let execType = this.safeString(rawTrade, 'execType', '');
|
|
1426
|
+
if (executionFast) {
|
|
1427
|
+
execType = 'Trade';
|
|
1428
|
+
}
|
|
1389
1429
|
if (!this.inArray(execType, filterExecTypes)) {
|
|
1390
1430
|
continue;
|
|
1391
1431
|
}
|
|
@@ -2341,12 +2381,13 @@ export default class bybit extends bybitRest {
|
|
|
2341
2381
|
}
|
|
2342
2382
|
}
|
|
2343
2383
|
handleMessage(client, message) {
|
|
2384
|
+
const topic = this.safeString2(message, 'topic', 'op', '');
|
|
2344
2385
|
if (this.handleErrorMessage(client, message)) {
|
|
2345
2386
|
return;
|
|
2346
2387
|
}
|
|
2347
2388
|
// contract pong
|
|
2348
2389
|
const ret_msg = this.safeString(message, 'ret_msg');
|
|
2349
|
-
if (ret_msg === 'pong') {
|
|
2390
|
+
if ((ret_msg === 'pong') || (topic === 'pong')) {
|
|
2350
2391
|
this.handlePong(client, message);
|
|
2351
2392
|
return;
|
|
2352
2393
|
}
|
|
@@ -2358,11 +2399,10 @@ export default class bybit extends bybitRest {
|
|
|
2358
2399
|
}
|
|
2359
2400
|
// pong
|
|
2360
2401
|
const event = this.safeString(message, 'event');
|
|
2361
|
-
if (event === 'sub') {
|
|
2402
|
+
if (event === 'sub' || (topic === 'subscribe')) {
|
|
2362
2403
|
this.handleSubscriptionStatus(client, message);
|
|
2363
2404
|
return;
|
|
2364
2405
|
}
|
|
2365
|
-
const topic = this.safeString2(message, 'topic', 'op', '');
|
|
2366
2406
|
const methods = {
|
|
2367
2407
|
'orderbook': this.handleOrderBook,
|
|
2368
2408
|
'kline': this.handleOHLCV,
|
|
@@ -2375,6 +2415,7 @@ export default class bybit extends bybitRest {
|
|
|
2375
2415
|
'wallet': this.handleBalance,
|
|
2376
2416
|
'outboundAccountInfo': this.handleBalance,
|
|
2377
2417
|
'execution': this.handleMyTrades,
|
|
2418
|
+
'execution.fast': this.handleMyTrades,
|
|
2378
2419
|
'ticketInfo': this.handleMyTrades,
|
|
2379
2420
|
'user.openapi.perp.trade': this.handleMyTrades,
|
|
2380
2421
|
'position': this.handlePositions,
|
|
@@ -2424,6 +2465,14 @@ export default class bybit extends bybitRest {
|
|
|
2424
2465
|
//
|
|
2425
2466
|
// { pong: 1653296711335 }
|
|
2426
2467
|
//
|
|
2468
|
+
//
|
|
2469
|
+
// {
|
|
2470
|
+
// "req_id": "2",
|
|
2471
|
+
// "op": "pong",
|
|
2472
|
+
// "args": [ "1757405570352" ],
|
|
2473
|
+
// "conn_id": "d266o6hqo29sqmnq4vk0-1yus1"
|
|
2474
|
+
// }
|
|
2475
|
+
//
|
|
2427
2476
|
client.lastPong = this.safeInteger(message, 'pong');
|
|
2428
2477
|
return message;
|
|
2429
2478
|
}
|
|
@@ -2443,6 +2492,13 @@ export default class bybit extends bybitRest {
|
|
|
2443
2492
|
// "connId":"cojifin88smerbj9t560-404"
|
|
2444
2493
|
// }
|
|
2445
2494
|
//
|
|
2495
|
+
// {
|
|
2496
|
+
// "success": true,
|
|
2497
|
+
// "ret_msg": "",
|
|
2498
|
+
// "op": "auth",
|
|
2499
|
+
// "conn_id": "d266o6hqo29sqmnq4vk0-1yus1"
|
|
2500
|
+
// }
|
|
2501
|
+
//
|
|
2446
2502
|
const success = this.safeValue(message, 'success');
|
|
2447
2503
|
const code = this.safeInteger(message, 'retCode');
|
|
2448
2504
|
const messageHash = 'authenticated';
|
|
@@ -2508,7 +2564,7 @@ export default class bybit extends bybitRest {
|
|
|
2508
2564
|
for (let j = 0; j < messageHashes.length; j++) {
|
|
2509
2565
|
const unsubHash = messageHashes[j];
|
|
2510
2566
|
const subHash = subMessageHashes[j];
|
|
2511
|
-
const usePrefix = (subHash === 'orders') || (subHash === 'myTrades');
|
|
2567
|
+
const usePrefix = (subHash === 'orders') || (subHash === 'myTrades') || (subHash === 'positions');
|
|
2512
2568
|
this.cleanUnsubscription(client, subHash, unsubHash, usePrefix);
|
|
2513
2569
|
}
|
|
2514
2570
|
this.cleanCache(subscription);
|
package/js/src/pro/coinex.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import coinexRest from '../coinex.js';
|
|
9
|
-
import { AuthenticationError, BadRequest, RateLimitExceeded, NotSupported, RequestTimeout, ExchangeError, ExchangeNotAvailable } from '../base/errors.js';
|
|
9
|
+
import { AuthenticationError, BadRequest, RateLimitExceeded, NotSupported, RequestTimeout, ExchangeError, ExchangeNotAvailable, ArgumentsRequired } from '../base/errors.js';
|
|
10
10
|
import { ArrayCache, ArrayCacheBySymbolById } from '../base/ws/Cache.js';
|
|
11
11
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
@@ -756,7 +756,6 @@ export default class coinex extends coinexRest {
|
|
|
756
756
|
let type = undefined;
|
|
757
757
|
let callerMethodName = undefined;
|
|
758
758
|
[callerMethodName, params] = this.handleParamString(params, 'callerMethodName', 'watchOrderBookForSymbols');
|
|
759
|
-
[type, params] = this.handleMarketTypeAndParams(callerMethodName, undefined, params);
|
|
760
759
|
const options = this.safeDict(this.options, 'watchOrderBook', {});
|
|
761
760
|
const limits = this.safeList(options, 'limits', []);
|
|
762
761
|
if (limit === undefined) {
|
|
@@ -773,17 +772,16 @@ export default class coinex extends coinexRest {
|
|
|
773
772
|
}
|
|
774
773
|
params = this.omit(params, 'aggregation');
|
|
775
774
|
const symbolsDefined = (symbols !== undefined);
|
|
776
|
-
if (symbolsDefined) {
|
|
777
|
-
|
|
778
|
-
const symbol = symbols[i];
|
|
779
|
-
market = this.market(symbol);
|
|
780
|
-
messageHashes.push('orderbook:' + market['symbol']);
|
|
781
|
-
watchOrderBookSubscriptions[symbol] = [market['id'], limit, aggregation, true];
|
|
782
|
-
}
|
|
775
|
+
if (!symbolsDefined) {
|
|
776
|
+
throw new ArgumentsRequired(this.id + ' watchOrderBookForSymbols() requires a symbol argument');
|
|
783
777
|
}
|
|
784
|
-
|
|
785
|
-
|
|
778
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
779
|
+
const symbol = symbols[i];
|
|
780
|
+
market = this.market(symbol);
|
|
781
|
+
messageHashes.push('orderbook:' + market['symbol']);
|
|
782
|
+
watchOrderBookSubscriptions[symbol] = [market['id'], limit, aggregation, true];
|
|
786
783
|
}
|
|
784
|
+
[type, params] = this.handleMarketTypeAndParams(callerMethodName, market, params);
|
|
787
785
|
const marketList = Object.values(watchOrderBookSubscriptions);
|
|
788
786
|
const subscribe = {
|
|
789
787
|
'method': 'depth.subscribe',
|
|
@@ -850,7 +848,8 @@ export default class coinex extends coinexRest {
|
|
|
850
848
|
// "id": null
|
|
851
849
|
// }
|
|
852
850
|
//
|
|
853
|
-
const
|
|
851
|
+
const isSpot = client.url.indexOf('spot') > -1;
|
|
852
|
+
const defaultType = isSpot ? 'spot' : 'swap';
|
|
854
853
|
const data = this.safeDict(message, 'data', {});
|
|
855
854
|
const depth = this.safeDict(data, 'depth', {});
|
|
856
855
|
const marketId = this.safeString(data, 'market');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccxt",
|
|
3
|
-
"version": "4.5.
|
|
4
|
-
"description": "A JavaScript / TypeScript / Python / C# / PHP
|
|
3
|
+
"version": "4.5.4",
|
|
4
|
+
"description": "A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go",
|
|
5
5
|
"unpkg": "dist/ccxt.browser.min.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"cli.py": "python3 ./examples/py/cli.py",
|
|
69
69
|
"cli.php": "php ./examples/php/cli.php",
|
|
70
70
|
"cli.cs": "dotnet run --project \"./cs/cli/cli.csproj\"",
|
|
71
|
-
"cli.go": "go run ./
|
|
71
|
+
"cli.go": "go run -C go ./cli/main.go",
|
|
72
72
|
"export-exchanges": "node build/export-exchanges",
|
|
73
73
|
"capabilities": "node ./examples/js/exchange-capabilities.js",
|
|
74
74
|
"git-ignore-generated-files": "node build/git-ignore-generated-files.cjs",
|