qfinbox
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
pip install qfinbox
For development dependencies:
pip install qfinbox[dev]
For advanced features:
pip install qfinbox[advanced]
📋 Requirements
- Python 3.8+
- NumPy >= 1.21.0
- Pandas >= 1.3.0
- SciPy >= 1.7.0
🎯 Quick Start
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
🤝 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 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
- Documentation: https://qfinbox.readthedocs.io
- PyPI: https://pypi.org/project/qfinbox/
- Issues: https://github.com/prashant-fintech/qfinbox/issues
Metadata
Release files for qfinbox 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qfinbox-0.1.0.tar.gz | 25.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qfinbox-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.9 kB
Release files / qfinbox-0.1.0.tar.gz
| Download URL | qfinbox-0.1.0.tar.gz |
|---|---|
| Size | 25.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
145383d8cce3620b13e3db415890c69b800e97fc6d4833765cb88ec9731b693a
|
|
BLAKE2b-256 checksum How to use checksums |
e5085d28876d2157e58abc537ab0c986bea164ea5a68d810f81120671988875f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / qfinbox-0.1.0-py3-none-any.whl
| Download URL | qfinbox-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09e7a8b90ca9b28ab8afc13eb5114a26545cc860863b165cf7d8b3b68e44ba91
|
|
BLAKE2b-256 checksum How to use checksums |
4ef25969c1bbc19db5e07d30faf6a08ee9b42a2383f11353a6b455eeeef16050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|