I'm in a financial IT company and I'm dealing with derivatives, but I've learned a lot about the theory of derivatives, so I will write down the explanation and the program in Python for review and creation of educational materials. By the way, we will do it based on publicly available information such as books. Therefore, it has nothing to do with work know-how.
First: Calculation of forward exchange rate- 2nd: Draw a yield curve (JPYLibor curve)
Forward exchange is the exchange rate of exchange at a certain point in the future.
The forward exchange rate (FwdFX) can be calculated from the current exchange rate, the spot exchange rate (SpotFX), and the interest rates of both currencies.
For example, when calculating the conversion rate between dollars and yen
FwdFX(USD/JPY) = SpotFX(USD/JPY) × DF(USD) / DF(JPY)
Can be calculated with.
Although it is called interest rate, interest rate does not come out, and instead, something called DF is coming out, DF is a discount factor, It's like a hook used to discount the value at a certain point in the future by the current value. The future 1 million yen and the current 1 million yen have interest rates, so they are not equal in value. So how much is the future value of 1 million yen? At times, the value can be calculated with a DF that costs 1 million yen. And DF can be calculated from the interest rate. The story around DF is different, so I won't talk about it anymore. I will proceed on the premise that I know it.
Let the current exchange rate be S (1 dollar S yen), the period be T (year), the yen spot interest rate on a continuous compound interest basis for T years be Ry, and the dollar spot interest rate be Rd.
(1) If you convert the yen fund S yen you have at the moment into dollars and operate it for T years
S \times \frac{1}{S} \times e^{RdT} = e^{RdT}(Dollar)
Will be.
(2) When operating in yen for T years
S \times e^{RyT}(Circle)
Will be.
Here, let X (X yen per dollar) be the exchange rate after T years.
Since the same result (*) is obtained between operating yen by converting it to dollar (1) and operating it by yen and converting it to dollar (2).
S \times e^{RyT} \times \frac{1}{X} = e^{RdT}
Is established.
Therefore, the forward exchange rate X is
\begin{align}
X &= S \times e^{-RdT} \times \frac{1}{e^{-RyT}} \\
&= S \times \frac{Dfd}{Dfy}
\end{align}
It is calculated by the spot exchange rate x DF (dollar) / DF (yen).
# -*- coding: utf-8 -*-
import numpy as np
#Various data
SFX= 120 #Spot exchange rate
ry = 0.01 #Yen spot interest rate
rd = 0.05 #Dollar spot interest rate
T = 1 #period
#One year continuous compound interest rate(R)The spot interest rate(r)Calculate from.
"""
e^RT = (1+r)^T
RT = ln(1+r)
R = ln(1+r) / T
"""
Ry = np.log(1 + ry) / T
Rd = np.log(1 + rd) / T
#The discant factor is e^Because it is calculated by RT
DFy = np.exp(-Ry * T)
DFd = np.exp(-Rd * T)
#Forward exchange rate is spot exchange rate x DF(Dollar) / DF(Circle)Because it is calculated by
FFX = SFX * DFd / DFy
print(FFX)
Recommended Posts