add expirations endpoint
This commit is contained in:
@@ -74,6 +74,20 @@ server.get<{
|
||||
ORDER BY "strike";`;
|
||||
reply.status(200).send(strikes);
|
||||
})
|
||||
server.get<{
|
||||
Params: {underlying:string, quote_date:string},
|
||||
}>('/option_quotes/:underlying/:quote_date/expirations', async (request, reply) => {
|
||||
const expirations = (await sql`
|
||||
SELECT DISTINCT "expiration"
|
||||
FROM "option_quote"
|
||||
WHERE
|
||||
"underlying" = ${request.params.underlying}
|
||||
AND
|
||||
"quote_date" = ${request.params.quote_date}
|
||||
ORDER BY "expiration";`
|
||||
).map(x=>x.expiration);
|
||||
reply.status(200).send(expirations);
|
||||
})
|
||||
|
||||
server.listen({ port: 8234, host: '127.0.0.1' }, (err, address) => {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user