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
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023