Skip to content

Commit

Permalink
Coingecko: Limit download of historical daily prices to 365 days
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed Apr 2, 2024
1 parent a279970 commit f9a1bc2
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ private QuoteFeedData getHistoricalQuotes(Security security, boolean collectRawR
coinGeckoId = getCoinGeckoIdForTicker(security.getTickerSymbol().toLowerCase());

String endpoint = "/api/v3/coins/" + coinGeckoId + "/market_chart"; //$NON-NLS-1$ //$NON-NLS-2$
long days = ChronoUnit.DAYS.between(start, LocalDate.now()) + 1;

// the free API only allows for 1 year of historical data (daily).
long days = Math.min(365, ChronoUnit.DAYS.between(start, LocalDate.now()) + 1);

WebAccess webaccess = new WebAccess("api.coingecko.com", endpoint) //$NON-NLS-1$
.addParameter("vs_currency", security.getCurrencyCode()) //$NON-NLS-1$
Expand Down

0 comments on commit f9a1bc2

Please sign in to comment.