明日の1ユーロは今日の1ユーロではない
年5%で運用できるなら、今日の100は1年後に105になります。したがって1年後に約束された105は、今日の価値では100にすぎません。これが割引で、そのお金が稼げたはずの利息を取り除いて、将来の金額を現在価値に換算することです。年率 r、t 年なら PV = cash / (1 + r) ** t です。債券、ローン、年金、恩給はすべてこの方法で値付けされ、次のトピックで扱う債券とオプションの価格付けの土台になります。
def present_value(cash, rate, years):
return cash / (1 + rate) ** years
print(round(present_value(100, 0.05, 3), 4)) # 86.3838 100 received in 3 years, worth 86.38 today
print(round(present_value(100, 0.05, 0), 4)) # 100.0 no waiting, no discount
print(round(present_value(100, 0.10, 3), 4)) # 75.1315 a higher rate discounts harder正味現在価値
実際の投資は一連の流れで支払われます。債券はクーポンと最後の元本を払い、プロジェクトは今お金がかかり、数年かけて戻ってきます。正味現在価値(NPV)は、各キャッシュフローをそれぞれの時点で割り引いて合計したものです。最初を時点0としてフローを並べると、時点は 0, 1, 2, ...(np.arange(len(flows)))となり、配列全体を1回の呼び出しで割り引けます。NPVが正なら投資は割引率より多く稼ぎ、負なら少ししか稼ぎません。金利が上がるとNPVは下がります。
import numpy as np
flows = np.array([-100.0, 30.0, 40.0, 50.0]) # pay 100 now, receive 30, 40 and 50 over the next three years
times = np.arange(len(flows)) # 0, 1, 2, 3
for rate in (0.08, 0.12, 0.20):
print(rate, round((flows / (1 + rate) ** times).sum(), 3))
# 0.08 1.763 positive: worth doing at 8%
# 0.12 -5.738 negative: not at 12%
# 0.2 -18.287 the higher the rate, the lower the NPV将来への複利と連続金利
将来へ進むのは鏡像で、FV = PV * (1 + r) ** t です。利息が表示金利 r で年 m 回支払われるなら、各期は r / m を稼ぎ、期数は m * t なので FV = PV * (1 + r / m) ** (m * t) です。支払いが頻繁なほど少し多く増え、5%の100は年1回で105.00、月次で105.12、日次で105.13になります。連続払いの極限では成長係数が exp(r * t)、割引係数が exp(-r * t) となり、時間をまたいでうまく掛け合わせられるため、オプション価格付けで使われる形です。
import math
for m in (1, 2, 12, 365):
print(m, round(100 * (1 + 0.05 / m) ** (m * 1), 4))
# 1 105.0
# 2 105.0625
# 12 105.1162
# 365 105.1267
print(round(100 * math.exp(0.05), 4)) # 105.1271 continuous compounding, the limit
print(round(math.exp(-0.05 * 3), 5)) # 0.86071 the continuous discount factor for 3 years
print(round(100 * (1 + 0.05 / 12) ** (12 * 3), 3)) # 116.147 100 grows for 3 years with monthly interest# How long to double the money at 5%? Exactly ln 2 / ln 1.05, roughly 72 / 5
print(round(math.log(2) / math.log(1.05), 2), round(72 / 5, 1)) # 14.21 14.4ln(1 + r) や exp(r) - 1 を使いましょう。PV = cash / (1 + r) ** t:後のお金ほど価値が低く、金利が高いほど強く割り引かれる- NPV = 割引後フローの合計(最初は時点0):
(flows / (1 + r) ** np.arange(n)).sum()。正なら実行する価値がある FV = PV * (1 + r / m) ** (m * t)。連続:成長exp(r * t)、割引exp(-r * t)。規約を常に明記する
次は債券価格です。クーポンの流れと最終元本を市場金利で割り引きます。
ラボ:採点される内容
present_valueで将来の支払いを現在に引き寄せる25点npvで一連の支払いを評価する25点future_valueで利息を複利で将来に伸ばす25点continuous_discount_factorで連続的に割り引く25点