Giter VIP home page Giter VIP logo

jupyter-notebooks's Introduction

Binder License: MIT frontmark RIVACON

Jupyter Notebooks

This is a collection of jupyter notebooks to illustrate the basic concepts of mathematical finance:

Market Data

Roll Conventions, Day Counters and Schedule Generation

The most important day counters and roll conventions are explained here. This notebook shows how to roll out schedules.

Discount Curves

You can learn how to create and work with discount curves including plotting functionality in this notebook. How to bootstrap in a multi-curve framework is explained here.

Equity Forward Curves

Create and work with equity forward curves including plotting functionality here.

Equity Volatility Surfaces

Create and work with equity volatility surfaces here.

Pricing

A variety of different derivative products from various asset classes are introduced and their pricing is discussed.

Conventions

  • use Title Case for H1 (#) and H2 (##) headers
  • use Sentence case for H3 (###), H4 (####) etc. headers (maybe except if only 2 - 3 linked words)
  • use snake_case for filenames

Tribute

Thanks to our sponsors frontmark and RIVACON.

jupyter-notebooks's People

Contributors

favcm avatar favdo avatar favph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jupyter-notebooks's Issues

Missing Default for getRho()

getRho() of pyvacon.pricer shall provide a result even if the only interest rate curve is not given explicitly inthe argument (cf. getComplexity() where this isn't necessary neither).

Change BondSpecification interface

In C++ there are several constructors for BondSpecification. The one that is swigged is insufficient as it does not distinguish between fixing dates and payment dates. In other words, it only accepts coupon period dates and spreads for the floating rate coupons.
There is a constructor that offers to use CouponDescriptions that provide full information on the coupons. It has to be double-checked this constructor lacks the attribute issue_date (and possibly also first_trading_date); https://www.helaba-zertifikate.de/File/OpenPDF/DE000HLB3DU1/BD

Bug in Schedule Generation

For roll convention 'Preceding' the end date might be unchanged even thought the last coupon date (at the same day) was rolled. It seems that the roll convention is not (always) applied to the end date.

Erroneous deposit specification in bootstrapper

The method InstrumentSpec.get_deposit_spec in pyvacon.marketdata.bootstrapping.py should be replaced by

def get_deposit_spec(self):
    """
    Specification for deposits
    """
    
    # start date of the accrual period
    startDate = get_end_date(self.refDate,  self.spotLag)
    startDate_p = converter.getLTime(startDate)
    
    # end date of the accrual period
    endDate = get_end_date(startDate, self.maturity)
    endDate_p = converter.getLTime(endDate)
    
    # specification of the deposit
    deposit = analytics.DepositSpecification(self.label, 'dummy_issuer', enums.SecuritizationLevel.NONE,
                                    self.currency, self.refDate_p, startDate_p, endDate_p, 100, self.parRate, self.floatDayCount)
                                              
    return(deposit)

Incomplete Swig Interface for Bootstrapping

While the C++ code allows for specifying inter- and extrapolation method within the bootstrapping algorithm, the swigged python code (pyvacon.analytics.YieldCurveBootstrapper. YieldCurveBootstrapper_compute) does not provide the option to configure this. The interface should be extended to avoid potential inconsistencies with subsequently defined interpolation methods for the resulting curve.

Bug in Roll Convention MODIFIED_FOLLOWING_EOM

Sometimes the roll convention doesn't derive the correct end date:

  • start date 29-Apr-2022 (Friday), period 1 month, end date: 31-May-2022 (Tuesday).
    30-Apr-2022 is a Saturday, so 29-Apr-2022 is the last business day of the month.
    Unexpected result: 30.05.2022
  • start date 28-Feb-2020 (Friday), period 1 month, end date: 31-Mar-2020 (Tuesday).
    Though 2020 is a leap year, the 28-Feb-2020 is the last business day of the month.
    Unexpected result: 30.03.2020

Consistency Checks: Coupon Dates <=> Coupons, Coupon Periods <=> Spreads

  • Throw an error message if the number of coupons is not equal to the number of coupon dates.
  • Avoid kernel shutdown if coupon dates, but no coupons (i.e. empty list) are porvided.
  • Throw an error message if the number of spreads is not equal to the number of coupon dates minus one:
    len(Spreads) == len(Coupon_Period_Dates) - 1.

Issue Date before Expiry Date

  • Throw error message if not(Issue Date < Expiry Date).
  • Seek for consistency in the argument lists: currently we have - at least - the following inconsistency:

    BondSpecification(): ..., expiry_date, issue_date, ...
    InflationLinkedBondSpecification(): ..., issue_date, expiry_date, ...

Bug in function bootstrap_curve

It seems that the function bootstrap_curve in pyvacon/marketdata/bootstrapping.py uses .iloc instead of .loc when iterating through the rows of a pandas DataFrame using a running number.
This works fine when the row number is the same as the index, but breaks (or gives unexpected results) when it is not.

BugBootstrapCurve

Missing Default Pricer for Bonds

Provide 'BondPricer' as default pricer for pyvacon.pricing.BondPricingData() 'BondPricer'.
Thereafter we can remove the pricer configuration in the notebooks to use them for testing purposes only.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.