Skip to content

Commit

Permalink
Merge branch 'main' into add_examples
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/source/i_whatsnew.rst
  • Loading branch information
attack68 committed Feb 3, 2024
2 parents e3f3e70 + 0ba19d4 commit c22533e
Show file tree
Hide file tree
Showing 22 changed files with 300 additions and 72 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
.pypirc
MANIFEST

# PyInstaller
Expand Down
6 changes: 3 additions & 3 deletions docs/source/_static/badges.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"coverage": "99%",
"licence": "CC-BY-NC-ND-4.0",
"pypi": "v0.7.0",
"conda": "v0.7.0",
"pypi": "v1.0.0",
"conda": "v1.0.0",
"python": "3.9 | 3.10 | 3.11",
"style": "black",
"status": "beta"
"status": "stable"
}
7 changes: 6 additions & 1 deletion docs/source/_static/switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@
"url": "https://rateslib.readthedocs.io/en/0.6.x/"
},
{
"name": "stable",
"name": "0.7.x",
"version": "0.7.x",
"url": "https://rateslib.readthedocs.io/en/0.7.x/"
},
{
"name": "stable",
"version": "1.0.0",
"url": "https://rateslib.readthedocs.io/en/stable/"
}
]
Binary file added docs/source/_static/thumb_coding_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/thumb_ptirds4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/f_fxf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ not provided at initialisation, nor is the "eurgbp" curve.

In these circumstances the :meth:`~rateslib.fx.FXForwards.curve` method will derive the
combination of existing curves that can be combined to yield required DFs on-the-fly.
This creates a :class:`~rateslib.fx.ProxyCurve`.
This creates a :class:`~rateslib.curves.ProxyCurve`.

In the above framework GBP is the cheapest to deliver collateral, and USD is the
most expensive. We can observe this
Expand Down
2 changes: 1 addition & 1 deletion docs/source/f_fxr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FX Spot Rates
***********************

This documentation page discusses the methods of the
:class:`~rateslib.fx.FXRates` class which are summarised below,
:class:`~rateslib.fx.FXRates` class which are summarised below:

.. autosummary::
rateslib.fx.FXRates
Expand Down
45 changes: 29 additions & 16 deletions docs/source/i_about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,35 @@ The History and Context of Rateslib
The foundations of *rateslib* is really the code library
`Book IRDS3 <https://github.com/attack68/book_irds3>`_, which laid down
basic principles and was a sandbox code environment for the
publication *Pricing and Trading Interest Rate Derivatives: A Practical Guide to Swaps
(2022, 3rd Edition)*. Some of the code and algorithms also date back to the author's
time trading IRSs as a market-maker between 2006 and 2017.

.. image:: _static/thumb_ptirds3.png
:alt: Pricing and Trading Interest Rate Derivatives
:target: https://www.amazon.com/Pricing-Trading-Interest-Rate-Derivatives/dp/0995455538
:width: 92

The algorithms and mathematical work of *rateslib* is expected to be released in
early 2024 under the working title of *Coding Interest Rates: FX, Swaps and Bonds*

.. image:: _static/thumb_coding_2.png
:alt: Coding Interest Rates: FX, Swaps and Bonds
:target: https://www.amazon.com/Pricing-Trading-Interest-Rate-Derivatives/dp/0995455538
:width: 92
publication `Pricing and Trading Interest Rate Derivatives: A Practical Guide to Swaps <https://www.amazon.com/Pricing-Trading-Interest-Rate-Derivatives/dp/0995455538>`_.
Some of the code and algorithms also date back to the author's
time trading IRSs as a market-maker between 2006 and 2017. The algorithms and mathematical
code developments of *rateslib*
are all characterised and explained in
`Coding Interest Rates: FX, Swaps and Bonds <https://www.amazon.com/dp/0995455554>`_.

.. container:: twocol

.. container:: leftside40

.. image:: _static/thumb_coding_3.png
:alt: Coding Interest Rates: FX, Swaps and Bonds
:target: https://www.amazon.com/dp/0995455554
:width: 145
:align: center

.. container:: rightside60

.. image:: _static/thumb_ptirds3.png
:alt: Pricing and Trading Interest Rate Derivatives
:target: https://www.amazon.com/Pricing-Trading-Interest-Rate-Derivatives/dp/0995455538
:width: 145
:align: center

.. raw:: html

<div class="clear"></div>


.. _pillars-doc:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/i_get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ Does *rateslib* ``solve`` curves relative to market prices?

**Yes**, when a :class:`~rateslib.solver.Solver` is configured along with all the intended
*Instruments* and their relevant *prices*.
Multiple algorithms (*gradient descent, Gauss-Newton, Leveberg-Marquardt*) and stopping criteria
Multiple algorithms (*gradient descent, Gauss-Newton, Levenberg-Marquardt*) and stopping criteria
can be used within the optimization routine
to simultaneously solve multiple *Curve* parameter.
to simultaneously solve multiple *Curve* parameters.

The *Solver* can even construct dependency chains, like sequentially building curves
with dependencies to other desks on an investment bank trading floor, and internally manage all of
Expand Down
8 changes: 4 additions & 4 deletions docs/source/i_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ parameters that are used to build up the instruments.
Multi-currency instruments
--------------------------

Lets take a quick look at a multi-currency instrument: the
Let's take a quick look at a multi-currency instrument: the
:class:`~rateslib.instruments.FXSwap`. All instruments have a mid-market pricing
function :meth:`rate()<rateslib.instruments.BaseDerivative.rate>`. Keeping a
consistent function name across all *Instruments* allows any of them to be used within a
Expand Down Expand Up @@ -262,7 +262,7 @@ a set of instrument prices, ``s``.
id="us_rates"
)
Solving was a success! Observe the DFs on the *Curve* have been updated:
Solving was a success! Observe that the DFs on the *Curve* have been updated:

.. ipython:: python
Expand Down Expand Up @@ -324,7 +324,7 @@ detailed instructions of the way in which the associations can be constructed in
g_mechanisms.rst

The **key takeway** is that when you initialise and create an *Instrument* you can do one
of three things;
of three things:

1) Not provide any *Curves* for pricing upfront (``curves=NoInput(0)``).
2) Create an explicit association to pre-existing Python objects, e.g. ``curves=my_curve``.
Expand Down Expand Up @@ -398,4 +398,4 @@ into any one category. See the :ref:`Cookbook index <cookbook-doc>`.
.. toctree::
:hidden:

g_coverage.rst
g_coverage.rst
29 changes: 19 additions & 10 deletions docs/source/i_whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ email contact through **[email protected]**.
- Description
- Consideration
- Timeframe
* - Coding Interest Rates
- Officially document this library's algorithms and release the book.
- Planned
- End 2023
* - Version 1.0
- Release the official first non-beta version of this library.
- Planned
- End 2023
* - Vanilla FX options and volatility products
- Adding option instruments and benchmark trades such as risk-reversals.
- Highly likely (v2.0?)
Expand All @@ -53,8 +45,8 @@ email contact through **[email protected]**.
- no ETA


1.0.0 (Not released)
**********************
1.1.0 (not released)
*********************

.. list-table::
:widths: 25 75
Expand All @@ -73,6 +65,23 @@ email contact through **[email protected]**.
settled payment date.


1.0.0 (1st Feb 2024)
**********************

.. list-table::
:widths: 25 75
:header-rows: 1

* - Feature
- Description
* - Bug
- FRA :meth:`~rateslib.instruments.FRA.cashflows` now correctly identifies the DF at cash
settled payment date.
* - Bug
- :meth:`~rateslib.legs.FloatLeg.fixings_table` now generates exact results (not in approximate mode) when RFR
fixings are included in any period.


0.7.0 (29th Nov 2023)
**********************

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.readthedocs.io%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.readthedocs.io%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.readthedocs.io%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.licence&label=Licence&color=orange" alt="Licence">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.readthedocs.io%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.status&label=Status&color=orange" alt="Status">
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Frateslib.readthedocs.io%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.readthedocs.io%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.readthedocs.io%2Fen%2Flatest%2F_static%2Fbadges.json&query=%24.style&label=Code%20Style&color=black" alt="Code Style">
</div>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rateslib"
version = "0.7.0"
version = "1.0.0"
description = "A fixed income library for trading interest rates"
readme = "README.md"
authors = [{ name = "J H M Darbyshire"}]
Expand Down
2 changes: 1 addition & 1 deletion rateslib/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NoInput(Enum):
"""
Enumerable type to handle setting default values.
See :ref:`<default values <defaults-doc>`.
See :ref:`default values <defaults-doc>`.
"""
blank = 0
inherit = 1
Expand Down
9 changes: 9 additions & 0 deletions rateslib/fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def _convert_dual(k, v):

# find currencies
self.pairs = [k for k in self.fx_rates.keys()]
self.pairs_settlement = {pair: settlement for pair in self.pairs}
self.variables = tuple(f"fx_{pair}" for pair in self.pairs)
self.currencies = {
k: i
Expand Down Expand Up @@ -838,6 +839,9 @@ def update(
fx_rates=fx_rates_obj,
fx_curves=sub_curves,
)
settlement_pairs = {
pair: fx_rates_obj.settlement for pair in fx_rates_obj.pairs
}
else:
# calculate additional FX rates from previous objects
# in the same settlement frame.
Expand All @@ -860,6 +864,9 @@ def update(
self.fx_curves, fx_rates_obj.currencies_list + pre_currencies
)
acyclic_fxf = FXForwards(fx_rates=combined_fx_rates, fx_curves=sub_curves)
settlement_pairs.update(
{pair: fx_rates_obj.settlement for pair in fx_rates_obj.pairs}
)

if base is not NoInput.blank:
acyclic_fxf.base = base.lower()
Expand All @@ -874,6 +881,7 @@ def update(
"pairs",
]:
setattr(self, attr, getattr(acyclic_fxf, attr))
self.pairs_settlement = settlement_pairs
else:
self.currencies = self.fx_rates.currencies
self.q = len(self.currencies.keys())
Expand All @@ -885,6 +893,7 @@ def update(
self.pairs = self.fx_rates.pairs
self.variables = tuple(f"fx_{pair}" for pair in self.pairs)
self.fx_rates_immediate = self._update_fx_rates_immediate()
self.pairs_settlement = self.fx_rates.pairs_settlement

def __init__(
self,
Expand Down
Loading

0 comments on commit c22533e

Please sign in to comment.