add underlying quote by date
This commit is contained in:
@@ -16,6 +16,20 @@ server.get('/ping', async (request, reply) => {
|
||||
return 'pong\n'
|
||||
})
|
||||
|
||||
server.get<{
|
||||
Params: {underlying:string, quote_date:string},
|
||||
}>('/underlying_quotes/:underlying/:quote_date', async (request, reply) => {
|
||||
const underlying_quote = (await sql`
|
||||
SELECT "high", "low", "open", "close"
|
||||
FROM "stock_quote"
|
||||
WHERE
|
||||
"symbol" = ${request.params.underlying}
|
||||
AND "quote_date" = ${request.params.quote_date}
|
||||
;`
|
||||
);
|
||||
reply.status(200).send(underlying_quote);
|
||||
})
|
||||
|
||||
server.get('/option_quotes/underlyings', async (request, reply) => {
|
||||
const underlyings = (await sql`SELECT * FROM "underlyings";`).map(x=>x.underlying);
|
||||
reply.status(200).send(underlyings);
|
||||
|
||||
Reference in New Issue
Block a user