|
|
@ -74,6 +74,20 @@ server.get<{
|
|
|
|
ORDER BY "strike";`;
|
|
|
|
ORDER BY "strike";`;
|
|
|
|
reply.status(200).send(strikes);
|
|
|
|
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) => {
|
|
|
|
server.listen({ port: 8234, host: '127.0.0.1' }, (err, address) => {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|