Skip to content

ShadyBad/intrinsic-value-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intrinsic Value Calculator

Project Status License

📝 Table of Contents

About

The Intrinsic Value Calculator is a sophisticated Python-based financial analysis tool that calculates the intrinsic value of stocks using the Discounted Cash Flow (DCF) model. By leveraging real-time financial data from Yahoo Finance and risk-free rates from the FRED API, this tool provides investors and analysts with automated, data-driven insights for stock valuation.

Technical Stack

  • Python 3.8+ - Core programming language
  • pandas - Data manipulation and analysis
  • yfinance - Real-time stock data retrieval
  • fredapi - Federal Reserve Economic Data integration
  • numpy - Numerical computations
  • python-dotenv - Environment variable management
  • concurrent.futures - Parallel processing implementation

Project Architecture

Intrinsic Value Calculator
│
├── Data Collection
│   ├── Yahoo Finance API (Stock Data)
│   └── FRED API (Risk-free Rates)
│
├── Processing
│   ├── DCF Calculation
│   ├── Data Validation
│   └── Parallel Processing
│
└── Output
    ├── CSV Export
    └── JSON Export

Prerequisites

Before you begin, ensure you have:

  • Python 3.8 or higher installed
  • A FRED API key (Get it here)
  • Basic understanding of DCF valuation concepts
  • Git installed (for cloning the repository)

⚙️ Features

  • Real-time Data Integration
    • Yahoo Finance API for current stock data
    • FRED API for up-to-date risk-free rates
  • Advanced Valuation Methods
    • Discounted Cash Flow (DCF) modeling
    • Automated growth rate calculations
    • Risk adjustment factors
  • Efficient Processing
    • Parallel processing for batch analysis
    • Robust error handling
    • Data validation checks
  • Flexible Output Options
    • Structured CSV export
    • JSON format for API integration
    • Detailed analysis reports

Installation

  1. Clone the Repository

    git clone https://github.com/your-username/Intrinsic-Value-Calculator.git
    cd Intrinsic-Value-Calculator
  2. Set Up Virtual Environment

    python -m venv venv
    
    # macOS/Linux
    source venv/bin/activate
    
    # Windows
    venv\Scripts\activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Configure Environment Variables

    # Create .env file
    touch .env
    
    # Add your FRED API key
    echo "FRED_API_KEY=your_fred_api_key_here" >> .env

🎯 Usage

Single Stock Analysis

python intrinsic_value_calculator.py
# Enter ticker when prompted: AAPL

Batch Analysis

python intrinsic_value_calculator.py
# Enter tickers separated by spaces: AAPL MSFT GOOGL

Output Format

CSV Format (valuations.csv)

Field Description
Ticker Stock symbol
Company Name Full company name
FCF Free Cash Flow
Market Price Current stock price
Intrinsic Value Calculated DCF value
Timestamp Analysis timestamp

JSON Structure (valuations.json)

{
  "AAPL": {
    "company_name": "Apple Inc.",
    "fcf": 100000000000,
    "market_price": 150.00,
    "intrinsic_value": 165.50,
    "timestamp": "2024-03-21T10:00:00Z"
  }
}

DCF Model Methodology

The calculator implements a sophisticated DCF model that:

  1. Projects future cash flows using historical growth rates
  2. Applies a calculated discount rate based on:
    • Risk-free rate from FRED
    • Market risk premium
    • Company-specific risk factors
  3. Incorporates terminal value calculation
  4. Adjusts for current debt and cash positions

Future Enhancements

  • 🔹 Advanced Features
    • CLI argument support
    • Automated data updates via GitHub Actions
    • Machine learning-based growth predictions
  • 🔹 UI/UX Improvements
    • Interactive web interface
    • Real-time visualization
    • PDF report generation
  • 🔹 Additional Analysis
    • Sensitivity analysis
    • Peer comparison
    • Multiple valuation methods

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

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

Contact

Brandon Shay - bpshay13@gmail.com

Project Link: https://github.com/your-username/Intrinsic-Value-Calculator


Last Updated: March 2025

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages