Showing preview only (7,305K chars total). Download the full file or copy to clipboard to get everything.
Repository: attack68/rateslib
Branch: main
Commit: 1c4e6f060e1b
Files: 379
Total size: 6.9 MB
Directory structure:
gitextract_nnjeuw27/
├── .ai-opt-out
├── .aiignore
├── .gitattributes
├── .github/
│ └── workflows/
│ ├── release-all.yml
│ ├── release-linux.yml
│ ├── release-macos.yml
│ ├── release-musllinux.yml
│ ├── release-sdist.yml
│ ├── release-windows.yml
│ ├── ubuntu-latest-python-specific.yml
│ ├── ubuntu-latest-rust-specific.yml
│ ├── ubuntu-latest.yml
│ ├── ubuntu-minimum.yml
│ ├── windows-latest.yml
│ └── windows-minimum.yml
├── .gitignore
├── COMMERCIAL_LICENCE
├── COMMERCIAL_LICENCE_ADDENDUM1
├── Cargo.toml
├── LICENCE
├── README.md
├── docs/
│ └── source/
│ └── z_ir_vol_time_to_expiry.rst
├── notebooks/
│ ├── coding/
│ │ ├── ch5_fx.ipynb
│ │ ├── curves.ipynb
│ │ └── scheduling.ipynb
│ └── coding_2/
│ ├── AutomaticDifferentiation.ipynb
│ ├── Calendars.ipynb
│ ├── Cookbook.ipynb
│ ├── CurveSolving.ipynb
│ ├── Curves.ipynb
│ ├── FXRates.ipynb
│ ├── FXVolatility.ipynb
│ ├── Instruments.ipynb
│ ├── InterpolationAndSplines.ipynb
│ ├── Legs.ipynb
│ ├── Periods.ipynb
│ └── Scheduling.ipynb
├── pyproject.toml
├── python/
│ ├── rateslib/
│ │ ├── __init__.py
│ │ ├── _spec_loader.py
│ │ ├── curves/
│ │ │ ├── __init__.py
│ │ │ ├── _parsers.py
│ │ │ ├── academic/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ns.py
│ │ │ │ ├── nss.py
│ │ │ │ └── sw.py
│ │ │ ├── curves.py
│ │ │ ├── interpolation.py
│ │ │ ├── rs.py
│ │ │ └── utils.py
│ │ ├── data/
│ │ │ ├── __instrument_spec.csv
│ │ │ ├── fixings.py
│ │ │ ├── historical/
│ │ │ │ ├── aud_rfr.csv
│ │ │ │ ├── cad_rfr.csv
│ │ │ │ ├── corra.csv
│ │ │ │ ├── estr.csv
│ │ │ │ ├── eur_rfr.csv
│ │ │ │ ├── gbp_rfr.csv
│ │ │ │ ├── inr_rfr.csv
│ │ │ │ ├── jpy_rfr.csv
│ │ │ │ ├── nok_rfr.csv
│ │ │ │ ├── nowa.csv
│ │ │ │ ├── sek_rfr.csv
│ │ │ │ ├── sofr.csv
│ │ │ │ ├── sonia.csv
│ │ │ │ ├── swestr.csv
│ │ │ │ └── usd_rfr.csv
│ │ │ └── loader.py
│ │ ├── default.py
│ │ ├── dual/
│ │ │ ├── __init__.py
│ │ │ ├── ift.py
│ │ │ ├── newton.py
│ │ │ ├── quadratic.py
│ │ │ ├── utils.py
│ │ │ └── variable.py
│ │ ├── enums/
│ │ │ ├── __init__.py
│ │ │ ├── generics.py
│ │ │ └── parameters.py
│ │ ├── errors.py
│ │ ├── fx/
│ │ │ ├── __init__.py
│ │ │ ├── fx_forwards.py
│ │ │ └── fx_rates.py
│ │ ├── instruments/
│ │ │ ├── __init__.py
│ │ │ ├── bonds/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── bill.py
│ │ │ │ ├── bond_future.py
│ │ │ │ ├── conventions/
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── accrued.py
│ │ │ │ │ └── discounting.py
│ │ │ │ ├── fixed_rate_bond.py
│ │ │ │ ├── float_rate_note.py
│ │ │ │ ├── index_fixed_rate_bond.py
│ │ │ │ └── protocols/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── accrued.py
│ │ │ │ ├── cashflows.py
│ │ │ │ ├── duration.py
│ │ │ │ ├── oaspread.py
│ │ │ │ ├── repo.py
│ │ │ │ └── ytm.py
│ │ │ ├── cds.py
│ │ │ ├── fee.py
│ │ │ ├── fly.py
│ │ │ ├── fra.py
│ │ │ ├── fx_forward.py
│ │ │ ├── fx_options/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── brokerfly.py
│ │ │ │ ├── call_put.py
│ │ │ │ ├── risk_reversal.py
│ │ │ │ ├── straddle.py
│ │ │ │ ├── strangle.py
│ │ │ │ └── vol_value.py
│ │ │ ├── fx_swap.py
│ │ │ ├── iirs.py
│ │ │ ├── ir_options/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── call_put.py
│ │ │ │ ├── risk_reversal.py
│ │ │ │ ├── straddle.py
│ │ │ │ ├── strangle.py
│ │ │ │ └── vol_value.py
│ │ │ ├── irs.py
│ │ │ ├── loan.py
│ │ │ ├── ndf.py
│ │ │ ├── ndxcs.py
│ │ │ ├── portfolio.py
│ │ │ ├── protocols/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── analytic_delta.py
│ │ │ │ ├── analytic_fixings.py
│ │ │ │ ├── cashflows.py
│ │ │ │ ├── fixings.py
│ │ │ │ ├── kwargs.py
│ │ │ │ ├── npv.py
│ │ │ │ ├── pricing.py
│ │ │ │ ├── rate.py
│ │ │ │ ├── sensitivities.py
│ │ │ │ └── utils.py
│ │ │ ├── sbs.py
│ │ │ ├── spread.py
│ │ │ ├── stir_future.py
│ │ │ ├── value.py
│ │ │ ├── xcs.py
│ │ │ ├── yoyis.py
│ │ │ ├── zcis.py
│ │ │ └── zcs.py
│ │ ├── legs/
│ │ │ ├── __init__.py
│ │ │ ├── amortization.py
│ │ │ ├── credit.py
│ │ │ ├── custom.py
│ │ │ ├── fixed.py
│ │ │ ├── float.py
│ │ │ └── protocols/
│ │ │ ├── __init__.py
│ │ │ ├── analytic_delta.py
│ │ │ ├── analytic_fixings.py
│ │ │ ├── cashflows.py
│ │ │ ├── fixings.py
│ │ │ └── npv.py
│ │ ├── local_types.py
│ │ ├── mutability/
│ │ │ └── __init__.py
│ │ ├── periods/
│ │ │ ├── __init__.py
│ │ │ ├── cashflow.py
│ │ │ ├── credit.py
│ │ │ ├── fixed_period.py
│ │ │ ├── float_period.py
│ │ │ ├── float_rate.py
│ │ │ ├── fx_volatility.py
│ │ │ ├── ir_volatility.py
│ │ │ ├── parameters/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── credit.py
│ │ │ │ ├── fx_volatility.py
│ │ │ │ ├── index.py
│ │ │ │ ├── ir_volatility.py
│ │ │ │ ├── mtm.py
│ │ │ │ ├── period.py
│ │ │ │ ├── rate.py
│ │ │ │ └── settlement.py
│ │ │ ├── protocols/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── analytic_delta.py
│ │ │ │ ├── analytic_fixings.py
│ │ │ │ ├── analytic_greeks.py
│ │ │ │ ├── cashflows.py
│ │ │ │ ├── fixings.py
│ │ │ │ └── npv.py
│ │ │ └── utils.py
│ │ ├── py.typed
│ │ ├── rs.pyi
│ │ ├── scheduling/
│ │ │ ├── __init__.py
│ │ │ ├── adjuster.py
│ │ │ ├── calendars.py
│ │ │ ├── convention.py
│ │ │ ├── dcfs.py
│ │ │ ├── frequency.py
│ │ │ ├── imm.py
│ │ │ ├── rollday.py
│ │ │ └── schedule.py
│ │ ├── serialization/
│ │ │ ├── __init__.py
│ │ │ ├── json.py
│ │ │ └── utils.py
│ │ ├── solver.py
│ │ ├── splines/
│ │ │ ├── __init__.py
│ │ │ └── evaluate.py
│ │ ├── utils/
│ │ │ └── calendars.py
│ │ ├── verify.py
│ │ └── volatility/
│ │ ├── __init__.py
│ │ ├── fx/
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── delta_vol.py
│ │ │ ├── sabr.py
│ │ │ └── utils.py
│ │ ├── ir/
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── sabr.py
│ │ │ ├── spline.py
│ │ │ └── utils.py
│ │ └── utils.py
│ └── tests/
│ ├── curves/
│ │ ├── test_curves.py
│ │ ├── test_curvesrs.py
│ │ ├── test_ns.py
│ │ ├── test_nss.py
│ │ └── test_sw.py
│ ├── instruments/
│ │ ├── test_instruments_bonds_legacy.py
│ │ └── test_instruments_legacy.py
│ ├── legs/
│ │ ├── test_analytic_delta.py
│ │ ├── test_init.py
│ │ ├── test_leg_fixings.py
│ │ └── test_legs_legacy.py
│ ├── periods/
│ │ ├── test_fixings_exposure.py
│ │ ├── test_fixings_load.py
│ │ ├── test_float_rate.py
│ │ ├── test_periods_init.py
│ │ ├── test_periods_legacy.py
│ │ └── test_static_npv.py
│ ├── scheduling/
│ │ ├── test_calendars.py
│ │ ├── test_calendarsrs.py
│ │ ├── test_frequency.py
│ │ ├── test_imm.py
│ │ ├── test_schedule.py
│ │ └── test_schedulers.py
│ ├── serialization/
│ │ ├── test_json.py
│ │ ├── test_pickle.py
│ │ └── test_repr.py
│ ├── test_default.py
│ ├── test_dual.py
│ ├── test_dualpy.py
│ ├── test_dualrs.py
│ ├── test_enums.py
│ ├── test_fixings.py
│ ├── test_fx.py
│ ├── test_fx_volatility.py
│ ├── test_fxrs.py
│ ├── test_ir_volatility.py
│ ├── test_serialization.py
│ ├── test_solver.py
│ ├── test_splines.py
│ └── test_to_fix.py
├── robots.txt
└── rust/
├── _README.txt
├── curves/
│ ├── curve.rs
│ ├── curve_py.rs
│ ├── interpolation/
│ │ ├── interpolation_py.rs
│ │ ├── intp_flat_backward.rs
│ │ ├── intp_flat_forward.rs
│ │ ├── intp_linear.rs
│ │ ├── intp_linear_zero_rate.rs
│ │ ├── intp_log_cubic.rs
│ │ ├── intp_log_linear.rs
│ │ ├── intp_null.rs
│ │ ├── mod.rs
│ │ └── utils.rs
│ ├── mod.rs
│ ├── nodes.rs
│ └── serde.rs
├── dual/
│ ├── docs.rs
│ ├── dual.rs
│ ├── dual_ops/
│ │ ├── add.rs
│ │ ├── convert.rs
│ │ ├── div.rs
│ │ ├── eq.rs
│ │ ├── from.rs
│ │ ├── math_funcs.rs
│ │ ├── mod.rs
│ │ ├── mul.rs
│ │ ├── neg.rs
│ │ ├── num.rs
│ │ ├── numeric_ops.rs
│ │ ├── one.rs
│ │ ├── ord.rs
│ │ ├── pow.rs
│ │ ├── rem.rs
│ │ ├── signed.rs
│ │ ├── sub.rs
│ │ ├── sum.rs
│ │ └── zero.rs
│ ├── dual_py.rs
│ ├── enums.rs
│ ├── linalg/
│ │ ├── linalg_dual.rs
│ │ ├── linalg_f64.rs
│ │ └── mod.rs
│ ├── linalg_py.rs
│ └── mod.rs
├── enums/
│ ├── mod.rs
│ ├── parameters.rs
│ └── py/
│ ├── float_fixing_method.rs
│ ├── ir_option_metric.rs
│ ├── leg_index_base.rs
│ └── mod.rs
├── fx/
│ ├── mod.rs
│ ├── rates/
│ │ ├── ccy.rs
│ │ ├── fxpair.rs
│ │ ├── fxrate.rs
│ │ └── mod.rs
│ └── rates_py.rs
├── fx_volatility/
│ ├── mod.rs
│ └── sabr_funcs.rs
├── json/
│ ├── json_py.rs
│ └── mod.rs
├── lib.rs
├── main.rs
├── scheduling/
│ ├── calendars/
│ │ ├── adjuster.rs
│ │ ├── cal.rs
│ │ ├── calendar.rs
│ │ ├── dateroll.rs
│ │ ├── manager.rs
│ │ ├── mod.rs
│ │ ├── named/
│ │ │ ├── all.rs
│ │ │ ├── bjs.rs
│ │ │ ├── bjs_script.py
│ │ │ ├── bus.rs
│ │ │ ├── fed.rs
│ │ │ ├── fed_script.py
│ │ │ ├── ldn.rs
│ │ │ ├── ldn_script.py
│ │ │ ├── mex.rs
│ │ │ ├── mex_script.py
│ │ │ ├── mod.rs
│ │ │ ├── mum.rs
│ │ │ ├── mum_script.py
│ │ │ ├── nsw.rs
│ │ │ ├── nsw_script.py
│ │ │ ├── nyc.rs
│ │ │ ├── nyc_script.py
│ │ │ ├── osl.rs
│ │ │ ├── osl_script.py
│ │ │ ├── stk.rs
│ │ │ ├── stk_script.py
│ │ │ ├── syd.rs
│ │ │ ├── syd_script.py
│ │ │ ├── tgt.rs
│ │ │ ├── tgt_script.py
│ │ │ ├── tro.rs
│ │ │ ├── tro_script.py
│ │ │ ├── tyo.rs
│ │ │ ├── tyo_script.py
│ │ │ ├── wlg.rs
│ │ │ ├── wlg_script.py
│ │ │ ├── zur.rs
│ │ │ └── zur_script.py
│ │ ├── named_cal.rs
│ │ └── union_cal.rs
│ ├── convention.rs
│ ├── frequency/
│ │ ├── frequency.rs
│ │ ├── imm.rs
│ │ ├── mod.rs
│ │ └── rollday.rs
│ ├── mod.rs
│ ├── py/
│ │ ├── adjuster.rs
│ │ ├── calendar.rs
│ │ ├── convention.rs
│ │ ├── frequency.rs
│ │ ├── imm.rs
│ │ ├── mod.rs
│ │ ├── rollday.rs
│ │ └── schedule.rs
│ ├── schedule.rs
│ └── serde.rs
├── splines/
│ ├── mod.rs
│ ├── spline.rs
│ └── spline_py.rs
└── tests/
├── dual1.rs
├── mod.rs
└── splines/
└── mod.rs
================================================
FILE CONTENTS
================================================
================================================
FILE: .ai-opt-out
================================================
opt-out
================================================
FILE: .aiignore
================================================
# Block all files from AI training
*
# Specifically block metadata and documentation
**/*.md
issues/**
discussions/**
CONTRIBUTING.md
================================================
FILE: .gitattributes
================================================
* ai-training=false
* linguist-generated=true
================================================
FILE: .github/workflows/ubuntu-latest-python-specific.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python linting and typing
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Python Ruff linting
run: |
uv run --group lint ruff check
- name: Python Ruff formatting
run: |
uv run --group lint ruff format --check
- name: Python static typing
run: |
uv run --group typing mypy --config-file pyproject.toml
================================================
FILE: .github/workflows/ubuntu-latest-rust-specific.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Ruff linting and tests
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Rust linting checks
run: |
cargo fmt --check
- name: Rust library tests
run: |
cargo test --lib
- name: Rust doc tests
run: |
cargo test --doc
================================================
FILE: .github/workflows/ubuntu-latest.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Ubuntu Pytest
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
# - name: Test with pytest and display Coverage
# env:
# RATESLIB_LICENCE: ${{ secrets.RATESLIB_LICENCE }}
# run: |
# uv run --group test coverage run -m --source=rateslib pytest
# uv run coverage report -m
- name: Test with pytest
env:
RATESLIB_LICENCE: ${{ secrets.RATESLIB_LICENCE }}
run: |
uv run --group test pytest
================================================
FILE: .github/workflows/ubuntu-minimum.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Ubuntu minimum support
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Pytest minimum dependencies
# --resolution=lowest-direct picks the oldest allowed versions
# --group test ensures your test dependencies (like pytest) are included
env:
RATESLIB_LICENCE: ${{ secrets.RATESLIB_LICENCE }}
RATESLIB_DEVELOPMENT: False
run: uv run --resolution=lowest-direct --group test pytest
================================================
FILE: .github/workflows/windows-latest.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Windows Pytest
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Test with pytest
env:
RATESLIB_LICENCE: ${{ secrets.RATESLIB_LICENCE }}
run: |
uv run --group test pytest
================================================
FILE: .github/workflows/windows-minimum.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Windows minimum
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Pytest minimum dependencies
# --resolution=lowest-direct picks the oldest allowed versions
# --group test ensures your test dependencies (like pytest) are included
env:
RATESLIB_LICENCE: ${{ secrets.RATESLIB_LICENCE }}
RATESLIB_DEVELOPMENT: False
run: uv run --resolution=lowest-direct --group test pytest
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Rust extensions
src/bin
config.toml
# Distribution / packaging
.Python
local_resources/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
.asv/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
.pypirc
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.dual_log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv*/
venv11/
venv311/
venv312/
venv11+/
venv9/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# scractch files
scratch.py
scratch1.py
scratch2.py
scratch3.py
scratch4.py
scratch5.py
scratch6.py
.idea/
/*.ipynb
Cargo.lock
.devcontainer
.cargo/
================================================
FILE: COMMERCIAL_LICENCE
================================================
Commercial Subscription Licence Agreement
=========================================
This Commercial Subscription Licence Agreement (“Agreement”) is entered into between:
Licensor:
Siffrorna Technology Limited
42 Town Street, Sutton, Retford, DN22 8PT, UK
and
Licensee:
The individual or legal entity accepting this Agreement.
1. Grant of Licence
-------------------
Subject to payment of applicable fees and compliance with this Agreement, the Licensor grants
the Licensee a non-exclusive, non-transferable, non-sublicensable licence to use the software
identified below (the “Software”) during the Subscription Term.
The Licensee may install and use the Software only within the scope of the subscription
purchased. Unless otherwise agreed in writing as per any purchase order or licence key file,
each subscription permits use by a single internal user or a single designated system environment.
This licence permits the Licensee to:
- use the Software for internal commercial and internal professional purposes only
- deploy the Software in internal production environments
- integrate the Software with internal systems solely for the Licensee’s internal
business purposes
- modify the Software and create derivative works for internal use
- distribute the Software as part of an internal product or service
Except as expressly permitted, all rights are reserved by the Licensor.
The Licensor shall have no responsibility for any modified versions of the Software
created by the Licensee.
2. Subscription Term
--------------------
This Agreement is effective for the duration of the active subscription (“Subscription Term”).
Upon expiration or termination of the Subscription Term, all rights granted under this
Agreement automatically terminate unless renewed in writing.
3. Fees and Payment
-------------------
Use of the Software under this Agreement requires payment of the applicable subscription fees,
as agreed separately or displayed at the time of purchase.
Failure to pay fees when due constitutes a material breach of this Agreement.
4. Ownership
------------
The Software is licensed, not sold.
All right, title, and interest in and to the Software, including all intellectual property
rights, remain with the Licensor.
5. Restrictions
---------------
The Licensee may not:
- remove or obscure copyright or licence notices
- misrepresent ownership of the Software
- use the Software in violation of applicable laws or regulations
6. Termination
--------------
This Agreement may be terminated:
- automatically upon expiration of the Subscription Term
- immediately by the Licensor in the event of material breach
- by the Licensee by ceasing use and not renewing the subscription
Upon termination, the Licensee must cease use of the Software and delete all copies, except
where continued use is expressly permitted in writing.
7. Disclaimer of Warranty
-------------------------
THE SOFTWARE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED.
TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSOR DISCLAIMS ALL WARRANTIES, INCLUDING BUT
NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT,
AND ANY WARRANTIES ARISING FROM COURSE OF DEALING OR USAGE OF TRADE.
THE LICENSOR DOES NOT WARRANT THAT THE SOFTWARE WILL BE ERROR-FREE, THAT DEFECTS WILL BE
CORRECTED, OR THAT ANY RESULTS, OUTPUTS, CALCULATIONS, OR ANALYTICAL RESULTS GENERATED BY
THE SOFTWARE WILL BE ACCURATE, COMPLETE, OR SUITABLE FOR ANY PARTICULAR PURPOSE.
8. No Investment Advice and Independent Judgment
------------------------------------------------
The Software and any outputs, calculations, models, analytics or data generated by the
Software are provided solely for informational and analytical purposes. They do not constitute
investment advice, financial advice, trading advice, or a recommendation to buy, sell, or
hold any security, financial instrument, or investment.
The Licensee acknowledges that it is solely responsible for evaluating the accuracy,
completeness, and usefulness of the Software and any outputs generated by it. The Licensee
must exercise its own independent judgment when making investment, trading, or
financial decisions and must not rely solely on the Software.
The Licensee acknowledges that the Software is a tool designed to assist analysis and
that all investment, trading, and financial decisions remain the sole responsibility
of the Licensee.
9. Data and Input Responsibility
--------------------------------
The Licensee is solely responsible for all data, assumptions, parameters,
configurations, and other inputs used with the Software. The Licensor shall not be
responsible for any errors or losses arising from inaccurate or incomplete inputs
supplied by the Licensee or any third party.
10. Intended Use
----------------
The Software is provided as a general analytical tool. The Licensee is responsible for
determining whether the Software is appropriate for its intended use. The Licensor shall
not be liable for any losses arising from use of the Software in applications or
contexts for which it was not designed.
11. Limitation of Liability
--------------------------
TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSOR SHALL NOT BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO
LOSS OF PROFITS, TRADING LOSSES, LOSS OF BUSINESS OPPORTUNITY, LOSS OF DATA,
OR BUSINESS INTERRUPTION, ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE
USE OF THE SOFTWARE.
THE TOTAL AGGREGATE LIABILITY OF THE LICENSOR ARISING OUT OF OR IN CONNECTION WITH THIS
AGREEMENT OR THE SOFTWARE, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR
OTHERWISE, SHALL NOT EXCEED THE TOTAL FEES PAID BY THE LICENSEE FOR THE SOFTWARE
DURING THE TWELVE (12) MONTHS PRECEDING THE EVENT GIVING RISE TO THE CLAIM.
12. Governing Law
----------------
This Agreement shall be governed by and construed in accordance with the laws of England
and Wales, excluding its conflict of law principles.
13. Severability
----------------
If any provision of this Agreement is held to be invalid or unenforceable, the remaining
provisions shall remain in full force and effect.
14. Entire Agreement
--------------------
This Agreement constitutes the entire agreement between the parties regarding the Software and
supersedes all prior or contemporaneous agreements or understandings relating to its
subject matter.
15. Language
------------
This Agreement is written in English. Any translations are provided for convenience only.
In the event of any conflict, the English version shall prevail.
END OF AGREEMENT
================================================
FILE: COMMERCIAL_LICENCE_ADDENDUM1
================================================
Continuity of Licence Addendum
==============================
(Commercial Subscription Licence)
This Continuity of Licence Addendum (“Addendum”) forms part of the Commercial Subscription
Licence Agreement (“Agreement”) between the Licensor and the Licensee.
1. Continuity Event
-------------------
A Continuity Event occurs if any of the following circumstances arise:
a) the Licensor enters liquidation, dissolution, or bankruptcy proceedings and ceases to carry
on business;
b) the Licensor permanently ceases operations and is no longer offering commercial licences for
the Software; or
c) where the Licensor is a sole proprietor or single-employee entity, the death or permanent
incapacity of that individual results in the Licensor being unable to continue licensing or
supporting the Software.
2. Effect of Continuity Event
-----------------------------
Upon the occurrence of a Continuity Event:
- any valid and paid-up Commercial Subscription Licence held by the Licensee shall
automatically convert into a perpetual, non-exclusive, royalty-free licence to use
the Software; and
- the Licensee may continue to exercise the rights granted under the Commercial Subscription
Licence as they existed immediately prior to the Continuity Event.
3. Scope of Continued Rights
----------------------------
Following a Continuity Event, the Licensee may:
- continue to use the Software for commercial and internal business purposes;
- deploy the Software in production environments;
- maintain, modify, and create derivative works of the Software for its own internal use;
- continue distributing the Software internally solely as part of its existing products
or services.
The Licensee may not:
- resell, sublicense, or otherwise make the Software available on a standalone basis; or
- represent itself as the owner of the Software or its intellectual property.
4. No Obligation to Provide Support
-----------------------------------
Nothing in this Addendum obligates the Licensor
(or any successor or estate) to provide maintenance, updates, support, or
warranties following a Continuity Event.
5. Survival
-----------
This Addendum shall survive termination or expiration of the Agreement and shall take
effect only upon the occurrence of a Continuity Event.
6. No Early Trigger
-------------------
The occurrence of a Continuity Event shall not be deemed to have occurred solely due to:
- a temporary suspension of business;
- a delay in responding to communications;
- a change in ownership or corporate structure where licensing continues; or
- the discontinuation of a particular product version while the Licensor continues to operate.
7. Governing Law
----------------
This Addendum shall be governed by and construed in accordance with the laws of
England and Wales, excluding its conflict of law principles.
END OF ADDENDUM
================================================
FILE: Cargo.toml
================================================
[package]
name = "rateslib"
version = "2.7.1"
edition = "2021"
exclude = [
".github/*",
"benches/*",
"benchmarks/*",
"notebooks/*",
"docs/*",
"robots.txt",
]
[lib]
name = "rateslib"
path = "rust/lib.rs"
crate-type = ["cdylib", "rlib"] # "lib" alone works but this is more explicit
[[bin]]
name = "main"
path = "rust/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
#pyo3 = { version = "0.20.3", features = ["abi3-py39", "extension-module"] }
serde = { version = "1.0", features = ["derive", "rc"] }
chrono = { version = "0.4", features = ["serde"] }
indexmap = { version = "2.7", features = ["serde"] }
ndarray = { version = "0.17", features = ["serde"] }
internment = { version = "0.8", features = ["serde"] }
pyo3 = "0.28"
num-traits = "0.2"
auto_ops = "0.3"
numpy = "0.28"
itertools = "0.14"
statrs = "0.18"
bincode = { version = "2.0", features = ["serde"] }
serde_json = "1.0"
[features]
# multiple-pymethods = ["pyo3/multiple-pymethods"]
abi3-py310 = ["pyo3/abi3-py310"]
pyo3-chrono = ["pyo3/chrono"]
pyo3-indexmap = ["pyo3/indexmap"]
default = ["abi3-py310", "pyo3-chrono", "pyo3-indexmap"]
# 'extension-module' has been added to 'features' of [tool.maturin] in pyproject.toml
#extension-module = ["pyo3/extension-module"]
#default = ["extension-module", "abi3-py39", "chrono"]
# ------------- When building commment the below out.
#[dev-dependencies]
#criterion = { version = "0.4", features = ["html_reports"] }
#[[bench]]
#name = "my_benchmark"
#harness = false
================================================
FILE: LICENCE
================================================
LICENCE
=======
Dual Licensing – Source-Available Non-Commercial Licence
and Commercial Subscription Licence
Copyright © 2023 Siffrorna Technology Limited
All rights reserved.
Licence Acceptance
------------------
By downloading, installing, copying, accessing, or otherwise using this software, you
acknowledge that you have read, understood, and agree to be bound by the terms of one of the
licences below.
This software is not open source.
Dual-Licensing Overview
-----------------------
This software is offered under two alternative licences:
1. Non-Commercial Source-Available Licence (free, default)
2. Commercial Subscription Licence (paid, required for business use)
You may use this software only if you comply with the terms of one of these licences.
1. Non-Commercial Source-Available Licence
------------------------------------------
(Personal and Educational Use Only)
1.1 Grant of Rights
Subject to the restrictions below, permission is granted to view, download, and run the
software solely for non-commercial purposes, including:
- personal use
- academic or educational use
This licence does not grant any right to distribute, modify, or commercially exploit the software.
1.2 Restrictions
You may not, directly or indirectly:
- Install or use the software for any purpose in a commercial environment
- Sell, license, sublicense, rent, lease, or monetize the software
- Distribute or redistribute the software, in source or binary form
- Modify, adapt, translate, or create derivative works
- Incorporate the software into any other software, library, service, or product
- Use the software to provide services to third parties
- Circumvent, remove, or obscure copyright or licence notices
For the purposes of this licence, “commercial” means any use primarily intended for or
directed toward commercial advantage, monetary compensation, or business operations,
whether direct or indirect.
1.3 Ownership
The software is licensed, not sold.
All right, title, and interest in and to the software remain with the copyright holder.
1.4 Termination
Any violation of this licence automatically terminates the rights granted herein.
Upon termination, you must immediately cease all use of the software and delete all copies
in your possession or control.
2. Commercial Subscription Licence
----------------------------------
(Required for Business or Revenue-Generating Use)
Any use of the software in a commercial, professional, or revenue-generating context requires
a valid Commercial Subscription Licence.
A Commercial Subscription Licence may permit, subject to separate written terms:
- Commercial and internal business use
- Deployment in production environments
- Integration with proprietary or open-source systems
- Modification and derivative works
- Distribution as part of a product or service
Commercial licences are offered under separate written terms and are typically provided on
a subscription basis.
To obtain a Commercial Subscription Licence, visit https://rateslib.com/licence
3. No Implied Rights
--------------------
Except as expressly granted in writing, no rights are granted under this licence, whether by
implication, estoppel, or otherwise.
No patent, trademark, or other intellectual property rights are granted under the
Non-Commercial Source-Available Licence.
4. Restriction on Machine Learning, AI Training and Generative AI
-----------------------------------------------------------------
The Source Code and all related assets in this repository may not be used, directly or indirectly,
for the purpose of training, developing, or improving any artificial intelligence,
machine learning model, or large language model. This includes, but is not limited to,
using the Source Code for data mining, scraping, or as part of a training dataset for generative
AI tools. Any such use is an unauthorized reproduction and a violation of this license.
5. Disclaimer of Warranty
-------------------------
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
AND NON-INFRINGEMENT.
6. Limitation of Liability
--------------------------
TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR
ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM OR IN CONNECTION WITH THE USE OF THE SOFTWARE.
7. Governing Law
----------------
This licence and any dispute arising out of or in connection with it shall be governed by and
construed in accordance with the laws of England and Wales, excluding its conflict of
law principles.
Nothing in this section limits the copyright holder’s right to seek injunctive or equitable
relief in any jurisdiction.
8. Severability
---------------
If any provision of this licence is held to be invalid, illegal, or unenforceable by a court of
competent jurisdiction, the remaining provisions shall remain in full force and effect.
9. No Waiver
------------
Failure to enforce any provision of this licence shall not constitute a waiver of future
enforcement of that or any other provision.
10. Language
-----------
This licence is written in English. Any translations are provided for convenience only.
In the event of any inconsistency or dispute, the English version shall prevail.
END OF TERMS
================================================
FILE: README.md
================================================
<div style="text-align: center; padding: 2em 0 2em">
<img src="https://rateslib.readthedocs.io/en/latest/_static/rateslib_logo_big2.png" alt="rateslib">
</div>
<div style="text-align: center">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.python&label=Python&color=blue" alt="Python">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.pypi&label=PyPi&color=blue" alt="PyPi">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.conda&label=Conda&color=blue" alt="Conda">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.licence&label=Licence&color=red" alt="Licence">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.status&label=Status&color=green" alt="Status">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.coverage&label=Coverage&color=green" alt="Coverage">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.com%2Fpy%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.style&label=Code%20Style&color=black" alt="Code Style">
</div>
# Rateslib
``Rateslib`` is a state-of-the-art **fixed income library** designed for Python.
Its purpose is to provide advanced, flexible and efficient fixed income analysis
with a high level, well documented API.
The techniques and object interaction within *rateslib* were inspired by
the requirements of multi-disciplined fixed income teams working, both cooperatively
and independently, within global investment banks.
Licence
=======
This library is released under specific Dual Licensing Terms - Source-Available Non-Commercial Licence
and Commercial Subscription Licence. See [latest licence](https://rateslib.com/py/en/latest/i_licence.html)
This project is source-available, **not** open source. Commercial use requires a paid licence.
Get Started
===========
Read the documentation at
[rateslib.com/py](https://rateslib.com/py/)
================================================
FILE: docs/source/z_ir_vol_time_to_expiry.rst
================================================
.. _cook-ir-vol-time-doc:
.. ipython:: python
:suppress:
from rateslib.curves import *
from rateslib.instruments import *
from rateslib.solver import Solver
from rateslib import calendars
from itertools import product
from rateslib.volatility import IRSabrCube, IRSplineCube, IRSplineSmile, IRSabrSmile
import matplotlib.pyplot as plt
from datetime import datetime as dt
import numpy as np
from pandas import DataFrame, option_context, Series
import pandas as pd
IR Volatility Time To Expiry Remapping
**********************************************************************
This page presents examples for working with time to expiry for IR volatility products.
**Key Points**
- Every *time to expiry* is an Act365 calendar day measure unless remapped.
- At each ``expiry`` on any *Cube* *time to expiry* is Act365 calendar day measure assuming the associated
volatility is calibrated to market.
- Any intermediate *time to expiry* between the chosen ``expiries`` on a *Cube* can be remapped.
Introduction
-------------
Every *IR volatility* pricing object has an ``eval_date`` as part of its ``meta`` parameters.
This allows any :class:`~rateslib.volatility._BaseIRSmile` to make a natural measure of time to expiry
using the equation:
.. math::
t = \frac{days(expiry - eval date)}{365}
When a :class:`~rateslib.volatility._BaseIRSmile` yields a volatility value for a specific strike,
that volatility value is assumed to be associated with that *time to expiry* that
that :class:`~rateslib.volatility._BaseIRSmile` calculates.
Most of the time a user will not need to be aware of that. Lets create a basic swaption and analyse
different pricing models. For example:
.. ipython:: python
curve = Curve({dt(2001, 1, 1): 1.0, dt(2004, 1, 1): 0.90}, convention="act360", calendar="nyc")
iro = IRSCall(expiry=dt(2002, 1, 1), tenor="1y", irs_series="usd_irs", strike=3.30)
.. tabs::
.. group-tab:: IRSplineSmile
.. ipython:: python
irss = IRSplineSmile(
eval_date=dt(2001, 1, 1),
expiry=dt(2002, 1, 1),
tenor="1y",
nodes={-25.0: 52, 0: 50, 25: 53},
k=4,
irs_series="usd_irs"
)
print(irss.get_from_strike(k=2.4, f=2.1))
print(iro.rate(curves=curve, vol=irss, metric="percentnotional"))
.. group-tab:: IRSabrSmile
.. ipython:: python
irss = IRSabrSmile(
eval_date=dt(2001, 1, 1),
expiry=dt(2002, 1, 1),
tenor="1y",
nodes={"alpha": 0.35, "rho": -0.05, "nu": 0.65},
beta=0.5,
irs_series="usd_irs",
)
print(irss.get_from_strike(k=2.4, f=2.1))
print(iro.rate(curves=curve, vol=irss, metric="percentnotional"))
The pair of values here :math:`(t, \sigma)` are used in pricing models such as the Black76 or Bachelier model directly.
Time Scaling
--------------
It is possible, however, to apply a scaling parameter to the calendar day measure to arrive at a different
*time to expiry*. Doing so yields a pair :math:`(\hat{t}, \hat{\sigma})`
.. math::
\hat{t} = \xi t
.. tabs::
.. group-tab:: IRSplineSmile
.. ipython:: python
irss = IRSplineSmile(
eval_date=dt(2001, 1, 1),
expiry=dt(2002, 1, 1),
tenor="1y",
nodes={-25.0: 52, 0: 50, 25: 53},
k=4,
irs_series="usd_irs",
time_scalar=0.98,
)
print(irss.get_from_strike(k=2.4, f=2.1))
print(iro.rate(curves=curve, vol=irss, metric="percentnotional"))
.. group-tab:: IRSabrSmile
.. ipython:: python
irss = IRSabrSmile(
eval_date=dt(2001, 1, 1),
expiry=dt(2002, 1, 1),
tenor="1y",
nodes={"alpha": 0.35, "rho": -0.05, "nu": 0.65},
beta=0.5,
irs_series="usd_irs",
time_scalar=0.98,
)
print(irss.get_from_strike(k=2.4, f=2.1))
print(iro.rate(curves=curve, vol=irss, metric="percentnotional"))
Working with a Cube
----------------------
Typically the *time scalar* is not a quantity one will add to a *Smile* directly.
Instead it exists to allow *Cubes* to handle time interpolation.
The ``weights`` argument on a *Cube* can apportion volatility to specific dates in between
chosen ``expiries``. It is **assumed** that on every given expiry the time scalar equals one
and the *Cube* is calibrated to market *Instruments*.
.. tabs::
.. tab:: Calendar Days
.. ipython:: python
irsc1 = IRSabrCube(
eval_date=dt(2001, 1, 1),
expiries=[dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)],
tenors=["1y"],
alpha=0.35,
beta=0.5,
rho=-0.05,
nu=0.45,
irs_series="usd_irs",
)
.. tab:: Business Days
.. ipython:: python
nyc = calendars.get("nyc")
weights = Series( # set the weight of non-business days to zero
index=[_ for _ in nyc.cal_date_range(dt(2001, 1, 1), dt(2001, 8, 1)) if nyc.is_non_bus_day(_)],
data=0.0
)
irsc2 = IRSabrCube(
eval_date=dt(2001, 1, 1),
expiries=[dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)],
tenors=["1y"],
alpha=0.35,
beta=0.5,
rho=-0.05,
nu=0.45,
irs_series="usd_irs",
weights=weights,
)
.. tab:: Semi-Business Days
.. ipython:: python
weights2 = Series( # set the weight of non-business days to 0.5
index=[_ for _ in nyc.cal_date_range(dt(2001, 1, 1), dt(2001, 8, 1)) if nyc.is_non_bus_day(_)],
data=0.5
)
irsc3 = IRSabrCube(
eval_date=dt(2001, 1, 1),
expiries=[dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)],
tenors=["1y"],
alpha=0.35,
beta=0.5,
rho=-0.05,
nu=0.45,
irs_series="usd_irs",
weights=weights2,
)
Prices of Options
-------------------
With the different models above we plot the prices of ATM Payer Swaptions. In fact these graphs show the
differences in prices of percent of notional for an option of every expiry date. After the end of the ``weights``
*Series* the prices converge as both models fall back to calendar day type.
.. ipython:: python
x, y, y2 = [], [], []
for expiry in nyc.cal_date_range(dt(2001, 1, 5), dt(2001, 9, 1)):
iro = IRSCall(
expiry=expiry,
tenor="1y",
strike="atm",
irs_series="usd_irs",
)
x.append(expiry)
y.append(iro.rate(curves=curve, vol=irsc1, metric="percentnotional") - iro.rate(curves=curve, vol=irsc2, metric="percentnotional"))
y2.append(iro.rate(curves=curve, vol=irsc1, metric="percentnotional") - iro.rate(curves=curve, vol=irsc3, metric="percentnotional"))
.. plot::
from rateslib import dt, Curve, IRSabrCube, calendars, IRSCall
from pandas import Series
curve = Curve({dt(2001, 1, 1): 1.0, dt(2004, 1, 1): 0.90}, convention="act360", calendar="nyc")
irsc1 = IRSabrCube(
eval_date=dt(2001, 1, 1),
expiries=[dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)],
tenors=["1y"],
alpha=0.35,
beta=0.5,
rho=-0.05,
nu=0.45,
irs_series="usd_irs",
)
nyc = calendars.get("nyc")
weights = Series( # set the weight of non-business days to zero
index=[_ for _ in nyc.cal_date_range(dt(2001, 1, 1), dt(2001, 8, 1)) if nyc.is_non_bus_day(_)],
data=0.0
)
weights2 = Series( # set the weight of non-business days to 0.5
index=[_ for _ in nyc.cal_date_range(dt(2001, 1, 1), dt(2001, 8, 1)) if nyc.is_non_bus_day(_)],
data=0.5
)
irsc2 = IRSabrCube(
eval_date=dt(2001, 1, 1),
expiries=[dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)],
tenors=["1y"],
alpha=0.35,
beta=0.5,
rho=-0.05,
nu=0.45,
irs_series="usd_irs",
weights=weights,
)
irsc3 = IRSabrCube(
eval_date=dt(2001, 1, 1),
expiries=[dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)],
tenors=["1y"],
alpha=0.35,
beta=0.5,
rho=-0.05,
nu=0.45,
irs_series="usd_irs",
weights=weights2,
)
x, y, y2 = [], [], []
for expiry in nyc.cal_date_range(dt(2001, 1, 5), dt(2001, 9, 1)):
iro = IRSCall(
expiry=expiry,
tenor="1y",
strike="atm",
irs_series="usd_irs",
)
x.append(expiry)
y.append(iro.rate(curves=curve, vol=irsc1, metric="percentnotional") - iro.rate(curves=curve, vol=irsc2, metric="percentnotional"))
y2.append(iro.rate(curves=curve, vol=irsc1, metric="percentnotional") - iro.rate(curves=curve, vol=irsc3, metric="percentnotional"))
from matplotlib import pyplot as plt
fig, ax = plt.subplots(1,1)
ax.plot(x,y)
ax.plot(x,y2)
ax.scatter([dt(2001, 2, 1), dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 7, 1)], [0, 0, 0, 0], s=25, c='r')
plt.show()
plt.close()
================================================
FILE: notebooks/coding/ch5_fx.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from rateslib.fx import FXRates, FXForwards\n",
"from rateslib.dual import Dual\n",
"from rateslib.curves import Curve\n",
"from datetime import datetime as dt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 5 - FX Rates\n",
"\n",
"### Unsuitable initialisation"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"FXRates({\"usdeur\": 1.0, \"noksek\":1.0})"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"FXRates({\"usdeur\": 1.0, \"gbpusd\":1.0, \"gbpeur\": 1.0})"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"FXRates({\"usdeur\": 1.0, \"eurusd\":1.0, \"noksek\": 1.0})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## FX Rates Array\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates({\"usdeur\": 2.0, \"usdgbp\": 2.5})\n",
"fxr.rates_table()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr.rate(\"eurgbp\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Representation via Dual"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates({\"usdnok\": 8.0})\n",
"fxr.convert(1000000, \"nok\", \"usd\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Equivalence of Cash Positions and Base Value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr.currencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"base_value = fxr.convert_positions([0, 1000000], \"usd\")\n",
"base_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"positions = fxr.positions(base_value, \"usd\")\n",
"positions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Introduce a third currency"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates({\"usdeur\": 0.9, \"eurnok\": 8.888889})\n",
"fxr.currencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"base_value = fxr.convert_positions([0, 0, 1000000], \"usd\")\n",
"base_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr.positions(base_value, \"usd\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"base_value = Dual(125000, \"fx_usdnok\", [-15625])\n",
"positions = fxr.positions(base_value, \"usd\")\n",
"positions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr.convert_positions(positions, \"usd\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Re-expression in Majors"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr_crosses = FXRates({\"eurusd\": 1.0, \"gbpjpy\": 100, \"eurjpy\": 100})\n",
"fxr_crosses.convert(1, \"usd\", \"jpy\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr_majors = fxr_crosses.restate([\"eurusd\", \"usdjpy\", \"gbpusd\"])\n",
"fxr_majors.convert(1, \"usd\", \"jpy\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## FX Forwards"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fx_rates = FXRates({\"usdeur\": 0.9, \"eurnok\": 8.888889}, dt(2022, 1, 3))\n",
"fx_curves = {\n",
" \"usdusd\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.96}),\n",
" \"eureur\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.99}),\n",
" \"eurusd\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.991}),\n",
" \"noknok\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98}),\n",
" \"nokeur\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.978}),\n",
"}\n",
"fxf = FXForwards(fx_rates, fx_curves)\n",
"fxf.rate(\"usdnok\", dt(2022, 8, 15))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Equivalence of Delta Risk"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fx_rates = FXRates({\"usdeur\": 0.9, \"eurnok\": 8.888889}, dt(2022, 1, 3))\n",
"start, end = dt(2022, 1, 1), dt(2023, 1,1)\n",
"fx_curves = {\n",
" \"usdusd\": Curve({start: 1.0, end: 0.96}, id=\"uu\", ad=1),\n",
" \"eureur\": Curve({start: 1.0, end: 0.99}, id=\"ee\", ad=1),\n",
" \"eurusd\": Curve({start: 1.0, end: 0.991}, id=\"eu\", ad=1),\n",
" \"noknok\": Curve({start: 1.0, end: 0.98}, id=\"nn\", ad=1),\n",
" \"nokeur\": Curve({start: 1.0, end: 0.978}, id=\"ne\", ad=1),\n",
"}\n",
"fxf = FXForwards(fx_rates, fx_curves)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"discounted_nok = fx_curves[\"nokeur\"][dt(2022, 8, 15)] * 1000\n",
"base_value = discounted_nok * fxf.rate(\"nokusd\", dt(2022, 1, 1))\n",
"base_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"forward_eur = fxf.rate(\"nokeur\", dt(2022, 8, 15)) * 1000\n",
"discounted_eur = forward_eur * fx_curves[\"eureur\"][dt(2022, 8, 15)]\n",
"base_value = discounted_eur * fxf.rate(\"eurusd\", dt(2022, 1, 1))\n",
"base_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"base_value.gradient([\"uu1\", \"ee1\", \"eu1\", \"nn1\", \"ne1\", \"fx_usdeur\", \"fx_eurnok\"])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Combining Settlement Dates\n",
"\n",
"### Separable system"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr1 = FXRates({\"eurusd\": 1.05}, settlement=dt(2022, 1, 3))\n",
"fxr2 = FXRates({\"usdcad\": 1.1}, settlement=dt(2022, 1, 2))\n",
"fxf = FXForwards(\n",
" fx_rates=[fxr1, fxr2],\n",
" fx_curves={\n",
" \"usdusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eureur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"usdeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" }\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxf.rate(\"eurcad\", dt(2022, 2, 1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Acyclic Dependent Systems"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxf = FXForwards(\n",
" fx_rates=[fxr1, fxr2],\n",
" fx_curves={\n",
" \"usdusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eureur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"usdeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" }\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxf.rate(\"eurcad\", dt(2022, 2, 1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Cyclic Dependent Systems Fail"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr1 = FXRates({\"eurusd\": 1.05, \"gbpusd\": 1.25}, settlement=dt(2022, 1, 3))\n",
"fxf = FXForwards(\n",
" fx_rates=[fxr1, fxr2],\n",
" fx_curves={\n",
" \"usdusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eureur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"usdeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"gbpcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"gbpgbp\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" }\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"But cyclic systems can be restructured"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr1 = FXRates({\"eurusd\": 1.05}, settlement=dt(2022, 1, 3))\n",
"fxr3 = FXRates({\"gbpusd\": 1.25}, settlement=dt(2022, 1, 3))\n",
"fxf = FXForwards(\n",
" fx_rates=[fxr1, fxr2, fxr3],\n",
" fx_curves={\n",
" \"usdusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eureur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"usdeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"gbpcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"gbpgbp\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" }\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxf.rate(\"eurcad\", dt(2022, 2, 1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Unsolvable System"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fxr1 = FXRates({\"eurusd\": 1.05, \"gbpusd\": 1.25}, settlement=dt(2022, 1, 3))\n",
"fxr3 = FXRates({\"gbpjpy\": 100}, settlement=dt(2022, 1, 4))\n",
"FXForwards(\n",
" fx_rates=[fxr1, fxr2, fxr3],\n",
" fx_curves={\n",
" \"usdusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eureur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"gbpgbp\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"usdjpy\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eurcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eurjpy\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"gbpcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" }\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Dual Representation"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>2022-01-01</th>\n",
" <th>2022-01-02</th>\n",
" <th>2022-01-03</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>cad</th>\n",
" <td>0.0</td>\n",
" <td>181500.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>eur</th>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>-100000.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>usd</th>\n",
" <td>100000.0</td>\n",
" <td>-165000.0</td>\n",
" <td>105000.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 2022-01-01 2022-01-02 2022-01-03\n",
"cad 0.0 181500.0 0.0\n",
"eur 0.0 0.0 -100000.0\n",
"usd 100000.0 -165000.0 105000.0"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fxr1 = FXRates({\"eurusd\": 1.05}, settlement=dt(2022, 1, 3))\n",
"fxr2 = FXRates({\"usdcad\": 1.1}, settlement=dt(2022, 1, 2))\n",
"fxf = FXForwards(\n",
" fx_rates=[fxr1, fxr2],\n",
" fx_curves={\n",
" \"usdusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"eureur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadcad\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"usdeur\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" \"cadusd\": Curve({dt(2022, 1, 1):1.0, dt(2022, 2, 1): 0.999}),\n",
" }\n",
")\n",
"pv = Dual(100000, [\"fx_eurusd\", \"fx_usdcad\"], [-100000, -150000])\n",
"fxf.positions(pv, base=\"usd\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"cad 181500.0\n",
"eur -100000.0\n",
"usd 40000.0\n",
"dtype: float64"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fxf.positions(pv, base=\"usd\", aggregate=True)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Dual: 100,000.000000, ['fx_eurusd', 'fx_usdcad'], [-100000. -150000.]>"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fxf.convert_positions(fxf.positions(pv, base=\"usd\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
================================================
FILE: notebooks/coding/curves.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"id": "f8825706-c252-40d7-8075-b438f5756093",
"metadata": {},
"source": [
"# Curves\n",
"\n",
"### CompositeCurve example\n",
"\n",
"The first section here regards efficient operations and compositing two curves."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c88c3ce0-72f1-4182-a6c0-36209ccc9954",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import dt\n",
"from rateslib.curves import Curve, LineCurve, CompositeCurve"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "9cbc5699-fa68-46cd-8e75-3752d078977c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.75"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"line_curve1 = LineCurve({dt(2022, 1, 1): 2.0, dt(2022, 1, 3): 4.0}, id=\"C1_\")\n",
"line_curve2 = LineCurve({dt(2022, 1, 1): 0.5, dt(2022, 1, 3): 1.0}, id=\"C2_\")\n",
"composite_curve = CompositeCurve(curves=(line_curve1, line_curve2))\n",
"composite_curve.rate(dt(2022, 1, 2))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fd5f49ac-ed99-4422-844a-13c657b823f1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Dual: 3.750000, ('C1_0', 'C1_1', 'C2_0', 'C2_1'), [0.5 0.5 0.5 0.5]>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"line_curve1._set_ad_order(1)\n",
"line_curve2._set_ad_order(1)\n",
"composite_curve.rate(dt(2022, 1, 2))"
]
},
{
"cell_type": "markdown",
"id": "8cb305f5-19a5-46b6-a9f2-82a2bd1f6592",
"metadata": {},
"source": [
"The code above demonstrates the summing of individual rates and of interoperability with Dual datatypes."
]
},
{
"cell_type": "markdown",
"id": "b658689c-65f2-4aae-992a-7fbf61f5d2c4",
"metadata": {},
"source": [
"### Error in approximated rates and execution time"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "973e0754-edfc-42ce-9d0c-d2272c69465f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([ 3455, 3451, 22875, 21294, 48033, 892]),\n",
" array([0.e+00, 5.e-07, 1.e-06, 5.e-06, 1.e-05, 5.e-05, 1.e+00]))"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"MIN, MAX, SAMPLES, DAYS, d = 0, 4, 100000, 3, 1.0/365\n",
"c1 = np.random.rand(DAYS, SAMPLES) * (MAX - MIN) + MIN\n",
"c2 = np.random.rand(DAYS, SAMPLES) * (MAX - MIN) + MIN\n",
"r_true=((1 + d * (c1 + c2) / 100).prod(axis=0) - 1) * 100 / (d * DAYS)\n",
"c1_bar = ((1 + d * c1 / 100).prod(axis=0)**(1/DAYS) - 1) * 100 / d\n",
"c2_bar = ((1 + d * c2 / 100).prod(axis=0)**(1/DAYS) - 1) * 100 / d\n",
"r_bar = ((1 + d * (c1_bar + c2_bar) / 100) ** DAYS - 1) * 100 / (d * DAYS)\n",
"np.histogram(np.abs(r_true-r_bar), bins=[0, 5e-7, 1e-6, 5e-6, 1e-5, 5e-5, 1]) "
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c56f3b7d-07ce-4007-bf57-bda4bc2259cb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"50.3 µs ± 1.22 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)\n"
]
}
],
"source": [
"composite_curve = CompositeCurve(\n",
" (\n",
" Curve({dt(2022, 1, 1): 1.0, dt(2024, 1, 1): 0.95}, id=\"C1_\"),\n",
" Curve({dt(2022, 1, 1): 1.0, dt(2024, 1, 1): 0.99}, id=\"C2_\"),\n",
" )\n",
")\n",
"%timeit composite_curve.rate(dt(2022, 6, 1), \"1y\", approximate=True) "
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7e74017e-41f0-424a-bd17-aed0d168a8df",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"21.9 ms ± 890 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
"source": [
"%timeit composite_curve.rate(dt(2022, 6, 1), \"1y\", approximate=False)"
]
},
{
"cell_type": "markdown",
"id": "5f2769bb-0f25-4d5e-996f-5684e1f18a26",
"metadata": {},
"source": [
"### Curve operations: shift"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "64caaec4-072a-4dd5-a9ef-ac4b95852a7f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.9926509362075961\n",
"2.4926509362108717\n"
]
}
],
"source": [
"curve = Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98})\n",
"print(curve.rate(dt(2022, 2, 1), \"1d\"))\n",
"print(curve.shift(50).rate(dt(2022, 2, 1), \"1d\"))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "5a386ff1-1577-42b1-8d13-7d53dc509aa5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.050958904109589\n",
"2.550958904109589\n"
]
}
],
"source": [
"line_curve = LineCurve({dt(2022, 1, 1): 2.0, dt(2023, 1, 1): 2.6})\n",
"print(line_curve.rate(dt(2022, 2, 1), \"1d\"))\n",
"print(line_curve.shift(50).rate(dt(2022, 2, 1), \"1d\"))"
]
},
{
"cell_type": "markdown",
"id": "44ebfa6c-72ee-473e-9299-e1727a8884b7",
"metadata": {},
"source": [
"### Curve operations: translate"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "bdf0aca9-39e0-406b-9d64-9bfcfc9ffed6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.8711064912719806 3.8711064912719806\n",
"3.8709012910311813 3.8709012910311813\n",
"3.8706902731000525 3.870690273092059\n",
"0.0 0.0\n",
"0.0 0.0\n",
"3.8971038951416404 3.9052558203165333\n"
]
}
],
"source": [
"for interpolation in [\n",
" \"linear\", \"log_linear\", \"linear_index\", \"flat_forward\", \"flat_backward\", \"linear_zero_rate\"\n",
"]:\n",
" curve = Curve(\n",
" nodes={dt(2022, 1, 1): 1.0, dt(2022, 2, 1):0.998, dt(2022, 3, 1): 0.995}, \n",
" interpolation=interpolation\n",
" )\n",
" curve_translated = curve.translate(dt(2022, 1, 15)) \n",
" print(\n",
" curve.rate(dt(2022, 2, 15), \"1d\"),\n",
" curve_translated.rate(dt(2022, 2, 15), \"1d\") \n",
" )"
]
},
{
"cell_type": "markdown",
"id": "327672ae-28af-4e15-bfe1-0b5a52cedcc8",
"metadata": {},
"source": [
"### Curve operations: roll"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "6e4e86f8-ff29-48bb-a7f7-9985aa2f0748",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.1111503451809455\n",
"2.1111503451809455\n"
]
}
],
"source": [
"curve = Curve(\n",
" nodes={dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98, dt(2024, 1, 1): 0.97},\n",
" t=[dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1),\n",
" dt(2023, 1, 1),\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)]\n",
")\n",
"print(curve.rate(dt(2022, 6, 1), \"1d\"))\n",
"print(curve.roll(\"30d\").rate(dt(2022, 7, 1), \"1d\"))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "d4e5fc59-aa88-48ec-a7f6-e5d13b10b1f3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.3082258965546494\n",
"2.3082258965546494\n"
]
}
],
"source": [
"line_curve = LineCurve(\n",
" nodes={dt(2022, 1, 1): 2.0, dt(2023, 1, 1): 2.6, dt(2024, 1, 1): 2.5},\n",
" t=[dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1),\n",
" dt(2023, 1, 1),\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)]\n",
")\n",
"print(line_curve.rate(dt(2022, 6, 1)))\n",
"print(line_curve.roll(\"-31d\").rate(dt(2022, 5, 1), \"1d\"))"
]
},
{
"cell_type": "markdown",
"id": "ee9951a7-1eea-4255-9e5c-2a4818983598",
"metadata": {},
"source": [
"### Operations on CompositeCurves"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "8fff533b-4ee2-4405-b6e3-bdf4fe53aadf",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.0252576094156325"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"composite_curve.rate(dt(2022, 6, 1), \"1d\")"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "53409cb5-9512-43f1-8e9c-cb1886ed1f6e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.525257609418908"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"composite_curve.shift(50).rate(dt(2022, 6, 1), \"1d\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "89680e78-5318-4b56-af1d-8be7dae90ca4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.025257609407639"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"composite_curve.roll(\"30d\").rate(dt(2022, 7, 1), \"1d\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "b23d6958-903a-4442-98a7-d5585fe4d56c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.0252576094156325"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"composite_curve.translate(dt(2022, 5, 1)).rate(dt(2022, 6, 1), \"1d\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding/scheduling.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "88003b38-8369-4263-b409-fe548b1250cb",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import dt\n",
"from rateslib.scheduling import _get_unadjusted_roll"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "ac36569f-fa13-49ae-829d-458104892eed",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"15"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_roll(ueffective=dt(2022, 3, 15), utermination=dt(2023, 3, 15), eom=False)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e5181913-6ea2-4ccc-893f-fdf8621e4534",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"28"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_roll(ueffective=dt(2022, 2, 28), utermination=dt(2023, 2, 28), eom=False)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "8bb47315-3042-4c9a-a8eb-3766be6a2fe7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'eom'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_roll(ueffective=dt(2022, 2, 28), utermination=dt(2023, 2, 28), eom=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c46d63ff-99c8-48fa-a03d-93e90e0b7b1c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 60,
"id": "bf3b7df1-9cd1-4a0d-988a-d7d80e7b9b08",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _generate_regular_schedule_unadjusted"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "19802482-fe5d-4e21-aa7b-8b419fe6245e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[datetime.datetime(2023, 3, 15, 0, 0),\n",
" datetime.datetime(2023, 4, 19, 0, 0),\n",
" datetime.datetime(2023, 5, 17, 0, 0),\n",
" datetime.datetime(2023, 6, 21, 0, 0),\n",
" datetime.datetime(2023, 7, 19, 0, 0),\n",
" datetime.datetime(2023, 8, 16, 0, 0),\n",
" datetime.datetime(2023, 9, 20, 0, 0)]"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dates = [\n",
" d for d in \n",
" _generate_regular_schedule_unadjusted(\n",
" ueffective=dt(2023, 3, 15),\n",
" utermination=dt(2023, 9, 20),\n",
" frequency=\"M\",\n",
" roll=\"imm\"\n",
" )\n",
"]\n",
"dates"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3b0dbdd3-5daa-4933-8cc2-5d08605bf57f",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "04b4befd-8430-4471-9b44-b367343268b0",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "995ebd97-495e-4736-a5a1-780b5d87b0d1",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "4e3a0787-082b-45eb-a769-6347e90a5190",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _check_unadjusted_regular_swap"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "d0d910d9-a974-4167-bfd3-f4a9c772de9a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(False, 'Roll day could not be inferred from given dates.')"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_check_unadjusted_regular_swap(\n",
" ueffective=dt(2022, 3, 16), utermination=dt(2022, 9, 21),\n",
" frequency=\"M\", roll=None, eom=False\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "67d9c5e4-84c7-4f0b-afa6-896c8eebf521",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(True,\n",
" {'ueffective': datetime.datetime(2022, 2, 28, 0, 0),\n",
" 'utermination': datetime.datetime(2023, 2, 28, 0, 0),\n",
" 'frequency': 'M',\n",
" 'roll': 'eom',\n",
" 'eom': True})"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_check_unadjusted_regular_swap(\n",
" ueffective=dt(2022, 2, 28), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=True, roll=None\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "cc11e373-87c8-49d8-859c-06610031c44a",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _get_unadjusted_short_stub_date"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "d02c470c-727b-4878-9658-5f63e5d4bace",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 6, 30, 0, 0)"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_short_stub_date(\n",
" ueffective=dt(2022, 6, 15), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=True, roll=None, stub_side=\"FRONT\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "de5285b8-50bf-4a84-af4e-a0113a63bf50",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 6, 28, 0, 0)"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_short_stub_date(\n",
" ueffective=dt(2022, 6, 15), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=False, roll=None, stub_side=\"FRONT\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "0135ff22-784f-4c43-8162-2577073a1927",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 6, 29, 0, 0)"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_short_stub_date(\n",
" ueffective=dt(2022, 6, 15), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=True, roll=29, stub_side=\"FRONT\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ab24b046-b86b-4945-8767-381c53d00a04",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 47,
"id": "19505125-6eed-43da-a541-32aab0f845d6",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _get_unadjusted_stub_date"
]
},
{
"cell_type": "code",
"execution_count": 50,
"id": "daff6659-f94a-4cd6-ab65-018fb20af567",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 7, 31, 0, 0)"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_stub_date(\n",
" ueffective=dt(2022, 6, 15), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=True, roll=None, stub=\"LONGFRONT\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "94e4ff12-a80a-44d1-85cd-b7ea2435cb52",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 7, 28, 0, 0)"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_stub_date(\n",
" ueffective=dt(2022, 6, 15), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=False, roll=None, stub=\"LONGFRONT\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "2f6ddb5e-6322-43f0-9d76-6a989c3617a7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"datetime.datetime(2022, 7, 29, 0, 0)"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_get_unadjusted_stub_date(\n",
" ueffective=dt(2022, 6, 15), utermination=dt(2023, 2, 28),\n",
" frequency=\"M\", eom=True, roll=29, stub=\"LONGFRONT\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "519ff189-e0df-44ba-a8f2-05da66123906",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 56,
"id": "8afde93d-6f6d-4656-a456-bc69900e53f0",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.calendars import get_calendar\n",
"from rateslib.scheduling import _check_regular_swap"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "ee7487e8-2b6d-437b-954f-26eb2ae913c4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(True,\n",
" {'ueffective': datetime.datetime(2022, 6, 5, 0, 0),\n",
" 'utermination': datetime.datetime(2022, 12, 5, 0, 0),\n",
" 'frequency': 'Q',\n",
" 'roll': 5,\n",
" 'eom': False})"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"_check_regular_swap(\n",
" effective=dt(2022, 6, 6),\n",
" termination=dt(2022, 12, 5),\n",
" frequency=\"Q\",\n",
" modifier=\"MF\",\n",
" eom=False,\n",
" roll=None,\n",
" calendar=get_calendar(\"bus\"),\n",
")\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3957a681-a10a-4925-8fe9-07d227a46786",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/AutomaticDifferentiation.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "207f47dd-6e8d-4a49-8d4c-c775b157f8cb",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import *"
]
},
{
"cell_type": "markdown",
"id": "4a2c4aa5-99a9-4a63-8b8a-3dc9fe2785ae",
"metadata": {},
"source": [
"# Definitions of dual numbers"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b5149cbc-1a29-4f20-a40b-3980866b6914",
"metadata": {},
"outputs": [],
"source": [
"z_x = Dual2(0.0, [\"x\"], [], [])\n",
"z_x"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26ce32a9-9f08-4477-8fd7-f98fed699362",
"metadata": {},
"outputs": [],
"source": [
"z_x * z_x"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5e6b947f-1ea1-44d6-8c7b-a7d9445f5158",
"metadata": {},
"outputs": [],
"source": [
"(z_x * z_x).dual2"
]
},
{
"cell_type": "markdown",
"id": "3364bb0a-7fe0-43fa-bda4-c67c7e6e4630",
"metadata": {},
"source": [
"# General functions of dual numbers"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e48f6a4d-fe10-4ea5-9f39-85c310423e76",
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"def dual_sin(x: float | Dual) -> float | Dual:\n",
" if isinstance(x, Dual):\n",
" return Dual(math.sin(x.real), x.vars, math.cos(x.real) * x.dual)\n",
" return math.sin(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d3cd2d23-0538-41e3-b94d-401bb7d2d35c",
"metadata": {},
"outputs": [],
"source": [
"x = Dual(2.1, [\"y\"], [])\n",
"dual_sin(x)"
]
},
{
"cell_type": "markdown",
"id": "e5cda5f5-c336-4e1c-abb6-2bf84db40352",
"metadata": {},
"source": [
"# Upcasting and dynamic variables"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "79196a21-0418-47a3-9d65-a6448b57df06",
"metadata": {},
"outputs": [],
"source": [
"first_dual = Dual(11.0, [\"x\", \"y\"], [3, 8])\n",
"second_dual = Dual(-3.0, [\"y\", \"z\"], [-2, 5])\n",
"first_dual + second_dual + 2.65"
]
},
{
"cell_type": "markdown",
"id": "93465777-50f0-4b1d-ad6d-00b054a52a37",
"metadata": {},
"source": [
"# First order derivatives and performance"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e66cf2c2-26a9-4b87-9600-265d43dd98ce",
"metadata": {},
"outputs": [],
"source": [
"def func(x, y, z):\n",
" return x**6 + dual_exp(x/y) + dual_log(z)\n",
"\n",
"x, y, z = 2.0, 1.0, 2.0\n",
"func(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff535dd2-92af-4141-8343-78025f101278",
"metadata": {},
"outputs": [],
"source": [
"%timeit func(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "827b29f9-9314-40f3-a02d-44072643ee75",
"metadata": {},
"outputs": [],
"source": [
"x, y, z = Dual(2.0, [\"x\"], []), Dual(1.0, [\"y\"], []), Dual(2.0, [\"z\"], [])\n",
"func(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5e5d6fd4-ea9d-4cad-888c-935a6eec92c5",
"metadata": {},
"outputs": [],
"source": [
"%timeit func(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1a1fb920-993f-4f9f-a023-7b946051f31c",
"metadata": {},
"outputs": [],
"source": [
"x = Dual(2.0, [\"x\", \"y\", \"z\"], [1.0, 0.0, 0.0])\n",
"y = Dual(1.0, [\"x\", \"y\", \"z\"], [0.0, 1.0, 0.0])\n",
"z = Dual(2.0, [\"x\", \"y\", \"z\"], [0.0, 0.0, 1.0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6dbce6a4-54b5-46dd-ae43-7011aa21703e",
"metadata": {},
"outputs": [],
"source": [
"%timeit func(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ceb92f32-8064-46e1-a3ce-54b888759744",
"metadata": {},
"outputs": [],
"source": [
"x = Dual(2.0, [\"x\", \"y\", \"z\"], [1.0, 0.0, 0.0])\n",
"y = Dual.vars_from(x, 1.0, [\"x\", \"y\", \"z\"], [0.0, 1.0, 0.0])\n",
"z = Dual.vars_from(x, 2.0, [\"x\", \"y\", \"z\"], [0.0, 0.0, 1.0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94cc0d63-5705-4848-9207-76d1885ba7d4",
"metadata": {},
"outputs": [],
"source": [
"%timeit func(x, y, z)"
]
},
{
"cell_type": "markdown",
"id": "170edec4-7a07-43ed-812f-2681225fd9b0",
"metadata": {},
"source": [
"# Numerical differentiation"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a616687b-e18f-491a-867e-efa6a4352262",
"metadata": {},
"outputs": [],
"source": [
"def df_fwd_diff(f, x, y, z):\n",
" base = f(x, y, z)\n",
" dh = 1e-10\n",
" dx = f(x+dh, y, z) - base\n",
" dy = f(x, y+dh, z) - base\n",
" dz = f(x, y, z+dh) - base\n",
" return base, dx/dh, dy/dh, dz/dh\n",
"\n",
"%timeit df_fwd_diff(func, 2.0, 1.0, 2.0) "
]
},
{
"cell_type": "markdown",
"id": "5841581d-1acf-4a97-b4c5-f5136ee9b4b1",
"metadata": {},
"source": [
"# Functions with execution line delay"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a47f8cea-1e05-4387-8e8f-f09030b39aa0",
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"def func_complex(x, y, z):\n",
" time.sleep(0.000025)\n",
" return x**6 + dual_exp(x/y) + dual_log(z)\n",
"\n",
"%timeit func_complex(2.0, 1.0, 2.0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16867e87-f124-45de-81c6-ddf251bc07c8",
"metadata": {},
"outputs": [],
"source": [
"%timeit func_complex(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e3273e1f-af3f-4b4f-bd37-93893cfd2055",
"metadata": {},
"outputs": [],
"source": [
"%timeit df_fwd_diff(func_complex, 2.0, 1.0, 2.0)"
]
},
{
"cell_type": "markdown",
"id": "3dd7f29a-5c85-4b51-8877-c198ca0c52f4",
"metadata": {},
"source": [
"# Second order derivatives"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "65332b6c-e18d-4cd2-b4a7-434b4098a70f",
"metadata": {},
"outputs": [],
"source": [
"x = Dual2(2.0, [\"x\", \"y\", \"z\"], [1.0, 0.0, 0.0], [])\n",
"y = Dual2(1.0, [\"x\", \"y\", \"z\"], [0.0, 1.0, 0.0], [])\n",
"z = Dual2(2.0, [\"x\", \"y\", \"z\"], [0.0, 0.0, 1.0], [])\n",
"func(x, y, z)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0ed2c033-9373-469c-a857-47aa3a32892c",
"metadata": {},
"outputs": [],
"source": [
"gradient(func(x, y, z), [\"x\", \"y\"], order=2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "72618649-a785-40d0-b8ea-f297a1f50621",
"metadata": {},
"outputs": [],
"source": [
"%timeit func(x, y, z)"
]
},
{
"cell_type": "markdown",
"id": "17ff6e34-0a43-4158-961a-5c3fe51d167b",
"metadata": {},
"source": [
"# Exogenous Variables"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "959084c7-cc2a-4206-adaa-7d663a2c6a7e",
"metadata": {},
"outputs": [],
"source": [
"x = Variable(1.5, [\"x\"])\n",
"y = Variable(3.9, [\"y\"])\n",
"x * y"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c30894e-04a8-429a-bbea-4d8d3fc2144c",
"metadata": {},
"outputs": [],
"source": [
"defaults._global_ad_order = 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dcbe5c20-ce23-4546-a9c5-bf4fe3753f01",
"metadata": {},
"outputs": [],
"source": [
"x * y"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a78d3ed5-96e5-4c87-8933-62245877a379",
"metadata": {},
"outputs": [],
"source": [
"(x * y).dual2"
]
},
{
"cell_type": "markdown",
"id": "ec449dab-7251-4225-b2e0-eb5212f9095a",
"metadata": {},
"source": [
"# One Dimensional Newton-Raphson Algorithm"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "04dc714b-49d8-4f77-b199-da3bd10416f8",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.dual import newton_1dim\n",
"\n",
"def f(g, s):\n",
" f0 = g**2 - s # Function value\n",
" f1 = 2*g # Analytical derivative is required\n",
" return f0, f1\n",
"\n",
"s = Dual(2.0, [\"s\"], [])\n",
"newton_1dim(f, g0=1.0, args=(s,))"
]
},
{
"cell_type": "markdown",
"id": "9b6df9e8-f5ae-4d3d-ac86-2cee332bf1de",
"metadata": {},
"source": [
"# One Dimensional Inverse Function Theorem"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "289e0c45-7a40-4c24-b9f1-f1efe21b1966",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.dual import ift_1dim\n",
"\n",
"def s(g):\n",
" return dual_exp(g) + g**2\n",
"\n",
"s_tgt = Dual(2.0, [\"s\"], [])\n",
"ift_1dim(s, s_tgt, h=\"modified_brent\", ini_h_args=(0.0, 2.0))"
]
},
{
"cell_type": "markdown",
"id": "82100c0b-63bc-4d19-bf62-848bb6cc91b3",
"metadata": {},
"source": [
"# Normal functions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "06f5fa1d-8084-46a2-b9a1-94db300ec28e",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.dual import dual_norm_pdf, dual_norm_cdf, dual_inv_norm_cdf"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ed9396d9-88d6-4817-bd86-c6a93fc3222e",
"metadata": {},
"outputs": [],
"source": [
"dual_norm_pdf(Variable(1.5, [\"u\"]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5e661276-6c82-4f99-9a18-0e1bc0a71c83",
"metadata": {},
"outputs": [],
"source": [
"dual_norm_cdf(Variable(1.5, [\"u\"]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ced0f08c-0ebf-4274-82e9-fe81480ab0fa",
"metadata": {},
"outputs": [],
"source": [
"dual_inv_norm_cdf(Variable(0.933193, [\"v\"]))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Calendars.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "2362d250-6e1f-43d3-a853-4e53db61ef19",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import *"
]
},
{
"cell_type": "markdown",
"id": "7c691656-ba4f-4278-8849-a75fc13b83f8",
"metadata": {},
"source": [
"# Timings\n",
"\n",
"Get a calendar straight from a hash table."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d8d2453-d45d-44a1-9794-31f9315f2de4",
"metadata": {},
"outputs": [],
"source": [
"%timeit get_calendar(\"ldn\")"
]
},
{
"cell_type": "markdown",
"id": "09dcad09-c185-48c3-9773-818f3af0d5db",
"metadata": {},
"source": [
"Construct a ``Cal`` directly from a list of holidays and week mask."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "375dc5c5-afbb-43a4-bd45-abb989ce3057",
"metadata": {},
"outputs": [],
"source": [
"cal = get_calendar(\"ldn\")\n",
"holidays = cal.holidays\n",
"%timeit Cal(holidays=holidays, week_mask=[5,6])"
]
},
{
"cell_type": "markdown",
"id": "e17cff9e-1685-491c-8b68-d43a5bd6f6d4",
"metadata": {},
"source": [
"Get a ``NamedCal`` parsed and constructed in Python."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9096fea1-5cf6-4866-8f2d-2f549092be48",
"metadata": {},
"outputs": [],
"source": [
"%timeit get_calendar(\"ldn,tgt\")"
]
},
{
"cell_type": "markdown",
"id": "359e90af-641f-4753-a031-105a5fe0d54e",
"metadata": {},
"source": [
"Construct a ``UnionCal`` directly from multiple ``Cal``."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "07ef7035-3406-4f6f-91fe-5232599ee91c",
"metadata": {},
"outputs": [],
"source": [
"c1 = Cal(holidays=get_calendar(\"ldn\", named=False).holidays, week_mask=[5,6])\n",
"c2 = Cal(holidays=get_calendar(\"tgt\", named=False).holidays, week_mask=[5,6])\n",
"\n",
"%timeit UnionCal([c1, c2])"
]
},
{
"cell_type": "markdown",
"id": "ad0bd111-3c5d-4f93-a097-ecdf3cdb6090",
"metadata": {},
"source": [
"Add a new calendar to ``defaults.calendars`` and fetch that directly."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3db567be-5110-41e5-a36e-c8a7c8fd9445",
"metadata": {},
"outputs": [],
"source": [
"defaults.calendars[\"ldn,tgt\"] = get_calendar(\"ldn,tgt\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e1a030ff-3403-4b5d-a271-7154c62e5597",
"metadata": {},
"outputs": [],
"source": [
"%timeit get_calendar(\"ldn,tgt\")"
]
},
{
"cell_type": "markdown",
"id": "97dd17e2-5b84-4a9c-ba5d-017ba5815ee2",
"metadata": {},
"source": [
"# Tenor Manipulations"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c1afb68c-f364-47cb-8818-63736ec0a911",
"metadata": {},
"outputs": [],
"source": [
"add_tenor(dt(2001, 9, 28), \"-6m\", modifier=\"MF\", calendar=\"LDN\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "993f5d28-6945-44ea-a83d-d7a66a80256f",
"metadata": {},
"outputs": [],
"source": [
"add_tenor(dt(2001, 9, 28), \"-6m\", modifier=\"MF\", calendar=\"LDN\", roll=31)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8bcddb24-17ab-46ca-a8c1-77c6e4fe2ac8",
"metadata": {},
"outputs": [],
"source": [
"add_tenor(dt(2001, 9, 28), \"-6m\", modifier=\"MF\", calendar=\"LDN\", roll=29)"
]
},
{
"cell_type": "markdown",
"id": "32a400ca-6e1c-4f0d-880f-bf256e6ce776",
"metadata": {},
"source": [
"# Associated Settlement Calendars"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f38317db-2936-496e-a29e-3a7a5fcaa6b2",
"metadata": {},
"outputs": [],
"source": [
"tgt_and_nyc = get_calendar(\"tgt,nyc\")\n",
"tgt_and_nyc.add_bus_days(dt(2009, 11, 10), 2, True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "adc402b7-de57-4bc8-afb0-652a61c150d9",
"metadata": {},
"outputs": [],
"source": [
"tgt_plus_nyc_settle = get_calendar(\"tgt|nyc\")\n",
"tgt_plus_nyc_settle.add_bus_days(dt(2009, 11, 10), 2, True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "79f4e7e4-c5ed-4d1e-ad55-669838a1b2ff",
"metadata": {},
"outputs": [],
"source": [
"tgt_plus_nyc_settle.add_bus_days(dt(2009, 11, 10), 1, settlement=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "90585e34-914d-4292-a6e8-9d146ba432de",
"metadata": {},
"outputs": [],
"source": [
"tgt_plus_nyc_settle.add_bus_days(dt(2009, 11, 10), 1, settlement=False)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Cookbook.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"id": "a731e2a1-7df1-4627-87a4-eece8b11f3ec",
"metadata": {},
"source": [
"# Turns"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b19074cb-c470-4da9-8c03-5db7f134bd4d",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bba57742-a6f2-4c05-b221-6af17deab2bf",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve(\n",
" nodes={dt(2022, 12, 1): 1.0, dt(2023, 2, 1): 1.0}, \n",
" interpolation=\"log_linear\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e7d887d4-7ed4-477e-b64b-08707dd27d27",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve({\n",
" dt(2022, 12, 1): 1.0,\n",
" dt(2022, 12, 31): 1.0,\n",
" dt(2023, 1, 1): 1.0,\n",
" dt(2023, 2, 1): 1.0,\n",
"}, interpolation=\"log_linear\")\n",
"instruments = [\n",
" IRS(dt(2022, 12, 1), \"1d\", \"A\", curves=curve),\n",
" Spread(\n",
" IRS(dt(2022, 12, 30), \"1d\", \"A\", curves=curve),\n",
" IRS(dt(2022, 12, 31), \"1d\", \"A\", curves=curve),\n",
" ),\n",
" Spread(\n",
" IRS(dt(2022, 12, 31), \"1d\", \"A\", curves=curve),\n",
" IRS(dt(2023, 1, 1), \"1d\", \"A\", curves=curve),\n",
" ), \n",
"]\n",
"solver = Solver(curves=[curve], instruments=instruments, s=[0.0, -0.5, 0.5])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ba791a79-f913-44ff-8631-c4c65b9a9a28",
"metadata": {},
"outputs": [],
"source": [
"instruments = [\n",
" IRS(dt(2022, 12, 1), \"1d\", \"A\", curves=curve),\n",
" Spread(\n",
" IRS(dt(2022, 12, 30), \"1d\", \"A\", curves=curve),\n",
" IRS(dt(2022, 12, 31), \"1d\", \"A\", curves=curve),\n",
" ),\n",
" IRS(dt(2023, 1, 1), \"1d\", \"A\", curves=curve),\n",
"]\n",
"solver = Solver(curves=[curve], instruments=instruments, s=[0.0, -50.0, 0.0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c662bd2b-118c-4016-9c24-d8141d5c3a2c",
"metadata": {},
"outputs": [],
"source": [
"curve.plot(\"1b\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "93a4f1b0-cacc-4e3c-933f-6305b21b3d0f",
"metadata": {},
"outputs": [],
"source": [
"linecurve = LineCurve({\n",
" dt(2022, 12, 1): 0.0,\n",
" dt(2022, 12, 31): -50.0,\n",
" dt(2023, 1, 1): 0.0,\n",
"}, interpolation=\"flat_forward\")\n",
"instruments = [\n",
" Value(dt(2022, 12, 1), curves=linecurve),\n",
" Value(dt(2022, 12, 31), curves=linecurve),\n",
" Value(dt(2023, 1, 1), curves=linecurve),\n",
"]\n",
"solver = Solver(curves=[linecurve], instruments=instruments, s=[0.0, -0.5, 0.0])\n",
"linecurve.plot(\"1b\", right=dt(2023, 2, 1))"
]
},
{
"cell_type": "markdown",
"id": "596da5c8-04c9-4668-a8ec-755c788e5d77",
"metadata": {},
"source": [
"### Injecting turns to spline curves"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2545ff72-0a2c-46e3-a1bb-ab0ef94f211d",
"metadata": {},
"outputs": [],
"source": [
"turn_curve = Curve({\n",
" dt(2022, 12, 1): 1.0,\n",
" dt(2022, 12, 31): 1.0,\n",
" dt(2023, 1, 1): 1.0,\n",
" dt(2023, 2, 1): 1.0,\n",
"}, interpolation=\"log_linear\")\n",
"cubic_curve = Curve({\n",
" dt(2022, 12, 1): 1.0,\n",
" dt(2022, 12, 21): 1.0,\n",
" dt(2023, 1, 11): 1.0,\n",
" dt(2023, 2, 1): 1.0,\n",
"}, t = [\n",
" dt(2022, 12, 1), dt(2022, 12, 1), dt(2022, 12, 1), dt(2022, 12, 1),\n",
" dt(2022, 12, 21),\n",
" dt(2023, 1, 11),\n",
" dt(2023, 2, 1), dt(2023, 2, 1), dt(2023, 2, 1), dt(2023, 2, 1),\n",
"])\n",
"composite_curve = CompositeCurve([turn_curve, cubic_curve])\n",
"instruments = [\n",
" IRS(dt(2022, 12, 1), \"1d\", \"A\", curves=turn_curve),\n",
" Spread(\n",
" IRS(dt(2022, 12, 30), \"1d\", \"A\", curves=turn_curve),\n",
" IRS(dt(2022, 12, 31), \"1d\", \"A\", curves=turn_curve),\n",
" ),\n",
" IRS(dt(2023, 1, 1), \"1d\", \"A\", curves=turn_curve),\n",
" IRS(dt(2022, 12, 1), \"20d\", \"A\", curves=composite_curve),\n",
" IRS(dt(2022, 12, 21), \"20d\", \"A\", curves=composite_curve),\n",
" IRS(dt(2023, 1, 11), \"18d\", \"A\", curves=composite_curve),\n",
"]\n",
"solver = Solver(\n",
" curves=[turn_curve, cubic_curve, composite_curve], \n",
" instruments=instruments, \n",
" s=[0.0, -50.0, 0.0, 2.01, 2.175, 2.35],\n",
" instrument_labels=[\"zero1\", \"turn\", \"zero2\", \"irs1\", \"irs2\", \"irs3\"],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f418e922-efc7-4eb6-a715-46a5b12ae319",
"metadata": {},
"outputs": [],
"source": [
"composite_curve.plot(\"1b\")"
]
},
{
"cell_type": "markdown",
"id": "a95663da-9904-4d57-9990-ffb3f9509672",
"metadata": {},
"source": [
"### Irrational turns on tenor curves"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e94c4fbc-7a59-46bc-9770-3c115c82c298",
"metadata": {},
"outputs": [],
"source": [
"turn_curve = LineCurve({\n",
" dt(2022, 9, 15): 0.0,\n",
" dt(2022, 10, 1): -0.20,\n",
" dt(2023, 1, 1): 0.0,\n",
"}, interpolation=\"flat_forward\")\n",
"fading_turn_curve = LineCurve({\n",
" dt(2022, 9, 15): 0.0,\n",
" dt(2022, 9, 30): 0.0,\n",
" dt(2022, 10, 1): -0.20,\n",
" dt(2022, 12, 31): -0.04,\n",
" dt(2023, 1, 1): 0.0,\n",
" dt(2023, 3, 15): 0.0,\n",
"}, interpolation=\"linear\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "322b92ab-e10f-47b0-8847-5ae6e0eb5768",
"metadata": {},
"outputs": [],
"source": [
"line_curve = LineCurve({\n",
" dt(2022, 9, 15): 1.0,\n",
" dt(2022, 12, 15): 1.0,\n",
" dt(2023, 3, 15): 1.0,\n",
"}, interpolation=\"linear\")\n",
"composite_curve=CompositeCurve([fading_turn_curve, line_curve], id=\"cc\")\n",
"instruments = [\n",
" Value(dt(2022, 9, 15), curves=fading_turn_curve),\n",
" Value(dt(2022, 9, 30), curves=fading_turn_curve),\n",
" Value(dt(2022, 10, 1), curves=fading_turn_curve),\n",
" Value(dt(2022, 12, 31), curves=fading_turn_curve),\n",
" Value(dt(2023, 1, 1), curves=fading_turn_curve),\n",
" Value(dt(2023, 3, 15), curves=fading_turn_curve),\n",
" Value(dt(2022, 9, 15), curves=composite_curve),\n",
" Value(dt(2022, 12, 15), curves=composite_curve),\n",
" Value(dt(2023, 3, 15), curves=composite_curve),\n",
"]\n",
"solver = Solver(\n",
" curves=[fading_turn_curve, line_curve, composite_curve], \n",
" instruments=instruments, \n",
" s=[0.0, 0.0, -0.2, -0.04, 0.0, 0.0, 3.5, 3.7, 4.05],\n",
" instrument_labels=[\"zero1\", \"zero2\", \"turnA\", \"turnB\", \"zero3\", \"zero4\", \"fra1\", \"fra2\", \"fra3\"],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "de87d60c-351e-4e19-b380-a4d24b97b956",
"metadata": {},
"outputs": [],
"source": [
"composite_curve.plot(\"1b\")"
]
},
{
"cell_type": "markdown",
"id": "5b810412-99f3-4192-8b67-a3beeee18fb4",
"metadata": {},
"source": [
"# Analysing roll on trade strategies"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "74f4c34a-ff5d-4c34-9fa1-ad208e13d8cf",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve(\n",
" nodes={\n",
" dt(2024, 1, 1): 1.0,\n",
" dt(2025, 1, 1): 0.96,\n",
" dt(2026, 1, 1): 0.935,\n",
" dt(2027, 1, 1): 0.915,\n",
" },\n",
" convention=\"act360\",\n",
" t=[\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1),\n",
" dt(2025, 1, 1), dt(2026, 1, 1),\n",
" dt(2027, 1, 1), dt(2027, 1, 1), dt(2027, 1, 1), dt(2027, 1, 1)\n",
" ],\n",
")\n",
"irs = IRS(\n",
" effective=dt(2024, 1, 1),\n",
" termination=\"18m\",\n",
" spec=\"usd_irs\",\n",
")\n",
"irs.rate(curve)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "179e8bac-63d9-4eef-a61d-25d284dd7a76",
"metadata": {},
"outputs": [],
"source": [
"irs.rate(curve.roll(\"6w\"))"
]
},
{
"cell_type": "markdown",
"id": "066f8cf4-47e3-46cf-adff-8487abbf3e17",
"metadata": {},
"source": [
"# Stepping underspecified Curves on central bank effective dates"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "118da85c-15bb-46ff-902a-c2cd40893073",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve(\n",
" nodes={\n",
" dt(2024, 1, 31): 1.00, dt(2024, 2, 2): 1.00, dt(2024, 3, 13): 1.00, \n",
" dt(2024, 4, 17): 1.0, dt(2024, 6, 12): 1.0, dt(2024, 7, 24): 1.0,\n",
" dt(2024, 9, 18): 1.0, dt(2024, 10, 23): 1.0, dt(2024, 12, 18): 1.0,\n",
" dt(2025, 1, 29): 1.0, dt(2025, 7, 31): 1.0,\n",
" },\n",
" convention=\"act360\", interpolation=\"log_linear\", calendar=\"tgt\", id=\"estr\",\n",
")\n",
"instruments = [\n",
" IRS(dt(2024, 1, 31), \"1b\", spec=\"eur_irs\", curves=\"estr\"), # O/N rate\n",
" IRS(dt(2024, 2, 2), dt(2024, 3, 13), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 3, 13), dt(2024, 4, 17), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 3, 20), dt(2024, 6, 19), spec=\"eur_irs\", curves=\"estr\"), # IMM\n",
" IRS(dt(2024, 6, 19), dt(2024, 9, 18), spec=\"eur_irs\", curves=\"estr\"), # IMM\n",
" IRS(dt(2024, 9, 18), dt(2024, 12, 18), spec=\"eur_irs\", curves=\"estr\"), # IMM\n",
" IRS(dt(2024, 12, 18), dt(2025, 3, 19), spec=\"eur_irs\", curves=\"estr\"), # IMM\n",
"]\n",
"pps = [ # policy periods\n",
" IRS(dt(2024, 2, 2), dt(2024, 3, 13), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 3, 13), dt(2024, 4, 17), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 4, 17), dt(2024, 6, 12), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 6, 12), dt(2024, 7, 24), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 7, 24), dt(2024, 9, 18), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 9, 18), dt(2024, 10, 2), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 10, 23), dt(2024, 12, 18), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2024, 12, 18), dt(2025, 1, 29), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
" IRS(dt(2025, 1, 29), dt(2025, 3, 15), spec=\"eur_irs\", curves=\"estr\"), # MPC\n",
"]\n",
"curvature = [\n",
" Fly(pps[2], pps[3], pps[4]), \n",
" Fly(pps[4], pps[5], pps[6]), \n",
" Fly(pps[6], pps[7], pps[8]),\n",
"]\n",
"solver = Solver(\n",
" curves=[curve],\n",
" instruments=instruments+curvature,\n",
" weights=[1.0] * 7 + [1e-8] * 3,\n",
" s=[3.899, 3.904, 3.859, 3.692, 3.215, 2.725, 2.37] + [0.0] * 3,\n",
" instrument_labels=[\n",
" \"depo\", \"1r\", \"2r\", \"1f\", \"2f\", \"3f\", \"4f\", \"cv0\", \"cv1\", \"cv2\"\n",
" ],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bc6cdbaa-255c-4c33-b163-0d2a14a0f57a",
"metadata": {},
"outputs": [],
"source": [
"curve.plot(\"1b\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/CurveSolving.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"id": "95844b55-1388-4bed-ae0e-63dd3296d868",
"metadata": {},
"source": [
"### This chapter on Curve Solving has no actionable 'rateslib' code listing"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Curves.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"id": "f8825706-c252-40d7-8075-b438f5756093",
"metadata": {},
"source": [
"# Curves\n",
"\n",
"### CompositeCurve example\n",
"\n",
"The first section here regards efficient operations and compositing two curves."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c88c3ce0-72f1-4182-a6c0-36209ccc9954",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import dt, defaults\n",
"from rateslib.curves import Curve, LineCurve, CompositeCurve, MultiCsaCurve"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9cbc5699-fa68-46cd-8e75-3752d078977c",
"metadata": {},
"outputs": [],
"source": [
"line_curve1 = LineCurve({dt(2022, 1, 1): 2.0, dt(2022, 1, 3): 4.0}, id=\"C1_\")\n",
"line_curve2 = LineCurve({dt(2022, 1, 1): 0.5, dt(2022, 1, 3): 1.0}, id=\"C2_\")\n",
"composite_curve = CompositeCurve(curves=(line_curve1, line_curve2))\n",
"composite_curve.rate(dt(2022, 1, 2))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fd5f49ac-ed99-4422-844a-13c657b823f1",
"metadata": {},
"outputs": [],
"source": [
"line_curve1._set_ad_order(1)\n",
"line_curve2._set_ad_order(1)\n",
"composite_curve.rate(dt(2022, 1, 2))"
]
},
{
"cell_type": "markdown",
"id": "8cb305f5-19a5-46b6-a9f2-82a2bd1f6592",
"metadata": {},
"source": [
"The code above demonstrates the summing of individual rates and of interoperability with Dual datatypes.\n",
"\n",
"Below measures rate lookup."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cd18dd64-5f2c-47ed-8039-284be1c8fc33",
"metadata": {},
"outputs": [],
"source": [
"defaults.curve_caching = False\n",
"\n",
"composite_curve = CompositeCurve(\n",
" (\n",
" Curve({dt(2022, 1, 1): 1.0, dt(2024, 1, 1): 0.95}, id=\"C1_\"),\n",
" Curve({dt(2022, 1, 1): 1.0, dt(2024, 1, 1): 0.99}, id=\"C2_\"),\n",
" )\n",
")\n",
"%timeit composite_curve.rate(dt(2022, 6, 1), \"1y\") "
]
},
{
"cell_type": "markdown",
"id": "ef56982a-2ffc-45f5-9c2b-08517f22f026",
"metadata": {},
"source": [
"### MultiCsaCurve"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ec3bb527-c507-43bf-ad2e-e744ad40e351",
"metadata": {},
"outputs": [],
"source": [
"c1 = Curve({dt(2022, 1, 1): 1.0, dt(2052, 1, 1): 0.5})\n",
"c2 = Curve({dt(2022, 1, 1): 1.0, dt(2032, 1, 1): 0.4, dt(2052, 1, 1):0.39}) \n",
"mcc = MultiCsaCurve([c1, c2])\n",
"\n",
"%timeit c2[dt(2052, 1, 1)]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "78b70fb7-d04d-478c-8509-0e1f5c42573f",
"metadata": {},
"outputs": [],
"source": [
"%timeit mcc[dt(2052, 1, 1)]"
]
},
{
"cell_type": "markdown",
"id": "b658689c-65f2-4aae-992a-7fbf61f5d2c4",
"metadata": {},
"source": [
"### Error in approximated rates and execution time"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "973e0754-edfc-42ce-9d0c-d2272c69465f",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"MIN, MAX, SAMPLES, DAYS, d = 0, 4, 100000, 3, 1.0/365\n",
"c1 = np.random.rand(DAYS, SAMPLES) * (MAX - MIN) + MIN\n",
"c2 = np.random.rand(DAYS, SAMPLES) * (MAX - MIN) + MIN\n",
"r_true=((1 + d * (c1 + c2) / 100).prod(axis=0) - 1) * 100 / (d * DAYS)\n",
"c1_bar = ((1 + d * c1 / 100).prod(axis=0)**(1/DAYS) - 1) * 100 / d\n",
"c2_bar = ((1 + d * c2 / 100).prod(axis=0)**(1/DAYS) - 1) * 100 / d\n",
"r_bar = ((1 + d * (c1_bar + c2_bar) / 100) ** DAYS - 1) * 100 / (d * DAYS)\n",
"np.histogram(np.abs(r_true-r_bar), bins=[0, 5e-7, 1e-6, 5e-6, 1e-5, 5e-5, 1]) "
]
},
{
"cell_type": "markdown",
"id": "5f2769bb-0f25-4d5e-996f-5684e1f18a26",
"metadata": {},
"source": [
"### Curve operations: shift"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "64caaec4-072a-4dd5-a9ef-ac4b95852a7f",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98}, convention=\"Act365F\", id=\"v\", ad=1)\n",
"curve.rate(dt(2022, 6, 1), \"1b\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "90928588-dc74-4886-a044-8d6f69b9cfcf",
"metadata": {},
"outputs": [],
"source": [
"shifted_curve = curve.shift(50)\n",
"shifted_curve.rate(dt(2022, 6, 1), \"1b\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b488431e-7e87-4195-9cf0-82f10a3d9bd0",
"metadata": {},
"outputs": [],
"source": [
"type(shifted_curve)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9803bfc3-52ce-4480-a972-a6aee2f9f100",
"metadata": {},
"outputs": [],
"source": [
"%timeit curve.rate(dt(2022, 6, 1), \"1b\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d66ee277-43e7-4f5a-9d2f-2c72c6e76a15",
"metadata": {},
"outputs": [],
"source": [
"%timeit shifted_curve.rate(dt(2022, 6, 1), \"1b\")"
]
},
{
"cell_type": "markdown",
"id": "327672ae-28af-4e15-bfe1-0b5a52cedcc8",
"metadata": {},
"source": [
"### Curve operations: roll"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6e4e86f8-ff29-48bb-a7f7-9985aa2f0748",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve(\n",
" nodes={dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98, dt(2024, 1, 1): 0.97},\n",
" t=[dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1),\n",
" dt(2023, 1, 1),\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)]\n",
")\n",
"print(curve.rate(dt(2022, 6, 1), \"1d\"))\n",
"print(curve.roll(\"30d\").rate(dt(2022, 7, 1), \"1d\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d4e5fc59-aa88-48ec-a7f6-e5d13b10b1f3",
"metadata": {},
"outputs": [],
"source": [
"line_curve = LineCurve(\n",
" nodes={dt(2022, 1, 1): 2.0, dt(2023, 1, 1): 2.6, dt(2024, 1, 1): 2.5},\n",
" t=[dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1),\n",
" dt(2023, 1, 1),\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)]\n",
")\n",
"print(line_curve.rate(dt(2022, 6, 1)))\n",
"print(line_curve.roll(\"-31d\").rate(dt(2022, 5, 1), \"1d\"))"
]
},
{
"cell_type": "markdown",
"id": "44ebfa6c-72ee-473e-9299-e1727a8884b7",
"metadata": {},
"source": [
"### Curve operations: translate"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bdf0aca9-39e0-406b-9d64-9bfcfc9ffed6",
"metadata": {},
"outputs": [],
"source": [
"for interpolation in [\n",
" \"linear\", \"log_linear\", \"linear_index\", \"flat_forward\", \"flat_backward\", \"linear_zero_rate\"\n",
"]:\n",
" curve = Curve(\n",
" nodes={dt(2022, 1, 1): 1.0, dt(2022, 2, 1):0.998, dt(2022, 3, 1): 0.995}, \n",
" interpolation=interpolation\n",
" )\n",
" curve_translated = curve.translate(dt(2022, 1, 15)) \n",
" print(\n",
" curve.rate(dt(2022, 2, 15), \"1d\"),\n",
" curve_translated.rate(dt(2022, 2, 15), \"1d\") \n",
" )"
]
},
{
"cell_type": "markdown",
"id": "ee9951a7-1eea-4255-9e5c-2a4818983598",
"metadata": {},
"source": [
"### Operations on CompositeCurves"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8fff533b-4ee2-4405-b6e3-bdf4fe53aadf",
"metadata": {},
"outputs": [],
"source": [
"composite_curve.rate(dt(2022, 6, 1), \"1d\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53409cb5-9512-43f1-8e9c-cb1886ed1f6e",
"metadata": {},
"outputs": [],
"source": [
"composite_curve.shift(50).rate(dt(2022, 6, 1), \"1d\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "89680e78-5318-4b56-af1d-8be7dae90ca4",
"metadata": {},
"outputs": [],
"source": [
"composite_curve.roll(\"30d\").rate(dt(2022, 7, 1), \"1d\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b23d6958-903a-4442-98a7-d5585fe4d56c",
"metadata": {},
"outputs": [],
"source": [
"composite_curve.translate(dt(2022, 5, 1)).rate(dt(2022, 6, 1), \"1d\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/FXRates.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "48397019-8e34-4802-9f82-eba040e083fd",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import FXRates, FXForwards, Dual, dt, Curve, gradient\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"id": "26a71ddc-8f7a-4b70-a032-e80abfeded61",
"metadata": {},
"source": [
"# Defined FXRates Systems - Errors"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9562c03a-5c29-4260-8470-392cc7ba21c1",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" FXRates(fx_rates={\"usdeur\": 0.9, \"noksek\": 1.10})\n",
"except ValueError as e:\n",
" print(e)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d5680fe-26fc-4b37-babe-9b6156195eac",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" FXRates(fx_rates={\"usdeur\": 0.9, \"gbpusd\": 1.10, \"eurgbp\": 1.124})\n",
"except ValueError as e:\n",
" print(e)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8e89f984-8ae4-490a-8dd1-dad6e72159bb",
"metadata": {},
"outputs": [],
"source": [
"try:\n",
" FXRates ( fx_rates ={\" usdeur \": 0.90 , \" eurusd \": 1.11 , \" noksek \": 1.10})\n",
"except ValueError as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "79afcdf3-34ca-440b-94c1-85d58ad8303c",
"metadata": {},
"source": [
"# FXRates Array"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9de92e9f-a7cd-4701-9900-510ba9d72cba",
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates({\"usdeur\": 2.0, \"usdgbp\": 2.5})\n",
"from rateslib.dual.utils import _dual_float\n",
"np.reshape([_dual_float(_) for _ in fxr.fx_array.ravel()], (3,3))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e4595d60-9093-410c-a256-49e5faab4bc1",
"metadata": {},
"outputs": [],
"source": [
"fxr.rate(\"eurgbp\")"
]
},
{
"cell_type": "markdown",
"id": "7512e613-2166-4cdb-a48e-648ebb47fcfe",
"metadata": {},
"source": [
"# Representation via Dual"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e9e9569b-2de9-49bb-8978-e6421721768f",
"metadata": {},
"outputs": [],
"source": [
"1e6 * (1/8.0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4d5d77d6-8b33-4b1b-8153-fa16531149f1",
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates({\"usdnok\": 8.0})\n",
"fxr.convert(1e6, \"nok\", \"usd\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9ba025b2-e121-4875-8d93-daebc796e967",
"metadata": {},
"outputs": [],
"source": [
"fxr._set_ad_order(2)\n",
"fxr.convert(1e6, \"nok\", \"usd\")"
]
},
{
"cell_type": "markdown",
"id": "40b16a07-dd1d-46e3-a3cc-413dd874fe6f",
"metadata": {},
"source": [
"# Cash positions and base value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "88061cf6-1fca-4171-87bc-a1f1c1b20819",
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates({\"usdnok\": 8.0})\n",
"fxr.currencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f4fa9823-f17a-4c2d-b4fc-cb7ea8ce213f",
"metadata": {},
"outputs": [],
"source": [
"# convert cash positions into an aggregated NOK value\n",
"base_nok_value = fxr . convert_positions ([0 , 1000000] , \"nok\")\n",
"base_nok_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8fec05c6-f5c2-4e39-957e-eacb87b6a323",
"metadata": {},
"outputs": [],
"source": [
"# Convert cash positions into an aggregated USD value\n",
"base_usd_value = fxr.convert_positions ([0 , 1000000] , \"usd\")\n",
"base_usd_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "058b7041-784d-44ab-8224-6b529e7d8a18",
"metadata": {},
"outputs": [],
"source": [
"# Convert an aggregated USD value back to cash positions\n",
"positions = fxr.positions(base_usd_value , \"usd\")\n",
"positions"
]
},
{
"cell_type": "markdown",
"id": "d6a071c6-9629-47f5-90cd-e12c9f1d363c",
"metadata": {},
"source": [
"### Introducing additional currency exposures"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a3929f34-f705-4bfa-baaf-e4fe39d10360",
"metadata": {},
"outputs": [],
"source": [
"fxr = FXRates ({\"usdeur\": 0.9 , \"eurnok \": 8.888889})\n",
"fxr.currencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "132afa56-41cf-4832-a72f-f42e1bc2af69",
"metadata": {},
"outputs": [],
"source": [
"base_value = fxr.convert_positions ([0 , 0, 1000000] , \"usd\")\n",
"base_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d8ce0e36-9e05-444f-a4a9-5e5f7194cf0c",
"metadata": {},
"outputs": [],
"source": [
"positions = fxr.positions(base_value, \"usd\")\n",
"positions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "75a8e694-06de-49d5-ac54-fc6cfc766058",
"metadata": {},
"outputs": [],
"source": [
"base_usd_value = Dual(125000 , [\"fx_usdnok\"], [-15625])\n",
"positions = fxr.positions(base_usd_value, \"usd\")\n",
"positions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e310fc72-cd0b-4ec2-accd-fa8bc9d864bf",
"metadata": {},
"outputs": [],
"source": [
"fxr.convert_positions(positions, \"usd\")"
]
},
{
"cell_type": "markdown",
"id": "fb72ccf5-49c2-49a8-80f5-f66e2da6c800",
"metadata": {},
"source": [
"### Re-expression in Majors or Crosses"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e8c647e5-387b-4da2-962d-57b6b6ec6edd",
"metadata": {},
"outputs": [],
"source": [
"fxr_crosses = FXRates({\"eurusd\": 1.0 , \"gbpjpy\": 100 , \"eurjpy\": 100})\n",
"fxr_crosses.convert(1, \"usd\", \"jpy\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d88c1c0-b5d4-4021-b9ca-36efd17e5710",
"metadata": {},
"outputs": [],
"source": [
"fxr_majors = fxr_crosses.restate ([\"eurusd\", \"usdjpy\", \"gbpusd\"])\n",
"fxr_majors.convert(1, \"usd\", \"jpy\")"
]
},
{
"cell_type": "markdown",
"id": "8726169a-e1e2-4f75-a5c0-4dc83f37aa02",
"metadata": {},
"source": [
"# FXForwards"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8256869c-9b79-4018-9793-65d9f067c464",
"metadata": {},
"outputs": [],
"source": [
"fx_rates = FXRates ({\"usdeur\": 0.9 , \"eurnok\": 8.888889} , dt(2022, 1, 3))\n",
"fx_curves = {\n",
" # local currency curves first\n",
" \"usdusd\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.96}),\n",
" \"eureur\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.99}),\n",
" \"noknok\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.98}),\n",
" # cross - currency collateral curves next\n",
" \"eurusd\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.991}) ,\n",
" \"nokeur\": Curve({dt(2022, 1, 1): 1.0, dt(2023, 1, 1): 0.978}) ,\n",
"}\n",
"fxf = FXForwards(fx_rates, fx_curves)\n",
"fxf.rate(\"usdnok\", dt(2022, 8, 15))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "308b549d-6c64-4c50-bf85-71cbdb8e838d",
"metadata": {},
"outputs": [],
"source": [
"fxf.currencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c86ef618-595e-4690-9849-70a86af32a02",
"metadata": {},
"outputs": [],
"source": [
"# Paths are expressed by indexed currencies: 1 = \"EUR\"\n",
"fxf._paths"
]
},
{
"cell_type": "markdown",
"id": "1c64ab97-058b-4e16-bfa0-6238d36c0a60",
"metadata": {},
"source": [
"### Equivalence of Delta Risk"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "14ba7ac1-3597-455d-b638-16dc75b62155",
"metadata": {},
"outputs": [],
"source": [
"fx_rates = FXRates({\"usdeur\": 0.9, \"eurnok\": 8.888889}, dt(2022 , 1, 3))\n",
"start, end = dt(2022, 1, 1), dt(2023, 1, 1)\n",
"fx_curves = {\n",
" \"usdusd\": Curve({start: 1.0 , end: 0.96}, id=\"uu\", ad=1) ,\n",
" \"eureur\": Curve({start: 1.0 , end: 0.99}, id=\"ee\", ad=1) ,\n",
" \"eurusd\": Curve({start: 1.0 , end: 0.991}, id=\"eu\", ad=1) ,\n",
" \"noknok\": Curve({start: 1.0 , end: 0.98}, id=\"nn\", ad=1) ,\n",
" \"nokeur\": Curve({start: 1.0 , end: 0.978}, id=\"ne\", ad=1) ,\n",
"}\n",
"fxf = FXForwards(fx_rates, fx_curves)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a307d877-f53e-4d1c-bdfd-3910dbcf044e",
"metadata": {},
"outputs": [],
"source": [
"discounted_nok = fx_curves[\"nokeur\"][dt(2022, 8, 15)] * 1000\n",
"base_value_1 = discounted_nok * fxf.rate(\"nokusd\", dt(2022 , 1, 1))\n",
"base_value_1"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "feb226d6-fb62-4b50-b000-1dd7d986c5ad",
"metadata": {},
"outputs": [],
"source": [
"gradient(base_value_1, [\"uu1\", \"ee1\", \"eu1\", \"nn1\", \"ne1\", \"fx_usdeur\", \"fx_eurnok\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff513fb7-82ac-4ab7-a0b9-db13522b1052",
"metadata": {},
"outputs": [],
"source": [
"forward_eur = fxf.rate(\"nokeur\", dt(2022, 8, 15)) * 1000\n",
"discounted_eur = forward_eur * fx_curves[\"eureur\"][dt(2022, 8, 15)]\n",
"base_value_2 = discounted_eur * fxf.rate(\"eurusd\", dt(2022, 1, 1))\n",
"base_value_2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13543dab-b1c3-472f-a64d-641c8014de2b",
"metadata": {},
"outputs": [],
"source": [
"gradient(base_value_2, [\"uu1\", \"ee1\", \"eu1\", \"nn1\", \"ne1\", \"fx_usdeur\", \"fx_eurnok\"])"
]
},
{
"cell_type": "markdown",
"id": "e68ee47b-b557-4ad0-bfa8-61660922841c",
"metadata": {},
"source": [
"# Combining Settlement dates"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce5bb6b0-aa86-41ba-bd60-8244ee9ded1a",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve ({ dt (2000 , 1, 1): 1.0 , dt (2001 , 1, 1): 0.99})\n",
"fxr1 = FXRates ({\"eurusd\": 1.10 , \"gbpusd\": 1.30} , settlement =dt (2000 , 1, 1))\n",
"fxr2 = FXRates ({\"usdcad\": 1.05} , settlement =dt (2000 , 1, 2))\n",
"fxr3 = FXRates ({\"gbpjpy\": 100.0} , settlement =dt (2000 , 1, 3))\n",
"try:\n",
" fxf = FXForwards (\n",
" fx_curves ={\n",
" \"usdusd\": curve, \"eureur\": curve, \"gbpgbp\": curve,\n",
" \"jpyjpy\": curve, \"cadcad\": curve, \"usdjpy\": curve,\n",
" \"eurjpy\": curve, \"eurcad\": curve, \"gbpcad\": curve,\n",
" },\n",
" fx_rates =[fxr1, fxr2, fxr3]\n",
" )\n",
"except ValueError as e:\n",
" print(e)"
]
},
{
"cell_type": "markdown",
"id": "19c3f55b-6e41-4fea-b057-5c71d1457f38",
"metadata": {},
"source": [
"### Dual represenation"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2cc50ab7-f56f-4f2a-bacb-d7c98604a854",
"metadata": {},
"outputs": [],
"source": [
"pv = Dual(100000 , [\"fx_eurusd\", \"fx_usdcad\"], [-100000 , 150000]) # base is USD"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4eb92a49-fd50-4fb6-a23a-9111e5a6d5e1",
"metadata": {},
"outputs": [],
"source": [
"fxr1 = FXRates ({\"eurusd\": 1.05} , settlement=dt(2022, 1, 3))\n",
"fxr2 = FXRates ({\"usdcad\": 1.1} , settlement=dt(2022, 1, 2))\n",
"fxf = FXForwards (\n",
" fx_rates =[fxr1, fxr2],\n",
" fx_curves ={\n",
" \"usdusd\": Curve ({dt(2022, 1, 1): 1.0 , dt(2022, 2, 1): 0.999}) ,\n",
" \"eureur\": Curve ({dt(2022, 1, 1): 1.0 , dt(2022, 2, 1): 0.999}) ,\n",
" \"cadcad\": Curve ({dt(2022, 1, 1): 1.0 , dt(2022, 2, 1): 0.999}) ,\n",
" \"usdeur\": Curve ({dt(2022, 1, 1): 1.0 , dt(2022, 2, 1): 0.999}) ,\n",
" \"cadusd\": Curve ({dt(2022, 1, 1): 1.0 , dt(2022, 2, 1): 0.999}) ,\n",
" }\n",
")\n",
"fxf.positions(pv, base=\"usd\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/FXVolatility.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "477eccd6-a966-41f8-b6db-954a2e3a09b0",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import *\n",
"from pandas import Series"
]
},
{
"cell_type": "markdown",
"id": "ffb96542-04f8-46cb-865f-4ebc8681cb93",
"metadata": {},
"source": [
"### Time Weighting for Volatility Surface"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "89f7bc83-a5e0-41be-8f6f-36cd9694a684",
"metadata": {},
"outputs": [],
"source": [
"fxv = FXDeltaVolSurface( \n",
" eval_date=dt(2024, 7, 25),\n",
" expiries=[dt(2024, 7, 30), dt(2024, 8, 5)], \n",
" delta_indexes=[0.5],\n",
" node_values =[[10.0] , [10.0]] , \n",
" weights=Series(0.1, index=[\n",
" dt(2024, 7, 27), dt(2024, 7, 28), dt(2024, 8, 3), dt(2024, 8, 4)]\n",
" ),\n",
" delta_type=\"forward\", \n",
")\n",
"print(fxv.meta.weights[dt(2024, 7, 25):dt(2024, 8, 5)])"
]
},
{
"cell_type": "markdown",
"id": "67cdacf9-ba83-4433-aada-76b489ba78f0",
"metadata": {},
"source": [
"### Sticky strike, sticky delta and Solver delta"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9d3e0eef-4831-4536-a7ee-789db442a18d",
"metadata": {},
"outputs": [],
"source": [
"# Define Curves\n",
"usd = Curve({dt(2024, 5, 7): 1.0, dt(2024, 5, 30): 1.0}, calendar=\"nyc\", id=\"usd\") \n",
"eur = Curve({dt(2024, 5, 7): 1.0, dt(2024, 5, 30): 1.0}, calendar=\"tgt\", id=\"eur\") \n",
"eurusd = Curve({dt(2024, 5, 7): 1.0, dt(2024, 5, 30): 1.0}, id=\"eurusd\")\n",
"\n",
"# Create an FX Forward market with spot FX rate data\n",
"spot = dt(2024, 5, 9)\n",
"fxr = FXRates({\"eurusd\": 1.0760}, settlement=spot) \n",
"fxf = FXForwards(\n",
" fx_rates=fxr, \n",
" fx_curves={\"eureur\": eur, \"usdusd\": usd, \"eurusd\": eurusd},\n",
")\n",
"\n",
"# Solve the Curves to market\n",
"pre_solver = Solver(\n",
" curves=[eur, eurusd, usd], \n",
" instruments=[\n",
" IRS(spot, \"3W\", spec=\"eur_irs\", curves=\"eur\"),\n",
" IRS(spot, \"3W\", spec=\"usd_irs\", curves=\"usd\"),\n",
" FXSwap(spot, \"3W\", pair=\"eurusd\", curves=[None, \"eurusd\", None, \"usd\"]),\n",
" ],\n",
" s=[3.90, 5.32, 8.85], \n",
" fx=fxf,\n",
" id=\"fxf\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "98f143f4-adbc-40f0-a205-6291488cec5c",
"metadata": {},
"outputs": [],
"source": [
"# Define the Vol Smile\n",
"smile = FXSabrSmile(\n",
" nodes={\"alpha\": 0.05, \"beta\": 1.0, \"rho\": 0.01, \"nu\": 0.03}, \n",
" eval_date=dt(2024, 5, 7),\n",
" expiry=dt(2024, 5, 28),\n",
" id=\"smile\",\n",
" pair=\"eurusd\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4aa1bb20-522a-4c49-9ebf-88f11f214d5d",
"metadata": {},
"outputs": [],
"source": [
"# Collect FXOption arguments\n",
"option_args = dict(\n",
" pair=\"eurusd\",\n",
" expiry=dt(2024, 5, 28), \n",
" calendar=\"tgt|fed\", \n",
" delta_type=\"spot\",\n",
" curves=[None, \"eurusd\", None, \"usd\"], \n",
" vol=\"smile\",\n",
")\n",
"# Calibrate the Smile to market option data\n",
"solver = Solver( \n",
" pre_solvers=[pre_solver], \n",
" curves=[smile],\n",
" instruments=[\n",
" FXStraddle(strike=\"atm_delta\", **option_args),\n",
" FXRiskReversal(strike=(\"-25d\", \"25d\"), **option_args),\n",
" FXRiskReversal(strike=(\"-10d\", \"10d\"), **option_args),\n",
" FXBrokerFly(strike=((\"-25d\", \"25d\"), \"atm_delta\"), **option_args),\n",
" FXBrokerFly(strike=((\"-10d\", \"10d\"), \"atm_delta\"), **option_args),\n",
" ],\n",
" s=[5.493, -0.157, -0.289, 0.071, 0.238],\n",
" fx=fxf,\n",
" id=\"smile\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6205d317-42ab-41fa-9fc2-a1dd6cbd4a37",
"metadata": {},
"outputs": [],
"source": [
"fxc = FXCall(**option_args, notional=100e6, strike =1.07, premium=982144.59) # <-- mid-market premium giving zero NPV"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5cfde62c-8f0f-4c09-abd7-251dc617300f",
"metadata": {},
"outputs": [],
"source": [
"fxc.delta(solver=solver).loc[(\"fx\", \"fx\", \"eurusd\")]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5215023d-bb18-45fd-abc6-e9d77da2e99d",
"metadata": {},
"outputs": [],
"source": [
"fxc.gamma(solver=solver).loc[(\"usd\", \"usd\", \"fx\", \"fx\", \"eurusd\"), (\"fx\", \"fx\", \"eurusd\")]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "892be093-60d4-4054-a7e2-eb1da01a377b",
"metadata": {},
"outputs": [],
"source": [
"fxr.update({\"eurusd\": 1.0761})\n",
"pre_solver.iterate()\n",
"solver.iterate()\n",
"fxc.npv(solver=solver)"
]
},
{
"cell_type": "markdown",
"id": "2466685c-5b21-421e-a2db-3c78b7c46733",
"metadata": {},
"source": [
"### Sticky delta"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86a640c0-fb02-41ab-855b-d8dd745fb5a8",
"metadata": {},
"outputs": [],
"source": [
"fxc.analytic_greeks(solver=solver)[\"delta_sticky\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7672a3fd-69ba-4e8e-907b-bd60a989a079",
"metadata": {},
"outputs": [],
"source": [
"fxc.analytic_greeks(solver=solver)[\"delta\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "947fc271-0d9a-4050-9c1c-a0268b8625d0",
"metadata": {},
"outputs": [],
"source": [
"option_args = dict(\n",
" pair=\"eurusd\",\n",
" expiry=dt(2024, 5, 28), \n",
" calendar=\"tgt|fed\", \n",
" delta_type=\"forward\",\n",
" curves=[None, \"eurusd\", None, \"usd\"], \n",
" vol=\"smile\",\n",
")\n",
"fxc = FXCall(**option_args, notional=100e6, strike =1.07, premium=982144.59) # <-- mid-market premium giving zero NPV\n",
"fxc.analytic_greeks(solver=solver)[\"delta_sticky\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51e3b16d-d6b3-4183-bda5-374859727d73",
"metadata": {},
"outputs": [],
"source": [
"fxc.analytic_greeks(solver=solver)[\"delta\"]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Instruments.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "07490ad9-c75c-403e-83d5-9f808360b49e",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import FixedRateBond, dt, Bill, IndexFixedRateBond"
]
},
{
"cell_type": "markdown",
"id": "e8200863-fdbf-499f-82f0-88298eced48f",
"metadata": {},
"source": [
"# Bond analogue methods"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "42cba7c3-f7e0-43df-8b3b-0d9a8c5f2367",
"metadata": {},
"outputs": [],
"source": [
"bond = FixedRateBond (\n",
" effective=dt(2022, 1, 1) ,\n",
" termination=dt(2023, 1, 1) ,\n",
" fixed_rate=5.0,\n",
" spec =\"uk_gb\",\n",
")\n",
"bond.accrued(dt(2022, 4, 15))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1725b831-3372-4100-a24e-2dc1a6b0b4d9",
"metadata": {},
"outputs": [],
"source": [
"bond = FixedRateBond (\n",
" effective=dt(2022, 1, 1) ,\n",
" termination=dt(2023, 1, 1) ,\n",
" fixed_rate=5.0,\n",
" spec =\"ca_gb\",\n",
")\n",
"bond.accrued(dt(2022, 4, 15))"
]
},
{
"cell_type": "markdown",
"id": "3cdcce1b-f71a-4104-82c8-f6cc60063409",
"metadata": {},
"source": [
"### YTM iteration"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c943458-8b8b-4a67-9ea6-f6e31dbc8e2b",
"metadata": {},
"outputs": [],
"source": [
"bond = FixedRateBond (\n",
" effective=dt(2000 , 1, 1) , termination =dt(2010 , 1, 1) ,\n",
" fixed_rate=2.5 , spec=\"us_gb\"\n",
")\n",
"bond.ytm(95.0, settlement=dt(2000, 7, 1))\n",
"# ( -3.0000 , 2.0000 , 12.0000) - Initial interval requires 4 function evaluations\n",
"# (2.0000 , 3.2858 , 12.0000) - Second interval requires 1 function evaluation\n",
"# (2.0000 , 3.1063 , 3.2858) - Third interval requires 1 function evaluation\n",
"# (3.1063 , 3.1120 , 3.2858) - Fourth interval requires 1 function evaluation"
]
},
{
"cell_type": "markdown",
"id": "7abe6651-eb34-466f-9b5f-745da0b8dcb2",
"metadata": {},
"source": [
"# Bills"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1c5d9f53-aea1-4307-836d-5338cff04346",
"metadata": {},
"outputs": [],
"source": [
"bill = Bill(\n",
" effective=dt(2023, 5, 17),\n",
" termination=dt(2023, 9, 26),\n",
" spec=\"us_gbb\"\n",
")\n",
"bill.ytm(99.75, settlement=dt(2023 , 9, 7))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5a24a850-47c8-41fd-b6a3-b5f7fd3806d7",
"metadata": {},
"outputs": [],
"source": [
"bond = FixedRateBond (\n",
" effective=dt(2023, 3, 26),\n",
" termination=dt(2023, 9, 26),\n",
" fixed_rate=0.0,\n",
" spec=\"us_gb\",\n",
")\n",
"bond.ytm(99.75, settlement=dt(2023, 9, 7))"
]
},
{
"cell_type": "markdown",
"id": "778325e0-6d64-4215-8218-1484fce9e643",
"metadata": {},
"source": [
"# Inflation Linked"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4b0c470-fc27-47cd-a6ca-c8c839b12958",
"metadata": {},
"outputs": [],
"source": [
"ukt = FixedRateBond (\n",
" spec =\"uk_gb\",\n",
" effective =dt (2022 , 2, 1) ,\n",
" termination =\"2y\",\n",
" fixed_rate =2.5 ,\n",
")\n",
"ukt.price(ytm=3.0, settlement=dt(2023 , 10, 1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5afffec3-c117-44bf-b4e5-7a027391cde9",
"metadata": {},
"outputs": [],
"source": [
"ukti = IndexFixedRateBond (\n",
" spec=\"uk_gbi\",\n",
" effective=dt(2022, 2, 1) ,\n",
" termination=\"2y\",\n",
" fixed_rate=2.5,\n",
" index_base=100.0,\n",
")\n",
"ukti.price(ytm=3.0, settlement=dt(2023 , 10, 1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13397bf0-a8e8-413f-a4e4-d1af737fa97e",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "e0e9a2c5-b929-4582-8ca5-40b38ca57562",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "456eef8f-0b15-4a51-a584-869c6d8c29d9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/InterpolationAndSplines.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "ac6cd685-e9ba-4813-ac98-c533012f10ed",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import *\n",
"from rateslib.splines import evaluate"
]
},
{
"cell_type": "markdown",
"id": "e974b0e9-27b1-4df8-84e5-26805a44c22f",
"metadata": {},
"source": [
"# Splines and AD"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aa34c83c-2f5a-42d8-9493-a2d5c638abdd",
"metadata": {},
"outputs": [],
"source": [
"pps = PPSplineDual(\n",
" k=3,\n",
" t=[0,0,0,4,4,4]\n",
")\n",
"pps.csolve(\n",
" tau=[1, 2, 3],\n",
" y=[\n",
" Dual(2.0, [\"y1\"], []),\n",
" Dual(1.0, [\"y2\"], []),\n",
" Dual(2.6, [\"y3\"], []),\n",
" ],\n",
" left_n=0,\n",
" right_n=0,\n",
" allow_lsq=False\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f2626baa-e0f9-4161-98c4-c209636f9f34",
"metadata": {},
"outputs": [],
"source": [
"pps.ppev_single(3.5)"
]
},
{
"cell_type": "markdown",
"id": "12b89c6b-7f90-4c17-b373-c0e88709f2e8",
"metadata": {},
"source": [
"# Application to curves"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c733ce29-72df-4807-825a-4a3268d0a133",
"metadata": {},
"outputs": [],
"source": [
"spline = PPSplineF64(\n",
" k=4,\n",
" t=[_.timestamp() for _ in [\n",
" dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1),\n",
" dt(2023, 1, 1),\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)\n",
" ]]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "29c3f337-4cbc-46e3-8ff5-e8e4b6cfc5a9",
"metadata": {},
"outputs": [],
"source": [
"spline.bsplmatrix(\n",
" tau=[_.timestamp() for _ in [\n",
" dt(2022, 1, 1), dt(2022, 1, 1), dt(2023, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)\n",
" ]],\n",
" left_n=2,\n",
" right_n=2\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17c307c9-b798-47ee-910e-55cf57becc14",
"metadata": {},
"outputs": [],
"source": [
"spline.csolve(\n",
" tau=[_.timestamp() for _ in [\n",
" dt(2022, 1, 1), dt(2022, 1, 1), dt(2023, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)\n",
" ]],\n",
" y=[0.0, 1.5, 1.85, 1.80, 0.0],\n",
" left_n=2,\n",
" right_n=2,\n",
" allow_lsq=False,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aaa86c7a-d11d-45d6-815b-88c3220a55bb",
"metadata": {},
"outputs": [],
"source": [
"spline.c"
]
},
{
"cell_type": "markdown",
"id": "18c744d3-51a9-473b-99e3-1bb4c0b133a8",
"metadata": {},
"source": [
"# Log-spline to DFs"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9b59245c-cf58-4a61-8603-ca751f0093cd",
"metadata": {},
"outputs": [],
"source": [
"from math import log, exp\n",
"from datetime import timedelta\n",
"\n",
"log_spline = PPSplineF64(\n",
" k=4,\n",
" t=[_.timestamp() for _ in [\n",
" dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1), dt(2022, 1, 1),\n",
" dt(2023, 1, 1),\n",
" dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1), dt(2024, 1, 1)\n",
" ]]\n",
")\n",
"log_spline.csolve(\n",
" tau=[_.timestamp() for _ in [\n",
" dt(2022,1,1), dt(2022,1,1), dt(2023,1,1), dt(2024,1,1), dt(2024,1,1)\n",
" ]], \n",
" y=[0, log(1.0), log(0.983), log(0.964), 0],\n",
" left_n=2,\n",
" right_n=2,\n",
" allow_lsq=False,\n",
")\n",
"log_spline.c"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eb7d47f8-e4db-4815-bf0c-a1b2f6e27a15",
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"x = [_.timestamp() for _ in [\n",
" dt(2022, 1, 1) + timedelta(days=i) for i in range(720)]]\n",
"fix, ax = plt.subplots(1,1)\n",
"ax.plot(x, [exp(log_spline.ppev_single(_)) for _ in x])\n",
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Legs.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"id": "8ced5feb-616f-469c-8b1a-68bd7c9ef252",
"metadata": {},
"source": [
"### The chapter on Legs contains no code listings"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Periods.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "49c1059d-3472-4797-a9a2-ae7efbc9ba1d",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import Curve, FloatPeriod, dt, defaults"
]
},
{
"cell_type": "markdown",
"id": "ce44b389-41a3-4a48-8dad-9d9601eddc8e",
"metadata": {},
"source": [
"# Expression of fixings risk in fixings table"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7390a465-ddd6-424f-a417-98a4a6e5e310",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve ({dt(2022, 1, 1): 1.0 , dt(2025, 1, 1): 0.94},\n",
" id=\"euribor3m\", calendar=\"tgt\", convention=\"act360\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2d803cf3-ec6b-415f-97d9-d7d70fa511b3",
"metadata": {},
"outputs": [],
"source": [
"imm_fp = FloatPeriod (\n",
" start=dt(2023, 3, 15),\n",
" end=dt(2023, 6, 21), # <--- IMM start and end dates\n",
" payment=dt(2023, 6, 21),\n",
" frequency=\"q\",\n",
" convention=\"act360\",\n",
" calendar=\"tgt\",\n",
" fixing_method=\"ibor\",\n",
" method_param=2,\n",
" notional=-1e6 # <-- Notional for period is -1mm\n",
" )\n",
"imm_fp.fixings_table(curve)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b6cbb243-dbc1-4d95-8a5d-9227e582a542",
"metadata": {},
"outputs": [],
"source": [
"curve2 = Curve ({dt(2022, 1, 1): 1.0 , dt(2025, 1, 1): 0.94} ,\n",
" id=\"euribor1m\", calendar=\"tgt\", convention=\"act360\"\n",
")\n",
"\n",
"stub_fp = FloatPeriod (\n",
" start=dt(2022, 3, 14),\n",
" end=dt(2022, 5, 14), # <--- 2M stub tenor\n",
" payment =dt(2022, 5, 14),\n",
" frequency=\"q\",\n",
" convention=\"act360\",\n",
" calendar=\"tgt\",\n",
" fixing_method=\"ibor\",\n",
" method_param=2,\n",
" notional=-1e6 ,\n",
" stub=True,\n",
")\n",
"stub_fp.fixings_table({\"1m\": curve2 , \"3m\": curve}, disc_curve=curve2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "784ed642-54b7-4864-89cc-4d4d7d5c4805",
"metadata": {},
"outputs": [],
"source": [
"defaults.curve_caching = False"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce13bfea-17a0-436c-aaab-ae9dfee8d2b8",
"metadata": {},
"outputs": [],
"source": [
"curve = Curve ({ dt(2022, 1, 4): 1.0, dt(2023, 1, 4): 0.98}, calendar=\"ldn\")\n",
"float_period = FloatPeriod(start=dt(2022, 1, 4), end=dt(2023, 1, 4),\n",
" payment=dt(2023, 1, 4) ,frequency =\"A\",\n",
" fixing_method=\"rfr_lookback\", method_param=0)\n",
"\n",
"%timeit float_period.fixings_table(curve)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "46902d71-7080-48d5-83d0-5ef250329709",
"metadata": {},
"outputs": [],
"source": [
"%timeit float_period.fixings_table(curve, approximate=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: notebooks/coding_2/Scheduling.ipynb
================================================
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "350b18e6-9448-4c28-9c45-444dabe50160",
"metadata": {},
"outputs": [],
"source": [
"from rateslib import *"
]
},
{
"cell_type": "markdown",
"id": "a454c714-2127-4a86-ad73-4f924210aee1",
"metadata": {},
"source": [
"# Regular Unadjusted Schedules"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a6a10173-9141-40f8-91f1-bb4c06b5a3be",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _generate_regular_schedule_unadjusted\n",
"\n",
"dates = list (_generate_regular_schedule_unadjusted (\n",
" ueffective=dt(2023 , 3, 15),\n",
" utermination=dt(2023 , 9, 20),\n",
" frequency=\"M\", \n",
" roll=\"imm\",\n",
"))\n",
"\n",
"dates"
]
},
{
"cell_type": "markdown",
"id": "f8e77e1c-6af9-4885-aaea-1de5b77ccee5",
"metadata": {},
"source": [
"# Stub and Roll Inference"
]
},
{
"cell_type": "markdown",
"id": "75166f2f-e9bd-4de1-b78d-b43f0a931e7c",
"metadata": {},
"source": [
"### Get a Roll"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d2905999-2165-480f-882c-a8b33e4aa105",
"metadata": {},
"outputs": [],
"source": [
"from rateslib . scheduling import _get_unadjusted_roll\n",
"\n",
"_get_unadjusted_roll (\n",
" ueffective =dt (2022 ,3 ,15) , utermination =dt (2023 ,3 ,15) , eom = True\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b582faa-05f3-40ea-9964-8677ed1dd250",
"metadata": {},
"outputs": [],
"source": [
"_get_unadjusted_roll (\n",
" ueffective =dt (2022 ,2 ,28) , utermination =dt (2023 ,2 ,28) , eom = False\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ba2b8488-8e88-4ca2-a24b-db73abf65ca9",
"metadata": {},
"outputs": [],
"source": [
"_get_unadjusted_roll (\n",
" ueffective =dt (2022 ,2 ,28) , utermination =dt (2023 ,2 ,28) , eom = True\n",
")"
]
},
{
"cell_type": "markdown",
"id": "b054fb9d-5a88-4d05-bd1b-2e0c7cc34e22",
"metadata": {},
"source": [
"### Validate for a regular unadjusted swap"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3860386d-a9ce-4afd-a1ce-b4c959b20f26",
"metadata": {},
"outputs": [],
"source": [
"from rateslib . scheduling import _check_unadjusted_regular_swap\n",
"\n",
"_check_unadjusted_regular_swap(\n",
" ueffective=dt(2022, 2, 28),\n",
" utermination=dt(2023, 2, 28),\n",
" frequency=\"M\",\n",
" eom=False,\n",
" roll=NoInput(0),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2c83a2d2-fc06-44ae-bf81-680d15be987b",
"metadata": {},
"outputs": [],
"source": [
"_check_unadjusted_regular_swap (\n",
" ueffective=dt (2022 , 2, 28) ,\n",
" utermination=dt (2023 , 2, 28) ,\n",
" frequency=\"M\",\n",
" eom=True,\n",
" roll=NoInput(0),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6b90f1c2-b9d9-4655-9936-999ffd613ddd",
"metadata": {},
"outputs": [],
"source": [
"_check_unadjusted_regular_swap (\n",
" ueffective=dt(2022 , 3, 16) ,\n",
" utermination=dt(2022 , 9, 21) ,\n",
" frequency=\"M\",\n",
" eom=False ,\n",
" roll=NoInput(0),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d766c8b5-9102-4853-8b05-a23d76c0c893",
"metadata": {},
"outputs": [],
"source": [
"_check_unadjusted_regular_swap (\n",
" ueffective=dt(2022 , 3, 16) ,\n",
" utermination=dt(2022 , 9, 21) ,\n",
" frequency=\"M\",\n",
" eom=False ,\n",
" roll=\"imm\",\n",
")"
]
},
{
"cell_type": "markdown",
"id": "cace2c03-ce4c-46a3-a384-524752253ae3",
"metadata": {},
"source": [
"### Get a stub"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f7aac92e-1ab9-4f38-942c-10e37faa2ee1",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _get_unadjusted_short_stub_date\n",
"\n",
"kws = dict (\n",
" ueffective =dt (2022 , 6, 15),\n",
" utermination =dt (2023 , 2, 28), # <-- End of Fenruary\n",
" frequency =\"M\",\n",
")\n",
"\n",
"_get_unadjusted_short_stub_date (**kws , eom=False , roll=NoInput(0) ,stub_side=\"FRONT\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ba070165-f691-432b-8819-76943a1f22a1",
"metadata": {},
"outputs": [],
"source": [
"_get_unadjusted_short_stub_date(**kws, eom=True, roll=NoInput(0), stub_side=\"FRONT\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "711b2df6-dc4c-46da-b167-62bd861465a3",
"metadata": {},
"outputs": [],
"source": [
"_get_unadjusted_short_stub_date(**kws, eom=True, roll=29, stub_side=\"FRONT\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b89e7485-2667-424c-9288-9758151c0b22",
"metadata": {},
"outputs": [],
"source": [
"from rateslib . scheduling import _get_unadjusted_stub_date\n",
"\n",
"_get_unadjusted_stub_date(**kws, eom=False, roll=NoInput(0), stub=\"LONGFRONT\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d5e1af0b-855f-425d-8a50-0ce085e7612b",
"metadata": {},
"outputs": [],
"source": [
"_get_unadjusted_stub_date(**kws, eom=True, roll=NoInput(0), stub=\"LONGFRONT\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b1514504-3a81-43b9-9ed5-d5f92bb28c55",
"metadata": {},
"outputs": [],
"source": [
"_get_unadjusted_stub_date(**kws, eom=False, roll=29, stub=\"LONGFRONT\")"
]
},
{
"cell_type": "markdown",
"id": "271c4d0d-ba1a-49fc-8ec6-eb355c46ed91",
"metadata": {},
"source": [
"### Validate for a regular swap account for business days"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "983a9f5e-4500-4ffc-955f-25a7811ded3a",
"metadata": {},
"outputs": [],
"source": [
"from rateslib.scheduling import _check_regular_swap\n",
"\n",
"_check_regular_swap( \n",
" effective=dt(2022, 6, 6), \n",
" termination=dt(2022, 12, 5),\n",
" frequency=\"Q\",\n",
" eom=False,\n",
" roll=NoInput(0),\n",
" modifier =\"MF\",\n",
" calendar=get_calendar(\"bus\"),\n",
")"
]
},
{
"cell_type": "markdown",
"id": "18abf86d-81f8-4fd1-bb4c-5a8e0d06bb8c",
"metadata": {},
"source": [
"# Schedule Building"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "562b95aa-550c-4654-bb4a-010ea7f39875",
"metadata": {},
"outputs": [],
"source": [
"sch = Schedule (\n",
" effective =\"1Y\",\n",
" termination =\"1Y\",\n",
" frequency =\"S\",\n",
" calendar =\"tgt\",\n",
" payment_lag =1,\n",
" eval_date=dt (2023 , 8, 17) ,\n",
" eval_mode=\"swaps_align\", \n",
")\n",
"print(sch)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "72ab63a2-fe4a-49bd-8baa-7ed046ad2b4f",
"metadata": {},
"outputs": [],
"source": [
"sch = Schedule (\n",
" effective =\"1Y\",\n",
" termination =\"1Y\",\n",
" frequency =\"S\",\n",
" calendar =\"tgt\",\n",
" payment_lag =1,\n",
" eval_date =dt (2023 , 8, 17) ,\n",
" eval_mode=\"swaptions_align\", \n",
")\n",
"print(sch)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: pyproject.toml
================================================
# pyproject.toml
[build-system]
requires = ["maturin>=1.0,<2.0"]
build-backend = "maturin"
[tool.maturin]
module-name = "rateslib.rs"
python-source = "python"
bindings = "pyo3"
compatibility = "linux"
features = ["pyo3/extension-module"]
# rustc --print target-list
# https://doc.rust-lang.org/rustc/platform-support.html
[project]
name = "rateslib"
version = "2.7.1"
description = "A fixed income library for trading interest rates"
readme = "README.md"
authors = [{ name = "J H M Darbyshire"}]
license-files = ["LICEN[CS]E", "COMMERCIAL_LICENCE", "COMMERCIAL_LICENCE_ADDENDUM1"]
keywords = ["interest rate", "derivatives", "swaps", "bonds", "fixed income"]
dependencies = [
"numpy>=1.21.5,<3.0",
"matplotlib>=3.5.1,<4.0",
"pandas>=1.4.1,<4.0",
]
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
[dependency-groups]
test = [
# "pandas>=3.0,<4.0",
"pytest>=9.0,<10.0",
"pytest-env>=1.0,<2.0",
"coverage>=7.6.1,<8.0",
]
lint = [
"ruff>=0.6.3,<1.0",
]
typing = [
"mypy>=1.13,<1.20",
"pandas-stubs>2.0,<4.0",
]
docs = [
"sphinx>=9.0,<10.0; python_version >= '3.11'",
"sphinx-automodapi>=0.16.0,<1.0",
"sphinxcontrib-googleanalytics>=0.4,<1.0",
"sphinx-tabs>=3.4,<4.0",
"pydata-sphinx-theme>=0.15.4,<1.0",
"nbsphinx>=0.9.5,<1.0",
]
gui = [
"jupyterlab>=4.0,<5.0",
"pickleshare>=0.7.5,<1.0",
]
[tool.pytest.ini_options]
# pythonpath = [".", "python/rateslib"]
minversion = "8.0"
addopts = [
"--ignore-glob=*_ignore.py",
] # use -s to show print capture, use -q for quiet, use -v for verbose
testpaths = [
"python/tests",
]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning"
]
[tool.pytest_env]
MPLBACKEND = "Agg"
[tool.setuptools]
packages = ["rateslib"]
[project.urls]
Homepage = "https://github.com/attack68/rateslib"
[tool.ruff]
exclude = [
".git",
".github",
"docs",
"notebooks",
"target",
"venv9",
"venv11",
"scratch*.py",
"__pycache__",
"docs/source/conf.py",
"old",
"build",
"dist",
"bench",
"benchmarks",
]
# Same as Black.
line-length = 100
indent-width = 4
# Assume Python 3.12
target-version = "py310"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = false
[tool.ruff.lint]
select = [
# "ANN", # flake8-annotations -- Superceded by the use of mypy
# "COM", # flake8-commas -- conflicts with ruff format
"E", # pycodestyle
"W",
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"C4", # flake8-comprehensions
"S", # flake8-bandit
"PIE", # flake8-pie
"A", # flake8-builtins
"Q", # flake8-quotes
"PT", # flake8-pytest-style
"C90", # mccabe complexity -- Requires work
"I", # isort
"N", # pep8 naming
# "RUF", # -- Requires work
# "D", Pydocs -- requires work
]
ignore = [
"A005", # json and typing module name shadowing is allowed
"PT011", "PT030", "PT031", # -- Requires work inputting match statements
"PIE790", # unnecessary pass
"C408", # unnecessary dict call
"N806", "N815", "N803", "N802",
"SIM116", # use a dict instead of successive ifs: off due to performance degradation.
"SIM108", # ternary operators: off due to code coverage degradation.
"B008", # function calls in argument defaults, e.g. NoInput(0)
# "B006", # mutable data structures for argument defaults, e.g. []
"B904", # raising within except clauses
"B028", # no explicit stack level
"E702", # semi-colons for multiple line statements
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "N801"]
"local_types.py" = ["E501", "E402"]
"python/tests/*" = ["F401", "B", "N", "S", "ANN", "D"]
"rust/*" = ["D"]
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 5.
max-complexity = 14
[tool.mypy]
files = ["python/"]
exclude = [
"python/tests",
# "/periods/ir_volatility.py",
]
strict = true
#packages = [
# "rateslib"
#]
[tool.coverage.run]
omit = [
"/local_types.py",
# "python/tests/*"
]
================================================
FILE: python/rateslib/__init__.py
================================================
# SPDX-License-Identifier: LicenseRef-Rateslib-Dual
#
# Copyright (c) 2026 Siffrorna Technology Limited
#
# Dual-licensed: Free Educational Licence or Paid Commercial Licence (commercial/professional use)
# Source-available, not open source.
#
# See LICENSE and https://rateslib.com/py/en/latest/i_licence.html for details,
# and/or contact info (at) rateslib (dot) com
####################################################################################################
__docformat__ = "restructuredtext"
# Let users know if they're missing any of our hard dependencies
_hard_dependencies = ("pandas", "matplotlib", "numpy")
_missing_dependencies: list[str] = []
for _dependency in _hard_dependencies:
try:
__import__(_dependency)
except ImportError as _e: # pragma: no cover
raise ImportError(f"`rateslib` requires installation of {_dependency}: {_e}")
from rateslib.verify import VERSION, Licence
__version__ = VERSION
licence = Licence()
from datetime import datetime as dt
from rateslib.data.loader import Fixings
from rateslib.default import Defaults
from rateslib.rs import CalendarManager
defaults = Defaults()
fixings = Fixings()
calendars = CalendarManager()
from contextlib import ContextDecorator
class default_context(ContextDecorator):
"""
Context manager to temporarily set options in the `with` statement context.
You need to invoke as ``option_context(pat, val, [(pat, val), ...])``.
Examples
--------
>>> with option_context('convention', "act360", 'frequency', "S"):
... pass
"""
def __init__(self, *args) -> None: # type: ignore[no-untyped-def]
if len(args) % 2 != 0 or len(args) < 2:
raise ValueError("Need to invoke as option_context(pat, val, [(pat, val), ...]).")
self.ops = list(zip(args[::2], args[1::2], strict=False))
def __enter__(self) -> None:
self.undo = [(pat, getattr(defaults, pat, None)) for pat, _ in self.ops]
for pat, val in self.ops:
setattr(defaults, pat, val)
def __exit__(self, *args) -> None: # type: ignore[no-untyped-def]
if self.undo:
for pat, val in self.undo:
setattr(defaults, pat, val)
from rateslib.curves import (
CompositeCurve,
Curve,
LineCurve,
MultiCsaCurve,
ProxyCurve,
index_left,
index_value,
)
from rateslib.curves.academic import (
NelsonSiegelCurve,
NelsonSiegelSvenssonCurve,
SmithWilsonCurve,
)
from rateslib.data.fixings import (
FloatRateIndex,
FloatRateSeries,
FXFixing,
FXIndex,
IBORFixing,
IBORStubFixing,
IndexFixing,
RFRFixing,
)
from rateslib.dual import ADOrder, Dual, Dual2, Variable, dual_exp, dual_log, dual_solve, gradient
from rateslib.enums import FloatFixingMethod, NoInput
from rateslib.fx import FXForwards, FXRates
from rateslib.instruments import (
CDS,
FRA,
IIRS,
IRS,
NDF,
NDXCS,
SBS,
XCS,
ZCIS,
ZCS,
Bill,
BillCalcMode,
BondCalcMode,
BondFuture,
Fee,
FixedRateBond,
FloatRateNote,
Fly,
FXBrokerFly,
FXCall,
FXForward,
FXPut,
FXRiskReversal,
FXStraddle,
FXStrangle,
FXSwap,
FXVolValue,
IndexFixedRateBond,
IRSCall,
IRSPut,
IRSRiskReversal,
IRSStraddle,
IRSStrangle,
IRVolValue,
Loan,
Portfolio,
Spread,
STIRFuture,
Value,
YoYIS,
)
from rateslib.legs import (
Amortization,
CreditPremiumLeg,
CreditProtectionLeg,
CustomLeg,
FixedLeg,
FloatLeg,
ZeroFixedLeg,
ZeroFloatLeg,
)
from rateslib.periods import (
Cashflow,
CreditPremiumPeriod,
CreditProtectionPeriod,
FixedPeriod,
FloatPeriod,
FXCallPeriod,
FXPutPeriod,
IRSCallPeriod,
IRSPutPeriod,
ZeroFixedPeriod,
ZeroFloatPeriod,
)
from rateslib.scheduling import (
Adjuster,
Cal,
Convention,
Frequency,
Imm,
NamedCal,
RollDay,
Schedule,
StubInference,
UnionCal,
add_tenor,
dcf,
get_calendar,
get_imm,
next_imm,
)
from rateslib.serialization import from_json
from rateslib.solver import Solver
from rateslib.splines import (
PPSplineDual,
PPSplineDual2,
PPSplineF64,
bspldnev_single,
bsplev_single,
)
from rateslib.volatility import (
FXDeltaVolSmile,
FXDeltaVolSurface,
FXSabrSmile,
FXSabrSurface,
IRSabrCube,
IRSabrSmile,
IRSplineCube,
IRSplineSmile,
)
# module level doc-string
__doc__ = """
RatesLib - An efficient and interconnected fixed income library for Python
==========================================================================
**rateslib** is a Python package providing fast, flexible, and accurate
fixed income instrument configuration and calculation.
It aims to be the fundamental high-level building block for practical analysis of
fixed income securities, derivatives, FX representation and curve construction
in Python.
""" # noqa: A001
__all__ = [
"dt",
"defaults",
"fixings",
"calendars",
"licence",
"from_json",
# enums.py
"NoInput",
"FloatFixingMethod",
# dual.py
"ADOrder",
"Dual",
"Dual2",
"Variable",
"dual_log",
"dual_exp",
"dual_solve",
"gradient",
# splines.py
"bsplev_single",
"bspldnev_single",
"PPSplineF64",
"PPSplineDual",
"PPSplineDual2",
# scheduling.py
"get_calendar",
"get_imm",
"next_imm",
"add_tenor",
"dcf",
"Cal",
"UnionCal",
"NamedCal",
"Schedule",
"Frequency",
"RollDay",
"Adjuster",
"StubInference",
"Convention",
"Imm",
# curves.py
"Curve",
"LineCurve",
"MultiCsaCurve",
"CompositeCurve",
"ProxyCurve",
"index_left",
"index_value",
# academic curves
"NelsonSiegelCurve",
"NelsonSiegelSvenssonCurve",
"SmithWilsonCurve",
# fixings.py
"FXFixing",
"IBORFixing",
"IBORStubFixing",
"IndexFixing",
"RFRFixing",
"FXIndex",
"FloatRateIndex",
"FloatRateSeries",
# volatility/fx
"FXDeltaVolSmile",
"FXDeltaVolSurface",
"FXSabrSmile",
"FXSabrSurface",
# volatility/ir
"IRSabrSmile",
"IRSabrCube",
"IRSplineSmile",
"IRSplineCube",
# solver.py
"Solver",
# fx.py
"FXRates",
"FXForwards",
# periods.py,
"FixedPeriod",
"FloatPeriod",
"ZeroFixedPeriod",
"ZeroFloatPeriod",
"Cashflow",
"FXCallPeriod",
"FXPutPeriod",
"IRSCallPeriod",
"IRSPutPeriod",
"CreditPremiumPeriod",
"CreditProtectionPeriod",
# legs.py
"Amortization",
"FixedLeg",
"FloatLeg",
"ZeroFloatLeg",
"ZeroFixedLeg",
"CustomLeg",
"CreditPremiumLeg",
"CreditProtectionLeg",
# instruments.py
"FixedRateBond",
"IndexFixedRateBond",
"FloatRateNote",
"BondFuture",
"BondCalcMode",
"CDS",
"FRA",
"Value",
"FXVolValue",
"IRVolValue",
"Bill",
"Fee",
"Loan",
"BillCalcMode",
"IRS",
"NDF",
"STIRFuture",
"IIRS",
"ZCS",
"ZCIS",
"YoYIS",
"SBS",
"FXSwap",
"FXForward",
"XCS",
"NDXCS",
"Spread",
"Fly",
"Portfolio",
"FXCall",
"FXPut",
"FXRiskReversal",
"FXStraddle",
"FXStrangle",
"FXBrokerFly",
"IRSCall",
"IRSPut",
"IRSRiskReversal",
"IRSStraddle",
"IRSStrangle",
]
================================================
FILE: python/rateslib/_spec_loader.py
================================================
# SPDX-License-Identifier: LicenseRef-Rateslib-Dual
#
# Copyright (c) 2026 Siffrorna Technology Limited
#
# Dual-licensed: Free Educational Licence or Paid Commercial Licence (commercial/professional use)
# Source-available, not open source.
#
# See LICENSE and https://rateslib.com/py/en/latest/i_licence.html for details,
# and/or contact info (at) rateslib (dot) com
####################################################################################################
from __future__ import annotations
import os
from typing import TYPE_CHECKING
import pandas as pd
from packaging import version
if TYPE_CHECKING:
from rateslib.local_types import ( # pragma: no cover
Any,
)
DEVELOPMENT = os.environ.get("RATESLIB_DEVELOPMENT", "False")
# This is output from a development version and hard coded before a release for performance.
INSTRUMENT_SPECS: dict[str, dict[str, Any]] = {
"test": {
"frequency": "m",
"stub": "longfront",
"eom": False,
"modifier": "p",
"calendar": "nyc,tgt,ldn",
"payment_lag": 4,
"currency": "tes",
"convention": "yearsmonths",
"leg2_frequency": "m",
"leg2_stub": "longback",
"leg2_roll": 1,
"leg2_eom": False,
"leg2_modifier": "mp",
"leg2_calendar": "nyc,tgt,ldn",
"leg2_payment_lag": 3,
"leg2_convention": "one",
},
"eurusd_call": {
"modifier": "mf",
"calendar": "tgt|fed",
"payment_lag": 2,
"pair": "eurusd",
"delivery_lag": 2,
},
"us_ig_cds": {
"frequency": "q",
"stub": "shortfront",
"roll": 20,
"eom": False,
"modifier": "fex",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "act360",
"fixed_rate": 1.0,
},
"inr_ndirs": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "mum",
"payment_lag": 0,
"currency": "usd",
"convention": "act365f",
"pair": "usdinr",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"inrusd_ndxcs": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "mum|fed",
"payment_lag": 2,
"currency": "usd",
"convention": "act365f",
"fixed": True,
"pair": "usdinr",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"mxn_irs": {
"frequency": "28d",
"stub": "shortfront",
"eom": False,
"modifier": "f",
"calendar": "mex",
"payment_lag": 2,
"currency": "mxn",
"convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"usd_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc",
"payment_lag": 2,
"currency": "usd",
"convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"usd_irs_lt_2y": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "nyc",
"payment_lag": 2,
"currency": "usd",
"convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"gbp_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "ldn",
"payment_lag": 0,
"currency": "gbp",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"eur_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt",
"payment_lag": 1,
"currency": "eur",
"convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"sek_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "stk",
"payment_lag": 1,
"currency": "sek",
"convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"nok_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "osl",
"payment_lag": 2,
"currency": "nok",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"chf_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "zur",
"payment_lag": 2,
"currency": "chf",
"convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"cad_irs": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tro",
"payment_lag": 1,
"currency": "cad",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"cad_irs_le_1y": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "tro",
"payment_lag": 1,
"currency": "cad",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"jpy_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "tyo",
"payment_lag": 2,
"currency": "jpy",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"nzd_irs3": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "wlg",
"payment_lag": 0,
"currency": "nzd",
"convention": "act365f",
"leg2_frequency": "q",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"nzd_irs6": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "wlg",
"payment_lag": 0,
"currency": "nzd",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"nzd_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "wlg",
"payment_lag": 2,
"currency": "nzd",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"aud_irs6": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "syd",
"payment_lag": 0,
"currency": "aud",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"aud_irs3": {
"frequency": "q",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "syd",
"payment_lag": 0,
"currency": "aud",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"aud_irs3_gt_3y": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "syd",
"payment_lag": 0,
"currency": "aud",
"convention": "act365f",
"leg2_frequency": "q",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"aud_irs": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "syd",
"payment_lag": 2,
"currency": "aud",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"eur_irs6": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "30e360",
"leg2_frequency": "s",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"eur_irs3": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "30e360",
"leg2_frequency": "q",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"eur_irs1": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "30e360",
"leg2_frequency": "m",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"sek_irs3": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "stk",
"payment_lag": 0,
"currency": "sek",
"convention": "30e360",
"leg2_frequency": "q",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"nok_irs3": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "osl",
"payment_lag": 0,
"currency": "nok",
"convention": "30e360",
"leg2_frequency": "q",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"nok_irs6": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "osl",
"payment_lag": 0,
"currency": "nok",
"convention": "30e360",
"leg2_frequency": "s",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"eurusd_xcs": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt,nyc",
"payment_lag": 2,
"currency": "eur",
"convention": "act360",
"spread_compound_method": "none_simple",
"fixing_method": "rfr_payment_delay",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "eurusd",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"gbpusd_xcs": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "ldn,nyc",
"payment_lag": 2,
"currency": "gbp",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "rfr_payment_delay",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "gbpusd",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"eurgbp_xcs": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt,ldn",
"payment_lag": 2,
"currency": "eur",
"convention": "act360",
"spread_compound_method": "none_simple",
"fixing_method": "rfr_payment_delay",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "eurgbp",
"leg2_convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"gbpeur_xcs": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt,ldn",
"payment_lag": 2,
"currency": "gbp",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "rfr_payment_delay",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "eurgbp",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"jpyusd_xcs": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc,tyo",
"payment_lag": 2,
"currency": "jpy",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "rfr_payment_delay",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "usdjpy",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"audusd_xcs3": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc,syd",
"payment_lag": 2,
"currency": "aud",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "audusd",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"audusd_xcs": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc,syd",
"payment_lag": 2,
"currency": "aud",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "rfr_payment_delay",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "audusd",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"nzdusd_xcs3": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc,wlg",
"payment_lag": 2,
"currency": "nzd",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "nzdusd",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
"leg2_fixed": False,
"leg2_mtm": True,
},
"nzdaud_xcs3": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc,wlg,syd",
"payment_lag": 2,
"currency": "nzd",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"payment_lag_exchange": 0,
"fixed": False,
"pair": "audnzd",
"leg2_convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
"leg2_fixed": False,
"leg2_mtm": True,
},
"eur_zcis": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "1+",
"leg2_index_method": "monthly",
"leg2_index_lag": 3,
},
"gbp_zcis": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "ldn",
"payment_lag": 0,
"currency": "gbp",
"convention": "1+",
"leg2_index_method": "monthly",
"leg2_index_lag": 2,
},
"usd_zcis": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "1+",
"leg2_index_method": "daily",
"leg2_index_lag": 3,
},
"gbp_zcs": {
"frequency": "a",
"stub": "shortfront",
"eom": True,
"modifier": "mf",
"calendar": "ldn",
"payment_lag": 0,
"currency": "gbp",
"convention": "act365f",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "rfr_payment_delay",
},
"sek_iirs": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "stk",
"payment_lag": 0,
"currency": "sek",
"convention": "actacticma",
"index_method": "daily",
"index_lag": 3,
"leg2_frequency": "q",
"leg2_convention": "act360",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"eur_sbs36": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "act360",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(2)",
"leg2_frequency": "s",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"nok_sbs36": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "osl",
"payment_lag": 0,
"currency": "nok",
"convention": "act360",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(2)",
"leg2_frequency": "s",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(2)",
},
"aud_sbs36": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "syd",
"payment_lag": 0,
"currency": "aud",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"leg2_frequency": "s",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"aud_sbs31": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "syd",
"payment_lag": 0,
"currency": "aud",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"leg2_frequency": "m",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"nzd_sbs36": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "wlg",
"payment_lag": 0,
"currency": "nzd",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"leg2_frequency": "s",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"nzd_sbs31": {
"frequency": "q",
"stub": "shortfront",
"eom": False,
"modifier": "mf",
"calendar": "wlg",
"payment_lag": 0,
"currency": "nzd",
"convention": "act365f",
"spread_compound_method": "none_simple",
"fixing_method": "ibor(0)",
"leg2_frequency": "m",
"leg2_spread_compound_method": "none_simple",
"leg2_fixing_method": "ibor(0)",
},
"us_gb": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "none",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "us_gb",
},
"us_gbi": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "none",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "actacticma",
"payment_lag_exchange": 0,
"index_method": "daily",
"index_lag": 3,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "us_gb",
},
"us_corp": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "none",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "30u360",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "us_corp",
},
"us_muni": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "none",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "30u360",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "us_muni",
},
"us_gb_tsy": {
"frequency": "s",
"stub": "shortfront",
"eom": True,
"modifier": "none",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "us_gb_tsy",
},
"uk_gb": {
"frequency": "s",
"stub": "longfront",
"eom": False,
"modifier": "none",
"calendar": "ldn",
"payment_lag": 0,
"currency": "gbp",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-7b",
"calc_mode": "uk_gb",
},
"au_gb": {
"frequency": "s",
"stub": "longfront",
"eom": False,
"modifier": "none",
"calendar": "syd",
"payment_lag": 0,
"currency": "aud",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "-8d",
"calc_mode": "au_gb",
},
"nz_gb": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "wlg",
"payment_lag": 0,
"currency": "nzd",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-8b",
"calc_mode": "nz_gb",
},
"cn_gb": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "bjs",
"payment_lag": 0,
"currency": "cny",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "cn_gb",
},
"de_gb": {
"frequency": "a",
"stub": "longfront",
"eom": False,
"modifier": "none",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "-1b",
"calc_mode": "de_gb",
},
"fr_gb": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "-1b",
"calc_mode": "fr_gb",
},
"nl_gb": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "-1b",
"calc_mode": "nl_gb",
},
"it_gb": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "tgt",
"payment_lag": 0,
"currency": "eur",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "-1b",
"calc_mode": "it_gb",
},
"ch_gb": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "zur",
"payment_lag": 0,
"currency": "chf",
"convention": "30e360",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "ch_gb",
},
"se_gb": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "stk",
"payment_lag": 0,
"currency": "sek",
"convention": "actacticma",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "-5b",
"calc_mode": "se_gb",
},
"no_gb": {
"frequency": "a",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "osl",
"payment_lag": 0,
"currency": "nok",
"convention": "actacticma_stub365f",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "no_gb",
},
"ca_gb": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "tro",
"payment_lag": 0,
"currency": "cad",
"convention": "actacticma_stub365f",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "ca_gb",
},
"ca_gbi": {
"frequency": "s",
"stub": "shortfront",
"eom": False,
"modifier": "none",
"calendar": "tro",
"payment_lag": 0,
"currency": "cad",
"convention": "actacticma_stub365f",
"payment_lag_exchange": 0,
"index_method": "daily",
"index_lag": 3,
"settle": 1,
"ex_div": "-1b",
"calc_mode": "ca_gb",
},
"us_gbb": {
"eom": True,
"modifier": "none",
"calendar": "nyc",
"payment_lag": 0,
"currency": "usd",
"convention": "act360",
"payment_lag_exchange": 0,
"settle": 1,
"ex_div": "0b",
"calc_mode": "us_gbb",
},
"se_gbb": {
"eom": False,
"modifier": "none",
"calendar": "stk",
"payment_lag": 0,
"currency": "sek",
"convention": "act360",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "0b",
"calc_mode": "se_gbb",
},
"no_gbb": {
"eom": False,
"modifier": "none",
"calendar": "osl",
"payment_lag": 0,
"currency": "nok",
"convention": "act365f",
"payment_lag_exchange": 0,
"settle": 2,
"ex_div": "0b",
"calc_mode": "no_gbb",
},
"uk_gbb": {
"eom": True
gitextract_nnjeuw27/
├── .ai-opt-out
├── .aiignore
├── .gitattributes
├── .github/
│ └── workflows/
│ ├── release-all.yml
│ ├── release-linux.yml
│ ├── release-macos.yml
│ ├── release-musllinux.yml
│ ├── release-sdist.yml
│ ├── release-windows.yml
│ ├── ubuntu-latest-python-specific.yml
│ ├── ubuntu-latest-rust-specific.yml
│ ├── ubuntu-latest.yml
│ ├── ubuntu-minimum.yml
│ ├── windows-latest.yml
│ └── windows-minimum.yml
├── .gitignore
├── COMMERCIAL_LICENCE
├── COMMERCIAL_LICENCE_ADDENDUM1
├── Cargo.toml
├── LICENCE
├── README.md
├── docs/
│ └── source/
│ └── z_ir_vol_time_to_expiry.rst
├── notebooks/
│ ├── coding/
│ │ ├── ch5_fx.ipynb
│ │ ├── curves.ipynb
│ │ └── scheduling.ipynb
│ └── coding_2/
│ ├── AutomaticDifferentiation.ipynb
│ ├── Calendars.ipynb
│ ├── Cookbook.ipynb
│ ├── CurveSolving.ipynb
│ ├── Curves.ipynb
│ ├── FXRates.ipynb
│ ├── FXVolatility.ipynb
│ ├── Instruments.ipynb
│ ├── InterpolationAndSplines.ipynb
│ ├── Legs.ipynb
│ ├── Periods.ipynb
│ └── Scheduling.ipynb
├── pyproject.toml
├── python/
│ ├── rateslib/
│ │ ├── __init__.py
│ │ ├── _spec_loader.py
│ │ ├── curves/
│ │ │ ├── __init__.py
│ │ │ ├── _parsers.py
│ │ │ ├── academic/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ns.py
│ │ │ │ ├── nss.py
│ │ │ │ └── sw.py
│ │ │ ├── curves.py
│ │ │ ├── interpolation.py
│ │ │ ├── rs.py
│ │ │ └── utils.py
│ │ ├── data/
│ │ │ ├── __instrument_spec.csv
│ │ │ ├── fixings.py
│ │ │ ├── historical/
│ │ │ │ ├── aud_rfr.csv
│ │ │ │ ├── cad_rfr.csv
│ │ │ │ ├── corra.csv
│ │ │ │ ├── estr.csv
│ │ │ │ ├── eur_rfr.csv
│ │ │ │ ├── gbp_rfr.csv
│ │ │ │ ├── inr_rfr.csv
│ │ │ │ ├── jpy_rfr.csv
│ │ │ │ ├── nok_rfr.csv
│ │ │ │ ├── nowa.csv
│ │ │ │ ├── sek_rfr.csv
│ │ │ │ ├── sofr.csv
│ │ │ │ ├── sonia.csv
│ │ │ │ ├── swestr.csv
│ │ │ │ └── usd_rfr.csv
│ │ │ └── loader.py
│ │ ├── default.py
│ │ ├── dual/
│ │ │ ├── __init__.py
│ │ │ ├── ift.py
│ │ │ ├── newton.py
│ │ │ ├── quadratic.py
│ │ │ ├── utils.py
│ │ │ └── variable.py
│ │ ├── enums/
│ │ │ ├── __init__.py
│ │ │ ├── generics.py
│ │ │ └── parameters.py
│ │ ├── errors.py
│ │ ├── fx/
│ │ │ ├── __init__.py
│ │ │ ├── fx_forwards.py
│ │ │ └── fx_rates.py
│ │ ├── instruments/
│ │ │ ├── __init__.py
│ │ │ ├── bonds/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── bill.py
│ │ │ │ ├── bond_future.py
│ │ │ │ ├── conventions/
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── accrued.py
│ │ │ │ │ └── discounting.py
│ │ │ │ ├── fixed_rate_bond.py
│ │ │ │ ├── float_rate_note.py
│ │ │ │ ├── index_fixed_rate_bond.py
│ │ │ │ └── protocols/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── accrued.py
│ │ │ │ ├── cashflows.py
│ │ │ │ ├── duration.py
│ │ │ │ ├── oaspread.py
│ │ │ │ ├── repo.py
│ │ │ │ └── ytm.py
│ │ │ ├── cds.py
│ │ │ ├── fee.py
│ │ │ ├── fly.py
│ │ │ ├── fra.py
│ │ │ ├── fx_forward.py
│ │ │ ├── fx_options/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── brokerfly.py
│ │ │ │ ├── call_put.py
│ │ │ │ ├── risk_reversal.py
│ │ │ │ ├── straddle.py
│ │ │ │ ├── strangle.py
│ │ │ │ └── vol_value.py
│ │ │ ├── fx_swap.py
│ │ │ ├── iirs.py
│ │ │ ├── ir_options/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── call_put.py
│ │ │ │ ├── risk_reversal.py
│ │ │ │ ├── straddle.py
│ │ │ │ ├── strangle.py
│ │ │ │ └── vol_value.py
│ │ │ ├── irs.py
│ │ │ ├── loan.py
│ │ │ ├── ndf.py
│ │ │ ├── ndxcs.py
│ │ │ ├── portfolio.py
│ │ │ ├── protocols/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── analytic_delta.py
│ │ │ │ ├── analytic_fixings.py
│ │ │ │ ├── cashflows.py
│ │ │ │ ├── fixings.py
│ │ │ │ ├── kwargs.py
│ │ │ │ ├── npv.py
│ │ │ │ ├── pricing.py
│ │ │ │ ├── rate.py
│ │ │ │ ├── sensitivities.py
│ │ │ │ └── utils.py
│ │ │ ├── sbs.py
│ │ │ ├── spread.py
│ │ │ ├── stir_future.py
│ │ │ ├── value.py
│ │ │ ├── xcs.py
│ │ │ ├── yoyis.py
│ │ │ ├── zcis.py
│ │ │ └── zcs.py
│ │ ├── legs/
│ │ │ ├── __init__.py
│ │ │ ├── amortization.py
│ │ │ ├── credit.py
│ │ │ ├── custom.py
│ │ │ ├── fixed.py
│ │ │ ├── float.py
│ │ │ └── protocols/
│ │ │ ├── __init__.py
│ │ │ ├── analytic_delta.py
│ │ │ ├── analytic_fixings.py
│ │ │ ├── cashflows.py
│ │ │ ├── fixings.py
│ │ │ └── npv.py
│ │ ├── local_types.py
│ │ ├── mutability/
│ │ │ └── __init__.py
│ │ ├── periods/
│ │ │ ├── __init__.py
│ │ │ ├── cashflow.py
│ │ │ ├── credit.py
│ │ │ ├── fixed_period.py
│ │ │ ├── float_period.py
│ │ │ ├── float_rate.py
│ │ │ ├── fx_volatility.py
│ │ │ ├── ir_volatility.py
│ │ │ ├── parameters/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── credit.py
│ │ │ │ ├── fx_volatility.py
│ │ │ │ ├── index.py
│ │ │ │ ├── ir_volatility.py
│ │ │ │ ├── mtm.py
│ │ │ │ ├── period.py
│ │ │ │ ├── rate.py
│ │ │ │ └── settlement.py
│ │ │ ├── protocols/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── analytic_delta.py
│ │ │ │ ├── analytic_fixings.py
│ │ │ │ ├── analytic_greeks.py
│ │ │ │ ├── cashflows.py
│ │ │ │ ├── fixings.py
│ │ │ │ └── npv.py
│ │ │ └── utils.py
│ │ ├── py.typed
│ │ ├── rs.pyi
│ │ ├── scheduling/
│ │ │ ├── __init__.py
│ │ │ ├── adjuster.py
│ │ │ ├── calendars.py
│ │ │ ├── convention.py
│ │ │ ├── dcfs.py
│ │ │ ├── frequency.py
│ │ │ ├── imm.py
│ │ │ ├── rollday.py
│ │ │ └── schedule.py
│ │ ├── serialization/
│ │ │ ├── __init__.py
│ │ │ ├── json.py
│ │ │ └── utils.py
│ │ ├── solver.py
│ │ ├── splines/
│ │ │ ├── __init__.py
│ │ │ └── evaluate.py
│ │ ├── utils/
│ │ │ └── calendars.py
│ │ ├── verify.py
│ │ └── volatility/
│ │ ├── __init__.py
│ │ ├── fx/
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── delta_vol.py
│ │ │ ├── sabr.py
│ │ │ └── utils.py
│ │ ├── ir/
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── sabr.py
│ │ │ ├── spline.py
│ │ │ └── utils.py
│ │ └── utils.py
│ └── tests/
│ ├── curves/
│ │ ├── test_curves.py
│ │ ├── test_curvesrs.py
│ │ ├── test_ns.py
│ │ ├── test_nss.py
│ │ └── test_sw.py
│ ├── instruments/
│ │ ├── test_instruments_bonds_legacy.py
│ │ └── test_instruments_legacy.py
│ ├── legs/
│ │ ├── test_analytic_delta.py
│ │ ├── test_init.py
│ │ ├── test_leg_fixings.py
│ │ └── test_legs_legacy.py
│ ├── periods/
│ │ ├── test_fixings_exposure.py
│ │ ├── test_fixings_load.py
│ │ ├── test_float_rate.py
│ │ ├── test_periods_init.py
│ │ ├── test_periods_legacy.py
│ │ └── test_static_npv.py
│ ├── scheduling/
│ │ ├── test_calendars.py
│ │ ├── test_calendarsrs.py
│ │ ├── test_frequency.py
│ │ ├── test_imm.py
│ │ ├── test_schedule.py
│ │ └── test_schedulers.py
│ ├── serialization/
│ │ ├── test_json.py
│ │ ├── test_pickle.py
│ │ └── test_repr.py
│ ├── test_default.py
│ ├── test_dual.py
│ ├── test_dualpy.py
│ ├── test_dualrs.py
│ ├── test_enums.py
│ ├── test_fixings.py
│ ├── test_fx.py
│ ├── test_fx_volatility.py
│ ├── test_fxrs.py
│ ├── test_ir_volatility.py
│ ├── test_serialization.py
│ ├── test_solver.py
│ ├── test_splines.py
│ └── test_to_fix.py
├── robots.txt
└── rust/
├── _README.txt
├── curves/
│ ├── curve.rs
│ ├── curve_py.rs
│ ├── interpolation/
│ │ ├── interpolation_py.rs
│ │ ├── intp_flat_backward.rs
│ │ ├── intp_flat_forward.rs
│ │ ├── intp_linear.rs
│ │ ├── intp_linear_zero_rate.rs
│ │ ├── intp_log_cubic.rs
│ │ ├── intp_log_linear.rs
│ │ ├── intp_null.rs
│ │ ├── mod.rs
│ │ └── utils.rs
│ ├── mod.rs
│ ├── nodes.rs
│ └── serde.rs
├── dual/
│ ├── docs.rs
│ ├── dual.rs
│ ├── dual_ops/
│ │ ├── add.rs
│ │ ├── convert.rs
│ │ ├── div.rs
│ │ ├── eq.rs
│ │ ├── from.rs
│ │ ├── math_funcs.rs
│ │ ├── mod.rs
│ │ ├── mul.rs
│ │ ├── neg.rs
│ │ ├── num.rs
│ │ ├── numeric_ops.rs
│ │ ├── one.rs
│ │ ├── ord.rs
│ │ ├── pow.rs
│ │ ├── rem.rs
│ │ ├── signed.rs
│ │ ├── sub.rs
│ │ ├── sum.rs
│ │ └── zero.rs
│ ├── dual_py.rs
│ ├── enums.rs
│ ├── linalg/
│ │ ├── linalg_dual.rs
│ │ ├── linalg_f64.rs
│ │ └── mod.rs
│ ├── linalg_py.rs
│ └── mod.rs
├── enums/
│ ├── mod.rs
│ ├── parameters.rs
│ └── py/
│ ├── float_fixing_method.rs
│ ├── ir_option_metric.rs
│ ├── leg_index_base.rs
│ └── mod.rs
├── fx/
│ ├── mod.rs
│ ├── rates/
│ │ ├── ccy.rs
│ │ ├── fxpair.rs
│ │ ├── fxrate.rs
│ │ └── mod.rs
│ └── rates_py.rs
├── fx_volatility/
│ ├── mod.rs
│ └── sabr_funcs.rs
├── json/
│ ├── json_py.rs
│ └── mod.rs
├── lib.rs
├── main.rs
├── scheduling/
│ ├── calendars/
│ │ ├── adjuster.rs
│ │ ├── cal.rs
│ │ ├── calendar.rs
│ │ ├── dateroll.rs
│ │ ├── manager.rs
│ │ ├── mod.rs
│ │ ├── named/
│ │ │ ├── all.rs
│ │ │ ├── bjs.rs
│ │ │ ├── bjs_script.py
│ │ │ ├── bus.rs
│ │ │ ├── fed.rs
│ │ │ ├── fed_script.py
│ │ │ ├── ldn.rs
│ │ │ ├── ldn_script.py
│ │ │ ├── mex.rs
│ │ │ ├── mex_script.py
│ │ │ ├── mod.rs
│ │ │ ├── mum.rs
│ │ │ ├── mum_script.py
│ │ │ ├── nsw.rs
│ │ │ ├── nsw_script.py
│ │ │ ├── nyc.rs
│ │ │ ├── nyc_script.py
│ │ │ ├── osl.rs
│ │ │ ├── osl_script.py
│ │ │ ├── stk.rs
│ │ │ ├── stk_script.py
│ │ │ ├── syd.rs
│ │ │ ├── syd_script.py
│ │ │ ├── tgt.rs
│ │ │ ├── tgt_script.py
│ │ │ ├── tro.rs
│ │ │ ├── tro_script.py
│ │ │ ├── tyo.rs
│ │ │ ├── tyo_script.py
│ │ │ ├── wlg.rs
│ │ │ ├── wlg_script.py
│ │ │ ├── zur.rs
│ │ │ └── zur_script.py
│ │ ├── named_cal.rs
│ │ └── union_cal.rs
│ ├── convention.rs
│ ├── frequency/
│ │ ├── frequency.rs
│ │ ├── imm.rs
│ │ ├── mod.rs
│ │ └── rollday.rs
│ ├── mod.rs
│ ├── py/
│ │ ├── adjuster.rs
│ │ ├── calendar.rs
│ │ ├── convention.rs
│ │ ├── frequency.rs
│ │ ├── imm.rs
│ │ ├── mod.rs
│ │ ├── rollday.rs
│ │ └── schedule.rs
│ ├── schedule.rs
│ └── serde.rs
├── splines/
│ ├── mod.rs
│ ├── spline.rs
│ └── spline_py.rs
└── tests/
├── dual1.rs
├── mod.rs
└── splines/
└── mod.rs
Showing preview only (499K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (5968 symbols across 274 files)
FILE: python/rateslib/__init__.py
class default_context (line 42) | class default_context(ContextDecorator):
method __init__ (line 54) | def __init__(self, *args) -> None: # type: ignore[no-untyped-def]
method __enter__ (line 60) | def __enter__(self) -> None:
method __exit__ (line 66) | def __exit__(self, *args) -> None: # type: ignore[no-untyped-def]
FILE: python/rateslib/_spec_loader.py
function _map_str_float_int (line 1370) | def _map_str_float_int(v: Any) -> Any:
FILE: python/rateslib/curves/_parsers.py
function _map_curve_or_id_from_solver_ (line 42) | def _map_curve_or_id_from_solver_(curve: CurveOrId, solver: Solver) -> _...
function _map_curve_from_solver_ (line 92) | def _map_curve_from_solver_(curve: CurveInput, solver: Solver) -> CurveO...
function _map_curve_from_solver (line 109) | def _map_curve_from_solver(curve: CurveInput_, solver: Solver) -> CurveO...
function _validate_curve_not_str (line 122) | def _validate_curve_not_str(curve: CurveOrId) -> _BaseCurve:
function _validate_no_str_in_curve_input (line 128) | def _validate_no_str_in_curve_input(curve: CurveInput_) -> CurveOption_:
function _get_curves_maybe_from_solver (line 140) | def _get_curves_maybe_from_solver(
function _make_4_tuple_of_curve (line 205) | def _make_4_tuple_of_curve(curves: tuple[CurveOption_, ...]) -> Curves_T...
function _validate_curve_is_not_dict (line 219) | def _validate_curve_is_not_dict(curve: CurveOption_) -> _BaseCurve_:
function _validate_disc_curves_are_not_dict (line 225) | def _validate_disc_curves_are_not_dict(curves_tuple: Curves_Tuple) -> Cu...
function _validate_curve_not_no_input (line 234) | def _validate_curve_not_no_input(curve: _BaseCurve_) -> _BaseCurve:
function _validate_obj_not_no_input (line 243) | def _validate_obj_not_no_input(obj: T | NoInput, name: str) -> T:
function _disc_maybe_from_curve (line 249) | def _disc_maybe_from_curve(curve: CurveOption_, disc_curve: _BaseCurve_)...
function _disc_required_maybe_from_curve (line 264) | def _disc_required_maybe_from_curve(curve: CurveOption_, disc_curve: Cur...
function _try_disc_required_maybe_from_curve (line 277) | def _try_disc_required_maybe_from_curve(
function _maybe_set_ad_order (line 296) | def _maybe_set_ad_order(
FILE: python/rateslib/curves/academic/ns.py
class NelsonSiegelCurve (line 41) | class NelsonSiegelCurve(_WithMutability, _BaseCurve):
method __init__ (line 118) | def __init__(
method params (line 153) | def params(self) -> tuple[DualTypes, DualTypes, DualTypes, DualTypes]:
method __getitem__ (line 160) | def __getitem__(self, date: datetime) -> DualTypes:
method _get_node_vector (line 180) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[Any]]:
method _get_node_vars (line 183) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_node_vector (line 188) | def _set_node_vector(self, vector: list[DualTypes], ad: int) -> None:
method _set_ad_order (line 201) | def _set_ad_order(self, order: int) -> None:
FILE: python/rateslib/curves/academic/nss.py
class NelsonSiegelSvenssonCurve (line 41) | class NelsonSiegelSvenssonCurve(_WithMutability, _BaseCurve):
method __init__ (line 118) | def __init__(
method params (line 153) | def params(self) -> tuple[DualTypes, DualTypes, DualTypes, DualTypes, ...
method __getitem__ (line 160) | def __getitem__(self, date: datetime) -> DualTypes:
method _get_node_vector (line 182) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[Any]]:
method _get_node_vars (line 185) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_node_vector (line 190) | def _set_node_vector(self, vector: list[DualTypes], ad: int) -> None:
method _set_ad_order (line 203) | def _set_ad_order(self, order: int) -> None:
FILE: python/rateslib/curves/academic/sw.py
class _NullInterpolator (line 51) | class _NullInterpolator:
method _csolve (line 52) | def _csolve(self, curve_type: _CurveType, nodes: _CurveNodes, ad: int)...
function _dual_sinh (line 56) | def _dual_sinh(x: DualTypes) -> DualTypes:
class SmithWilsonCurve (line 60) | class SmithWilsonCurve(_WithMutability, _BaseCurve):
method __init__ (line 323) | def __init__(
method alpha (line 363) | def alpha(self) -> DualTypes:
method b (line 368) | def b(self) -> NDArray[Nobject]:
method ufr (line 373) | def ufr(self) -> DualTypes:
method k (line 378) | def k(self) -> DualTypes:
method w (line 400) | def w(self) -> DualTypes:
method u (line 405) | def u(self) -> NDArray[Nf64]:
method __getitem__ (line 410) | def __getitem__(self, date: datetime) -> DualTypes:
FILE: python/rateslib/curves/curves.py
class _WithOperations (line 79) | class _WithOperations:
method shift (line 86) | def shift(
method translate (line 112) | def translate(self, start: datetime, id: str_ = NoInput(0)) -> Transla...
method roll (line 134) | def roll(self, tenor: datetime | str | int, id: str_ = NoInput(0)) -> ...
class _BaseCurve (line 167) | class _BaseCurve(_WithState, _WithCache[datetime, DualTypes], _WithOpera...
method _meta (line 213) | def _meta(self) -> _CurveMeta:
method _interpolator (line 227) | def _interpolator(self) -> _CurveInterpolator:
method _nodes (line 241) | def _nodes(self) -> _CurveNodes: ...
method _id (line 245) | def _id(self) -> str:
method _ad (line 250) | def _ad(self) -> int: ...
method _base_type (line 254) | def _base_type(self) -> _CurveType: ...
method __getitem__ (line 259) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 297) | def _set_ad_order(self, order: int) -> None: ...
method ad (line 302) | def ad(self) -> int:
method meta (line 307) | def meta(self) -> _CurveMeta:
method id (line 312) | def id(self) -> str:
method nodes (line 318) | def nodes(self) -> _CurveNodes:
method _n (line 323) | def _n(self) -> int:
method interpolator (line 328) | def interpolator(self) -> _CurveInterpolator:
method rate (line 334) | def rate(
method _rate_with_raise (line 439) | def _rate_with_raise(
method _rate_with_raise_values (line 456) | def _rate_with_raise_values(
method _rate_with_raise_dfs (line 471) | def _rate_with_raise_dfs(
method _try_index_value (line 529) | def _try_index_value(
method index_value (line 597) | def index_value(
method plot (line 690) | def plot(
method _plot_diff (line 767) | def _plot_diff(
method _plot_modifier (line 780) | def _plot_modifier(self, upper_tenor: str) -> str:
method _plot_rates (line 789) | def _plot_rates(
method _plot_rate (line 832) | def _plot_rate(
method _plot_zero_rate (line 844) | def _plot_zero_rate(
method plot_index (line 863) | def plot_index(
method __eq__ (line 943) | def __eq__(self, other: Any) -> bool:
method __repr__ (line 955) | def __repr__(self) -> str:
method copy (line 958) | def copy(self) -> _BaseCurve:
class ShiftedCurve (line 973) | class ShiftedCurve(_BaseCurve):
method __init__ (line 1062) | def __init__(
method __getitem__ (line 1103) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 1106) | def _set_ad_order(self, ad: int) -> None:
method obj (line 1110) | def obj(self) -> _BaseCurve:
method _ad (line 1115) | def _ad(self) -> int:
method _meta (line 1119) | def _meta(self) -> _CurveMeta:
method _id (line 1123) | def _id(self) -> str:
method _nodes (line 1127) | def _nodes(self) -> _CurveNodes:
method _interpolator (line 1131) | def _interpolator(self) -> _CurveInterpolator:
method _base_type (line 1135) | def _base_type(self) -> _CurveType:
class TranslatedCurve (line 1139) | class TranslatedCurve(_BaseCurve):
method __init__ (line 1226) | def __init__(
method __getitem__ (line 1238) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 1246) | def _set_ad_order(self, ad: int) -> None:
method obj (line 1250) | def obj(self) -> _BaseCurve:
method _ad (line 1255) | def _ad(self) -> int:
method _interpolator (line 1259) | def _interpolator(self) -> _CurveInterpolator:
method _meta (line 1263) | def _meta(self) -> _CurveMeta:
method _base_type (line 1273) | def _base_type(self) -> _CurveType:
class RolledCurve (line 1277) | class RolledCurve(_BaseCurve):
method __init__ (line 1367) | def __init__(
method __getitem__ (line 1377) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 1413) | def _set_ad_order(self, order: int) -> None:
method obj (line 1417) | def obj(self) -> _BaseCurve:
method roll_days (line 1422) | def roll_days(self) -> int:
method _ad (line 1427) | def _ad(self) -> int:
method _interpolator (line 1431) | def _interpolator(self) -> _CurveInterpolator:
method _meta (line 1435) | def _meta(self) -> _CurveMeta:
method _nodes (line 1439) | def _nodes(self) -> _CurveNodes:
method _base_type (line 1443) | def _base_type(self) -> _CurveType:
class _WithMutability (line 1447) | class _WithMutability:
method __init__ (line 1467) | def __init__( # type: ignore[no-untyped-def]
method _set_ad_order (line 1520) | def _set_ad_order(self, order: int) -> None:
method _get_node_vector (line 1539) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[Any]]:
method _get_node_vars (line 1543) | def _get_node_vars(self) -> tuple[str, ...]:
method csolve (line 1551) | def csolve(self) -> None:
method update (line 1571) | def update(
method update_node (line 1609) | def update_node(self, key: datetime, value: DualTypes) -> None:
method update_meta (line 1646) | def update_meta(self, key: datetime, value: Any) -> None:
method _set_node_vector (line 1667) | def _set_node_vector(self, vector: list[DualTypes], ad: int) -> None:
method _set_node_vector_direct (line 1671) | def _set_node_vector_direct(self, vector: list[DualTypes], ad: int) ->...
method _from_json (line 1714) | def _from_json(cls, loaded_json: dict[str, Any]) -> _BaseCurve:
method to_json (line 1757) | def to_json(self) -> str:
class Curve (line 1786) | class Curve(_WithMutability, _BaseCurve):
method __init__ (line 1929) | def __init__(self, *args: Any, **kwargs: Any) -> None:
method __getitem__ (line 1932) | def __getitem__(self, date: datetime) -> DualTypes:
class LineCurve (line 1940) | class LineCurve(_WithMutability, _BaseCurve):
method __init__ (line 2083) | def __init__(self, *args: Any, **kwargs: Any) -> None:
method __getitem__ (line 2086) | def __getitem__(self, date: datetime) -> DualTypes:
class CompositeCurve (line 2090) | class CompositeCurve(_BaseCurve):
method __init__ (line 2279) | def __init__(
method meta (line 2302) | def meta(self) -> _CurveMeta:
method __getitem__ (line 2307) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 2343) | def _set_ad_order(self, order: int) -> None:
method _validate_state (line 2356) | def _validate_state(self) -> None:
method _get_composited_state (line 2366) | def _get_composited_state(self) -> int:
class MultiCsaCurve (line 2371) | class MultiCsaCurve(_BaseCurve):
method meta (line 2419) | def meta(self) -> _CurveMeta:
method __init__ (line 2424) | def __init__(
method __getitem__ (line 2440) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 2502) | def _set_ad_order(self, order: int) -> None:
method _validate_state (line 2515) | def _validate_state(self) -> None:
method _get_composited_state (line 2525) | def _get_composited_state(self) -> int:
function _validate_composited_curve_collection (line 2530) | def _validate_composited_curve_collection(
function _check_meta_attribute (line 2565) | def _check_meta_attribute(curves: tuple[_BaseCurve, ...], attr: str) -> ...
class ProxyCurve (line 2575) | class ProxyCurve(_BaseCurve):
method _ad (line 2619) | def _ad(self) -> int:
method interpolator (line 2623) | def interpolator(self) -> _ProxyCurveInterpolator: # type: ignore[ove...
method meta (line 2629) | def meta(self) -> _CurveMeta:
method __init__ (line 2634) | def __init__(
method __getitem__ (line 2660) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 2670) | def _set_ad_order(self, order: int) -> None:
method _validate_state (line 2673) | def _validate_state(self) -> None:
method _get_composited_state (line 2691) | def _get_composited_state(self) -> int:
class CreditImpliedCurve (line 2695) | class CreditImpliedCurve(_BaseCurve):
method _base_type (line 2803) | def _base_type(self) -> _CurveType:
method _id (line 2807) | def _id(self) -> str:
method _ad (line 2811) | def _ad(self) -> int:
method __init__ (line 2816) | def __init__(
method __getitem__ (line 2840) | def __getitem__(self, date: datetime) -> DualTypes:
method _set_ad_order (line 2844) | def _set_ad_order(self, order: int) -> None:
method obj (line 2848) | def obj(self) -> CompositeCurve:
method meta (line 2854) | def meta(self) -> _CurveMeta:
method _nodes (line 2859) | def _nodes(self) -> _CurveNodes:
method _composite_scalars (line 2862) | def _composite_scalars(self) -> list[float | Dual | Dual2 | Variable]:
method _get_composited_state (line 2871) | def _get_composited_state(self) -> int:
method _validate_state (line 2875) | def _validate_state(self) -> None:
function index_value (line 2898) | def index_value(
function _try_index_value (line 2978) | def _try_index_value(
function _index_value_from_mixed_series_and_curve (line 3065) | def _index_value_from_mixed_series_and_curve(
function _index_value_from_series_no_curve (line 3168) | def _index_value_from_series_no_curve(
FILE: python/rateslib/curves/interpolation.py
class InterpolationFunction (line 36) | class InterpolationFunction(Protocol):
method __call__ (line 38) | def __call__(self, date: datetime, curve: _BaseCurve) -> DualTypes: ...
function _linear (line 41) | def _linear(date: datetime, curve: _BaseCurve) -> DualTypes:
function _linear_bus (line 48) | def _linear_bus(date: datetime, curve: _BaseCurve) -> DualTypes:
function _log_linear (line 58) | def _log_linear(date: datetime, curve: _BaseCurve) -> DualTypes:
function _log_linear_bus (line 65) | def _log_linear_bus(date: datetime, curve: _BaseCurve) -> DualTypes:
function _flat_forward (line 75) | def _flat_forward(date: datetime, curve: _BaseCurve) -> DualTypes:
function _flat_backward (line 84) | def _flat_backward(date: datetime, curve: _BaseCurve) -> DualTypes:
function _linear_zero_rate (line 93) | def _linear_zero_rate(date: datetime, curve: _BaseCurve) -> DualTypes:
function _linear_index (line 116) | def _linear_index(date: datetime, curve: _BaseCurve) -> DualTypes:
function _runtime_error (line 123) | def _runtime_error(date: datetime, curve: _BaseCurve) -> DualTypes:
function _get_posix (line 144) | def _get_posix(date: datetime, curve: _BaseCurve) -> tuple[float, float,...
function index_left (line 157) | def index_left(
FILE: python/rateslib/curves/rs.py
class CurveRs (line 48) | class CurveRs:
method __init__ (line 49) | def __init__(
method id (line 79) | def id(self) -> str:
method convention (line 83) | def convention(self) -> str:
method modifier (line 87) | def modifier(self) -> str:
method interpolation (line 91) | def interpolation(self) -> str:
method nodes (line 95) | def nodes(self) -> dict[datetime, Number]:
method ad (line 99) | def ad(self) -> int:
method _set_ad_order (line 107) | def _set_ad_order(self, ad: int) -> None:
method _validate_interpolator (line 111) | def _validate_interpolator(
method to_json (line 121) | def to_json(self) -> str:
method __init_from_obj__ (line 125) | def __init_from_obj__(cls, obj: CurveObj) -> CurveRs:
method __eq__ (line 136) | def __eq__(self, other: Any) -> bool:
method __getitem__ (line 141) | def __getitem__(self, value: datetime) -> Number:
function _get_interpolator (line 145) | def _get_interpolator(name: str) -> CurveInterpolator:
FILE: python/rateslib/curves/utils.py
class _CurveType (line 47) | class _CurveType(Enum):
class _CreditImpliedType (line 57) | class _CreditImpliedType(Enum):
class _CurveMeta (line 69) | class _CurveMeta:
method calendar (line 85) | def calendar(self) -> CalTypes:
method convention (line 90) | def convention(self) -> Convention:
method modifier (line 95) | def modifier(self) -> str:
method index_base (line 100) | def index_base(self) -> Variable | float_:
method index_lag (line 105) | def index_lag(self) -> int:
method collateral (line 110) | def collateral(self) -> str | None:
method credit_discretization (line 116) | def credit_discretization(self) -> int:
method credit_recovery_rate (line 121) | def credit_recovery_rate(self) -> float | Variable:
method to_json (line 125) | def to_json(self) -> str:
method _from_json (line 154) | def _from_json(cls, loaded_json: dict[str, Any]) -> _CurveMeta:
class _CurveSpline (line 169) | class _CurveSpline:
method __init__ (line 179) | def __init__(self, t: list[datetime], endpoints: tuple[str, str]) -> N...
method t (line 189) | def t(self) -> list[datetime]:
method t_posix (line 194) | def t_posix(self) -> list[float]:
method spline (line 199) | def spline(self) -> PPSplineF64 | PPSplineDual | PPSplineDual2 | None:
method endpoints (line 206) | def endpoints(self) -> tuple[str, str]:
method _csolve (line 211) | def _csolve(self, curve_type: _CurveType, nodes: _CurveNodes, ad: int)...
method to_json (line 257) | def to_json(self) -> str:
method _from_json (line 278) | def _from_json(cls, loaded_json: dict[str, Any]) -> _CurveSpline:
method __eq__ (line 284) | def __eq__(self, other: Any) -> bool:
class _CurveInterpolator (line 294) | class _CurveInterpolator:
method __init__ (line 304) | def __init__(
method local (line 354) | def local(self) -> str | InterpolationFunction:
method local_name (line 361) | def local_name(self) -> str:
method local_func (line 366) | def local_func(self) -> InterpolationFunction:
method spline (line 371) | def spline(self) -> _CurveSpline | None:
method convention (line 376) | def convention(self) -> Convention:
method _csolve (line 381) | def _csolve(self, curve_type: _CurveType, nodes: _CurveNodes, ad: int)...
method __eq__ (line 386) | def __eq__(self, other: Any) -> bool:
method to_json (line 396) | def to_json(self) -> str:
method _from_json (line 420) | def _from_json(cls, loaded_json: dict[str, Any]) -> _CurveInterpolator:
class _ProxyCurveInterpolator (line 443) | class _ProxyCurveInterpolator:
method fx_forwards (line 454) | def fx_forwards(self) -> FXForwards:
method cash (line 460) | def cash(self) -> str:
method collateral (line 465) | def collateral(self) -> str:
method pair (line 470) | def pair(self) -> str:
method cash_index (line 475) | def cash_index(self) -> int:
method collateral_index (line 480) | def collateral_index(self) -> int:
method cash_pair (line 485) | def cash_pair(self) -> str:
method collateral_pair (line 490) | def collateral_pair(self) -> str:
class _CurveNodes (line 496) | class _CurveNodes:
method __post_init__ (line 503) | def __post_init__(self) -> None:
method nodes (line 512) | def nodes(self) -> dict[datetime, DualTypes]:
method keys (line 517) | def keys(self) -> list[datetime]:
method values (line 522) | def values(self) -> list[DualTypes]:
method n (line 527) | def n(self) -> int:
method posix_keys (line 532) | def posix_keys(self) -> list[float]:
method initial (line 537) | def initial(self) -> datetime:
method final (line 542) | def final(self) -> datetime:
method to_json (line 546) | def to_json(self) -> str:
method _from_json (line 567) | def _from_json(cls, loaded_json: dict[str, Any]) -> _CurveNodes:
function average_rate (line 573) | def average_rate(
FILE: python/rateslib/data/fixings.py
class _BaseFixing (line 83) | class _BaseFixing(metaclass=ABCMeta):
method __init__ (line 104) | def __init__(
method reset (line 116) | def reset(self, state: int_ = NoInput(0)) -> None:
method value (line 165) | def value(self) -> DualTypes_:
method date (line 191) | def date(self) -> datetime:
method identifier (line 196) | def identifier(self) -> str_:
method _lookup_and_calculate (line 201) | def _lookup_and_calculate(
method __repr__ (line 208) | def __repr__(self) -> str:
class IndexFixing (line 212) | class IndexFixing(_BaseFixing):
method __init__ (line 258) | def __init__(
method index_method (line 273) | def index_method(self) -> IndexMethod:
method index_lag (line 279) | def index_lag(self) -> int:
method _lookup_and_calculate (line 283) | def _lookup_and_calculate(
method _lookup (line 297) | def _lookup(
class FXIndex (line 320) | class FXIndex:
method __init__ (line 371) | def __init__(
method __repr__ (line 395) | def __repr__(self) -> str:
method pair (line 399) | def pair(self) -> str:
method calendar (line 404) | def calendar(self) -> CalTypes:
method settle (line 409) | def settle(self) -> Adjuster:
method isda_mtm_calendar (line 417) | def isda_mtm_calendar(self) -> CalTypes | NoInput:
method isda_mtm_settle (line 422) | def isda_mtm_settle(self) -> Adjuster | NoInput:
method isda_fixing_date (line 429) | def isda_fixing_date(self, delivery: datetime) -> datetime:
method delivery (line 462) | def delivery(self, date: datetime) -> datetime:
method publications (line 477) | def publications(self, delivery: datetime) -> list[datetime]:
method allow_cross (line 493) | def allow_cross(self) -> bool:
class _FXFixingMajor (line 498) | class _FXFixingMajor(_BaseFixing):
method __init__ (line 574) | def __init__(
method fx_index (line 612) | def fx_index(self) -> FXIndex:
method _value_from_possible_inversion (line 616) | def _value_from_possible_inversion(self, identifier: str) -> DualTypes_:
method publication (line 639) | def publication(self) -> datetime:
method delivery (line 645) | def delivery(self) -> datetime:
method value (line 651) | def value(self) -> DualTypes_:
method _lookup_and_calculate (line 660) | def _lookup_and_calculate(
method _lookup (line 666) | def _lookup(
method pair (line 685) | def pair(self) -> str:
method value_or_forecast (line 689) | def value_or_forecast(self, fx: FXForwards_) -> DualTypes:
method try_value_or_forecast (line 708) | def try_value_or_forecast(self, fx: FXForwards_) -> Result[DualTypes]:
method __repr__ (line 729) | def __repr__(self) -> str:
function _clone_isda_mtm (line 733) | def _clone_isda_mtm(pair: FXIndex | str, isda_index: FXIndex) -> FXIndex:
function _fx_index_set_cross (line 759) | def _fx_index_set_cross(pair: FXIndex, allow_cross: bool) -> FXIndex:
class _UnitFixing (line 770) | class _UnitFixing(_BaseFixing):
method __init__ (line 776) | def __init__(
method value (line 785) | def value(self) -> DualTypes_:
method value_or_forecast (line 789) | def value_or_forecast(self, *args: Any, **kwargs: Any) -> DualTypes:
method __repr__ (line 793) | def __repr__(self) -> str:
method reset (line 796) | def reset(self, *args: Any, **kwargs: Any) -> None:
method _lookup_and_calculate (line 800) | def _lookup_and_calculate(self, *args: Any, **kwargs: Any) -> DualTypes_:
class _WMRClassification (line 808) | class _WMRClassification(Enum):
method classify (line 820) | def classify(cls, value: str) -> _WMRClassification:
class FXFixing (line 831) | class FXFixing(_BaseFixing):
method __init__ (line 975) | def __init__(
method _state (line 1126) | def _state(self) -> int: # type: ignore[override]
method fx_fixing1 (line 1130) | def fx_fixing1(self) -> _FXFixingMajor:
method fx_fixing2 (line 1137) | def fx_fixing2(self) -> _FXFixingMajor | _UnitFixing:
method fx_fixing3 (line 1144) | def fx_fixing3(self) -> _FXFixingMajor | _UnitFixing:
method allow_cross (line 1151) | def allow_cross(self) -> bool:
method fx_index (line 1157) | def fx_index(self) -> FXIndex:
method publication (line 1162) | def publication(self) -> datetime:
method delivery (line 1168) | def delivery(self) -> datetime:
method value (line 1174) | def value(self) -> DualTypes_:
method pair (line 1189) | def pair(self) -> str:
method value_or_forecast (line 1193) | def value_or_forecast(self, fx: FXForwards_) -> DualTypes:
method try_value_or_forecast (line 1215) | def try_value_or_forecast(self, fx: FXForwards_) -> Result[DualTypes]:
method _lookup_and_calculate (line 1236) | def _lookup_and_calculate(
method _lookup (line 1242) | def _lookup(
method __repr__ (line 1261) | def __repr__(self) -> str:
method reset (line 1267) | def reset(self, state: int_ = NoInput(0)) -> None:
class IRSSeries (line 1280) | class IRSSeries:
method __init__ (line 1343) | def __init__(
method currency (line 1373) | def currency(self) -> str:
method settle (line 1378) | def settle(self) -> Adjuster:
method calendar (line 1384) | def calendar(self) -> Cal | NamedCal | UnionCal:
method frequency (line 1389) | def frequency(self) -> Frequency:
method leg2_frequency (line 1395) | def leg2_frequency(self) -> Frequency:
method convention (line 1401) | def convention(self) -> Convention:
method leg2_convention (line 1407) | def leg2_convention(self) -> Convention:
method modifier (line 1413) | def modifier(self) -> Adjuster:
method payment_lag (line 1419) | def payment_lag(self) -> Adjuster | int | str_:
method eom (line 1425) | def eom(self) -> bool:
method leg2_fixing_method (line 1430) | def leg2_fixing_method(self) -> FloatFixingMethod:
method __repr__ (line 1435) | def __repr__(self) -> str:
function _get_irs_series (line 1439) | def _get_irs_series(val: IRSSeries | str) -> IRSSeries:
class IRSFixing (line 1446) | class IRSFixing(_BaseFixing):
method __init__ (line 1508) | def __init__(
method tenor (line 1522) | def tenor(self) -> datetime | str:
method irs_series (line 1527) | def irs_series(self) -> IRSSeries:
method irs (line 1532) | def irs(self) -> IRS:
method annuity (line 1551) | def annuity(
method publication (line 1633) | def publication(self) -> datetime:
method effective (line 1638) | def effective(self) -> datetime:
method termination (line 1643) | def termination(self) -> datetime:
method value_or_forecast (line 1658) | def value_or_forecast(self, curves: CurvesT_) -> DualTypes:
method try_value_or_forecast (line 1677) | def try_value_or_forecast(self, curves: CurvesT_) -> Result[DualTypes]:
method _lookup_and_calculate (line 1699) | def _lookup_and_calculate(
method _lookup (line 1707) | def _lookup(
method __repr__ (line 1725) | def __repr__(self) -> str:
function _maybe_get_fx_index (line 1729) | def _maybe_get_fx_index(val: FXIndex | str_) -> FXIndex_:
function _get_fx_index (line 1736) | def _get_fx_index(val: FXIndex | str) -> FXIndex:
class IBORFixing (line 1770) | class IBORFixing(_BaseFixing):
method __init__ (line 1823) | def __init__(
method index (line 1847) | def index(self) -> FloatRateIndex:
method series (line 1852) | def series(self) -> FloatRateSeries:
method accrual_start (line 1857) | def accrual_start(self) -> datetime:
method accrual_end (line 1862) | def accrual_end(self) -> datetime:
method _lookup_and_calculate (line 1866) | def _lookup_and_calculate(
method _lookup (line 1874) | def _lookup(
class IBORStubFixing (line 1893) | class IBORStubFixing(_BaseFixing):
method __init__ (line 2003) | def __init__(
method date (line 2056) | def date(self) -> datetime:
method fixing1 (line 2061) | def fixing1(self) -> IBORFixing | NoInput:
method fixing2 (line 2066) | def fixing2(self) -> IBORFixing | NoInput:
method value (line 2071) | def value(self) -> DualTypes_:
method reset (line 2088) | def reset(self, state: int_ = NoInput(0)) -> None:
method weights (line 2096) | def weights(self) -> tuple[float, float]:
method series (line 2111) | def series(self) -> FloatRateSeries:
method accrual_start (line 2116) | def accrual_start(self) -> datetime:
method accrual_end (line 2121) | def accrual_end(self) -> datetime:
method _lookup_and_calculate (line 2125) | def _lookup_and_calculate(
method _stub_tenors_from_list (line 2132) | def _stub_tenors_from_list(self, tenors: list[str]) -> tuple[list[str]...
class RFRFixing (line 2221) | class RFRFixing(_BaseFixing):
method __init__ (line 2312) | def __init__(
method reset (line 2337) | def reset(self, state: int_ = NoInput(0)) -> None:
method fixing_method (line 2344) | def fixing_method(self) -> FloatFixingMethod:
method float_spread (line 2349) | def float_spread(self) -> DualTypes:
method spread_compound_method (line 2354) | def spread_compound_method(self) -> SpreadCompoundMethod:
method accrual_start (line 2360) | def accrual_start(self) -> datetime:
method accrual_end (line 2365) | def accrual_end(self) -> datetime:
method value (line 2370) | def value(self) -> DualTypes_:
method populated (line 2387) | def populated(self) -> Series[DualTypes]: # type: ignore[type-var]
method unpopulated (line 2392) | def unpopulated(self) -> Series[DualTypes]: # type: ignore[type-var]
method _lookup_and_calculate (line 2398) | def _lookup_and_calculate(
method _lookup (line 2415) | def _lookup(
method rate_index (line 2453) | def rate_index(self) -> FloatRateIndex:
method dates_obs (line 2458) | def dates_obs(self) -> Arr1dObj:
method dates_dcf (line 2464) | def dates_dcf(self) -> Arr1dObj:
method dcfs_obs (line 2470) | def dcfs_obs(self) -> Arr1dF64:
method dcfs_dcf (line 2480) | def dcfs_dcf(self) -> Arr1dF64:
method bounds (line 2490) | def bounds(self) -> tuple[tuple[datetime, datetime], tuple[datetime, d...
method _get_date_bounds (line 2501) | def _get_date_bounds(
class FloatRateIndex (line 2552) | class FloatRateIndex:
method __init__ (line 2571) | def __init__(
method frequency (line 2580) | def frequency(self) -> Frequency:
method series (line 2585) | def series(self) -> FloatRateSeries:
method lag (line 2590) | def lag(self) -> int:
method calendar (line 2595) | def calendar(self) -> CalTypes:
method modifier (line 2600) | def modifier(self) -> Adjuster:
method eom (line 2605) | def eom(self) -> bool:
method convention (line 2610) | def convention(self) -> Convention:
class FloatRateSeries (line 2615) | class FloatRateSeries:
method __init__ (line 2653) | def __init__(
method lag (line 2676) | def lag(self) -> int:
method calendar (line 2682) | def calendar(self) -> CalTypes:
method convention (line 2687) | def convention(self) -> Convention:
method modifier (line 2692) | def modifier(self) -> Adjuster:
method eom (line 2697) | def eom(self) -> bool:
method zero_period_stub (line 2703) | def zero_period_stub(self) -> StubInference:
method tenors (line 2709) | def tenors(self) -> list[str] | NoInput:
class _IBORRate (line 2716) | class _IBORRate:
method _rate (line 2718) | def _rate(
method _rate_interpolated_stub (line 2759) | def _rate_interpolated_stub(
method _rate_interpolated_stub_maybe_from_fixings (line 2799) | def _rate_interpolated_stub_maybe_from_fixings(
method _rate_interpolated_stub_from_curve_dict (line 2868) | def _rate_interpolated_stub_from_curve_dict(
method _rate_single_tenor (line 2916) | def _rate_single_tenor(
method _rate_tenor_maybe_from_fixings (line 2946) | def _rate_tenor_maybe_from_fixings(
method _rate_tenor_forecast_from_curve (line 2987) | def _rate_tenor_forecast_from_curve(
method _rate_stub_forecast_from_curve (line 3026) | def _rate_stub_forecast_from_curve(
method _interpolated_stub_rate (line 3052) | def _interpolated_stub_rate(
class _RFRRate (line 3069) | class _RFRRate:
method _rate (line 3082) | def _rate(
method _efficient_calculation (line 3238) | def _efficient_calculation(
method _semi_efficient_calculation (line 3263) | def _semi_efficient_calculation(
method _inefficient_calculation (line 3292) | def _inefficient_calculation(
method _get_dates_and_fixing_rates_from_fixings (line 3338) | def _get_dates_and_fixing_rates_from_fixings(
method _forecast_fixing_rates_from_curve (line 3399) | def _forecast_fixing_rates_from_curve(
method _push_rate_fixings_as_series_to_fixing_rates (line 3436) | def _push_rate_fixings_as_series_to_fixing_rates(
method _adjust_dates (line 3497) | def _adjust_dates(
method _get_obs_and_dcf_dates (line 3551) | def _get_obs_and_dcf_dates(
method _get_dcf_values (line 3568) | def _get_dcf_values(
method _is_rfr_efficient (line 3596) | def _is_rfr_efficient(
method _calculator_rate_rfr_avg_with_spread (line 3622) | def _calculator_rate_rfr_avg_with_spread(
method _calculator_rate_rfr_isda_compounded_with_spread (line 3649) | def _calculator_rate_rfr_isda_compounded_with_spread(
function _get_float_rate_series (line 3691) | def _get_float_rate_series(val: FloatRateSeries | str) -> FloatRateSeries:
function _get_float_rate_series_or_blank (line 3711) | def _get_float_rate_series_or_blank(val: FloatRateSeries | str_) -> Floa...
function _maybe_get_rate_series_from_curve (line 3718) | def _maybe_get_rate_series_from_curve(
function _leg_fixings_to_list (line 3762) | def _leg_fixings_to_list(rate_fixings: LegFixings, n_periods: int) -> li...
FILE: python/rateslib/data/loader.py
class _BaseFixingsLoader (line 38) | class _BaseFixingsLoader(metaclass=ABCMeta):
method __getitem__ (line 56) | def __getitem__(self, name: str) -> tuple[int, Series[DualTypes], tupl...
method add (line 85) | def add(self, name: str, series: Series[DualTypes], state: int_ = NoIn...
method pop (line 120) | def pop(self, name: str) -> Series[DualTypes] | None: # type: ignore[...
method __try_getitem__ (line 139) | def __try_getitem__(
method __base_lookup__ (line 149) | def __base_lookup__(
method get_stub_ibor_fixings (line 172) | def get_stub_ibor_fixings(
class DefaultFixingsLoader (line 254) | class DefaultFixingsLoader(_BaseFixingsLoader):
method __init__ (line 261) | def __init__(self) -> None:
method directory (line 266) | def directory(self) -> str:
method directory (line 271) | def directory(self, val: str) -> None:
method loaded (line 275) | def loaded(self) -> dict[str, tuple[int, Series[DualTypes], tuple[date...
method _load_csv (line 280) | def _load_csv(directory: str, path: str) -> Series[DualTypes]: # type...
method __getitem__ (line 294) | def __getitem__(self, name: str) -> tuple[int, Series[DualTypes], tupl...
method add (line 312) | def add(self, name: str, series: Series[DualTypes], state: int_ = NoIn...
method pop (line 325) | def pop(self, name: str) -> Series[DualTypes] | None: # type: ignore[...
class Fixings (line 334) | class Fixings(_BaseFixingsLoader):
method __new__ (line 402) | def __new__(cls) -> Fixings:
method __getitem__ (line 411) | def __getitem__(self, name: str) -> tuple[int, Series[DualTypes], tupl...
method loader (line 415) | def loader(self) -> _BaseFixingsLoader:
method loader (line 422) | def loader(self, loader: _BaseFixingsLoader) -> None:
method add (line 425) | def add(self, name: str, series: Series[DualTypes], state: int_ = NoIn...
method pop (line 448) | def pop(self, name: str) -> Series[DualTypes] | None: # type: ignore[...
class FixingRangeError (line 466) | class FixingRangeError(Exception):
method __init__ (line 467) | def __init__(self, date: datetime, boundary: tuple[datetime, datetime]...
class FixingMissingDataError (line 476) | class FixingMissingDataError(Exception):
method __init__ (line 477) | def __init__(self, date: datetime, boundary: tuple[datetime, datetime]...
class FixingMissingForecasterError (line 487) | class FixingMissingForecasterError(Exception):
method __init__ (line 488) | def __init__(self) -> None:
function _find_neighbouring_tenors (line 492) | def _find_neighbouring_tenors(
FILE: python/rateslib/default.py
class Defaults (line 539) | class Defaults:
method __new__ (line 614) | def __new__(cls) -> Defaults:
method reset_defaults (line 624) | def reset_defaults(self) -> None:
method print (line 646) | def print(self) -> str:
function plot (line 739) | def plot(
function plot3d (line 764) | def plot3d(
function _make_py_json (line 780) | def _make_py_json(json: str, class_name: str) -> str:
FILE: python/rateslib/dual/ift.py
function ift_1dim (line 31) | def ift_1dim(
function _bisection (line 228) | def _bisection(
function _root_f (line 288) | def _root_f(x: float, s: Callable[[DualTypes], DualTypes], s_tgt: float)...
function _dekker (line 293) | def _dekker(
function _brent (line 372) | def _brent(
function _ytm_quadratic (line 456) | def _ytm_quadratic(
function _quadratic_approx (line 546) | def _quadratic_approx(
FILE: python/rateslib/dual/newton.py
function _solver_result (line 44) | def _solver_result(
function _dual_float_or_unchanged (line 65) | def _dual_float_or_unchanged(x: T | DualTypes) -> T | float:
function newton_1dim (line 72) | def newton_1dim(
function newton_ndim (line 218) | def newton_ndim(
function _is_any_dual (line 344) | def _is_any_dual(arr: np.ndarray[tuple[int, ...], np.dtype[np.object_]])...
function _is_any_dual2 (line 348) | def _is_any_dual2(arr: np.ndarray[tuple[int, ...], np.dtype[np.object_]]...
FILE: python/rateslib/dual/quadratic.py
function quadratic_eqn (line 27) | def quadratic_eqn(
FILE: python/rateslib/dual/utils.py
function _dual_float (line 48) | def _dual_float(val: DualTypes) -> float:
function _dual_round (line 61) | def _dual_round(val: DualTypes, ndigits: int) -> DualTypes:
function _float_or_none (line 77) | def _float_or_none(val: DualTypes | None | NoInput | Result[DualTypes]) ...
function _abs_float (line 86) | def _abs_float(val: DualTypes) -> float:
function _get_order_of (line 94) | def _get_order_of(val: DualTypes) -> int:
function _to_number (line 107) | def _to_number(val: DualTypes) -> Number:
function set_order (line 114) | def set_order(val: DualTypes, order: int) -> Number:
function set_order_convert (line 157) | def set_order_convert(
function gradient (line 210) | def gradient(
function _validate_keep_manifold (line 276) | def _validate_keep_manifold(keep_manifold: bool, order: int, dual: DualT...
function dual_exp (line 287) | def dual_exp(x: DualTypes) -> Number:
function dual_log (line 305) | def dual_log(x: DualTypes, base: int | None = None) -> Number:
function dual_norm_pdf (line 332) | def dual_norm_pdf(x: DualTypes) -> Number:
function dual_norm_cdf (line 347) | def dual_norm_cdf(x: DualTypes) -> Number:
function dual_inv_norm_cdf (line 365) | def dual_inv_norm_cdf(x: DualTypes) -> Number:
function dual_solve (line 383) | def dual_solve(
function _get_adorder (line 452) | def _get_adorder(order: int) -> ADOrder:
function _set_ad_order_objects (line 464) | def _set_ad_order_objects(order: list[int] | dict[int, int], objs: list[...
FILE: python/rateslib/dual/variable.py
class Variable (line 34) | class Variable:
method __init__ (line 60) | def __init__(
method _to_dual_type (line 74) | def _to_dual_type(self, order: int) -> Dual | Dual2:
method to_json (line 86) | def to_json(self) -> str:
method _from_json (line 108) | def _from_json(cls, loaded_json: dict[str, Any]) -> Variable:
method to_dual (line 115) | def to_dual(self) -> Dual:
method to_dual2 (line 118) | def to_dual2(self) -> Dual2:
method __eq__ (line 121) | def __eq__(self, argument: Any) -> bool:
method __lt__ (line 132) | def __lt__(self, other: Any) -> bool:
method __le__ (line 135) | def __le__(self, other: Any) -> bool:
method __gt__ (line 138) | def __gt__(self, other: Any) -> bool:
method __ge__ (line 141) | def __ge__(self, other: Any) -> bool:
method __eq_coeffs__ (line 144) | def __eq_coeffs__(self, argument: Dual | Dual2 | Variable, precision: ...
method __abs__ (line 157) | def __abs__(self) -> float:
method __neg__ (line 160) | def __neg__(self) -> Variable:
method __add__ (line 163) | def __add__(self, other: Dual | Dual2 | float | Variable) -> Dual | Du...
method __radd__ (line 177) | def __radd__(self, other: Dual | Dual2 | float | Variable) -> Dual | D...
method __rsub__ (line 180) | def __rsub__(self, other: Dual | Dual2 | float | Variable) -> Dual | D...
method __sub__ (line 183) | def __sub__(self, other: Dual | Dual2 | float | Variable) -> Dual | Du...
method __mul__ (line 186) | def __mul__(self, other: Dual | Dual2 | float | Variable) -> Dual | Du...
method __rmul__ (line 200) | def __rmul__(self, other: Dual | Dual2 | float | Variable) -> Dual | D...
method __truediv__ (line 203) | def __truediv__(self, other: Dual | Dual2 | float | Variable) -> Dual ...
method __rtruediv__ (line 217) | def __rtruediv__(self, other: Dual | Dual2 | float | Variable) -> Dual...
method __exp__ (line 233) | def __exp__(self) -> Dual | Dual2:
method __log__ (line 237) | def __log__(self) -> Dual | Dual2:
method __norm_cdf__ (line 241) | def __norm_cdf__(self) -> Dual | Dual2:
method __norm_inv_cdf__ (line 245) | def __norm_inv_cdf__(self) -> Dual | Dual2:
method __pow__ (line 249) | def __pow__(self, exponent: float | Dual | Dual2, modulo: int | None =...
method __repr__ (line 253) | def __repr__(self) -> str:
FILE: python/rateslib/enums/generics.py
class Err (line 21) | class Err:
method __init__ (line 28) | def __init__(self, exception: Exception) -> None:
method __repr__ (line 31) | def __repr__(self) -> str:
method is_err (line 35) | def is_err(self) -> bool:
method is_ok (line 39) | def is_ok(self) -> bool:
method unwrap (line 42) | def unwrap(self) -> NoReturn:
class Ok (line 46) | class Ok(Generic[T]):
method __init__ (line 51) | def __init__(self, value: T) -> None:
method __repr__ (line 54) | def __repr__(self) -> str:
method is_err (line 58) | def is_err(self) -> bool:
method is_ok (line 62) | def is_ok(self) -> bool:
method unwrap (line 65) | def unwrap(self) -> T:
class NoInput (line 72) | class NoInput(Enum):
function _validate_obj_not_no_input (line 84) | def _validate_obj_not_no_input(obj: T | NoInput, expected: str) -> T:
function _try_validate_obj_not_no_input (line 90) | def _try_validate_obj_not_no_input(obj: T | NoInput, expected: str) -> R...
function _drb (line 97) | def _drb(default: Any, possible_ni: Any | NoInput) -> Any:
FILE: python/rateslib/enums/parameters.py
class OptionType (line 51) | class OptionType(float, Enum):
class FXOptionMetric (line 60) | class FXOptionMetric(Enum):
class OptionPricingModel (line 69) | class OptionPricingModel(Enum):
class SwaptionSettlementMethod (line 78) | class SwaptionSettlementMethod(Enum):
class LegMtm (line 88) | class LegMtm(Enum):
class IndexMethod (line 101) | class IndexMethod(Enum):
method __str__ (line 115) | def __str__(self) -> str:
class SpreadCompoundMethod (line 119) | class SpreadCompoundMethod(Enum):
method __str__ (line 128) | def __str__(self) -> str:
class FXDeltaMethod (line 132) | class FXDeltaMethod(Enum):
method __str__ (line 142) | def __str__(self) -> str:
function _get_option_pricing_model (line 160) | def _get_option_pricing_model(
function _get_swaption_settlement_method (line 184) | def _get_swaption_settlement_method(
function _get_leg_mtm (line 206) | def _get_leg_mtm(leg_mtm: str | LegMtm) -> LegMtm:
function _get_leg_index_base (line 225) | def _get_leg_index_base(leg_index: str | LegIndexBase) -> LegIndexBase:
function _get_index_method (line 245) | def _get_index_method(index_method: str | IndexMethod) -> IndexMethod:
function _get_float_fixing_method (line 280) | def _get_float_fixing_method(method: str | FloatFixingMethod) -> FloatFi...
function _get_spread_compound_method (line 317) | def _get_spread_compound_method(method: str | SpreadCompoundMethod) -> S...
function _get_fx_delta_type (line 340) | def _get_fx_delta_type(method: str | FXDeltaMethod) -> FXDeltaMethod:
function _get_fx_option_metric (line 358) | def _get_fx_option_metric(method: str | FXOptionMetric) -> FXOptionMetric:
function _get_ir_option_metric (line 383) | def _get_ir_option_metric(method: str | IROptionMetric) -> IROptionMetric:
FILE: python/rateslib/fx/fx_forwards.py
class FXForwards (line 63) | class FXForwards(_WithState, _WithCache[tuple[str, datetime], DualTypes]):
method update (line 133) | def update(self, fx_rates: list[dict[str, float]] | NoInput = NoInput(...
method __init__ (line 205) | def __init__(
method fx_proxy_curves (line 219) | def fx_proxy_curves(self) -> dict[str, ProxyCurve]:
method _get_composited_state (line 225) | def _get_composited_state(self) -> int:
method _validate_state (line 232) | def _validate_state(self) -> None:
method _validate_fx_curves (line 236) | def _validate_fx_curves(self, fx_curves: dict[str, _BaseCurve]) -> None:
method _calculate_immediate_rates (line 266) | def _calculate_immediate_rates(self, base: str | NoInput, init: bool) ...
method _calculate_immediate_rates_same_settlement_frame (line 350) | def _calculate_immediate_rates_same_settlement_frame(self) -> FXRates:
method __repr__ (line 390) | def __repr__(self) -> str:
method _get_curves_for_currencies (line 400) | def _get_curves_for_currencies(
method rate (line 413) | def rate(
method _rate_without_validation (line 457) | def _rate_without_validation(self, pair: str, settlement: datetime_ = ...
method _rate_direct (line 493) | def _rate_direct(
method positions (line 519) | def positions(
method convert (line 598) | def convert(
method convert_positions (line 687) | def convert_positions(
method swap (line 770) | def swap(
method _full_curve (line 797) | def _full_curve(self, cashflow: str, collateral: str) -> _BaseCurve:
method curve (line 843) | def curve(
method plot (line 914) | def plot(
method _set_ad_order (line 976) | def _set_ad_order(self, order: int) -> None:
method to_json (line 990) | def to_json(self) -> str:
method from_json (line 1003) | def from_json(cls, fx_forwards: str, **kwargs) -> FXForwards: # type:...
method __eq__ (line 1036) | def __eq__(self, other: Any) -> bool:
method __ne__ (line 1069) | def __ne__(self, other: Any) -> bool:
method copy (line 1073) | def copy(self) -> FXForwards:
function forward_fx (line 1085) | def forward_fx(
function _get_curves_indicator_array (line 1184) | def _get_curves_indicator_array(
function _validate_curves_indicator_array (line 1205) | def _validate_curves_indicator_array(T: np.ndarray[tuple[int, int], np.d...
function _recursive_pair_population (line 1229) | def _recursive_pair_population(
function _create_initial_mapping (line 1288) | def _create_initial_mapping(
FILE: python/rateslib/fx/fx_rates.py
class FXRates (line 57) | class FXRates(_WithState):
method __init__ (line 125) | def __init__(
method __init_from_obj__ (line 150) | def __init_from_obj__(cls, obj: FXRatesObj) -> FXRates:
method __init_post_obj__ (line 158) | def __init_post_obj__(self) -> None:
method __eq__ (line 161) | def __eq__(self, other: Any) -> bool:
method __ne__ (line 166) | def __ne__(self, other: Any) -> bool:
method __copy__ (line 169) | def __copy__(self) -> FXRates:
method __repr__ (line 174) | def __repr__(self) -> str:
method fx_array (line 184) | def fx_array(self) -> Arr2dObj:
method _fx_array_el (line 189) | def _fx_array_el(self, i: int, j: int) -> Number:
method base (line 194) | def base(self) -> str:
method settlement (line 204) | def settlement(self) -> datetime:
method pairs (line 209) | def pairs(self) -> list[str]:
method fx_rates (line 215) | def fx_rates(self) -> dict[str, DualTypes]:
method currencies_list (line 220) | def currencies_list(self) -> list[str]:
method currencies (line 225) | def currencies(self) -> dict[str, int]:
method q (line 232) | def q(self) -> int:
method fx_vector (line 237) | def fx_vector(self) -> Arr1dObj:
method pairs_settlement (line 242) | def pairs_settlement(self) -> dict[str, datetime]:
method variables (line 248) | def variables(self) -> tuple[str, ...]:
method _ad (line 254) | def _ad(self) -> int:
method rate (line 257) | def rate(self, pair: FXIndex | str) -> Number:
method restate (line 284) | def restate(self, pairs: list[str], keep_ad: bool = False) -> FXRates:
method convert (line 339) | def convert(
method convert_positions (line 394) | def convert_positions(
method positions (line 429) | def positions(
method _get_positions_from_delta (line 468) | def _get_positions_from_delta(
method rates_table (line 486) | def rates_table(self) -> DataFrame:
method _clear_cache (line 502) | def _clear_cache(self) -> None:
method update (line 513) | def update(self, fx_rates: dict[str, float] | NoInput = NoInput(0)) ->...
method _set_ad_order (line 576) | def _set_ad_order(self, order: int) -> None:
method to_json (line 584) | def to_json(self) -> str:
FILE: python/rateslib/instruments/bonds/bill.py
class Bill (line 58) | class Bill(_BaseBondInstrument):
method leg1 (line 170) | def leg1(self) -> FixedLeg:
method legs (line 175) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 179) | def __init__(
method _parse_vol (line 260) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 263) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method rate (line 297) | def rate(
method simple_rate (line 361) | def simple_rate(self, price: DualTypes, settlement: datetime) -> DualT...
method discount_rate (line 380) | def discount_rate(self, price: DualTypes, settlement: datetime) -> Dua...
method price (line 400) | def price(
method _price_discount (line 432) | def _price_discount(self, rate: DualTypes, settlement: datetime) -> Du...
method _price_simple (line 437) | def _price_simple(self, rate: DualTypes, settlement: datetime) -> Dual...
method ytm (line 442) | def ytm( # type: ignore[override]
method duration (line 491) | def duration(self, ytm: DualTypes, settlement: datetime, metric: str =...
FILE: python/rateslib/instruments/bonds/bond_future.py
class ConversionFactorFunction (line 50) | class ConversionFactorFunction(Protocol):
method __call__ (line 52) | def __call__(self, bond: FixedRateBond) -> DualTypes: ...
class BondFuture (line 55) | class BondFuture(_BaseInstrument):
method __init__ (line 137) | def __init__(
method __repr__ (line 208) | def __repr__(self) -> str:
method _parse_curves (line 211) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method notional (line 246) | def notional(self) -> DualTypes:
method cfs (line 260) | def cfs(self) -> tuple[DualTypes, ...]:
method _cf_funcs (line 303) | def _cf_funcs(self) -> dict[str, ConversionFactorFunction]:
method _conversion_factors (line 313) | def _conversion_factors(self) -> tuple[DualTypes, ...]:
method _cfs_ytm (line 321) | def _cfs_ytm(self, bond: FixedRateBond) -> DualTypes:
method _cfs_ust (line 326) | def _cfs_ust(self, bond: FixedRateBond, short: bool) -> float:
method _cfs_ust_short (line 365) | def _cfs_ust_short(self, bond: FixedRateBond) -> float:
method _cfs_ust_long (line 368) | def _cfs_ust_long(self, bond: FixedRateBond) -> float:
method _cfs_eurex_eur (line 371) | def _cfs_eurex_eur(self, bond: FixedRateBond) -> float:
method _cfs_eurex_chf (line 404) | def _cfs_eurex_chf(self, bond: FixedRateBond) -> float:
method _cfs_ice_gbp (line 452) | def _cfs_ice_gbp(self, bond: FixedRateBond) -> float:
method dlv (line 459) | def dlv(
method cms (line 577) | def cms(
method gross_basis (line 667) | def gross_basis(
method net_basis (line 731) | def net_basis(
method implied_repo (line 831) | def implied_repo(
method ytm (line 908) | def ytm(
method duration (line 957) | def duration(
method convexity (line 1033) | def convexity(
method ctd_index (line 1090) | def ctd_index(
method rate (line 1170) | def rate(
method npv (line 1249) | def npv(
FILE: python/rateslib/instruments/bonds/conventions/__init__.py
class BondCalcMode (line 37) | class BondCalcMode:
method __init__ (line 409) | def __init__(
method kwargs (line 452) | def kwargs(self) -> dict[str, str]:
class BillCalcMode (line 457) | class BillCalcMode:
method __init__ (line 485) | def __init__(
method kwargs (line 508) | def kwargs(self) -> dict[str, str]:
function _get_bond_calc_mode (line 771) | def _get_bond_calc_mode(calc_mode: str | BondCalcMode) -> BondCalcMode:
function _get_bill_calc_mode (line 777) | def _get_bill_calc_mode(calc_mode: str | BillCalcMode) -> BillCalcMode:
function _get_calc_mode_for_class (line 783) | def _get_calc_mode_for_class(
FILE: python/rateslib/instruments/bonds/conventions/accrued.py
class AccrualFunction (line 33) | class AccrualFunction(Protocol):
method __call__ (line 35) | def __call__(
function _acc_linear_proportion_by_days (line 40) | def _acc_linear_proportion_by_days(
function _acc_linear_proportion_by_days_long_stub_split (line 57) | def _acc_linear_proportion_by_days_long_stub_split(
function _acc_30e360_backward (line 146) | def _acc_30e360_backward(
function _acc_30u360_forward (line 172) | def _acc_30u360_forward(
function _acc_act365_with_1y_and_stub_adjustment (line 196) | def _acc_act365_with_1y_and_stub_adjustment(
FILE: python/rateslib/instruments/bonds/conventions/discounting.py
class YtmDiscountFunction (line 33) | class YtmDiscountFunction(Protocol):
method __call__ (line 35) | def __call__(
class YtmStubDiscountFunction (line 48) | class YtmStubDiscountFunction(Protocol):
method __call__ (line 51) | def __call__(
class CashflowFunction (line 64) | class CashflowFunction(Protocol):
method __call__ (line 66) | def __call__(
function _v2_ (line 83) | def _v2_(
function _v2_annual (line 103) | def _v2_annual(
function _v2_annual_pay_adjust (line 122) | def _v2_annual_pay_adjust(
function _v1_compounded (line 144) | def _v1_compounded(
function _v1_simple (line 172) | def _v1_simple(
function _v1_simple_act365f (line 196) | def _v1_simple_act365f(
function _v1_simple_pay_adjust (line 214) | def _v1_simple_pay_adjust(
function _v1_compounded_pay_adjust (line 239) | def _v1_compounded_pay_adjust(
function _v1_compounded_final_simple (line 264) | def _v1_compounded_final_simple(
function _v1_compounded_final_simple_act365f (line 288) | def _v1_compounded_final_simple_act365f(
function _v1_compounded_final_simple_pay_adjust (line 312) | def _v1_compounded_final_simple_pay_adjust(
function _v1_comp_stub_act365f (line 334) | def _v1_comp_stub_act365f(
function _v1_simple_long_stub (line 352) | def _v1_simple_long_stub(
function _v3_compounded (line 391) | def _v3_compounded(
function _v3_compounded_pay_adjust (line 414) | def _v3_compounded_pay_adjust(
function _v3_30e360_u_simple (line 432) | def _v3_30e360_u_simple(
function _v3_simple (line 455) | def _v3_simple(
function _v3_simple_pay_adjust (line 475) | def _v3_simple_pay_adjust(
function _c_from_obj (line 523) | def _c_from_obj(
function _c_full_coupon (line 539) | def _c_full_coupon(
function _pay_adj (line 561) | def _pay_adj(obj: _SupportsFixedFloatLeg1, period_idx: int) -> float:
FILE: python/rateslib/instruments/bonds/fixed_rate_bond.py
class FixedRateBond (line 54) | class FixedRateBond(_BaseBondInstrument):
method fixed_rate (line 214) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 220) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 225) | def leg1(self) -> FixedLeg:
method legs (line 230) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 234) | def __init__(
method _parse_vol (line 321) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 324) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method rate (line 358) | def rate(
FILE: python/rateslib/instruments/bonds/float_rate_note.py
class FloatRateNote (line 56) | class FloatRateNote(_BaseBondInstrument):
method float_spread (line 218) | def float_spread(self) -> DualTypes:
method float_spread (line 224) | def float_spread(self, value: DualTypes) -> None:
method leg1 (line 229) | def leg1(self) -> FloatLeg:
method legs (line 234) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 238) | def __init__(
method _parse_vol (line 333) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 336) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method rate (line 374) | def rate(
method accrued (line 425) | def accrued(
FILE: python/rateslib/instruments/bonds/index_fixed_rate_bond.py
class IndexFixedRateBond (line 62) | class IndexFixedRateBond(_BaseBondInstrument):
method fixed_rate (line 227) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 233) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 238) | def leg1(self) -> FixedLeg:
method legs (line 243) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 247) | def __init__(
method _parse_vol (line 348) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 351) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method index_ratio (line 379) | def index_ratio(self, settlement: datetime, index_curve: _BaseCurve_ =...
method rate (line 436) | def rate(
method accrued (line 572) | def accrued(
method fwd_from_repo (line 629) | def fwd_from_repo(
method repo_from_fwd (line 721) | def repo_from_fwd(
method duration (line 801) | def duration(
method ytm (line 885) | def ytm(
method price (line 990) | def price(
FILE: python/rateslib/instruments/bonds/protocols/__init__.py
class _BaseBondInstrument (line 44) | class _BaseBondInstrument(
method npv (line 54) | def npv(
method cashflows (line 90) | def cashflows(
method local_analytic_rate_fixings (line 111) | def local_analytic_rate_fixings(
method analytic_delta (line 130) | def analytic_delta(
method price (line 162) | def price(self, ytm: DualTypes, settlement: datetime, dirty: bool = Fa...
method _maybe_get_settlement (line 241) | def _maybe_get_settlement(
FILE: python/rateslib/instruments/bonds/protocols/accrued.py
class _WithAccrued (line 34) | class _WithAccrued(Protocol):
method _period_cashflow (line 39) | def _period_cashflow(
method leg1 (line 46) | def leg1(self) -> FixedLeg | FloatLeg: ...
method kwargs (line 49) | def kwargs(self) -> _KWArgs: ...
method _accrued (line 51) | def _accrued(self, settlement: datetime, func: AccrualFunction) -> Dua...
method accrued (line 60) | def accrued(self, settlement: datetime) -> DualTypes:
FILE: python/rateslib/instruments/bonds/protocols/cashflows.py
class _WithExDiv (line 24) | class _WithExDiv(Protocol):
method leg1 (line 30) | def leg1(self) -> FixedLeg | FloatLeg: ...
method ex_div (line 32) | def ex_div(self, settlement: datetime) -> bool:
FILE: python/rateslib/instruments/bonds/protocols/duration.py
class _WithDuration (line 29) | class _WithDuration(Protocol):
method price (line 34) | def price(self, *args: Any, **kwargs: Any) -> DualTypes: ...
method leg1 (line 37) | def leg1(self) -> FixedLeg | FloatLeg: ...
method duration (line 39) | def duration(self, ytm: DualTypes, settlement: datetime, metric: str =...
method convexity (line 119) | def convexity(self, ytm: DualTypes, settlement: datetime, metric: str ...
FILE: python/rateslib/instruments/bonds/protocols/oaspread.py
class _WithOASpread (line 46) | class _WithOASpread(_WithAccrued, Protocol):
method _parse_curves (line 51) | def _parse_curves(self, curves: CurvesT_) -> _Curves: ...
method rate (line 53) | def rate(
method oaspread (line 66) | def oaspread(
FILE: python/rateslib/instruments/bonds/protocols/repo.py
class _WithRepo (line 32) | class _WithRepo(_WithAccrued, Protocol):
method fwd_from_repo (line 37) | def fwd_from_repo(
method repo_from_fwd (line 137) | def repo_from_fwd(
FILE: python/rateslib/instruments/bonds/protocols/ytm.py
class _WithYTM (line 49) | class _WithYTM(_WithAccrued, Protocol):
method kwargs (line 55) | def kwargs(self) -> _KWArgs: ...
method leg1 (line 58) | def leg1(self) -> FixedLeg | FloatLeg: ...
method _price_from_ytm (line 60) | def _price_from_ytm(
method _generic_price_from_ytm (line 116) | def _generic_price_from_ytm(
method _generic_price_from_ytm_indexed (line 194) | def _generic_price_from_ytm_indexed(
method _ytm (line 275) | def _ytm(
method ytm (line 332) | def ytm(
method _period_cashflow (line 409) | def _period_cashflow(
FILE: python/rateslib/instruments/cds.py
class CDS (line 52) | class CDS(_BaseInstrument):
method fixed_rate (line 216) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 220) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 225) | def leg1(self) -> CreditPremiumLeg:
method leg2 (line 230) | def leg2(self) -> CreditProtectionLeg:
method legs (line 235) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 239) | def __init__(
method rate (line 346) | def rate(
method accrued (line 379) | def accrued(self, settlement: datetime) -> DualTypes:
method spread (line 398) | def spread(
method npv (line 422) | def npv(
method _set_pricing_mid (line 451) | def _set_pricing_mid(
method _parse_vol (line 469) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 472) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method cashflows (line 514) | def cashflows(
method local_analytic_rate_fixings (line 535) | def local_analytic_rate_fixings(
method analytic_rec_risk (line 554) | def analytic_rec_risk(
FILE: python/rateslib/instruments/fee.py
class Fee (line 52) | class Fee(_BaseInstrument):
method leg1 (line 178) | def leg1(self) -> CustomLeg:
method legs (line 183) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 187) | def __init__(
method _parse_vol (line 284) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 288) | def _parse_curves(cls, curves: CurvesT_) -> _Curves:
method rate (line 327) | def rate(
method npv (line 357) | def npv(
method cashflows (line 380) | def cashflows(
method analytic_delta (line 401) | def analytic_delta(
method local_analytic_rate_fixings (line 426) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/fly.py
function _composit_fixings_table (line 39) | def _composit_fixings_table(df_result: DataFrame, df: DataFrame) -> Data...
class Fly (line 76) | class Fly(_BaseInstrument):
method instruments (line 131) | def instruments(self) -> Sequence[_BaseInstrument]:
method __init__ (line 135) | def __init__(
method npv (line 143) | def npv(
method local_analytic_rate_fixings (line 173) | def local_analytic_rate_fixings(
method cashflows (line 202) | def cashflows(
method rate (line 223) | def rate(
method analytic_delta (line 251) | def analytic_delta(self, *args: Any, **kwargs: Any) -> NoReturn:
FILE: python/rateslib/instruments/fra.py
class FRA (line 54) | class FRA(_BaseInstrument):
method fixed_rate (line 218) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 224) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 229) | def leg1(self) -> FixedLeg:
method leg2 (line 234) | def leg2(self) -> FloatLeg:
method legs (line 239) | def legs(self) -> list[_BaseLeg]:
method _parse_vol (line 243) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 246) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method __init__ (line 303) | def __init__(
method _fra_rate_scalar (line 399) | def _fra_rate_scalar(self, leg2_rate_curve: _BaseCurveOrDict_) -> Dual...
method _try_fra_rate_scalar (line 403) | def _try_fra_rate_scalar(self, leg2_rate_curve: _BaseCurveOrDict_) -> ...
method npv (line 412) | def npv(
method _set_pricing_mid (line 452) | def _set_pricing_mid(
method rate (line 470) | def rate(
method analytic_delta (line 508) | def analytic_delta(
method local_analytic_rate_fixings (line 542) | def local_analytic_rate_fixings(
method cashflows (line 565) | def cashflows(
FILE: python/rateslib/instruments/fx_forward.py
class FXForward (line 49) | class FXForward(_BaseInstrument):
method leg1 (line 113) | def leg1(self) -> CustomLeg:
method leg2 (line 118) | def leg2(self) -> CustomLeg:
method legs (line 123) | def legs(self) -> Sequence[_BaseLeg]:
method _parse_curves (line 127) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 163) | def _parse_vol(self, vol: VolT_) -> _Vol:
method __init__ (line 166) | def __init__(
method cashflows (line 245) | def cashflows(
method rate (line 266) | def rate(
FILE: python/rateslib/instruments/fx_options/brokerfly.py
class FXBrokerFly (line 43) | class FXBrokerFly(_BaseFXOptionStrat):
method __init__ (line 230) | def __init__(
method instruments (line 320) | def instruments(self) -> tuple[FXStrangle, FXStraddle]:
method _parse_vol (line 326) | def _parse_vol(cls, vol: VolStrat_) -> tuple[VolStrat_, VolStrat_]: #...
method _maybe_set_vega_neutral_notional (line 331) | def _maybe_set_vega_neutral_notional(
method rate (line 379) | def rate(
method analytic_greeks (line 430) | def analytic_greeks(
method _plot_payoff (line 473) | def _plot_payoff(
FILE: python/rateslib/instruments/fx_options/call_put.py
class _PricingMetrics (line 78) | class _PricingMetrics:
class _BaseFXOption (line 89) | class _BaseFXOption(_BaseInstrument, metaclass=ABCMeta):
method leg1 (line 100) | def leg1(self) -> CustomLeg:
method leg2 (line 106) | def leg2(self) -> CustomLeg:
method legs (line 112) | def legs(self) -> Sequence[_BaseLeg]:
method _option (line 117) | def _option(self) -> _BaseFXOptionPeriod:
method _premium (line 121) | def _premium(self) -> Cashflow:
method _parse_curves (line 124) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 167) | def _parse_vol(cls, vol: VolT_) -> _Vol:
method __init__ (line 178) | def __init__(
method __repr__ (line 325) | def __repr__(self) -> str:
method _validate_strike_and_premiums (line 328) | def _validate_strike_and_premiums(self) -> None:
method _set_strike_and_vol (line 338) | def _set_strike_and_vol(
method _update_pricing_for_strike (line 388) | def _update_pricing_for_strike(
method _set_premium (line 448) | def _set_premium(
method rate (line 482) | def rate(
method npv (line 528) | def npv(
method cashflows (line 583) | def cashflows(
method analytic_greeks (line 621) | def analytic_greeks(
method _analytic_greeks_set_metrics (line 684) | def _analytic_greeks_set_metrics(
method _analytic_greeks_reduced (line 723) | def _analytic_greeks_reduced(
method analytic_delta (line 759) | def analytic_delta(self, *args: Any, leg: int = 1, **kwargs: Any) -> N...
method _plot_payoff (line 765) | def _plot_payoff(
method plot_payoff (line 792) | def plot_payoff(
method local_analytic_rate_fixings (line 826) | def local_analytic_rate_fixings(
method spread (line 838) | def spread(
class FXCall (line 855) | class FXCall(_BaseFXOption):
method __init__ (line 1044) | def __init__(self, *args: Any, **kwargs: Any) -> None:
class FXPut (line 1048) | class FXPut(_BaseFXOption):
method __init__ (line 1055) | def __init__(self, *args: Any, **kwargs: Any) -> None:
FILE: python/rateslib/instruments/fx_options/risk_reversal.py
class _BaseFXOptionStrat (line 44) | class _BaseFXOptionStrat(_BaseFXOption):
method kwargs (line 68) | def kwargs(self) -> _KWArgs:
method __init__ (line 72) | def __init__(
method _parse_vol (line 183) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
method instruments (line 187) | def instruments(self) -> tuple[_BaseFXOption | _BaseFXOptionStrat, ...]:
method __repr__ (line 190) | def __repr__(self) -> str:
method rate (line 193) | def rate(
method npv (line 232) | def npv(
method cashflows (line 268) | def cashflows(
method _plot_payoff (line 289) | def _plot_payoff(
method analytic_greeks (line 315) | def analytic_greeks(
class FXRiskReversal (line 376) | class FXRiskReversal(_BaseFXOptionStrat):
method __init__ (line 548) | def __init__(
method _parse_vol (line 630) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
FILE: python/rateslib/instruments/fx_options/straddle.py
class FXStraddle (line 38) | class FXStraddle(_BaseFXOptionStrat):
method __init__ (line 207) | def __init__(
method _parse_vol (line 289) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
method _set_notionals (line 294) | def _set_notionals(self, notional: DualTypes) -> None:
FILE: python/rateslib/instruments/fx_options/strangle.py
class FXStrangle (line 59) | class FXStrangle(_BaseFXOptionStrat):
method __init__ (line 236) | def __init__(
method _parse_vol (line 328) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
method rate (line 333) | def rate(
method _rate (line 356) | def _rate(
method _rate_single_vol (line 399) | def _rate_single_vol(
function _d_c_hat_d_sigma_hat (line 592) | def _d_c_hat_d_sigma_hat(
function _d_c_mkt_d_sigma_hat (line 618) | def _d_c_mkt_d_sigma_hat(
FILE: python/rateslib/instruments/fx_options/vol_value.py
class FXVolValue (line 43) | class FXVolValue(_BaseInstrument):
method __init__ (line 115) | def __init__(
method _parse_vol (line 136) | def _parse_vol(self, vol: VolT_) -> _Vol:
method rate (line 146) | def rate(
method npv (line 220) | def npv(self, *args: Any, **kwargs: Any) -> NoReturn:
method cashflows (line 223) | def cashflows(self, *args: Any, **kwargs: Any) -> NoReturn:
method analytic_delta (line 226) | def analytic_delta(self, *args: Any, **kwargs: Any) -> NoReturn:
FILE: python/rateslib/instruments/fx_swap.py
class FXSwap (line 56) | class FXSwap(_BaseInstrument):
method leg1 (line 203) | def leg1(self) -> CustomLeg:
method leg2 (line 208) | def leg2(self) -> CustomLeg:
method legs (line 213) | def legs(self) -> Sequence[_BaseLeg]:
method _parse_curves (line 217) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 248) | def _parse_vol(self, vol: VolT_) -> _Vol:
method __init__ (line 251) | def __init__(
method cashflows (line 376) | def cashflows(
method rate (line 397) | def rate(
method _rate_on_leg (line 420) | def _rate_on_leg(
method npv (line 456) | def npv(
function _validated_fxswap_input_combinations (line 480) | def _validated_fxswap_input_combinations(
FILE: python/rateslib/instruments/iirs.py
class IIRS (line 54) | class IIRS(_BaseInstrument):
method fixed_rate (line 264) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 268) | def fixed_rate(self, value: DualTypes_) -> None:
method leg2_float_spread (line 273) | def leg2_float_spread(self) -> DualTypes_:
method leg2_float_spread (line 277) | def leg2_float_spread(self, value: DualTypes) -> None:
method leg1 (line 282) | def leg1(self) -> FixedLeg:
method leg2 (line 287) | def leg2(self) -> FloatLeg:
method legs (line 292) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 296) | def __init__(
method rate (line 425) | def rate(
method spread (line 473) | def spread(
method npv (line 502) | def npv(
method _set_pricing_mid (line 531) | def _set_pricing_mid(
method _parse_curves (line 549) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 593) | def _parse_vol(self, vol: VolT_) -> _Vol:
method cashflows (line 596) | def cashflows(
method local_analytic_rate_fixings (line 617) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/ir_options/call_put.py
class _BaseIRSOption (line 73) | class _BaseIRSOption(_BaseInstrument, metaclass=ABCMeta):
method analytic_greeks (line 83) | def analytic_greeks(
method _analytic_greeks_set_metrics (line 146) | def _analytic_greeks_set_metrics(
method local_analytic_rate_fixings (line 187) | def local_analytic_rate_fixings(
method spread (line 201) | def spread(
method _rate_scalar (line 215) | def _rate_scalar(self) -> float: # type: ignore[override]
method leg1 (line 225) | def leg1(self) -> CustomLeg:
method leg2 (line 231) | def leg2(self) -> CustomLeg:
method legs (line 237) | def legs(self) -> Sequence[_BaseLeg]:
method _option (line 242) | def _option(self) -> _BaseIRSOptionPeriod:
method _irs (line 246) | def _irs(self) -> IRS:
method _premium (line 250) | def _premium(self) -> Cashflow:
method _parse_curves (line 254) | def _parse_curves(cls, curves: CurvesT_) -> _Curves:
method _parse_vol (line 307) | def _parse_vol(cls, vol: VolT_) -> _Vol:
method __init__ (line 318) | def __init__(
method __repr__ (line 415) | def __repr__(self) -> str:
method _set_strike_and_vol (line 418) | def _set_strike_and_vol(
method _set_premium (line 458) | def _set_premium(
method rate (line 480) | def rate(
method npv (line 533) | def npv(
method cashflows (line 596) | def cashflows(
method analytic_delta (line 644) | def analytic_delta(self, *args: Any, leg: int = 1, **kwargs: Any) -> N...
method _plot_payoff (line 650) | def _plot_payoff(
method plot_payoff (line 680) | def plot_payoff(
class IRSCall (line 744) | class IRSCall(_BaseIRSOption):
method __init__ (line 910) | def __init__(self, *args: Any, **kwargs: Any) -> None:
class IRSPut (line 914) | class IRSPut(_BaseIRSOption):
method __init__ (line 921) | def __init__(self, *args: Any, **kwargs: Any) -> None:
FILE: python/rateslib/instruments/ir_options/risk_reversal.py
class IRSRiskReversal (line 38) | class IRSRiskReversal(_BaseIRSOptionStrat):
method __init__ (line 164) | def __init__(
method _parse_vol (line 233) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
method _set_notionals (line 238) | def _set_notionals(self, notional: DualTypes) -> None:
FILE: python/rateslib/instruments/ir_options/straddle.py
class _BaseIRSOptionStrat (line 44) | class _BaseIRSOptionStrat(_BaseIRSOption):
method kwargs (line 72) | def kwargs(self) -> _KWArgs:
method __init__ (line 76) | def __init__(
method _parse_vol (line 109) | def _parse_vol(cls, vol: VolStrat_) -> VolStrat_: # type: ignore[over...
method instruments (line 113) | def instruments(self) -> tuple[_BaseIRSOption | _BaseIRSOptionStrat, ....
method __repr__ (line 116) | def __repr__(self) -> str:
method rate (line 119) | def rate(
method npv (line 156) | def npv(
method cashflows (line 192) | def cashflows(
method _plot_payoff (line 213) | def _plot_payoff(
method analytic_greeks (line 239) | def analytic_greeks(
class IRSStraddle (line 302) | class IRSStraddle(_BaseIRSOptionStrat):
method __init__ (line 427) | def __init__(
method _parse_vol (line 496) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
method _set_notionals (line 501) | def _set_notionals(self, notional: DualTypes) -> None:
FILE: python/rateslib/instruments/ir_options/strangle.py
class IRSStrangle (line 38) | class IRSStrangle(_BaseIRSOptionStrat):
method __init__ (line 163) | def __init__(
method _parse_vol (line 232) | def _parse_vol(cls, vol: VolStrat_) -> tuple[_Vol, _Vol]: # type: ign...
method _set_notionals (line 237) | def _set_notionals(self, notional: DualTypes) -> None:
FILE: python/rateslib/instruments/ir_options/vol_value.py
class IRVolValue (line 55) | class IRVolValue(_BaseInstrument):
method rate_scalar (line 148) | def rate_scalar(self) -> float:
method __init__ (line 164) | def __init__(
method _ir_option_params (line 204) | def _ir_option_params(self) -> _IROptionParams:
method rate (line 217) | def rate(
method _parse_curves (line 305) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 308) | def _parse_vol(self, vol: VolT_) -> _Vol:
method npv (line 311) | def npv(self, *args: Any, **kwargs: Any) -> NoReturn:
method cashflows (line 316) | def cashflows(self, *args: Any, **kwargs: Any) -> NoReturn:
method analytic_delta (line 321) | def analytic_delta(self, *args: Any, **kwargs: Any) -> NoReturn:
FILE: python/rateslib/instruments/irs.py
class IRS (line 57) | class IRS(_BaseInstrument):
method fixed_rate (line 299) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 305) | def fixed_rate(self, value: DualTypes_) -> None:
method leg2_float_spread (line 310) | def leg2_float_spread(self) -> DualTypes_:
method leg2_float_spread (line 316) | def leg2_float_spread(self, value: DualTypes) -> None:
method leg1 (line 321) | def leg1(self) -> FixedLeg:
method leg2 (line 326) | def leg2(self) -> FloatLeg:
method legs (line 331) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 335) | def __init__(
method rate (line 470) | def rate(
method spread (line 510) | def spread(
method npv (line 545) | def npv(
method _set_pricing_mid (line 575) | def _set_pricing_mid(
method _parse_vol (line 595) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 599) | def _parse_curves(cls, curves: CurvesT_) -> _Curves:
method cashflows (line 655) | def cashflows(
method local_analytic_rate_fixings (line 676) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/loan.py
class Loan (line 59) | class Loan(_BaseInstrument):
method leg1 (line 291) | def leg1(self) -> FixedLeg | FloatLeg:
method legs (line 297) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 301) | def __init__(
method _parse_vol (line 439) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 442) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method rate (line 486) | def rate(
method npv (line 581) | def npv(
method cashflows (line 631) | def cashflows(
method analytic_delta (line 652) | def analytic_delta(
method local_analytic_rate_fixings (line 677) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/ndf.py
class NDF (line 55) | class NDF(_BaseInstrument):
method leg1 (line 250) | def leg1(self) -> CustomLeg:
method leg2 (line 255) | def leg2(self) -> CustomLeg:
method legs (line 260) | def legs(self) -> Sequence[_BaseLeg]:
method _parse_vol (line 264) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 267) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method __init__ (line 304) | def __init__(
method cashflows (line 436) | def cashflows(
method rate (line 457) | def rate(
method _set_pricing_mid (line 474) | def _set_pricing_mid(
method npv (line 497) | def npv(
function _validated_ndf_input_combinations (line 525) | def _validated_ndf_input_combinations(
function _validated_2ccy_ndf_input_combinations (line 599) | def _validated_2ccy_ndf_input_combinations(
function _validated_3ccy_ndf_input_combinations (line 659) | def _validated_3ccy_ndf_input_combinations(
function _notional_and_fx_rate_validation (line 727) | def _notional_and_fx_rate_validation(
FILE: python/rateslib/instruments/ndxcs.py
class NDXCS (line 56) | class NDXCS(_BaseInstrument):
method _rate_scalar_calc (line 392) | def _rate_scalar_calc(self) -> float:
method fixed_rate (line 399) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 408) | def fixed_rate(self, value: DualTypes_) -> None:
method float_spread (line 416) | def float_spread(self) -> DualTypes:
method float_spread (line 425) | def float_spread(self, value: DualTypes) -> None:
method leg2_fixed_rate (line 433) | def leg2_fixed_rate(self) -> DualTypes_:
method leg2_fixed_rate (line 442) | def leg2_fixed_rate(self, value: DualTypes_) -> None:
method leg2_float_spread (line 450) | def leg2_float_spread(self) -> DualTypes_:
method leg2_float_spread (line 459) | def leg2_float_spread(self, value: DualTypes) -> None:
method leg1 (line 467) | def leg1(self) -> FixedLeg | FloatLeg:
method leg2 (line 473) | def leg2(self) -> FixedLeg | FloatLeg:
method legs (line 479) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 483) | def __init__(
method _init_args (line 704) | def _init_args(
method _init_two_currency (line 728) | def _init_two_currency(
method _init_three_currency (line 749) | def _init_three_currency(
method rate (line 763) | def rate(
method spread (line 830) | def spread(
method npv (line 853) | def npv(
method _set_pricing_mid (line 883) | def _set_pricing_mid(
method _parse_vol (line 943) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 946) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method cashflows (line 976) | def cashflows(
method local_analytic_rate_fixings (line 997) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/portfolio.py
function _instrument_npv (line 40) | def _instrument_npv(
class Portfolio (line 48) | class Portfolio(_BaseInstrument):
method instruments (line 97) | def instruments(self) -> Sequence[_BaseInstrument]:
method __init__ (line 101) | def __init__(self, instruments: Sequence[_BaseInstrument]) -> None:
method npv (line 106) | def npv(
method local_analytic_rate_fixings (line 179) | def local_analytic_rate_fixings(
method cashflows (line 198) | def cashflows(
method rate (line 219) | def rate(self, *args: Any, **kwargs: Any) -> NoReturn:
method analytic_delta (line 222) | def analytic_delta(self, *args: Any, **kwargs: Any) -> NoReturn:
FILE: python/rateslib/instruments/protocols/__init__.py
class _BaseInstrument (line 31) | class _BaseInstrument(
FILE: python/rateslib/instruments/protocols/analytic_delta.py
class _WithAnalyticDelta (line 39) | class _WithAnalyticDelta(_WithPricingObjs, Protocol):
method kwargs (line 45) | def kwargs(self) -> _KWArgs: ...
method analytic_delta (line 47) | def analytic_delta(
FILE: python/rateslib/instruments/protocols/analytic_fixings.py
function _composit_fixings_table (line 41) | def _composit_fixings_table(df_result: DataFrame, df: DataFrame) -> Data...
class _WithAnalyticRateFixings (line 78) | class _WithAnalyticRateFixings(_WithPricingObjs, Protocol):
method kwargs (line 84) | def kwargs(self) -> _KWArgs: ...
method local_analytic_rate_fixings (line 86) | def local_analytic_rate_fixings(
method _local_analytic_rate_fixings_from_legs (line 148) | def _local_analytic_rate_fixings_from_legs(
method _local_analytic_rate_fixings_from_instruments (line 198) | def _local_analytic_rate_fixings_from_instruments(
FILE: python/rateslib/instruments/protocols/cashflows.py
class _WithCashflows (line 44) | class _WithCashflows(_WithPricingObjs, Protocol):
method kwargs (line 52) | def kwargs(self) -> _KWArgs:
method cashflows (line 55) | def cashflows(
method _cashflows_from_legs (line 120) | def _cashflows_from_legs(
method _cashflows_from_instruments (line 196) | def _cashflows_from_instruments(self, *args: Any, **kwargs: Any) -> Da...
method cashflows_table (line 211) | def cashflows_table(
FILE: python/rateslib/instruments/protocols/fixings.py
class _WithFixings (line 39) | class _WithFixings(Protocol):
method npv (line 51) | def npv(
method reset_fixings (line 64) | def reset_fixings(self, state: int_ = NoInput(0)) -> None:
method local_fixings (line 87) | def local_fixings(
FILE: python/rateslib/instruments/protocols/kwargs.py
function _get_args_from_spec (line 27) | def _get_args_from_spec(spec: str_) -> dict[str, Any]:
function _update_not_noinput (line 36) | def _update_not_noinput(base_kwargs: dict[str, Any], new_kwargs: dict[st...
function _update_with_defaults (line 46) | def _update_with_defaults(
function _inherit_or_negate (line 60) | def _inherit_or_negate(kwargs: dict[str, Any], ignore_blank: bool = Fals...
function _convert_to_schedule_kwargs (line 94) | def _convert_to_schedule_kwargs(kwargs: dict[str, Any], leg: int) -> dic...
class _KWArgs (line 119) | class _KWArgs:
method leg1 (line 131) | def leg1(self) -> dict[str, Any]:
method leg2 (line 136) | def leg2(self) -> dict[str, Any]:
method meta (line 141) | def meta(self) -> dict[str, Any]:
method __init__ (line 145) | def __init__(
method __eq__ (line 167) | def __eq__(self, other: Any) -> bool:
FILE: python/rateslib/instruments/protocols/npv.py
class _WithNPV (line 41) | class _WithNPV(_WithPricingObjs, Protocol):
method settlement_params (line 49) | def settlement_params(self) -> _SettlementParams:
method kwargs (line 65) | def kwargs(self) -> _KWArgs:
method __repr__ (line 70) | def __repr__(self) -> str:
method npv (line 73) | def npv(
method _npv_single_core (line 190) | def _npv_single_core(
FILE: python/rateslib/instruments/protocols/pricing.py
class _WithPricingObjs (line 51) | class _WithPricingObjs(Protocol):
method _parse_curves (line 61) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 69) | def _parse_vol(self, vol: VolT_) -> _Vol:
class _Curves (line 78) | class _Curves:
method __init__ (line 83) | def __init__(
method __eq__ (line 100) | def __eq__(self, other: Any) -> bool:
method rate_curve (line 115) | def rate_curve(self) -> _BaseCurveOrIdOrIdDict_:
method disc_curve (line 120) | def disc_curve(self) -> _BaseCurveOrIdOrIdDict_:
method index_curve (line 125) | def index_curve(self) -> _BaseCurveOrIdOrIdDict_:
method leg2_rate_curve (line 130) | def leg2_rate_curve(self) -> _BaseCurveOrIdOrIdDict_:
method leg2_disc_curve (line 135) | def leg2_disc_curve(self) -> _BaseCurveOrIdOrIdDict_:
method leg2_index_curve (line 140) | def leg2_index_curve(self) -> _BaseCurveOrIdOrIdDict_:
class _Vol (line 145) | class _Vol:
method __init__ (line 150) | def __init__(
method fx_vol (line 160) | def fx_vol(self) -> FXVol_:
method ir_vol (line 165) | def ir_vol(self) -> IRVol_:
method __eq__ (line 169) | def __eq__(self, other: Any) -> bool:
function _parse_curves (line 176) | def _parse_curves(
function _parse_vol (line 183) | def _parse_vol(
function _parse_vol (line 192) | def _parse_vol(
function _parse_vol (line 200) | def _parse_vol(
function _get_curve (line 213) | def _get_curve(
function _get_curve (line 224) | def _get_curve(
function _get_curve (line 235) | def _get_curve(
function _get_curve (line 246) | def _get_curve(
function _get_curve (line 256) | def _get_curve(
function _validate_base_curve_or_dict (line 283) | def _validate_base_curve_or_dict(
function _validate_base_curve_or_dict (line 291) | def _validate_base_curve_or_dict(
function _validate_base_curve_or_dict (line 299) | def _validate_base_curve_or_dict(
function _validate_base_curve_or_dict (line 307) | def _validate_base_curve_or_dict(
function _validate_base_curve_or_dict (line 314) | def _validate_base_curve_or_dict(
function _validate_base_curve (line 335) | def _validate_base_curve(curve: _BaseCurveOrId, allow_no_input: Literal[...
function _validate_base_curve (line 339) | def _validate_base_curve(curve: _BaseCurveOrId, allow_no_input: Literal[...
function _validate_base_curve (line 342) | def _validate_base_curve(curve: _BaseCurveOrId, allow_no_input: bool) ->...
function _get_curve_from_solver (line 355) | def _get_curve_from_solver(
function _get_curve_from_solver (line 361) | def _get_curve_from_solver(
function _get_curve_from_solver (line 366) | def _get_curve_from_solver(
function _parse_curve_or_id_from_solver_ (line 387) | def _parse_curve_or_id_from_solver_(curve: _BaseCurveOrId, solver: Solve...
function _get_fx_vol (line 441) | def _get_fx_vol(
function _get_fx_vol (line 451) | def _get_fx_vol(
function _get_fx_vol (line 461) | def _get_fx_vol(
function _get_fx_vol (line 471) | def _get_fx_vol(
function _get_fx_vol (line 480) | def _get_fx_vol(
function _validate_base_fx_vol (line 505) | def _validate_base_fx_vol(fx_vol: _FXVolObj | str, allow_no_input: Liter...
function _validate_base_fx_vol (line 509) | def _validate_base_fx_vol(
function _validate_base_fx_vol (line 514) | def _validate_base_fx_vol(fx_vol: _FXVolObj | str, allow_no_input: bool)...
function _get_fx_vol_from_solver (line 526) | def _get_fx_vol_from_solver(fx_vol: _FXVolObj | str, solver: Solver) -> ...
function _maybe_get_ir_vol_maybe_from_solver (line 567) | def _maybe_get_ir_vol_maybe_from_solver(
function _get_ir_vol_from_solver (line 582) | def _get_ir_vol_from_solver(
function _validate_ir_vol_is_not_id (line 622) | def _validate_ir_vol_is_not_id(ir_vol: _IRVolObj | str) -> _IRVolObj:
function _get_fx_forwards_maybe_from_solver (line 633) | def _get_fx_forwards_maybe_from_solver(solver: Solver_, fx: FXForwards_)...
function _get_fx_maybe_from_solver (line 660) | def _get_fx_maybe_from_solver(solver: Solver_, fx: FXForwards_) -> FXFor...
FILE: python/rateslib/instruments/protocols/rate.py
class _WithRate (line 30) | class _WithRate(Protocol):
method rate (line 37) | def rate(
method spread (line 98) | def spread(
method rate_scalar (line 159) | def rate_scalar(self) -> float:
FILE: python/rateslib/instruments/protocols/sensitivities.py
class _WithSensitivities (line 38) | class _WithSensitivities(_WithNPV, Protocol):
method delta (line 44) | def delta(
method exo_delta (line 130) | def exo_delta(
method gamma (line 231) | def gamma(
FILE: python/rateslib/instruments/protocols/utils.py
function _validate_obj_not_no_input (line 43) | def _validate_obj_not_no_input(obj: T | NoInput, name: str) -> T:
function _maybe_set_ad_order (line 49) | def _maybe_set_ad_order(
FILE: python/rateslib/instruments/sbs.py
class SBS (line 54) | class SBS(_BaseInstrument):
method float_spread (line 240) | def float_spread(self) -> DualTypes_:
method float_spread (line 246) | def float_spread(self, value: DualTypes) -> None:
method leg2_float_spread (line 251) | def leg2_float_spread(self) -> DualTypes_:
method leg2_float_spread (line 257) | def leg2_float_spread(self, value: DualTypes) -> None:
method leg1 (line 262) | def leg1(self) -> FloatLeg:
method leg2 (line 267) | def leg2(self) -> FloatLeg:
method legs (line 272) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 276) | def __init__(
method rate (line 407) | def rate(
method spread (line 459) | def spread(
method npv (line 482) | def npv(
method _set_pricing_mid (line 511) | def _set_pricing_mid(
method _parse_curves (line 540) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 589) | def _parse_vol(self, vol: VolT_) -> _Vol:
method cashflows (line 592) | def cashflows(
method local_analytic_rate_fixings (line 613) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/spread.py
class Spread (line 39) | class Spread(_BaseInstrument):
method instruments (line 92) | def instruments(self) -> Sequence[_BaseInstrument]:
method __init__ (line 96) | def __init__(
method npv (line 103) | def npv(
method local_analytic_rate_fixings (line 139) | def local_analytic_rate_fixings(
method cashflows (line 158) | def cashflows(
method rate (line 179) | def rate(
method analytic_delta (line 207) | def analytic_delta(self, *args: Any, **kwargs: Any) -> NoReturn:
FILE: python/rateslib/instruments/stir_future.py
class STIRFuture (line 57) | class STIRFuture(_BaseInstrument):
method fixed_rate (line 217) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 223) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 228) | def leg1(self) -> FixedLeg:
method leg2 (line 233) | def leg2(self) -> FloatLeg:
method legs (line 238) | def legs(self) -> list[_BaseLeg]:
method _parse_vol (line 242) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 245) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method __init__ (line 302) | def __init__(
method npv (line 400) | def npv(
method _set_pricing_mid (line 440) | def _set_pricing_mid(
method rate (line 459) | def rate(
method analytic_delta (line 482) | def analytic_delta(
method local_analytic_rate_fixings (line 524) | def local_analytic_rate_fixings(
method cashflows (line 546) | def cashflows(
FILE: python/rateslib/instruments/value.py
class Value (line 39) | class Value(_BaseInstrument):
method __init__ (line 109) | def __init__(
method _parse_curves (line 131) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method rate (line 163) | def rate(
method npv (line 211) | def npv(self, *args: Any, **kwargs: Any) -> NoReturn:
method cashflows (line 214) | def cashflows(self, *args: Any, **kwargs: Any) -> NoReturn:
method analytic_delta (line 217) | def analytic_delta(self, *args: Any, **kwargs: Any) -> NoReturn:
FILE: python/rateslib/instruments/xcs.py
class XCS (line 59) | class XCS(_BaseInstrument):
method _rate_scalar_calc (line 366) | def _rate_scalar_calc(self) -> float:
method fixed_rate (line 373) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 382) | def fixed_rate(self, value: DualTypes_) -> None:
method float_spread (line 390) | def float_spread(self) -> DualTypes:
method float_spread (line 399) | def float_spread(self, value: DualTypes) -> None:
method leg2_fixed_rate (line 407) | def leg2_fixed_rate(self) -> DualTypes_:
method leg2_fixed_rate (line 416) | def leg2_fixed_rate(self, value: DualTypes_) -> None:
method leg2_float_spread (line 424) | def leg2_float_spread(self) -> DualTypes_:
method leg2_float_spread (line 433) | def leg2_float_spread(self, value: DualTypes) -> None:
method leg1 (line 441) | def leg1(self) -> FixedLeg | FloatLeg:
method leg2 (line 447) | def leg2(self) -> FixedLeg | FloatLeg:
method legs (line 453) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 457) | def __init__(
method rate (line 685) | def rate(
method spread (line 769) | def spread(
method npv (line 792) | def npv(
method _set_pricing_mid (line 822) | def _set_pricing_mid(
method _parse_vol (line 882) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 885) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method cashflows (line 915) | def cashflows(
method local_analytic_rate_fixings (line 936) | def local_analytic_rate_fixings(
function _validated_xcs_input_combinations (line 956) | def _validated_xcs_input_combinations(
FILE: python/rateslib/instruments/yoyis.py
class YoYIS (line 55) | class YoYIS(_BaseInstrument):
method fixed_rate (line 264) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 269) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 274) | def leg1(self) -> FixedLeg:
method leg2 (line 279) | def leg2(self) -> FixedLeg:
method legs (line 284) | def legs(self) -> Sequence[_BaseLeg]:
method __init__ (line 288) | def __init__(
method rate (line 405) | def rate(
method spread (line 441) | def spread(
method npv (line 473) | def npv(
method _set_pricing_mid (line 502) | def _set_pricing_mid(
method _parse_curves (line 520) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 556) | def _parse_vol(self, vol: VolT_) -> _Vol:
method cashflows (line 559) | def cashflows(
method local_analytic_rate_fixings (line 580) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/zcis.py
class ZCIS (line 54) | class ZCIS(_BaseInstrument):
method fixed_rate (line 231) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 237) | def fixed_rate(self, value: DualTypes_) -> None:
method leg1 (line 242) | def leg1(self) -> ZeroFixedLeg:
method leg2 (line 247) | def leg2(self) -> FixedLeg:
method legs (line 252) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 256) | def __init__(
method rate (line 377) | def rate(
method spread (line 413) | def spread(
method npv (line 426) | def npv(
method _set_pricing_mid (line 455) | def _set_pricing_mid(
method _parse_vol (line 473) | def _parse_vol(self, vol: VolT_) -> _Vol:
method _parse_curves (line 476) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method cashflows (line 519) | def cashflows(
method local_analytic_rate_fixings (line 540) | def local_analytic_rate_fixings(
FILE: python/rateslib/instruments/zcs.py
class ZCS (line 53) | class ZCS(_BaseInstrument):
method fixed_rate (line 223) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 229) | def fixed_rate(self, value: DualTypes_) -> None:
method leg2_float_spread (line 244) | def leg2_float_spread(self) -> DualTypes_:
method leg2_float_spread (line 250) | def leg2_float_spread(self, value: DualTypes) -> None:
method leg1 (line 255) | def leg1(self) -> ZeroFixedLeg:
method leg2 (line 260) | def leg2(self) -> ZeroFloatLeg:
method legs (line 265) | def legs(self) -> list[_BaseLeg]:
method __init__ (line 269) | def __init__(
method rate (line 391) | def rate(
method spread (line 427) | def spread(
method npv (line 459) | def npv(
method _set_pricing_mid (line 488) | def _set_pricing_mid(
method _parse_curves (line 506) | def _parse_curves(self, curves: CurvesT_) -> _Curves:
method _parse_vol (line 555) | def _parse_vol(self, vol: VolT_) -> _Vol:
method cashflows (line 558) | def cashflows(
method local_analytic_rate_fixings (line 579) | def local_analytic_rate_fixings(
FILE: python/rateslib/legs/amortization.py
class _AmortizationType (line 23) | class _AmortizationType(Enum):
class Amortization (line 33) | class Amortization:
method amortization (line 267) | def amortization(self) -> tuple[DualTypes, ...]:
method outstanding (line 272) | def outstanding(self) -> tuple[DualTypes, ...]:
method __init__ (line 276) | def __init__(
method __mul__ (line 322) | def __mul__(self, other: DualTypes) -> Amortization:
method __rmul__ (line 329) | def __rmul__(self, other: DualTypes) -> Amortization:
function _get_amortization (line 333) | def _get_amortization(
FILE: python/rateslib/legs/credit.py
class CreditPremiumLeg (line 41) | class CreditPremiumLeg(_BaseLeg, _WithExDiv):
method settlement_params (line 117) | def settlement_params(self) -> _SettlementParams:
method periods (line 123) | def periods(self) -> list[CreditPremiumPeriod]:
method fixed_rate (line 128) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 134) | def fixed_rate(self, value: DualTypes_) -> None:
method schedule (line 140) | def schedule(self) -> Schedule:
method amortization (line 145) | def amortization(self) -> Amortization:
method accrued (line 151) | def accrued(self, settlement: datetime) -> DualTypes:
method __init__ (line 172) | def __init__(
method spread (line 224) | def spread(
class CreditProtectionLeg (line 247) | class CreditProtectionLeg(_BaseLeg):
method settlement_params (line 297) | def settlement_params(self) -> _SettlementParams:
method periods (line 303) | def periods(self) -> list[CreditProtectionPeriod]:
method schedule (line 308) | def schedule(self) -> Schedule:
method amortization (line 313) | def amortization(self) -> Amortization:
method __init__ (line 319) | def __init__(
method analytic_rec_risk (line 366) | def analytic_rec_risk(
method spread (line 391) | def spread(self, *args: Any, **kwargs: Any) -> DualTypes:
FILE: python/rateslib/legs/custom.py
class CustomLeg (line 27) | class CustomLeg(_BaseLeg):
method periods (line 70) | def periods(self) -> Sequence[_BasePeriod]:
method __init__ (line 74) | def __init__(self, periods: Sequence[_BasePeriod]) -> None:
method spread (line 81) | def spread(self, *args: Any, **kwargs: Any) -> DualTypes:
FILE: python/rateslib/legs/fixed.py
class FixedLeg (line 61) | class FixedLeg(_BaseLeg, _WithExDiv):
method settlement_params (line 511) | def settlement_params(self) -> _SettlementParams:
method periods (line 517) | def periods(self) -> list[_BasePeriod]:
method fixed_rate (line 541) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 547) | def fixed_rate(self, value: DualTypes_) -> None:
method schedule (line 553) | def schedule(self) -> Schedule:
method amortization (line 558) | def amortization(self) -> Amortization:
method __init__ (line 564) | def __init__(
method spread (line 779) | def spread(
class ZeroFixedLeg (line 815) | class ZeroFixedLeg(_BaseLeg):
method settlement_params (line 927) | def settlement_params(self) -> _SettlementParams:
method periods (line 933) | def periods(self) -> list[_BasePeriod]:
method schedule (line 946) | def schedule(self) -> Schedule:
method amortization (line 951) | def amortization(self) -> Amortization:
method __init__ (line 957) | def __init__(
method fixed_rate (line 1076) | def fixed_rate(self) -> DualTypes_:
method fixed_rate (line 1082) | def fixed_rate(self, value: DualTypes_) -> None:
method spread (line 1087) | def spread(
function _fx_delivery (line 1148) | def _fx_delivery(
FILE: python/rateslib/legs/float.py
class FloatLeg (line 64) | class FloatLeg(_BaseLeg, _WithExDiv):
method rate_params (line 436) | def rate_params(self) -> _FloatRateParams:
method settlement_params (line 442) | def settlement_params(self) -> _SettlementParams:
method periods (line 448) | def periods(self) -> list[_BasePeriod]:
method float_spread (line 474) | def float_spread(self) -> DualTypes:
method float_spread (line 480) | def float_spread(self, value: DualTypes) -> None:
method schedule (line 485) | def schedule(self) -> Schedule:
method amortization (line 490) | def amortization(self) -> Amortization:
method __init__ (line 496) | def __init__(
method _is_linear (line 805) | def _is_linear(self) -> bool:
method spread (line 825) | def spread(
class ZeroFloatLeg (line 888) | class ZeroFloatLeg(_BaseLeg):
method settlement_params (line 1014) | def settlement_params(self) -> _SettlementParams:
method periods (line 1020) | def periods(self) -> Sequence[_BasePeriod]:
method schedule (line 1033) | def schedule(self) -> Schedule:
method amortization (line 1038) | def amortization(self) -> Amortization:
method rate_params (line 1045) | def rate_params(self) -> _FloatRateParams:
method float_spread (line 1051) | def float_spread(self) -> DualTypes:
method float_spread (line 1057) | def float_spread(self, value: DualTypes) -> None:
method float_periods (line 1062) | def float_periods(self) -> CustomLeg:
method __init__ (line 1067) | def __init__(
method spread (line 1181) | def spread(
FILE: python/rateslib/legs/protocols/__init__.py
class _BaseLeg (line 21) | class _BaseLeg(
FILE: python/rateslib/legs/protocols/analytic_delta.py
class _WithAnalyticDelta (line 35) | class _WithAnalyticDelta(Protocol):
method periods (line 42) | def periods(self) -> Sequence[_BasePeriod]: ...
method local_analytic_delta (line 44) | def local_analytic_delta(
method analytic_delta (line 96) | def analytic_delta(
FILE: python/rateslib/legs/protocols/analytic_fixings.py
class _WithAnalyticRateFixings (line 33) | class _WithAnalyticRateFixings(Protocol):
method periods (line 40) | def periods(self) -> Sequence[_BasePeriod]: ...
method local_analytic_rate_fixings (line 42) | def local_analytic_rate_fixings(
FILE: python/rateslib/legs/protocols/cashflows.py
class _WithCashflows (line 37) | class _WithCashflows(Protocol):
method periods (line 44) | def periods(self) -> Sequence[_BasePeriod]: ...
method cashflows (line 46) | def cashflows(
class _WithExDiv (line 120) | class _WithExDiv(Protocol):
method schedule (line 127) | def schedule(self) -> Schedule: ...
method _period_index (line 129) | def _period_index(self, settlement: datetime) -> int:
method ex_div (line 141) | def ex_div(self, settlement: datetime) -> bool:
FILE: python/rateslib/legs/protocols/fixings.py
class _WithFixings (line 40) | class _WithFixings(_WithNPV, Protocol):
method periods (line 53) | def periods(self) -> Sequence[_BasePeriod]: ...
method reset_fixings (line 55) | def reset_fixings(self, state: int_ = NoInput(0)) -> None:
method local_fixings (line 74) | def local_fixings(
FILE: python/rateslib/legs/protocols/npv.py
class _WithNPV (line 36) | class _WithNPV(Protocol):
method periods (line 56) | def periods(self) -> Sequence[_BasePeriod]:
method __repr__ (line 61) | def __repr__(self) -> str:
method settlement_params (line 65) | def settlement_params(self) -> _SettlementParams:
method local_npv (line 70) | def local_npv(
method npv (line 126) | def npv(
method spread (line 210) | def spread(
FILE: python/rateslib/local_types.py
class SupportsSolverMutability (line 264) | class SupportsSolverMutability(Protocol):
method _n (line 266) | def _n(self) -> int: ...
method _ini_solve (line 268) | def _ini_solve(self) -> int: ...
method _set_ad_order (line 269) | def _set_ad_order(self, ad: int) -> None: ...
method _set_node_vector (line 270) | def _set_node_vector(self, vector: Arr1dObj, ad: int) -> None: ...
method _get_node_vars (line 271) | def _get_node_vars(self) -> tuple[str, ...]: ...
method _get_node_vector (line 272) | def _get_node_vector(self) -> Arr1dObj: ...
class SupportsRate (line 275) | class SupportsRate(Protocol):
method rate (line 276) | def rate(self, *args: Any, **kwargs: Any) -> DualTypes: ...
method rate_scalar (line 279) | def rate_scalar(self) -> float: ...
class SupportsMetrics (line 282) | class SupportsMetrics:
method rate (line 283) | def rate(self, *args: Any, **kwargs: Any) -> DualTypes: ... # type: i...
method npv (line 284) | def npv(self, *args: Any, **kwargs: Any) -> DualTypes | dict[str, Dual...
method delta (line 285) | def delta(self, *args: Any, **kwargs: Any) -> DataFrame: ... # type: ...
method gamma (line 286) | def gamma(self, *args: Any, **kwargs: Any) -> DataFrame: ... # type: ...
method cashflows (line 287) | def cashflows(self, *args: Any, **kwargs: Any) -> DataFrame: ... # ty...
method cashflows_table (line 288) | def cashflows_table(self, *args: Any, **kwargs: Any) -> DataFrame: ......
class _SupportsFixedFloatLeg1 (line 291) | class _SupportsFixedFloatLeg1(Protocol):
method leg1 (line 293) | def leg1(self) -> FixedLeg | FloatLeg: ...
FILE: python/rateslib/mutability/__init__.py
function _no_interior_validation (line 29) | def _no_interior_validation(func: Callable[P, R]) -> Callable[P, R]:
function _validate_states (line 51) | def _validate_states(func: Callable[P, R]) -> Callable[P, R]:
function _clear_cache_post (line 67) | def _clear_cache_post(func: Callable[P, R]) -> Callable[P, R]:
function _new_state_post (line 83) | def _new_state_post(func: Callable[P, R]) -> Callable[P, R]:
class _WithState (line 99) | class _WithState:
method _set_new_state (line 115) | def _set_new_state(self) -> None:
method _validate_state (line 124) | def _validate_state(self) -> None:
method _get_composited_state (line 133) | def _get_composited_state(self) -> int:
class _WithCache (line 143) | class _WithCache(Generic[KT, VT]):
method _cached_value (line 147) | def _cached_value(self, key: KT, val: VT) -> VT:
method _clear_cache (line 159) | def _clear_cache(self) -> None:
FILE: python/rateslib/periods/cashflow.py
class Cashflow (line 53) | class Cashflow(_BasePeriodStatic):
method __init__ (line 149) | def __init__(
method unindexed_reference_cashflow (line 193) | def unindexed_reference_cashflow(
method try_unindexed_reference_cashflow_analytic_delta (line 201) | def try_unindexed_reference_cashflow_analytic_delta(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 209) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
class MtmCashflow (line 221) | class MtmCashflow(_BasePeriodStatic):
method mtm_params (line 335) | def mtm_params(self) -> _MtmParams:
method __init__ (line 340) | def __init__(
method unindexed_reference_cashflow (line 388) | def unindexed_reference_cashflow( # type: ignore[override]
method try_unindexed_reference_cashflow_analytic_delta (line 402) | def try_unindexed_reference_cashflow_analytic_delta(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 410) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
FILE: python/rateslib/periods/credit.py
class CreditPremiumPeriod (line 57) | class CreditPremiumPeriod(_BasePeriod):
method credit_params (line 158) | def credit_params(self) -> _CreditParams:
method rate_params (line 163) | def rate_params(self) -> _FixedRateParams:
method period_params (line 168) | def period_params(self) -> _PeriodParams:
method __init__ (line 172) | def __init__(
method immediate_local_npv (line 218) | def immediate_local_npv(
method try_immediate_local_analytic_delta (line 233) | def try_immediate_local_analytic_delta(
method cashflow (line 253) | def cashflow(
method try_cashflow (line 272) | def try_cashflow(
method _probability_adjusted_df (line 303) | def _probability_adjusted_df(self, rate_curve: _BaseCurve, disc_curve:...
method try_accrued (line 336) | def try_accrued(self, settlement: datetime) -> Result[DualTypes]:
method accrued (line 364) | def accrued(self, settlement: datetime) -> DualTypes:
class CreditProtectionPeriod (line 380) | class CreditProtectionPeriod(_BasePeriod):
method credit_params (line 460) | def credit_params(self) -> _CreditParams:
method period_params (line 465) | def period_params(self) -> _PeriodParams:
method __init__ (line 469) | def __init__(
method cashflow (line 509) | def cashflow(
method try_cashflow (line 522) | def try_cashflow(
method immediate_local_npv (line 553) | def immediate_local_npv(
method _quadrature (line 568) | def _quadrature(
method try_immediate_local_analytic_delta (line 595) | def try_immediate_local_analytic_delta(
method analytic_rec_risk (line 607) | def analytic_rec_risk(
FILE: python/rateslib/periods/fixed_period.py
class FixedPeriod (line 61) | class FixedPeriod(_BasePeriodStatic):
method rate_params (line 230) | def rate_params(self) -> _FixedRateParams:
method period_params (line 235) | def period_params(self) -> _PeriodParams:
method __init__ (line 239) | def __init__(
method unindexed_reference_cashflow (line 305) | def unindexed_reference_cashflow(
method try_unindexed_reference_cashflow_analytic_delta (line 366) | def try_unindexed_reference_cashflow_analytic_delta(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 374) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
class ZeroFixedPeriod (line 386) | class ZeroFixedPeriod(_BasePeriodStatic):
method rate_params (line 495) | def rate_params(self) -> _FixedRateParams:
method period_params (line 500) | def period_params(self) -> _PeriodParams:
method schedule (line 505) | def schedule(self) -> Schedule:
method dcf (line 510) | def dcf(self) -> float:
method fixed_periods (line 528) | def fixed_periods(self) -> list[FixedPeriod]:
method __init__ (line 535) | def __init__(
method unindexed_reference_cashflow (line 614) | def unindexed_reference_cashflow(
method try_unindexed_reference_cashflow_analytic_delta (line 628) | def try_unindexed_reference_cashflow_analytic_delta(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 645) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
method cashflows (line 656) | def cashflows(
FILE: python/rateslib/periods/float_period.py
class FloatPeriod (line 81) | class FloatPeriod(_BasePeriodStatic):
method rate_params (line 375) | def rate_params(self) -> _FloatRateParams:
method period_params (line 380) | def period_params(self) -> _PeriodParams:
method __init__ (line 383) | def __init__(
method unindexed_reference_cashflow (line 483) | def unindexed_reference_cashflow(
method try_unindexed_reference_cashflow_analytic_delta (line 492) | def try_unindexed_reference_cashflow_analytic_delta(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 530) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
method try_rate (line 580) | def try_rate(self, rate_curve: CurveOption_) -> Result[DualTypes]:
method rate (line 622) | def rate(self, rate_curve: CurveOption_) -> DualTypes:
class ZeroFloatPeriod (line 638) | class ZeroFloatPeriod(_BasePeriodStatic):
method rate_params (line 790) | def rate_params(self) -> _FloatRateParams:
method rate_metric (line 795) | def rate_metric(self) -> str:
method period_params (line 800) | def period_params(self) -> _PeriodParams:
method schedule (line 805) | def schedule(self) -> Schedule:
method dcf (line 810) | def dcf(self) -> float:
method float_spread (line 828) | def float_spread(self) -> DualTypes:
method float_spread (line 833) | def float_spread(self, value: DualTypes) -> None:
method float_periods (line 838) | def float_periods(self) -> list[FloatPeriod]:
method __init__ (line 845) | def __init__(
method try_rate (line 941) | def try_rate(
method rate (line 965) | def rate(self, *, rate_curve: CurveOption_ = NoInput(0)) -> DualTypes:
method unindexed_reference_cashflow (line 986) | def unindexed_reference_cashflow(
method try_unindexed_reference_cashflow_analytic_delta (line 998) | def try_unindexed_reference_cashflow_analytic_delta(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 1020) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
method cashflows (line 1051) | def cashflows(
function _get_ibor_curve_from_dict (line 1076) | def _get_ibor_curve_from_dict(fixing_frequency: Frequency, d: dict[str, ...
function _get_ibor_curve_from_dict2 (line 1088) | def _get_ibor_curve_from_dict2(fixing_frequency: str, d: dict[str, _Base...
class _UnindexedReferenceCashflowFixingsSensitivity (line 1099) | class _UnindexedReferenceCashflowFixingsSensitivity:
method _ibor (line 1101) | def _ibor(
method _ibor_regular (line 1130) | def _ibor_regular(
method _ibor_stub (line 1158) | def _ibor_stub(
method _rfr (line 1196) | def _rfr(
method _rfr_drdr_approximation (line 1236) | def _rfr_drdr_approximation(
FILE: python/rateslib/periods/float_rate.py
function rate_value (line 45) | def rate_value(
function try_rate_value (line 72) | def try_rate_value(
FILE: python/rateslib/periods/fx_volatility.py
class _BaseFXOptionPeriod (line 94) | class _BaseFXOptionPeriod(_BasePeriodStatic, _WithAnalyticFXOptionGreeks...
method analytic_greeks (line 103) | def analytic_greeks(
method period_params (line 122) | def period_params(self) -> None:
method settlement_params (line 128) | def settlement_params(self) -> _SettlementParams:
method index_params (line 134) | def index_params(self) -> _IndexParams | None:
method non_deliverable_params (line 140) | def non_deliverable_params(self) -> _NonDeliverableParams | None:
method rate_params (line 146) | def rate_params(self) -> None:
method fx_option_params (line 151) | def fx_option_params(self) -> _FXOptionParams:
method __init__ (line 157) | def __init__(
method __repr__ (line 246) | def __repr__(self) -> str:
method unindexed_reference_cashflow (line 249) | def unindexed_reference_cashflow( # type: ignore[override]
method try_rate (line 317) | def try_rate(
method rate (line 368) | def rate(
method implied_vol (line 415) | def implied_vol(
method _index_vol_and_strike_from_atm (line 482) | def _index_vol_and_strike_from_atm(
method _index_vol_and_strike_from_atm_sabr (line 541) | def _index_vol_and_strike_from_atm_sabr(
method _index_vol_and_strike_from_atm_dv (line 589) | def _index_vol_and_strike_from_atm_dv( # DeltaVol type models
method _index_vol_and_strike_from_delta (line 655) | def _index_vol_and_strike_from_delta(
method _index_vol_and_strike_from_delta_dv (line 709) | def _index_vol_and_strike_from_delta_dv(
method _index_vol_and_strike_from_delta_sabr (line 772) | def _index_vol_and_strike_from_delta_sabr(
method _payoff_at_expiry (line 851) | def _payoff_at_expiry(
class FXCallPeriod (line 873) | class FXCallPeriod(_BaseFXOptionPeriod):
method __init__ (line 946) | def __init__(
class FXPutPeriod (line 975) | class FXPutPeriod(_BaseFXOptionPeriod):
method __init__ (line 1048) | def __init__(
FILE: python/rateslib/periods/ir_volatility.py
class _BaseIRSOptionPeriod (line 73) | class _BaseIRSOptionPeriod(_BasePeriodStatic, _WithAnalyticIROptionGreek...
method analytic_greeks (line 82) | def analytic_greeks(
method period_params (line 103) | def period_params(self) -> None:
method settlement_params (line 109) | def settlement_params(self) -> _SettlementParams:
method index_params (line 115) | def index_params(self) -> _IndexParams | None:
method non_deliverable_params (line 121) | def non_deliverable_params(self) -> _NonDeliverableParams | None:
method rate_params (line 127) | def rate_params(self) -> None:
method ir_option_params (line 132) | def ir_option_params(self) -> _IROptionParams:
method __init__ (line 138) | def __init__(
method __repr__ (line 183) | def __repr__(self) -> str:
method _unindexed_reference_cashflow_elements (line 186) | def _unindexed_reference_cashflow_elements(
method unindexed_reference_cashflow (line 317) | def unindexed_reference_cashflow( # type: ignore[override]
method try_rate (line 333) | def try_rate(
method rate (line 363) | def rate(
method _payoff_at_expiry (line 484) | def _payoff_at_expiry(
class IRSCallPeriod (line 506) | class IRSCallPeriod(_BaseIRSOptionPeriod):
method __init__ (line 577) | def __init__(
class IRSPutPeriod (line 606) | class IRSPutPeriod(_BaseIRSOptionPeriod):
method __init__ (line 681) | def __init__(
FILE: python/rateslib/periods/parameters/credit.py
class _CreditParams (line 15) | class _CreditParams:
method __init__ (line 23) | def __init__(self, _premium_accrued: bool) -> None:
method premium_accrued (line 27) | def premium_accrued(self) -> bool:
FILE: python/rateslib/periods/parameters/fx_volatility.py
class _FXOptionParams (line 33) | class _FXOptionParams:
method __init__ (line 48) | def __init__(
method expiry (line 90) | def expiry(self) -> datetime:
method delivery (line 95) | def delivery(self) -> datetime:
method fx_index (line 100) | def fx_index(self) -> FXIndex:
method pair (line 105) | def pair(self) -> str:
method direction (line 110) | def direction(self) -> OptionType:
method strike (line 115) | def strike(self) -> DualTypes_:
method strike (line 120) | def strike(self, val: DualTypes_) -> None:
method option_fixing (line 124) | def option_fixing(self) -> FXFixing:
method metric (line 129) | def metric(self) -> FXOptionMetric:
method delta_type (line 134) | def delta_type(self) -> FXDeltaMethod:
method time_to_expiry (line 138) | def time_to_expiry(self, now: datetime) -> float:
FILE: python/rateslib/periods/parameters/index.py
class _IndexParams (line 48) | class _IndexParams:
method __init__ (line 83) | def __init__(
method index_base (line 148) | def index_base(self) -> IndexFixing:
method index_base (line 153) | def index_base(self, value: Any) -> None:
method index_fixing (line 157) | def index_fixing(self) -> IndexFixing:
method index_fixing (line 163) | def index_fixing(self, value: Any) -> None:
method index_only (line 167) | def index_only(self) -> bool:
method index_lag (line 172) | def index_lag(self) -> int:
method index_method (line 177) | def index_method(self) -> IndexMethod:
method try_index_value (line 182) | def try_index_value(
method try_index_base (line 206) | def try_index_base(
method try_index_ratio (line 230) | def try_index_ratio(
method index_ratio (line 251) | def index_ratio(
function _init_or_none_IndexParams (line 274) | def _init_or_none_IndexParams(
FILE: python/rateslib/periods/parameters/ir_volatility.py
class _IROptionParams (line 35) | class _IROptionParams:
method __init__ (line 46) | def __init__(
method settlement_method (line 92) | def settlement_method(self) -> SwaptionSettlementMethod:
method expiry (line 97) | def expiry(self) -> datetime:
method direction (line 102) | def direction(self) -> OptionType:
method strike (line 107) | def strike(self) -> DualTypes_:
method strike (line 112) | def strike(self, val: DualTypes_) -> None:
method option_fixing (line 117) | def option_fixing(self) -> IRSFixing:
method metric (line 122) | def metric(self) -> IROptionMetric:
method time_to_expiry (line 126) | def time_to_expiry(self, now: datetime) -> float:
FILE: python/rateslib/periods/parameters/mtm.py
class _MtmParams (line 34) | class _MtmParams:
method __init__ (line 54) | def __init__(
method fx_fixing_start (line 65) | def fx_fixing_start(self) -> FXFixing:
method fx_fixing_end (line 70) | def fx_fixing_end(self) -> FXFixing:
method currency (line 75) | def currency(self) -> str:
method pair (line 80) | def pair(self) -> str:
method reference_currency (line 85) | def reference_currency(self) -> str:
method fx_reversed (line 91) | def fx_reversed(self) -> bool:
method try_fixing_change (line 95) | def try_fixing_change(self, fx: FXForwards_) -> Result[DualTypes]:
function _init_MtmParams (line 107) | def _init_MtmParams(
FILE: python/rateslib/periods/parameters/period.py
class _PeriodParams (line 31) | class _PeriodParams:
method __init__ (line 66) | def __init__(
method start (line 90) | def start(self) -> datetime:
method end (line 95) | def end(self) -> datetime:
method termination (line 100) | def termination(self) -> datetime_:
method adjuster (line 105) | def adjuster(self) -> Adjuster_:
method calendar (line 111) | def calendar(self) -> CalTypes:
method stub (line 116) | def stub(self) -> bool:
method convention (line 122) | def convention(self) -> Convention:
method frequency (line 127) | def frequency(self) -> Frequency:
method dcf (line 132) | def dcf(self) -> float:
FILE: python/rateslib/periods/parameters/rate.py
function _init_FloatRateParams (line 58) | def _init_FloatRateParams(
function _init_float_rate_series (line 215) | def _init_float_rate_series(
class _CreditParams (line 257) | class _CreditParams:
method __init__ (line 269) | def __init__(self, _premium_accrued: bool):
method premium_accrued (line 273) | def premium_accrued(self) -> bool:
class _FixedRateParams (line 278) | class _FixedRateParams:
method __init__ (line 288) | def __init__(self, _fixed_rate: DualTypes_) -> None:
method fixed_rate (line 292) | def fixed_rate(self) -> DualTypes | NoInput:
method fixed_rate (line 297) | def fixed_rate(self, value: DualTypes_) -> None:
class _FloatRateParams (line 301) | class _FloatRateParams:
method __init__ (line 328) | def __init__(
method fixing_series (line 351) | def fixing_series(self) -> FloatRateSeries:
method fixing_index (line 357) | def fixing_index(self) -> FloatRateIndex:
method fixing_date (line 363) | def fixing_date(self) -> datetime:
method fixing_convention (line 378) | def fixing_convention(self) -> Convention:
method fixing_modifier (line 384) | def fixing_modifier(self) -> Adjuster:
method fixing_frequency (line 390) | def fixing_frequency(self) -> Frequency:
method fixing_identifier (line 396) | def fixing_identifier(self) -> str_:
method accrual_start (line 416) | def accrual_start(self) -> datetime:
method accrual_end (line 426) | def accrual_end(self) -> datetime:
method fixing_calendar (line 435) | def fixing_calendar(self) -> CalTypes:
method fixing_method (line 440) | def fixing_method(self) -> FloatFixingMethod:
method float_spread (line 446) | def float_spread(self) -> DualTypes:
method float_spread (line 451) | def float_spread(self, value: DualTypes) -> None:
method spread_compound_method (line 456) | def spread_compound_method(self) -> SpreadCompoundMethod:
method rate_fixing (line 461) | def rate_fixing(self) -> IBORFixing | IBORStubFixing | RFRFixing:
method _validate_combinations_args (line 467) | def _validate_combinations_args(self) -> None:
FILE: python/rateslib/periods/parameters/settlement.py
class _SettlementParams (line 40) | class _SettlementParams:
method __init__ (line 65) | def __init__(
method currency (line 80) | def currency(self) -> str:
method notional (line 85) | def notional(self) -> DualTypes:
method notional_currency (line 90) | def notional_currency(self) -> str:
method payment (line 95) | def payment(self) -> datetime:
method ex_dividend (line 100) | def ex_dividend(self) -> datetime:
class _NonDeliverableParams (line 105) | class _NonDeliverableParams:
method __init__ (line 126) | def __init__(
method currency (line 142) | def currency(self) -> str:
method reference_currency (line 147) | def reference_currency(self) -> str:
method fx_index (line 153) | def fx_index(self) -> FXIndex:
method pair (line 160) | def pair(self) -> str:
method fx_fixing (line 165) | def fx_fixing(self) -> FXFixing:
method fx_fixing (line 170) | def fx_fixing(self, val: Any) -> None:
method delivery (line 174) | def delivery(self) -> datetime:
method publication (line 179) | def publication(self) -> datetime:
method fx_reversed (line 184) | def fx_reversed(self) -> bool:
function _init_or_none_NonDeliverableParams (line 189) | def _init_or_none_NonDeliverableParams(
function _init_SettlementParams_with_fx_pair (line 206) | def _init_SettlementParams_with_fx_pair(
function _init_fx_fixing (line 237) | def _init_fx_fixing(
FILE: python/rateslib/periods/protocols/__init__.py
class _BasePeriod (line 43) | class _BasePeriod(
class _BasePeriodStatic (line 55) | class _BasePeriodStatic(
FILE: python/rateslib/periods/protocols/analytic_delta.py
class _WithAnalyticDelta (line 45) | class _WithAnalyticDelta(Protocol):
method settlement_params (line 75) | def settlement_params(self) -> _SettlementParams:
method try_immediate_local_analytic_delta (line 80) | def try_immediate_local_analytic_delta(
method try_local_analytic_delta (line 121) | def try_local_analytic_delta(
method analytic_delta (line 186) | def analytic_delta(
class _WithAnalyticDeltaStatic (line 265) | class _WithAnalyticDeltaStatic(
method try_unindexed_reference_cashflow_analytic_delta (line 298) | def try_unindexed_reference_cashflow_analytic_delta(
method try_reference_cashflow_analytic_delta (line 328) | def try_reference_cashflow_analytic_delta(
method try_unindexed_cashflow_analytic_delta (line 361) | def try_unindexed_cashflow_analytic_delta(
method try_cashflow_analytic_delta (line 396) | def try_cashflow_analytic_delta(
method try_immediate_local_analytic_delta (line 442) | def try_immediate_local_analytic_delta(
FILE: python/rateslib/periods/protocols/analytic_fixings.py
class _WithAnalyticRateFixings (line 38) | class _WithAnalyticRateFixings(Protocol):
method settlement_params (line 57) | def settlement_params(self) -> _SettlementParams: ...
method try_immediate_analytic_rate_fixings (line 59) | def try_immediate_analytic_rate_fixings(
method local_analytic_rate_fixings (line 96) | def local_analytic_rate_fixings(
class _WithAnalyticRateFixingsStatic (line 155) | class _WithAnalyticRateFixingsStatic(
method try_unindexed_reference_cashflow_analytic_rate_fixings (line 179) | def try_unindexed_reference_cashflow_analytic_rate_fixings(
method try_unindexed_cashflow_analytic_rate_fixings (line 221) | def try_unindexed_cashflow_analytic_rate_fixings(
method try_reference_cashflow_analytic_rate_fixings (line 286) | def try_reference_cashflow_analytic_rate_fixings(
method try_cashflow_analytic_rate_fixings (line 336) | def try_cashflow_analytic_rate_fixings(
method try_immediate_analytic_rate_fixings (line 386) | def try_immediate_analytic_rate_fixings(
FILE: python/rateslib/periods/protocols/analytic_greeks.py
class _WithAnalyticFXOptionGreeks (line 58) | class _WithAnalyticFXOptionGreeks(Protocol):
method fx_option_params (line 64) | def fx_option_params(self) -> _FXOptionParams: ...
method settlement_params (line 67) | def settlement_params(self) -> _SettlementParams: ...
method analytic_greeks (line 87) | def analytic_greeks(
method _base_analytic_greeks (line 181) | def _base_analytic_greeks(
method _analytic_vega (line 370) | def _analytic_vega(
method _analytic_vomma (line 376) | def _analytic_vomma(
method _analytic_gamma (line 385) | def _analytic_gamma(
method _analytic_delta (line 401) | def _analytic_delta(
method _analytic_sticky_delta (line 422) | def _analytic_sticky_delta(
method _analytic_vanna (line 486) | def _analytic_vanna(
method _analytic_kega (line 503) | def _analytic_kega(
method _analytic_kappa (line 524) | def _analytic_kappa(v_deli: DualTypes, phi: float, d_min: DualTypes) -...
method _analytic_bs76 (line 528) | def _analytic_bs76(
class _WithAnalyticIROptionGreeks (line 539) | class _WithAnalyticIROptionGreeks(Protocol):
method ir_option_params (line 545) | def ir_option_params(self) -> _IROptionParams: ...
method settlement_params (line 548) | def settlement_params(self) -> _SettlementParams: ...
method analytic_greeks (line 550) | def analytic_greeks(
method _base_analytic_greeks (line 645) | def _base_analytic_greeks(
method _analytic_vega (line 795) | def _analytic_vega(
method _analytic_vomma (line 809) | def _analytic_vomma(
method _analytic_gamma (line 824) | def _analytic_gamma(
method _analytic_delta (line 839) | def _analytic_delta(
method _analytic_vanna (line 851) | def _analytic_vanna(
method _analytic_sticky_delta (line 865) | def _analytic_sticky_delta(
FILE: python/rateslib/periods/protocols/cashflows.py
class _WithCashflows (line 52) | class _WithCashflows(_WithNPV, Protocol):
method try_cashflow (line 76) | def try_cashflow(
method cashflows (line 116) | def cashflows(
class _WithCashflowsStatic (line 190) | class _WithCashflowsStatic(_WithNPVStatic, Protocol):
method _index_elements (line 208) | def _index_elements(
method _non_deliverable_elements (line 245) | def _non_deliverable_elements(self, fx: FXForwards_) -> dict[str, Any]:
method _mtm_elements (line 265) | def _mtm_elements(self, fx: FXForwards_) -> dict[str, Any]:
method cashflows (line 277) | def cashflows(
function _standard_elements (line 358) | def _standard_elements(self: _WithCashflows | _WithCashflowsStatic) -> d...
function _period_elements (line 373) | def _period_elements(self: _WithCashflows | _WithCashflowsStatic) -> dic...
function _rate_elements (line 392) | def _rate_elements(
function _credit_elements (line 420) | def _credit_elements(
function _cashflow_elements (line 451) | def _cashflow_elements(
FILE: python/rateslib/periods/protocols/fixings.py
class _WithFixings (line 46) | class _WithFixings(_WithNPV, Protocol):
method reset_fixings (line 79) | def reset_fixings(self, state: int_ = NoInput(0)) -> None:
method local_fixings (line 141) | def local_fixings(
function _replace_fixings_with_ad_variables (line 210) | def _replace_fixings_with_ad_variables(
function _structure_sensitivity_data (line 251) | def _structure_sensitivity_data(
class _SupportsResetFixings (line 285) | class _SupportsResetFixings(Protocol):
method reset_fixings (line 286) | def reset_fixings(self, state: int_ = NoInput(0)) -> None: ...
function _reset_fixings_data (line 289) | def _reset_fixings_data(
function _s2_before_s1 (line 306) | def _s2_before_s1(v1: DualTypes, v2: DualTypes | None) -> DualTypes:
FILE: python/rateslib/periods/protocols/npv.py
function _screen_ex_div_and_forward (line 48) | def _screen_ex_div_and_forward(
class _WithNPV (line 111) | class _WithNPV(Protocol):
method settlement_params (line 144) | def settlement_params(self) -> _SettlementParams:
method __repr__ (line 149) | def __repr__(self) -> str:
method immediate_local_npv (line 152) | def immediate_local_npv(
method try_immediate_local_npv (line 198) | def try_immediate_local_npv(
method local_npv (line 232) | def local_npv(
method try_local_npv (line 301) | def try_local_npv(
method npv (line 337) | def npv(
class _WithIndexingStatic (line 429) | class _WithIndexingStatic(Protocol):
method index_params (line 437) | def index_params(self) -> _IndexParams | None:
method is_indexed (line 445) | def is_indexed(self) -> bool:
method index_up (line 451) | def index_up(self, value: DualTypes, index_curve: _BaseCurve_) -> Dual...
method try_index_up (line 476) | def try_index_up(self, value: Result[DualTypes], index_curve: _BaseCur...
class _WithNonDeliverableStatic (line 503) | class _WithNonDeliverableStatic(Protocol):
method non_deliverable_params (line 514) | def non_deliverable_params(self) -> _NonDeliverableParams | None:
method is_non_deliverable (line 520) | def is_non_deliverable(self) -> bool:
method convert_deliverable (line 527) | def convert_deliverable(self, value: DualTypes, fx: FXForwards_) -> Du...
method try_convert_deliverable (line 551) | def try_convert_deliverable(
class _WithNPVStatic (line 580) | class _WithNPVStatic(_WithNPV, _WithIndexingStatic, _WithNonDeliverableS...
method unindexed_reference_cashflow (line 624) | def unindexed_reference_cashflow(
method try_unindexed_reference_cashflow (line 671) | def try_unindexed_reference_cashflow(
method reference_cashflow (line 703) | def reference_cashflow(
method try_reference_cashflow (line 754) | def try_reference_cashflow(
method unindexed_cashflow (line 786) | def unindexed_cashflow(
method try_unindexed_cashflow (line 837) | def try_unindexed_cashflow(
method cashflow (line 869) | def cashflow(
method try_cashflow (line 920) | def try_cashflow(
method immediate_local_npv (line 952) | def immediate_local_npv(
FILE: python/rateslib/periods/utils.py
function _maybe_local (line 51) | def _maybe_local(
function _maybe_fx_converted (line 70) | def _maybe_fx_converted(
function _get_immediate_fx_scalar_and_base (line 84) | def _get_immediate_fx_scalar_and_base(
function _get_ir_vol_value_and_forward_maybe_from_obj (line 150) | def _get_ir_vol_value_and_forward_maybe_from_obj(
function _get_fx_vol_value_maybe_from_obj (line 202) | def _get_fx_vol_value_maybe_from_obj(
function _get_vol_smile_or_value (line 249) | def _get_vol_smile_or_value(vol: _FXVolOption_, expiry: datetime) -> FXD...
function _get_vol_smile_or_raise (line 256) | def _get_vol_smile_or_raise(vol: _FXVolOption_, expiry: datetime) -> FXD...
function _get_vol_delta_type (line 265) | def _get_vol_delta_type(vol: _FXVolOption_, default_delta_type: FXDeltaM...
function _validate_fx_as_forwards (line 272) | def _validate_fx_as_forwards(fx: FX_) -> FXForwards:
function _try_validate_fx_as_forwards (line 276) | def _try_validate_fx_as_forwards(fx: FX_) -> Result[FXForwards]:
function _try_validate_base_curve (line 285) | def _try_validate_base_curve(curve: CurveOption_) -> Result[_BaseCurve]:
function _validate_base_curve (line 296) | def _validate_base_curve(curve: CurveOption_) -> _BaseCurve:
function _validate_credit_curves (line 305) | def _validate_credit_curves(
function _get_rfr_curve_from_dict (line 326) | def _get_rfr_curve_from_dict(d: dict[str, _BaseCurve]) -> _BaseCurve:
FILE: python/rateslib/rs.pyi
class ADOrder (line 28) | class ADOrder:
class LegIndexBase (line 33) | class LegIndexBase:
class Imm (line 37) | class Imm:
method next (line 52) | def next(self, date: datetime) -> datetime: ...
method validate (line 53) | def validate(self, date: datetime) -> bool: ...
method get (line 54) | def get(self, year: int, month: int) -> datetime: ...
method to_json (line 55) | def to_json(self) -> str: ...
class _Scheduling (line 57) | class _Scheduling:
method unext (line 58) | def unext(self, udate: datetime) -> datetime: ...
method next (line 59) | def next(self, date: datetime) -> datetime: ...
method uprevious (line 60) | def uprevious(self, udate: datetime) -> datetime: ...
method previous (line 61) | def previous(self, date: datetime) -> datetime: ...
method uregular (line 62) | def uregular(self, ueffective: datetime, utermination: datetime) -> li...
method infer_ustub (line 63) | def infer_ustub(
method periods_per_annum (line 66) | def periods_per_annum(self) -> float: ...
class _FrequencyMixins (line 68) | class _FrequencyMixins:
method string (line 69) | def string(self) -> str: ...
method is_stub (line 70) | def is_stub(self, ustart: datetime, uend: datetime, front: bool) -> bo...
method is_uregular (line 71) | def is_uregular(self, ueffective: datetime, utermination: datetime) ->...
class Frequency (line 73) | class Frequency(_Scheduling, _FrequencyMixins):
class CalDays (line 74) | class CalDays(Frequency):
method __init__ (line 76) | def __init__(self, number: int) -> None: ...
class BusDays (line 78) | class BusDays(Frequency):
method __init__ (line 81) | def __init__(self, number: int, calendar: CalTypes) -> None: ...
class Months (line 83) | class Months(Frequency):
method __init__ (line 86) | def __init__(self, number: int, roll: RollDay | None) -> None: ...
class Zero (line 88) | class Zero(Frequency): ...
method to_json (line 90) | def to_json(self) -> str: ...
class StubInference (line 92) | class StubInference:
method to_json (line 99) | def to_json(self) -> str: ...
class Schedule (line 101) | class Schedule:
method __init__ (line 118) | def __init__(
method is_regular (line 133) | def is_regular(self) -> bool: ...
method to_json (line 134) | def to_json(self) -> str: ...
class Convention (line 136) | class Convention:
method dcf (line 154) | def dcf(
method to_json (line 164) | def to_json(self) -> str: ...
class Modifier (line 166) | class Modifier:
class RollDay (line 173) | class RollDay:
class Day (line 174) | class Day(RollDay):
method __init__ (line 176) | def __init__(self, val: int) -> None: ...
class IMM (line 178) | class IMM(RollDay): ...
method to_json (line 180) | def to_json(self) -> str: ...
class _Adjustment (line 182) | class _Adjustment:
method adjust (line 183) | def adjust(self, date: datetime, calendar: CalTypes) -> datetime: ...
method reverse (line 184) | def reverse(self, date: datetime, calendar: CalTypes) -> list[datetime...
method adjusts (line 185) | def adjusts(self, udates: list[datetime], calendars: CalTypes) -> list...
class Adjuster (line 187) | class Adjuster(_Adjustment):
class Actual (line 188) | class Actual(Adjuster): ...
class Following (line 189) | class Following(Adjuster): ...
class ModifiedFollowing (line 190) | class ModifiedFollowing(Adjuster): ...
class FollowingSettle (line 191) | class FollowingSettle(Adjuster): ...
class ModifiedFollowingSettle (line 192) | class ModifiedFollowingSettle(Adjuster): ...
class Previous (line 193) | class Previous(Adjuster): ...
class ModifiedPrevious (line 194) | class ModifiedPrevious(Adjuster): ...
class PreviousSettle (line 195) | class PreviousSettle(Adjuster): ...
class ModifiedPreviousSettle (line 196) | class ModifiedPreviousSettle(Adjuster): ...
class FollowingExLast (line 197) | class FollowingExLast(Adjuster): ...
class FollowingExLastSettle (line 198) | class FollowingExLastSettle(Adjuster): ...
class BusDaysLagSettleInAdvance (line 200) | class BusDaysLagSettleInAdvance(Adjuster):
method __init__ (line 203) | def __init__(self, number: int) -> None: ...
class BusDaysLagSettle (line 205) | class BusDaysLagSettle(Adjuster):
method __init__ (line 207) | def __init__(self, number: int) -> None: ...
class CalDaysLagSettle (line 209) | class CalDaysLagSettle(Adjuster):
method __init__ (line 211) | def __init__(self, number: int) -> None: ...
method to_json (line 213) | def to_json(self) -> str: ...
class _MethodParam (line 215) | class _MethodParam:
method method_param (line 216) | def method_param(self) -> int: ...
class FloatFixingMethod (line 218) | class FloatFixingMethod(_MethodParam):
class RFRPaymentDelay (line 219) | class RFRPaymentDelay(FloatFixingMethod): ...
class RFRObservationShift (line 221) | class RFRObservationShift(FloatFixingMethod):
method __init__ (line 223) | def __init__(self, param: int) -> None: ...
class RFRLockout (line 225) | class RFRLockout(FloatFixingMethod):
method __init__ (line 227) | def __init__(self, param: int) -> None: ...
class RFRLookback (line 229) | class RFRLookback(FloatFixingMethod):
method __init__ (line 231) | def __init__(self, param: int) -> None: ...
class RFRPaymentDelayAverage (line 233) | class RFRPaymentDelayAverage(FloatFixingMethod): ...
class RFRObservationShiftAverage (line 235) | class RFRObservationShiftAverage(FloatFixingMethod):
method __init__ (line 237) | def __init__(self, param: int) -> None: ...
class RFRLockoutAverage (line 239) | class RFRLockoutAverage(FloatFixingMethod):
method __init__ (line 241) | def __init__(self, param: int) -> None: ...
class RFRLookbackAverage (line 243) | class RFRLookbackAverage(FloatFixingMethod):
method __init__ (line 245) | def __init__(self, param: int) -> None: ...
class IBOR (line 247) | class IBOR(FloatFixingMethod):
method __init__ (line 249) | def __init__(self, param: int) -> None: ...
method to_json (line 251) | def to_json(self) -> str: ...
class _Shift (line 253) | class _Shift:
method shift (line 254) | def shift(self) -> int: ...
class IROptionMetric (line 256) | class IROptionMetric(_Shift):
class NormalVol (line 257) | class NormalVol(IROptionMetric): ...
class PercentNotional (line 258) | class PercentNotional(IROptionMetric): ...
class Premium (line 259) | class Premium(IROptionMetric): ...
class BlackVolShift (line 261) | class BlackVolShift(IROptionMetric):
method __init__ (line 263) | def __init__(self, param: int) -> None: ...
method to_json (line 265) | def to_json(self) -> str: ...
class CalendarManager (line 267) | class CalendarManager:
method add (line 268) | def add(self, name: str, calendar: Cal) -> None: ...
method pop (line 269) | def pop(self, name: str) -> Cal | UnionCal: ...
method get (line 270) | def get(self, name: str) -> NamedCal: ...
method keys (line 271) | def keys(self) -> list[str]: ...
class _DateRoll (line 273) | class _DateRoll:
method add_bus_days (line 274) | def add_bus_days(self, date: datetime, days: int, settlement: bool) ->...
method add_cal_days (line 275) | def add_cal_days(self, date: datetime, days: int, adjuster: Adjuster) ...
method add_months (line 276) | def add_months(
method bus_date_range (line 283) | def bus_date_range(self, start: datetime, end: datetime) -> list[datet...
method cal_date_range (line 284) | def cal_date_range(self, start: datetime, end: datetime) -> list[datet...
method is_bus_day (line 285) | def is_bus_day(self, date: datetime) -> bool: ...
method is_non_bus_day (line 286) | def is_non_bus_day(self, date: datetime) -> bool: ...
method is_settlement (line 287) | def is_settlement(self, date: datetime) -> bool: ...
method lag_bus_days (line 288) | def lag_bus_days(self, date: datetime, days: int, settlement: bool) ->...
method to_json (line 289) | def to_json(self) -> str: ...
method print (line 290) | def print(self, year: int, month: int | None = None) -> str: ...
method print_compare (line 291) | def print_compare(self, comparator: Cal | UnionCal | NamedCal, year: i...
class _CalendarAdjustment (line 293) | class _CalendarAdjustment:
method adjust (line 294) | def adjust(self, date: datetime, adjuster: Adjuster) -> datetime: ...
method adjusts (line 295) | def adjusts(self, dates: list[datetime], adjuster: Adjuster) -> list[d...
class Cal (line 297) | class Cal(_DateRoll, _CalendarAdjustment):
method __init__ (line 298) | def __init__(self, rules: list[datetime], week_mask: list[int]) -> Non...
method from_name (line 300) | def from_name(cls, name: str) -> Cal: ...
class UnionCal (line 302) | class UnionCal(_DateRoll, _CalendarAdjustment):
method from_name (line 306) | def from_name(cls, name: str) -> UnionCal: ...
method __init__ (line 307) | def __init__(
class NamedCal (line 313) | class NamedCal(_DateRoll, _CalendarAdjustment):
method __init__ (line 316) | def __init__(self, name: str) -> None: ...
method inner_ptr_eq (line 317) | def inner_ptr_eq(self, other: NamedCal) -> bool: ...
class Ccy (line 319) | class Ccy:
method __init__ (line 320) | def __init__(self, name: str) -> None: ...
class FXRate (line 323) | class FXRate:
method __init__ (line 324) | def __init__(
method __repr__ (line 331) | def __repr__(self) -> str: ...
method __eq__ (line 332) | def __eq__(self, other: FXRate) -> bool: ... # type: ignore[override]
class FXRates (line 334) | class FXRates:
method __init__ (line 335) | def __init__(self, fx_rates: list[FXRate], base: Ccy | None) -> None: ...
method __copy__ (line 336) | def __copy__(self) -> FXRates: ...
method get_ccy_index (line 343) | def get_ccy_index(self, currency: Ccy) -> int | None: ...
method rate (line 344) | def rate(self, lhs: Ccy, rhs: Ccy) -> DualTypes | None: ...
method update (line 345) | def update(self, fx_rates: list[FXRate]) -> None: ...
method set_ad_order (line 346) | def set_ad_order(self, ad: ADOrder) -> None: ...
method to_json (line 347) | def to_json(self) -> str: ...
class _DualOps (line 349) | class _DualOps:
method __eq__ (line 350) | def __eq__(self, other: Number) -> bool: ... # type: ignore[override]
method __lt__ (line 351) | def __lt__(self, other: Number) -> bool: ...
method __le__ (line 352) | def __le__(self, other: Number) -> bool: ...
method __gt__ (line 353) | def __gt__(self, other: Number) -> bool: ...
method __ge__ (line 354) | def __ge__(self, other: Number) -> bool: ...
method __neg__ (line 355) | def __neg__(self) -> Self: ...
method __add__ (line 356) | def __add__(self, other: Number) -> Self: ...
method __radd__ (line 357) | def __radd__(self, other: Number) -> Self: ...
method __sub__ (line 358) | def __sub__(self, other: Number) -> Self: ...
method __rsub__ (line 359) | def __rsub__(self, other: Number) -> Self: ...
method __mul__ (line 360) | def __mul__(self, other: Number) -> Self: ...
method __rmul__ (line 361) | def __rmul__(self, other: Number) -> Self: ...
method __truediv__ (line 362) | def __truediv__(self, other: Number) -> Self: ...
method __rtruediv__ (line 363) | def __rtruediv__(self, other: Number) -> Self: ...
method __pow__ (line 364) | def __pow__(self, power: Number, modulo: int | None = None) -> Self: ...
method __exp__ (line 365) | def __exp__(self) -> Self: ...
method __abs__ (line 366) | def __abs__(self) -> float: ...
method __log__ (line 367) | def __log__(self) -> Self: ...
method __norm_cdf__ (line 368) | def __norm_cdf__(self) -> Self: ...
method __norm_inv_cdf__ (line 369) | def __norm_inv_cdf__(self) -> Self: ...
method __float__ (line 370) | def __float__(self) -> float: ...
method to_json (line 371) | def to_json(self) -> str: ...
method ptr_eq (line 372) | def ptr_eq(self, other: Self) -> bool: ...
method __repr__ (line 373) | def __repr__(self) -> str: ...
method grad1 (line 374) | def grad1(self, vars: Sequence[str]) -> Arr1dF64: ... # noqa: A002
method grad2 (line 375) | def grad2(self, vars: Sequence[str]) -> Arr2dF64: ... # noqa: A002
class Dual (line 377) | class Dual(_DualOps):
method __init__ (line 378) | def __init__(self, real: float, vars: Sequence[str], dual: Sequence[fl...
method vars_from (line 383) | def vars_from(
method to_dual2 (line 390) | def to_dual2(self) -> Dual2: ...
class Dual2 (line 392) | class Dual2(_DualOps):
method __init__ (line 393) | def __init__(
method vars_from (line 405) | def vars_from(
method grad1_manifold (line 413) | def grad1_manifold(self, vars: Sequence[str]) -> list[Dual2]: ... # n...
method to_dual (line 414) | def to_dual(self) -> Dual: ...
function _dsolve1 (line 416) | def _dsolve1(a: list[Any], b: list[Any], allow_lsq: bool) -> list[Dual]:...
function _dsolve2 (line 417) | def _dsolve2(a: list[Any], b: list[Any], allow_lsq: bool) -> list[Dual2]...
function _fdsolve1 (line 418) | def _fdsolve1(a: Arr2dF64, b: list[Any], allow_lsq: bool) -> list[Dual]:...
function _fdsolve2 (line 419) | def _fdsolve2(a: Arr2dF64, b: list[Any], allow_lsq: bool) -> list[Dual2]...
class PPSplineF64 (line 421) | class PPSplineF64:
method __init__ (line 426) | def __init__(self, k: int, t: list[float], c: list[float] | None) -> N...
method csolve (line 427) | def csolve(
method ppev_single (line 430) | def ppev_single(self, x: Number) -> float: ...
method ppev_single_dual (line 431) | def ppev_single_dual(self, x: Number) -> Dual: ...
method ppev_single_dual2 (line 432) | def ppev_single_dual2(self, x: Number) -> Dual2: ...
method ppev (line 433) | def ppev(self, x: list[float]) -> list[float]: ...
method ppdnev_single (line 434) | def ppdnev_single(self, x: Number, m: int) -> float: ...
method ppdnev_single_dual (line 435) | def ppdnev_single_dual(self, x: Number, m: int) -> Dual: ...
method ppdnev_single_dual2 (line 436) | def ppdnev_single_dual2(self, x: Number, m: int) -> Dual2: ...
method ppdnev (line 437) | def ppdnev(self, x: list[float], m: int) -> list[float]: ...
method bsplev (line 438) | def bsplev(self, x: list[float], i: int) -> list[float]: ...
method bspldnev (line 439) | def bspldnev(self, x: list[float], i: int, m: int) -> list[float]: ...
method bsplmatrix (line 440) | def bsplmatrix(self, tau: list[float], left_n: int, right_n: int) -> A...
method __eq__ (line 441) | def __eq__(self, other: PPSplineF64) -> bool: ... # type: ignore[over...
method __copy__ (line 442) | def __copy__(self) -> PPSplineF64: ...
method to_json (line 443) | def to_json(self) -> str: ...
class PPSplineDual (line 445) | class PPSplineDual:
method __init__ (line 450) | def __init__(self, k: int, t: list[float], c: list[Dual] | None) -> No...
method csolve (line 451) | def csolve(
method ppev_single (line 454) | def ppev_single(self, x: Number) -> Dual: ...
method ppev_single_dual (line 455) | def ppev_single_dual(self, x: Number) -> Dual: ...
method ppev_single_dual2 (line 456) | def ppev_single_dual2(self, x: Number) -> Dual2: ...
method ppev (line 457) | def ppev(self, x: list[float]) -> list[Dual]: ...
method ppdnev_single (line 458) | def ppdnev_single(self, x: Number, m: int) -> Dual: ...
method ppdnev_single_dual (line 459) | def ppdnev_single_dual(self, x: Number, m: int) -> Dual: ...
method ppdnev_single_dual2 (line 460) | def ppdnev_single_dual2(self, x: Number, m: int) -> Dual2: ...
method ppdnev (line 461) | def ppdnev(self, x: list[float], m: int) -> list[Dual]: ...
method bsplev (line 462) | def bsplev(self, x: list[float], i: int) -> list[Dual]: ...
method bspldnev (line 463) | def bspldnev(self, x: list[float], i: int, m: int) -> list[Dual]: ...
method bsplmatrix (line 464) | def bsplmatrix(self, tau: list[float], left_n: int, right_n: int) -> A...
method __eq__ (line 465) | def __eq__(self, other: PPSplineDual) -> bool: ... # type: ignore[ove...
method __copy__ (line 466) | def __copy__(self) -> PPSplineDual: ...
method to_json (line 467) | def to_json(self) -> str: ...
class PPSplineDual2 (line 469) | class PPSplineDual2:
method __init__ (line 474) | def __init__(self, k: int, t: list[float], c: list[Dual2] | None) -> N...
method csolve (line 475) | def csolve(
method ppev_single (line 478) | def ppev_single(self, x: Number) -> Dual2: ...
method ppev_single_dual (line 479) | def ppev_single_dual(self, x: Number) -> Dual: ...
method ppev_single_dual2 (line 480) | def ppev_single_dual2(self, x: Number) -> Dual2: ...
method ppev (line 481) | def ppev(self, x: list[float]) -> list[Dual2]: ...
method ppdnev_single (line 482) | def ppdnev_single(self, x: Number, m: int) -> Dual2: ...
method ppdnev_single_dual (line 483) | def ppdnev_single_dual(self, x: Number, m: int) -> Dual: ...
method ppdnev_single_dual2 (line 484) | def ppdnev_single_dual2(self, x: Number, m: int) -> Dual2: ...
method ppdnev (line 485) | def ppdnev(self, x: list[float], m: int) -> list[Dual2]: ...
method bsplev (line 486) | def bsplev(self, x: list[float], i: int) -> list[Dual2]: ...
method bspldnev (line 487) | def bspldnev(self, x: list[float], i: int, m: int) -> list[Dual2]: ...
method bsplmatrix (line 488) | def bsplmatrix(self, tau: list[float], left_n: int, right_n: int) -> A...
method __eq__ (line 489) | def __eq__(self, other: PPSplineDual2) -> bool: ... # type: ignore[ov...
method __copy__ (line 490) | def __copy__(self) -> PPSplineDual2: ...
method to_json (line 491) | def to_json(self) -> str: ...
function bsplev_single (line 493) | def bsplev_single(x: float, i: int, k: int, t: list[float], org_k: int |...
function bspldnev_single (line 494) | def bspldnev_single(
function from_json (line 497) | def from_json(json: str) -> Any: ...
class FlatBackwardInterpolator (line 499) | class FlatBackwardInterpolator:
method __init__ (line 500) | def __init__(self) -> None: ...
class FlatForwardInterpolator (line 502) | class FlatForwardInterpolator:
method __init__ (line 503) | def __init__(self) -> None: ...
class LinearInterpolator (line 505) | class LinearInterpolator:
method __init__ (line 506) | def __init__(self) -> None: ...
class LogLinearInterpolator (line 508) | class LogLinearInterpolator:
method __init__ (line 509) | def __init__(self) -> None: ...
class LinearZeroRateInterpolator (line 511) | class LinearZeroRateInterpolator:
method __init__ (line 512) | def __init__(self) -> None: ...
class NullInterpolator (line 514) | class NullInterpolator:
method __init__ (line 515) | def __init__(self) -> None: ...
class Curve (line 517) | class Curve:
method __init__ (line 524) | def __init__(
method to_json (line 535) | def to_json(self) -> str: ...
method __eq__ (line 536) | def __eq__(self, other: Curve) -> bool: ... # type: ignore[override]
method __getitem__ (line 537) | def __getitem__(self, date: datetime) -> Number: ...
method set_ad_order (line 538) | def set_ad_order(self, ad: ADOrder) -> None: ...
method index_value (line 539) | def index_value(self, date: datetime) -> Number: ...
function _get_convention_str (line 541) | def _get_convention_str(convention: Convention) -> str: ...
function _get_modifier_str (line 542) | def _get_modifier_str(modifier: Modifier) -> str: ...
function index_left_f64 (line 543) | def index_left_f64(list_input: list[float], value: float, left_count: in...
function _sabr_x0 (line 544) | def _sabr_x0(
function _sabr_x1 (line 554) | def _sabr_x1(
function _sabr_x2 (line 564) | def _sabr_x2(
FILE: python/rateslib/scheduling/adjuster.py
function _get_adjuster_none (line 38) | def _get_adjuster_none(adjuster: Adjuster | int | str_) -> Adjuster | None:
function _get_adjuster (line 45) | def _get_adjuster(adjuster: int | str | Adjuster) -> Adjuster:
function _convert_to_adjuster (line 62) | def _convert_to_adjuster(modifier: str | Adjuster, settlement: bool, mod...
FILE: python/rateslib/scheduling/calendars.py
function get_calendar (line 24) | def get_calendar(
function _get_years_and_months (line 92) | def _get_years_and_months(d1: datetime, d2: datetime) -> tuple[int, int]:
function _adjust_date (line 104) | def _adjust_date(
function _is_day_type_tenor (line 133) | def _is_day_type_tenor(tenor: str) -> bool:
FILE: python/rateslib/scheduling/convention.py
function _get_convention (line 62) | def _get_convention(convention: Convention | str) -> Convention:
FILE: python/rateslib/scheduling/dcfs.py
function dcf (line 30) | def dcf(
function _dcf_numeric (line 128) | def _dcf_numeric(start: datetime, end: datetime, denominator: float, **k...
function _dcf_actacticma_nonstub (line 133) | def _dcf_actacticma_nonstub(
FILE: python/rateslib/scheduling/frequency.py
function _get_frequency (line 34) | def _get_frequency(
function _get_frequency_none (line 94) | def _get_frequency_none(
function _get_tenor_from_frequency (line 103) | def _get_tenor_from_frequency(frequency: Frequency) -> str:
function add_tenor (line 118) | def add_tenor(
function _get_fx_expiry_and_delivery_and_payment (line 262) | def _get_fx_expiry_and_delivery_and_payment(
FILE: python/rateslib/scheduling/imm.py
function next_imm (line 47) | def next_imm(start: datetime, definition: str | Imm = Imm.Wed3_HMUZ) -> ...
function get_imm (line 114) | def get_imm(
FILE: python/rateslib/scheduling/rollday.py
function _get_rollday (line 23) | def _get_rollday(roll: RollDay | str | int_) -> RollDay | None:
function _is_eom_cal (line 38) | def _is_eom_cal(date: datetime, cal: CalTypes) -> bool:
FILE: python/rateslib/scheduling/schedule.py
function _get_stub_inference (line 43) | def _get_stub_inference(
function _get_adjuster_from_modifier (line 121) | def _get_adjuster_from_modifier(modifier: Adjuster | str_, mod_days: boo...
function _should_mod_days (line 128) | def _should_mod_days(tenor: datetime | str) -> bool:
function _get_adjuster_from_lag_drb (line 137) | def _get_adjuster_from_lag_drb(lag: Adjuster | int_, default: str) -> Ad...
class Schedule (line 145) | class Schedule:
method obj (line 264) | def obj(self) -> Schedule_rs:
method __init__ (line 268) | def __init__(
method __init_from_obj__ (line 344) | def __init_from_obj__(cls, obj: Schedule_rs) -> Schedule:
method __getnewargs__ (line 351) | def __getnewargs__(
method __eq__ (line 388) | def __eq__(self, other: Any) -> bool:
method uschedule (line 395) | def uschedule(self) -> list[datetime]:
method aschedule (line 400) | def aschedule(self) -> list[datetime]:
method pschedule (line 409) | def pschedule(self) -> list[datetime]:
method pschedule2 (line 418) | def pschedule2(self) -> list[datetime]:
method pschedule3 (line 427) | def pschedule3(self) -> list[datetime]:
method frequency (line 436) | def frequency(self) -> str:
method periods_per_annum (line 441) | def periods_per_annum(self) -> float:
method frequency_obj (line 449) | def frequency_obj(self) -> Frequency:
method modifier (line 454) | def modifier(self) -> Adjuster:
method calendar (line 459) | def calendar(self) -> CalTypes:
method accrual_adjuster (line 467) | def accrual_adjuster(self) -> Adjuster:
method payment_adjuster (line 472) | def payment_adjuster(self) -> Adjuster:
method payment_adjuster2 (line 477) | def payment_adjuster2(self) -> Adjuster:
method payment_adjuster3 (line 482) | def payment_adjuster3(self) -> Adjuster | None:
method termination (line 487) | def termination(self) -> datetime:
method effective (line 492) | def effective(self) -> datetime:
method utermination (line 497) | def utermination(self) -> datetime:
method ueffective (line 502) | def ueffective(self) -> datetime:
method ufront_stub (line 507) | def ufront_stub(self) -> datetime | None:
method uback_stub (line 512) | def uback_stub(self) -> datetime | None:
method roll (line 517) | def roll(self) -> str | int | NoInput:
method table (line 532) | def table(self) -> DataFrame:
method _stubs (line 551) | def _stubs(self) -> list[bool]:
method n_periods (line 561) | def n_periods(self) -> int:
method __repr__ (line 565) | def __repr__(self) -> str:
method __str__ (line 568) | def __str__(self) -> str:
method is_regular (line 576) | def is_regular(self) -> bool:
method to_json (line 580) | def to_json(self) -> str:
function _validate_effective (line 590) | def _validate_effective(
function _validate_termination (line 628) | def _validate_termination(
FILE: python/rateslib/serialization/json.py
function _pynative_from_json (line 54) | def _pynative_from_json(name: str, json: dict[str, Any] | str) -> Any:
function from_json (line 62) | def from_json(json: str) -> Any:
FILE: python/rateslib/serialization/utils.py
function _dualtypes_to_json (line 29) | def _dualtypes_to_json(val: DualTypes) -> str:
function _enum_to_json (line 37) | def _enum_to_json(val: Enum) -> str:
function _obj_to_json (line 41) | def _obj_to_json(val: Any) -> str:
FILE: python/rateslib/solver.py
class Gradients (line 71) | class Gradients:
method J (line 113) | def J(self) -> NDArray[Nf64]:
method grad_v_rT (line 129) | def grad_v_rT(self) -> NDArray[Nf64]:
method J2 (line 136) | def J2(self) -> NDArray[Nf64]:
method grad_v_v_rT (line 160) | def grad_v_v_rT(self) -> NDArray[Nf64]:
method grad_v_g (line 167) | def grad_v_g(self) -> NDArray[Nf64]:
method grad_s_vT (line 181) | def grad_s_vT(self) -> NDArray[Nf64]:
method _grad_s_vT_final_iteration_dual (line 194) | def _grad_s_vT_final_iteration_dual(self, algorithm: str | None = None...
method _grad_s_vT_final_iteration_analytical (line 208) | def _grad_s_vT_final_iteration_analytical(self) -> NDArray[Nf64]:
method _grad_s_vT_fixed_point_iteration (line 217) | def _grad_s_vT_fixed_point_iteration(self) -> NDArray[Nf64]:
method grad_s_s_vT (line 245) | def grad_s_s_vT(self) -> NDArray[Nf64]:
method _grad_s_s_vT_fwd_difference_method (line 258) | def _grad_s_s_vT_fwd_difference_method(self) -> NDArray[Nf64]:
method _grad_s_s_vT_final_iteration_analytical (line 275) | def _grad_s_s_vT_final_iteration_analytical(self, use_pre: bool = Fals...
method grad_f_rT_pre (line 301) | def grad_f_rT_pre(self, fx_vars: Sequence[str]) -> NDArray[Nf64]:
method J2_pre (line 319) | def J2_pre(self) -> NDArray[Nf64]:
method grad_f_v_rT_pre (line 359) | def grad_f_v_rT_pre(self, fx_vars: Sequence[str]) -> NDArray[Nf64]:
method grad_f_f_rT_pre (line 381) | def grad_f_f_rT_pre(self, fx_vars: Sequence[str]) -> NDArray[Nf64]:
method grad_s_s_vT_pre (line 403) | def grad_s_s_vT_pre(self) -> NDArray[Nf64]:
method grad_v_v_rT_pre (line 420) | def grad_v_v_rT_pre(self) -> NDArray[Nf64]:
method grad_f_s_vT_pre (line 426) | def grad_f_s_vT_pre(self, fx_vars: Sequence[str]) -> NDArray[Nf64]:
method grad_f_f_vT_pre (line 446) | def grad_f_f_vT_pre(self, fx_vars: Sequence[str]) -> NDArray[Nf64]:
method grad_f_vT_pre (line 466) | def grad_f_vT_pre(self, fx_vars: Sequence[str]) -> NDArray[Nf64]:
method grad_f_f (line 485) | def grad_f_f(self, f: Dual | Dual2 | Variable, fx_vars: Sequence[str])...
method grad_s_vT_pre (line 507) | def grad_s_vT_pre(self) -> NDArray[Nf64]:
method grad_s_f_pre (line 546) | def grad_s_f_pre(self, f: Dual | Dual2 | Variable) -> NDArray[Nf64]:
method grad_s_sT_f_pre (line 565) | def grad_s_sT_f_pre(self, f: Dual | Dual2 | Variable) -> NDArray[Nf64]:
method grad_f_sT_f_pre (line 588) | def grad_f_sT_f_pre(self, f: Dual | Dual2 | Variable, fx_vars: Sequenc...
method grad_f_fT_f_pre (line 622) | def grad_f_fT_f_pre(self, f: Dual | Dual2 | Variable, fx_vars: Sequenc...
method grad_s_Ploc (line 662) | def grad_s_Ploc(self, npv: Dual | Dual2 | Variable) -> NDArray[Nf64]:
method grad_f_Ploc (line 678) | def grad_f_Ploc(self, npv: Dual | Dual2 | Variable, fx_vars: Sequence[...
method grad_s_Pbase (line 698) | def grad_s_Pbase(
method grad_f_Pbase (line 723) | def grad_f_Pbase(
method grad_s_sT_Ploc (line 753) | def grad_s_sT_Ploc(self, npv: Dual2 | Variable) -> NDArray[Nf64]:
method gradp_f_vT_Ploc (line 783) | def gradp_f_vT_Ploc(
method grad_f_sT_Ploc (line 804) | def grad_f_sT_Ploc(self, npv: Dual | Dual2 | Variable, fx_vars: Sequen...
method grad_f_fT_Ploc (line 831) | def grad_f_fT_Ploc(self, npv: Dual | Dual2 | Variable, fx_vars: Sequen...
method grad_s_sT_Pbase (line 863) | def grad_s_sT_Pbase(
method grad_f_sT_Pbase (line 897) | def grad_f_sT_Pbase(
method grad_f_fT_Pbase (line 937) | def grad_f_fT_Pbase(
class Solver (line 987) | class Solver(Gradients, _WithState):
method __init__ (line 1140) | def __init__(
method __repr__ (line 1281) | def __repr__(self) -> str:
method _set_new_state (line 1286) | def _set_new_state(self) -> None:
method _do_not_validate (line 1291) | def _do_not_validate(self) -> bool:
method _do_not_validate (line 1295) | def _do_not_validate(self, value: bool) -> None:
method _validate_state (line 1300) | def _validate_state(self) -> None:
method _validate_and_get_state (line 1331) | def _validate_and_get_state(obj: Any) -> int:
method _associated_states (line 1335) | def _associated_states(self) -> dict[str, int]:
method _get_composited_state (line 1345) | def _get_composited_state(self) -> int:
method _parse_instrument (line 1349) | def _parse_instrument(
method _reset_properties_ (line 1401) | def _reset_properties_(self, dual2_only: bool = False) -> None:
method _get_pre_curve (line 1454) | def _get_pre_curve(self, obj: str) -> Curve:
method _get_pre_fxvol (line 1465) | def _get_pre_fxvol(self, obj: str) -> FXVols:
method _get_pre_irvol (line 1476) | def _get_pre_irvol(self, obj: str) -> _BaseIRSmile | _BaseIRCube[Any]:
method _get_fx (line 1487) | def _get_fx(self) -> FXForwards_:
method result (line 1493) | def result(self) -> dict[str, Any]:
method v (line 1508) | def v(self) -> NDArray[Nobject]:
method r (line 1519) | def r(self) -> NDArray[Nobject]: # type: ignore[override]
method r_pre (line 1532) | def r_pre(self) -> NDArray[Nobject]: # type: ignore[override]
method x (line 1554) | def x(self) -> NDArray[Nobject]:
method error (line 1569) | def error(self) -> Series[float]:
method g (line 1600) | def g(self) -> Dual | Dual2: # type: ignore[override]
method _update_step_ (line 1621) | def _update_step_(self, algorithm: str) -> NDArray[Nobject]:
method _update_fx (line 1668) | def _update_fx(self) -> None:
method iterate (line 1675) | def iterate(self) -> None:
method _solver_result (line 1733) | def _solver_result(self, state: int, i: int, time: float) -> None:
method _update_curves_with_parameters (line 1738) | def _update_curves_with_parameters(self, v_new: NDArray[Nobject]) -> N...
method _set_ad_order (line 1751) | def _set_ad_order(self, order: int) -> None:
method delta (line 1764) | def delta(
method _get_base_and_fx (line 1890) | def _get_base_and_fx(self, base: str_, fx: FX_) -> tuple[str_, FX_]:
method gamma (line 1926) | def gamma(
method _pnl_explain (line 2169) | def _pnl_explain(
method market_movements (line 2210) | def market_movements(self, solver: Solver) -> DataFrame:
method jacobian (line 2249) | def jacobian(self, solver: Solver) -> DataFrame:
method exo_delta (line 2347) | def exo_delta(
method from_other (line 2434) | def from_other(
FILE: python/rateslib/splines/evaluate.py
function evaluate (line 24) | def evaluate(
FILE: python/rateslib/utils/calendars.py
function _get_first_bus_day (line 23) | def _get_first_bus_day(dates: list[datetime], calendar: CalTypes) -> dat...
FILE: python/rateslib/verify.py
class LicenceNotice (line 34) | class LicenceNotice(UserWarning):
class _LicenceStatus (line 70) | class _LicenceStatus(Enum):
class Licence (line 78) | class Licence:
method __init__ (line 83) | def __init__(self) -> None:
method _output (line 117) | def _output(self, text: str, *args: Any) -> None:
method status (line 123) | def status(self) -> _LicenceStatus:
method expiry (line 127) | def expiry(self) -> datetime:
method add_licence (line 131) | def add_licence(cls, licence_text: str) -> None:
method remove_licence (line 177) | def remove_licence(cls) -> bool:
method print_licence (line 203) | def print_licence(cls) -> str:
function _rsa_encrypt (line 229) | def _rsa_encrypt(message_int: int, public_key: tuple[int, int]) -> int:
function _get_licence_path (line 236) | def _get_licence_path() -> Path:
function _get_licence (line 253) | def _get_licence() -> str | None:
function _verify_licence (line 263) | def _verify_licence(licence_plaintext: str) -> str | None:
FILE: python/rateslib/volatility/fx/base.py
class _BaseFXSmile (line 29) | class _BaseFXSmile(_WithState, _WithCache[float, DualTypes]):
method ad (line 37) | def ad(self) -> int:
method __iter__ (line 41) | def __iter__(self) -> NoReturn:
method plot (line 44) | def plot(
FILE: python/rateslib/volatility/fx/delta_vol.py
class FXDeltaVolSmile (line 75) | class FXDeltaVolSmile(_BaseFXSmile):
method __init__ (line 128) | def __init__(
method id (line 160) | def id(self) -> str:
method meta (line 166) | def meta(self) -> _FXSmileMeta: # type: ignore[override]
method nodes (line 171) | def nodes(self) -> _FXDeltaVolSmileNodes:
method _n (line 176) | def _n(self) -> int:
method __getitem__ (line 180) | def __getitem__(self, item: DualTypes) -> DualTypes:
method _get_index (line 199) | def _get_index(
method get (line 208) | def get(
method get_from_strike (line 266) | def get_from_strike(
method _get_node_vector (line 364) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 368) | def _get_node_vars(self) -> tuple[str, ...]:
method _plot (line 374) | def _plot(
method _set_node_vector (line 414) | def _set_node_vector(
method _set_ad_order (line 441) | def _set_ad_order(self, order: int) -> None:
method _update_nodes_and_csolve (line 455) | def _update_nodes_and_csolve(self, nodes: dict[float, DualTypes]) -> N...
method update (line 461) | def update(
method update_node (line 504) | def update_node(self, key: float, value: DualTypes) -> None:
class FXDeltaVolSurface (line 544) | class FXDeltaVolSurface(_WithState, _WithCache[datetime, FXDeltaVolSmile]):
method __init__ (line 626) | def __init__(
method _n (line 666) | def _n(self) -> int:
method id (line 671) | def id(self) -> str:
method meta (line 677) | def meta(self) -> _FXDeltaVolSurfaceMeta:
method ad (line 682) | def ad(self) -> int:
method smiles (line 687) | def smiles(self) -> list[FXDeltaVolSmile]:
method _get_composited_state (line 691) | def _get_composited_state(self) -> int:
method _validate_state (line 694) | def _validate_state(self) -> None:
method _set_ad_order (line 701) | def _set_ad_order(self, order: int) -> None:
method _set_node_vector (line 708) | def _set_node_vector(
method _get_node_vector (line 716) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 720) | def _get_node_vars(self) -> tuple[str, ...]:
method get_smile (line 728) | def get_smile(self, expiry: datetime) -> FXDeltaVolSmile:
method get_from_strike (line 842) | def get_from_strike(
method _get_index (line 888) | def _get_index(self, delta_index: DualTypes, expiry: datetime) -> Dual...
method plot (line 895) | def plot(self) -> PlotOutput:
function _moneyness_from_atm_delta_one_dimensional (line 905) | def _moneyness_from_atm_delta_one_dimensional(
function _moneyness_from_delta_one_dimensional (line 979) | def _moneyness_from_delta_one_dimensional(
function _moneyness_from_atm_delta_two_dimensional (line 1063) | def _moneyness_from_atm_delta_two_dimensional(
function _moneyness_from_delta_two_dimensional (line 1138) | def _moneyness_from_delta_two_dimensional(
function _moneyness_from_delta_three_dimensional (line 1224) | def _moneyness_from_delta_three_dimensional(
FILE: python/rateslib/volatility/fx/sabr.py
class FXSabrSmile (line 74) | class FXSabrSmile(_BaseFXSmile):
method __init__ (line 140) | def __init__(
method _n (line 183) | def _n(self) -> int:
method id (line 188) | def id(self) -> str:
method meta (line 194) | def meta(self) -> _FXSmileMeta: # type: ignore[override]
method nodes (line 199) | def nodes(self) -> _SabrSmileNodes:
method get_from_strike (line 203) | def get_from_strike(
method _d_sabr_d_k_or_f (line 273) | def _d_sabr_d_k_or_f(
method _get_node_vector (line 312) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 316) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_node_vector (line 322) | def _set_node_vector(
method _set_ad_order (line 362) | def _set_ad_order(self, order: int) -> None:
method update_node (line 382) | def update_node(self, key: str, value: DualTypes) -> None:
method _plot (line 419) | def _plot(
class FXSabrSurface (line 468) | class FXSabrSurface(_WithState, _WithCache[datetime, FXSabrSmile]):
method __init__ (line 545) | def __init__(
method _n (line 588) | def _n(self) -> int:
method id (line 593) | def id(self) -> str:
method meta (line 599) | def meta(self) -> _FXSabrSurfaceMeta:
method ad (line 604) | def ad(self) -> int:
method smiles (line 609) | def smiles(self) -> list[FXSabrSmile]:
method _get_composited_state (line 613) | def _get_composited_state(self) -> int:
method _validate_state (line 616) | def _validate_state(self) -> None:
method _set_ad_order (line 623) | def _set_ad_order(self, order: int) -> None:
method _set_node_vector (line 630) | def _set_node_vector(
method _get_node_vector (line 638) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 642) | def _get_node_vars(self) -> tuple[str, ...]:
method get_from_strike (line 650) | def get_from_strike(
method _d_sabr_d_k_or_f (line 692) | def _d_sabr_d_k_or_f(
FILE: python/rateslib/volatility/fx/utils.py
class _FXSmileMeta (line 49) | class _FXSmileMeta:
method eval_date (line 63) | def eval_date(self) -> datetime:
method expiry (line 68) | def expiry(self) -> datetime:
method plot_x_axis (line 73) | def plot_x_axis(self) -> str:
method delta_type (line 79) | def delta_type(self) -> FXDeltaMethod:
method calendar (line 84) | def calendar(self) -> CalTypes:
method pair (line 89) | def pair(self) -> str | None:
method t_expiry (line 94) | def t_expiry(self) -> float:
method t_expiry_sqrt (line 99) | def t_expiry_sqrt(self) -> float:
method delivery (line 105) | def delivery(self) -> datetime:
method delivery_lag (line 110) | def delivery_lag(self) -> int:
class _FXDeltaVolSmileNodes (line 115) | class _FXDeltaVolSmileNodes:
method __init__ (line 125) | def __init__(self, nodes: dict[float, DualTypes], meta: _FXSmileMeta) ...
method __eq__ (line 148) | def __eq__(self, other: Any) -> bool:
method plot_upper_bound (line 154) | def plot_upper_bound(self) -> float:
method meta (line 169) | def meta(self) -> _FXSmileMeta:
method nodes (line 174) | def nodes(self) -> dict[float, DualTypes]:
method keys (line 179) | def keys(self) -> list[float]:
method values (line 184) | def values(self) -> list[DualTypes]:
method n (line 189) | def n(self) -> int:
method spline (line 194) | def spline(self) -> _FXDeltaVolSpline:
class _FXDeltaVolSpline (line 199) | class _FXDeltaVolSpline:
method __init__ (line 208) | def __init__(self, t: list[float]) -> None:
method t (line 213) | def t(self) -> list[float]:
method spline (line 218) | def spline(self) -> PPSplineF64 | PPSplineDual | PPSplineDual2:
method _csolve_n_other (line 223) | def _csolve_n_other(
method csolve (line 253) | def csolve(self, nodes: _FXDeltaVolSmileNodes, ad: int) -> None:
method to_json (line 284) | def to_json(self) -> str:
method _from_json (line 304) | def _from_json(cls, loaded_json: dict[str, Any]) -> _FXDeltaVolSpline:
method __eq__ (line 309) | def __eq__(self, other: Any) -> bool:
class _FXDeltaVolSurfaceMeta (line 320) | class _FXDeltaVolSurfaceMeta:
method __post_init__ (line 333) | def __post_init__(self) -> None:
method delta_indexes (line 339) | def delta_indexes(self) -> list[float]:
method expiries (line 345) | def expiries(self) -> list[datetime]:
method expiries_posix (line 351) | def expiries_posix(self) -> list[float]:
method weights (line 356) | def weights(self) -> Series[float] | None:
method weights_cum (line 361) | def weights_cum(self) -> Series[float] | None:
method eval_date (line 370) | def eval_date(self) -> datetime:
method eval_posix (line 375) | def eval_posix(self) -> float:
method delta_type (line 380) | def delta_type(self) -> FXDeltaMethod:
method plot_x_axis (line 386) | def plot_x_axis(self) -> str:
class _FXSabrSurfaceMeta (line 393) | class _FXSabrSurfaceMeta:
method __post_init__ (line 406) | def __post_init__(self) -> None:
method weights (line 412) | def weights(self) -> Series[float] | None:
method weights_cum (line 417) | def weights_cum(self) -> Series[float] | None:
method expiries (line 426) | def expiries(self) -> list[datetime]:
method expiries_posix (line 432) | def expiries_posix(self) -> list[float]:
method eval_posix (line 437) | def eval_posix(self) -> float:
method delivery_lag (line 442) | def delivery_lag(self) -> int:
method eval_date (line 447) | def eval_date(self) -> datetime:
method pair (line 452) | def pair(self) -> str | None:
method calendar (line 457) | def calendar(self) -> CalTypes:
function _delta_type_constants (line 462) | def _delta_type_constants(
function _moneyness_from_atm_delta_closed_form (line 481) | def _moneyness_from_atm_delta_closed_form(vol: DualTypes, t_e: DualTypes...
function _moneyness_from_delta_closed_form (line 503) | def _moneyness_from_delta_closed_form(
FILE: python/rateslib/volatility/ir/base.py
class _WithMutability (line 56) | class _WithMutability(ABC):
method _n (line 64) | def _n(self) -> int:
method _ini_solve (line 70) | def _ini_solve(self) -> int:
method _get_node_vector (line 76) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 81) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_node_vector_direct (line 90) | def _set_node_vector_direct(
method _set_ad_order_direct (line 101) | def _set_ad_order_direct(self, order: int | None) -> None:
method _set_single_node (line 113) | def _set_single_node(self, key: Any, value: DualTypes) -> None:
method _set_node_vector (line 121) | def _set_node_vector(
method _set_ad_order (line 131) | def _set_ad_order(self, order: int | None) -> None:
method update_node (line 152) | def update_node(self, key: str, value: DualTypes) -> None:
class _BaseIRSmile (line 182) | class _BaseIRSmile(_WithState, _WithCache[float, DualTypes], ABC):
method id (line 212) | def id(self) -> str:
method ad (line 220) | def ad(self) -> int:
method meta (line 227) | def meta(self) -> _IRSmileMeta:
method pricing_params (line 233) | def pricing_params(self) -> Iterable[float | Dual | Dual2 | Variable]:
method _get_from_strike (line 239) | def _get_from_strike(
method _plot (line 263) | def _plot(
method _d_sigma_d_f (line 274) | def _d_sigma_d_f(
method _plot_conversion (line 284) | def _plot_conversion(
method plot (line 332) | def plot(
method get_from_strike (line 425) | def get_from_strike(
method __iter__ (line 481) | def __iter__(self) -> NoReturn:
class _BaseIRCube (line 485) | class _BaseIRCube(Generic[T], _WithState, _WithCache[tuple[datetime, dat...
method id (line 515) | def id(self) -> str:
method ad (line 523) | def ad(self) -> int:
method meta (line 530) | def meta(self) -> _IRCubeMeta:
method pricing_params (line 536) | def pricing_params(self) -> Arr3dObj:
method _bilinear_interpolation (line 540) | def _bilinear_interpolation(
method _construct_smile (line 671) | def _construct_smile(
method get_from_strike (line 697) | def get_from_strike(
method get_smile (line 733) | def get_smile(self, expiry: datetime | str, tenor: datetime | str) -> ...
method _get_node_vector (line 768) | def _get_node_vector(self) -> Arr1dObj:
method _get_node_vars (line 772) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_single_node (line 780) | def _set_single_node(
method _set_single_node_direct (line 826) | def _set_single_node_direct(self, key: tuple[datetime, datetime, T], v...
FILE: python/rateslib/volatility/ir/sabr.py
class IRSabrSmile (line 54) | class IRSabrSmile(_BaseIRSmile, _WithMutability):
method __init__ (line 163) | def __init__(
method _n (line 212) | def _n(self) -> int:
method _ini_solve (line 216) | def _ini_solve(self) -> int:
method id (line 220) | def id(self) -> str:
method nodes (line 226) | def nodes(self) -> _SabrSmileNodes:
method _d_sabr_d_k_or_f (line 230) | def _d_sabr_d_k_or_f(
method _get_node_vector (line 270) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 274) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_node_vector_direct (line 278) | def _set_node_vector_direct(
method _set_ad_order_direct (line 317) | def _set_ad_order_direct(self, order: int | None) -> None:
method _set_single_node (line 337) | def _set_single_node(self, key: str, value: DualTypes) -> None:
method _plot (line 348) | def _plot(
method ad (line 373) | def ad(self) -> int:
method pricing_params (line 379) | def pricing_params(self) -> tuple[float | Dual | Dual2 | Variable, ...]:
method meta (line 385) | def meta(self) -> _IRSmileMeta:
method _get_from_strike (line 389) | def _get_from_strike(self, k: DualTypes, f: DualTypes) -> _IRVolPricin...
method _d_sigma_d_f (line 430) | def _d_sigma_d_f(
class IRSabrCube (line 450) | class IRSabrCube(_BaseIRCube[str], _WithMutability):
method __init__ (line 550) | def __init__(
method beta (line 593) | def beta(self) -> DualTypes:
method alpha (line 599) | def alpha(self) -> DataFrame:
method alpha_float (line 609) | def alpha_float(self) -> DataFrame:
method rho (line 615) | def rho(self) -> DataFrame:
method rho_float (line 625) | def rho_float(self) -> DataFrame:
method nu (line 631) | def nu(self) -> DataFrame:
method nu_float (line 641) | def nu_float(self) -> DataFrame:
method _n (line 647) | def _n(self) -> int:
method id (line 654) | def id(self) -> str:
method meta (line 660) | def meta(self) -> _IRCubeMeta:
method pricing_params (line 665) | def pricing_params(self) -> Arr3dObj:
method ad (line 670) | def ad(self) -> int:
method _set_ad_order_direct (line 674) | def _set_ad_order_direct(self, order: int | None) -> None:
method _set_node_vector_direct (line 692) | def _set_node_vector_direct(
method _get_node_vector (line 729) | def _get_node_vector(self) -> Arr1dObj:
method _get_node_vars (line 739) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_single_node_direct (line 750) | def _set_single_node_direct(
FILE: python/rateslib/volatility/ir/spline.py
class _IRSplineSmileNodes (line 59) | class _IRSplineSmileNodes:
method __init__ (line 68) | def __init__(self, nodes: dict[float, DualTypes], k: int) -> None:
method __eq__ (line 86) | def __eq__(self, other: Any) -> bool:
method nodes (line 92) | def nodes(self) -> dict[float, DualTypes]:
method keys (line 97) | def keys(self) -> list[float]:
method values (line 102) | def values(self) -> list[DualTypes]:
method n (line 107) | def n(self) -> int:
method k (line 112) | def k(self) -> int:
method spline (line 117) | def spline(self) -> _IRVolSpline:
class _IRVolSpline (line 122) | class _IRVolSpline:
method __init__ (line 132) | def __init__(self, t: list[float], k: int) -> None:
method t (line 138) | def t(self) -> list[float]:
method k (line 143) | def k(self) -> int:
method spline (line 148) | def spline(self) -> PPSplineF64 | PPSplineDual | PPSplineDual2:
method evaluate (line 153) | def evaluate(self, x: DualTypes, m: int = 0) -> Number:
method _csolve_n_other (line 157) | def _csolve_n_other(
method csolve (line 187) | def csolve(self, nodes: _IRSplineSmileNodes, ad: int) -> None:
method __eq__ (line 244) | def __eq__(self, other: Any) -> bool:
class IRSplineSmile (line 254) | class IRSplineSmile(_BaseIRSmile, _WithMutability):
method __init__ (line 377) | def __init__(
method _n (line 420) | def _n(self) -> int:
method _ini_solve (line 424) | def _ini_solve(self) -> int:
method id (line 428) | def id(self) -> str:
method nodes (line 434) | def nodes(self) -> _IRSplineSmileNodes:
method _get_node_vector (line 440) | def _get_node_vector(self) -> np.ndarray[tuple[int, ...], np.dtype[np....
method _get_node_vars (line 444) | def _get_node_vars(self) -> tuple[str, ...]:
method _set_node_vector_direct (line 448) | def _set_node_vector_direct(
method _set_ad_order_direct (line 474) | def _set_ad_order_direct(self, order: int | None) -> None:
method _set_single_node (line 491) | def _set_single_node(self, key: float, value: DualTypes) -> None:
method _plot (line 499) | def _plot(
method ad (line 531) | def ad(self) -> int:
method pricing_params (line 537) | def pricing_params(self) -> Sequence[float | Dual | Dual2 | Variable]:
method meta (line 543) | def meta(self) -> _IRSmileMeta:
method _get_from_strike (line 547) | def _get_from_strike(self, k: DualTypes, f: DualTypes) -> _IRVolPricin...
method _d_sigma_d_f (line 579) | def _d_sigma_d_f(
class IRSplineCube (line 590) | class IRSplineCube(_BaseIRCube[float | Variable], _WithMutability):
method __init__ (line 703) | def __init__(
method _n (line 754) | def _n(self) -> int:
method id (line 762) | def id(self) -> str:
method meta (line 768) | def meta(self) -> _IRCubeMeta:
method pricing_params (line 773) | def pricing_params(self) -> Arr3dObj:
method ad (line 778) | def ad(self) -> int:
method _set_ad_order_direct (line 782) | def _set_ad_order_direct(self, order: int | None) -> None:
method _set_node_vector_direct (line 798) | def _set_node_vector_direct(
method _set_single_node_direct (line 826) | def _set_single_node_direct(
FILE: python/rateslib/volatility/ir/utils.py
class _IRVolPricingParams (line 41) | class _IRVolPricingParams(NamedTuple):
method rate_shift (line 63) | def rate_shift(self) -> DualTypes:
class _IRSmileMeta (line 69) | class _IRSmileMeta:
method __init__ (line 75) | def __init__(
method time_scalar (line 105) | def time_scalar(self) -> DualTypes:
method pricing_model (line 110) | def pricing_model(self) -> OptionPricingModel:
method eval_date (line 115) | def eval_date(self) -> datetime:
method shift (line 120) | def shift(self) -> DualTypes:
method rate_shift (line 127) | def rate_shift(self) -> DualTypes:
method plot_x_axis (line 134) | def plot_x_axis(self) -> str:
method plot_y_axis (line 140) | def plot_y_axis(self) -> str:
method irs_series (line 146) | def irs_series(self) -> IRSSeries:
method expiry_input (line 151) | def expiry_input(self) -> datetime | str:
method expiry (line 156) | def expiry(self) -> datetime:
method tenor_input (line 169) | def tenor_input(self) -> datetime | str:
method irs_fixing (line 174) | def irs_fixing(self) -> IRSFixing:
method t_expiry (line 180) | def t_expiry(self) -> DualTypes:
method _t_expiry (line 184) | def _t_expiry(self, expiry: datetime) -> DualTypes:
method t_expiry_sqrt (line 189) | def t_expiry_sqrt(self) -> DualTypes:
class _IRCubeMeta (line 196) | class _IRCubeMeta:
method __post_init__ (line 212) | def __post_init__(self) -> None:
method shift (line 228) | def shift(self) -> DualTypes:
method _n_expiries (line 235) | def _n_expiries(self) -> int:
method _n_tenors (line 240) | def _n_tenors(self) -> int:
method irs_series (line 245) | def irs_series(self) -> IRSSeries:
method smile_params (line 253) | def smile_params(self) -> dict[str, Any]:
method weights (line 261) | def weights(self) -> Series[float] | NoInput:
method time_scalars (line 266) | def time_scalars(self) -> Series[float] | NoInput:
method tenors (line 277) | def tenors(self) -> list[str]:
method indexes (line 282) | def indexes(self) -> list[Any]:
method tenor_dates (line 287) | def tenor_dates(self) -> Arr2dObj:
method tenor_dates_posix (line 302) | def tenor_dates_posix(self) -> Arr2dObj:
method _t_expiry (line 309) | def _t_expiry(self, expiry: datetime) -> float:
method expiries (line 319) | def expiries(self) -> list[datetime | str]:
method expiry_dates (line 324) | def expiry_dates(self) -> list[datetime]:
method expiries_posix (line 342) | def expiries_posix(self) -> list[float]:
method eval_posix (line 347) | def eval_posix(self) -> float:
method eval_date (line 352) | def eval_date(self) -> datetime:
method pricing_model (line 357) | def pricing_model(self) -> OptionPricingModel:
function _get_ir_expiry_and_payment (line 362) | def _get_ir_expiry_and_payment(
function _get_ir_expiry (line 423) | def _get_ir_expiry(
function _get_ir_tenor (line 462) | def _get_ir_tenor(
function _bilinear_interp (line 502) | def _bilinear_interp(
function _scale_weights (line 524) | def _scale_weights(
FILE: python/rateslib/volatility/utils.py
class _SabrSmileNodes (line 52) | class _SabrSmileNodes:
method alpha (line 64) | def alpha(self) -> Number:
method beta (line 69) | def beta(self) -> float | Variable:
method rho (line 74) | def rho(self) -> Number:
method nu (line 79) | def nu(self) -> Number:
method n (line 84) | def n(self) -> int:
function _validate_weights (line 89) | def _validate_weights(
function _t_var_interp (line 116) | def _t_var_interp(
function _t_var_interp_d_sabr_d_k_or_f (line 184) | def _t_var_interp_d_sabr_d_k_or_f(
class _OptionModelBlack76 (line 242) | class _OptionModelBlack76:
method _d_plus_min (line 246) | def _d_plus_min(
method _d_plus_min_u (line 253) | def _d_plus_min_u(shifted_u: DualTypes, vol_sqrt_t: DualTypes, eta: fl...
method _d_min (line 258) | def _d_min(
method _d_plus (line 264) | def _d_plus(
method _value (line 270) | def _value(
method convert_to_bachelier (line 318) | def convert_to_bachelier(
method convert_to_new_shift (line 362) | def convert_to_new_shift(
class _OptionModelBachelier (line 420) | class _OptionModelBachelier:
method _value (line 424) | def _value(
method convert_to_black76 (line 465) | def convert_to_black76(
class _SabrModel (line 501) | class _SabrModel:
method _d_sabr_d_k_or_f (line 505) | def _d_sabr_d_k_or_f(
method _sabr_X0 (line 541) | def _sabr_X0(
method _sabr_X1 (line 560) | def _sabr_X1(
method _sabr_X2 (line 578) | def _sabr_X2(
function _surface_index_left (line 600) | def _surface_index_left(expiries_posix: list[float], expiry_posix: float...
FILE: python/tests/curves/test_curves.py
function curve (line 43) | def curve():
function line_curve (line 57) | def line_curve():
function index_curve (line 70) | def index_curve():
function test_meta_attribute (line 83) | def test_meta_attribute(curve, line_curve):
function test_flat_interp (line 89) | def test_flat_interp(method) -> None:
function test_linear_interp (line 105) | def test_linear_interp(curve_style, expected, curve, line_curve) -> None:
function test_log_linear_interp (line 115) | def test_log_linear_interp() -> None:
function test_linear_zero_rate_interp (line 133) | def test_linear_zero_rate_interp() -> None:
function test_line_curve_rate (line 138) | def test_line_curve_rate(line_curve) -> None:
function test_curve_rate_floating_spread (line 153) | def test_curve_rate_floating_spread(scm, exp) -> None:
function test_curve_rate_raises (line 159) | def test_curve_rate_raises(curve) -> None:
function test_index_left (line 180) | def test_index_left(li, ll, val, expected) -> None:
function test_zero_rate_plot (line 185) | def test_zero_rate_plot() -> None:
function test_curve_equality_type_differ (line 200) | def test_curve_equality_type_differ(curve, line_curve) -> None:
function test_copy_curve (line 204) | def test_copy_curve(curve, line_curve) -> None:
function test_curve_equality_checks (line 224) | def test_curve_equality_checks(attr, val, curve) -> None:
function test_curve_equality_spline_coeffs (line 231) | def test_curve_equality_spline_coeffs() -> None:
function test_curve_interp_raises (line 285) | def test_curve_interp_raises() -> None:
function test_curve_sorted_nodes_raises (line 300) | def test_curve_sorted_nodes_raises() -> None:
function test_curve_interp_case (line 312) | def test_curve_interp_case() -> None:
function test_custom_interpolator (line 336) | def test_custom_interpolator() -> None:
function test_df_is_zero_in_past (line 354) | def test_df_is_zero_in_past(curve) -> None:
function test_curve_none_return (line 358) | def test_curve_none_return(curve) -> None:
function test_spline_endpoints (line 372) | def test_spline_endpoints(endpoints, expected) -> None:
function test_spline_endpoints_raise (line 402) | def test_spline_endpoints_raise(endpoints) -> None:
function test_not_a_knot_raises (line 429) | def test_not_a_knot_raises() -> None:
function test_set_ad_order_no_spline (line 452) | def test_set_ad_order_no_spline() -> None:
function test_set_ad_order_raises (line 478) | def test_set_ad_order_raises(curve) -> None:
function test_index_left_raises (line 483) | def test_index_left_raises() -> None:
function test_curve_shift_ad_order (line 516) | def test_curve_shift_ad_order(ad_order) -> None:
function test_curve_shift_association (line 554) | def test_curve_shift_association() -> None:
function test_curve_shift_dual_input (line 578) | def test_curve_shift_dual_input() -> None:
function test_composite_curve_shift (line 611) | def test_composite_curve_shift() -> None:
function test_linecurve_shift (line 622) | def test_linecurve_shift(ad_order) -> None:
function test_linecurve_shift_dual_input (line 656) | def test_linecurve_shift_dual_input() -> None:
function test_indexcurve_shift (line 691) | def test_indexcurve_shift(ad_order) -> None:
function test_indexcurve_shift_dual_input (line 728) | def test_indexcurve_shift_dual_input() -> None:
function test_curve_shift_ad_orders (line 770) | def test_curve_shift_ad_orders(curve, line_curve, index_curve, c_obj, in...
function test_curve_translate (line 924) | def test_curve_translate(crv, tol) -> None:
function test_curve_roll (line 999) | def test_curve_roll(crv, dates) -> None:
function test_curve_roll_copy (line 1029) | def test_curve_roll_copy(curve) -> None:
function test_curve_spline_warning (line 1034) | def test_curve_spline_warning() -> None:
function test_index_curve_roll (line 1061) | def test_index_curve_roll() -> None:
function test_index_value_series (line 1120) | def test_index_value_series(s) -> None:
function test_curve_translate_raises (line 1138) | def test_curve_translate_raises(curve) -> None:
function test_curve_zero_width_rate_raises (line 1143) | def test_curve_zero_width_rate_raises(curve) -> None:
function test_set_node_vector_updates_ad_attribute (line 1148) | def test_set_node_vector_updates_ad_attribute(curve) -> None:
function test_average_rate (line 1162) | def test_average_rate(convention, expected):
function test_spline_interpolation_feature (line 1174) | def test_spline_interpolation_feature(curve):
function test_conventions_and_calendar_unnecessary (line 1189) | def test_conventions_and_calendar_unnecessary():
class TestCurve (line 1207) | class TestCurve:
method test_repr (line 1208) | def test_repr(self):
method test_cache_clear_and_defaults (line 1221) | def test_cache_clear_and_defaults(self):
method test_typing_as_base_curve (line 1239) | def test_typing_as_base_curve(self):
method test_curve_translate_knots_raises (line 1252) | def test_curve_translate_knots_raises(self) -> None:
method test_calendar_passed_to_rate_dcf (line 1280) | def test_calendar_passed_to_rate_dcf(self):
method test_linear_bus_interpolation (line 1330) | def test_linear_bus_interpolation(self, interpolation) -> None:
method test_update_meta (line 1351) | def test_update_meta(self, curve):
method test_no_termination (line 1355) | def test_no_termination(self, curve):
method test_index_value_lag_mismatch (line 1359) | def test_index_value_lag_mismatch(self, index_curve):
method test_update_node_raises (line 1367) | def test_update_
Condensed preview — 379 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (7,677K chars).
[
{
"path": ".ai-opt-out",
"chars": 7,
"preview": "opt-out"
},
{
"path": ".aiignore",
"chars": 134,
"preview": "# Block all files from AI training\n*\n\n# Specifically block metadata and documentation\n**/*.md\nissues/**\ndiscussions/**\nC"
},
{
"path": ".gitattributes",
"chars": 45,
"preview": "* ai-training=false\n* linguist-generated=true"
},
{
"path": ".github/workflows/ubuntu-latest-python-specific.yml",
"chars": 1024,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".github/workflows/ubuntu-latest-rust-specific.yml",
"chars": 787,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".github/workflows/ubuntu-latest.yml",
"chars": 1167,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".github/workflows/ubuntu-minimum.yml",
"chars": 1087,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".github/workflows/windows-latest.yml",
"chars": 988,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".github/workflows/windows-minimum.yml",
"chars": 1169,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".gitignore",
"chars": 2069,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Rust extensions\nsrc/bi"
},
{
"path": "COMMERCIAL_LICENCE",
"chars": 6869,
"preview": "Commercial Subscription Licence Agreement\n=========================================\n\nThis Commercial Subscription Licenc"
},
{
"path": "COMMERCIAL_LICENCE_ADDENDUM1",
"chars": 2945,
"preview": "Continuity of Licence Addendum\n==============================\n(Commercial Subscription Licence)\n\nThis Continuity of Lice"
},
{
"path": "Cargo.toml",
"chars": 1578,
"preview": "[package]\nname = \"rateslib\"\nversion = \"2.7.1\"\nedition = \"2021\"\nexclude = [\n \".github/*\",\n \"benches/*\",\n \"benchm"
},
{
"path": "LICENCE",
"chars": 5535,
"preview": "LICENCE\n=======\nDual Licensing – Source-Available Non-Commercial Licence\nand Commercial Subscription Licence\n\nCopyright "
},
{
"path": "README.md",
"chars": 2357,
"preview": "<div style=\"text-align: center; padding: 2em 0 2em\">\n <img src=\"https://rateslib.readthedocs.io/en/latest/_static/rat"
},
{
"path": "docs/source/z_ir_vol_time_to_expiry.rst",
"chars": 9373,
"preview": ".. _cook-ir-vol-time-doc:\n\n.. ipython:: python\n :suppress:\n\n from rateslib.curves import *\n from rateslib.instrume"
},
{
"path": "notebooks/coding/ch5_fx.ipynb",
"chars": 16106,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"metadata\": {\n \"tags\": []\n },\n \"outputs\": ["
},
{
"path": "notebooks/coding/curves.ipynb",
"chars": 10546,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"f8825706-c252-40d7-8075-b438f5756093\",\n \"metadata\": {},\n \"so"
},
{
"path": "notebooks/coding/scheduling.ipynb",
"chars": 10861,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"88003b38-8369-4263-b409-fe548b1250cb\",\n \""
},
{
"path": "notebooks/coding_2/AutomaticDifferentiation.ipynb",
"chars": 10743,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"207f47dd-6e8d-4a49-8d4c-c775b157f8cb\",\n "
},
{
"path": "notebooks/coding_2/Calendars.ipynb",
"chars": 5275,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"2362d250-6e1f-43d3-a853-4e53db61ef19\",\n "
},
{
"path": "notebooks/coding_2/Cookbook.ipynb",
"chars": 12341,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"a731e2a1-7df1-4627-87a4-eece8b11f3ec\",\n \"metadata\": {},\n \"so"
},
{
"path": "notebooks/coding_2/CurveSolving.ipynb",
"chars": 661,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"95844b55-1388-4bed-ae0e-63dd3296d868\",\n \"metadata\": {},\n \"so"
},
{
"path": "notebooks/coding_2/Curves.ipynb",
"chars": 9001,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"f8825706-c252-40d7-8075-b438f5756093\",\n \"metadata\": {},\n \"so"
},
{
"path": "notebooks/coding_2/FXRates.ipynb",
"chars": 13002,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"48397019-8e34-4802-9f82-eba040e083fd\",\n "
},
{
"path": "notebooks/coding_2/FXVolatility.ipynb",
"chars": 7088,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"477eccd6-a966-41f8-b6db-954a2e3a09b0\",\n "
},
{
"path": "notebooks/coding_2/Instruments.ipynb",
"chars": 4870,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"07490ad9-c75c-403e-83d5-9f808360b49e\",\n "
},
{
"path": "notebooks/coding_2/InterpolationAndSplines.ipynb",
"chars": 4765,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"ac6cd685-e9ba-4813-ac98-c533012f10ed\",\n "
},
{
"path": "notebooks/coding_2/Legs.ipynb",
"chars": 635,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"8ced5feb-616f-469c-8b1a-68bd7c9ef252\",\n \"metadata\": {},\n \"so"
},
{
"path": "notebooks/coding_2/Periods.ipynb",
"chars": 3597,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"49c1059d-3472-4797-a9a2-ae7efbc9ba1d\",\n "
},
{
"path": "notebooks/coding_2/Scheduling.ipynb",
"chars": 8195,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n \"id\": \"350b18e6-9448-4c28-9c45-444dabe50160\",\n "
},
{
"path": "pyproject.toml",
"chars": 4303,
"preview": "# pyproject.toml\n\n[build-system]\nrequires = [\"maturin>=1.0,<2.0\"]\nbuild-backend = \"maturin\"\n\n[tool.maturin]\nmodule-name "
},
{
"path": "python/rateslib/__init__.py",
"chars": 7446,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/_spec_loader.py",
"chars": 38899,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/__init__.py",
"chars": 1423,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/_parsers.py",
"chars": 12438,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/academic/__init__.py",
"chars": 736,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/academic/ns.py",
"chars": 8609,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/academic/nss.py",
"chars": 8914,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/academic/sw.py",
"chars": 16695,
"preview": "#############################################################\n# COPYRIGHT 2022 Siffrorna Technology Limited\n# This code "
},
{
"path": "python/rateslib/curves/curves.py",
"chars": 123907,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/interpolation.py",
"chars": 8431,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/rs.py",
"chars": 4789,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/curves/utils.py",
"chars": 20847,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/data/__instrument_spec.csv",
"chars": 17836,
"preview": "kind,meta,meta,meta,meta,meta,meta,base_derivative,base_derivative,base_derivative,base_derivative,base_derivative,base_"
},
{
"path": "python/rateslib/data/fixings.py",
"chars": 140447,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/data/historical/aud_rfr.csv",
"chars": 54452,
"preview": "reference_date,rate\n04-01-2011,-500\n05-01-2011,-500\n06-01-2011,-500\n07-01-2011,-500\n10-01-2011,-500\n11-01-2011,-500\n12-"
},
{
"path": "python/rateslib/data/historical/cad_rfr.csv",
"chars": 104292,
"preview": "reference_date,rate\n12-08-1997,-500\n18-08-1997,-500\n19-08-1997,-500\n20-08-1997,-500\n21-08-1997,-500\n22-08-1997,-500\n25-"
},
{
"path": "python/rateslib/data/historical/corra.csv",
"chars": 104292,
"preview": "reference_date,rate\n12-08-1997,-500\n18-08-1997,-500\n19-08-1997,-500\n20-08-1997,-500\n21-08-1997,-500\n22-08-1997,-500\n25-"
},
{
"path": "python/rateslib/data/historical/estr.csv",
"chars": 15796,
"preview": "reference_date,rate\n01-10-2019,-500\n02-10-2019,-500\n03-10-2019,-500\n04-10-2019,-500\n07-10-2019,-500\n08-10-2019,-500\n09-"
},
{
"path": "python/rateslib/data/historical/eur_rfr.csv",
"chars": 15796,
"preview": "reference_date,rate\n01-10-2019,-500\n02-10-2019,-500\n03-10-2019,-500\n04-10-2019,-500\n07-10-2019,-500\n08-10-2019,-500\n09-"
},
{
"path": "python/rateslib/data/historical/gbp_rfr.csv",
"chars": 42788,
"preview": "reference_date,rate\n01-08-2023,-500\n31-07-2023,-500\n28-07-2023,-500\n27-07-2023,-500\n26-07-2023,-500\n25-07-2023,-500\n24-"
},
{
"path": "python/rateslib/data/historical/inr_rfr.csv",
"chars": 23283,
"preview": "reference_date,rate\n01-01-2025,-500\n31-12-2024,-500\n30-12-2024,-500\n27-12-2024,-500\n26-12-2024,-500\n24-12-2024,-500\n23-1"
},
{
"path": "python/rateslib/data/historical/jpy_rfr.csv",
"chars": 35204,
"preview": "reference_date,rate\n09-06-2015,-500\n10-06-2015,-500\n11-06-2015,-500\n12-06-2015,-500\n15-06-2015,-500\n16-06-2015,-500\n17-"
},
{
"path": "python/rateslib/data/historical/nok_rfr.csv",
"chars": 13421,
"preview": "reference_date,rate\n02-01-2020,1.49\n03-01-2020,1.49\n06-01-2020,1.49\n07-01-2020,1.49\n08-01-2020,1.49\n09-01-2020,1.49\n10-"
},
{
"path": "python/rateslib/data/historical/nowa.csv",
"chars": 13421,
"preview": "reference_date,rate\n02-01-2020,1.49\n03-01-2020,1.49\n06-01-2020,1.49\n07-01-2020,1.49\n08-01-2020,1.49\n09-01-2020,1.49\n10-"
},
{
"path": "python/rateslib/data/historical/sek_rfr.csv",
"chars": 7780,
"preview": "reference_date,rate\n01-09-2021,-500\n02-09-2021,-500\n03-09-2021,-500\n06-09-2021,-500\n07-09-2021,-500\n08-09-2021,-500\n09-"
},
{
"path": "python/rateslib/data/historical/sofr.csv",
"chars": 21348,
"preview": "reference_date,rate\n01-08-2023,-500\n31-07-2023,-500\n28-07-2023,-500\n27-07-2023,-500\n26-07-2023,-500\n25-07-2023,-500\n24-"
},
{
"path": "python/rateslib/data/historical/sonia.csv",
"chars": 42788,
"preview": "reference_date,rate\n01-08-2023,-500\n31-07-2023,-500\n28-07-2023,-500\n27-07-2023,-500\n26-07-2023,-500\n25-07-2023,-500\n24-"
},
{
"path": "python/rateslib/data/historical/swestr.csv",
"chars": 7780,
"preview": "reference_date,rate\n01-09-2021,-500\n02-09-2021,-500\n03-09-2021,-500\n06-09-2021,-500\n07-09-2021,-500\n08-09-2021,-500\n09-"
},
{
"path": "python/rateslib/data/historical/usd_rfr.csv",
"chars": 161,
"preview": "reference_date,rate\n01-08-2019,2.19\n31-07-2019,2.55\n30-07-2019,2.39\n29-07-2019,2.4\n26-07-2019,2.41\n25-07-2019,2.42\n24-0"
},
{
"path": "python/rateslib/data/loader.py",
"chars": 17630,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/default.py",
"chars": 23659,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/dual/__init__.py",
"chars": 3683,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/dual/ift.py",
"chars": 23656,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/dual/newton.py",
"chars": 12573,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/dual/quadratic.py",
"chars": 3402,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/dual/utils.py",
"chars": 16440,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/dual/variable.py",
"chars": 9818,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/enums/__init__.py",
"chars": 1113,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/enums/generics.py",
"chars": 2440,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/enums/parameters.py",
"chars": 12206,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/errors.py",
"chars": 10782,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/fx/__init__.py",
"chars": 624,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/fx/fx_forwards.py",
"chars": 51110,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/fx/fx_rates.py",
"chars": 20009,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/__init__.py",
"chars": 2919,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/__init__.py",
"chars": 1128,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/bill.py",
"chars": 20369,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/bond_future.py",
"chars": 45822,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/conventions/__init__.py",
"chars": 28459,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/conventions/accrued.py",
"chars": 9264,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/conventions/discounting.py",
"chars": 17111,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/fixed_rate_bond.py",
"chars": 14760,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/float_rate_note.py",
"chars": 20212,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/index_fixed_rate_bond.py",
"chars": 42458,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/__init__.py",
"chars": 7799,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/accrued.py",
"chars": 2933,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/cashflows.py",
"chars": 1565,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/duration.py",
"chars": 6048,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/oaspread.py",
"chars": 6982,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/repo.py",
"chars": 8588,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/bonds/protocols/ytm.py",
"chars": 16070,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/cds.py",
"chars": 21249,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fee.py",
"chars": 15582,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fly.py",
"chars": 8292,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fra.py",
"chars": 22259,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_forward.py",
"chars": 10612,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/__init__.py",
"chars": 1090,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/brokerfly.py",
"chars": 19145,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/call_put.py",
"chars": 40384,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/risk_reversal.py",
"chars": 23621,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/straddle.py",
"chars": 11493,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/strangle.py",
"chars": 26065,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_options/vol_value.py",
"chars": 7981,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/fx_swap.py",
"chars": 21549,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/iirs.py",
"chars": 25410,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ir_options/__init__.py",
"chars": 1019,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ir_options/call_put.py",
"chars": 32741,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ir_options/risk_reversal.py",
"chars": 9193,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ir_options/straddle.py",
"chars": 18334,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ir_options/strangle.py",
"chars": 9083,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ir_options/vol_value.py",
"chars": 12311,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/irs.py",
"chars": 27905,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/loan.py",
"chars": 27165,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ndf.py",
"chars": 28803,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/ndxcs.py",
"chars": 42634,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/portfolio.py",
"chars": 7329,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/__init__.py",
"chars": 1655,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/analytic_delta.py",
"chars": 4674,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/analytic_fixings.py",
"chars": 7671,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/cashflows.py",
"chars": 10831,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/fixings.py",
"chars": 4846,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/kwargs.py",
"chars": 6550,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/npv.py",
"chars": 8078,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/pricing.py",
"chars": 22757,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/rate.py",
"chars": 6229,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/sensitivities.py",
"chars": 12601,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/protocols/utils.py",
"chars": 5228,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/sbs.py",
"chars": 25376,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/spread.py",
"chars": 6737,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/stir_future.py",
"chars": 22382,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/value.py",
"chars": 7827,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/xcs.py",
"chars": 41507,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/yoyis.py",
"chars": 22910,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/zcis.py",
"chars": 21043,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/instruments/zcs.py",
"chars": 23428,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/__init__.py",
"chars": 984,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/amortization.py",
"chars": 12220,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/credit.py",
"chars": 13670,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/custom.py",
"chars": 2369,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/fixed.py",
"chars": 46483,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/float.py",
"chars": 53130,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/protocols/__init__.py",
"chars": 1253,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/protocols/analytic_delta.py",
"chars": 5935,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/protocols/analytic_fixings.py",
"chars": 3615,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/protocols/cashflows.py",
"chars": 5401,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/protocols/fixings.py",
"chars": 4903,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/legs/protocols/npv.py",
"chars": 9612,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/local_types.py",
"chars": 14055,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/mutability/__init__.py",
"chars": 6112,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/__init__.py",
"chars": 1728,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/cashflow.py",
"chars": 16149,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/credit.py",
"chars": 23451,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/fixed_period.py",
"chars": 27351,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/float_period.py",
"chars": 54959,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/float_rate.py",
"chars": 3986,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/fx_volatility.py",
"chars": 41299,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/ir_volatility.py",
"chars": 26740,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/__init__.py",
"chars": 1637,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/credit.py",
"chars": 916,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/fx_volatility.py",
"chars": 4254,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/index.py",
"chars": 10550,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/ir_volatility.py",
"chars": 4105,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/mtm.py",
"chars": 4078,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/period.py",
"chars": 4660,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/rate.py",
"chars": 17754,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/parameters/settlement.py",
"chars": 8305,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/__init__.py",
"chars": 2039,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/analytic_delta.py",
"chars": 17186,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/analytic_fixings.py",
"chars": 16023,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/analytic_greeks.py",
"chars": 31512,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/cashflows.py",
"chars": 19443,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/fixings.py",
"chars": 11165,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/protocols/npv.py",
"chars": 36003,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/periods/utils.py",
"chars": 12144,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/py.typed",
"chars": 0,
"preview": ""
},
{
"path": "python/rateslib/rs.pyi",
"chars": 18902,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/__init__.py",
"chars": 4318,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/adjuster.py",
"chars": 2483,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/calendars.py",
"chars": 4190,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/convention.py",
"chars": 2587,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/dcfs.py",
"chars": 6157,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/frequency.py",
"chars": 13327,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/imm.py",
"chars": 5064,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/rollday.py",
"chars": 1598,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/scheduling/schedule.py",
"chars": 24706,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/serialization/__init__.py",
"chars": 583,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/serialization/json.py",
"chars": 3151,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/serialization/utils.py",
"chars": 1446,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/solver.py",
"chars": 103591,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/splines/__init__.py",
"chars": 2550,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/splines/evaluate.py",
"chars": 2159,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/utils/calendars.py",
"chars": 1015,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/verify.py",
"chars": 9930,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/volatility/__init__.py",
"chars": 1503,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/volatility/fx/__init__.py",
"chars": 1329,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/volatility/fx/base.py",
"chars": 3690,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/volatility/fx/delta_vol.py",
"chars": 50513,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
},
{
"path": "python/rateslib/volatility/fx/sabr.py",
"chars": 30803,
"preview": "# SPDX-License-Identifier: LicenseRef-Rateslib-Dual\n#\n# Copyright (c) 2026 Siffrorna Technology Limited\n#\n# Dual-license"
}
]
// ... and 179 more files (download for full content)
About this extraction
This page contains the full source code of the attack68/rateslib GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 379 files (6.9 MB), approximately 1.8M tokens, and a symbol index with 5968 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.