Redstone api usage
First, you need to import redstone module
Node.js require
ES6 import
// Using Node.js `require()`
const redstone = require('redstone-api');
// Using ES6 imports
import redstone from 'redstone-api';
Then you can fetch the prices with just a single line of code
const price = await redstone.getPrice("AR");
console.log(price.value); // latest price value for AR token (in USD)
console.log(price.timestamp); // the exact timestamp of the price
See more examples in the documentation of the following methods:
You can also check out docs for the redstone fluent interface, which makes the price fetching even simpler thanks to human readable syntax.