a guest Mar 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def durations(cfs, rates, price, ytm, no_coupons):
- import numpy as np
- mac_dur = np.sum([cfs[i]*（i+1）/np.power(1+rates[i],i+1) for i in range(len(cfs))])/price
- mod_dur = mac_dur/(1+ytm/no_coupons)
- return mac_dur, mod_dur
RAW Paste Data