Beginner's question - Accessing all coins history at once

Hello,

I’m a beginner on working with APIs and currently am trying to develop a small WebApp using Vuejs and axios.
I’m currently working with the history side of the API and am able to get any currency’s history, one by one (https://developers.coinranking.com/api/documentation/coins#get-coin-history).

However I would like to be able to make a single request for all currencies instead of having to make a single one per currency (for example, showing the last element of the history for every coins).
Since the call for this data is “/coin/:uuid/history” I’m struggling a bit and can’t seem to find the right approach.

This is the code I used to access the BTC history (and make a comparison to know if it’s going up or down) which is working:

    axios
    .get(proxyurl + history_url, { 
        reqHeaders
    })
    .then((reponseHistory) => {
        //get data from last element
        const history = reponseHistory.data.data.history
        this.lastItem = history[history.length-1]
        this.lastEvol = this.lastItem.price
        //get data from previous element:
        this.previousItem = history[history.length-2]
        this.previousEvol = this.previousItem.price
    })
    .catch((error) => {
        console.error(error)
    })

Thanks for you help!
Let me know if you’re missing information.

Cheers,

2 Likes

@nickpater if you have any input that’s be awesome :smiley:

2 Likes

Hi @JStephens83!

Unfortunately, it is currently not possible to get the history of all coins in one request!
That would be at least 385mb of data for one request :slight_smile:

Why exactly do you need all the history at once?

If you want to show a sparkline or calculate a change, this data is also available in the /coins endpoint.

1 Like

Thanks @nickpater,

I do not need the whole data indeed.

I need to associate the id of the coin with its history in order to show a trend for each coin.
I hadn’t seen the sparkline property (and I’m French so I also didn’t know what sparkline meant and didn’t realize when I saw it :smiley:) and it’s exactly what I need!

Thanks again for taking the time :+1:

1 Like