Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add BondFuture spec examples #701

Merged
merged 4 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/source/i_whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ email contact, see `rateslib <https://rateslib.com>`_.
- Add ``calc_mode`` *'eurex_eur'* for :class:`~rateslib.instruments.BondFuture`.
(`699 <https://github.com/attack68/rateslib/pull/699>`_)
* - Instruments
- Add ``spec`` argument for :class:`~rateslib.instruments.BondFuture`.
- Add ``spec`` argument for :class:`~rateslib.instruments.BondFuture`, and some CME treasury futures and EUREX
bond future default specifications. This has also refactored the *BondFuture* attributes into a ``kwargs``
dict instead of being directly accessible on the object. This may affect existing code that relies on these
attributes.
(`700 <https://github.com/attack68/rateslib/pull/700>`_)
* - Refactor
- Rename :class:`~rateslib.instruments.BaseMixin` to :class:`~rateslib.instruments.Metrics`.
Expand Down
125 changes: 125 additions & 0 deletions docs/source/spec/bondfuture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
.. ipython:: python
:suppress:

from rateslib import *

**************
BondFuture
**************

USD
****

CME Treasury Futures
---------------------

.. _spec-us-gb-2y:

**2-year**

.. ipython:: python

defaults.spec["us_gb_2y"]
BondFuture(spec="us_gb_2y", delivery=(dt(2000, 3, 1), dt(2000, 3, 31))).kwargs

.. _spec-us-gb-3y:

**3-year**

.. ipython:: python

defaults.spec["us_gb_3y"]
BondFuture(spec="us_gb_3y", delivery=(dt(2000, 3, 1), dt(2000, 3, 31))).kwargs

.. _spec-us-gb-5y:

**5-year**

.. ipython:: python

defaults.spec["us_gb_5y"]
BondFuture(spec="us_gb_5y", delivery=(dt(2000, 3, 1), dt(2000, 3, 31))).kwargs

.. _spec-us-gb-10y:

**10-year**

.. ipython:: python

defaults.spec["us_gb_10y"]
BondFuture(spec="us_gb_10y", delivery=(dt(2000, 3, 1), dt(2000, 3, 31))).kwargs

.. _spec-us-gb-30y:

**30-year**

.. ipython:: python

defaults.spec["us_gb_30y"]
BondFuture(spec="us_gb_30y", delivery=(dt(2000, 3, 1), dt(2000, 3, 31))).kwargs

EUR
********

.. _spec-de-gb-2y:

**Eurex Schatz**

.. ipython:: python

defaults.spec["de_gb_2y"]
BondFuture(spec="de_gb_2y", delivery=dt(2000, 3, 10)).kwargs

.. _spec-de-gb-5y:

**Eurex Bobl**

.. ipython:: python

defaults.spec["de_gb_5y"]
BondFuture(spec="de_gb_5y", delivery=dt(2000, 3, 10)).kwargs

.. _spec-de-gb-10y:

**Eurex Bund**

.. ipython:: python

defaults.spec["de_gb_10y"]
BondFuture(spec="de_gb_10y", delivery=dt(2000, 3, 10)).kwargs

.. _spec-de-gb-30y:

**Eurex Buxl**

.. ipython:: python

defaults.spec["de_gb_30y"]
BondFuture(spec="de_gb_30y", delivery=dt(2000, 3, 10)).kwargs

.. _spec-fr-gb-5y:

**Eurex OAT 5y**

.. ipython:: python

defaults.spec["fr_gb_5y"]
BondFuture(spec="fr_gb_5y", delivery=dt(2000, 3, 10)).kwargs

.. _spec-fr-gb-10y:

**Eurex OAT 10y**

.. ipython:: python

defaults.spec["fr_gb_10y"]
BondFuture(spec="fr_gb_10y", delivery=dt(2000, 3, 10)).kwargs

.. _spec-sp-gb-10y:

**Eurex BONO**

.. ipython:: python

defaults.spec["sp_gb_10y"]
BondFuture(spec="sp_gb_10y", delivery=dt(2000, 3, 10)).kwargs
12 changes: 12 additions & 0 deletions docs/source/u_defaults.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,56 +208,67 @@ a host of arguments will be pre-populated. The table below outlines all of the e
- Bill
- IndexFixedRateBond
- FloatRateNote
- BondFuture
* - USD
- :ref:`us_gb <spec-us-gb>`, :ref:`us_gb_tsy <spec-us-gb>`
- :ref:`us_gbb <spec-usd-gbb>`
-
-
- :ref:`us_gb_2y <spec-us-gb-2y>` :ref:`us_gb_3y <spec-us-gb-3y>` :ref:`us_gb_5y <spec-us-gb-5y>`:ref:`us_gb_10y <spec-us-gb-10y>`:ref:`us_gb_30y <spec-us-gb-30y>`
* - EUR
- :ref:`de_gb <spec-de-gb>`, :ref:`fr_gb <spec-fr-gb>`, :ref:`it_gb <spec-it-gb>`, :ref:`nl_gb <spec-nl-gb>`
-
-
-
- :ref:`de_gb_2y <spec-de-gb-2y>`, :ref:`de_gb_5y <spec-de-gb-5y>`, :ref:`de_gb_10y <spec-de-gb-10y>`, :ref:`de_gb_30y <spec-de-gb-30y>`, :ref:`fr_gb_5y <spec-fr-gb-5y>`, :ref:`fr_gb_10y <spec-fr-gb-10y>`, :ref:`sp_gb_10y <spec-sp-gb-10y>`
* - GBP
- :ref:`uk_gb <spec-uk-gb>`
- :ref:`uk_gbb <spec-uk-gbb>`
-
-
-
* - CHF
-
-
-
-
-
* - SEK
- :ref:`se_gb <spec-se-gb>`
- :ref:`se_gbb <spec-se-gbb>`
-
-
-
* - NOK
- :ref:`no_gb <spec-no-gb>`
-
-
-
-
* - CAD
- :ref:`ca_gb <spec-ca-gb>`
-
-
-
-
* - JPY
-
-
-
-
-
* - AUD
-
-
-
-
-
* - NZD
-
-
-
-
-


.. toctree::
Expand All @@ -272,6 +283,7 @@ a host of arguments will be pre-populated. The table below outlines all of the e
spec/sbs.rst
spec/fra.rst
spec/fixedratebond.rst
spec/bondfuture.rst
spec/bill.rst
spec/stir.rst
spec/zcis.rst
Expand Down
Loading