## How to Calculate the Present Value using Python

You can use the following template to calculate the Present Value using Python: FV = Future Value r = Interest Rate n = Number of Periods PV = FV/(1+r/100)**n print (PV) Steps to Calculate the Present Value using Python Step 1: Gather your Data To start, you’ll need to gather the data for the Present … Read more

## How to Calculate NPV using Numpy (with example)

You can use the following template to calculate the NPV using Numpy: import numpy as np npv = np.npv(discount rate,[initial investment in negative terms, cash flow for each year separated by comma]) print (npv) Let’s now review a simple example with the steps to calculate the NPV. Steps to Calculate the NPV using Numpy Step … Read more

## How to Calculate the IRR using Numpy

Here is a simple template that you can use in order to calculate the IRR using numpy: import numpy as np irr = np.irr([initial investment in negative terms, cash flows each year separated by commas]) print (irr) Steps to calculate the IRR using Numpy Step 1: Install the numpy package If you haven’t already done … Read more

## How to Calculate the Bond Duration (example included)

In this short post, you’ll see how to calculate the bond duration. More specifically, you’ll see how to calculate the: Macaulay duration; and Modified duration To start, here is the formula that you can use to calculate the Macaulay duration (MacD): (t1*FV)(C) (tn*FV)(C) (tn*FV) MacD = (m*PV)(1+YTM/m)mt1 + … + (m*PV)(1+YTM/m)mtn + (PV)(1+YTM/m)mtn Where: m = … Read more

## How to Calculate the Bond Price using Python

In this short guide, you’ll see how to calculate the bond price using Python. Calculate the Bond Price using Python Here is a template that you can use to calculate the bond price using Python: m = Number of payments per period (e.g., m=2 for semiannually payments) t = Number of years to maturity ytm … Read more

## How to Calculate the Bond Price (example included)

You can use the following equation to calculate the Bond Price: PMT x [1 – (1 + i)-N] Bond Price = i          +  FV x (1 + i)-N Where: N = (Number of payments per period) x (Number of years to maturity) i = (Interest rate or YTM) / (Number of payments per … Read more