Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
import { polygonDailyAPI } from "https://esm.town/v/rwev/polygonDailyAPI";
export async function polygonPriceOnDate(ticker, isoDate) {
const response = await polygonDailyAPI(ticker, isoDate);
if (response.status != "OK")
throw new Error(
`Could not get price for ${ticker} on ${isoDate}: ${response.error}`
);
return response.close;
}
October 23, 2023