Skip to content

Add QQQ 1DTE short-put backtest script#1

Open
ax3301 wants to merge 4 commits into
mainfrom
claude/qqq-put-backtest-Ta2CC
Open

Add QQQ 1DTE short-put backtest script#1
ax3301 wants to merge 4 commits into
mainfrom
claude/qqq-put-backtest-Ta2CC

Conversation

@ax3301

@ax3301 ax3301 commented Jun 5, 2026

Copy link
Copy Markdown
Owner

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.

claude added 4 commits May 18, 2026 03:32
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants