ccxt 4.4.27 → 4.4.29
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.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +44 -40
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/binance.js +7 -0
- package/dist/cjs/src/bitget.js +99 -6
- package/dist/cjs/src/bitopro.js +21 -21
- package/dist/cjs/src/bitrue.js +28 -28
- package/dist/cjs/src/bitvavo.js +4 -0
- package/dist/cjs/src/bybit.js +51 -646
- package/dist/cjs/src/coincatch.js +24 -4
- package/dist/cjs/src/kraken.js +48 -35
- package/dist/cjs/src/lbank.js +7 -1
- package/dist/cjs/src/pro/binance.js +4 -6
- package/dist/cjs/src/pro/bitvavo.js +2 -1
- package/dist/cjs/src/pro/mexc.js +198 -30
- package/dist/cjs/src/vertex.js +51 -6
- package/dist/cjs/src/wavesexchange.js +1 -0
- package/examples/README.md +0 -2
- package/examples/js/cli.js +7 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +7 -0
- package/js/src/abstract/binancecoinm.d.ts +7 -0
- package/js/src/abstract/binanceus.d.ts +7 -0
- package/js/src/abstract/binanceusdm.d.ts +7 -0
- package/js/src/abstract/bybit.d.ts +0 -13
- package/js/src/alpaca.js +44 -40
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -0
- package/js/src/binance.js +7 -0
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitget.d.ts +2 -1
- package/js/src/bitget.js +99 -6
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitopro.js +21 -21
- package/js/src/bitrue.js +28 -28
- package/js/src/bitvavo.js +4 -0
- package/js/src/bybit.d.ts +0 -8
- package/js/src/bybit.js +51 -646
- package/js/src/coincatch.d.ts +1 -1
- package/js/src/coincatch.js +24 -4
- package/js/src/kraken.js +48 -35
- package/js/src/lbank.js +7 -1
- package/js/src/pro/binance.js +4 -6
- package/js/src/pro/bitvavo.js +2 -1
- package/js/src/pro/mexc.js +198 -30
- package/js/src/vertex.d.ts +4 -2
- package/js/src/vertex.js +51 -6
- package/js/src/wavesexchange.js +1 -0
- package/js/src/whitebit.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2073,13 +2073,23 @@ class coincatch extends coincatch$1 {
|
|
|
2073
2073
|
request['chain'] = this.networkCodeToId(networkCode);
|
|
2074
2074
|
}
|
|
2075
2075
|
const response = await this.privatePostApiSpotV1WalletWithdrawalV2(this.extend(request, params));
|
|
2076
|
-
// todo add after withdrawal
|
|
2077
2076
|
//
|
|
2078
|
-
|
|
2077
|
+
// {
|
|
2078
|
+
// "code": "00000",
|
|
2079
|
+
// "msg": "success",
|
|
2080
|
+
// "data": {
|
|
2081
|
+
// "orderId":888291686266343424",
|
|
2082
|
+
// "clientOrderId":"123"
|
|
2083
|
+
// }
|
|
2084
|
+
// }
|
|
2085
|
+
//
|
|
2086
|
+
const data = this.safeDict(response, 'data', {});
|
|
2087
|
+
return this.parseTransaction(data, currency);
|
|
2079
2088
|
}
|
|
2080
2089
|
parseTransaction(transaction, currency = undefined) {
|
|
2081
2090
|
//
|
|
2082
2091
|
// fetchDeposits
|
|
2092
|
+
//
|
|
2083
2093
|
// {
|
|
2084
2094
|
// "id": "1213046466852196352",
|
|
2085
2095
|
// "txId": "824246b030cd84d56400661303547f43a1d9fef66cf968628dd5112f362053ff",
|
|
@@ -2099,7 +2109,17 @@ class coincatch extends coincatch$1 {
|
|
|
2099
2109
|
// "uTime": "1724938746015"
|
|
2100
2110
|
// }
|
|
2101
2111
|
//
|
|
2102
|
-
|
|
2112
|
+
// withdraw
|
|
2113
|
+
//
|
|
2114
|
+
// {
|
|
2115
|
+
// "code": "00000",
|
|
2116
|
+
// "msg": "success",
|
|
2117
|
+
// "data": {
|
|
2118
|
+
// "orderId":888291686266343424",
|
|
2119
|
+
// "clientOrderId":"123"
|
|
2120
|
+
// }
|
|
2121
|
+
// }
|
|
2122
|
+
//
|
|
2103
2123
|
let status = this.safeString(transaction, 'status');
|
|
2104
2124
|
if (status === 'success') {
|
|
2105
2125
|
status = 'ok';
|
|
@@ -2125,7 +2145,7 @@ class coincatch extends coincatch$1 {
|
|
|
2125
2145
|
}
|
|
2126
2146
|
return {
|
|
2127
2147
|
'info': transaction,
|
|
2128
|
-
'id': id,
|
|
2148
|
+
'id': this.safeString2(transaction, 'id', 'orderId'),
|
|
2129
2149
|
'txid': txid,
|
|
2130
2150
|
'timestamp': timestamp,
|
|
2131
2151
|
'datetime': this.iso8601(timestamp),
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1489,7 +1489,7 @@ class kraken extends kraken$1 {
|
|
|
1489
1489
|
// {
|
|
1490
1490
|
// "error": [],
|
|
1491
1491
|
// "result": {
|
|
1492
|
-
// "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' },
|
|
1492
|
+
// "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' }, // see more examples in "parseOrder"
|
|
1493
1493
|
// "txid": [ 'OEKVV2-IH52O-TPL6GZ' ]
|
|
1494
1494
|
// }
|
|
1495
1495
|
// }
|
|
@@ -1555,9 +1555,10 @@ class kraken extends kraken$1 {
|
|
|
1555
1555
|
}
|
|
1556
1556
|
parseOrderType(status) {
|
|
1557
1557
|
const statuses = {
|
|
1558
|
+
// we dont add "space" delimited orders here (eg. stop loss) because they need separate parsing
|
|
1558
1559
|
'take-profit': 'market',
|
|
1559
|
-
'stop-loss-limit': 'limit',
|
|
1560
1560
|
'stop-loss': 'market',
|
|
1561
|
+
'stop-loss-limit': 'limit',
|
|
1561
1562
|
'take-profit-limit': 'limit',
|
|
1562
1563
|
'trailing-stop-limit': 'limit',
|
|
1563
1564
|
};
|
|
@@ -1565,30 +1566,19 @@ class kraken extends kraken$1 {
|
|
|
1565
1566
|
}
|
|
1566
1567
|
parseOrder(order, market = undefined) {
|
|
1567
1568
|
//
|
|
1568
|
-
// createOrder
|
|
1569
|
+
// createOrder
|
|
1569
1570
|
//
|
|
1570
1571
|
// {
|
|
1571
|
-
// "descr": {
|
|
1572
|
+
// "descr": {
|
|
1573
|
+
// "order": "buy 0.02100000 ETHUSDT @ limit 330.00" // limit orders
|
|
1574
|
+
// "buy 0.12345678 ETHUSDT @ market" // market order
|
|
1575
|
+
// "sell 0.28002676 ETHUSDT @ stop loss 0.0123 -> limit 0.0.1222" // stop order
|
|
1576
|
+
// "sell 0.00100000 ETHUSDT @ stop loss 2677.00 -> limit 2577.00 with 5:1 leverage"
|
|
1577
|
+
// "buy 0.10000000 LTCUSDT @ take profit 75.00000 -> limit 74.00000"
|
|
1578
|
+
// "sell 10.00000000 XRPEUR @ trailing stop +50.0000%" // trailing stop
|
|
1579
|
+
// },
|
|
1572
1580
|
// "txid": [ 'OEKVV2-IH52O-TPL6GZ' ]
|
|
1573
1581
|
// }
|
|
1574
|
-
// {
|
|
1575
|
-
// "txid": [ "TX_ID_HERE" ],
|
|
1576
|
-
// "descr": { "order":"buy 0.12345678 ETHEUR @ market" },
|
|
1577
|
-
// }
|
|
1578
|
-
//
|
|
1579
|
-
//
|
|
1580
|
-
// createOrder for stop orders
|
|
1581
|
-
//
|
|
1582
|
-
// {
|
|
1583
|
-
// "txid":["OSILNC-VQI5Q-775ZDQ"],
|
|
1584
|
-
// "descr":{"order":"sell 167.28002676 ADAXBT @ stop loss 0.00003280 -> limit 0.00003212"}
|
|
1585
|
-
// }
|
|
1586
|
-
//
|
|
1587
|
-
//
|
|
1588
|
-
// {
|
|
1589
|
-
// "txid":["OVHMJV-BZW2V-6NZFWF"],
|
|
1590
|
-
// "descr":{"order":"sell 0.00100000 ETHUSD @ stop loss 2677.00 -> limit 2577.00 with 5:1 leverage"}
|
|
1591
|
-
// }
|
|
1592
1582
|
//
|
|
1593
1583
|
// editOrder
|
|
1594
1584
|
//
|
|
@@ -1668,27 +1658,34 @@ class kraken extends kraken$1 {
|
|
|
1668
1658
|
orderDescription = this.safeString(order, 'descr');
|
|
1669
1659
|
}
|
|
1670
1660
|
let side = undefined;
|
|
1671
|
-
let
|
|
1661
|
+
let rawType = undefined;
|
|
1672
1662
|
let marketId = undefined;
|
|
1673
1663
|
let price = undefined;
|
|
1674
1664
|
let amount = undefined;
|
|
1675
|
-
let
|
|
1665
|
+
let triggerPrice = undefined;
|
|
1676
1666
|
if (orderDescription !== undefined) {
|
|
1677
1667
|
const parts = orderDescription.split(' ');
|
|
1678
1668
|
side = this.safeString(parts, 0);
|
|
1679
1669
|
amount = this.safeString(parts, 1);
|
|
1680
1670
|
marketId = this.safeString(parts, 2);
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1671
|
+
const part4 = this.safeString(parts, 4);
|
|
1672
|
+
const part5 = this.safeString(parts, 5);
|
|
1673
|
+
if (part4 === 'limit' || part4 === 'market') {
|
|
1674
|
+
rawType = part4; // eg, limit, market
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
rawType = part4 + ' ' + part5; // eg. stop loss, take profit, trailing stop
|
|
1678
|
+
}
|
|
1679
|
+
if (rawType === 'stop loss' || rawType === 'take profit') {
|
|
1680
|
+
triggerPrice = this.safeString(parts, 6);
|
|
1684
1681
|
price = this.safeString(parts, 9);
|
|
1685
1682
|
}
|
|
1686
|
-
else if (
|
|
1683
|
+
else if (rawType === 'limit') {
|
|
1687
1684
|
price = this.safeString(parts, 5);
|
|
1688
1685
|
}
|
|
1689
1686
|
}
|
|
1690
1687
|
side = this.safeString(description, 'type', side);
|
|
1691
|
-
|
|
1688
|
+
rawType = this.safeString(description, 'ordertype', rawType); // orderType has dash, e.g. trailing-stop
|
|
1692
1689
|
marketId = this.safeString(description, 'pair', marketId);
|
|
1693
1690
|
const foundMarket = this.findMarketByAltnameOrId(marketId);
|
|
1694
1691
|
let symbol = undefined;
|
|
@@ -1753,17 +1750,33 @@ class kraken extends kraken$1 {
|
|
|
1753
1750
|
trades.push(rawTrade);
|
|
1754
1751
|
}
|
|
1755
1752
|
}
|
|
1756
|
-
|
|
1753
|
+
// as mentioned in #24192 PR, this field is not something consistent/actual
|
|
1754
|
+
// triggerPrice = this.omitZero (this.safeString (order, 'stopprice', triggerPrice));
|
|
1757
1755
|
let stopLossPrice = undefined;
|
|
1758
1756
|
let takeProfitPrice = undefined;
|
|
1759
|
-
|
|
1757
|
+
// the dashed strings are not provided from fields (eg. fetch order)
|
|
1758
|
+
// while spaced strings from "order" sentence (when other fields not available)
|
|
1759
|
+
if (rawType.startsWith('take-profit')) {
|
|
1760
1760
|
takeProfitPrice = this.safeString(description, 'price');
|
|
1761
1761
|
price = this.omitZero(this.safeString(description, 'price2'));
|
|
1762
1762
|
}
|
|
1763
|
-
else if (
|
|
1763
|
+
else if (rawType.startsWith('stop-loss')) {
|
|
1764
1764
|
stopLossPrice = this.safeString(description, 'price');
|
|
1765
1765
|
price = this.omitZero(this.safeString(description, 'price2'));
|
|
1766
1766
|
}
|
|
1767
|
+
else if (rawType === 'take profit') {
|
|
1768
|
+
takeProfitPrice = triggerPrice;
|
|
1769
|
+
}
|
|
1770
|
+
else if (rawType === 'stop loss') {
|
|
1771
|
+
stopLossPrice = triggerPrice;
|
|
1772
|
+
}
|
|
1773
|
+
let finalType = this.parseOrderType(rawType);
|
|
1774
|
+
// unlike from endpoints which provide eg: "take-profit-limit"
|
|
1775
|
+
// for "space-delimited" orders we dont have market/limit suffixes, their format is
|
|
1776
|
+
// eg: `stop loss > limit 123`, so we need to parse them manually
|
|
1777
|
+
if (this.inArray(finalType, ['stop loss', 'take profit'])) {
|
|
1778
|
+
finalType = (price === undefined) ? 'market' : 'limit';
|
|
1779
|
+
}
|
|
1767
1780
|
return this.safeOrder({
|
|
1768
1781
|
'id': id,
|
|
1769
1782
|
'clientOrderId': clientOrderId,
|
|
@@ -1773,13 +1786,13 @@ class kraken extends kraken$1 {
|
|
|
1773
1786
|
'lastTradeTimestamp': undefined,
|
|
1774
1787
|
'status': status,
|
|
1775
1788
|
'symbol': symbol,
|
|
1776
|
-
'type':
|
|
1789
|
+
'type': finalType,
|
|
1777
1790
|
'timeInForce': undefined,
|
|
1778
1791
|
'postOnly': isPostOnly,
|
|
1779
1792
|
'side': side,
|
|
1780
1793
|
'price': price,
|
|
1781
|
-
'stopPrice':
|
|
1782
|
-
'triggerPrice':
|
|
1794
|
+
'stopPrice': triggerPrice,
|
|
1795
|
+
'triggerPrice': triggerPrice,
|
|
1783
1796
|
'takeProfitPrice': takeProfitPrice,
|
|
1784
1797
|
'stopLossPrice': stopLossPrice,
|
|
1785
1798
|
'cost': undefined,
|
package/dist/cjs/src/lbank.js
CHANGED
|
@@ -1193,6 +1193,12 @@ class lbank extends lbank$1 {
|
|
|
1193
1193
|
const indexPrice = this.safeNumber(ticker, 'underlyingPrice');
|
|
1194
1194
|
const fundingRate = this.safeNumber(ticker, 'fundingRate');
|
|
1195
1195
|
const fundingTime = this.safeInteger(ticker, 'nextFeeTime');
|
|
1196
|
+
const positionFeeTime = this.safeInteger(ticker, 'positionFeeTime');
|
|
1197
|
+
let intervalString = undefined;
|
|
1198
|
+
if (positionFeeTime !== undefined) {
|
|
1199
|
+
const interval = this.parseToInt(positionFeeTime / 60 / 60);
|
|
1200
|
+
intervalString = interval + 'h';
|
|
1201
|
+
}
|
|
1196
1202
|
return {
|
|
1197
1203
|
'info': ticker,
|
|
1198
1204
|
'symbol': symbol,
|
|
@@ -1209,7 +1215,7 @@ class lbank extends lbank$1 {
|
|
|
1209
1215
|
'previousFundingRate': undefined,
|
|
1210
1216
|
'previousFundingTimestamp': undefined,
|
|
1211
1217
|
'previousFundingDatetime': undefined,
|
|
1212
|
-
'interval':
|
|
1218
|
+
'interval': intervalString,
|
|
1213
1219
|
};
|
|
1214
1220
|
}
|
|
1215
1221
|
async fetchFundingRate(symbol, params = {}) {
|
|
@@ -3714,12 +3714,6 @@ class binance extends binance$1 {
|
|
|
3714
3714
|
market = this.getMarketFromSymbols(symbols);
|
|
3715
3715
|
messageHash = '::' + symbols.join(',');
|
|
3716
3716
|
}
|
|
3717
|
-
const marketTypeObject = {};
|
|
3718
|
-
if (market !== undefined) {
|
|
3719
|
-
marketTypeObject['type'] = market['type'];
|
|
3720
|
-
marketTypeObject['subType'] = market['subType'];
|
|
3721
|
-
}
|
|
3722
|
-
await this.authenticate(this.extend(marketTypeObject, params));
|
|
3723
3717
|
let type = undefined;
|
|
3724
3718
|
[type, params] = this.handleMarketTypeAndParams('watchPositions', market, params);
|
|
3725
3719
|
if (type === 'spot' || type === 'margin') {
|
|
@@ -3733,6 +3727,10 @@ class binance extends binance$1 {
|
|
|
3733
3727
|
else if (this.isInverse(type, subType)) {
|
|
3734
3728
|
type = 'delivery';
|
|
3735
3729
|
}
|
|
3730
|
+
const marketTypeObject = {};
|
|
3731
|
+
marketTypeObject['type'] = type;
|
|
3732
|
+
marketTypeObject['subType'] = subType;
|
|
3733
|
+
await this.authenticate(this.extend(marketTypeObject, params));
|
|
3736
3734
|
messageHash = type + ':positions' + messageHash;
|
|
3737
3735
|
let isPortfolioMargin = undefined;
|
|
3738
3736
|
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'watchPositions', 'papi', 'portfolioMargin', false);
|
|
@@ -773,7 +773,8 @@ class bitvavo extends bitvavo$1 {
|
|
|
773
773
|
const messageHash = this.buildMessageHash(action, request);
|
|
774
774
|
this.checkMessageHashDoesNotExist(messageHash);
|
|
775
775
|
const url = this.urls['api']['ws'];
|
|
776
|
-
|
|
776
|
+
const randomSubHash = this.randNumber(5).toString() + ':' + messageHash;
|
|
777
|
+
return await this.watch(url, messageHash, request, randomSubHash);
|
|
777
778
|
}
|
|
778
779
|
async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
779
780
|
/**
|
package/dist/cjs/src/pro/mexc.js
CHANGED
|
@@ -75,15 +75,25 @@ class mexc extends mexc$1 {
|
|
|
75
75
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
76
76
|
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams
|
|
77
77
|
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels
|
|
78
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#miniticker
|
|
78
79
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
79
80
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
81
|
+
* @param {boolean} [params.miniTicker] set to true for using the miniTicker endpoint
|
|
80
82
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
81
83
|
*/
|
|
82
84
|
await this.loadMarkets();
|
|
83
85
|
const market = this.market(symbol);
|
|
84
86
|
const messageHash = 'ticker:' + market['symbol'];
|
|
85
87
|
if (market['spot']) {
|
|
86
|
-
|
|
88
|
+
let miniTicker = false;
|
|
89
|
+
[miniTicker, params] = this.handleOptionAndParams(params, 'watchTicker', 'miniTicker');
|
|
90
|
+
let channel = undefined;
|
|
91
|
+
if (miniTicker) {
|
|
92
|
+
channel = 'spot@public.miniTicker.v3.api@' + market['id'] + '@UTC+8';
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
channel = 'spot@public.bookTicker.v3.api@' + market['id'];
|
|
96
|
+
}
|
|
87
97
|
return await this.watchSpotPublic(channel, messageHash, params);
|
|
88
98
|
}
|
|
89
99
|
else {
|
|
@@ -95,6 +105,38 @@ class mexc extends mexc$1 {
|
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
107
|
handleTicker(client, message) {
|
|
108
|
+
//
|
|
109
|
+
// swap
|
|
110
|
+
//
|
|
111
|
+
// {
|
|
112
|
+
// "symbol": "BTC_USDT",
|
|
113
|
+
// "data": {
|
|
114
|
+
// "symbol": "BTC_USDT",
|
|
115
|
+
// "lastPrice": 76376.2,
|
|
116
|
+
// "riseFallRate": -0.0006,
|
|
117
|
+
// "fairPrice": 76374.4,
|
|
118
|
+
// "indexPrice": 76385.8,
|
|
119
|
+
// "volume24": 962062810,
|
|
120
|
+
// "amount24": 7344207079.96768,
|
|
121
|
+
// "maxBidPrice": 84024.3,
|
|
122
|
+
// "minAskPrice": 68747.2,
|
|
123
|
+
// "lower24Price": 75620.2,
|
|
124
|
+
// "high24Price": 77210,
|
|
125
|
+
// "timestamp": 1731137509138,
|
|
126
|
+
// "bid1": 76376.2,
|
|
127
|
+
// "ask1": 76376.3,
|
|
128
|
+
// "holdVol": 95479623,
|
|
129
|
+
// "riseFallValue": -46.5,
|
|
130
|
+
// "fundingRate": 0.0001,
|
|
131
|
+
// "zone": "UTC+8",
|
|
132
|
+
// "riseFallRates": [ -0.0006, 0.1008, 0.2262, 0.2628, 0.2439, 1.0564 ],
|
|
133
|
+
// "riseFallRatesOfTimezone": [ 0.0065, -0.0013, -0.0006 ]
|
|
134
|
+
// },
|
|
135
|
+
// "channel": "push.ticker",
|
|
136
|
+
// "ts": 1731137509138
|
|
137
|
+
// }
|
|
138
|
+
//
|
|
139
|
+
// spot
|
|
98
140
|
//
|
|
99
141
|
// {
|
|
100
142
|
// "c": "spot@public.bookTicker.v3.api@BTCUSDT",
|
|
@@ -108,8 +150,30 @@ class mexc extends mexc$1 {
|
|
|
108
150
|
// "t": 1678643605721
|
|
109
151
|
// }
|
|
110
152
|
//
|
|
153
|
+
// spot miniTicker
|
|
154
|
+
//
|
|
155
|
+
// {
|
|
156
|
+
// "d": {
|
|
157
|
+
// "s": "BTCUSDT",
|
|
158
|
+
// "p": "76522",
|
|
159
|
+
// "r": "0.0012",
|
|
160
|
+
// "tr": "0.0012",
|
|
161
|
+
// "h": "77196.3",
|
|
162
|
+
// "l": "75630.77",
|
|
163
|
+
// "v": "584664223.92",
|
|
164
|
+
// "q": "7666.720258",
|
|
165
|
+
// "lastRT": "-1",
|
|
166
|
+
// "MT": "0",
|
|
167
|
+
// "NV": "--",
|
|
168
|
+
// "t": "1731135533126"
|
|
169
|
+
// },
|
|
170
|
+
// "c": "spot@public.miniTicker.v3.api@BTCUSDT@UTC+8",
|
|
171
|
+
// "t": 1731135533126,
|
|
172
|
+
// "s": "BTCUSDT"
|
|
173
|
+
// }
|
|
174
|
+
//
|
|
111
175
|
this.handleBidAsk(client, message);
|
|
112
|
-
const rawTicker = this.
|
|
176
|
+
const rawTicker = this.safeDict2(message, 'd', 'data');
|
|
113
177
|
const marketId = this.safeString2(message, 's', 'symbol');
|
|
114
178
|
const timestamp = this.safeInteger(message, 't');
|
|
115
179
|
const market = this.safeMarket(marketId);
|
|
@@ -134,24 +198,51 @@ class mexc extends mexc$1 {
|
|
|
134
198
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
135
199
|
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams
|
|
136
200
|
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels
|
|
201
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#minitickers
|
|
137
202
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
138
203
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
204
|
+
* @param {boolean} [params.miniTicker] set to true for using the miniTicker endpoint
|
|
139
205
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
140
206
|
*/
|
|
141
207
|
await this.loadMarkets();
|
|
142
|
-
symbols = this.marketSymbols(symbols, undefined
|
|
208
|
+
symbols = this.marketSymbols(symbols, undefined);
|
|
143
209
|
const messageHashes = [];
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
210
|
+
const firstSymbol = this.safeString(symbols, 0);
|
|
211
|
+
let market = undefined;
|
|
212
|
+
if (firstSymbol !== undefined) {
|
|
213
|
+
market = this.market(firstSymbol);
|
|
214
|
+
}
|
|
215
|
+
let type = undefined;
|
|
216
|
+
[type, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
|
|
217
|
+
const isSpot = (type === 'spot');
|
|
147
218
|
const url = (isSpot) ? this.urls['api']['ws']['spot'] : this.urls['api']['ws']['swap'];
|
|
148
219
|
const request = {};
|
|
149
220
|
if (isSpot) {
|
|
221
|
+
let miniTicker = false;
|
|
222
|
+
[miniTicker, params] = this.handleOptionAndParams(params, 'watchTickers', 'miniTicker');
|
|
150
223
|
const topics = [];
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
224
|
+
if (!miniTicker) {
|
|
225
|
+
if (symbols === undefined) {
|
|
226
|
+
throw new errors.ArgumentsRequired(this.id + 'watchTickers required symbols argument for the bookTicker channel');
|
|
227
|
+
}
|
|
228
|
+
const marketIds = this.marketIds(symbols);
|
|
229
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
230
|
+
const marketId = marketIds[i];
|
|
231
|
+
messageHashes.push('ticker:' + symbols[i]);
|
|
232
|
+
const channel = 'spot@public.bookTicker.v3.api@' + marketId;
|
|
233
|
+
topics.push(channel);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
topics.push('spot@public.miniTickers.v3.api@UTC+8');
|
|
238
|
+
if (symbols === undefined) {
|
|
239
|
+
messageHashes.push('spot:ticker');
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
243
|
+
messageHashes.push('ticker:' + symbols[i]);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
155
246
|
}
|
|
156
247
|
request['method'] = 'SUBSCRIPTION';
|
|
157
248
|
request['params'] = topics;
|
|
@@ -170,6 +261,8 @@ class mexc extends mexc$1 {
|
|
|
170
261
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
171
262
|
}
|
|
172
263
|
handleTickers(client, message) {
|
|
264
|
+
//
|
|
265
|
+
// swap
|
|
173
266
|
//
|
|
174
267
|
// {
|
|
175
268
|
// "channel": "push.tickers",
|
|
@@ -192,15 +285,66 @@ class mexc extends mexc$1 {
|
|
|
192
285
|
// "ts": 1725872514111
|
|
193
286
|
// }
|
|
194
287
|
//
|
|
195
|
-
|
|
196
|
-
|
|
288
|
+
// spot
|
|
289
|
+
//
|
|
290
|
+
// {
|
|
291
|
+
// "c": "spot@public.bookTicker.v3.api@BTCUSDT",
|
|
292
|
+
// "d": {
|
|
293
|
+
// "A": "4.70432",
|
|
294
|
+
// "B": "6.714863",
|
|
295
|
+
// "a": "20744.54",
|
|
296
|
+
// "b": "20744.17"
|
|
297
|
+
// },
|
|
298
|
+
// "s": "BTCUSDT",
|
|
299
|
+
// "t": 1678643605721
|
|
300
|
+
// }
|
|
301
|
+
//
|
|
302
|
+
// spot miniTicker
|
|
303
|
+
//
|
|
304
|
+
// {
|
|
305
|
+
// "d": {
|
|
306
|
+
// "s": "BTCUSDT",
|
|
307
|
+
// "p": "76522",
|
|
308
|
+
// "r": "0.0012",
|
|
309
|
+
// "tr": "0.0012",
|
|
310
|
+
// "h": "77196.3",
|
|
311
|
+
// "l": "75630.77",
|
|
312
|
+
// "v": "584664223.92",
|
|
313
|
+
// "q": "7666.720258",
|
|
314
|
+
// "lastRT": "-1",
|
|
315
|
+
// "MT": "0",
|
|
316
|
+
// "NV": "--",
|
|
317
|
+
// "t": "1731135533126"
|
|
318
|
+
// },
|
|
319
|
+
// "c": "spot@public.miniTicker.v3.api@BTCUSDT@UTC+8",
|
|
320
|
+
// "t": 1731135533126,
|
|
321
|
+
// "s": "BTCUSDT"
|
|
322
|
+
// }
|
|
323
|
+
//
|
|
324
|
+
const data = this.safeList2(message, 'data', 'd');
|
|
325
|
+
const channel = this.safeString(message, 'c', '');
|
|
326
|
+
const marketId = this.safeString(message, 's');
|
|
327
|
+
const market = this.safeMarket(marketId);
|
|
328
|
+
const channelStartsWithSpot = channel.startsWith('spot');
|
|
329
|
+
const marketIdIsUndefined = marketId === undefined;
|
|
330
|
+
const isSpot = marketIdIsUndefined ? channelStartsWithSpot : market['spot'];
|
|
331
|
+
const spotPrefix = 'spot:';
|
|
332
|
+
const messageHashPrefix = isSpot ? spotPrefix : '';
|
|
333
|
+
const topic = messageHashPrefix + 'ticker';
|
|
197
334
|
const result = [];
|
|
198
335
|
for (let i = 0; i < data.length; i++) {
|
|
199
|
-
const
|
|
336
|
+
const entry = data[i];
|
|
337
|
+
let ticker = undefined;
|
|
338
|
+
if (isSpot) {
|
|
339
|
+
ticker = this.parseWsTicker(entry, market);
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
ticker = this.parseTicker(entry);
|
|
343
|
+
}
|
|
200
344
|
const symbol = ticker['symbol'];
|
|
201
345
|
this.tickers[symbol] = ticker;
|
|
202
346
|
result.push(ticker);
|
|
203
|
-
const messageHash =
|
|
347
|
+
const messageHash = 'ticker:' + symbol;
|
|
204
348
|
client.resolve(ticker, messageHash);
|
|
205
349
|
}
|
|
206
350
|
client.resolve(result, topic);
|
|
@@ -208,21 +352,44 @@ class mexc extends mexc$1 {
|
|
|
208
352
|
parseWsTicker(ticker, market = undefined) {
|
|
209
353
|
//
|
|
210
354
|
// spot
|
|
211
|
-
// {
|
|
212
|
-
// "A": "4.70432",
|
|
213
|
-
// "B": "6.714863",
|
|
214
|
-
// "a": "20744.54",
|
|
215
|
-
// "b": "20744.17"
|
|
216
|
-
// }
|
|
217
355
|
//
|
|
356
|
+
// {
|
|
357
|
+
// "A": "4.70432",
|
|
358
|
+
// "B": "6.714863",
|
|
359
|
+
// "a": "20744.54",
|
|
360
|
+
// "b": "20744.17"
|
|
361
|
+
// }
|
|
362
|
+
//
|
|
363
|
+
// spot miniTicker
|
|
364
|
+
//
|
|
365
|
+
// {
|
|
366
|
+
// "s": "BTCUSDT",
|
|
367
|
+
// "p": "76522",
|
|
368
|
+
// "r": "0.0012",
|
|
369
|
+
// "tr": "0.0012",
|
|
370
|
+
// "h": "77196.3",
|
|
371
|
+
// "l": "75630.77",
|
|
372
|
+
// "v": "584664223.92",
|
|
373
|
+
// "q": "7666.720258",
|
|
374
|
+
// "lastRT": "-1",
|
|
375
|
+
// "MT": "0",
|
|
376
|
+
// "NV": "--",
|
|
377
|
+
// "t": "1731135533126"
|
|
378
|
+
// }
|
|
379
|
+
//
|
|
380
|
+
const marketId = this.safeString(ticker, 's');
|
|
381
|
+
const timestamp = this.safeInteger(ticker, 't');
|
|
382
|
+
const price = this.safeString(ticker, 'p');
|
|
218
383
|
return this.safeTicker({
|
|
219
|
-
'
|
|
220
|
-
'
|
|
221
|
-
'
|
|
384
|
+
'info': ticker,
|
|
385
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
386
|
+
'timestamp': timestamp,
|
|
387
|
+
'datetime': this.iso8601(timestamp),
|
|
222
388
|
'open': undefined,
|
|
223
|
-
'high':
|
|
224
|
-
'low':
|
|
225
|
-
'close':
|
|
389
|
+
'high': this.safeNumber(ticker, 'h'),
|
|
390
|
+
'low': this.safeNumber(ticker, 'l'),
|
|
391
|
+
'close': price,
|
|
392
|
+
'last': price,
|
|
226
393
|
'bid': this.safeNumber(ticker, 'b'),
|
|
227
394
|
'bidVolume': this.safeNumber(ticker, 'B'),
|
|
228
395
|
'ask': this.safeNumber(ticker, 'a'),
|
|
@@ -230,11 +397,10 @@ class mexc extends mexc$1 {
|
|
|
230
397
|
'vwap': undefined,
|
|
231
398
|
'previousClose': undefined,
|
|
232
399
|
'change': undefined,
|
|
233
|
-
'percentage':
|
|
400
|
+
'percentage': this.safeNumber(ticker, 'tr'),
|
|
234
401
|
'average': undefined,
|
|
235
|
-
'baseVolume':
|
|
236
|
-
'quoteVolume':
|
|
237
|
-
'info': ticker,
|
|
402
|
+
'baseVolume': this.safeNumber(ticker, 'v'),
|
|
403
|
+
'quoteVolume': this.safeNumber(ticker, 'q'),
|
|
238
404
|
}, market);
|
|
239
405
|
}
|
|
240
406
|
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
@@ -1337,6 +1503,8 @@ class mexc extends mexc$1 {
|
|
|
1337
1503
|
'public.kline.v3.api': this.handleOHLCV,
|
|
1338
1504
|
'push.kline': this.handleOHLCV,
|
|
1339
1505
|
'public.bookTicker.v3.api': this.handleTicker,
|
|
1506
|
+
'public.miniTicker.v3.api': this.handleTicker,
|
|
1507
|
+
'public.miniTickers.v3.api': this.handleTickers,
|
|
1340
1508
|
'push.ticker': this.handleTicker,
|
|
1341
1509
|
'push.tickers': this.handleTickers,
|
|
1342
1510
|
'public.increase.depth.v3.api': this.handleOrderBook,
|
package/dist/cjs/src/vertex.js
CHANGED
|
@@ -2892,13 +2892,58 @@ class vertex extends vertex$1 {
|
|
|
2892
2892
|
};
|
|
2893
2893
|
const response = await this.v1GatewayPostExecute(this.extend(request, params));
|
|
2894
2894
|
//
|
|
2895
|
-
//
|
|
2896
|
-
//
|
|
2897
|
-
//
|
|
2898
|
-
//
|
|
2899
|
-
//
|
|
2895
|
+
// {
|
|
2896
|
+
// "status": "success",
|
|
2897
|
+
// "signature": {signature},
|
|
2898
|
+
// "request_type": "execute_withdraw_collateral"
|
|
2899
|
+
// }
|
|
2900
2900
|
//
|
|
2901
|
-
|
|
2901
|
+
const transaction = this.parseTransaction(response, currency);
|
|
2902
|
+
return this.extend(transaction, {
|
|
2903
|
+
'amount': amount,
|
|
2904
|
+
'address': address,
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
parseTransaction(transaction, currency = undefined) {
|
|
2908
|
+
//
|
|
2909
|
+
// {
|
|
2910
|
+
// "status": "success",
|
|
2911
|
+
// "signature": {signature},
|
|
2912
|
+
// "request_type": "execute_withdraw_collateral"
|
|
2913
|
+
// }
|
|
2914
|
+
//
|
|
2915
|
+
let code = undefined;
|
|
2916
|
+
if (currency !== undefined) {
|
|
2917
|
+
code = currency['code'];
|
|
2918
|
+
}
|
|
2919
|
+
return {
|
|
2920
|
+
'info': transaction,
|
|
2921
|
+
'id': undefined,
|
|
2922
|
+
'txid': undefined,
|
|
2923
|
+
'timestamp': undefined,
|
|
2924
|
+
'datetime': undefined,
|
|
2925
|
+
'addressFrom': undefined,
|
|
2926
|
+
'address': undefined,
|
|
2927
|
+
'addressTo': undefined,
|
|
2928
|
+
'tagFrom': undefined,
|
|
2929
|
+
'tag': undefined,
|
|
2930
|
+
'tagTo': undefined,
|
|
2931
|
+
'type': 'withdrawal',
|
|
2932
|
+
'amount': undefined,
|
|
2933
|
+
'currency': code,
|
|
2934
|
+
'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
|
|
2935
|
+
'updated': undefined,
|
|
2936
|
+
'network': undefined,
|
|
2937
|
+
'comment': undefined,
|
|
2938
|
+
'internal': undefined,
|
|
2939
|
+
'fee': undefined,
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2942
|
+
parseTransactionStatus(status) {
|
|
2943
|
+
const statuses = {
|
|
2944
|
+
'success': 'ok',
|
|
2945
|
+
};
|
|
2946
|
+
return this.safeString(statuses, status, status);
|
|
2902
2947
|
}
|
|
2903
2948
|
handlePublicAddress(methodName, params) {
|
|
2904
2949
|
let userAux = undefined;
|
|
@@ -1522,6 +1522,7 @@ class wavesexchange extends wavesexchange$1 {
|
|
|
1522
1522
|
* @method
|
|
1523
1523
|
* @name wavesexchange#fetchOrder
|
|
1524
1524
|
* @description fetches information on an order made by the user
|
|
1525
|
+
* @see https://matcher.waves.exchange/api-docs/index.html#/status/getOrderStatusByPKAndIdWithSig
|
|
1525
1526
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1526
1527
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1527
1528
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|