Giter Club home page Giter Club logo

interest-rate-modelling-baruch's Introduction

InterestRate

Assignment 1

Reports

  • Develop a small library implementing B-splines. This library should be capable of calculating the derivatives and integrals of the basis functions. Make sure that you take a full advantage of the recursive properties of the basis functions.

    • Please refer to python script: Assignment1/splines.py
    • Spline Class: with methods splrep(), splint(), spldev(), be capable of the derivatives and integrals of the basis functions.
    • Use cache in the function to take a full advantage of the recursive properties of the basis functions.
  • Build a function that computes the discount factor between any two dates.

    • Please refer to python script: Assignment1/curves.py
    • Inside the Curve Class, disc_factor() is implemented, and both OIS and LIBOR classes will be derived from Curve.
  • Build a function that computes the forward LIBOR rate for any settlement and underlying tenor.

    • Please refer to python script: Assignment1/curves.py
    • Inside the Curve Class, forwards() is implemented, and LIBOR Class will inheritant this method.
  • Build a function that computes the (spot or forward) swap rate for any settlement and underlying tenor.

    • Please refer to python script: Assignment1/swaps.py
    • Inside the Swap Class, SwapRates() is to compute the swap rate for given settlement and underlying tenor.
  • Use the enclosed market data sheet and the method described in class to build the instantaneous OIS and LIBOR curves.

    • Please refer to python script: Assignment1/curves.py
    • Inside the LIBOR and OIS classes, they both inheritant r() method in Curve base class, and this method is building the instantaneous curves.
  • Build a function that calculates the PV of any spot or forward starting swap based on your curves.

    • Please refer to the main file: Assignment1/main.py

Usage

  • Step 1: Please make sure your computer has installed python2 and required modules, if not and you want to test this assignment by running the program, please go https://github.com/weiyialanchen/MacInstallation and follow the installation guide.

  • Step 2: Download the repository by git clone https://github.com/weiyialanchen/InterestRate.git

  • Step 3: Go to Assignment 1 directory and run the main file

    cd ~/InterestRate/Assignment1
    python main.py
    

Assignment 2

Reports

  • Implement the model using Euler’s scheme (note that for the normal LMM, Euler’s and Milstein’s schemes are identical). For drift term calculations, implement the ability to do both: the exact calculation and the frozen curve approximation.

    • Please refer to python script: Assignment2/libor_market.py
    • The exact calculation: set the parameter b_frozenCurve as False
    • The frozen curve approximation: set the paramter b_frozenCurve as True
  • Apply your model to a spot starting 10 year knock-out swap. A knock-out swap is an interest rate swap with a special termination feature. Namely, if, on a fixed leg coupon date (or more precisely, two business days before), the 10 year swap rate sets below a preset barrier B, the swap is terminated. Notice that this is a path dependent derivative and Monte Carlo simulations are an appropriate approach to pricing this product. Use 2000 simulated paths to carry out the calculation. As a variance reducing method, you may also consider using antithetic variables.

    • Knock-out swap: Knock_Out_Swap class in Assignment2/swaps.py derived from Swap class implemented in Assignment1
    • Monte Carlo Simulation: please refer to Knock_Out_Swap.simulate()
  • 2000 simulated paths calculation, assuming B = 0.95%, determine the break-even rate on the fixed leg of the swap.

    • Please refer to calc_swapRate() in Assignment2/main.py, see output for 2000 paths below
    Use 2,000 simulated paths to carry out the calculation (the exact calculation) - 
    The break-even rate on the fixed leg of the swap: 	0.0222146461996 
    
    Use 2,000 simulated paths to carry out the calculation (the frozen curve approximation) - 
    The break-even rate on the fixed leg of the swap: 	0.0221701123552
    
  • How accurate is your calculation? Compare against a run with 5,000 simulated paths.

    • Please refer to calc_swapRate() in Assignment2/main.py, see output for 5000 paths below
    Compare against a run with 5,000 simulated paths - 
    The break-even rate on the fixed leg of the swap: 	0.0227748459579
    

    It's very accurate, with error around 2%.

  • Analyse the performance of each of the drift terms calculation methods, and the accuracy of the frozen curve approximation.

    • The performance between different methods is very close, though the exact calculation is more accurate in theory.
    • But the error of frozen curve approximation method is smaller than 0.01 digits / 2% error, a good enough approximation.

Usage

  • Step 1: Please make sure your computer has installed python2 and required modules, if not and you want to test this assignment by running the program, please go https://github.com/weiyialanchen/MacInstallation and follow the installation guide.

  • Step 2: Download the repository by git clone https://github.com/weiyialanchen/InterestRate.git

  • Step 3: Go to Assignment 2 directory and run the main file

    cd ~/InterestRate/Assignment2
    python main.py
    

interest-rate-modelling-baruch's People

Contributors

wec7 avatar

Stargazers

 avatar

Watchers

Vivek Srivastava avatar James Cloos avatar

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.