Skip to content
Back to blog

Query Option Trade Files with DuckDB: Three Examples on the Free Sample

Load an OptionData trade file in DuckDB and run three queries: premium by side, the busiest strikes, and trades against open interest. Every result below comes from the free DIS sample.

2 min readOptionData
historical-dataduckdbparquetoption-tradestutorial
RESEARCHOptionData blogSELECTWHEREGROUPORDER

You can check a trade file before you buy it. The free DIS sample holds every DIS option trade on 2026-10-15, 8,087 rows, in the same layout as a paid file. This post runs three queries on it with DuckDB, which reads Parquet and CSV directly. There is nothing to load or import first.

The queries use the free option chain sample too. Download both files into one folder.

Open the file

SQL
DESCRIBE SELECT * FROM 'DIS_2026-10-15.parquet';

You get the 16 columns the download guide lists: date, time, symbol, put_call, strike, expiration_date, size, price, bid, ask, underlying_price, iv, delta, gamma, oi and dei. The CSV sample reads the same way, with read_csv('DIS_2026-10-15.csv.gz'). It also has 8,087 rows.

One difference between the formats: time is a UTC timestamp in Parquet and New York local time in CSV.

1. Premium by side

The premium of a trade is price × size × 100.

SQL
SELECT put_call,
       count(*)                          AS trades,
       sum(size)                         AS contracts,
       round(sum(price * size * 100))    AS premium
FROM 'DIS_2026-10-15.parquet'
GROUP BY put_call
ORDER BY put_call;
put_calltradescontractspremium
CALL3,94117,317$5,606,810
PUT4,14622,809$4,030,548

Puts traded more contracts, and calls carried more premium: a call contract cost more on average.

2. The busiest strikes for tomorrow's expiry

Filter on expiration_date to look at one expiration. Here it is the next day, 2026-10-16.

SQL
SELECT strike, put_call, sum(size) AS contracts
FROM 'DIS_2026-10-15.parquet'
WHERE expiration_date = DATE '2026-10-16'
GROUP BY strike, put_call
ORDER BY contracts DESC
LIMIT 3;
strikeput_callcontracts
110CALL2,171
110PUT2,088
111PUT1,670

3. Trades against open interest

Volume means more next to the contracts already open. The chain file has each contract's open interest in its oi column, as of the previous close, so join the two files on the contract:

SQL
SELECT t.strike, t.put_call, t.contracts, ch.oi
FROM (
  SELECT strike, expiration_date, put_call, sum(size) AS contracts
  FROM 'DIS_2026-10-15.parquet'
  GROUP BY ALL
) t
JOIN 'DIS_chains_2026-10-15.parquet' ch
  USING (strike, expiration_date, put_call)
ORDER BY t.contracts DESC
LIMIT 3;
strikeput_callcontracts tradedopen interest
109PUT2,91072
110CALL2,1717,406
110PUT2,0881,932

The 109 put traded 2,910 contracts against 72 already open, which is the kind of mismatch worth a closer look. The 110 call traded much less than its open interest.

Next steps

The same queries run on a whole market day, which is about 9 to 17 million rows. Point DuckDB at a folder of files with a glob such as 'trades_*.parquet' to query many days at once. A trade file costs $2 per whole-market day, so a month is about $42. Order option trades, or read what each file holds.