Skip to content

Add DataFrame entry points and replace apply_signal with signal_dates#232

Merged
michaelchu merged 1 commit intomainfrom
claude/remove-underlying-price
Feb 27, 2026
Merged

Add DataFrame entry points and replace apply_signal with signal_dates#232
michaelchu merged 1 commit intomainfrom
claude/remove-underlying-price

Conversation

@michaelchu
Copy link
Copy Markdown
Member

Summary

  • options_data(df) — validates/normalizes an existing DataFrame for use with strategies (no CSV or column-index mapping needed)
  • load_cached_options(symbol) — reads options data from the parquet cache (produced by optopsy-data download) into the strategy pipeline
  • load_cached_stocks(symbol) — reads cached stock OHLCV data for signal building
  • signal_dates(stock_data, signal_func) — replaces apply_signal as the single way to generate entry/exit dates from signals

Removes apply_signal which confusingly required options data to build stock-based signals. signal_dates cleanly separates concerns: signals run on stock data, strategies run on options data.

New user flow

import optopsy as op

stocks = op.load_cached_stocks("SPY")
options = op.load_cached_options("SPY")

entry = op.signal_dates(stocks, op.rsi_below(threshold=30))
results = op.long_calls(options, entry_dates=entry)

Test plan

  • All 1268 tests pass
  • Pre-commit hooks pass (ruff format, ruff check, ty, pytest, branch name)
  • Zero remaining references to apply_signal in codebase
  • Docs and samples updated to show new flow

🤖 Generated with Claude Code

…es; remove apply_signal

Adds DataFrame-based entry points to bridge the data package and core library:
- options_data(df) validates/normalizes an existing DataFrame for strategies
- load_cached_options(symbol) reads from the parquet cache into the strategy pipeline
- load_cached_stocks(symbol) reads cached stock OHLCV data for signal building

Replaces apply_signal with signal_dates(stock_data, signal_func) which cleanly
separates concerns: signals are computed on stock data only, then dates are
passed to strategies via entry_dates/exit_dates. This removes the confusing
coupling where apply_signal required options data to build stock-based signals.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@michaelchu michaelchu merged commit 0e60a00 into main Feb 27, 2026
8 checks passed
@michaelchu michaelchu deleted the claude/remove-underlying-price branch February 27, 2026 21:20
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.

1 participant