Skip to content

Royce1xx/DevHacks

Repository files navigation

SentiSwing - AI-Powered Stock Sentiment Analysis

A machine learning-powered stock prediction platform that analyzes news sentiment to provide BUY/SELL recommendations with AI-powered explanations.

Features

  • 🤖 Machine Learning Model: Random Forest trained on historical news sentiment vs stock performance
  • 📰 Real-time News Analysis: Alpha Vantage API integration for live news sentiment
  • 🧠 AI Explanations: OpenAI GPT-3.5-turbo powered explanations for each recommendation
  • 📊 Top 5 BUY Recommendations: Auto-generated list of highest confidence stocks
  • 🎨 Professional UI: Clean, modern financial platform design
  • Live Predictions: Real-time analysis for any stock ticker

Tech Stack

  • Backend: Flask (Python)
  • ML Model: Random Forest (scikit-learn)
  • AI: OpenAI GPT-3.5-turbo
  • Data: Alpha Vantage API
  • Frontend: HTML/CSS/JavaScript
  • Styling: Professional white/blue theme

Setup Instructions

1. Clone the Repository

git clone <your-repo-url>
cd sentiswing

2. Create Virtual Environment

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Set Up Environment Variables

Create a .env file in the root directory:

# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here

# Flask Configuration
FLASK_ENV=development
FLASK_DEBUG=True

5. Get API Keys

6. Run the Application

source venv/bin/activate
python app.py

Visit http://localhost:5000 to use the application.

Usage

  1. Search for any stock (e.g., AAPL, NFLX, TSLA)
  2. View ML prediction with confidence score
  3. Click "Get AI Explanation" for detailed analysis
  4. Browse Top 5 BUY recommendations on the homepage

Project Structure

sentiswing/
├── app.py                      # Flask backend
├── sentiswing_trainer.py       # ML model training
├── sentiswing_predictor.py     # Prediction logic
├── templates/
│   └── index.html              # Frontend dashboard
├── .env                        # Environment variables (not in git)
├── .gitignore                  # Git ignore rules
├── requirements.txt            # Python dependencies
└── data files...

Demo Flow

  1. "Let me search NFLX..." → Shows BUY 98.9% confidence
  2. "Here's why our AI recommends this..." → Click AI Explanation button
  3. "The AI explains the reasoning based on sentiment analysis" → Shows professional explanation

Hackathon Ready

Perfect for hacker track competitions with:

  • Real ML model implementation
  • Multiple API integrations
  • Professional presentation
  • Live demo capabilities

License

MIT License - feel free to use for hackathons and projects!

About

sentiment analysis Trade reccomendations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors