Moralis icon

Moralis

Interact with Moralis Web3 APIs for blockchain data, NFTs, tokens, and DeFi

Token → Get Token Price

AI-generated

Overview

This node interacts with the Moralis Web3 API to fetch the current price of a specified token on a selected blockchain. It is useful for applications that need real-time token price data, such as portfolio trackers, trading bots, or financial dashboards. For example, a user can input a token contract address and select the blockchain (e.g., Ethereum, Polygon) to retrieve the latest price information of that token.

Use Case Examples

  1. Retrieve the current price of a specific ERC20 token on the Ethereum blockchain by providing its contract address.
  2. Get the price of a token on the Polygon network to display in a DeFi dashboard.

Properties

Name Meaning
Chain The blockchain network to query for the token price (e.g., Ethereum, BSC, Polygon).
Token Address The contract address of the token for which the price is requested.
Additional Fields Optional parameters to customize the request, including limit, cursor for pagination, whether to include metadata, and the number format (decimal or hex).

Output

JSON

  • price - The current price of the token.
  • currency - The currency in which the price is denominated.
  • timestamp - The timestamp when the price data was retrieved.
  • operation - The operation performed, here it is 'getTokenPrice'.
  • resource - The resource type, here it is 'token'.
  • chain - The blockchain network queried for the token price.

Dependencies

  • Moralis Web3 API
  • An API key credential for Moralis

Troubleshooting

  • Ensure the token contract address is correct and valid on the selected blockchain.
  • Verify that the API key credential for Moralis is correctly configured and has the necessary permissions.
  • Check network connectivity and that the Moralis API endpoint is reachable.
  • If the response is empty or 'No data found', confirm that the token exists and is supported on the selected chain.

Links

Discussion