Fetch Market Caps
Use the marketCaps namespace to fetch market caps for coins.
const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
const caps = await velo.query(
marketCaps.history({ coins: ['BTC', 'ETH'] }),
);
for (const marketCap of caps) {
console.log(marketCap.coin, marketCap.circ_dollars);
}coins must be a non-empty array.
Result type
velo.query() resolves to a MarketCap[]. For example:
[
{
"coin": "BTC",
"time": 1783513513252,
"circ": 20053612,
"circ_dollars": 1248112746545.6,
"fdv": 20053612,
"fdv_dollars": 1248112746545.6
}
]Each item uses the exported MarketCap type:
interface MarketCap {
coin: string;
time: number;
circ: number | null;
circ_dollars: number | null;
fdv: number | null;
fdv_dollars: number | null;
}| Field | Description |
|---|---|
coin | Velo's normalized coin symbol |
time | Snapshot time, as a Unix timestamp in milliseconds |
circ | Circulating supply |
circ_dollars | Circulating market capitalization in dollars |
fdv | Fully diluted supply |
fdv_dollars | Fully diluted valuation in dollars |
Supply and valuation fields may be null when a value is unavailable.