Hey everyone,
I’m trying to figure out how to get a list of NFT collections ranked by their total volume. I’ve been looking at different APIs, but I’m stumped.
Here’s what I want to do:
// Pseudo code
function getNFTCollections() {
const sortCriteria = 'totalVolume'
const collections = fetchCollections(sortCriteria)
return collections
}
I can grab individual assets easily enough, but I can’t seem to find a way to get the collections sorted by volume. The only sorting option I’ve found is by creation date.
Has anyone tackled this before? Any tips or pointers would be super helpful. Thanks in advance!
hey there zoe! ur question got me thinkin… have u checked out the nftport api? i stumbled across it recently and it’s pretty cool for nft stuff. they have this collections endpoint that lets u sort by volume, which sounds like exactly what ur after! 
heres a rough idea of how u could use it:
const response = await fetch('https://api.nftport.xyz/v0/nfts/collections?sort=volume')
const collections = await response.json()
just remember to grab an api key from their site first. oh and make sure to set the right headers too!
anyone else here tried nftport? what do u guys think about it compared to opensea or reservoir? im still exploring different options myself
hey zoe, i’ve dealt with this before. OpenSea API might be ur best bet. they have an endpoint for collections that lets u sort by total volume. just make sure to set the ‘orderBy’ parameter to ‘stats.total_volume’ in ur API call. hope this helps! lmk if u need more info
I’ve encountered a similar challenge in my work with NFT data. While OpenSea’s API is a solid option, I’ve found that using the Reservoir API offers more flexibility for sorting collections by volume. Their ‘collections’ endpoint allows you to specify ‘sortBy=allTimeVolume’ as a query parameter. This gives you a straightforward way to rank collections based on their total trading volume.
Keep in mind that you’ll need to handle pagination to get a complete list, as most APIs limit the number of results per request. Also, consider caching the results if you’re making frequent calls, as volume data doesn’t change too rapidly.