Hacker News new | ask | show | jobs
by UnpossibleJim 1501 days ago
I will preface this statement by stating that I know nothing about the stock market and let my retirement account be handled by an investor...

What real math is involved in predicting the stock market? I understand there is a lot of theory behind TRYING to predict it, just as there is a lot of study in trying to predict trends in the stock market, which is why you are better off investing in groups of stocks as opposed to a singled stock (there you go, that's the grand total of what I know about the stock market). But so far as shorting stocks (betting that they'll fall) and buying stocks (betting that they'll rise), there isn't much real math, is there? Isn't it all just a gamble? Not even a statistical gamble, like dice or cards, but a public market analysis with the uncertainty of public trading and public sentiment thrown in, not to mention the hope of government bailouts on occasion?

I don't see a huge amount of difference in crypto except for physical assets, which don't cover the stock price for public companies, generally.

Now, how horribly wrong am I? I'm willing to admit I missed the mark, entirely as I don't understand trading. That's what my broker does.

9 comments

> What real math is involved in predicting the stock market?

I have a MSC in Statistics, studied quantitative finance. Generally I'd agree with you. For general investing there's often little math involved other than some simple ratios and comparisons. Three numbers I look at most often are the Price-to-Sales ratio, Gross Profit %, and annual revenue growth. There's no complex math involved here at all.

Where investing does get mathy is in calculating risk. When constructing a portfolio, generally the aim is to maximize returns while minimizing risk below some threshold. There is some very interesting and fun maths involved in this process that is beyond the scope of general investing.

Would you be able to recommend any online resources or books on the more complex math? It sounds interesting.
> There is some very interesting and fun maths involved in this process that is beyond the scope of general investing.

Are there some search terms or resources you would recommend looking into to learn more about this fun maths?

Nassim Taleb's academic papers are all about the fun math of risk-management. He basically invented the barbell/butterfly strategy which is effectively a "normal distribution risk profile" to "students t distribution risk profile" arbitrage, where you are making a big bet that the market underestimates both the downside risk and upside rewards of equities in general.

Very bizarre strategy, but really, really interesting.

Awesome! Thank you!
Look at the CAPM for the financial content, and mean-variance optimisation for the maths. It's basically minimising a quadratic function, but in many dimensions, with two constraints - the efficient frontier. You use Lagrange multipliers and arrive at a neat linear system.

Lots of fun parabolas and hyperbolas :-)

Awesome! Thank you!
Thank you, so much =)
The math that most investors (not traders) use isn't necessarily about trying to predict the market, at least in the short term - but to get signals like "this company is over/undervalued compared to competitors or compared to the size of market its targeting" etc.

These types of analysis don't necessarily predict anything on their own especially in the short term, though they likely do have value in the long term when you stack up lots of these signals.

The problem with applying math to crypto investing (not trading) is that there's no market, no sales, no cash burn rate, no actual accounting going on to base a longer term thesis on.

Exactly, the industry of trading relies on building good models. Running analysis to uncover more data points is part of it.
> What real math is involved in predicting the stock market?

Are we really comparing the two markets?

Owning a stock means owning a piece of a business. If you have all the stock in the world, you seized all means of production, good job.

If you own all the UnpossibleJimCoins in the world what exactly has changed? Oh but that coin is not insert another coin, it doesn't have the consensus/cult.

Owning a stock is not the same as having controlling interest in the business and being able to take home your share of profits (or suffer your share of losses) from the business. It is interesting how the mind works to confuse these two things.

Also, in the limit, if you owned all the stock in the world, you have destroyed the stock market.

Because ultimately, stock market is about speculating the future potential of the business and pricing it into today's stock price and more importantly having someone believe that and be available to buy from you at that price. So, it is a sophisticated collective story-telling-belief-system based on imperfect and asymmetric information using fancy mind-bending jargons. By having some regulatory safeguards, it is lent an air of legitimacy but really only the crudest of scamsters are stopped.

What are you on about? If you own all the shares of a company, you own the company, that's how hostile takeovers can happen. Usually shares come with voting rights, dividends (share of profits) etc. You're right about the price speculation though.
> Also, in the limit, if you owned all the stock in the world, you have destroyed the stock market

Dead wrong, and indeed that is the difference to crypto.

If you own all Bitcoins in the world, it is worth nothing and your net worth is zero. If you own all stocks in the world, you can direct all of those public companies to pay a large chunk of their profit to you every month in dividends, and make those companies do whatever you want them to do (research a way to build a Mars colony, or build better fusion reactors or pay off politicians to do your bidding), which is real power and real wealth.

You are missing the emphasis on the market in stock market. By buying all the stocks of a company, you are basically taking company private – you own the company but the market for its stock is gone – and the value of what you own is the book-value of the business and access to its free cashflow. You don't own an instrument that gets you multiples on that anymore. Stock market gives you a multiple on the book value.

For example, if Elon Musk owned all of Tesla he would have access to $3.7B of its annual free cash-flow or $3.3B of net income. He won't be able to afford to buy Twitter with that. But because he has Tesla stocks which gets a huge multiple on those metrics, he can pledge a fraction of his fraction of ownership in Tesla to get a huge loan with which he is able to buy Twitter (and still enjoy his ownership rights of Tesla stocks!). That's because of stock market.

> Owning a stock means owning a piece of a business

That is clearly not true. What you own, is something worth X amount of Y, where Y is what other believe it is worth.

"Means of production" has a very specific meaning and what you're saying is not it.

Actually, it is true.

When you buy a share in a company, you own a slice of that company. You have voting rights, access to shareholder meetings, annual reports, bod meetings etc.

What that share is worth is what others perceive it's value. what it's market "worth" is completely irrelevant to the fact you own a share.

You own voting rights, that's it. The recent Twitter stuff emphasized this. Some people were wondering why they can't just refuse to sell their stock (if the deal passes the various requirements, which includes a shareholder vote) if they don't want to. The reason is because they don't actually own anything, just a vote. If the company as a whole decides to go become a new entity (going from public to private in this case), the entity you owned a vote in no longer exists.

In an increasingly large number of companies even this notion of a vote is a facade. For instance at Facebook and Google, Zuckerberg and Larry/Sergey would maintain majority control even if you bought all the stock on the open market, because of stock tiering. So when you buy stock in these companies you're practically not even buying a vote. I mean you technically are, but it's like participating in an election of with 100 other people, where one guy gets a vote that magically counts as 101 votes.

That why things like the occasional 'share holders look to force Zuckerberg out' type articles are 100% clickbait. Google and Facebook also even tried to force scenarios on shareholders where the real owners of the company were going to "sell" their shares without giving up control by introducing non-voting shares. These plans were only stopped thanks to the courts because they, of course, passed a shareholder vote. [1]

[1] - https://arstechnica.com/tech-policy/2017/09/shareholders-for...

Actually, the Twitter stuff emphasized just the opposite - even after the board agreed to the sale, a majority of shareholders (well, specifically, a majority of the voting power as determined by shares) still had to agree. And because they did, Musk is on track to own Twitter.

Facebook also demonstrates it - Zuckerberg and a few others (many of whom have given him voting power on their behalf) own 'Class B' stock, which is worth 10 votes (and thus could reasonably be treated as each share being worth 10 of Class A shares). What is sold to everyone else is 'Class A' stock worth 1 vote. Despite owning fewer stock shares, then, Zuckerberg has more votes and thus has effective majority control.

You mention due to stock tiering, but that's just it, those tiers don't remove votes, or even owning a share of the company (your stock still does), it just ensures that majority control stays in the company's control. It doesn't change the claim that stock shares = shares in the company. It just changes the percentage each stock is of the company, so it's not as simple as 1 stock = 1/(# of outstanding shares) control, but it still is (100% stock) = (100% control), and (X% of voting power from stock) = (X% of control).

> Zuckerberg and a few others (many of whom have given him voting power on their behalf) own 'Class B' stock, which is worth 10 votes (and thus could reasonably be treated as each share being worth 10 of Class A shares).

the stock exchanges really missed a trick by not prohibiting this sort of bullshit

Yeah - any corporate takeover is via stock acquisition. That's how Musk is buying Twitter; he's buying all the outstanding stock. "A share" of stock is literally "a share" of the company.
Branching off, what I feel is more important is that in brokers like Robinhood you don't even OWN the underlying security of your investment; you're renting it. Not even that... you're being lied to about owning it.
What are you talking about?
In the US stock ownership is ... complicated. Effectively all shares in all public companies are owned by the Depository Trust & Clearing Corporation[1].

When you buy a share of a company, you hold that share at a broker. That broker in turn uses a clearing company which then in turn moves shares around between accounts at DTCC on a net basis between brokers. The only company in this chain that knows what shares you own is your broker. To everyone else in the world your share is held by, for example, Fidelity or Vanguard.

You retain every economic right to the share, you just don't _technically_ own it. This gets more complicated with margin accounts, where as part of the margin agreement you agree to allow your broker to lend your shares to shorts, so for some periods of time you may not actually own the shares you think you own.

[1]: https://en.wikipedia.org/wiki/Depository_Trust_%26_Clearing_...

That doesn’t sound right.

The obvious example being a hostile take over. One can literally buy up more of a company than anyone else and then attention to take control of the company. One defence being too literally discount shares for existing owners so they can buy up more of the company.

We just saw this happen with Twitter.

Relevant XKCD - https://xkcd.com/927
> What real math is involved in predicting the stock market?

1. Stock market valuation has a fairly tidy theoretical foundation that is not too much use in practice for prediction. (It is used for IPOs etc. in some form, when a market price hasn't been established yet.) It involves basic algebra, along the lines of sum_t=1^infty D/(1+r)^t = D/r, etc.

Fisher Black (of Black-Scholes fame) memorably wrote: "An efficient market is one in which price is within a factor 2 of value", where price = market price, and value = true value, as determined by that tidy formula assuming you had all the correct inputs, which you don't.

2. Similar for FX and Rates, though there is a bit more to it.

3. In derivatives, you have much more sophisticated maths (stochastic processes, Ito calculus, PDEs, Monte Carlo). Its focus is not so much prediction of the future, but a) deducing the true current state of the market from observable prices, and then b) from that true state deduce the price of derivative products, and c) computing risks (partial derivatives), which then lets you d) synthesise these derivative products. But that's not very relevant here.

4. Trying to predict the market is a whole other ballgame. You can work with time series analysis, regression and more sophisticated statistical methods and ML, and use any number of inputs: price history, company fundamentals, macro fundamentals, text/sentiment analysis, order book (market micro structure), etc.

Funny thing about this business is that there's a lot written about it, but those that have figured it out use it to make money, and don't write about it.

5. Now, cryptography involves real maths, but entirely different again, mostly number theory (such as n^p = n (mod p), for p prime).

GP might have been complaining that many vociferous crypto bros lack the basics to understand the mathematical foundations of cryptography. Though, I must say, I think one can understand e.g. hash functions and asymmetric encryption etc. quite well from their functionality alone, without needing to understand the math behind it (just as you don't need to understand transistors to understand what a NAND gate does).

> What real math is involved in predicting the stock market?

Given the apparently inability of active funds to routinely outperform passive funds[0], "not much" would be my response.

One could be really cynical and reduce it to: some people get lucky, some of the time. That's all.

[0] https://www.ft.com/content/06317e0e-b6bf-4fdc-9255-cf664cb92... ( https://archive.ph/NumMp )

>Given the apparently inability of active funds to routinely outperform passive funds[0], "not much" would be my response.

Renaissance Technologies and Two Sigmas are just two examples of firms that constantly beat the market using math, algorithms and machine learning. It's doable, but not easy.

It's silly to say Two Sigma consistently beat the market. They have multiple funds and only one of their numerous funds (Two Sigma Enhanced Compass) has managed to outperform the S&P 500 over a 5 year period, the rest have significantly underperformed.
Until the day they don't.

This kind of thing is inherently un-provable. You can have a method that works stupidly well for decades, and then it stops working. Building a model that provenly (in the mathematical sense) works with X% efficiency would be akin to building a free energy device.

It's very likely you put your life on the line every day with things that can't be proven. That is engineering after all.
> your life on the line

Your life at 0.00000x% risk is one thing. I'm fairly relaxed about that.

Your capital at - say - 50% risk of total loss is another. I don't play that game.

This is just... wrong, to put it mildly.

When it comes to serious financial modeling in big firms, everything from PDEs and stochastic calculus to cutting edge forecasting models and deep learning is fair game.

> fair game

Ummm, not really. If it were readily predictable, then <ooops> it actually couldn't be predictable.

We simply can't all be making money all the time.

>I don't see a huge amount of difference in crypto except for physical assets, which don't cover the stock price for public companies, generally.

Stocks represent part of real businesses which produce real goods or real services. So they are tangible.

Crypto are just some bits somewhere. They don't represent anything meaningful.

Technically, stocks are also just some bits somewhere. Ownership in general is just an agreement. If you own a house, it's only really yours as long as people agree that it's yours and respect your ownership.
Is a "dollar" tangible? It's just a number on a paper.
There is a very large organization out there who pays in those dollars and demands taxes in those dollars. If you want to live in a certain piece of dirt, you will deal with that organization.

That dirt is very tangible. So is the vast organization running that dirt: it builds roads, runs a military, and (in extreme cases) sends out people with guns if you don't pay those taxes.

That makes those dollars pretty darn tangible.

I think the point being made is that we assign a value to arbitrary things. People often cite cryptocurrency as not having real tangible value but the same could be said about anything we collectively assign some value to it.

I'd further argue that nothing truly has tangible value because by definition, value is an intangible concept. The question isn't whether it's tangible, but whether its value to risk ratio is good enough for you.

Well, unless we’re talking about shares in a SPAC, which is a few pieces of paper filed with the State of Delaware’s Division of Corporations…
It's important to understand that your average Series 6,7,63-licensed "investment advisor" knows less about the stock market than your average crypto bro. They just follow a script of "invest into retirement-target fund over the long term". None of them adjust anything based on market conditions unless you get into "family office" territory at (at the very least) over 100 million in assets. A lot of people make the mistake thinking "investment advisor" bros know anything.

- former "investment advisor" with all those licenses, CFA, etc

I write execution systems for hedge funds. Don't have fancy quantstatistician titles.

Stock market has something called "fundamentals" which gives you insights into the real value of stocks. If a company invests $1bn to develop their business, their value will go up. Major oil producer goes to war? Crude oil futures will go up. 100% every time. It is not rocket science, and no astrology is involved.

It is what people do that turns it into a gambling machine. They try to predict tomorrow's price by looking at chicken entrails and they get cocky and confident during bull runs. This behavior is not restricted to the crypto space.

> But so far as shorting stocks (betting that they'll fall) and buying stocks (betting that they'll rise), there isn't much real math, is there?

A lot of the math is automated these days. PE ratios, SMA (simple moving average), etc. etc.

The basis of most stock analysis is price per earnings, or also known as "How much does $1 of profits cost?". Ex: PE of 20 means that it costs $20 to buy $1/year of profits. PE of 100 means it costs $100 to buy $1/year of profits.

Using this as a baseline, you can estimate the future performance of many stocks. You then correct for public sentiment, bailouts, supply changes (are chips getting rarer and/or more expensive?), and try to predict _future_ profits, not just historical profits.

The company with the most profits, at the lowest price, wins in the long run. Buying $100/year worth of profits for just $1000 investment is better than buying $100/year worth of profits for $50,000.

But the "math" is easy. You just take the profits from last year, then divide it by the #shares * $value of the shares. You can also try to be "forward-PE" by predicting next year's profits and dividing it with today's #shares * $value of shares.

-------

The #shares changes over time. Companies can make new shares or "buyback" shares at any time. That is why when you hear about company "share buybacks", the stock goes up (fewer shares means lower PE, meaning the people who are buying the remaining shares get more $profits per $investment).

-----

EDIT: Note that under this theory, it doesn't "matter" what the company does with its profits. Profits can go back to the investors through dividends. Or, profits can be spent back on the same company through Capital-Expenditures (ie: building bigger factories or larger systems). "Growth" companies issue no dividends, because they "recycle" all profits into growing. Or the company can buy another company with the profits. Etc. etc.

While "Value" companies tend to return the money as dividends to the share holders.

Shareholders don't really care. If the profits are given to the shareholders, then shareholders can buy up more of the stock (growing their %ownership, and they themselves get more % of the profits next cycle).

If the profits are invested into itself, then shareholder value goes up as appropriate (instead of $1-million worth of factories, next year the company is doing everything with $1.1-million worth of factories and gets 10% higher profits all around).

If another company was bought, same thing, except the factories are separated by different names / locations.

Of course, the "details matter". Some industries are better suited for growth than others. But the fundamental assumption is "control more profits for fewer dollars".

-------

EDIT2: Anyway, what ends up happening is that the math-part is easy. Its the prediction part that's hard.