Hot answers tagged

6

the problem is that the pay-off has discontinuous first derivative. Try a contract with pay-off that is twice differentiable and it will probably work. The problem is that all the value comes from the tiny number of paths within $\Delta S$ of the strike, and these paths have huge value. This is a well-known problem. As the bump size goes to zero, the ...


5

By definition the fair value of an option is given by an expectation value of the payoff, $\mathbf{E}\left[\textrm{payoff}(\textit{paths})\right]$. The probability distribution of the paths is the risk neutral measure. This is just an integral expression of the form you wrote. This applies to all option prices. Many options are, of course, special in the ...


5

Yes, this technique is called moment matching variance reduction and it may indeed lead to a form of variance reduction. The first and second order moments correspond to the mean and the variance of the distribution. You can extend to higher order moments, which is of course more difficult to implement and creates some extra overhead. The mean can be adjust ...


5

importance sampling is well known to be tricky. See the extensive discussion in Glasserman's book. I presume that you are simply meanshifting and multiply by the ratio of normal densities. For this sort of problem, I'd use a more stratified algorithm instead and force every path to end in the money. To do this I'd compute the uniform that goes to 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

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 ...


4

the LIBOR market model the Heston model -- Euler and Milstein are actually bad for this and much more sophisticated methods are necessary local volatility models


4

You don't need to use the Sobol sequence to generate quasi-random numbers in MATLAB. We know the Heston model is represented by the bi-variate system of stochastic differential equations (SDE): \begin{align} & d{{S}_{t}}=rS_tdt+{\sqrt\upsilon_t} d{{W}_{1}}(t) \\ & d{{\upsilon}_{t}}=\kappa(\theta-\upsilon_t) ...


3

In inflation world, the deal payoff is always based on a certain lag convention. That is, the value $I(T)$ always refers to a published index level several months ago or is interpolated based on those published index levels. For example, for a payoff on July 15, 2015, the indexed level referred is the published index level for May, 2015, based on the 2m ...


3

Sigh. I'm not sure that there's a best way to do multi-threaded MC in QuantLib. I'm afraid that you're underestimating the amount of development you'd need for option 2. You're not going to get away with some OpenMP code as you suggest, because calculations on different paths are not trivially parallel: the RNGs we have are not parallel, and even if you ...


3

You can calibrate the model by discretizing in time, and using a forward induction method as originally proposed by Jamishidian in 1991: F.Jamshidian, Forward Induction and Construction of Yield Curve Diffusion Models, J.Fixed Income 6, 62-74 (1991). Although he formulated this induction in the language of the binomial tree, the method is more general, and ...


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

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 - ...


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

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.


2

This sounds correct, however step 2 is a little vague, so I will try to restate the steps here for you. The assets in your portfolio must be priced with respect to a set of risk factors (e.g. interest rate curve). Each scenario consists of a value for each of your risk factors. Given the value of your risk factors you can price your portfolio. You want ...


2

To keep things simple let's assume you have a perfect random number generator (i.e. I will discuss only the statistics not the numerics of the problem). I will also focus on the practical matter and gloss over some mathematical details. From a practical perspective "convergence" means that you will never get an exact answer from Monte-Carlo but ...


2

the output of an MC simulation depends on the random numbers used and if the distribution used is not too weird, after 10,000 runs you will get an answer that is distributed $$ \mu + \frac{\sigma}{\sqrt{n}} Z, $$ with $Z$ a standard normal. Here $n=10,000.$ With $\mu$ the quantity you want and $\sigma$ the standard deviation. So you won't get precisely the ...


2

You should write some kernel functions in CUDA (Nvidia language) for your matlab code. Arrayfun is quite restrictive and not appropriate. Look at this link http://fr.mathworks.com/help/distcomp/run-cuda-or-ptx-code-on-gpu.html for more details about matlab and parallel computing.


2

We set out a general scheme for doing this sort of thing in our paper http://ssrn.com/abstract=1401094 and its sequel http://ssrn.com/abstract=1437847 Whilst the case studied is different, the techniques are the same. I also discuss in detail the whole process in a chapter of More Mathematical Finance. The adjoint method when it applies is generally ...


2

For a swap, we have a sequence of re-setting and payment dates. The # of forward rates corresponding to the # of payment dates. For example, let us assume that we have $n$ payment dates $t_1, \ldots, t_n$, where $0< t_1 < \cdots < t_n$. Then there are $n$ forward rates. During the simulation, for time steps prior to $t_1$, there exist $n$ ...


2

For non-normal asset price models you could look at the theory of Lévy-processes. If we assume that you work in the physical probability measure $P$ and that the random numbers that you have generated are daily log-returns, then you can do the following: Asset $i$ has starting price $S_0^i$ and for the future prices you can put $$ S_t^i = S_0^i ...


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. ...


1

Your Vega of 188.48 is correct, in the sense that matches my calculation. What it means is that if the volatility increase by 1 (i.e. by 100 percentage points, from 19.14% to 119.14%) the call will increase by 188 dollars. Obviously that is an unrealistic move. More realistically if the volatility increases by 0.01 (i.e. 1 percentage point, from 19.14% to ...


1

first, there is a formula for the continuously monitored case. second, if you use log coordinates the Euler discretization is exact so this should be done. third, the convergence for discretely monitored to continuously is actually very slow so you will need a lot of steps. fourth, it's actually better to draw the hitting time to the barrier rather than ...



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