Skip to content

Alpha Vantage Historical Data Access - outputsize Parameter Issue #66

@iAmGiG

Description

@iAmGiG

Problem: Alpha Vantage outputsize=compact only returns recent 100 days, not historical data.

Manifestation:

  • Requesting historical dates (2024-01-01) returns 2025 data
  • Date filtering removes all data resulting in empty DataFrames
  • Technical indicators fail with "insufficient data"

Root Cause:

# Wrong logic - only used 'full' for large ranges
use_full = days_range > 100

# Should use 'full' for ANY historical request

Solution Applied:

# Use full output if requesting historical data (>30 days old) OR large range
end_date_obj = datetime.datetime.strptime(processed_end, "%Y-%m-%d")
now = datetime.datetime.now()
days_from_now = (now - end_date_obj).days

use_full = days_from_now > 30 or days_range > 100

Files Fixed:

  • src/data_sources/alpha_vantage_gex.py (lines 220-228)

Prevention:

  • Test data fetching with both recent and historical date ranges
  • Validate that date ranges in test data match requested ranges
  • Monitor for sample/fake data patterns in results

Priority: High - critical for backtesting and historical analysis

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdata-sourcesIssues related to data source integrations (Alpha Vantage, Polygon, etc.)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions