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:1. As an environment variable (recommended)
2. As a command-line argument
3. In a file
Create a file namedpplx_api_key
or .pplx_api_key
in the same directory:
Quick Start
Get the latest tech stock news: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 week1m
- Last month3m
- Last 3 months1y
- Last year
Output Format
The tool provides comprehensive financial analysis including:1. Executive Summary
A brief overview of the key financial developments2. 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 newsExample 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
- Be Specific: Include company tickers, sector names, or specific events
- Combine Topics: Mix company names with relevant themes (e.g., “TSLA electric vehicles”)
- Use Time Ranges: Match the time range to your investment horizon
- 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