Guest User

Untitled

a guest
Mar 13th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. def durations(cfs, rates, price, ytm, no_coupons):
  2. import numpy as np
  3. mac_dur = np.sum([cfs[i]*(i+1)/np.power(1+rates[i],i+1) for i in range(len(cfs))])/price
  4. mod_dur = mac_dur/(1+ytm/no_coupons)
  5. return mac_dur, mod_dur
Add Comment
Please, Sign In to add comment