Finding Undervalued Stocks With Claude AI (Value + Momentum Investing)
- 30:44
Debs and Graham build an investment screen with Claude and run it across the S&P 500. The prompt was two lines: produce a value and momentum screen, pull fundamentals from the SEC API and market data from a free source. Claude chose the factors, built the scoring and generated the dashboard. Debs, who is quick to point out she is not a coder, did the setup in Power Query.
Downloads
No associated resources to download.
Transcript
You can have a great thesis. You can be 100% correct in terms of your thesis, but be completely wrong in terms of the actual investment results.
Have you ever had something where Claude or GPT said, "This is just a crappy idea.
Don't do this"? I am not a coder. I am not someone who has Python coding skills or anything like that. I've done a little bit of Visual Basic in my time.
But what Claude did was basically provide a screen that does pull in data from an API.
How do we determine if something is good value or is just a crappy company? Retail investors can and do now build their own screens, but even now have the ability to connect the outputs of their screens to their trading platforms.
You can, in theory, trade automatically off the back of your investment screening.
You've got to make sure you've got a lot of conviction here before you actually use one of these tools to pull the trigger.
Thanks to all our listeners for joining us for this week's episode of "What's The Big Deal?" Graham, please do tell our listeners, what is it that we're going to be talking about this week? What is the big deal? I'm really excited for this week. We are going to switch gears a little bit.
We're still going to use AI to help us with some of this finance work, but we're going to talk public market investing.
Now, this is something I really don't know too much about.
Of course, I do at a high level, but in terms of some of the detail that goes into how you pick a company to invest in, how you, in essence, make the decision to pull the trigger on buying a public stock, it's not something I've done a whole lot of. All my experience is private market.
So I'm really excited to talk to you about this today.
I know. And we're going to be using AI to enhance our discussions.
Of course, where would we be without Claude? And Claude's going to be just running some screens.
That's going to be the focus of our discussions, isn't it? How we can screen to identify investment opportunities in the public markets.
So let's start off with a little bit about what screens are.
Maybe that's probably a good place to start the discussion, isn't it, Graham? Yeah. And at a high level, you can think about this, whether we're talking public market, private market. We're going to talk about a certain number of factors that we're going to apply that will let us filter down a potential universe of investments and really create a shortlist that's going to help us decide whether or not we want to invest.
Now, in the private market investing that I used to do, we had some overall themes in terms of sectors that we liked more than others.
We'd look at most stuff across sectors.
Now, this is going to vary massively depending on the individual firm or the house.
Some only play in certain sectors. We looked at pretty much everything.
But ultimately, we weren't in the position because you're dependent on transaction volume. Weren't really in the position to just say, "Okay, I like this company, I like this sector, so we're going to buy at this point." You've got to wait for something to actually come up.
Public market investing, you can just decide at any point to buy or sell.
So in some ways, it's a bit more real time.
It's a bit more fun in that sense because you can look at these factors any time and make a really quick decision. So what are the factors that you are filtering for today? August 24th to 26th, we're running our investment banking AI boot camp.
Three days in New York. This isn't theory.
It's a direct adaptation of the AI training that we deliver inside the world's top investment banks, taught by the same instructors.
Modeling, diligence, data analysis, deal materials.
You'll leave with a prompt library, our AI for IB certificate, and 27 CPE credits. Details at wallstreetprep.com. Use code WTBD.
Yeah, just taking a step back. What you were just saying about the private markets, it still does apply in the public markets, that you have different styles for different houses. You have hedge funds with a particular focus or strategy, more fundamental long-only investors.
And so what we're going to look at today is an example screen, and probably for a more fundamental investor. But regardless of what your strategy is, the purpose of the screen is to filter your investment universe.
As you said, the public markets, they are vast.
You have thousands upon thousands of stocks that you could consider investing in based on any individual strategy.
And so the screen kind of helps you to kind of filter down that universe to a list of stocks that maybe if you're an active investor, you can then take away and do some more detailed research on. So it kind of reduces your workload.
In a more extreme form, you have odd funds who use screening effectively for building their portfolios. It's much more systematic, where the output is effectively what you are going to invest in.
There's no add-on research that's needed.
So there are different styles, different strategies.
But what we're going to look at is a very simple screen, which Claude has built based on a couple of factors, or styles I should say, that are quite common for more fundamental firms, but also for retail investors as well.
So the styles that we're going to look at today are value investments and also momentum investments. And we'll talk a little bit in detail about the sorts of factors that you can use for those styles.
But effectively, if you're looking for value investments, this is an investment style that was promoted by Benjamin Graham, and it's kind of well-supported by Warren Buffett.
But effectively, you're looking for stocks which are trading at below what is perceived to be their intrinsic value.
So looking for effectively cheap stocks, but which are really quality stocks.
And so you're looking for factors that help to identify those types of companies.
So companies which trade on very low multiples of their book value or multiples of earnings, that generate very high cash yield.
So those are sorts of factors that you would expect in a value screen.
So Debs, when we're talking a value screen, of course, that makes a lot of sense.
We're looking for cheap stuff.
In a screen like this, how do we determine what's cheap? Is it kind of looking at per company, say all right, the industry average P/E multiple for a company in this sector is whatever it is, and we're looking for companies that trade below that? And then on a screen like this, how do we determine if something is good value or is just a crappy company? Or is that- That's a really good question. That's a great question, Graham.
That's really the ultimate question. The Holy Grail of investing, I would say.
Yeah, so- That requires a bit more work, right? Yeah.
You're not just going to take this list and say, "Okay, invest." So you can actually... What you've just suggested is absolutely something that firms do in terms of screening on a relative basis compared to industry.
So looking for stocks which are cheap within their industry.
The screen we've got here is a bit more simple.
It was generated by Claude, and we will dive into it in a minute.
I didn't suggest that. I just prompted Claude.
In fact, I'll just show you the prompt, and it's a two-line prompt.
"Can you produce a value and momentum screen for the S&P 500?" I've given instructions for where the data should come from.
Fundamental data should come from an SEC API, which means it can auto-refresh, or at least I have to prompt it to refresh, but I don't have to input any more data.
And then the market data should come from any free source which also offers an API.
And it should allow- Okay ... some stock scoring based on a user input for factor weighting.
So I can basically build the relative weights of the different factors.
But the actual mechanism for calculating the scores was done by Claude. And what we'll see when we dive into the screen is it basically ranks all of the companies based on each factor, so P/E, price to book, I think there's some EV multiples as well. It ranks them across the whole S&P 500, and then gives them a factor score, a Z-score, if you like, which just recalibrates it.
So it's looking at the spread across the whole range, and effectively just ranks them And that allows you to- Okay ... compile different metrics all in the same ranking system that you can then add up their scores and give a sort of compound score. But your question on what we refer to as value traps, what's just cheap and crappy versus cheap and an opportunity.
Cheap and good.
Yeah. Is the exact reason why we tend not to just use value on its own.
Yeah.
And one of the ways that you get around that is to combine it with momentum, because a momentum screen is one that's just looking for stocks that have some upward momentum in their share price.
So it's where the market is kind of rallying behind those companies, and it's one way, it's not the only way, but it's one way of trying to ensure that you don't end up buying a value trap, that you have got a stock that has got some positive momentum behind it.
The other thing I would just say about the value factors, an important part of trying to avoid just really crappy companies is the cash flow element.
So we do tend to include a cash flow type yield, either a dividend yield, or I think this one has a free cash flow yield in it.
Because then at least you are buying up companies, even if they're not high growth, value's not looking for growth, but it is looking for companies that genuinely are good quality. So having some kind of cash flow yield in there helps to get around that. So shall we have a look at the actual results of Claude's inputs or his activities? Yeah. How did we do here? Well, I think its immediate response to my prompt is, "This is a great build." So it's already congratulating me on my prompt.
Have you ever had something where Claude or GPT said, "This is just a crappy idea, don't do this." No. Claude loves me. I know that. It tells me every day.
Anyway, I'm probably actually going to that. Basically...
It's so smart.
So the first thing I would highlight to all of our listeners, I am not a coder.
I am not someone who has Python coding skills or anything like that.
I've done a little bit of Visual Basic in my time.
But what Claude did was basically provide a screen that does pull in data from an API, and I was required to do a little bit of work around pulling in the API instructions. So let me just show you where we started off in the- And the API here you're talking about is... I guess we need a couple, right? Because they're the market data APIs.
Yeah.
You said using Yahoo Finance, and then you are pulling any kind of non-market data, but the reported data direct from SEC from Edgar. Absolutely.
Yeah. Okay. So what you need, particularly for the value screen, you need book values, you need earnings, you need cash flow. So that's what we refer to as fundamentals data.
That's coming from the SEC API, so pulled directly from financial reports, and then the market data, which also is needed for the value screen, for the multiples, but for the momentum factors as well. Those come from Yahoo Finance.
Originally, Claude did suggest using STOOK, which I know people who use that, but for some reason it was blocking me.
I don't know what is in my settings that it didn't like.
So it was a bit of a pivot to using Yahoo Finance as a last-minute thing.
Okay.
Yeah, so basically the first thing that Claude did was it generated this README with some instructions for basically how this screen is going to work. Okay? So it was Claude that came up with the idea of all of the factors.
I didn't give it any instructions for that, so it suggested.
Okay.
So the multiples, it's flipped those, so a high yield, i.e.
a low PE, which is what we're generally looking for, scores well. Yeah.
So we've got inverse of multiples, so earnings yield, book to price, EBITDA to EV, sales to EV, free cash flow yield. Yeah.
So those are our factors for value, and then the momentum is just using the trends in the share price on a one-month, six-month, three-month basis.
Okay.
Claude has decided on those factors, which I'm reasonably happy with.
I would quite like to have a dividend yield in there.
One thing I think we probably will find is that when you have lots of factors which focus on the operational elements, for example, EBITDA and sales, you tend to punish financial institution companies, so insurance and banks, simply because they just don't really have that data. There isn't really an EBITDA- Yeah ... for banks and insurance companies. So that means they end up with a zero score.
So there's always this concern when you're building a screen that you're going to end up with a factor that kind of distorts the results or naturally excludes a company that would otherwise be viable.
I guess if you're looking across industries, because I guess what you could do here is you say, "I want to build a bank screen or insurance screen," and then you look at factors specific to just those industries or those companies.
Absolutely.
Now, one question I have here is in terms of the multiple calculations, do you know if Claude is calculating the multiples on its own by, say, pulling book value of equity from Edgar and using price data from Yahoo? Or is it pulling the multiple direct from Yahoo? Because I'm just thinking, one of the things I spent a lot of time doing as an analyst when I was in M&A was just scrubbing all the numbers that go into the multiples that you present in a trading comp set or transaction comp set.
And thinking how much work has Claude done here on that side of things, if any, because this is something that presumably you could actually prompt and instruct AI to do relatively well these days.
My sense is that it's pulled a lot of the data on the fundamentals from the SEC.
What I mean by that is things like EBITDA, earnings, book values. That obviously would come from the SEC.
But EV, I'm not sure. It would require a bit of digging.
I'm not even sure if Yahoo publishes EV values.
That seems quite a step for Yahoo Finance. But anyway.
Yeah. Okay.
Yeah, something that would need a bit of investigation.
Okay, and then the next thing is we have the Z score, which is basically just a way of ranking each factor.
You mean Z.
Oh, sorry, Z score. I'm in the US.
Okay, there we go.
And then there's a composite, so this builds across all the factors to give them an overall score with rank one being the highest overall score. Okay? Okay.
Then in terms of actually setting up the data, as the instructions say, it was a one-time setup. Now, I used Power Query for this, because it's something I've used maybe twice in my life before, so I was more familiar with that for building in the API than the alternative that Claude suggested.
So basically what it did, and you can see it really is paint by numbers.
It's giving me a list of instructions for what I do to get the API instructions into Power Query. Okay, so what we have down here- Okay ... I know there's just a lot of hash refs here.
Basically, each of these little query boxes is just a set of instructions. It's basically some code that I then have to load into Power Query.
Now, I'm not going to open up Power Query on my device now.
I'll show you where it is. But we're in the Data, Get Data. If you launch the Power Query editor, on my laptop particularly when recording, it'll take five minutes to open up.
But basically, that opens up Power Query in Excel that allows you then to paste the instructions into the query, and it effectively then connects.
Within the instruction, it tells Excel where to look for the API source.
It basically gives all the instructions for what data item it's going to pull from the API. And then the code also then tells Power Query where to download that data to.
And effectively what we end up with is this tab here of raw data. This is the data that's come through from...
I think the initial stuff is all from SEC, and then the stuff to the right is the stuff from Yahoo Finance.
So effectively, it's just pulling all of that data through from the two APIs I mentioned. Okay. And this is very custom.
And presumably this is something that you set up once, I assume, and you can hit refresh as you want to.
Yeah, so I go back into Power Query and just hit Refresh Data.
Yeah.
In fact, weirdly enough, because I was wondering about whether to show live how it's all arranged within Power Query, and it did take a few minutes for it to open.
But as soon as I opened it, it did prompt to say, "Do you want to refresh the data? The data's now stale," because I created the screen yesterday.
Okay.
So yeah, it's super easy. It's a bit of work up front, but once you've done it, you're away.
Yeah. Okay.
And then once you've got the raw data, Claude then puts this into a screen which has calculations, taking the raw data, there's a little bit of cleaning, and this is kind of standard when you're building a screen.
You need to create a little bit of logic around if there's a zero value, you want to make sure that if you're dividing by zero, you don't end up with errors.
So there's a bit of cleaning that's all built into these formulas within the actual screen itself. So here we have our factors all the way over to the right, and then those factors are basically built into your Z-scores.
So each factor gets a Z-score, that's your ranking of results across the universe, and then that's combined into a value score, a momentum score, and then those are combined into a composite score. Now- Okay ... in terms of that scoring, I have got a list of controls here.
Now, this is where I have user override because I can say, "Well, do you know what? I don't really want to have, let's say, sales to EV as such a big driver of my outputs." I could replace that with 0.5, and that then automatically gives it a lower weighting, but then all the other factors have to compensate for that, so they get an automatically proportionately higher weighting.
So- Got it. Okay ... that's how, as a user, I have the ability to still control some of the outputs and just in terms of that relative weighting of each of the factors.
And then what happens is we get to our dashboard that, again, all created by Claude, didn't need any prompting from me.
I like the fact that at the top it has a reminder of your tilt.
That's what when we talk about portfolios, we talk about the tilt as being the leaning towards one particular theme or particular type of factor or strategy.
So it's saying here, well, the tilt is that you're mostly focusing on value here.
It's not 69% value, 31% momentum. That just reflects the relative weighting of the factors in my controls.
Yeah. Okay.
So then as we go down, we have the top-ranked companies, and so these are the ones which are scoring top of the scoreboard for value and momentum, and then languishing at the bottom, we have those companies there which have a negative composite score. Now, at the moment, this screen is just a dashboard that I could then take away, and if I'm wanting to start my analysis, I can start with that list at the top and do a little bit more research, decide if they are genuinely companies that I want to then invest in.
But actually, increasingly, even retail investors are using this for much more automated decision-making. Now, I mentioned at the beginning that you have quants.
They are professional investors who use systematic rules for investing in stocks. So once they've decided on their weighting, they'll do a little bit of back testing, which is basically checking if you work backwards in time, if they use this mix of weights and factors in their investment decisions, has it genuinely produced historical good results, what we refer to as alpha, excess performance within that basket of stocks.
And if they can prove themselves that that gives them an edge in terms of their investment returns, they will then use those outputs for automated decision-making.
It's what we refer to as a systematic strategy.
I would say it's so interesting just because it's so different from the style of investing that I'm used to, right? I think about the process that I went through before making any investment in any particular company, and it was a months-long process of fundamental analysis saying, "Okay, I might have an overall screen in terms of I like this industry, thematically I like companies that are positioned a certain way," that kind of thing. But ultimately what it comes down to is doing a lot of primary work on the particular business that you're considering an investment in.
It's a months-long process. You're at investment committee a few times to get final approval and sanction, and then you commit capital.
And obviously it's a different investment style, right? Because you're making a long-term illiquid investment.
If something changes, you can't just trade out of it.
You've got to be really confident- Yeah ... that you are going to be okay for the three to five years, whatever the time horizon is that you're actually invested in this company. It's so different.
I do find it fascinating.
Yeah. I get what you're saying, and I think to a certain extent for active investors, this is just the start of the process, and that for them- Yeah ... qualitative analysis, understanding the company's strategy, doing detailed research on the different business segments, the operations, and really digging down into the valuation and the investment thesis is still really important. It's just the fact that you don't physically have time to research that entire S&P 500 in that level of detail.
Yeah.
So you have to have a filter as your starting point.
Well, I guess it's that you also have-- You can do all the fundamental analysis on a company that you want, but you've got all these other external factors that impact the price of that business, right? So you could say, "All right.
I'm just looking at the list we have here." You could say, "I've done all the work on Hewlett Packard Enterprise, right, and I think they've got great products and they're well-positioned. The markets they're surveying, good relations with the customers," whatever the kind of analysis you're looking at is.
But then the market tides could change just on that company based on something that might not have anything to do with that company in particular, and all of a sudden you've got a share price movement that regardless of how much fundamental analysis you've done, doesn't really matter.
Yeah, absolutely. I mean, that's the fun of public markets investing is that you can have a great thesis. You can be 100% correct in terms of your thesis, but be completely wrong in terms of the actual investment results.
Yeah.
That is the reality, and the markets have had a wild ride.
Last year we had Liberation Day, completely disrupting lots of really good investment ideas. But that's the reality, and that's kind of, for me, that is the... I don't want to say fun, but I do enjoy the fact that you can have one plus one equals two one day, and then a completely different result the next day because an external event- Yeah, one plus one equals negative five.
... the next day, and it's that the world is constantly changing.
It's not a contained system. It's something that's constantly evolving, and you have to stay on top of that. And actually on that point, I think it's really interesting from the quant perspective is that with all the developments of AI, quant firms now have to be so much quicker in terms of their evolution of factors.
When I was an analyst, you would have quant funds which would spend weeks and months researching factors. They would set up a portfolio that used those screens or those systems in their investment strategy, and that would apply for weeks, months, and that would work for a long time.
Whereas even when I left the markets, it got to a point where some of my clients were talking about the investment edge from a new factor, it's eroded within weeks.
And I can imagine that now it's days- Interesting ... because you have AI constantly learning what works and what doesn't, and then the rest of the market catches up so quickly.
So your edge disappears very quickly these days.
But I think the other thing that I find quite fascinating is the fact that this is now, and it's something we mentioned in last week's episode, the fact that access to data is so cheap and easy, and AI makes a lot of this process, which was beyond a lot of retail investors a long time ago- It makes it so much more accessible. And the fact that retail investors can and do now build their own screens. They even now have the ability to connect the outputs of their screens to their trading platforms.
You can, in theory, trade automatically off the back of your investment screening, which- Yeah ... it's a new development, and I strongly recommend that you put some good parameters in place if that's what you do.
Yeah.
But it is a changing world, the fact that you can, as an individual now, do so much more, you have so much more power in terms of your ability to analyze and make investment decisions than we had even a year or six months ago.
It's interesting. So I was at a client last week, and there was a bit more markets content there, and one of the things that they were talking about was the democratization of private markets in the sense that you have a few more vehicles to, as a retail investor, get access to private markets than you used to.
Right? We've talked a while ago about some of the semi-liquid private credit vehicles, as an example. So are we now in the world where we've got some kind of democratization of quant trading through AI? Maybe. I guess the question here is given the cost of AI, you've probably got to trade a reasonable sum of cash to actually justify all the tokens you're burning through, coming up with your investment ideas here. Because presumably, if you're doing this relatively constantly and using, say, Claude or GPT's API instead of the monthly subscription service that you and I use for most of our stuff, presumably this gets pretty costly pretty quickly.
Yeah, completely agree. And in fact, on top of that, there's two other advantages that institutional investors, and particularly quant funds, have.
Number one is the access to data. We are using free data sources.
They all have proprietary data sources that they've built themselves, or that they will have very expensive paid-for data sources that, as an individual, we can't access. And then the trading cost point is also really important because, as an individual, you're trading in small volumes, the relative cost is quite high compared to a quant fund, which is trading billions of dollars of stocks each day. They can get much cheaper pricing.
And that's important, particularly if you're in a relatively fluid portfolio where you're trading regularly and it's not for long-term holds, then yeah, it's definitely something that the funds still have that advantage, and I can't see that disappearing in the short term.
Yeah, it's a good point, even on just the trading commission, if you're using one of these tools to trade in and out of stuff frequently.
I'm not an active public market trader.
I don't know what trades cost these days, but it's not nothing- Mm ... particularly if you're a retail investor.
Yeah.
So you've got to make sure you've got a lot of conviction here before you actually use one of these tools to pull the trigger.
Absolutely.
It would be interesting, just as a side project, just to come up with some kind of mock portfolio that Claude manages or GPT manages, just to see how it does. I'm sure other people, I know other people online have done this, so maybe we should review a few of those and see what kind of results people are producing.
For sure, and I know lots of people who are doing that already with a view to, once they get to a point where they feel confident in their screens, they plan to hook it up to their trading portfolios.
But yeah- And their MCUs.
Yeah. That's a big vote of confidence for Claude, isn't it? But yeah, absolutely.
It's an interesting one. We can go away and have a think about maybe doing some analysis of that in a future episode.
Yeah, no, 100%. But it's super interesting, and I want to talk more about it just because, like I said, it's something that I don't have a ton of exposure to.
It's a very different investment style than- Mm ... what I'm used to, and it's just always fun to learn a bit more.
Great. So I hope you enjoyed our deep dive into screening using AI, and a bit of an exploration into different investment styles and factors.
That's all we have time for this week, but thanks for tuning in, and see you next week