I am trying to develop an crypto traking site like coinmarketcap, for market data I am using exchanges API. but I am little bit confuse whether i should use api or websocket? as i don't have much experience, any suggestion would be appreciated.
REST API, you would have to poll for data periodically and make changes for every poll you do.
Websockets allow you to essentially listen for changes and make changes on your end accordingly based on whatever changed, almost instantly.
They both have their advantages and disadvantages.
REST polling allows you to cache data in a much easier fashion, which will be a big deal once your dataset get's large the more you collect. The downside is that it's more intensive to process the data each time you poll.
Websockets allows you to process data much faster since you only receive data that changes. The downside is dealing with a constant open connection opens up potential security issues and caching data is a bit annoying.