## Wednesday, May 9, 2012

### Stock market as a combination of waves

I had this idea that the price of a stock reflects the fact that people are trying to buy it when the price is low and sell it when the price is high. Fewer and fewer people buy it as the price rises until eventually at it's peak more people start to sell it than buy it and the price begins to go down. This is starting to sound like sin(t) behavior or a wave. In calculus terms the change of rate that people are buying the stock is negatively proportional to the price of the stock, just as the second derivative of sin(t) is -sin(t).
But there are many different agents who have different evaluations of what is considered a "high" price and a low price so the overall stock price should be built from a bunch of sin waves of different shapes. In math when we want to handle this kind of thing we use Fourrier analysis.
Here is a graph of Apple's stock price over a year.
See it looks very chaotic but when you run it through Fourrier analysis it comes out like:
Now the interesting thing is this above function shouldn't be too hard to find a function that matches it. In Maple I find:

I haven't put it through Fourier transform software to see how well this predicts the variation of the price over time yet, though.
The long and short of this whole thing is if you took 234^(1/f) and did the inverse Fourier transform on it, that should be a function that more or less looks like Apple's stock price over time.