Metadata-Version: 2.4
Name: qfinbox
Version: 0.1.0
Summary: A Python library for quantitative finance, offering tools for risk management, portfolio optimization, and financial modeling
Author-email: prashant-fintech <box_prashant@outlook.com>
License: MIT License
        
        Copyright (c) 2025 prashant-fintech
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/prashant-fintech/qfinbox
Project-URL: Documentation, https://qfinbox.readthedocs.io
Project-URL: Repository, https://github.com/prashant-fintech/qfinbox
Project-URL: Bug Tracker, https://github.com/prashant-fintech/qfinbox/issues
Keywords: quantitative finance,risk management,portfolio optimization,financial modeling,investment analysis,market simulation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: seaborn>=0.11.0
Requires-Dist: yfinance>=0.1.70
Requires-Dist: requests>=2.25.0
Requires-Dist: python-dateutil>=2.8.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0.0; extra == "dev"
Requires-Dist: pytest-cov>=2.12.0; extra == "dev"
Requires-Dist: black>=21.0.0; extra == "dev"
Requires-Dist: flake8>=3.9.0; extra == "dev"
Requires-Dist: mypy>=0.910; extra == "dev"
Requires-Dist: isort>=5.9.0; extra == "dev"
Requires-Dist: pre-commit>=2.13.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=4.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=0.5.0; extra == "docs"
Requires-Dist: nbsphinx>=0.8.0; extra == "docs"
Requires-Dist: jupyter>=1.0.0; extra == "docs"
Requires-Dist: sphinx-copybutton>=0.5.0; extra == "docs"
Requires-Dist: myst-parser>=0.18.0; extra == "docs"
Requires-Dist: sphinx-design>=0.3.0; extra == "docs"
Requires-Dist: pygments>=2.12.0; extra == "docs"
Requires-Dist: ipykernel>=6.15.0; extra == "docs"
Provides-Extra: advanced
Requires-Dist: scikit-learn>=1.0.0; extra == "advanced"
Requires-Dist: statsmodels>=0.12.0; extra == "advanced"
Requires-Dist: arch>=5.0.0; extra == "advanced"
Requires-Dist: cvxpy>=1.1.0; extra == "advanced"
Requires-Dist: plotly>=5.0.0; extra == "advanced"
Dynamic: license-file

# qfinbox

[![PyPI version](https://badge.fury.io/py/qfinbox.svg)](https://badge.fury.io/py/qfinbox)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation Status](https://readthedocs.org/projects/qfinbox/badge/?version=latest)](https://qfinbox.readthedocs.io/en/latest/?badge=latest)

**qfinbox** is a comprehensive Python library for quantitative finance, offering professional-grade tools for risk management, portfolio optimization, and financial modeling. It enables easy simulation of market scenarios and investment strategy optimization, enhancing financial analysis and decision-making.

## ✨ Features

### 🧮 Time Value of Money (TVM)
- **Basic TVM**: Future/present value calculations with various compounding methods
- **Annuities**: Ordinary and due annuities (PV/FV calculations)
- **Bond Valuation**: Pricing, yield-to-maturity, duration, and convexity
- **Loan Analysis**: Payment calculations, amortization schedules, and balance tracking
- **Cash Flow Analysis**: NPV, IRR, payback periods, and profitability index

### 🛡️ Core Utilities
- **Input Validation**: Robust parameter validation for financial calculations  
- **Exception Handling**: Custom exception hierarchy for clear error reporting
- **Data Conversion**: Seamless integration with NumPy arrays and Pandas DataFrames
- **Type Safety**: Full type hints throughout the codebase

## 🚀 Installation

```bash
pip install qfinbox
```

For development dependencies:
```bash
pip install qfinbox[dev]
```

For advanced features:
```bash
pip install qfinbox[advanced]
```

## 📋 Requirements

- Python 3.8+
- NumPy >= 1.21.0
- Pandas >= 1.3.0  
- SciPy >= 1.7.0

## 🎯 Quick Start

```python
import qfinbox as qf

# Basic TVM calculations
fv = qf.tvm.future_value(1000, 0.05, 10)  # $1,628.89
pv = qf.tvm.present_value(fv, 0.05, 10)   # $1,000.00

# Annuity calculations
annuity_pv = qf.tvm.ordinary_annuity_pv(1000, 0.05, 10)  # $7,721.73
annuity_fv = qf.tvm.ordinary_annuity_fv(1000, 0.05, 10)  # $12,577.89

# Bond valuation
bond_price = qf.tvm.bond_price(1000, 0.06, 10, 0.08)  # $864.10
duration = qf.tvm.bond_duration(1000, 0.06, 10, 0.08)  # 7.45 years

# Loan calculations
monthly_payment = qf.tvm.loan_payment(300000, 0.05, 30, 12)  # $1,610.46
schedule = qf.tvm.amortization_schedule(100000, 0.06, 15, 12)

# Cash flow analysis
cash_flows = [-100000, 30000, 40000, 50000]
npv = qf.tvm.net_present_value(cash_flows, 0.10)  # $-2,103.68
payback = qf.tvm.payback_period(cash_flows)        # 3.6 years

# Input validation and error handling
try:
    weights = qf.validate_weights([0.4, 0.3, 0.3])  # ✓ Valid
    invalid = qf.validate_weights([0.5, 0.3, 0.3])  # ✗ Raises ValidationError
except qf.ValidationError as e:
    print(f"Error: {e}")
```

## 📖 Documentation

Full documentation is available at [https://qfinbox.readthedocs.io](https://qfinbox.readthedocs.io)

## 🤝 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.

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🏦 Use Cases

- **Investment Analysis**: Calculate returns, risk metrics, and portfolio optimization
- **Loan Analysis**: Mortgage calculations, amortization schedules, and payment planning
- **Bond Valuation**: Price bonds, calculate yields, duration, and convexity
- **Project Finance**: NPV analysis, IRR calculations, and investment decision-making
- **Risk Management**: Portfolio risk assessment and scenario analysis
- **Financial Planning**: Retirement planning, education funding, and goal-based investing

## 🔗 Links

- **Homepage**: [https://github.com/prashant-fintech/qfinbox](https://github.com/prashant-fintech/qfinbox)
- **Documentation**: [https://qfinbox.readthedocs.io](https://qfinbox.readthedocs.io)
- **PyPI**: [https://pypi.org/project/qfinbox/](https://pypi.org/project/qfinbox/)
- **Issues**: [https://github.com/prashant-fintech/qfinbox/issues](https://github.com/prashant-fintech/qfinbox/issues)
