Skip to content

Add OHLCV caching to avoid yfinance rate limits in TA signal workflows#86

Closed
Copilot wants to merge 1 commit intofeature/pandas-ta-signalsfrom
copilot/sub-pr-85
Closed

Add OHLCV caching to avoid yfinance rate limits in TA signal workflows#86
Copilot wants to merge 1 commit intofeature/pandas-ta-signalsfrom
copilot/sub-pr-85

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 20, 2026

The run_strategy tool fetches OHLCV data via yfinance on every execution when TA signals are used, causing slowness and potential rate limiting during iterative chat sessions.

Changes

  • Parquet-based OHLCV cache under ~/.optopsy/cache/ohlcv/{SYMBOL}.parquet
  • Smart range merging in run_strategy: fetches only missing date ranges, merges with cached data
  • Cache CLI commands: optopsy-chat cache size now shows OHLCV stats, cache clear supports OHLCV category
  • Gap detection: refetches interior gaps >5 calendar days (consistent with options chain provider logic)

Example

# First call: fetches 2024-01-01 to 2024-12-31 from yfinance
run_strategy("long_calls", "SPY", entry_signal="sma_crossover", ...)

# Second call with overlapping range: reuses cache, fetches only 2025-01-01 onward
run_strategy("long_calls", "SPY", entry_signal="rsi_oversold", start_date="2024-06-01", end_date="2025-03-01", ...)

Cache survives across chat sessions. Historical OHLCV data is immutable, so no TTL needed.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] WIP: Address feedback from review on pandas_ta signal support Add OHLCV caching to avoid yfinance rate limits in TA signal workflows Feb 20, 2026
Copilot AI requested a review from michaelchu February 20, 2026 20:42
@michaelchu michaelchu closed this Feb 20, 2026
@michaelchu michaelchu deleted the copilot/sub-pr-85 branch February 23, 2026 03:30
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