Hot answers tagged

6

It really, really, really depends on your parameters, i.e. $r$, $\sigma$, $K$, $T$, $S_0$. For example, here are some results from implementing the stopping criteria I explain in my answer here. These are the number of iterations requires in order for there to be an approximate 0.95 probability that the MC call price differs from the exact call price by ...


6

You have the right idea, but it seems you don't know $\mu$, so using it in your error check doesn't seem correct. Also, checking the result every 10,000 iterations may not be optimal for deciding when to stop. To be clear, let $E(X) = \mu$ and $Var(X) = \sigma$. We're invoking the CLT when we write $$ P\left( \left|\frac{\bar{X}_n - \mu}{\sigma/\sqrt{n}}\...


6

By definition, the payoff of a log-contract of maturity $T$ writes $$ \phi(S_T) = \ln\left(\frac{S_T}{S_0}\right) $$ Let $\Pi_t$ denote the $t$-value of such a contingent claim. We are interested in the price at $t=0$, best known as the option premium. Theory tells us that the latter premium can be computed as $$ \Pi_0 = e^{-rT} E^{\mathbb{Q}} \left[ \phi(...


6

I believe that the confusion arises because of the wrong treatment of NIG. The answer to the question you link is misleading, as it simulates under P which is not appropriate for option pricing. None of the NIG parameters under P carries over to Q in general, but especially the drift is the problem here. First use the mom gen function of NIG to find the ...


5

I wouldn't repeat the same algorithm on Excel, because if you make a mistake in your Python code, it's likely that you'll also make the same mistake in your Excel code. Quants usually test an implementation with an analytical formula (not always possible). You should start off with something easy by pricing an European option with your MC algorithm. You ...


5

American calls on a non-dividend paying stock are worth the same as European ones so there is no point to using least-squares.


5

You should see this as a comment to @Kiwiakos answer which already hit the bull's eye. In the SE question you're referring to and to which I have answered, the idea was simply to provide you with a sound way of simulating returns out of a NIG distribution. It so happens that, for whatever your reason was, you decided to calibrate your NIG parameters based ...


5

[Short answer] IMHO there is a fundamental problem with wanting to extract a sound implied volatility figure out of a deep ITM option's price. You should use out-of-the-money forward options (OTMF) instead: put options for strikes smaller than the forward price (left wing of the volatility surface) and call options otherwise (right wing of the volatility ...


4

First you need to correct the formula to: $$ W_t^2 = \rho W_t^1 + \sqrt{1-\rho^2} Z_t, $$ where $Z_t$ is a BM independent of $W_t^1$ If you calculate the variance and the covariance, then you see that it is true: $$ V[W_t^1] = t $$ and $$ V[W_t^2] = \rho^2 t + 1-\rho^2 t = t, $$ which is the desired variance. For the covariance you get $$ Cov[W_t^1,W_t^2] =...


4

Here is the general approach you can follow to generate two correlated random variables. Let's suppose, X and Y are two random variable, such that: $$X \sim N(\mu_1, \sigma_1^2)$$ $$Y \sim N(\mu_2, \sigma_2^2)$$ and $$cor(X,Y)=\rho$$ Now consider: $y=bx + e_i$, where $x$ $(=\frac{X-\mu_1}{\sigma_1}$) and $y$ $(=\frac{Y-\mu_2}{\sigma_2}$) both follow ...


4

Surely what is meant is that the 100 components are pairwise correlated but the 1000 draws are independent.


4

You are trying to price an option through Monte Carlo simulations. Here is how it should work, assuming the Black-Scholes diffusion framework. Under the Black-Scholes model's assumptions, the value of a risky asset $S$ at the time $t=T$ is a random variable which reads $$ S_T = S_0 e^{\left(\mu-\frac{\sigma^2}{2}\right)T + \sigma \sqrt{T} Z}\tag{1}$$ with ...


4

Typically when running a Monte Carlo simulation we might simulate an SDE similar to $$ \dfrac{dS}{S} = \mu\:dt + \sigma \: dW(t) $$ by some appropriate method (e.g. Euler-Maruyama, Milstein, etc). We notice by dimensional analysis that if $t$ is in units of $\textrm{years}$ then $\mu \sim \textrm{years}^{-1}$ and $\sigma \sim \textrm{years}^{-1/2}$. ...


3

you just add in any auxiliary variables accumulated along the path that determine the pay-off to the regression variables. So path-dependence is not a problem. If you have previous decisions, you may need to do different regressions based on their possible values or make them into a continuous variables that can be used for regression.


3

Yes you can! Any SDE that has an analytic solution can be simulated exactly. The vasicek model has dynamics $dr=a(b-r)dt+\sigma dW_t$. By Ito's lemma, $$d\left(e^{at}r\right)=e^{at}\left(a(b-r)dt+\sigma dW_t\right) +a e^{at} r dt$$ Simplifying, $$d\left(e^{at}r\right)=e^{at} ab +e^{at}\sigma dW_t$$ Integrating, $$e^{aT} r_T=r_0+b(e^{aT}-1)+\sigma \int_0 ...


3

Yes, your solution is correct, given the implementation of McSimulation and the interface of SequenceStatistics. We should probably have defined SequenceStatistics as returning instances of Array... As you might have seen, trying to return std::vector<Real> from the path pricer wouldn't work; the result type needs to define arithmetic operations such ...


3

A butterfly in general has a payoff of the form \begin{align*} (X_T-K_c)^+ + (K_p-X_T)^+-(X_T-K_{atm})^+-(K_{atm}-X_T)^+, \end{align*} where $X_T$ is the asset value at maturity $T$, while $K_c$, $K_p$, and $K_{atm}$ are strike levels.


3

I believe the question to be too vague to be a good interview question. If you want to do Mean Variance Optimization (MVO) it's hard to see the point of Monte Carlo simulation. One of the good thing of MVO is its analytic tractability. Clearly, the topic is not widely discussed as this Google Search has this question as the first result (I was in incognito ...


3

it certainly works best at the money. Why? I think it comes from the fact that Black's formula is approximately linear at the money. The approximation $$ \frac{1}{\sqrt{2\pi}} \operatorname{SR} \sigma \sqrt{T} A, $$ with $A$ the annuity is remarkably good. One way of deducing these formulas is to do an asymptotic/Taylor expansion about $\sigma=0.$


3

The ADF test assumes the DGP $$ \Delta y_t = \alpha +\beta t +\gamma y_t +\delta_1 \Delta y_{t-1}+\cdots +\delta_k \Delta y_{t-k}+\epsilon_t $$ The parameters are estimated using OLS on a sample of length $T$. You might impose $\alpha=0$ and/or $\beta=0$, this will give you different null hypotheses to test. But your test is always $\gamma=0$, and the ...


2

You don't say anything about the model or discretization so it is a little hard to judge. However, if you are using an exact discretization, the time step-size should be irrelevant. If you are using an approximate one, the more steps you use, the more accurate it should get. Possible sources of error: 1) random number generator is not good enough and ...


2

First let me say that in the Black-Scholes model as you have it, there is of course no need for intermediate steps when pricing vanilla calls, since the SDE has the closed-form solution you included. Intermediate steps would be required for complicated payoffs or other SDEs. To answer your question though, you do need to use additional dimensions. Think ...


2

This will depend on the nature of the problem. You already mention a perfectly good strategy - observe your current estimate after N samples - did it change significantly? If you have a grasp of the scale of the answer to the problem then you may be able to set a convergence criteria on the basis of this change. However let's say you have a far out of the ...


2

Since you are using geometric brownian motion (GBM) as your model, there is a strong (and therefore weak) solution to the SDE. That is to say, your simulation that presumably looks like $$ S^A_T \sim S^A_0 \exp\left( \left(r-q-\frac12 \sigma^2\right) T + z \sigma \sqrt{T} \right) $$ for standard gaussian $z$ has precisely the correct distribution. ...


2

As your code works for the short maturity case, I assume that it is correct. The volatility of $80 \%$ is simply huge. Thus the area covered by the paths is huge too. As you can read e.g. here the sampling error is proportional to the variance of the process, which is huge in your case. As a brute force solution you can just enlarge the number of samples. ...


2

This question has already been answered on Stack Overflow. As it is important to Quant Finance, so I have added R code here. Others users may add code of other programming software to simulate ARMA(1,0)-GARCH(1,1) model. sim.GARCH <- function( horizon=5, N=1e4, h0 = 2e-4, mu = 0, omega=0, alpha1 = 0.027, beta1 = 0.963 ){ ret <- zt &...


2

Two comments: Normal returns should always be in $[-1,+\infty)$. I believe that the way you sample $R_i$ from Stable directly violates that. You might want to sample $\log (1+R_i)$ from Stable instead. The question is very poorly worded. For the sampling distribution of a percentile you can invoke order statistics. It will follow a transformation of Beta ...


2

What you describe is a very simple quasi monte carlo, where the 'random' points are equally spaced in probability space. Like numerical integration. Sometimes you can use it, but in general you will need the cumulative distribution to do percentile mapping. This very frequently is not known in closed form, and can be very expensive to compute numerically. ...


2

I would definitely recommend Volopta as a reliable source of self-contained and commented financial engineering source codes (useful for prototyping/understanding but clearly not production code). I have for instance copy-pasted, the explicit PDE solver you are looking for (centred in space, backward in time) below (+ edited for clarity + improved ...



Only top voted, non community-wiki answers of a minimum length are eligible