From cd9dd9fefc1029061fd22f7e7f9d93ce2b81ca90 Mon Sep 17 00:00:00 2001 From: Avraham Sakal Date: Fri, 5 Jul 2024 16:42:04 -0400 Subject: [PATCH] I don't have the underlying data yet --- server/src/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/src/index.ts b/server/src/index.ts index 1100b42..8f1c5c4 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -37,10 +37,11 @@ export function RpcType(schema: T) { const appRouter = router({ getAvailableUnderlyings: publicProcedure.query(async (opts) => { - // return (await query<{symbol:string}>(` - // SELECT DISTINCT(symbol) as symbol FROM option_contract_existences - // `)) - // .map(({symbol})=>symbol); + // return ( + // await query<{ symbol: string }>(` + // SELECT DISTINCT(symbol) as symbol FROM option_contract_existences WHERE asOfDate = (SELECT max(asOfDate) FROM option_contract_existences) + // `) + // ).map(({ symbol }) => symbol); return ["AAPL", "AMD", "GOOGL", "MSFT", "NFLX"]; }), getAvailableAsOfDates: publicProcedure @@ -142,7 +143,7 @@ const appRouter = router({ SELECT toUnixTimestamp(tsStart) as x, open as y - FROM option_aggregates + FROM option_contract_aggregates WHERE symbol = '${underlying}' AND expirationDate = '${expirationDate}' AND strike = ${strike}