13

I found out what I was doing wrong - the OLS function was regressing with no intercept value - so I had to use the "add_constant" method to add an intercept term to the X series (z_lag) as follows: z_lag = np.roll(z_array,1) z_lag[0] = 0 z_ret = z_array - z_lag z_ret[0] = 0 #adds intercept terms to X variable for regression z_lag2 = sm.add_constant(z_lag) ...


10

Well, "mean reversion trading" could mean a lot of things, I am not qualified to describe it in full generality. However, there is a simple model of mean reversion called the Ornstein Uhlenbeck process that is often seen. It has two parameters \lambda and \sigma, where lambda is the strength of the mean reversion (so one over lambda is the mean reversion ...


10

$\theta$ is the "mean" for this process. If $X_t > \theta \implies (\theta - X_t) < 0 $, which means that the drift for the process is negative and tends towards $\theta$. The opposite case can be made for $X_t < \theta$ ; the process will have positive drift when $X_t$ is below $\theta$. Therefore we can consider $\kappa$ to be the "speed" of mean ...


9

A very popular choice for mean reversion is the Ornstein–Uhlenbeck process (here in discretized form): $$L_{t+1}-L_t=\alpha(L^*-L_t)+\sigma\epsilon_t$$ Here you see that the level change is governed by some parameter $\alpha$, the mean reversion rate (or speed), and the distance between the long run mean $L^*$ and the actual level $L_t$ plus some noise. A ...


9

Concerning your first question, this depends on what curve, currency, etc. you are interested in. The general method for constructing yield curves is called bootstrapping which allows you to derive spot, zero-coupon rates from the known price of coupon-bearing instruments $-$ such as bonds or swaps. In general: You start picking short-term (typically less ...


8

Mean reversion speed $\kappa$ is better interpreted with the concept of half-life, which can be calculated from $\text{HL} = \ln(2) / \kappa$. For example, if the mean reversion coefficient is $\kappa = 1.5$, then the half-life of the process is $\ln(2) / 1.5 = 0.46209812$ years, or about 6 months. Let's assume that the current interest rate is 1% and the ...


8

Similar to Juan Gil's answer but a bit differently I would say the following based on this: The OU process $$dX_t = \kappa(\theta-X_t)dt + \sigma dW_t$$ can be (Euler-Maryuama discretization) discretized at times $n \Delta t,n=1,\ldots,\infty $ which gives with $t = k \Delta t$ $$ X_{k+1} - X_k = \kappa \theta \Delta t -\kappa X_k \Delta t + \sigma (W_{k+1} ...


7

Within the fixed income space, there's a lot of literature on PCA trading. The first 2-3 principal component factors (PCs) can typically explain 90-99% of the total variances in yield curve movement. It's also nice, because the first PC looks like a change in the overall level of the yield curve, the second PC looks like a slope change, while the third ...


7

From the SDE \begin{align*} \frac{dS_t}{S_t}= k(\theta-\ln S_t) dt + \sigma dW_t, \end{align*} where $\{W_t,\, t\ge 0\}$ is a standard Brownian motion, we obtain that \begin{align*} d(e^{kt}\ln S_t) = ke^{kt} \Big(\theta -\frac{1}{2k}\sigma^2\Big) dt + \sigma e^{kt} dW_t. \end{align*} Then, \begin{align*} \ln S_T = e^{-k(T-t)} \ln S_t + \Big(\theta -\frac{1}{...


6

For a Ornstein-Uhlenbeck process, the maximum likelihood parameters are the ones from least squares regression. If your process is: $$ dX=\kappa (\theta-X)dt+\sigma dW $$ you can do a linear regression in the form $$ \frac{dX}{dt}=a+bX+\epsilon $$ So your parameters will be: $$ \kappa=-b $$ $$ \theta=-\frac{a}{b} $$ $$ \sigma=std(\epsilon dt) $$


6

A few possibilities - Trading costs kill your returns (often a problem for very highly correlated securities) Mean reversion of the cointegration spread is either very weak, or happens over periods which are too long to be practical, or there is no mean reversion whatsoever. For example, consider the following two securities, which are clearly very ...


6

You could use the two factor model of Schwartz-Smith. It's a very standard model in commodities, where you observe this kind of long term mean reversion (where "long-term" is here around a year). It's a mean reversion model where the long-term mean reversion is itself a brownian proccess. This way you can have the desided stochasticity in the short term, ...


5

The concept of 'mean reversion' is tricky in continuous time. Most people would call 'mean reverting' a process where the drift pulls back towards a long run mean, and I assume that this is what you also mean. Something like the drift of an OU process. However, in continuous time the 'pull' can be generated by the volatility. For example the process $$ dX_t ...


5

Joshi is correct. The no arbitrage argument implies that the stock price instantaneous return under the risk neutral measure is equal to the short rate, and the girsanov theorem implies that the instantaneous volatility $\sigma$ is the same under the historical measure and under the risk neutral measure, so under the risk neutral measure the stock price is a ...


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


4

The claim that interest rates don't follow long term trends is not consistent with observed data. The idea of mean reversion is that interest rates do not rise or fall without bound, but are limited by economic and political factors. But there is no indication that this oscillation of short rates should happen around a constant mean. Allowing the mean ...


4

A negative mean reversion makes the dynamics of the asset explode. If the model is: $$dr=[\theta-\alpha r]dt+\sigma dW $$ The expected value in this model is: $$\mathbb{E}(r)= r(0) e^{-\alpha t} + \frac{\theta}{\alpha} (1-e^{-\alpha t} )$$ If $\alpha<0$ $\mathbb{E}(r)$ goes to $\infty$ or $-\infty$, depending on if $r(0)$ is above or below the "long ...


4

One economic model you could look at is the Habit model of Campbell and Cochrane (1999). The basic idea is that as the consumption of the representative investor approaches the (appropriately defined) habit level of consumption the representative investors risk aversion spikes: this means discount rates increase dramatically and we see a big drop in stock ...


4

The point of confusion may be in thinking that a predictable price process is synonymous with a mean-reverting process while using the definitions in these papers, it's actually the opposite! In the context of these papers, a random walk would be 100% predictable: the unpredictable component of a random walk (i.e. the period specific shock which has finite ...


4

Given a initial discount bond $P^M(0, T)$ curve, the expression for $\theta(t)$ in the Hull White Short Rate model is a know result given by: $$ \theta(t) = \frac{1}{\kappa} \cdot f'(0, t) + f(0, t) + \frac{1}{2} \cdot \left( \frac{\sigma}{\kappa} \right)^2 \cdot \left( 1 - e^{-2 \kappa t} \right). $$ I have used a notation where the spot rate dynamics is ...


3

If two or more (I(1)) time series are cointegrated, then this means that you can find a linear combination of them that is mean-reverting. Thus, if you create a portfolio with weights that are proportional to this linear combination, then the portfolio returns will also be mean-reverting. There is a large literature on cointegration and asset prices and ...


3

Using https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process#Solution $$X^i_t = (X^i_0 + \int_0^t\sigma_i e^{a_i u} dB^i_u)e^{-a_it} $$ and $$ X^i_t-\mathbb{E}[X^i_t] = e^{-a_it} \int_0^t\sigma_i e^{a_i u} dB^i_u $$ and thus : $$\text{Cov}(X^1_t,X^2_t)=\mathbb{E}\left[e^{-a_1t} \int_0^t\sigma_1 e^{a_1 u} dB^1_u e^{-a_2t} \int_0^t\sigma_2 e^{...


3

EDIT: My reasoning below seems to be wrong. The process as you write it tends to infinity if $a$ is big enough and positive and if $\lambda_0$ is positive. I would not call this process non-meanreverting OU. It is just an Ito process of a simple form. If we remove the stochastic part then we get $$ d\lambda_t = a \lambda_t dt $$ with the solution (if $\...


3

if you just want to test for significance of the generation of returns exceeding a hurdle rate then you can just setup a standard hypothesis test where you test whether your returns you generate from back tests exceeds a certain return. if you are more interested in testing for co-integration then you should consider the Johansen and/or Engle-Granger tests ...


3

1) The reversion speed $\eta$ is just a scaling factor >0 to control the sensitivity to mean deviations, it has no unit as such. 2) There are various simulation formulas in your reference link. Can you please specify which of these you want to simulate?


3

Let's consider the following example: the process is initialized randomly with $\pm1$ and then stays there forever. Seems stationary to me, but it would never cross its mean.


3

Assuming $\theta>0$ (take $\tilde{X}=\mu-X$ if it is not the case) Let us denote $\text{erfi}(x)$ the imaginary error function Let us denote $\tau_L$,resp.$\tau_U$ the hitting time of $L$resp.$U$ where $L<U$ 1) Using Ito's lemma, prove that : $$Y_t = \text{erfi}\left(\sqrt{\frac{\theta}{\sigma^2}}\left(X_t-\mu\right)\right) \text{ is a martingale}$$ ...


3

There are some slight inaccuracies in using term basis. You probably meant strategies which profit from carry/futures roll. There are a lot of variations of carry/roll strategies on different markets. I can point you to: 1/ FX carry - can be easily traded using futures 2/ Term structure/carry in commodities 3/ Term structure/carry in bond futures 4/ Term ...


3

Of course. Even if you started dollar neutral, the spread can continue to move away from its mean resulting in losses. Pairs trading isn't an arbitrage situation, it simply asserts that given correlated assets, their spread will revert to the long run mean if and when it does deviate.


3

By mean reversion, people usually mean to say that some price process is second order stationnary -- even though they do not always know the technical term for it. It's only vague in the sense that this defines a class of processes, but doesn't pin down any specific process. By momentum, people usually mean a process which follows trends: upward movements ...


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