Knowee
Questions
Features
Study Tools

First, Using numpy, write function npv to compute the net present value of a set of cash flows given their timing and a single discount rate with continuous compounding. Then Apply npv to compute the price of a bond that pays 6% coupons payable semi-annually, knowing that the bond's face value is $1000, it matures in 30 months and the yield to maturity is 5.5% with semi-annual compounding.

Question

First, Using numpy, write function npv to compute the net present value of a set of cash flows given their timing and a single discount rate with continuous compounding. Then Apply npv to compute the price of a bond that pays 6% coupons payable semi-annually, knowing that the bond's face value is $1000, it matures in 30 months and the yield to maturity is 5.5% with semi-annual compounding.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, let's break this down into steps.

Step 1: Import the necessary library

import numpy as np

Step 2: Define the npv function

def npv(rate, cashflows):
    return np.sum(cashflows / np.exp(rate * np.arange(len(cashflows))))

This function calculates the net present value of a series of cash flows. It does this by dividing each cash flow by the exponential of the rate times the time period (which is represented by the index of the cash flow in the array), and then summing these values.

Step 3: Define the parameters of the bond

face_value = 1000
coupon_rate = 0.06
maturity = 30 / 12  # convert months to years
yield_to_maturity = 0.055

Step 4: Calculate the cash flows

cashflows = np.full(int(maturity * 2), face_value * coupon_rate / 2)  # semi-annual coupons
cashflows[-1] += face_value  # the face value is returned at maturity

This creates an array of cash flows. The bond pays semi-annual coupons, so the number of cash flows is twice the maturity. The value of each coupon is the face value times the coupon rate, divided by 2 because the coupons are semi-annual. The face value is added to the last cash flow because it is returned at maturity.

Step 5: Apply the npv function to calculate the price of the bond

bond_price = npv(yield_to_maturity / 2, cashflows)  # the rate is divided by 2 because compounding is semi-annual

This calculates the net present value of the cash flows, which is the price of the bond.

Step 6: Print the bond price

print(bond_price)

This will print the price of the bond.

This problem has been solved

Similar Questions

Using numpy, write function npv to compute the net present value of a set of cash flows given their timing and a single discount rate with continuous compounding.

Discounted cash flows applicationsNet present Value calculations have a broad range of applications in finance.Calculate the NPV of the project based on the information below.Initial investment: $20,00Cash flow generated each year: $5,000Total period: 5 YearsDiscount rate: 6%

You are designing a new product and want to estimate the net present value of the first year of future sales. You think you could make your first sale a year from now, and would have$5000in revenue (sales) each month. For a nominal annual discount rate of10%, compounded monthly, the net present value of that first year of sales is [NPV]. Answer to the nearest whole dollar. Hint: first draw the cash flow diagram; the first arrow up should be att=13months and the last att=24months.

What is the cash flow of a 8-year bond that pays coupon interest semiannually, has a coupon rate of 6%, and has a par value of $100,000?

Calculate the cash price, accrued interest, market price, and determine the amount of the bond premium or discount of a bond with a face value of 80,00080,000 , coupon rate of  2.91%2.91%  that was issued on January 15th, 1990 and matures in 1515 years, if it is sold on January 15th, 1992 with a market rate of 7.08%7.08% . Assume that all interest rates and payment frequencies are compounded semi-annually and that the redemption price equals the face value.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.