Skip to content

Conversation

@piper0124
Copy link

Wow, Doctor, it's really great to meet you!
Based on Bond Math: The Theory Behind the Formulas, Second Edition, I have implemented duration and other metrics for interest rate swaps in FinancePy(ibor_swap.py) and compared the results with those presented in the Bond Math book(FinancePy>notebooks>products>rates>FINIBORSWAP_ReplicationgBONDMATHDurationExample.ipynb). The results are largely consistent, with small differences likely due to date conventions.
Have a nice day.

@domokane
Copy link
Owner

domokane commented May 23, 2025

Hi - Can you just have one function. Use the class member fixed_leg_type to determine whether someone is a payer or receiver.

    if fixed_leg_type == SwapTypes.PAY

or

    if fixed_leg_type == SwapTypes.RECEIVE
piper0124 added 3 commits May 26, 2025 09:11
1. Use the class member fixed_leg_type(SwapTypes.PAY or SwapTypes.RECEIVE) to determine whether a counterparty is a buyer or seller, and calculate the Macaulay duration, modified duration, basis point value (BPV), and present value change of the interest rate swap (IRS).
2. Updated the notebook: FINIBORSWAP_ReplicationBONDMATHDurationExample.ipynb.
@piper0124
Copy link
Author

  1. Use the class member fixed_leg_type(SwapTypes.PAY or SwapTypes.RECEIVE) to determine whether a counterparty is a buyer or seller, and calculate the Macaulay duration, modified duration, basis point value (BPV), and present value change of the interest rate swap (IRS).
  2. Updated the notebook: FINIBORSWAP_ReplicationBONDMATHDurationExample.ipynb.
    Thanks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants