fintoolsom is a Python library designed for financial calculations, specializing in fixed income instruments, interest rate modeling, and derivatives. It provides a robust set of tools for valuation, analysis, and curve construction, with specific features tailored for the Chilean financial market.
-
Bond Valuation (
Bond):- A comprehensive class for valuing fixed income securities.
- Calculate Present Value (PV) from a given Internal Rate of Return (IRR) or a Zero-Coupon Curve.
- Determine the IRR (Yield-to-Maturity) from a given price or settlement amount.
- Compute key risk metrics like
get_duration(Macaulay duration) andget_dv01. - Handle complex coupon structures and amortizations.
- Chilean Market Features: Includes specialized methods for the Chilean market, such as calculating the Tasa de Emisión de Renta Anual (TERA) and determining settlement amounts based on local conventions.
-
Deposits (
Deposit):- Simple valuation for fixed-term deposits.
- Calculates PV, duration, and DV01.
-
Yield Curve Modeling (
NelsonSiegel,NelsonSiegelSvensson):- Implements the Nelson-Siegel and Nelson-Siegel-Svensson parametric models for yield curve fitting.
- Uses
numbafor JIT-compiled calculations for high performance. - Calibration: Calibrates model parameters to fit a set of market bond prices or IRRs using optimization methods from
scipy. - Curve Generation: Generates a smooth, continuous
ZeroCouponCurveobject from the calibrated model, ideal for pricing and risk management. - Structured into a base
NelsonSiegelclass and an inheritingNelsonSiegelSvenssonclass for the four-factor model.
-
Rate Engine (
Rate,RateConvention):- A flexible
Rateobject that encapsulates both a rate value and itsRateConvention. - Supports various interest calculation methods:
LinearInterestConventionCompoundedInterestConventionExponentialInterestConvention(Continuously compounded)
- Handles conversions between different rate conventions.
- A flexible
-
Zero-Coupon Curves (
ZeroCouponCurve):- Constructs yield curves from a set of dates and discount factors or zero-coupon rates.
- Calculates discount factors (
get_df), wealth factors, and forward rates between any two dates. - Provides interpolation methods for points between curve nodes, including:
LogLinearHermiteCubicSpline(PCHIP)
- Supports curve operations like parallel bumping and aging the curve to a future date (
get_aged_curve).
Install directly from the GitHub repository to get the latest version:
pip install git+https://github.com/oliverm91/fintoolsom.git --upgrade- Python: >=3.11
- Packages:
numpy,scipy,numba