Skip to content

Commit

Permalink
Flatten output of fi.yield_curve.bootstrap()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyas Srinivasan committed Mar 22, 2022
1 parent 76e68ab commit 725d9ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/fixedincome/yield_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def bootstrap(cash_flows : np.ndarray, prices : np.ndarray) -> np.ndarray:

discount_factors = np.linalg.inv(cash_flows) @ prices
yields = np.power(discount_factors, np.reshape(-1 / np.arange(start=1, stop=discount_factors.shape[0]+1), newshape=discount_factors.shape)) - 1 # Formula: d = 1/(1 + y)^i
return yields
return np.reshape(yields, newshape=(yields.shape[0])) # Flatten output


def regression():
Expand Down

0 comments on commit 725d9ec

Please sign in to comment.