Add QQQ 1DTE short-put backtest script#1
Open
ax3301 wants to merge 4 commits into
Open
Conversation
Implements the strategy: at every T-1 close, sell 1 QQQ put expiring T struck at ~spot*0.98 (nearest listed strike). On T close, if QQQ > strike the put expires worthless; otherwise we are assigned 100 shares at the strike and hold for 10 trading days before selling. QQQ daily bars come from yfinance; the option chain and EOD prices come from Polygon via the PROXY_URL/PROXY_KEY environment variables (POLYGON_API_KEY supported as a direct fallback). Outputs qqq_put_premiums.csv, qqq_put_log.csv and a terminal summary comparing strategy PnL to QQQ buy-and-hold. Note: running the backtest still requires the proxy at 43.206.151.58:8080 to be reachable from the sandbox.
Three CLI tools that capture the lessons of the 2026-06-05 DRAM
short-put episode:
research/sec_monitor.py
edgartools + sec-edgar-downloader. List & dump SEC filings;
--risk prints the latest 10-K Item 1A. Read this BEFORE selling
puts on a company.
research/options_backtest.py
yfinance + Black-Scholes premium estimate + QuantStats tearsheet.
Backtests a weekly short-put strategy at K = round(spot * pct).
Output: per-trade CSV + HTML report + strategy vs buy-and-hold.
Tested on MU (2y, 813% vs 594% B&H) and DRAM (2-month sample).
research/realtime_options.py
Polygon (via PROXY_URL/PROXY_KEY or direct API key) with yfinance
fallback. Prints ATM straddle implied move, 25-delta skew, top-OI
strikes — fixing the "yfinance returns 0s for small ETF options"
issue we hit during the DRAM roll.
Includes setup.sh + requirements.txt so a fresh sandbox can be
re-provisioned in one command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the strategy: at every T-1 close, sell 1 QQQ put expiring T
struck at ~spot*0.98 (nearest listed strike). On T close, if QQQ > strike
the put expires worthless; otherwise we are assigned 100 shares at the
strike and hold for 10 trading days before selling. QQQ daily bars come
from yfinance; the option chain and EOD prices come from Polygon via the
PROXY_URL/PROXY_KEY environment variables (POLYGON_API_KEY supported as
a direct fallback). Outputs qqq_put_premiums.csv, qqq_put_log.csv and a
terminal summary comparing strategy PnL to QQQ buy-and-hold.
Note: running the backtest still requires the proxy at 43.206.151.58:8080
to be reachable from the sandbox.