1
2
3
4
5
6
7
8
9
10
11
import { secrets } from "https://esm.town/v/me/secrets";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function stockPrice(symbol: string) {
let data = await fetchJSON(
`https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${secrets.alphaVantage}`,
);
console.log(data);
return data["Global Quote"]["05. price"];
}
// Forked from @stevekrouse.stockPrice