Skip to content

feat: Add check_news tool for economic calendar / news events #1

@teslashibe

Description

@teslashibe

Summary

Add a check_news tool to query economic calendar events and market-moving news. This enables strategies to avoid trading during high-impact events (FOMC, CPI, etc.).

Motivation

The backtesting agent generates strategies that say "Avoid trading during major news events" but has no tool to actually check for this. This creates a gap between strategy logic and execution capability.

Proposed Interface

// NewsProvider provides access to economic calendar / news events.
type NewsProvider interface {
    // GetEventsInRange returns events between start and end times.
    // Used for backtesting to check historical events during a candle.
    GetEventsInRange(ctx context.Context, asset string, start, end time.Time) ([]NewsEvent, error)
    
    // GetUpcomingEvents returns events within the next N hours.
    // Used for live trading to check before entering positions.
    GetUpcomingEvents(ctx context.Context, asset string, hoursAhead int) ([]NewsEvent, error)
}

// NewsEvent represents a market-moving event.
type NewsEvent struct {
    Time        time.Time
    Title       string
    Impact      string  // "high", "medium", "low"
    Asset       string  // "BTC", "ETH", "*" for macro
    Category    string  // "fed", "cpi", "fomc", "halving", etc.
    Description string
}

Files to Create/Modify

File Purpose
core/interfaces.go Add NewsProvider interface
core/types.go Add NewsEvent type
context.go Add optional NewsProvider to Context
tools/check_news.go New check_news tool
tools/registry.go Register the new tool

Tool Output Example

{
  "asset": "BTC",
  "start_time": "2025-12-20T00:00:00Z",
  "end_time": "2025-12-31T00:00:00Z",
  "events_count": 2,
  "high_impact_events": [
    {
      "time": "2025-12-27T14:00:00Z",
      "title": "FOMC Meeting Minutes",
      "impact": "high",
      "category": "fed"
    }
  ],
  "recommendation": "⚠️ Avoid opening new positions 2 hours before/after high-impact events"
}

Implementation Notes

  • Provider-based design allows different implementations (DB, API, mock)
  • Optional dependency - tool returns warning if no provider configured
  • Works for both backtesting (historical) and live trading (upcoming)

Labels

enhancement, tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions