Skip to content

Commit

Permalink
getHistoricalPricesForMultipleTokens
Browse files Browse the repository at this point in the history
  • Loading branch information
jansoren committed Sep 25, 2023
1 parent 94edc31 commit 38e4dfa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/no/jansoren/defillama/CoinsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import no.jansoren.defillama.model.coins.Coins;
import no.jansoren.defillama.model.protocols.BaseClient;

import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.nio.charset.StandardCharsets;

public class CoinsClient extends BaseClient {

Expand All @@ -22,6 +24,7 @@ public Coins getHistoricalPricesOfTokensByContractAddress(String coins, int time
}

public Coins getHistoricalPricesForMultipleTokens(String coins, String searchWidth) {
return get("https://coins.llama.fi/batchHistorical?coins=" + coins + "&searchWidth="+searchWidth, new TypeReference<>(){});
var coinsEncoded = URLEncoder.encode(coins, StandardCharsets.UTF_8);
return get("https://coins.llama.fi/batchHistorical?coins=" + coinsEncoded + "&searchWidth="+searchWidth, new TypeReference<>(){});
}
}

0 comments on commit 38e4dfa

Please sign in to comment.