A unified abstraction layer that aggregates options data from Interactive Brokers, TradingView, and other sources to find optimal strategies while persisting analysis for historical tracking.
Pull data from IB, TradingView, Yahoo - use the best source available with automatic fallback
Store chains in Redis, IV history in TimescaleDB, track strategy performance over time
Query via Claude Code with natural language - "Find me a bull call spread on NVDA for March"
No more clicking through TWS - automate searches and get alerts when opportunities appear
Abstraction layer over existing tools with persistent storage
Leverage the tools you already pay for
How data flows through the abstraction layer
You ask Claude: "Find me the best options strategy for NVDA to hit $155 by March. I want defined risk."
Claude Code invokes the search_strategies MCP tool
Tool: search_strategies Symbol: NVDA Target: $155 (+10%) Timeline: ~90 days (March expiry) Constraint: defined_risk: true
Look for recently cached chain data
Key: chains:NVDA:2025-03-21 Result: MISS (cache expired) Action: Fetch from providers
Primary provider returns full options chain
# ib_insync fetches via IB Gateway Expiration: 2025-03-21 Calls: 45 contracts Puts: 45 contracts Greeks: Delta, Gamma, Theta, Vega Liquidity: Volume, Open Interest, Spread
Add technical analysis and IV metrics
# TradingView API enrichment IV Rank: 62 (above average) IV Percentile: 71 RSI (14): 54.2 MACD Signal: BULLISH Recommendation: BUY
Store for reuse and historical tracking
# Hot cache for repeated queries Redis: chains:NVDA:2025-03-21 TTL: 60s # Historical tracking TimescaleDB: iv_history (symbol, iv_rank, timestamp)
Filter for defined risk, calculate metrics, rank by target alignment
# Strategy engine processing Filter: defined_risk=true → Spreads only Generated: 312 vertical spreads Calculated: P&L at $155, PoP, Greeks Ranked: Top 20 by score
Claude presents the top strategies with full context
Tiered caching + unified database
Quotes and Greeks change rapidly - short cache prevents stale execution data
IV metrics and technicals change slowly - longer cache OK
Contract specs and strike lists rarely change
Single instance with TimescaleDB extension - hypertables for time-series, regular tables for config
Multi-source enriched strategy recommendation
Validated by Gemini, Claude, and Codex
score = ( # Expected value weighted by probability (max_profit × prob_of_profit) - (max_loss × (1 - prob_of_profit)) # Penalize illiquid options × liquidity_factor # 0-1, based on bid/ask spread # Penalize high-maintenance strategies - gamma_penalty # High gamma = constant adjustment )
Why not just ROI? A 500% return with 5% probability is worse than 50% return with 60% probability.
py_vollib calculates European options. US equity options are American style. Flag strategies where early exercise matters (deep ITM puts, calls before dividends).
tradingview-ta is unofficial and brittle. Plan for breakage. Free tier is ~15m delayed. Always have fallback strategy.
Risk management and option quality parameters
// Request: max_allocation=$5000, max_risk=$2000, allow_multiple=true Bull Call Spread: NVDA 140/155 @ $9.30/contract max_loss_per_contract: $930 max_contracts_by_risk: floor($2000 / $930) = 2 contracts max_contracts_by_capital: floor($5000 / $930) = 5 contracts recommended: 2 contracts (limited by max_risk) Result: total_cost: $1,860 max_loss: $1,860 (within $2000 limit) max_profit: $1,140 (2 × $570)
Defined vs Undefined Risk: For spreads, max_loss = debit paid. For naked options, max_loss is calculated from margin requirements.
{
"symbol": "AAPL",
"current_price": 195.50,
"target_prices": [205.28, 215.05],
"timeline_days": 90,
"allowed_strategies": ["vertical_spread", "covered_call"],
// Position Sizing
"max_allocation": 5000,
"max_risk": 2000,
"allow_multiple_contracts": true,
"max_contracts": 10,
// Quality Filters
"min_probability_of_profit": 0.50,
"min_open_interest": 100,
"max_bid_ask_spread_pct": 5.0,
"min_days_to_expiry": 14,
"exclude_earnings": true,
"delta_range": [0.20, 0.40],
// Data & Storage
"data_sources": ["ib", "tradingview"],
"persist_results": true
}