How do websites get prices for a coin? There are websites with historical data of coins. How do they get it?

Do they get the price from 10 exchanges at the same time, then divide by 10?
Every website may have a different way of aggregating this sort of data. I would expect that the exact method used by each website will be determined by their specific needs/applications. There is no absolute "right or wrong way" to get this job done. For example:


A simple implementation someone makes for fun might just display the average of two different API calls
A firm like the CME will pull data from only the most legitimate sources, with external considerations to ensure the price data cannot be manipulated to game futures trades on their exchange


To find more info on some actual implementations, I would suggest looking up some websites that display data in the way you're looking for, and see if they provide any info on the algorithms/methods used. I would guess at least a few sites make that info public.