import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings(action='ignore')
import yfinance as yf
import matplotlib.pyplot as plt
daily = pd.DataFrame()
daily['Close'] = yf.download('^IXIC')['Close']
daily['Return'] = np.log(daily['Close'] / daily['Close'].shift())
daily
monthly = pd.DataFrame(columns=['date', 'return', 'volatility'])
returns = []
for i in range(1, len(daily)-2):
today = daily.index[i].month
tomorrow = daily.index[i+1].month
if today == tomorrow:
returns.append(daily['Return'].iloc[i])
else:
returns.append(daily['Return'].iloc[i])
monthly.loc[len(monthly)] = [daily.index[i], np.sum(returns), np.std(returns)]
returns=[]
c = 1.
monthly['active'] = c / monthly['volatility'].shift() ** 2 * monthly['return']
monthly['active'] = monthly['return'].std() / monthly['active'].std() * monthly['active']
plt.figure(dpi=150)
plt.plot(monthly['date'], monthly['return'].cumsum(), label='passive')
plt.plot(monthly['date'], monthly['active'].cumsum(), label='volitility-managed')
plt.legend()
plt.xlabel('date')
plt.ylabel('cumulative returns')
Several studies have examined the economic value of volatility timing and found that it can add value to a portfolio. One study [1] measured the value of volatility timing as the estimated fee that a risk-averse investor would be willing to pay to switch from the ex-ante optimal portfolio to a volatility-timed portfolio. The study found that the value of volatility timing is positive and significant, indicating that it can improve the performance of a portfolio. Another study [2] considered two utility-maximizing volatility timing strategies based on maximizing the conditional expectation of benefits. The study found that both strategies can generate significant utility gains relative to a buy-and-hold strategy, indicating that volatility timing can be a profitable investment strategy. Another study [3] employs advanced statistical and machine learning methods to predict stock market volatility and utilizes these predictions for asset allocation and portfolio construction. It suggests that high-dimensional models, with a focus on the LASSO model, provide superior forecasts of market volatility, leading to enhanced investment performance, particularly when adjusting portfolios based on volatility timing. The study's findings have implications for investors and portfolio managers seeking to improve risk-adjusted returns in their investment strategies. However, some experts argue that timing the market is impossible [4]. They argue that trying to time the market based on volatility is a costly mistake and that investors should focus on long-term investment strategies instead of trying to predict short-term market movements.
In conclusion, volatility timing is an investment strategy that aims to adjust the exposure of a portfolio based on the volatility of the market. It involves calculating the standard deviation of the market returns, calculating the active return of the stock, standardizing the active return, and plotting the passive and active returns cumulatively over time. While some studies suggest that it can add value to a portfolio, others argue that it is impossible to time the market and that investors should focus on long-term investment strategies.
Have questions? I will be happy to help!
You can ask me anything. Just maybe not relationship advice.
I might not be very good at that. ??