ccxt 4.2.35 → 4.2.37

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/js/src/woo.js CHANGED
@@ -1546,11 +1546,12 @@ export default class woo extends Exchange {
1546
1546
  * @method
1547
1547
  * @name woo#fetchOHLCV
1548
1548
  * @see https://docs.woo.org/#kline-public
1549
+ * @see https://docs.woo.org/#kline-historical-data-public
1549
1550
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1550
1551
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1551
1552
  * @param {string} timeframe the length of time each candle represents
1552
1553
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1553
- * @param {int} [limit] the maximum amount of candles to fetch
1554
+ * @param {int} [limit] max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms)))
1554
1555
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1555
1556
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1556
1557
  */
@@ -1560,42 +1561,70 @@ export default class woo extends Exchange {
1560
1561
  'symbol': market['id'],
1561
1562
  'type': this.safeString(this.timeframes, timeframe, timeframe),
1562
1563
  };
1563
- if (limit !== undefined) {
1564
+ let useHistEndpoint = since !== undefined;
1565
+ if ((limit !== undefined) && (since !== undefined)) {
1566
+ const oneThousandCandles = this.parseTimeframe(timeframe) * 1000 * 999; // 999 because there will be delay between this and the request, causing the latest candle to be excluded sometimes
1567
+ const startWithLimit = this.milliseconds() - oneThousandCandles;
1568
+ useHistEndpoint = since < startWithLimit;
1569
+ }
1570
+ if (useHistEndpoint) {
1571
+ request['start_time'] = since;
1572
+ }
1573
+ else if (limit !== undefined) { // the hist endpoint does not accept limit
1564
1574
  request['limit'] = Math.min(limit, 1000);
1565
1575
  }
1566
- const response = await this.v1PublicGetKline(this.extend(request, params));
1567
- // {
1568
- // "success": true,
1569
- // "rows": [
1570
- // {
1571
- // "open": "0.94238",
1572
- // "close": "0.94271",
1573
- // "low": "0.94238",
1574
- // "high": "0.94296",
1575
- // "volume": "73.55",
1576
- // "amount": "69.32040520",
1577
- // "symbol": "SPOT_WOO_USDT",
1578
- // "type": "1m",
1579
- // "start_timestamp": "1641584700000",
1580
- // "end_timestamp": "1641584760000"
1581
- // },
1582
- // {
1583
- // "open": "0.94186",
1584
- // "close": "0.94186",
1585
- // "low": "0.94186",
1586
- // "high": "0.94186",
1587
- // "volume": "64.00",
1588
- // "amount": "60.27904000",
1589
- // "symbol": "SPOT_WOO_USDT",
1590
- // "type": "1m",
1591
- // "start_timestamp": "1641584640000",
1592
- // "end_timestamp": "1641584700000"
1593
- // },
1594
- // ...
1595
- // ]
1596
- // }
1597
- const data = this.safeValue(response, 'rows', []);
1598
- return this.parseOHLCVs(data, market, timeframe, since, limit);
1576
+ let response = undefined;
1577
+ if (!useHistEndpoint) {
1578
+ response = await this.v1PublicGetKline(this.extend(request, params));
1579
+ //
1580
+ // {
1581
+ // "success": true,
1582
+ // "rows": [
1583
+ // {
1584
+ // "open": "0.94238",
1585
+ // "close": "0.94271",
1586
+ // "low": "0.94238",
1587
+ // "high": "0.94296",
1588
+ // "volume": "73.55",
1589
+ // "amount": "69.32040520",
1590
+ // "symbol": "SPOT_WOO_USDT",
1591
+ // "type": "1m",
1592
+ // "start_timestamp": "1641584700000",
1593
+ // "end_timestamp": "1641584760000"
1594
+ // },
1595
+ // ...
1596
+ // ]
1597
+ // }
1598
+ //
1599
+ }
1600
+ else {
1601
+ response = await this.v1PubGetHistKline(this.extend(request, params));
1602
+ response = this.safeDict(response, 'data');
1603
+ //
1604
+ // {
1605
+ // "success": true,
1606
+ // "data": {
1607
+ // "rows": [
1608
+ // {
1609
+ // "symbol": "SPOT_BTC_USDT",
1610
+ // "open": 44181.40000000,
1611
+ // "close": 44174.29000000,
1612
+ // "high": 44193.44000000,
1613
+ // "low": 44148.34000000,
1614
+ // "volume": 110.11930100,
1615
+ // "amount": 4863796.24318878,
1616
+ // "type": "1m",
1617
+ // "start_timestamp": 1704153600000,
1618
+ // "end_timestamp": 1704153660000
1619
+ // },
1620
+ // ...
1621
+ // ]
1622
+ // }
1623
+ // }
1624
+ //
1625
+ }
1626
+ const rows = this.safeValue(response, 'rows', []);
1627
+ return this.parseOHLCVs(rows, market, timeframe, since, limit);
1599
1628
  }
1600
1629
  parseOHLCV(ohlcv, market = undefined) {
1601
1630
  // example response in fetchOHLCV
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.35",
3
+ "version": "4.2.37",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -144,7 +144,7 @@
144
144
  "as-table": "1.0.37",
145
145
  "asciichart": "^1.5.25",
146
146
  "assert": "^2.0.0",
147
- "ast-transpiler": "^0.0.41",
147
+ "ast-transpiler": "^0.0.43",
148
148
  "docsify": "^4.11.4",
149
149
  "eslint": "8.22.0",
150
150
  "eslint-config-airbnb-base": "15.0.0",