UNPKG

alphasquared.js

Version:

A lightweight client for AlphaSquared

21 lines (20 loc) 459 B
// src/index.ts class AlphaSquared { _apiKey; constructor(apiKey) { this._apiKey = apiKey; } async get(type = "BTC") { const key = type === "BTC" ? "" : `_${type}`; const response = await fetch(`https://alphasquared.com/wp-json/as/v1/latest-risk-value${key}`, { headers: { Authorization: this._apiKey } }); const json = await response.json(); return json.latest_risk_value; } } export { AlphaSquared };