How can I get historical trading data of an NFT collection?

Hey ya’ll!

I’m looking to get the historical sales and mints for an NFT collection. How do I get the historical trading data programmatically? Would I use qn_getTransfersByNFT or another API you have?

Thanks!

Here’s an example of how you can use the qn_getTransfersByNFT API to get historical sales and mints data for an NFT collection:

  1. First, make sure you have set up and configured your QuickNode account. You will need your QuickNode endpoint URL and your API key.
  2. Construct a JSON-RPC request using the qn_getTransfersByNFT method to retrieve the historical trading data. Here’s an example request:
POST / HTTP/1.1
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "qn_getTransfersByNFT",
  "params": [
    {
      "contract": "0xCONTRACT_ADDRESS",
      "fromBlock": "0",
      "toBlock": "latest"
    }
  ]
}

Replace 0xCONTRACT_ADDRESS with the actual address of the NFT contract you’re interested in.

  1. Send the above JSON-RPC request to the QuickNode API endpoint using the appropriate HTTP library or tool in your preferred programming language.
  2. Parse the JSON response and extract the historical trading data, which will include information about sales and mints for the specified NFT collection.

Please note that you may need to adjust the parameters of the qn_getTransfersByNFT method to fit your specific requirements. QuickNode’s API documentation can provide further details on the available parameters and their usage.

Remember to handle pagination if there are more transactions than the response limit. You can modify the fromBlock and toBlock parameters to fetch data in batches.