Collection of Jupyter notebooks for quantitative finance
github.com
github.com
[1] https://julia.quantecon.org/
[2] https://python.quantecon.org/
Thank you for making this publicly available.
Practical example: get free price every minute from cryptomarketplot.com/api.json then you can figure out the EUR/USD spot using BTC/USD and BTC/EUR without ever needing yahoo finance or anything
I'll only note that beating everyone else is quite challenging, especially when you are competing against very well funded trading firms.
EDIT: Slight fix of wording as suggested by comment below.
They are useful for pricing or replicating other derivatives without available prices, but not really aimed at getting an edge on the market.
But anyways, no one actually believes that. EMH is used as a framework to price securities and as a way to reason about the market. Quant finance doesn’t work without the no arbitrage condition and therefore, EMH. EMH has absolutely nothing to do with “making a profit.” If fact, quant finance and EMH are built on a sure fire way to make a profit: the risk-free rate.
In short, while alpha is, by definition, a zero sum game, beta is not. So we can make profit pretty easily, and this is what most of the world does: obtain exposure to beta and make money.
I do agree that the EMH doesn't exactly hold. Empirical proof of that is the existence of profitable trading firms. However, the reasoning behind EMH does imply something about the difficulty of earning profit relative to the market. And I do think it is a theory that people should be aware of when they start trying to understand finance.
There is lots of data that shows that active managers don't do better than the market.
The EMH doesn't even preclude the possibility of consistently beating the market (consistently mining alpha); it simply states that the cost of providing those investments as a service rationally rises to cannibalize the outsized returns, so it becomes a wash.
We see this in practice: the well known hedge funds which demonstrate consistent alpha eventually close their doors to outside investors. Why pool risk with external capital when you're printing money? Investors are a hassle and no strategy can scale infinitely. When you can consistently mine alpha it's strictly better to just become a prop shop and run on your own money.
But in the abstract, you differentiate them the same way you implement any hypothetical distinguisher in probability theory. Consider an n-sigma event observed to occur consistently. As n increases the likelihood of the event occurring by chance (rather than agency) decreases.
There are so few managers that beat the market and then it might still be luck. Until you can be sure that a manager really is concistently better than the market he will be in his sixties.
We know factors that concistently outperform the market. So why not passively follow them?
This is a naive way of doing the analysis, because we have examples of funds whose performance is so many standard deviations beyond the mean that we wouldn't expect them to arise by chance even if every single business in the United States was a professional trading firm. To get you started, I invite you to consider Renaissance Technologies, as one example. [1]
We'll assume that trading returns have a binary distribution. Traders win or lose with equal probability. This is not a great model, but it's good for making ballpark estimates, because it overestimates the odds of a track record like Renaissances.
RenTec's Medallion fund has not had a down year in the past 25. The odds of this are at most 1 in 33 million, using our binary model. Survivorship bias does not begin to explain this; there have not been anything resembling 33 million hedge funds over the course of history. I think 30000 hedge funds is a fairly generous estimate. [2]
In order to account for Renaissance's 30 year record of 70% returns before fees (and 40% after fees) under your hypothesis, we need to advance the claim that Renaissance has been successfully conducting massive fraud and financial conspiracy with a resulting profit north of over one hundred billion dollars over three decades. Even the common citation of the IRS case with the Deutsche basket options doesn't even begin to control for those kinds of returns; there would have to be something fundamentally novel criminal conspiracy occurring in Long Island.
Of course, you can still try to defend that position. But it makes the claim significantly more complex than simply saying, "most managers don't beat the market."
_______________
1. There are others. TGS, Baupost, etc.
2. This is copied from one of my favorite rebuttals of this point: https://news.ycombinator.com/item?id=9860254
Stocks don't have a 50% chance of being up per year. It is more close to 80-90%. The size of the return however makes a really good case that Simons fund is better than the other managers at discovering prices.
https://www.slickcharts.com/sp500/returns
I don't think we can be sure that Baupost's performance is not due to luck. Since 2001 it is reported to have an annual return of 9.4%, that is decent but not much above the market.
In the end, the average investor will not be able to invest in a fund that has consistent alpha. The alpha that a fund has will get smaller the bigger the fund gets. Just look at the recent performance of Berkshire Hathaway.
Sounds like just another manager.
https://www.investopedia.com/terms/f/famaandfrenchthreefacto...
Sure, one of us might be the next George Soros, but it's important to keep expectations curbed.
He made his first big money by shorting the pound, which (to me, oddly) turned out to be a self-perpetuating burn-it-all-down machine. Which required that he had the resources to place the bet in the first place, but much like LTCM, kind of self-funded after the first dominoe fell.
So - great financial system hacker! For sure!
Stock picker? I'm not quite so certain. (It's possible you know enough more about this than I, that I could be overlooking some great "picking" behavior. I'd love to learn.)
Can quants help? That I am not certain.
And many people like re-creational gambling. So why not gamble on a non-zero sum game, the stock-market?
(I work at Quantopian)
https://epubs.siam.org/doi/abs/10.1137/s0036144500378302
I was planning on moving on to his book but now I'll just read this. Kudos to you Nicola for putting in the work and then releasing. If I were you I would typeset this and approach publishers because I bet you would sell many copies.
edit: i'll take this opportunity to poll the audience: does anyone know a good explanation of girsanov? i know a fair amount of measure theory but i'm still looking for a good, detailed, practical explanation of its use in the context of changing to risk-free measure for black-scholes.
A quick explanation of how it's used:
Taking the stochastic differential equation for geometric Brownian motion, apply Girsanov's theorem to change measure via a drift change such that we now have a discounted stock price that is a martingale. The discounted stock price is the stock price divided by a short term bond or cash account asset. In this new measure the discounted short term bond/cash account asset is also trivially a martingale since it's being divided by itself. So we have that our two key assets (discounted) are martingales. We then define the time zero price of the option (divided by the time zero price of the bond/cash asset) to be the discounted expected value of its value at maturity in this newly constructed measure. By construction this discounted option price is a martingale and we now have three assets that are all martingales which implies there is no arbitrage possible. With this option price, called the "risk neutral" price, no arbitrage is possible under our newly constructed measure, but, because the original measure is an equivalent measure no arbitrage is possible here in the "real world" either and so this is our actual price.
I appreciate there are a few steps here that seem like a bit of a leap. It took me a while to appreciate them. The key things to appreciate are:
How everything being a martingale implies a lack of arbitrage. Girsanov allows you to make your (discounted) underlying a martingale.
How you can then just make the option price a martingale by construction. And then how lack of arbitrage under one measure means lack of arbitrage in any equivalent measure.
The discounting can also be a little confusing, but it's really just incorporating the time value of money into the calculations.
[0] Oksendal B . Stochastic Differential Equations. [1] Shreve S E. Stochastic Calculus for Finance II. [2] Joshi M S. The Concepts and Practice of Mathematical Finance
for anyone interested these two explanations i found when googling around again today are very good: