blob: 3dac574c92dbf5bb0d92d2a0da706e7aaa2b2981 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import type { RequestHandler } from '@sveltejs/kit';
import yahooFinance from 'yahoo-finance2';
/**
* Example request : GET /stocksapi/trendingSymbols
*/
export const GET: RequestHandler = async () => {
const queryOptions = { count: 5, lang: 'en-US' };
const data = await yahooFinance.trendingSymbols('US', queryOptions);
return new Response(JSON.stringify(data), {
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
},
});
};
|