How does Coinmarketcap calculate volume? Does Coinmarketcap read all  trade history from the APIs of all exchanges and sums them up to calculate overall 24h volume? Or Does it retrieve it directly from specific coin's api?
It connects to the api of the exchange and returns the traded volume. 

The volume of the exchange is the sum of all coin's volume in that exchange that is returned from the exchange API.

The volume of the coin is the sum of that coin's traded volume that is returned from all exchange's api.