madnight/bitcoin-chart-cli

Use only one API call per run.

Ingvix opened this issue · 2 comments

By having tmux view of multiple updating charts you can easily exceed your daily call limits. I noticed that every time bitcoin-chart-cli runs it makes two API call, to get the history and the current value. This is not very favorable for free users.

I then wondered would it be possible to extract the current value straight from the history call so you'd only need to make a single API call? I'm not very familiar with the API but I'd sort of assume that the latest value in the history would be the current value.

Good point. I just had a look at the API and the problem is that the historical data endpoint does not provide the current price. It has low, high, open and close for each time frame. The closest thing I could use would be the previous close value, but that's not the current live price.

I think you either have to lower your chart update frequency or use a free API key: https://min-api.cryptocompare.com/pricing with 100,000 calls / month. Just set your API key as env variable: export CRYPTOCOMPARE_API_KEY=

Alright, I guess it's not doable then. I wasn't aware I can get more calls just by signing up. I might consider that.