Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to compute the valuation of a cash flow in the presence of a wealth tax.
import numpy as np
from numpy.linalg import solve
def vmat(n, discount_rate, tax_rate):
m = np.zeros(shape=(n,n))
discount = tax_rate*np.exp(-1*discount_rate*np.arange(n))
for i in range(n):
m[i, i:n] = discount[0:n-i]
m[i,i] = 1
return m
def remaining_cashflow(cash_flow, discount_rate):
_discount = np.exp(-1*discount_rate*np.arange(len(cash_flow)))
return np.convolve(cash_flow, _discount[::-1])[len(cash_flow)-1:]
def valuation(cash_flow, discount_rate, tax_rate):
"""
Returns the valuation of a cash flow, as well as the current NPV of a cash flow, for a given cash flow sequence given as input.
"""
return solve(vmat(len(cash_flow), discount_rate, tax_rate), remaining_cash_flow(cash_flow, discount_rate))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment