Real-Time Price Tracking
Learn how to track real-time cryptocurrency prices using ZettaBlock's SQL query builder and one-click API.
Objective
Fetch real-time prices of specific cryptocurrencies from the prices.usd_latest
table.
Step 1: Write the SQL query
SELECT * FROM prices.usd_latest
WHERE symbol IN ('ETH', 'BTC');
Step 2: Create an API

Step 3: Calling the API externally
Use the following JavaScript code to call the API and integrate it with your dApp:
const axios = require('axios');
async function fetchRealTimePrices() {
const response = await axios.get('your_api_key_here');
const prices = response.data;
// Use 'prices' in your dApp
}
fetchRealTimePrices();
Note: This is just one example of how the API can be called using axios. You can can whatever process/language works best for your dApp's needs.
And that's it - it's that simple! You've successfully integrated real-time price tracking into your dApp with ZettaBlock. 🚀
Updated 2 months ago