Monday, 1 February 2021

So you want to be a quant/systematic trader?

 One of the upsides of having a (very, very minor) public profile is that you get a lot of people asking you for advice, which is flattering (and if you say otherwise, you need to consider just how first world that particular 'problem' is). The only downside of this is you get asked the same sort of question a number of different times. At some point it becomes worth writing a blog article about the subject, which saves time, but also means the person asking will get a much better answer.

(Also, cynically, posts like this get more clicks than ones about obscure corners of portfolio optimisation)

The generic question this article seeks to answer is "How do I become like you, Rob?" And by 'like you', they don't mean "How do I become a bald middled aged bloke with three kids, a mortgage, and an awesome shed?" They want to know how to become a systematic / quantitative trader.

Now there is a trite answer to this which is 'read all my books and stop bothering me you peasant', but of course even the most arrogant and prolific author cannot really believe that their canon alone is sufficient reading material to prepare someone for their future career.

This post is divided into three parts; firstly I define what I mean precisely by the end goal of becoming a systematic/quantitative trader. Secondly I discuss routes to market, how you can actually end up in this lofty position. Finally I talk about the resources I would recommend to help you.



Where you want to end up?

The phrase 'quant / systematic trader' I began this post with this deliberately vague; it's not clear exactly what this means. And the reason for that is that I don't want this post to be limited only to someone who wants to end up exactly like me, trading futures with a holding period averaging a few weeks with a fully automated system lovingly coded in python, using mostly momentum and carry type signals.

For starters there are a whole bunch of different trading styles and assets that are ripe for trading in a systematic or quantitative way; options, ETFs, equities, cash bonds, swaps and CDS; and you can trade those from high frequency up to buy and HODL forever; using valuation factors, relative value basis, or by providing liquidity, or in a thousand different ways.

And of course you can trade purely systematically, or in a purely discretionary way but guided by numbers (so still a quant), or in some mixture of the two; with or without a fully automated system.

And there is more to finance than trading; there is risk management, there is portfolio management, execution trading, quant software developing, risk management, quant pricing and many other associated jobs.

I'm pointing this out for a few reasons. Firstly, there is a lot of overlap between the skill sets required for these jobs. So even if you don't want to become a medium speed fully automated python futures trading with a bias towards momentum and carry (to be abbreviated to M.S.F.A.P.F.T.B.M.A.C. for the rest of this post), then a lot of what I will say will still be relevant to you. 

For example, pretty much everyone working in the math'y end of finance will need to code. But there is coding, and there is coding. So quant developers in high frequency trading will probably need to be fluent in C, and at the other extreme quant options traders of the 'shift-F9' monkey flavour will need to know some VBA but little else.

Secondly, and this will become important in the next part of this post, it's not uncommon for people to transfer between these roles. Almost nobody in finance is still doing the job they started doing. Just today I had a linkedin message from an old colleague whose CV looks like this: Maths phd -> statistical forecasting -> rates trader -> teacher -> software engineer. 

Remember that you don't neccessarily know where you will end up, and it's good to keep an open mind. Two things are very valuable in finance, and equally valid in life:

  • Optionality: keep your options open
  • Diversification: don't put your eggs in one basket


Routes to market

OK, so let's assume you have at least a vague idea of where you want to end up, how do you get there?

I did do a post on this some time ago, but it's still worth reading, and I've also written about it elsewhere. A key differentation is whether you want to end up trading your own money, or other peoples. Many people assume the correct approach is to trade your own money first, build up an amazing track record, and then fight off all the hedge fund managers who will be desperately trying to recruit you, or the outside investors who will be throwing money at you.

But there are a number of reasons why this is extremely unlikely. In practice the journey in the other direction is more common; the world is full of ex-professional money managers like me sitting in their sheds (or if they are more successful than I was, in their ski lodge in Verbier) trading their own money, but there are relatively few ex-shed dwellers working on Wall Street (at least pre-pandemic; in this time of COVID pretty much everyone is currently working in an actual or metaphorical shed).

For most people then the answer is to:

  • get a fancy finance job, and eithier do it forever or at some point retire and trade your own money
  • have another job, earn enough money to trade with, and then at some point hopefully have enough money to stop working and just live off your trading earnings

The skillsets for these two routes do have some overlap, but there are some important differences. For example, if you are going to try and make a living as a finance professional it helps to have some political and people skills, even amongst the rough and tumble of a trading floor or the autistic spectrum of a cliched quant group. 

Joking(?) aside, formal qualifications are extremely important in the world of professional finance (and they will also matter to outside investors if you were to go for the lottery ticket option of starting your own fund) but will not matter at all if you can only lose your own capital.

So the first step if you are going down the pro-route is to get a degree... and probably more than one. The CEO at AHL who I worked under was hired straight out of uni in 1991 with an undergraduate degree. Fifteen years after that, I was hired in 2006 with a masters (and some experience). Another fifteen years later, in 2021, and it will be much harder to get an elite front office quant job without a Phd.

It goes without saying the degree should probably be in maths, science, engineering, computer science or some variety of economics. And from as good a university as you can get into. It's better, from a job perspective, to be doing a degree that's less prestigous at a good university rather than vice versa as long as you're going to get at least a 2:1; a 2:1 from a good university is seen as better than a first from a poorer one by most recruiters (wrongly! but this is the world we live in), but a 2:2 even from Cambridge won't even get you through the door (clearly this is a UK centric opinion). It's also better to do a degree in a more traditional subject; computer science rather than game design for example.

Having said all that, if you really love history and get a place at a good university to do it then you should do it. Yes it's unlikely you will end up writing option pricing code (lucky you!), but there are still plenty of excellent jobs in finance that you can do, and you will also be able to do lots of other jobs as well: optionality.

The next piece of advice I give everybody is to think about the following heirarchy:

  1. The job you want at the place you want to work
  2. The job you want at a place that isn't quite as good
  3. Another front office job at the place you want to work
  4. Another front office job at a place that isn't quite as good
  5. The job you want at somewhere that's not good at all
  6. Something else that uses your skill set, not in finance
  7. Something else in finance

Clearly if you have a choice you should probably prioritise 1 above 2, and so on. I'd say generally it's better to have the job you want, even if it means working at Morgan Stanley rather than Goldmans: people hop between firms all the time, and if you're good you will have no trouble moving up the IB ranking or HF AUM table. The exception is (5), because having somewhere rubbish on your CV can harm your future career. 

So it's probably unwise to take a job as a 'trader' at some third rate bucket shop (where you'll all your time hedging customer flow and earning a relatively meagre income, as well as not being able to look at yourself in the mirror because of all the poor slobs you are ripping off). Better to work in risk management at a half decent bank, where you will get a feel for what the opportunities are, and have a reasonable chance of becoming a proper trader if it turns out that is what floats your boat.

I've spoken to several students who have said things like 'Well I was offered a job in sales at <tier one investment bank>, but I really want to be a hedge fund trader so I've turned them down'. This is very stupid! From sales in IB to hedge fund trader is two or three hops on the snakes and ladders board of life, and none of those hops is insurmountably large. 

And it may turn out that you're much more suited to sales anyway, you never know those recruitment people may have seen something in you that you didn't see in yourself (and I speak as someone who interviewed for a banking research job, and ended up getting an offer from the trading desk "Yes this guy is a a total nerd and on the face of it ideal research fodder. But his personality profile indicates a strong pyschopathic tendency, so he's our man").

I know dozens of people who started out as quants, or developers, or risk managers; and are now systematic portfolio managers or quant traders. Better to accept a job doing that, as long as it's at a half decent firm, than hold out for a lottery ticket that may never pay off. As I said above, it's unlikely that you even know at the age of 21 (or whatever) what you want to end up doing. 

This also means you shouldn't prioritise any job in finance over anything else. If you have a degree in computer science, and have a choice between a grunt middle office related finance job writing SQL queries for some legacy big iron database; or a more interesting job at a data science startup; for gods sakes take the second option even if it pays less. 

Although the SQL grunt is on the same org chart and possibly the same building as the trader (though unlikely the same floor), the reality is that the journey from former to latter is very difficult. Whereas if you become an expert in using big data, your chances of getting hired by a hedge fund to do the same are exponentially higher, and as I've already said from quant developer to quant trader is a relatively common journey. 

Whats more, the second job leaves you with more options open, both inside and outside of finance. Whereas the likely paths from SQL grunt include 0.001% of paths where you end up as a trader, 0.999% of paths where you get stuck somewhere on the journey, and 99% of paths where you remain an SQL grunt until someone finally works out how to copy the data in MongoDB at which point you get fired.

This also means that if you are interested in trading your own money, then you should be doing something right now that you enjoy and are good at, and if you are really lucky that also pays well enough to save money. Don't do a degree in Economics just because you think you need to. Do something you love. If you do hit the career or trading your own money jackpot you don't want to be one of those desperately boring people who retire at the age of 40 or 50 with no interests outside of finance, and aren't actually interested in finance anyway.


Resources

One of the fun things about this 'job' is that it requires a wide variety of skills to do well. This is doubly true if you're an independent trader, since you have to do everything yourself. That means this section has a lot of headings!

However a few caveats:

  • As I said above, there are a wide variety of things you can do in this field and the emphasis will be different depending on exactly what role you want to end up doing.
  • This list will inevitably be weak in areas where I am weak myself; I've never worked as a high frequency trader or options valuation quant. 
  • Like everything I write, this list is tainted by my subjective preferences and experiences.
  • I am old! I still think fondly of textbooks I was using as an undergraduate 20 years ago. More recent ones may have passed me by.
  • Other people have produced lists like this, and done a more rigorous job, for example here, and here
This section of the post is mostly a truncated version of this page, where I've focused only on the books and websites that are directly relevant for the problem in hand, and cut out most of the 'nice to haves' in favour of the 'must haves'. Nevertheless, I encourage you to check out the longer list of books on that page.

Coding

"How do I learn to code" is another question I get asked a lot. And it's very difficult for me to answer it. I learned to code nearly 40 years ago, at the age of seven, in BASIC on one of these:


TRS-80 color computer
By Bilby - Own work, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=10858630

Since then I've learned and mostly forgotten at least 30 other languages (I've even forgotten the names of some of them). So when someone asks "How do I learn python like you did", well the truthful answer is to go back in time 40 years and learn BASIC, assembler, C, SQL ..... Matlab, R, S-plus, and then learn Python. If the questioner is a 20 year old student that isn't helpful.

In all seriousness there are dozens of websites which teach you how to code for free. And I can do no more than point to https://wiki.python.org/moin/BeginnersGuide/Programmers for python specifically. 

A question I can answer is "How do you become a better Python programmer". This is in fact two questions, how do you write better Python? And how do you become a better programmer?

Better Python:

  • Python cookbook, Beazley and Jones
  • Classic computer science problems in python, Kopec
  • Effective python, Slatkin (some overlap with the cookbook, but a lot shorter and therefore cheaper)

Better programmer:

  • Clean code, Martin: Concise and brilliant 
  • The Art of Unix programming, Raymond: Useful even for non Unix people 
  • Code complete, McConnell: Large reference manual 

Alongside this, there is some specific Python that it's super useful to know for finance. I don't actually own these, and I haven't read the third or fourth, but the author is highly rated. 

  • Python for finance, Hilpisch.
  • Python for data analysis; by the creator of Pandas Wes McKinny
  • Derivatives Analytics with Python, Hilpisch.
  • Python for Algorithmic Trading, Hilpisch (note covers OANDA and FXCM but not IB)

Of course there are other languages than Python like R and Matlab or C (all of which I've used in the past) and Java (which I haven't used extensively, and therefore I naturally hate). This isn't the place for a language war (there is some discussion here of what might work best), but if you want references on material for other languages you might try here (for R), and here (for C++).

There are some coding blogs and websites that I've found particularly useful and interesting.


Automated trading (with interactive brokers)

A very specific coding need is to send orders to a broker. If you use interactive brokers like me (via IBinsyc and using the IB controller), then you'll need to become very familiar with the following web addresses:

You may also want to look at my open source backtesting and trading engine, plus my series of posts on using the python TWS API.

Econometrics, statistics and all that jazz

The problem with young people today, is they think they know everything because they have played around with some black box machine learning package. But they haven't got a firm grasp on the basics. Which means they are very likely to end up overfitting the hell out of everything.

  • Fundamental methods of Mathematical Economics, Chiang. Good starting point if you've forgotten a lot of maths
  • Econometric Analysis, Greene: Best introductory econometrics textbook mainly because of the absurdly long but endlessly entertaining chapter endnotes
  • Market models, Alexander. 
  • The Elements of Statistical Learning, Hastie. The classic ML book.
  • Advances in Financial Machine Learning, Lopez de Prado. You're only allowed to read this once you've got the basics under your belt. Read my review.


Derivatives pricing and trading

Clearly what you read here depends on whether you are going to be a pricing quant in which case you need to able to throw around Itos lemma in your sleep, or just punt around a few futures.

  • Quantitative finance for dummies, Bell. Good for dummies.
  • Paul Wilmott introduces quantitative finance, by .... well guess. Good for beginners.
  • Options, futures and other derivatives, Hull. The absolute classic, but overkill for many people. But by law it has to be on thist list.
  • Derivative securities, Jarrow & Turnbull. Similar level to Hull, and actually (whispers) I prefer it.
  • Dynamic Hedging, Taleb. A bit of a marmite book (like Taleb himself really) but I found it very helpful when I was working as an options trader.


Risk management

  • Red-Blooded Risk: The Secret History of Wall Street, Aaron Brown. Non technical history of quant risk management over recent years from a dude that was there. 
  • Quantitative risk management, McNeil, Frey, Embrechts. Technical manual for risk managers.


Behavioural finance

  • Beyond greed and fear, Shefrin. Quite an old book now but a very good accessible introduction to the world of behavioural finance and relatively brief.  I suggest you read Thinking Fast and Slow after this if you are in a hurry; otherwise reverse the order.
  • Thinking Fast and Slow, Kahneman. Not just a great finance book. This book will literally change the way you think about thinking (see what I did there). Arguably it isn't necessary to read this to follow the behavioural finance literature. However if you care about whether behavioural finance has some kind of underpinning then its an absolute must.


Forecasting

  • How to predict the unpredictable, Poundstone.  
  • The signal and the noise, Silver. Yes it's the 538 guy
  • Thinking in Bets: Making Smarter Decisions When You Don't Have All the Facts/ Annie Duke
  • Forecast: What Physics, Meteorology, and the Natural Sciences Can Teach Us About Economics. Mark Buchanan
  • Radical Uncertainty: Decision-making for an unknowable future. Mervyn King, John Kay


Financial economics

  • Fortunes Formula. Superb non technical book about the Kelly criteria. This book manages to be an entertaining but also incredibly instructive book about the history of links between gambling and the financial markets.
  • A random walk down Wall Street. This book has been around longer than me; and its like marmite you either agree with its efficient markets hypothesis creed or you don't. Certainly the later editions have drifted far from being a useful survey of the various factor inefficiencies to being yet another 'how to' on personal investment. If you find an earlier edition of this book in a second hand bookshop its worth buying, otherwise Expected Returns is a better use of your money.
  • Expected returns- Anti Ilmanen. Absolute classic on return factors
  • Irrational exuberance. Excellent book by Robert Shiller on speculative bubbles.
  • Capital ideas and Capital Ideas Evolving. Interesting history of the whole efficient market hypothesis approach.
  • Adaptive markets, Lo. 
  • Active Portfolio Management, Grinold and Kahn: A quantative approach for producing superior returns and selecting superior money managers.
  • Narrative Economics: How Stories Go Viral and Drive Major Economic Events. Robert J. Shiller
  • Modern Investment Management: An Equilibrium Approach: Bob Litterman et al. Absolute bible.


High frequency trading

These are very good general reading albeit somewhat polemical; I would like to see a recommendation for a good technical book on this subject:
  • Dark pools, Patterson.
  • Flash boys, Lewis. 



Fixed income

There isn't much here that is asset specific, but fundamentally I've spent slightly more time trading fixed income than anything else, so:
  • The Handbook of Fixed Income Securities, Fabozzi.
  • STIR futures, Aiken

General interest quant books

  • Nerds on wall street, Leinweber. Entertaining book written by someone who was there as the whole quant thing developed.
  • The Predictors : How a Band of Maverick Physicists Used Chaos Theory to Trade Their Way to a Fortune on Wall Street, Bass: Not as cheesy as the subtitle suggests. This is the book that got me into the systematic investment game. Doyne Farmer now at Oxford, is one of the more interesting people in the finance world and a great speaker if you get the chance to listen to him. Also worth reading (though a little less relevant to finance) the prequel: The Eudaemonic Pie, which is about betting on roulette.
  • The Man Who Solved the Market: How Jim Simons Launched the Quant Revolution: Gregory Zuckerman. "Rentech. Probably the most hedge fund in the world". Also launched Donald Trumpt thanks to Bob Mercer's money, but nobodys perfect.


    Books by traders

    • The education of a speculator. Victor Niederhoffer. Is incredibly random and there is no attempt to impose a coherent worldview or grand theory of everything. Imposing such an overview would be a ridiculous thing to do anyway, but Taleb and Soros would have tried to do so...
    • Market wizards series, Schwager. You must have heard of this guy. Surely.
    • Why Aren't They Shouting?: A Banker’s Tale of Change, Computers and Perpetual Crisis. Kevin Rodgers. Great history of the markets
    • All those books that Nassim Taleb guy has written. 'Fooled by Randomness' is my favourite. They get a little more mad and harder to follow as time goes on.


    Trading books

    • Following the trend: Diversified Managed Futures Trading - Andreas Clenow. Nice book on trading futures CTA style.
    • Stocks on the move, Clenow. Trading equities with momentum.
    • A Complete Guide To The Futures Markets, Jack Schwager. Buy this rather than the other futures books Jack has written. Unless you really like Jack, and would like him to have as much of your money as his humanly possible.
    • Trading systems and methods- Perry Kaufman. A massive book with a four figure page count. Nevertheless it really is the bible of trading signals and that is why everyone should buy it. Perry - is my cheque in the post?
    • Efficiently inefficient, Pedersen. Excellent book on trading some popular hedge fund strategies, interspersed with interviews.
    • The rise of Carry, Lee & Coldiron. My review.
    • Ernie Chen's various books. 
    • Systematic Trading - Robert Carver
    • Leveraged Trading - Robert Carver


    Useful blogs and websites


    Summary

    As always please feel free to comment below (then wait until I have the time to moderate your comment before publishing it). I'm especially looking for ideas for additional resources that I haven't come across, which I'll add to the lists above.



    21 comments:

    1. there are a couple of resources i would like to add


      this one focusing on ml for finance based on marcos lopez books.they also have a good library
      https://hudsonthames.org/research/

      this one from ernie also good. he post a new research there
      https://www.predictnow.ai/blog/

      this also have a good section
      https://alpaca.markets/learn/

      ReplyDelete
    2. What a coincidence! This was posted mere hours after I first discovered your book (and blog) today, wanting to learn more about algorithmic trading as a complete newbie (and a recent high school graduate).
      I didn't get to finish reading the article just yet (too excited about the coincidence part) but I appreciate you and your blog very much! Introduction of this high a quality is rare even in Python/machine learning community which (I think) tends to be a lot more welcoming of newcomers.

      ReplyDelete
      Replies
      1. Great minds think alike! Hope you enjoy it.

        Delete
    3. this one is also have a great resources

      https://www.tastytrade.com/on-demand

      there are a quant section also

      ReplyDelete
    4. Thanks a lot Rob for sharing this great content . You have been fav writer after I read your systematic trading book .For retail investor as me you are the messiah .

      ReplyDelete
      Replies
      1. I'm not the messiah.
        I'm a very naughty boy :-)

        Delete
    5. Hi Rob, Do you also trade or using Options as protection or hedging to protect your portfolio when the volatility rising?

      Cheers

      ReplyDelete
    6. Its probabaly the good old British modesty coming out in you, but your books are worth more than a little one liner at the end.

      I've been reading systems and trading books since ... well ... the 1980s, and dabbled in coding them, without really sticking a system.

      Your books got me on the right path, and am now using a couple of spreadsheets / workbooks with end of day data for systems analysis, placing manual trades - its the best way to develop and learn a system inside out before coding that system.

      Thanks for the books.

      ReplyDelete
    7. During a recent Covid-induced lockdown I spent time to watch a YouTube series of lectures called "MIT 18.S096 Topics in Mathematics w Applications in Finance"

      ReplyDelete
    8. Hi Rob,

      Have you trade options also? For leveraged trading, is options (not binary) one of the choices?

      As we can be flexible with limited risk, even it's small profit potential also compare to the risk.

      Thought?

      ReplyDelete
      Replies
      1. Yes I've traded options (I started my career in finance as a bank options trader). However I don't feel I have the expertise to write about options trading. I don't trade them now because there is a considerable amount of work involved in getting the data sorted, and I'm too lazy.

        Delete
      2. yes, i read in your leveraged books about your first career on options. Just wonder why you don't trade it anymore. Instead focusing on futures.


        I found this one. Looks interesting as it's cheap. It's also available in Interactive Broker. Have you look at this one?

        https://smallexchange.com/

        I like about how you explaning about a cost in your books.




        Cheers

        Delete
    9. >there is a considerable amount of work involved in getting the data sorted, and I'm too lazy.

      is that mean it's hard to backtest?

      but what do you think from cost perspective?

      cheers


      ReplyDelete
      Replies
      1. A future has a single price, and an expiry. I've got several hundred lines of code that convert that into a hypothetical instrument with a single total return series (back-adjusted price). An option has multiple strikes and multiple expiries. So it gets exponentially harder in terms of the code and data points involved. You need do interpolate surfaces, worry about large bid-offer spreads in the tails.... and that's before you even think about working out a way to predict the price. Then you need to translate your hypothetical option into something that's tradeable - much harder than deciding whether to trade the first or second futures contract.

        Delete
      2. Ah right. That's clear. Thanks for your explanation. It's way too complicated and difficult to automate that for sure.

        I also take a look at Andreas Clenow books, i just realize that you write the last part. He said that that ETF or Equity is not easy. It also tight much capital than futures. But futures is expensive to trade for small account.

        Difficult choices then. Haha.

        Delete
    10. Hi, great post (as always). I was curious about your review of Do Prado's ML for Finance book but the provided link points to a blank page. Is there an alternate link to the review? Thanks.

      ReplyDelete
      Replies
      1. Not sure what's going on there, I'm afraid I don't have an alternative link. I've contacted the site owner to see what's going on.

        Delete
      2. Thank you, great review. I like the idea of backtests based on synthetic data. It is helpful, in my view, to think of risk adjusted performance metrics in terms of probability distributions rather than single estimates. I was curious about your opinion on using synthetic data to backtest trend following systems. In real life, price series are neither purely trendy nor purely mean reverting but rather a mix of both. I guess a decent trade-off between the two makes a trend strategy profitable over the long run. What is your approach to generate synthetic price series? Thanks, Gilles

        Delete
      3. https://qoppac.blogspot.com/2015/11/using-random-data.html

        Delete
    11. Hi Rob! Hope your well! Big fan of the blog. Been following it for about 5 years now.
      What do you think of the below course. I'm thinking of doing it in the middle of the year.
      https://home.tpq.io/certificates/pyalgo/
      Best,
      Andrew

      ReplyDelete