BaoKhuong's picture
Update README.md
2af8939 verified

A newer version of the Gradio SDK is available: 5.49.1

Upgrade
metadata
title: FinRobot-claude-4.1-opus
emoji: πŸ€–
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.47.0
app_file: app1 - claude-4.1-opus.py
python_version: 3.12
pinned: false
license: apache-2.0
short_description: AI-powered stock market analysis

πŸ€– FinRobot Forecaster

AI-powered stock market analysis and prediction using advanced language models

This application provides comprehensive stock market analysis by combining:

  • Real-time stock data from Alpha Vantage via RapidAPI (premium access)
  • Company news and sentiment from Finnhub
  • Advanced AI analysis using Google's Gemini models
  • Financial metrics and historical performance data

πŸš€ Features

  • Stock Price Analysis: Analyze historical price movements over configurable time periods
  • News Sentiment Analysis: Process company news and market sentiment
  • AI-Powered Predictions: Generate detailed market outlook using advanced language models
  • Financial Metrics: Optional inclusion of basic financial data
  • Interactive Interface: User-friendly Gradio interface for easy interaction

πŸ“Š How It Works

  1. Data Collection: Fetches historical stock data and recent company news
  2. Analysis: Processes the data to identify trends and patterns
  3. AI Processing: Uses Google Gemini to analyze the information
  4. Prediction: Generates structured predictions with:
    • Positive developments
    • Potential concerns
    • Price outlook with rationale

πŸ› οΈ Setup Instructions

For HuggingFace Spaces:

  1. Fork this repository to your HuggingFace account
  2. Deploy: The Space will automatically build and deploy
    • All API keys are already included in the code
    • Multiple API keys are used for better reliability and rate limit handling

For Local Development:

  1. Clone the repository:

    git clone <your-repo-url>
    cd finrobot-forecaster
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the application:

    python app.py
    

πŸ“ˆ Usage Examples

Try these popular stocks:

  • AAPL (Apple Inc.)
  • MSFT (Microsoft Corporation)
  • GOOGL (Alphabet Inc.)
  • TSLA (Tesla Inc.)
  • NVDA (NVIDIA Corporation)

βš™οΈ Configuration Options

  • Stock Symbol: Enter any valid ticker symbol
  • Historical Weeks: Choose 1-6 weeks of historical data
  • Basic Financials: Toggle to include financial metrics

πŸ”§ Technical Details

  • Framework: Gradio 5.46.0
  • AI Model: Google Gemini 1.5 Pro
  • Data Sources: RapidAPI Alpha Vantage (2 premium keys), Finnhub
  • Language: Python 3.11
  • Container: Optimized for HuggingFace Spaces

πŸ“ Output Format

The AI analysis provides:

[Positive Developments]

  • Key positive factors affecting the stock
  • Recent achievements and growth indicators

[Potential Concerns]

  • Risk factors and challenges
  • Market uncertainties

[Prediction & Analysis]

  • One-week price outlook
  • Detailed rationale for the prediction

πŸ›‘οΈ Error Handling & Reliability

Comprehensive Fallback System:

  1. Primary: RapidAPI Alpha Vantage (2 premium keys with rotation)
  2. Secondary: Mock data generation (for demonstration)

API Key Rotation:

  • Automatic switching between RapidAPI keys
  • Rate limit detection with seamless fallback
  • Comprehensive logging for debugging
  • Graceful degradation at every level

Error Recovery:

  • Timeout handling: 30-second timeout with retry logic
  • Rate limit management: Automatic key rotation
  • Mock data fallback: App always works for demonstration
  • User-friendly messages: Clear error communication

⚠️ Disclaimer

Important: This application is for educational and research purposes only. The predictions and analysis provided should not be considered as financial advice. Always consult with qualified financial professionals before making investment decisions.

🀝 Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ™ Acknowledgments

  • FinRobot - Original FinRobot framework
  • Google AI - Gemini models
  • [RAPID] - Stock market data
  • Finnhub - Financial news and data
  • Gradio - Web interface framework

Built with ❀️ for the financial AI community