Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Financial Scenario Analyzer for oil and Gas Project

A comprehensive Streamlit application for CAPEX/OPEX financial analysis with multi-scenario comparison.

Features

Financial Metrics

  • Net Present Value (NPV): Calculates the present value of future cash flows
  • Internal Rate of Return (IRR): Determines the discount rate at which NPV equals zero
  • Return on Investment (ROI): Measures the profitability of an investment
  • Payback Period: Calculates the time required to recover the initial investment

Depreciation Methods

  • Straight-Line Depreciation
  • Declining Balance Depreciation
  • Sum-of-Years-Digits Depreciation

Scenario Management

  • Create up to 10 scenarios for comparison
  • Duplicate existing scenarios for sensitivity analysis
  • Import/Export scenarios in JSON format

Visualization

  • Interactive comparison charts (NPV, IRR, ROI, Payback)
  • Cash flow line charts
  • Cumulative cash flow analysis
  • Waterfall charts for detailed breakdowns

Export Options

  • Excel reports with formatted tables and charts
  • PDF summary reports for presentations
  • JSON data export for backup and data transfer

Installation

Prerequisites

  • Python 3.9 or higher
  • pip (Python package manager)

Setup

  1. Clone or download this project:
git clone https://github.com/abyansyah052/IPFEST.git
cd IPFEST/financial-scenario-analyzer
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On macOS/Linux
# or
venv\Scripts\activate  # On Windows
  1. Install dependencies:
pip install -r requirements.txt

Usage

Running the Application

Start the Streamlit application:

streamlit run app.py

The application will open in your default web browser at http://localhost:8501.

Application Pages

  1. Home (app.py): Overview and scenario management
  2. Dashboard: Key metrics summary and comparison charts
  3. Input Data: Configure scenarios with CAPEX and OPEX items
  4. Results: Calculate and view financial metrics
  5. Compare Scenarios: Side-by-side scenario comparison
  6. Export: Download reports in Excel, PDF, or JSON format

Workflow

  1. Create a Scenario: Click "New Scenario" in the sidebar
  2. Configure Parameters: Set discount rate, tax rate, and analysis period
  3. Add CAPEX Items: Enter capital expenditure items with depreciation settings
  4. Add OPEX Items: Enter operating expenses with escalation rates
  5. Set Revenue: Configure annual revenue and growth rate
  6. Calculate: Go to Results page and click "Calculate Financial Metrics"
  7. Compare: Use Compare Scenarios page to evaluate multiple options
  8. Export: Download reports for presentation or further analysis

Project Structure

financial-scenario-analyzer/
├── app.py                 # Main application entry point
├── requirements.txt       # Python dependencies
├── README.md             # This file
├── config/
│   ├── __init__.py
│   └── settings.py       # Application configuration
├── models/
│   ├── __init__.py
│   ├── capex_item.py     # CAPEX item data model
│   ├── opex_item.py      # OPEX item data model
│   ├── scenario.py       # Scenario data model
│   └── financial_calculator.py  # Financial calculations
├── pages/
│   ├── 1_Dashboard.py    # Dashboard page
│   ├── 2_Input_Data.py   # Data input page
│   ├── 3_Results.py      # Results page
│   ├── 4_Compare_Scenarios.py  # Comparison page
│   └── 5_Export.py       # Export page
├── utils/
│   ├── __init__.py
│   ├── session_manager.py    # Session state management
│   ├── best_scenario.py      # Best scenario identification
│   ├── visualizations.py     # Plotly chart functions
│   ├── export_excel.py       # Excel export functions
│   └── export_pdf.py         # PDF export functions
└── tests/
    └── test_calculations.py  # Unit tests

Running Tests

Execute the test suite:

cd financial-scenario-analyzer
pytest tests/test_calculations.py -v

Configuration

Default settings can be modified in config/settings.py:

  • MAX_SCENARIOS: Maximum number of scenarios (default: 10)
  • DEFAULT_DISCOUNT_RATE: Default discount rate (default: 12.0%)
  • DEFAULT_TAX_RATE: Default tax rate (default: 22.0%)
  • DEFAULT_ANALYSIS_PERIOD: Default analysis period (default: 10 years)
  • DEPRECIATION_METHODS: Available depreciation methods
  • OPEX_CATEGORIES: Available OPEX categories

Technical Notes

Libraries Used

  • Streamlit: Web application framework
  • pandas: Data manipulation and analysis
  • numpy: Numerical computations
  • numpy-financial: Financial calculations (NPV, IRR)
  • plotly: Interactive visualizations
  • openpyxl: Excel file generation
  • fpdf2: PDF file generation

Financial Calculations

The application uses numpy-financial for accurate NPV and IRR calculations:

  • NPV: npf.npv(rate, cashflows)
  • IRR: npf.irr(cashflows)
  • ROI: (Total Return - Total Investment) / Total Investment * 100
  • Payback: Linear interpolation on cumulative cash flows

License

This project is provided for educational and demonstration purposes.

Author

Financial Analysis Team - IPFEST Project

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages