R
R
Redstone API
Github
NPM
Website
Discord
Search…
1.0.0
What is Redstone API
Getting started
Installation
Usage
Methods
getPrice
getHistoricalPrice
getAllPrices
query
Fluent interface
Redstone query
HTTP API
Prices HTTP Api
Knowledge base
Cache layer
Signature verification
Provider
Links
Github repo
NPM
Website
Discord
Powered By
GitBook
Usage
Redstone api usage
First, you need to import redstone module
Node.js require
ES6 import
1
// Using Node.js `require()`
2
const
redstone
=
require
(
'redstone-api'
);
Copied!
1
// Using ES6 imports
2
import
redstone
from
'redstone-api'
;
Copied!
Then you can fetch the prices with just a single line of code
1
const
price
=
await
redstone
.
getPrice
(
"AR"
);
2
3
console
.
log
(
price
.
value
);
// latest price value for AR token (in USD)
4
console
.
log
(
price
.
timestamp
);
// the exact timestamp of the price
Copied!
See more examples in the documentation of the following methods:
getPrice
getHistoricalPrice
getAllPrices
You can also check out docs for the
redstone fluent interface
, which makes the price fetching even simpler thanks to human readable syntax.
Getting started - Previous
Installation
Next - Methods
getPrice
Last modified
11mo ago
Copy link