ccxt 4.5.24 → 4.5.26
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 +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitmart.js +3 -3
- package/dist/cjs/src/htx.js +5 -1
- package/dist/cjs/src/hyperliquid.js +82 -66
- package/dist/cjs/src/mexc.js +17 -11
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/bitmart.js +3 -3
- package/js/src/htx.js +5 -1
- package/js/src/hyperliquid.d.ts +1 -1
- package/js/src/hyperliquid.js +82 -66
- package/js/src/mexc.d.ts +2 -2
- package/js/src/mexc.js +17 -11
- package/package.json +1 -1
package/js/src/mexc.d.ts
CHANGED
|
@@ -103,8 +103,8 @@ export default class mexc extends Exchange {
|
|
|
103
103
|
/**
|
|
104
104
|
* @method
|
|
105
105
|
* @name mexc#fetchOHLCV
|
|
106
|
-
* @see https://
|
|
107
|
-
* @see https://
|
|
106
|
+
* @see https://www.mexc.com/api-docs/spot-v3/market-data-endpoints#klinecandlestick-data
|
|
107
|
+
* @see https://www.mexc.com/api-docs/futures/market-endpoints#get-candlestick-data
|
|
108
108
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
109
109
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
110
110
|
* @param {string} timeframe the length of time each candle represents
|
package/js/src/mexc.js
CHANGED
|
@@ -1760,8 +1760,8 @@ export default class mexc extends Exchange {
|
|
|
1760
1760
|
/**
|
|
1761
1761
|
* @method
|
|
1762
1762
|
* @name mexc#fetchOHLCV
|
|
1763
|
-
* @see https://
|
|
1764
|
-
* @see https://
|
|
1763
|
+
* @see https://www.mexc.com/api-docs/spot-v3/market-data-endpoints#klinecandlestick-data
|
|
1764
|
+
* @see https://www.mexc.com/api-docs/futures/market-endpoints#get-candlestick-data
|
|
1765
1765
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1766
1766
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1767
1767
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -1775,7 +1775,7 @@ export default class mexc extends Exchange {
|
|
|
1775
1775
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
1776
1776
|
await this.loadMarkets();
|
|
1777
1777
|
const market = this.market(symbol);
|
|
1778
|
-
const maxLimit = (market['spot']) ?
|
|
1778
|
+
const maxLimit = (market['spot']) ? 500 : 2000; // docs say 1000 for spot, but in practice it's 500
|
|
1779
1779
|
let paginate = false;
|
|
1780
1780
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
1781
1781
|
if (paginate) {
|
|
@@ -1790,10 +1790,16 @@ export default class mexc extends Exchange {
|
|
|
1790
1790
|
'interval': timeframeValue,
|
|
1791
1791
|
};
|
|
1792
1792
|
let candles = undefined;
|
|
1793
|
+
const until = this.safeIntegerN(params, ['until', 'endTime']);
|
|
1794
|
+
let start = since;
|
|
1795
|
+
if ((until !== undefined) && (since === undefined)) {
|
|
1796
|
+
params = this.omit(params, ['until']);
|
|
1797
|
+
const usedLimit = limit ? limit : maxLimit;
|
|
1798
|
+
start = until - (usedLimit * duration);
|
|
1799
|
+
}
|
|
1793
1800
|
if (market['spot']) {
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
request['startTime'] = since;
|
|
1801
|
+
if (start !== undefined) {
|
|
1802
|
+
request['startTime'] = start;
|
|
1797
1803
|
if (until === undefined) {
|
|
1798
1804
|
// we have to calculate it assuming we can get at most 2000 entries per request
|
|
1799
1805
|
const end = this.sum(since, maxLimit * duration);
|
|
@@ -1805,8 +1811,7 @@ export default class mexc extends Exchange {
|
|
|
1805
1811
|
request['limit'] = limit;
|
|
1806
1812
|
}
|
|
1807
1813
|
if (until !== undefined) {
|
|
1808
|
-
|
|
1809
|
-
request['endTime'] = until;
|
|
1814
|
+
request['endTime'] = until + 1; // mexc's endTime is not inclusive, so we add 1 ms to avoid missing the last candle in the results
|
|
1810
1815
|
}
|
|
1811
1816
|
const response = await this.spotPublicGetKlines(this.extend(request, params));
|
|
1812
1817
|
//
|
|
@@ -1826,13 +1831,14 @@ export default class mexc extends Exchange {
|
|
|
1826
1831
|
candles = response;
|
|
1827
1832
|
}
|
|
1828
1833
|
else if (market['swap']) {
|
|
1829
|
-
const until = this.safeIntegerProductN(params, ['until', 'endTime'], 0.001);
|
|
1830
1834
|
if (since !== undefined) {
|
|
1831
1835
|
request['start'] = this.parseToInt(since / 1000);
|
|
1832
1836
|
}
|
|
1833
1837
|
if (until !== undefined) {
|
|
1834
|
-
|
|
1835
|
-
|
|
1838
|
+
request['end'] = this.parseToInt(until / 1000);
|
|
1839
|
+
if (since === undefined) {
|
|
1840
|
+
request['start'] = this.parseToInt(start / 1000);
|
|
1841
|
+
}
|
|
1836
1842
|
}
|
|
1837
1843
|
const priceType = this.safeString(params, 'price', 'default');
|
|
1838
1844
|
params = this.omit(params, 'price');
|
package/package.json
CHANGED