FinancePy
FinancePy copied to clipboard
Duration & Metrics for IRS in FinancePy: Validation Against Bond Math by DONALD J. SMITH
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.
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
- 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).
- Updated the notebook: FINIBORSWAP_ReplicationBONDMATHDurationExample.ipynb. Thanks.