Skip to content

ryzncodes/fa-analysis

Repository files navigation

Fundamental Analysis Webapp

A modern web application that provides data-driven fundamental analysis for stocks. The system fetches financial data from multiple sources including Yahoo Finance and Alpha Vantage, standardizes and processes the information with robust error handling and efficient caching, and leverages OpenAI for comprehensive analysis.

Features

  • ๐Ÿ“Š Real-time stock data fetching from Yahoo Finance and Alpha Vantage
  • ๐Ÿ’ฐ Comprehensive financial metrics including:
    • Company profiles and key statistics
    • Real-time market data
    • Historical price data with interactive charts
    • Dividend information
    • News feeds with full article content
  • ๐Ÿ“ˆ Interactive price charts with multiple timeframes (1D, 1W, 1M, 3M, 1Y, 5Y)
  • โš™๏ธ Robust error handling with custom error types and structured logging
  • ๐Ÿ”„ Efficient caching system using both in-memory and file-based strategies
  • ๐Ÿงฎ Data standardization utilities for dates, numbers, and currencies
  • ๐Ÿค– OpenAI-powered analysis integration
  • ๐ŸŽจ Modern, responsive UI with dark mode support

Tech Stack

Frontend

  • Framework: Next.js 14+ with App Router
  • Language: TypeScript
  • UI Components: shadcn/ui (based on Radix UI primitives)
  • Styling: Tailwind CSS
  • Charts: Lightweight Charts
  • Icons: Lucide React

Backend

  • Framework: Next.js API Routes (serverless functions)
  • Language: TypeScript
  • Data Sources:
    • Yahoo Finance API
    • Alpha Vantage API
  • Caching: Hybrid in-memory and file-based caching system
  • Error Handling: Custom error classes with detailed logging

AI Integration

  • Provider: OpenAI
  • Purpose: Enhanced financial analysis and insights
  • Integration: Direct API integration via Next.js API routes

Getting Started

  1. Clone the repository:
git clone [repository-url] cd [repository-name]
  1. Install dependencies:
npm install
  1. Set up environment variables: Create a .env.local file with:
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_keyOPENAI_API_KEY=your_openai_api_key
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 in your browser.

API Endpoints

GET /api/market

Fetches market data with support for:

  • Real-time quotes
  • Historical price data with customizable timeframes
  • Volume data

GET /api/stock/[ticker]

Fetches comprehensive stock data including:

  • Current market data (price, volume, etc.)
  • Company profile & key statistics
  • Dividend information
  • Latest news with full article content
  • Financial metrics (income statements, balance sheets, cash flows)

Project Structure

โ”œโ”€โ”€ app/ โ”‚ โ”œโ”€โ”€ api/ โ”‚ โ”‚ โ”œโ”€โ”€ market/ โ”‚ โ”‚ โ””โ”€โ”€ stock/ โ”‚ โ”œโ”€โ”€ stock/ โ”‚ โ”‚ โ””โ”€โ”€ [ticker]/ โ”‚ โ”œโ”€โ”€ layout.tsx โ”‚ โ”œโ”€โ”€ page.tsx โ”‚ โ””โ”€โ”€ globals.css โ”œโ”€โ”€ components/ โ”‚ โ”œโ”€โ”€ stock/ โ”‚ โ”‚ โ”œโ”€โ”€ PriceChart.tsx โ”‚ โ”‚ โ””โ”€โ”€ [other components] โ”‚ โ””โ”€โ”€ ui/ โ”œโ”€โ”€ lib/ โ”‚ โ”œโ”€โ”€ market-service.ts โ”‚ โ”œโ”€โ”€ stock-service.ts โ”‚ โ”œโ”€โ”€ openai-service.ts โ”‚ โ”œโ”€โ”€ alpha-vantage-service.ts โ”‚ โ”œโ”€โ”€ stock-news-service.ts โ”‚ โ”œโ”€โ”€ cache.ts โ”‚ โ””โ”€โ”€ utils/ โ”œโ”€โ”€ types/ โ”œโ”€โ”€ public/ โ””โ”€โ”€ [configuration files] 

Future Enhancements

  • Enhanced AI-powered analysis features
  • Portfolio tracking and management
  • Advanced technical analysis tools
  • Real-time price alerts and notifications
  • User authentication and personalized watchlists
  • Additional data sources integration
  • Performance optimizations and caching improvements
  • Comprehensive testing suite

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published