frontend/src/routes/index/[tickerID]/options/volatility/+page.server.ts
MuslemRahimi 5b500ae3f9 add index
2025-02-09 22:17:13 +01:00

32 lines
611 B
TypeScript

export const load = async ({ locals, params }) => {
const { apiKey, apiURL, user } = locals;
const getData = async () => {
const postData = {
ticker: params.tickerID,
};
const response = await fetch(apiURL + "/implied-volatility", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
body: JSON.stringify(postData),
});
const output = await response.json();
return output;
};
// Make sure to return a promise
return {
getData: await getData(),
};
};