feat: custom date range filter on calendar page
- Backend: /api/eco/calendar accepts date_from + date_to query params when period=custom; get_calendar() uses them directly without override Limit raised to 5000 for wide date ranges - Frontend: "Custom" tab at end of period list; shows two date inputs (from/to) with Apply button; displays day count; fetches on Apply click (not on every keystroke to avoid hammering the API) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -421,10 +421,12 @@ def ff_scrape_status_ep() -> Dict[str, Any]:
|
||||
|
||||
@router.get("/calendar")
|
||||
def ff_calendar(
|
||||
period: str = Query("recent", description="recent|today|tomorrow|yesterday|this_week|next_week|previous_week|this_month|next_month|previous_month"),
|
||||
period: str = Query("recent", description="recent|today|tomorrow|yesterday|this_week|next_week|previous_week|this_month|next_month|previous_month|custom"),
|
||||
date_from: Optional[str] = Query(None, description="YYYY-MM-DD (used when period=custom)"),
|
||||
date_to: Optional[str] = Query(None, description="YYYY-MM-DD (used when period=custom)"),
|
||||
currencies: Optional[str] = Query(None, description="Comma-separated: USD,EUR,GBP,..."),
|
||||
impacts: Optional[str] = Query(None, description="Comma-separated: high,medium,low"),
|
||||
limit: int = Query(300, ge=1, le=2000),
|
||||
limit: int = Query(500, ge=1, le=5000),
|
||||
offset: int = Query(0, ge=0),
|
||||
) -> Dict[str, Any]:
|
||||
"""Unified Forex Factory calendar — past releases + upcoming events."""
|
||||
@@ -433,6 +435,8 @@ def ff_calendar(
|
||||
imp_list = [i.strip().lower() for i in impacts.split(",") if i.strip()] if impacts else None
|
||||
return get_calendar(
|
||||
period=period,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
currencies=cur_list,
|
||||
impacts=imp_list,
|
||||
limit=limit,
|
||||
|
||||
Reference in New Issue
Block a user