Add sample query to scratch.sql
This commit is contained in:
+20
@@ -70,3 +70,23 @@ ORDER BY
|
||||
strike,
|
||||
"type"
|
||||
LIMIT 30;
|
||||
|
||||
-- given an underlying, contract type, strike, and front/back expirations: for each quote_date, list prices of calendars:
|
||||
SELECT
|
||||
"front_contract"."quote_date",
|
||||
("back_contract"."ask" - "front_contract"."bid") AS "price"
|
||||
FROM
|
||||
"option_quote" AS "front_contract"
|
||||
INNER JOIN
|
||||
"option_quote" AS "back_contract"
|
||||
ON
|
||||
"back_contract"."underlying" = "front_contract"."underlying"
|
||||
AND "back_contract"."type" = "front_contract"."type"
|
||||
AND "back_contract"."quote_date" = "front_contract"."quote_date"
|
||||
AND "back_contract"."strike" = "front_contract"."strike"
|
||||
AND "back_contract"."expiration" = '?'
|
||||
WHERE
|
||||
"front_contract"."underlying" = '?'
|
||||
AND "front_contract"."type" = 'call'
|
||||
AND "front_contract"."strike" = '?'
|
||||
AND "front_contract"."expiration" = '?'
|
||||
|
||||
Reference in New Issue
Block a user