Skip to content
Snippets Groups Projects
Commit eaca1098 authored by Aggarwal Himanshu's avatar Aggarwal Himanshu
Browse files

Add timeseries range API query

parent f419dcda
No related branches found
No related tags found
2 merge requests!7Merge develop to main,!2Draft: Add Compare Chart Feature
......@@ -18,6 +18,23 @@ export function useCryptoTimeSeriesData(name, days = 7, interval = "daily") {
);
}
export function useCryptoTimeSeriesRangeData(name, from, to) {
return useQuery(
`${name}_from_${from}_to_${to}`,
() => {
return axios
.get(
`https://api.coingecko.com/api/v3/coins/${name}/market_chart/range?vs_currency=usd&from=${from}&to=${to}`
)
.then((res) => res.data);
},
{
refetchOnWindowFocus: false,
staleTime: 5 * 60000, // 5 minutes,
}
);
}
export function useCryptoList(
currency = "usd",
numberOfCurrencies = 20,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment