Package to compute and price swap
Project description
IRS Toolkit
Table of Contents
Installation
Requirements
- Python 3.9 or higher (up to Python 3.12)
Quick install
It is published on PyPI. To install, run:
pip install IRS_toolkit
Features
The Financial Toolkit Library provides a comprehensive suite of tools for financial calculations and analysis. Here's a detailed breakdown of the main features:
Interest Rate Swap (IRS) Valuation
- Swap Pricing (
core/swap.py): Calculate present value and fair value of interest rate swaps - Cash Flow Analysis (
core/cash_flow.py): Generate and analyze swap cash flows - Swap Legs (
core/leg/): Handle different types of swap legs and their characteristics
Curve Analysis
- Yield Curve Construction (
core/curve/yield_curve.py): Build and manipulate yield curves from market data with overnight rate integration - Compounded Rates (
core/curve/compounded.py): Handle compounded rate calculations - Bootstrapping: Implement bootstrapping algorithms for zero-coupon rates
- Forward Rates: Calculate forward rates
Additional Features
- Date Handling: Comprehensive date manipulation and business day conventions
- Documentation: Detailed documentation and usage examples
- Testing: Comprehensive unit test suite for all major functionalities
Project Structure
financial-toolkit-library/
├── IRS_toolkit/ # Main package source code
│ ├── core/ # Core functionality
│ │ ├── curve/ # Yield curve implementations
│ │ ├── leg/ # Swap leg implementations
│ │ ├── swap.py # Swap pricing
│ │ └── cash_flow.py # Cash flow analysis
│ ├── utils/ # Utility functions
│ └── options/ # Options pricing
├── docs/ # Documentation files
├── examples/ # Example notebooks and scripts
├── tests/ # Unit test suite
├── pyproject.toml # Project dependencies and metadata
└── mkdocs.yml # Documentation configuration
Example of usage
Build your yield curve
# Import packages
from IRS_toolkit.core.curve import yield_curve
from datetime import datetime
# Input data
list_tenor = ['1D', '2D', '1W', '2W', '3W', '1M', '2M', '3M', '6M', '7M', '8M', '9M', '1Y', '15M', '18M', '21M', '2Y','3Y']
rates = [0.02, 0.021, 0.022, 0.023, 0.025, 0.027, 0.03, 0.032, 0.033, 0.034, 0.035, 0.036, 0.037, 0.038, 0.039, 0.04, 0.041, 0.045]
curve_date = datetime(2025,3,10)
# Set the curve
curve_tool = yield_curve.YieldCurve(
list_tenor=list_tenor,
list_rate=rates,
date_curve=curve_date,
date_convention="ACT/360",
)
#Bootstrap yield curve
curve_tool.bootstrap("quarterly")
# Visualize dataframe
curve_tool.df
Documentation
The documentation is built using MkDocs. To view it, run:
mkdocs serve
Future Work
The next planned improvements that can be added to this library are:
- Improvement of yield curve construction by adding other conventions and multi-curve framework
- Pricing of swaptions
- Expanding documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file irs_toolkit-0.2.1.tar.gz.
File metadata
- Download URL: irs_toolkit-0.2.1.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.13.0 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
316433530f0db3617c2d5d1559785e4f3fe0cb72effcbc969a14c6aee54f0175
|
|
| MD5 |
303b0c0b54404be3fb5356a3c00cf04f
|
|
| BLAKE2b-256 |
f571f3d15c2d52cd6ec4be2bb4f121ce602a99002bcbb9064c9dfe8bc9581f16
|
File details
Details for the file irs_toolkit-0.2.1-py3-none-any.whl.
File metadata
- Download URL: irs_toolkit-0.2.1-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.13.0 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb98e2f81b53ef70eee6ec5fdfb5f082e83ebda6e274be80f15496cce44dfb33
|
|
| MD5 |
d38c003dec4dfaa0c00942841a8a1e95
|
|
| BLAKE2b-256 |
89ccf2bdd77337e6fea3c6ade9080bb1a1d1af696bce0d0d1aacb1301c30ccfc
|