.. RatesLib documentation master file.
.. ipython:: python
:suppress:
from rateslib import FixedRateBond, dt
.. raw:: html
*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. *Rateslib* is not freely licensed, it is copyrightable
software provided as below.
.. raw:: html
.. raw:: html
Academic or Home Educational Use |
Commercial Use by Anyone in: Banks, Funds, Accountants, Treasuries |
FREE to use and modify.
|
Not Licenced - Cannot be installed on a corporate machine without permission.
Can purchase a licence extension. $300 per year / per user.
contact: infoLively magic@rateslib.com
|
.. 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.
.. raw:: html
Highlights
==========
*Other interface bindings*
----------------------------
Extension websites provide the documentation for using *rateslib* in other ways than directly
with Python.
.. raw:: html
.. container:: twocol
.. container:: leftside50
.. image:: _static/rateslib_excel_logo_label.png
:align: center
:alt: Excel bindings for rateslib
:width: 203
:target: https://rateslib.com/excel/latest/
.. raw:: html
Rateslib-excel provides Excel bindings to use
all of
rateslib's functionality in Excel.
.. container:: rightside50
.. image:: _static/rateslib_rs_logo_label.png
:align: center
:alt: Rust codebase for rateslib
:width: 203
:target: https://rateslib.com/rs/latest/rateslib
.. raw:: html
Rateslib-rs is the backend codebase
for parts of
rateslib written in Rust using PyO3.
.. raw:: html
*Curve construction is simple but has huge flexibility*
--------------------------------------------------------
Multiple interpolation modes are offered by default and the generalised process for curve
solving means very specific pricing artefacts can be accurately modelled with the
correct formulations. The framework is accessible and requires minimal configuration.
.. container:: twocol
.. container:: leftside40
.. code-block:: python
usd_curve = Curve(
nodes={...},
convention="act360",
calendar="nyc",
interpolation="log_linear",
id="sofr",
)
solver = Solver(
curves=[usd_curve],
instruments=[...],
weights=[...],
s=[...],
)
.. container:: rightside60
.. image:: _static/ptirds_00_00.png
:align: center
:alt: See Cookbook: Single currency curve replication
:height: 220
:width: 380
:target: z_ptirds_curve.html
.. raw:: html
*API is designed for users with full documentation*
-----------------------------------------------------------------
Although any fixed income library uses complex mathematical processes, the API has been
carefully designed to provide a workflow that is very intuitive. In the case of using it
for small scale learning items often few parameters and arguments are required.
For larger series of curves and more complicated object oriented
associations the API signature does not materially change. Best practice is demonstrated in
documentation examples.
.. code-block:: python
xcs = XCS(
effective=dt(2022, 2, 14), termination="15M",
notional=100e6, float_spread=-10.25,
spec="eurusd_xcs", curves=[...],
) # Create a EUR/USD Cross-Ccy Swap
xcs.rate(solver=solver)
xcs.npv(solver=solver, base="eur")
*Wide range of fixed income Instruments available*
----------------------------------------------------
The most recent version of *rateslib* contains the main *Instruments* that
dominate linear fixed income products. The large array of input parameters for these gives scope
to fully capture the nuances of these products across sectors and geographic regions,
capturing aspects like trading calendars, day count conventions, payment delays, etc. New
specifications and calendars are continually being added as users enquire.
A good example is a **US Treasury Bond**, replicated here with *rateslib* and the equivalent
ticket in Bloomberg for reference point.
.. ipython:: python
ust = FixedRateBond(
effective=dt(2023, 8, 15), termination=dt(2033, 8, 15),
fixed_rate=3.875, spec="ust"
) # Create a US-Treasury bond
ust.price(ytm=4.0, settlement=dt(2025, 2, 14))
ust.duration(ytm=4.0, settlement=dt(2025, 2, 14), metric="risk")
.. image:: _static/ust_10y.gif
:alt: US Treasury example using the FixedRateBond class
:width: 611
*Minimal dependencies to other Python libraries*
--------------------------------------------------
The dependencies are to **NumPy**, **Pandas**, and **Matplotlib**. *Rateslib* does
not have any dependencies to any automatic
differentiation libraries, such as PyAudi or JAX, preferring initially to use its
own forward mode module.
The test coverage is very high.
Licence
=======
This library is released under a **Creative Commons Attribution, Non-Commercial,
No-Derivatives 4.0 International Licence**. See :ref:`here` for more details.
Get Started
===========
Move on to the next page to :ref:`Get Started`
.. toctree::
:maxdepth: 0
:titlesonly:
:hidden:
i_get_started.rst
i_licence.rst
i_guide.rst
i_about.rst
i_api.rst
i_whatsnew.rst
i_developers.rst