Fetch current cryptocurrency prices and market data.
pricepassing, 0.3s/v1/finance:crypto-price/price5m cache2 paramschecking key…// npm i zpi-sdk
import { ZpiClient } from "zpi-sdk";
const client = new ZpiClient({ apiKey: "zpi_xxxxxxxxxxxxxxxxxxxxxxxx" });
const data = await client.run("finance:crypto-price", "price", {
"coins": "bitcoin,ethereum",
"vs": "usd"
});
console.log(data);curl -X GET "https://api.zpi.web.id/v1/finance:crypto-price/price?coins=bitcoin%2Cethereum&vs=usd" \
-H "x-api-key: zpi_xxxxxxxxxxxxxxxxxxxxxxxx"/v1/finance:crypto-price/priceRetrieve current price for a given cryptocurrency.coinsstringrequiredvsstringoptionalcurl -X GET "https://api.zpi.web.id/v1/finance:crypto-price/price?coins=bitcoin%2Cethereum&vs=usd" \
-H "x-api-key: zpi_xxxxxxxxxxxxxxxxxxxxxxxx"{
"ok": true,
"prices": {
"bitcoin": {
"usd": 63011,
"usd_24h_change": 0.009751251957127007,
"usd_market_cap": 1264680911365.345
},
"ethereum": {
"usd": 1879.12,
"usd_24h_change": -0.00923439989967606,
"usd_market_cap": 226776737101.05252
}
}
}