[PYTHON] Financial engineering verified the claim that "leveraged mutual funds are disadvantageous in a volatile market"

Recently, I saw a title-like claim on Twitter. Basically, such a claim is doubtful, but also in the article of Japan Exchange Group (https://www.jpx.co.jp/equities/products/etfs/etf-outline/04-04.html). There was a similar claim, and I thought it might be credible to some extent. The purpose of this article is to examine this claim from a financial engineering perspective. Therefore, please note that it has a strong mathematical aspect and is not suitable for the purpose of actually making money. Also, since the author is studying financial engineering, please point out any inadequacies.

What is a leveraged investment trust?

The above article will be helpful in understanding leveraged mutual funds. Simply put, the leverage ($ r $ times) index is an index that gives a return obtained by multiplying the daily fluctuation rate (return) by the ratio of $ r $ times. For example, if TOPIX goes from 100 points to 110 points (+ 10% fluctuation), the TOPIX leverage (double) index will fluctuate by + 20%. Therefore, while it is possible to aim for a larger return than investing in the underlying index (TOPIX in this case), there is a risk because the same leverage effect works for negative fluctuations.

The title claim is explained in the above article as shown in the image below. Indeed, in this case we can see that the leveraged performance is diminishing. 日本取引所.jpg However, even after receiving this explanation, I had the following complaints.

In this article, the goal is to give answers to these.

Mathematical modeling

I would like to model the above phenomenon by the geometric Brownian motion that is often used in financial engineering. It is generally known that financial indicators such as TOPIX can be modeled by the following Geometric Brownian motion:

dS_t = \mu S_t dt + \sigma S_t dW_t

However, $ S_t $ is a financial index, $ \ mu $ is the expected rate of return, $ \ sigma $ is the volatility, and $ dW_t $ is the increase in Brownian motion. Roughly speaking, $ dW_t $ is a random number that follows $ dW_t \ sim \ mathcal {N} (0, \ sqrt {dt}) $ (see financial engineering textbooks for the exact description). ). The simplest way to discretize this stochastic differential equation is: $ S_n = (1 + \mu \Delta t + \sigma \sqrt{\Delta t} \xi_n )S_{n-1} $ However, $ S_n $ is an index at time $ n $, $ \ Delta t $ is a discretized time step, and $ \ xi_n $ is a random number that follows a standard normal distribution. Here, we will consider about one year as the time scale, and handle the time of about one day as the time step $ \ Delta t $. In other words, it is about $ \ Delta t \ simeq 1/360 . At this time, if the fluctuation of the leverage ( r $ times) index is $ R_t , it can be modeled from the definition as follows: $ R_n = (1 + r \mu \Delta t + r \sigma \sqrt{\Delta t} \xi_n) R_{n-1} $$ By this modeling, we can confirm that the daily return is certainly multiplied by $ r $. Also note that it is similar to multiplying the expected rate of return $ \ mu $ and the volatility $ \ sigma $ by $ r $, respectively. Obviously, $ r = 1 $ corresponds to the underlying index.

Also note that an analytical solution is required for the underlying index: $ S_t = S_0 \exp [ (\mu - \sigma^2/2) t + \sigma W_t] $ The probability distribution $ p (S) $ follows a lognormal distribution as follows: $ p(S) = \dfrac{S_0}{\sqrt{2 \pi \sigma^2 t} S} \exp \left[ -\dfrac{1}{2\sigma^2 t} (\log S/S_0 - (\mu - \sigma^2/2)t )^2 \right] $

Confirmation by simulation

Some parameters were confirmed by simple simulation with jupyter. As a condition of the simulation, the initial value is $ S_0 = 100 $, the expected rate of return is $ \ mu = 1.0 $, the simulation is performed $ 8000 $ times under a fixed value, and the value of $ \ sigma $ is changed. See the code for details. An analytical solution (log-normal distribution) is also shown to confirm the results. prob_density(sigma=0.50).jpg prob_density(sigma=0.60).jpg prob_density(sigma=0.80).jpg As is clear from the figure, as the volatility $ \ sigma $ increases, the probability distribution of the leveraged $ R $ shifts to the left, that is, the performance deteriorates. Therefore, ** I was able to confirm the claim that the leverage type is disadvantageous in a volatile market **. I will also show the code for the time being. The plot part of the graph is not essential and will be omitted.

Code for simulation


mu = 1.0 #Expected rate of return
sigma = 0.8 #Rate of change
T = 1.0 # 1 year
days = 365 # 1 day
dt = 1.0 / days #Step size

S0 = 100.0 #Initial conditions
num_sample = 8000 #Number of sample paths
S_data = np.zeros(num_sample) #Intrinsic data
R_data = np.zeros(num_sample) #Leveraged indicator(r times)data from
r = 2.0 #How many times the leverage type

for i in range(num_sample):
    S = S0
    R = S0 #The initial conditions are complete
    for d in range(days):
        xi = np.random.randn()
        S = S*(1.0 + mu*dt + sigma*xi*np.sqrt(dt))
        R = R*(1.0 + r*(mu*dt + sigma*xi*np.sqrt(dt)))
    S_data[i] = S
    R_data[i] = R

def lognormal(S, S0, mu, sigma, T):
    return np.exp(-((np.log(S/S0) - (mu-0.5*sigma*sigma)*T)**2.0) / (2.0*sigma*sigma*T) ) / (np.sqrt(2.0*np.pi*sigma*sigma*T)*S)
pdf_S = lognormal(S_grid, S0, mu, sigma, T)
pdf_R = lognormal(S_grid, S0, mu*r, sigma*r, T)

Conditions for leveraged mutual funds to be "disadvantageous"

Of the first two questions, one (that is, confirmation for many sample paths) was achieved, but the other (that is, the condition that the leverage type is "disadvantageous") is not well understood. Therefore, we define that leveraged mutual funds are "disadvantageous" as follows: ** A leverage ($ r $ times) indicator is "disadvantageous" if the indicator is held until time $ T $, the probability that the value will be smaller than the original indicator $ p $ exceeds $ 1/2 $. That's what it means. ** (This definition may not be good enough. I would like to know if there is a better way to define it.)

Now, it is understood that the stochastic differential equation of leverage ($ r $ multiple index) should be multiplied by $ r $ of the expected rate of return $ \ mu $ and the volatility $ \ sigma $ in the stochastic differential equation of the original index. It is. In addition, since an analytical solution is required for the stochastic differential equation of the original index, the leverage type is set for each value of $ r $ in the risk / return plane (that is, the plane of the parameters $ \ mu $ and $ \ sigma ). You can find areas that are "disadvantageous". Based on the above, the figure below shows the boundary line where the probability that the value of the leverage type ( r $ times index) is smaller than the original index is $ 1/2 $ at time $ T $.

critical_line.jpg

From this figure, it can be confirmed that when the expected rate of return $ \ mu $ is constant and the volatility $ \ sigma $ becomes large, it becomes "disadvantageous". Furthermore, we can see that the tendency becomes more pronounced as $ r $ increases. In other words, it can be confirmed that the area where leveraged investment trusts are "disadvantageous" (the area where $ p> 1/2 $ is) will expand. From the above, it was confirmed that ** leveraged investment trusts are "disadvantageous" in a volatile market **. In particular, note that ** we were able to determine "advantages / disadvantages" according to market conditions $ \ mu $ and $ \ sigma $ **. The "theory" in the figure was calculated as follows. Similar to the analytic solution of the underlying index $ S_t , the leveraged ( r $ times) index can also be parsed: $ R_t = S_0 \exp [ (r \mu - r^2 \sigma^2 /2) t + r \sigma W_t ] $ When comparing the coefficients of $ t $ in the exponential part with $ S_t $ and $ R_t , the condition that they are equal is as follows: $ \mu = \dfrac{1}{2}(1+r) \sigma^2 $$ The plot of this for each value of $ r $ is the "theory" in the figure. From the graph, we can see that this explains the borderline of $ p = 1/2 $ very well, but we still don't know why this explains it. I'm sorry for the code. The part that outputs the graph is omitted.

import numpy as np
from scipy.stats import lognorm
import matplotlib.pyplot as plt

S0 = 100
T = 1.0 # 1 year
r1 = 2.0
r2 = 4.0
num_sample = 2000

num_grid_param = 200
mu_start = 0.0
mu_end = 6.0
mu_list = np.linspace(mu_start, mu_end, num_grid_param)
sigma_start = 0.01
sigma_end = 2.0
sigma_list = np.linspace(sigma_start, sigma_end, num_grid_param)

params_critical1 = []
params_critical2 = []

def calc_params_critical(r):
    params_critical = []
    for sigma in sigma_list:
        print("sigma = {:.3f}".format(sigma), end = "\r")
        for mu in mu_list:
            B = np.random.randn(num_sample)*np.sqrt(T)
            S = S0*np.exp((mu-sigma*sigma*0.5)*T + sigma*B)

            mu_r, sigma_r = r*mu, r*sigma
            R = S0*np.exp((mu_r-sigma_r*sigma_r*0.5)*T + sigma_r*B)
            prob = sum(R < S) / num_sample #Probability of inferior leveraged performance

            if mu == mu_start:
                prob_old = prob
            else:
                if (prob-0.5)*(prob_old-0.5) < 0.0:
                    params_critical.append([sigma,mu])
                prob_old = prob
    params_critical = np.array(params_critical)
    return params_critical

params_critical1 = calc_params_critical(r1)
params_critical2 = calc_params_critical(r2)

Summary and attention

By simple modeling, we verified the claim that "leveraged mutual funds are disadvantageous in a volatile market." As a result, it was confirmed that the claim was correct under this modeling. In addition, by appropriately defining "disadvantage", it is possible to quantitatively determine "advantage / disadvantage" for each value of the expected rate of return $ \ mu $ and volatility $ \ sigma $, which represent the market conditions. It's done. In particular, it was confirmed that the area of "disadvantage" expands as the leverage ratio $ r $ increases. This is considered to justify the claim at the beginning. Furthermore, by comparing the exponential part of the analytical solution, the analytical solution with the boundary line $ p = 1/2 $ was obtained.

Note that the above analysis is all about a mathematical approach. It may be more interesting to find $ \ mu, \ sigma $ from the distribution of daily returns, but I'm not very interested in it, so I won't touch it. Also, it may be interesting to verify using actual TOPIX data, but it is troublesome, so I will do it if I feel like it.

Recommended Posts

Financial engineering verified the claim that "leveraged mutual funds are disadvantageous in a volatile market"
Financial Forecasting Feature Engineering: What are the features in financial forecasting?
A collection of Numpy, Pandas Tips that are often used in the field
A solution to the problem that files containing [and] are not listed in glob.glob ()