8
$\begingroup$

I have a random walk that is generated as so using python, numpy, and matplotlib

def random_process():
    a = 0
    b = 104         #replicate starting point of SPY shown later
    rho = 0.995     #empirically good number
    X, Y = [], []

    aSamples = np.random.normal(size=sample_size)
    bSamples = np.random.normal(size=sample_size)

    for i in range(0, sample_size):
        X.append(i)
        Y.append(a + b)

        a = a * rho + aSamples[i]
        b = b + rho * bSamples[i]

    plt.plot(X, Y)
    plt.show()

This generated the following plot

Random Walk

The walk of the b variable means that it is not guaranteed to return to any value.

I also generated a plot for the SPY index based on daily data for the year 2010

SPY index

How are these plots objectively different? How would one be able to tell that the first plot is generated at random and that it is impossible to predict the direction of the next value?

Is attempting to build a strategy that looks exclusively at in-sample stock data as futile as trying to predict the next value of the first plot?

$\endgroup$
  • $\begingroup$ Is your question "how are these plots objectively different [by eyeballing]?", or "is quantitative trading futile?" Stock market return distributions are very different from your generator, but that probably won't help you trying to trade them. $\endgroup$ – experquisite Oct 27 '14 at 1:39
  • 3
    $\begingroup$ You look at 250 data points. If you look at a longer term time frame you will notice the absence of upward drift in your random data model vs the drift component that partly drives equity (and its index) returns. For higher frequencies the quantity of "white noise" increases and a portion of any researcher's job becomes to apply suitable filters in order to isolate the time spans when non-random pricing data allow for alpha extraction. $\endgroup$ – Matthias Wolf Oct 27 '14 at 4:24
  • $\begingroup$ Hello Mark! Welcome to Quant.SE. Hope that the answers are useful for you. If you find them helpful please free to upvote them and accept one of them. Thank you and looking forward to future interactions with you here :-) $\endgroup$ – vonjd Oct 27 '14 at 18:47
  • $\begingroup$ One notable difference is that spy can be plotted with little error using correlating data, where as nothing correlates to your random walk. The market isn't so much random as it is efficient. $\endgroup$ – Blaze Jul 31 '15 at 23:43
5
$\begingroup$

I think the main difference even in this little example is the gain-loss asymmetry which is a known stylized fact: When you look at the big bump both time series posses your artificial one is perfectly symmetric whereas the real one takes longer for going up and then crashes in a relatively shorter time frame.

This is a known phenomenon in real financial time series. You can find more here:

What Can Be Learned from Inverse Statistics? by Peter Toke Heden Ahlgren, Henrik Dahl, Mogens Høgh Jensen, Ingve Simonsen

Unfortunately the article is not free but you can at least access the abstract (and some may be able to access it anyway).

More pages of the article can be found here (p. 247ff.): Google books

Edit
More similar papers can be found here:
http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=327148

$\endgroup$
  • $\begingroup$ If this was true, should I expect to see a negative skew on a sample of price deltas from SPY? $\endgroup$ – Mark Dunne Nov 11 '14 at 23:07
  • $\begingroup$ I did some of my own research and these two statements are not equal. I found that SPY has a positive skew, but there is still a very significant time to 5% gain/loss asymmetry. This asymmetry is not present in the output generated by my code $\endgroup$ – Mark Dunne Nov 12 '14 at 0:21
2
$\begingroup$

For both time-series, just plot the log returns. You will see that one is not a Random-Walk .. the S&P500 since you will get values that far beyond the normal distribution. Just watch this video by Benoit Mandelbrot (starting at 11min:54sec). Looking at both graphs, your eyes can fool you making you believe that both are generated by Random Walks...

$\endgroup$
  • 1
    $\begingroup$ Yes and no: In general you are of course right but financial markets can be in different regimes. When you only take 250 trading days selectively it could well be that they are mainly from a "normal" regime. In fact you could model financial time series and their stylized facts with a mixture of 2 to 4 Gaussian distributions quite well. $\endgroup$ – vonjd Oct 26 '14 at 21:30
  • 1
    $\begingroup$ You can have a random walk with a non-normal distribution. However, if the non-normal distribution is the result of some underlying process (like regimes per @vonjd or stochastic volatility), then it would not be a random walk anymore. $\endgroup$ – John Oct 27 '14 at 16:37
0
$\begingroup$

You have just luckily created 1 path of the random walk by chance that fitted the S&P. You can create another random walk and it will look much different.

The efficient markets hypothesis predicts that stock prices behave as random walks, so it is likely that S&P looks similar to that. However, one cannot predict the next step to make a profit, because the next step is always purely random up or down.

$\endgroup$
  • $\begingroup$ I can create many different walks, few of which look like the SPY index, but all look indifferentiable from legitimate stock data. This plot was not a fluke as your answer seems to suggest. I was under the impression that trying to predict the next step / overall trend was the point of a quant. Is this wrong? $\endgroup$ – Mark Dunne Oct 26 '14 at 15:31
  • 1
    $\begingroup$ @MarkDunne Yes there are some market inefficiencies left, where one can apply complex mathematical models to achieve some profit by forecasting. However, such efficiencies will vanish over time, and the series will become more and more random as suggested by efficient markets hypothesis. Also, it is known that random walk has no prediction, since the distribution around the current value is perfectly symmetric normal. Quants are also employed in arbitrage-free derivatives pricing and risk management practices, mostly to program code. $\endgroup$ – emcor Oct 26 '14 at 16:05
  • 1
    $\begingroup$ That is not what EMH states (that future prices follow a random walk). Even the statement in Wiki is plain wrong: "This implies that future price movements are determined entirely by information not contained in the price series. Hence, prices must follow a random walk." Just because future prices may not be a function of past prices does not infer future prices to follow a random walk. $\endgroup$ – Matthias Wolf Oct 27 '14 at 4:29
-1
$\begingroup$

That is not a random walk. There is serial correlation in your number generator. A true random walk will not show this

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.