29

The way you do it in the first place is a discretization of the Geometric Brownian Motion (GBM) process. This method is most useful when you want to compute the path between $S_0$ and $S_t$, i.e. you want to know all the intermediary points $S_i$ for $0 \leq i \leq t$. The second equation is a closed form solution for the GBM given $S_0$. A simple ...


24

Monte Carlo is most useful when you lack analytic tractability or when you have a highly multidimensional problem. For example, even using simple lognormal and poisson models, there exist path-dependent payoffs or multi-asset computations such that no analytic solution exists and such that any PDE finite difference solution would require 3 or more ...


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

We cannot give you a relative bid-ask spread that would make sense. The reason for that is that it really depends on several parameters: The type of financial asset you invest in (futures, funds, index, options, ...) The period during which you're trading (I think the liquidity in markets hasn't been the same over time). If you trade intraday, it depends on ...


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


7

Consider a $T \times N$ matrix of potentially cointegrating prices $P$. Define $Y_{t}\equiv ln\left(P_{t}\right)$. In the multivariate framework, there are two basic methods to estimate the cointegrating relationships. The first is an error correction framework of the form $$\Delta Y_{t} = \beta_{0}+\beta_{1}\Delta Y_{t-1}+\beta_{2}Y_{t-1}+\varepsilon_{t}$$ ...


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

One way to construct cointegrated timeseries it to use the error-correction representation (see Engle, Granger 1987 for details of the equivalence). To generate two timeseries that are cointegrated, start with your cointegrating vector $(\alpha_1, \alpha_2)$ so that you want $\alpha_1x_t + \alpha_2y_t$ to be stationary; choose initial values $x_0, y_0$ and ...


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

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

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

Normally, one uses MC methods when: Analytical solutions do not exist PDE style solutions also don't work (they are usually still faster than MC) You need to price some exotic, but computation time does not matter (MC methods are easy(-ier) and fast to code-up) Note: Using MC is not free of assumptions: you always assume a distribution for the driving ...


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

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

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

Just to add to the answer by @KeSchn : 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 ...


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

I take it you want to do a Monte-Carlo simulation. You just need to decide of an unit of time $dt$ and then start simulating the path. $dW_t$ is simulated using a random normal value. In Excel $N\left(\mu, \sigma\right)$ would be simulated by NORMINV(rand(), mu , sigma). For your Poisson process you just have to simulate random numbers between 0 and 1 and ...


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

Before answering your questions directly i would like to briefly restate the idea of the resampled efficent frontier: One of the problem with classical mean variance optimization is (even if the multivariate normal assumption holds) that you cant estimate $\mu$ and $\Omega$ (which is usually denoted as $\Sigma$) exactly. Thats why you incur estimation ...


4

The common practices are: if you trade less than 8% of the Average Daily Volume, you can use a VWAP or Implementation Shortfall algo. you need to "add" a slippage of 1/3 of the bid ask spread of the stock. Your only issue is that you want to use the close price instead of the VWAP one. Best option is to use the daily VWAP as a proxy. Otherwise measure the ...


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