Skip to content

shubham5027/Stock-Portfolio-AI

Repository files navigation

PortView AI Insights

A sophisticated stock market analytics and portfolio management platform that combines real-time market data, AI-powered sentiment analysis, and advanced portfolio optimization.


Screenshot 2025-06-05 120817 Screenshot 2025-06-05 120828 Screenshot 2025-06-05 120837 Screenshot 2025-06-05 120847 Screenshot 2025-06-05 120900 Screenshot 2025-06-05 121122

Key Features

  • Real-Time Market Data: Live stock prices, market indicators, and trading volumes.
  • AI-Powered Sentiment Analysis: Market sentiment analysis using news and social media data.
  • Portfolio Optimization: Advanced portfolio optimization using modern portfolio theory.
  • Asset Correlations: Interactive correlation analysis between different assets.
  • Price Predictions: AI-driven stock price predictions with confidence intervals.
  • Sector Performance: Detailed sector-wise market performance analysis.
  • Financial News Aggregation: Curated financial news from multiple reliable sources.
  • Custom Watchlists: Personalized stock watchlists with real-time updates.

Technology Stack

Frontend

  • React 18 with TypeScript
  • Vite (build tooling)
  • TailwindCSS (styling)
  • shadcn/ui (UI components)
  • Recharts (data visualization)
  • TanStack Query (data fetching/caching)

APIs and Data Sources

  • Alpha Vantage: Market data & technical indicators
  • Finnhub: Real-time stock data & social sentiment
  • Financial Modeling Prep: Company financials & market news
  • Polygon.io: Historical market data
  • Yahoo Finance: Additional market data
  • News API: Financial news aggregation

Development Tools

  • TypeScript
  • ESLint
  • Prettier
  • Bun (package management)

Installation

Prerequisites

  • Node.js 18.0 or higher
  • Bun (recommended) or npm
  • API keys for:
    • Alpha Vantage
    • Finnhub
    • Financial Modeling Prep
    • Polygon.io
    • News API

Setup Instructions

  1. Clone the repository:

    git clone <repository-url>
    cd portview-ai-insights
  2. Install dependencies:

    # Using bun (recommended)
    bun install
    
    # Using npm
    npm install
  3. Create a .env file in the root directory with your API keys:

    VITE_ALPHA_VANTAGE_API_KEY=your_key_here
    VITE_FINNHUB_API_KEY=your_key_here
    VITE_FMP_API_KEY=your_key_here
    VITE_POLYGON_API_KEY=your_key_here
    VITE_NEWS_API_KEY=your_key_here
  4. Start the development server:

    # Using bun
    bun dev
    
    # Using npm
    npm run dev

The app will be available at http://localhost:5173.


Project Structure

src/
├── components/          # Reusable UI components
│   ├── dashboard/      # Dashboard-specific components
│   ├── layout/         # Layout components
│   ├── theme/          # Theme components
│   └── ui/             # Base UI components
├── hooks/              # Custom React hooks
├── lib/                # Utilities and configurations
│   └── api/            # API integration modules
├── pages/              # Page components
└── types/              # TypeScript type definitions

Component Architecture

Core Components

  • Dashboard Components:
    PortfolioPerformanceCard, SentimentCard, StockPriceChart, TopStocksTable
  • Layout Components:
    Layout, Navbar, Sidebar
  • Data Visualization:
    Custom charts (Recharts), interactive data grids, correlation heat maps

State Management

  • React Query for server state
  • React Context for theme/settings
  • Local state for UI

API Integration

  • Market Data: Alpha Vantage, Polygon.io, Yahoo Finance
  • News & Sentiment: Finnhub, News API, Financial Modeling Prep

Data Flow:

  1. Data fetching with React Query
  2. Server-side caching
  3. Real-time updates via WebSocket
  4. Fallbacks for API rate limits

Features in Detail

Market Sentiment Analysis

  • Real-time sentiment from news/social media
  • Historical analysis and trends
  • Keyword extraction, topic modeling
  • Sentiment impact on prices

Portfolio Optimization

  • Modern Portfolio Theory
  • Risk-adjusted return optimization
  • Efficient frontier calculation
  • Rebalancing suggestions
  • Custom constraints

Asset Correlation Analysis

  • Interactive correlation matrix
  • Cross-asset/sector correlation trends
  • Risk diversification insights

Price Predictions

  • ML-based price forecasting
  • Multiple timeframe predictions
  • Confidence intervals, risk metrics
  • Technical indicator integration

Historical Data Analysis

  • Comprehensive historical data
  • Custom date range
  • Technical overlays
  • Volume profile analysis

Real-Time Data

  • Live price updates, indicators
  • Volume analysis
  • Price alerts & notifications

Development

Code Style & Quality

# Lint
npm run lint

# Format
npm run format

# Type check
npm run typecheck

# Run all checks
npm run check

Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Specific test file
npm run test -- path/to/test

Build for Production

npm run build
npm run preview

Performance Optimization

  • Efficient data caching (React Query)
  • WebSocket for real-time updates
  • Lazy loading, code splitting, dynamic imports
  • Tree shaking, asset optimization
  • Optimistic UI updates

Security Considerations

  • API key management via environment variables
  • Rate limiting, request validation
  • Error handling, logging
  • Secure data storage
  • User authentication/authorization
  • Data encryption in transit
  • Regular security audits

Deployment

Prerequisites

  • Node.js environment
  • Configured environment variables & API keys
  • SSL certificate for HTTPS

Steps

  1. Build production version
  2. Configure environment variables
  3. Set up reverse proxy (if needed)
  4. Deploy static assets
  5. Monitor performance

Supported Platforms

  • Vercel (recommended)
  • Netlify
  • AWS Amplify
  • Docker
  • Static hosting

Contributing

  1. Fork the repo
  2. Create a feature branch
  3. Make changes
  4. Submit a pull request

Guidelines:

  • Follow code style
  • Write meaningful commits
  • Add tests for features
  • Update docs

License

MIT License – see LICENSE for details.


Support

  • Check the documentation
  • Open an issue
  • Contact the development team

Acknowledgments

  • Data providers & API services
  • Open source libraries/tools
  • Contributors & maintainers

About

The platform provides comprehensive insights for making informed investment decisions through various data sources and machine learning models.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages