Thursday, January 3, 2008

Predicting the stock market

J.P Morgan was once asked what the stock market will do. He replied 'It will fluctuate'. This statement I think is the most perfect prediction ever done for a stock market. Since then, there have been a thousands of theories and formulas that took a shot at predicting the market direction. But none of them worked.

Well, now let me take a stab at predicting the short term future.



Here are my assumptions:
  • Market works on sentiments
  • Bad news about a company pushes the stock down
  • Good news about a company pushes the stock up.

Now the theory:

  • Look at the history of a stock performance
  • Gather the news at the begining of every upward trend and downward trend.


  • Categorize these news into the buckets of gain or loss based on how they affected stock historically.

  • After we've got all the news bucketed, run Bayesian filtering algorithms on each bucket data. The data in buckets will train our Bayesian filters. (Exactly the way email spam filtering works).

  • Monitor the news in realtime. We can do that using RSS news feeds. Google news, Yahoo news and AP news do a good job of proving RSS feeds for any stocks tickers.
    Then try to match the new news to determine what bucket it fits in.

  • That's it!

The code should be pretty simple for this implementaion. Then we can run it patiently for a 3 months and measure the performance.

No comments: