diff --git a/app/api/v1/endpoints/price.py b/app/api/v1/endpoints/price.py index cde3185..65735e6 100644 --- a/app/api/v1/endpoints/price.py +++ b/app/api/v1/endpoints/price.py @@ -310,11 +310,19 @@ async def get_price_data_simple( period: Optional[str] = Query(None, description="Period like '1d', '7d', '1m', '3m', '6m', '1y', '2y', '5y', 'max'"), start_date: Optional[date] = Query(None, description="Start date for data retrieval (use with end_date, not with period)"), end_date: Optional[date] = Query(None, description="End date for data retrieval (use with start_date, not with period)"), + start: Optional[date] = Query(None, description="Alias for start_date"), + end: Optional[date] = Query(None, description="Alias for end_date"), interval: str = Query("1d", description="Data interval: 1d, 1w, 1m, 5d, 1h, etc."), force_refresh: bool = Query(False, description="Force refresh from Yahoo Finance"), db: AsyncSession = Depends(get_db) ): """Simplified GET endpoint for price data""" + # Resolve aliases: start/end → start_date/end_date + if start and not start_date: + start_date = start + if end and not end_date: + end_date = end + # Validate that either period OR date range is provided, not both if period and (start_date or end_date): raise HTTPException( diff --git a/app/schemas/financial.py b/app/schemas/financial.py index 2428fdd..5e42772 100644 --- a/app/schemas/financial.py +++ b/app/schemas/financial.py @@ -145,8 +145,8 @@ class BulkFinancialDataRequest(BaseModel): if not quarters: # Using date-based approach if not v: raise ValueError("end_date is required when not using quarters") - if start_date and v <= start_date: - raise ValueError("end_date must be after start_date") + if start_date and v < start_date: + raise ValueError("end_date must be on or after start_date") return v class PriceDataRequest(BaseModel): @@ -215,8 +215,8 @@ class PriceDataRequest(BaseModel): if not quarters: # Using date-based approach if not v: raise ValueError("end_date is required when not using quarters") - if start_date and v <= start_date: - raise ValueError("end_date must be after start_date") + if start_date and v < start_date: + raise ValueError("end_date must be on or after start_date") return v class BulkPriceDataRequest(BaseModel): @@ -274,8 +274,8 @@ class BulkPriceDataRequest(BaseModel): if not quarters: # Using date-based approach if not v: raise ValueError("end_date is required when not using quarters") - if start_date and v <= start_date: - raise ValueError("end_date must be after start_date") + if start_date and v < start_date: + raise ValueError("end_date must be on or after start_date") return v diff --git a/app/schemas/validators.py b/app/schemas/validators.py index 7f54867..36e6300 100644 --- a/app/schemas/validators.py +++ b/app/schemas/validators.py @@ -57,6 +57,6 @@ def validate_end_date_field(cls, v, values): if not quarters and not period: # Using date-based approach if not v: raise ValueError("end_date is required when using date range approach") - if start_date and v <= start_date: - raise ValueError("end_date must be after start_date") + if start_date and v < start_date: + raise ValueError("end_date must be on or after start_date") return v \ No newline at end of file