Inspiration

Modern markets are flooded with headlines. As a news-driven trader, I often found myself asking very simple but hard-to-answer questions:
“When we saw this kind of news before, what actually happened to the price?”
Most people end up gambling on the next candle instead of learning from history or managing risk systematically.

NewsWave was born from that frustration. I wanted a tool that treats news as data, not noise – something that can replay past events, quantify how the market reacted, and then make risk-aware decisions instead of chasing hype.


What it does

NewsWave is a news-driven AI portfolio manager and strategy router. For a given symbol (e.g. NVDA, BTC, BLUE), it:

  • Replays historical news events from a curated dataset.
  • Computes pattern statistics over 1D/3D/7D returns and positive ratios.
  • Feeds these patterns into an AI Portfolio Manager (AI PM) module.
  • Lets the AI PM choose:
    • Strategy: directional “sniper” vs mean-reversion / OU arbitrage.
    • Risk mode: defensive vs aggressive.
    • Confidence score for the setup.
  • Applies a safe Kelly-style position sizing layer to suggest how much capital to allocate – or when to stand aside and not trade at all.

The Streamlit UI shows this flow end-to-end: news → historical pattern → AI PM decision → Kelly sizing → routed orders.


How we built it

Under the hood, NewsWave is structured as a small but modular quant engine:

  • Core engine & strategies
    Python modules handle backtesting logic and two strategies: a directional “sniper” and an OU-style arbitrage engine.

  • AI Portfolio Manager (AI PM)
    The ai_pm module exposes a single decision interface that can run in:

    • pure rule-based mode (deterministic, offline), or
    • LLM-enhanced mode via the Gemini 3 API. The same interface is used in both cases, so the rest of the system doesn’t need to know whether a decision came from rules or from an LLM.
  • Gemini 3 integration (with fallback)
    When enabled, Gemini 3 is used to: 1) understand a headline/summary and map it to a pattern/regime,
    2) reason over historical stats and current market state to pick a strategy + risk mode + confidence,
    3) generate short, human-readable rationales that are shown in the UI.
    Due to free-tier quota and 429 issues, the recorded demo runs in rule-based fallback mode, but the Gemini integration is fully implemented and guarded by environment flags.

  • Risk & Kelly sizing
    A separate infra module computes a conservative Kelly fraction from the AI’s confidence and payoff assumptions, caps it, and enforces a “no-trade” zone when edge is too weak. The UI uses this to override notional sizes and to surface warnings like “edge too weak, suggested action: no trade”.

  • Frontend
    A Streamlit app ties everything together into two main flows:

    • historical event replay, and
    • a “Custom News Lab” where the user can input a hypothetical headline and see how the system would react based on historical patterns.

Challenges we ran into

  • LLM quotas and reliability
    In practice, calling Gemini from a hackathon environment quickly hit 429 RESOURCE_EXHAUSTED errors. This forced us to design the AI PM as “LLM-first, but rule-based-safe” from the beginning: every decision path has a deterministic fallback with the same interface and tests.

  • Designing risk first, not alpha first
    It is tempting to show impressive-looking trades, but a realistic tool must know when not to trade. Getting the Kelly module and the “no-trade” logic to feel conservative yet informative took multiple iterations.

  • Data constraints
    The current dataset is small and focused on 2024 news events. We had to design the engine in a way that can naturally scale to more symbols, more years, and potentially on-chain news feeds in the future.


What we learned

  • How to architect an AI-heavy system so that LLMs are a pluggable “brain” with graceful degradation, instead of a single point of failure.
  • How to turn noisy, narrative-heavy news into simple, testable decisions that a risk manager would not be ashamed of.
  • How important good UX is for quant tools: explaining why an AI PM picked a strategy or chose “no trade” matters as much as the decision itself.

What’s next for NewsWave

  • Expanding the news dataset to more years and more symbols, including crypto and DeFi assets.
  • Bringing Gemini 3 fully online in a more stable environment to power real-time pattern classification and explanations.
  • Exploring integrations with actual brokers or DeFi protocols so that routed orders and Kelly-sized decisions can be executed on live markets.
  • Extending the router to support multiple strategy families and richer risk profiles, so users can choose “survive first, then optimize upside” in a way that fits their own temperament.

Built With

Share this project:

Updates