Skip to main content

Financial News Tracker

A command-line tool that fetches and analyzes real-time financial news using Perplexity’s Sonar API. Get comprehensive market insights, news summaries, and investment analysis for any financial topic.

Features

  • Real-time financial news aggregation from multiple sources
  • Market sentiment analysis (Bullish/Bearish/Neutral)
  • Impact assessment for news items (High/Medium/Low)
  • Sector and company-specific analysis
  • Investment insights and recommendations
  • Customizable time ranges (24h to 1 year)
  • Structured JSON output support
  • Beautiful emoji-enhanced CLI output

Installation

1. Install required dependencies

2. Make the script executable

API Key Setup

The tool requires a Perplexity API key. You can provide it in one of these ways:

2. As a command-line argument

3. In a file

Create a file named pplx_api_key or .pplx_api_key in the same directory:

Quick Start

Get the latest tech stock news:
This will fetch recent financial news about tech stocks, analyze market sentiment, and provide actionable insights.

Usage Examples

Basic usage - Get news for a specific topic

Get cryptocurrency news from the past week

Track specific company news

Get news about market sectors

Output as JSON for programmatic use

Use a different model

Enable structured output (requires Tier 3+ API access)

Time Range Options

  • 24h - Last 24 hours (default)
  • 1w - Last week
  • 1m - Last month
  • 3m - Last 3 months
  • 1y - Last year

Output Format

The tool provides comprehensive financial analysis including:

1. Executive Summary

A brief overview of the key financial developments

2. Market Analysis

  • Market Sentiment: Overall market mood (πŸ‚ Bullish, 🐻 Bearish, βš–οΈ Neutral)
  • Key Drivers: Factors influencing the market
  • Risks: Current market risks and concerns
  • Opportunities: Potential investment opportunities

3. News Items

Each news item includes:
  • Headline: The main news title
  • Impact: Market impact level (πŸ”΄ High, 🟑 Medium, 🟒 Low)
  • Summary: Brief description of the news
  • Affected Sectors: Industries or companies impacted
  • Source: News source attribution

4. Investment Insights

Actionable recommendations and analysis based on the news

Example Output

Advanced Features

Custom Queries

You can combine multiple topics for comprehensive analysis:

JSON Output

For integration with other tools or scripts:

Tips for Best Results

  1. Be Specific: Include company tickers, sector names, or specific events
  2. Combine Topics: Mix company names with relevant themes (e.g., β€œTSLA electric vehicles”)
  3. Use Time Ranges: Match the time range to your investment horizon
  4. Regular Monitoring: Set up cron jobs for daily market updates

Limitations

  • Results depend on available public information
  • Not financial advice - always do your own research
  • Historical data may be limited for very recent events
  • Structured output requires Tier 3+ Perplexity API access

Error Handling

The tool includes comprehensive error handling for:
  • Invalid API keys
  • Network connectivity issues
  • API rate limits
  • Invalid queries
  • Parsing errors

Integration Examples

Daily Market Report

Create a script for daily updates:

Python Integration