views:

1256

answers:

9

Given a set of datavery similar to the Motley Fool CAPS system, where individual users enter BUY and SELL recommendations on various equities. What I would like to do is show each recommendation and I guess some how rate (1-5) as to whether it was good predictor<5> (ie corellation coeffient = 1) of the future stock price (or eps or whatever) or a horrible predictor (ie corellation coeffient = -1) or somewhere inbetween.

Each recommendation is tagged to a particular user, so that can be tracked over time. I can also track market direction (bullish / bearish) based off of something like sp500 price. The components I think that would make sense in the model would be:

user
direction (long/short)
market direction
sector of stock

The thought is that some users are better in bull markets than bear (and vice versa), and some are better at shorts than longs- and then a cobination the above. I can automatically tag the market direction and sector (based off the market at the time and the equity being recommended).

The thought is that I could present a series of screens and allow me to rank each individual recommendation by displaying available data absolute, market and sector out performance for a specfic time period out. I would follow a detailed list for ranking the stocks so that the ranking is as objective as possible. My assumtion is that a single user is right no more than 57% of the time - but who knows.

I could load the system and say "Lets rank the recommendation as a predictor of stock value 90 days forward"; and that would represent a very explicit set of rankings.

NOW here is the crux - I want to create some sort of machine learning algorithm that can identify patterns over a series of time so that as recommendations stream into the application we maintain a ranking of that stock (ie. similar to correlation coeeficient) as to the likelihood of that recommendation (in addition to the past series of recommendations ) will affect the price.

Now here is the super crux. I have never taken an AI class / read an AI book / never mind specific to machine learning. So I cam looking for guidance - sample or description of a similar system I could adapt. Place to look for info or any general help. Or even push me in the right direction to get started...

My hope is to implment this with F# and be able to impress my friends with a new skillset in F# with an implementation of machine learnign and potentially something (application / source) I can include in a tech portfolio or blog space;

Thank you for any advice in advance.

+4  A: 

I understand monkeys can pick better than most experts, so why not an AI? Just make it random and call it an "advanced simian Mersenne twister AI" or something.

T.E.D.
Yes, anyone who thinks this would work should read a book like A Random Walk Down Wallstreet. You really can't beat the market in the long term. Edit: oops, should have clicked the link, it actually mentions the book
swampsjohn
But what are the chances that two monkeys type shakesphere in the same week? http://en.wikipedia.org/wiki/Infinite_monkey_theorem
akaphenom
if you think monkeys are good at nothing.. check this out, monkey beats human in poker - http://www.youtube.com/watch?v=JEaKxNYD2lk
Anurag
@T.E.D. Apparently rats don't do half bad either: http://www.rattraders.com/
Lirik
How do you explain consistent winners? I agree its not stock picking. But you can get an edge.
Steve
+2  A: 

If you want to go down this long, dark, lonesome road of trying to pick stocks you may want to look into data mining techniques using advanced data mining software such as SPSS or SAS or one of the dozen others.

You'll probably want to use a combination or technical indicators and fundamental data. The data will more than likely be highly correlated so a feature reduction technique such as PCA will be needed to reduce the number of features.

Also keep in mind your data will constantly have to be updated, trimmed, shuffled around because market conditions will constantly be changing.

I've done research with this for a grad level class and basically I was somewhat successful at picking whether a stock would go up or down the next day but the number of stocks in my data set was fairly small (200) and it was over a very short time frame with consistent market conditions.

What I'm trying to say is what you want to code has been done in very advanced ways in software that already exists. You should be able to input your data into one of these programs and using either regression, or decision trees or clustering be able to do what you want to do.

DTown
I think this is more of a quesiton of me wanting the experience of building it or thinking through the system. When learning a new language (F#) it always is more fun to have a project to try and apply it to. And better yet - if I can acquire some knowledge on machine learning at the same time all the better.here exists (from a stocking picking contests) a whole bunch of dated recommendations (buy this / sell that). Each individual contributor either did fundamental analyis or picks stocks they are familiar with. My app should detect which relationships are important...
akaphenom
does anyody think this problem subjects itself to the supervised machine learnign domain? Or am that far off?
akaphenom
+3  A: 

If I knew the answer, do you think I would be sharing it here? :)

Mikos
+2  A: 

How will you handle the fact that at the moment you start using your system, you have altered the system and therefore the model under which your AI operates is not valid anymore?

Hans
I don't know how I will handle any of this. That is the question - I probably shouldn't have used stock picking example, which is causing more static than necessary.... I am trying to learn what I need to know.
akaphenom
That's a sharp observation that most people don't realize. However, as long as he doesn't use his system to host his own "Mad Money" tv show, and only uses it privately, it's unlikely to violate causality enough to negate the results.
Chris S
@Hans, the only way to "alter the system" is if you actually invest money. Unless you're investing A LOT of money, you will probably not have a significant impact on the system... or at least the impact will be so minimal that you can ignore it.
Lirik
@Lirik Agreed. But look at it this way, either one person invests a lot of money based on their program, or that person shared that program with many people who all invest a little money.
Hans
@Hans Of course don't forget the option of trading with a little bit of your money (i.e 20-30k). But even if they become large enough to impact the market, they can minimize the impact with various techniques: e.g. placing iceberg orders... commonly used by institutional traders who **would** have an impact on the system if they placed **huge** orders.
Lirik
+12  A: 

My Advice to You:
There are several Machine Learning/Artificial Intelligence (ML/AI) branches out there:
http://www-formal.stanford.edu/jmc/whatisai/node2.html

I have only tried genetic programming, but in the "learning from experience" branch you will find neural nets. GP/GA and neural nets seem to be the most commonly explored methodologies for the purpose of stock market predictions, but if you do some data mining on Predict Wall Street, you might be able to utilize a Naive Bayes classifier to do what you're interested in doing.

Spend some time learning about the various ML/AI techniques, get a small data set and try to implement some of those algorithms. Each one will have its strengths and weaknesses, so I would recommend that you try to combine them using Naive Bays classifier (or something similar).

My Experience:
I'm working on the problem for my Masters Thesis so I'll pitch my results using Genetic Programming: www.twitter.com/darwins_finches

I started live trading with real money in 09/09/09.. yes, it was a magical day! I post the GP's predictions before the market opens (i.e. the timestamps on twitter) and I also place the orders before the market opens. The profit for this period has been around 25%, we've consistently beat the Buy & Hold strategy and we're also outperforming the S&P 500 with stocks that are under-performing it.

Some Resources:
Here are some resources that you might want to look into:

The Chatter:
The general consensus amongst "financial people" is that Artificial Intelligence is a voodoo science, you can't make a computer predict stock prices and you're sure to loose your money if you try doing it. None-the-less, the same people will tell you that just about the only way to make money on the stock market is to build and improve on your own trading strategy and follow it closely.

The idea of AI algorithms is not to build Chip and let him trade for you, but to automate the process of creating strategies.

Fun Facts:
RE: monkeys can pick better than most experts
Apparently rats are pretty good too!

Lirik
+2  A: 

I have been thinking of this for a few months.

I am thinking about Random Matrix Theory/Wigner's distribution.

I am also thinking of Kohonen self-learning maps.

Blessed Geek
A: 

These comments on speculation and past performance apply to you as well.

BCS
+13  A: 

I have an MBA in Finance, and am an economist, programmer and data miner.

  1. Trying to pick stocks is a bad idea. Goldman Sachs will beat you. Yes, Goldman spends hundreds of millions on AI a year. Google "Goldman Sachs singularity"

  2. However, a lot of companies have made a lot of money on pair trading (find a pair of assets that normally correlate, and buy/sell pair when they diverge). See the writings of Ed Thorpe (of Beat the Dealer). He runs a hedge fund now. What you want to do is avoid the assets that everyone else is playing with, so find a niche.

  3. There is probably some room in using data mining to predict companies that will default (and shorting them), and also predicting companies that will lose value after an IPO (and shorting them). There are known biases that can be exploited. Search google scholar for "predict distress" etc. Also, look into capital structure arbitrage.

Key is, find a niche that the big boys are not playing in.

And for the love of God, please read Fooled By Randomness by Taleb.

el chief
+1  A: 

Much more money is made by the sellers of "money-making" systems then by the users of those systems.

Instead of trying to predict the performance of companies over which you have no control, form a company yourself and fill some need by offering a product or service (yes, your product might be a stock-predicting program, but something a little less theoretical is probably a better idea). Work hard, and your company's own value will rise much quicker than any gambling you'd do on stocks. You'll also have plenty of opportunities to apply programming skills to the myriad of internal requirements your own company will have.

joe snyder