October 16, 2023

How to Get the Floor Price of an NFT – NFT API Guide

Table of Contents

Overview

NFTs (non-fungible tokens) have become a major player in the digital asset market, with floor prices acting as one of the most important indicators of a collection’s value. Whether you’re an NFT collector, trader, or developer, tracking floor prices can provide valuable insights into the performance of an NFT collection. But fetching accurate floor prices can be tricky, especially if you’re trying to pull data from multiple sources.

In this tutorial, we’ll show you how to effortlessly retrieve NFT floor prices using Moralis. The Moralis NFT Floor Price API lets you fetch the floor price of any NFT collection in real-time with just one API call. For a more detailed guide, check out the NFT Floor Price Documentation.

By the end of this guide, you’ll be equipped with the knowledge and code snippets needed to integrate NFT floor price data into your own projects.

 

Full Video Tutorial

Want to see the full process in action? Watch our YouTube tutorial for a detailed walkthrough:

 

What Are NFT Floor Prices?

NFT floor prices represent the lowest price at which an NFT is currently listed for sale in a particular collection. The floor price serves as an important metric for gauging the value and market activity of an NFT collection. For example, a rising floor price can indicate high demand for a collection, while a falling floor price may reflect decreasing interest.

Accurate tracking of these prices allows users to make informed decisions on buying, selling, or holding NFTs. As a developer, incorporating floor price data into your tools helps users stay updated with the latest market conditions.

Why Use Moralis for NFT Floor Prices?

Fetching floor prices manually from marketplaces is time-consuming and complex. Moralis simplifies the process by providing a powerful NFT Floor Price API that retrieves real-time floor price data from multiple sources in just one API call. With this, you can:

  • Fetch floor prices from leading marketplaces like OpenSea, Blur, and others.
  • Get data in both cryptocurrency (e.g., ETH) and its equivalent in USD.
  • Retrieve prices for NFT collections across multiple blockchains, including Ethereum and Base.

Tutorial: How to Get the Current Price of an NFT with Moralis

Setting Up Moralis

Before fetching NFT floor prices, you need to set up Moralis and get your API key. Follow the Getting Started with Moralis API guide to create an account and access your API key.

Once you’re ready, you can use the NFT Floor Price API to retrieve the price for any collection.

Fetching NFT Floor Prices by Contract Address

You can retrieve the floor price for any NFT collection by providing the contract address. 

Here’s an example of how to fetch the floor price for the NFT Worlds collection on Ethereum:

Javascript Code Snippet

import Moralis from "moralis";

async function fetchNFTFloorPrice() {
  try {
    await Moralis.start({
      apiKey: "YOUR_API_KEY",
    });

    const response = await Moralis.EvmApi.nft.getNFTFloorPriceByContract({
      chain: "0x1", // Ethereum Mainnet
      address: "0x524cab2ec69124574082676e6f654a18df49a048", // NFT Worlds Contract
    });

    console.log(response.raw);
  } catch (e) {
    console.error(e);
  }
}

fetchNFTFloorPrice();
In this code:
  • chain: Specifies Ethereum Mainnet with the value "0x1".
  • address: This is the contract address for the NFT Worlds collection.

Example API Response

{
  "address": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
  "floor_price": "0.2176",
  "floor_price_usd": "564.24",
  "currency": "eth",
  "marketplace": [
    {
      "name": "blur",
      "logo": "https://cdn.moralis.io/marketplaces/blur.png"
    }
  ],
  "last_updated": "2024-08-21T15:59:11.000Z"
}
In this response:
  • address: The contract address of the NFT collection.
  • floor_price: The floor price in cryptocurrency (ETH).
  • floor_price_usd: The floor price converted to USD.
  • marketplace: The marketplace where the floor price was found (e.g., Blur).
  • last_updated: The last time the floor price was updated.

Fetching Historical NFT Floor Prices

In addition to retrieving real-time floor prices, you can use Moralis to fetch historical NFT floor prices. This feature is particularly useful for analyzing long-term trends and gaining insights into how the floor price of a specific NFT collection changes over time. Whether you’re building analytics tools, charting platforms, or market trackers, having access to historical floor price data can enhance your application.

Available Query Intervals

When querying historical NFT floor prices, you can specify different time intervals for how often the floor price data should be retrieved. These intervals allow you to tailor the data to your specific needs.

Here are the available options:

  • 1d: Daily floor prices
  • 7d: Weekly floor prices
  • 30d: Monthly floor prices
  • 60d: Bi-monthly floor prices
  • 90d: Quarterly floor prices
  • 1y: Yearly floor prices
  • all: All available historical data

Example Code for Historical Floor Prices

import Moralis from 'moralis';

async function fetchHistoricalFloorPrices() {
  try {
    await Moralis.start({
      apiKey: "YOUR_API_KEY"
    });

    const response = await Moralis.EvmApi.nft.getNFTHistoricalFloorPriceByContract({
      chain: "0x1", // Ethereum Mainnet
      address: "0x524cab2ec69124574082676e6f654a18df49a048", // NFT Worlds Contract
      interval: "1d", // Fetch daily floor price data
      cursor: "", // Optional, used for pagination if needed
    });

    console.log(response.raw);
  } catch (e) {
    console.error(e);
  }
}

fetchHistoricalFloorPrices();

Example Response

{
  "page": 0,
  "page_size": 100,
  "cursor": null,
  "result": [
    {
      "floor_price": "0.797799",
      "floor_price_usd": "2075.934",
      "currency": "eth",
      "marketplace": "blur",
      "timestamp": "2024-10-16T15:30:00.000Z"
    },
    {
      "floor_price": "0.798",
      "floor_price_usd": "2076.457",
      "currency": "eth",
      "marketplace": "blur",
      "timestamp": "2024-10-16T15:00:00.000Z"
    }
    // Additional data points...
  ]
}

Understanding the Response:

  • floor_price: The historical floor price in the native cryptocurrency (e.g., ETH).
  • floor_price_usd: The equivalent price in USD.
  • currency: The cryptocurrency used (in this case, ETH).
  • marketplace: The marketplace from which the data was sourced (e.g., Blur).
  • timestamp: The exact time when the floor price was recorded.

Why Use Moralis’ NFT Floor Price API?

There are many advantages to using Moralis’ API for fetching NFT floor prices:

  • Real-Time Data: Moralis provides real-time floor price data pulled directly from major marketplaces.
  • Multi-Chain Support: Fetch NFT floor prices across multiple blockchains like Ethereum and Base.
  • Comprehensive API: Get both current and historical data in one API call, with support for marketplace-specific information.

By integrating Moralis’ NFT Floor Price API, you can enhance your applications with accurate, up-to-date NFT price data. Whether you’re building NFT dashboards, marketplace apps, or portfolio trackers, Moralis simplifies the process of retrieving this data.

Building More Advanced Tools with Moralis

The power of Moralis doesn’t stop with real-time floor prices. Developers can extend their applications by analyzing historical floor price trends, charting market dynamics, and predicting future movements.

If you’re interested in creating advanced tools that can chart and analyze NFT floor prices over time, check out our YouTube video on analyzing and charting NFT floor prices using Moralis APIs:

Conclusion

Using Moralis’ NFT Floor Price API, developers can fetch both real-time and historical floor prices effortlessly. Whether you’re working on NFT analytics, marketplaces, or portfolio tracking tools, this API provides all the data you need to make informed decisions.

For more details, check out the official documentation for the NFT Floor Price API:

In addition to fetching NFT floor prices, Moralis offers a full range of powerful NFT APIs to enhance your applications. Whether you’re looking to retrieve metadata, ownership details, or NFT transactions, the Moralis API suite has you covered. For a full list of NFT APIs and to explore their capabilities, check out the Moralis NFT API Documentation. You’ll find everything you need to build robust NFT tools and applications, from fetching collections to tracking NFT transfers and more.

NFT API
Unlock the full potential of your NFT projects with this industry-leading NFT API! Fast, easy, and free.
NFT API
Related Articles
October 13, 2022

Avalanche Boilerplate – Fastest Way to Build Avalanche Dapps

September 1, 2022

How to Create a Dapp with PlayFab and Unity in 5 Steps

October 30, 2023

Blockchain API Providers – Comparing Top Blockchain API Services

October 18, 2023

How to Set Custom Webhooks with Moralis Streams

September 17, 2022

How to Set Up a Self-Hosted Web3 Server

February 20, 2024

Crypto Portfolio Tracker Endpoint – Get Portfolio Data with a Single API Call 

August 13, 2024

Extended RPC Methods – Get All Blockchain Data via RPC Methods

December 13, 2022

Tutorial for Blockchain Developers on How to Get All Transfers of an NFT

November 29, 2023

List of Smart Contract Ideas and Examples for Developers

🔥 LIMITED-TIME OFFER - Get early access to an Enhanced Token Page & boost your token project’s exposure! GET EARLY ACCESS 🔥