ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Build AI Financial News Screener
Tutorial

How to Build AI Financial News Screener

Screen financial news for earnings, FDA approvals, and macro events using search API. Python pipeline at $0.005/query.

Get Free API KeyAPI Docs

Financial news moves fast and is scattered across dozens of sources. This screener queries Google News via search API for earnings surprises, FDA decisions, macro events, and sector rotations, then scores relevance and urgency. Each news search costs $0.005, and a full daily screen of 20 topics costs $0.10.

Prerequisites

  • Python 3.8+
  • requests library
  • A Scavio API key from scavio.dev
  • List of tickers or sectors to monitor

Walkthrough

Step 1: Define screening categories

Set up search queries for different financial event types.

Python
import os, requests, json
from datetime import datetime

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

SCREENS = {
    'earnings': ['earnings surprise Q2 2026', 'earnings beat expectations today'],
    'fda': ['FDA approval 2026', 'FDA decision drug approval today'],
    'macro': ['fed rate decision 2026', 'CPI inflation report today'],
    'sector': ['AI stocks momentum 2026', 'semiconductor supply chain update'],
}

def search_news(query):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': query, 'country_code': 'us'}).json()
    return [{'title': r.get('title', ''), 'snippet': r.get('snippet', ''),
             'link': r.get('link', ''), 'source': r.get('displayed_link', '')}
            for r in data.get('organic_results', [])[:5]]

for category, queries in SCREENS.items():
    print(f'\n[{category.upper()}]')
    for q in queries:
        results = search_news(q)
        print(f'  "{q}": {len(results)} articles')

Step 2: Score article urgency and relevance

Classify articles by urgency based on recency signals in titles.

Python
URGENT_WORDS = ['breaking', 'just', 'today', 'now', 'surges', 'plunges', 'halted',
                'approved', 'rejected', 'surprise', 'warning', 'emergency']
HIGH_WORDS = ['report', 'announces', 'update', 'decision', 'results', 'guidance']

def score_urgency(title, snippet):
    text = f'{title} {snippet}'.lower()
    urgent = sum(1 for w in URGENT_WORDS if w in text)
    high = sum(1 for w in HIGH_WORDS if w in text)
    if urgent >= 2: return 'URGENT'
    if urgent >= 1 or high >= 2: return 'HIGH'
    return 'NORMAL'

def full_screen():
    all_articles = []
    for category, queries in SCREENS.items():
        for q in queries:
            results = search_news(q)
            for r in results:
                r['category'] = category
                r['urgency'] = score_urgency(r['title'], r['snippet'])
                all_articles.append(r)
    # Sort by urgency
    priority = {'URGENT': 0, 'HIGH': 1, 'NORMAL': 2}
    all_articles.sort(key=lambda a: priority.get(a['urgency'], 3))
    return all_articles

articles = full_screen()
for a in articles[:10]:
    print(f'[{a["urgency"]:6}] [{a["category"]:8}] {a["title"][:60]}')
print(f'\nTotal articles: {len(articles)}')

Step 3: Generate daily financial digest

Compile screened articles into a structured daily report.

Python
def daily_digest(articles):
    print(f'\n=== Financial News Digest - {datetime.now().strftime("%Y-%m-%d")} ===')
    by_urgency = {'URGENT': [], 'HIGH': [], 'NORMAL': []}
    for a in articles:
        by_urgency.get(a['urgency'], []).append(a)
    for level in ['URGENT', 'HIGH', 'NORMAL']:
        items = by_urgency[level]
        if items:
            print(f'\n  [{level}] ({len(items)} articles)')
            for a in items[:5]:
                print(f'    [{a["category"]}] {a["title"][:55]}')
                print(f'      {a["snippet"][:80]}')
    total_queries = sum(len(qs) for qs in SCREENS.values())
    print(f'\nScreening cost: ${total_queries * 0.005:.3f}')
    print(f'Articles found: {len(articles)}')
    print(f'Urgent items: {len(by_urgency["URGENT"])}')

daily_digest(articles)

Python Example

Python
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def screen(query):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': query, 'country_code': 'us'}).json()
    for r in data.get('organic_results', [])[:3]:
        print(f'  {r.get("title", "")[:60]}')

for q in ['earnings surprise today', 'FDA approval 2026']:
    print(f'\n[{q}]')
    screen(q)
print('Cost: $0.010')

JavaScript Example

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function screen(query) {
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: SH,
    body: JSON.stringify({ query, country_code: 'us' })
  }).then(r => r.json());
  return (data.organic_results || []).slice(0, 5);
}
const results = await screen('earnings surprise today');
results.forEach(r => console.log(r.title));

Expected Output

JSON
=== Financial News Digest - 2026-05-20 ===

  [URGENT] (3 articles)
    [earnings] NVDA Surges After Q2 Earnings Beat Expectation
      NVIDIA reported earnings per share of $1.42 vs $1.28 exp...
    [fda] FDA Approves New Alzheimer Drug From Eli Lilly Tod
      The FDA today approved donanemab for early Alzheimer...

  [HIGH] (8 articles)
    [macro] Fed Holds Rate Steady, Signals September Cut Lik
      Federal Reserve maintained rates at 4.25-4.50%...

Screening cost: $0.040
Articles found: 35
Urgent items: 3

Related Tutorials

  • How to Build a Financial News Sentiment Pipeline
  • How to Build a Multi-Source Trading Brief Agent
  • How to Get Google News Results via the Scavio API

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+. requests library. A Scavio API key from scavio.dev. List of tickers or sectors to monitor. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Best Of

Best Financial News Screening APIs for AI Agents (2026)

Read more
Workflow

Stock News Monitoring via Search MCP Pipeline

Read more
Solution

Stock News Monitoring via MCP Search

Read more
Glossary

Search API Provider Landscape (2026)

Read more
Best Of

Best Search APIs for Pipeline Integration in 2026

Read more
Use Case

Financial News AI Screening

Read more

Start Building

Screen financial news for earnings, FDA approvals, and macro events using search API. Python pipeline at $0.005/query.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy