# Tag Info

## Hot answers tagged simulations

13

To complement @SRKX comment ,i'll try to explain the "simple mathematical proof" beetween both formula : I assume you know the geometric or arithmetic brownian motion : Geometric: \begin{equation*} dS = \mu S dt + \sigma Sdz \end{equation*} Arithmetic : \begin{equation*} dS = \mu dt + \sigma dz \end{equation*} Then another important stochastic tool you ...

12

I think to understand the martingale/local martingale distinction, it helps to bring in a third class of processes, the uniformly integrable martingale. I would argue that the local martingale and the non-uniformly integrable (true) martingale are actually fairly similar. The key property that a uniformly integrable martingale has is the so-called closure ...

10

It depends on the purpose of your simulation. If you want to model the asset price path for pricing some derivative then you need the risk-neutral measure (thus you take the risk-less rate as drift). Why? Because the risk-neutral measure makes your pricing compatible with the pricing of other contracts in the market. It makes the prices consistent. If ...

9

I'm not completely certain from your question, but I'm going to assume you have a basket of $n$ stocks with prices $S_0(t)$ to $S_n(t)$, and you want to price an option with payoff at $C(\tau)$ at time $\tau$ equal to \begin{align} C(\tau) = \max\Bigl({\frac 1 n}\sum^n_{i=1} S_i - K, 0\Bigr) \end{align} where $K$ is the strike of the option I'm also going to ...

8

In general these are the two basic approaches to QuantFinance: Sell side (market maker, risk neutral): You use risk-neutral probabilities ("$\mathbb{Q}$") e.g. in option pricing (to e.g. calculate your greeks and hedge your portfolio), so that you live on the spread. Buy side (market/risk taker): You use real-world probabilites ("$\mathbb{P}$") for e.g. ...

8

Yes, the term Brownian Bridge seems to be used loosely. I assume you are talking about continuously monitored barriers by the way, since you mention the probability of the barrier being crossed in between the path time points. If that's the case then "naive" Monte Carlo simulation will have what is called "simulation bias". That's exactly because the ...

6

For completeness, let's restate that the discrete case goes like this: $$\Delta S_t = S_{t+\Delta t}- S_t = \mu S_t \Delta t + \sigma S_t \sqrt{\Delta t} Z_t$$ with $Z_t \sim \mathcal{N}(0,1)$ What you are doing in your case is to use the exact solution of the SDE to model the movement between two points of $S$. Essentially, you are doing the same thing ...

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 Is there a place online where you can simulate strategies programmatically? Your best choice is most likely a service such as Quantopian or QuantConnect. Quantopian provides equity and futures data and allows you to program trading strategies in Python, run risk management analysis and backtests. The latter option, QuantConnect, has support for Python as ... 6 I agree with wrong formula in simulation, but think i understand the question. Here's my take on it: The reason SDE may seem to allow a negative value of x is because dW can be a large negative number, and thus can move x from positive to negative values. If that's the confusion, that is justified only in discrete case. Do a thought experiment. Imagine ... 6 You probably wonder whether \mathbb{E}^\mathbb{P}[P_T\mid\mathcal{F}_t]= \mathbb{E}^\mathbb{Q}[P_T\mid\mathcal{F}_t]. Note the T as index, i.e. the future unknown payoff and not the current price P_t. Now, why should P_t be a martingale under both, \mathbb{P} and \mathbb{Q}? Most likely, it is not. Indeed, the reason why you use \mathbb{Q} in ... 6 Just to add to the answer by @Kevin : There are at least two things going on here. First of all let \{Q_i \} denote a set of equivalent probability measures, which includes your P and Q above. Any F^i(t) defined as F^i(t) = E_t^{Q_i} [P_T] will be a martingale by application of the tower law. With the definition above, it will not be the case ... 6 What does 'simulate a covariance matrix' mean? If the question means, generate an arbitrary correlation matrix for 1000 stocks, then we can choose any symmetric matrix with all 1s down the diagonal, so long as every element is between -1 and 1 and the matrix is positive semi-definite. The large size of the matrix means that putting random values in every ... 5 When I run this simulation I see the same results, and it makes sense. For the straight 50%/50%, I found that my win ration was about 38% and my loss ratio 61%. The reason it wasn't 50/50 was that if I had consecutive up flips my value could keep going up, but if I had consecutive down flips I would 0 out and the sequence would have to end as I had lost ... 5 Note: There is a typo in your third equations. Instead of S(u) it should be S(t_{i}) and in place of S(t) there should be S(t_{i+1}). In fact, given S(t_{i}) we have that$$S(t_{i+1}) = S(t_{i}) \exp\left( (\mu - \frac{1}{2} \sigma^2) (t_{i+1} - t_{i}) + \sigma (W(t_{i+1}) - W(t_{i})) \right)$$is the exact solution of the SDE. Hence, the ... 5 Try Quantum for Quants, which has contributions from people working actively in quantum computing, and some small scale examples solved on the D-Wave Systems Quantum Annealer. The picture below is from an article on Finding Arbitrage Opportunities using a Quantum Annealer (the link is on the Q4Q main page). The annealer can solve certain graph theory ... 5 this is a well-known problem. One solution is to make volatility zero when rates exceed a certain high level. It's less problematic than it looks because any cash-flows generated will be divided by a rolling money market account which has huge value and so the deflated cash-flows are very small. 5 This approach is rather crude. It only takes the mean and volatility of the historical returns and assumes a very simple model. I'm not sure if you have much experience with Time Series, but your returns series is a Time series. You can now perform tests on these log returns to ensure you can continue with Time series models. One very simple model is ARMA. ... 5 From the equations of the model it is clear that v_t is the instantaneous variance of the log-returns, not the terminal annualised variance of the log-asset price. Put differently, you are you confusing$$ v_t \approx \text{var}(\ln(S_{t+\delta t}/S_t))/\delta t $$with$$\text{var}(\ln(S_t))/t$$presumably because in the Black-Scholes framework these ... 5 Try Quantlib https://www.quantlib.org, it comes with everything you need. 5 In my understanding, the mortgage prepayment option, at any point in time, is a function of the value of the mortgage from that point in time forward. This value, in turn, is a function of the future evolution of the interest rates and any optimal decision taken by the mortgagor along that path and all paths that evolve from any future 'branch'. So in ... 5 You have misunderstood the statement in Matsumotos original paper. The original Mersenne twister guarantees, over its period of 2^{19937}-1 (a number which I am sure you will agree is larger than the length of any Monte Carlo sequence ever devised), that every 623 dimensional uniformly distributed tuple occurs a fixed number of times, with each single ... 5 [I think] the problem is with the SDE, rather than the numerical scheme At a glance, and as I commented, I think the issue you are coming up against stems more from the underlying SDE rather than the numerical approximation scheme. To explain this a bit more, let's quickly revisit the SDE$$ \mathrm{d}S_t = \sigma(t, S_t) \,\mathrm{d}W_t $$with some given ... 4 This however, goes against the conventional wisdom that variance becomes smaller as you hold the portfolio longer. Which conventional wisdom says this? If the variance decreases with time, then the likelyhood of getting a return close to the expected return increases (Cecbycev's inequality). So you are telling me, I know more about the long-time future as ... 4 There are a lot of methods for simulating such a process, the real problem here is to preserve positivity of the next simulated step as the Gaussian increment might result in negative value and then a non definite value for the next "square-root" step. An approach that might be suitable to your more general needs is the following where a "consistent-domain"... 4 EQ1 is uni-variate case. EQ2 is multivariate case, in which you have to use correlated X_t. His way of doing is making Y_t independent so that you can simulate freely. He does so by finding PC on \Delta. Alternatively, you could generate correlated X_t in your simulation. To benchmark your model / code, you should first test and reproduce a given ... 4 As a short summary and adaption of the question: You better redefine \hat{r}_i= \frac{S_{i-1}}{S_1}-1 and \hat{S}_i = (1+\hat{r}_i)S_0. The above definition of \hat{S}_i yields a sample of potential values for S for the future day. This approach is usually applied in historical simulation. The aim here is to use information of the past about the ... 4 The formula is given in your link. For the real world probability without jump:$$x_t = x_{t-1} e^{-\eta \Delta t} + \hat{x}(1-e^{-\eta \Delta t}) +\sigma \sqrt{\frac{1-e^{- 2 \eta \Delta t}}{2 \eta}} N(0,1)  where: $x_t$: price $x_{t-1}$: PreviousPrice $\hat{x}$: long term mean (a parameter) $\Delta t$: Time step (one fraction) $\eta$: ...

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