Given historical daily returns, how can I calculate the portfolio allocation for a single stock position, based on not losing more than 10% of the starting portfolio value over 21 days? (with 95% confidence.)
Based on some starting code of e.g.
import numpy as np
from scipy.stats import norm
returns = [-0.01, -0.02, -0.01, 0.04, 0.02, 0.01, -0.03]
mu = np.mean(returns)
std = np.std(returns)
valueAtRisk = norm.ppf(0.05, mu, sigma)
However, the above only tells me my risk for 1 day. My question goes in the other direction; what can I allocate given the distribution of returns, assuming that I don't want to lose more than 10% over 21 days.
I would prefer an answer that can be computed directly, but a Monte Carlo answer would be acceptable.
Thanking you kindly for your help.
Assuming returns are independently and identically distributed (i.i.d.), then the volatility of T days equals to the product of sqrt(T) times one-day-volatility.
Alternatively, you can do bootstraps. That's randomly select 21 days from historical dataset, calculate the return over this randomly drawed 21 days. Plot the histogram and get the 5% quantile.