How to get an average bitcoin to USD price from different sources
You would want to avoid doing this on every page load. Instead I would recommend making it a cronjob that runs every N minutes and dump the values into a database. Then for each page load pull from your database instead of fetching from external sources. This will make your page load faster and you wont have as many api requests. Most sites limit your number of requests and if you are pinging them every page load you might get blocked.