docs/premium-finance-search.mdx
This document covers the extra targeted stock-news search layer used by premium finance.
It is separate from the core premium-finance architecture on purpose.
Core premium finance can still function without this layer. The search layer exists to improve stock-news discovery quality for targeted ticker analysis, especially where feed-only coverage is weak.
See the core system document in PREMIUM_FINANCE.md.
World Monitor is mostly feed-first:
The source repo being migrated from uses a broader search-provider layer for stock-specific news lookup. That produces better targeted coverage for:
This layer closes that gap without replacing the project's broader feed architecture.
The current provider chain is:
TavilyBraveSerpAPIBocha was intentionally not added because the current premium-finance direction is not China-focused.
Primary implementation:
Integration point:
The helper:
StockAnalysisHeadlineThe current query shape intentionally mirrors the stock-news style from the source repo for foreign equities:
<Company Name> <SYMBOL> stock latest news
Examples:
Apple AAPL stock latest newsMicrosoft MSFT stock latest newsSearch freshness is dynamic:
That mirrors the idea that weekend gaps need a wider lookback than midweek trading days.
The search layer uses runtime-managed secret keys so it fits the same desktop/web secret model as the rest of the project.
Configured keys:
TAVILY_API_KEYSBRAVE_API_KEYSSERPAPI_API_KEYSThese are wired through:
The values are multi-key strings, split on commas or newlines.
Search results are cached in Redis under a query-derived key. The cache key includes:
This avoids repeated provider calls when multiple users request the same premium stock analysis.
The cache is intentionally short-lived because search-backed finance news gets stale quickly.
If Tavily fails, the system tries Brave.
If Brave fails, the system tries SerpAPI.
If provider-backed search is unavailable, empty, or unconfigured, the system falls back to Google News RSS.
That means:
This layer is not the stock-analysis engine itself.
It should be treated as:
It should not be treated as:
That separation matters because it keeps the premium finance feature understandable:
The current implementation does not yet expose a standalone public stock-news search RPC.
Right now it is an internal backend helper used by premium stock analysis. That is deliberate:
If needed later, this helper can be promoted into a first-class market RPC.