Saturday, 26 March 2016

Music to benchmarked ears

20:00 Posted by The Thalesians (@thalesians) No comments

There are some days, which I never thought would come. An example of one such day arrived years ago. It was the day, when I simply had no idea which artist was at the top of the music charts. This state of affairs has persisted to the current day: today, I have absolutely no idea who is at the top of either the Billboard 100 or the UK Top 40...

It would however, be wrong to equate this is to a lack of interest with music. I love music just as much as I did a decade ago. Browsing my main playlist, which I have unoriginally called the "Thalesians Mix", which I periodically add my favourite tracks, I see the names Taylor Swift and Ed Sheeran, juxtaposed with David Bowie and Bob Dylan, with a modicum of Tom Petty, The Beatles and topped by a hint of Green Day, interspersed with all manner of musical genres. Is this a "right" playlist? Well, it seems right for me, judging by the fact that I seem to gravitate towards listening to this playlist in its entirety at least several times a week. Whether it is right for everyone else, is an entirely different question, I am quite sure there are some tracks on my playlist, which you the reader, would not like. 

I strongly suspect, that my taste in music seems far more eclectic when judged against the "benchmark" of the music charts. I don't feel the "benchmark" of the current music charts is right for me. Of course, I might like one or two current tracks, but I can never see myself listening entirely to purely new songs and dispensing with the old.

The notion of benchmarks in finance is a fraught subject. Whenever you invest, what should be the yardstick for how you judge your performance? Should investors be purely judged by how they beat (or miss) a benchmark which is the "market"? A recent paper, Curse of the benchmarks, by Dimitri Vayanos and Paul Woolley attempts to answer this question (thanks @george_cooper__ and @PolemicTMM for tweeting this paper to my attention). They suggest that trying to use market cap weighted benchmarks (which is often considered as the market) ends up causing

the inversion of the relationship between risk and return so that high volatile securities and asset classes offer lower returns than low volatile ones

A far better way of judging investors, they suggest, is to try to compare them with their peer group adopting a similar trading strategy, rather than the approach of using market cap benchmarks. More broadly, the matter of precisely how to create targets for your investment, will differ between investors. What is an acceptable drawdown is not acceptable for one investor might well be too much for another. The idea of how much risk a trader should take will differ between mandates. I wrote a chapter on both the matter of risks and investment targets in my book, Trading Thalesians, if you'd be interested in reading more.

So whether it's music or investing, if you do have a benchmark, we first need to consider this: is it the right one? Most important does having the wrong benchmark end up changing your strategy for the worse! In the meantime, I keep listening to the music.

Like my writing? Have a look at my book Trading Thalesians - What the ancient world can teach us about trading today is on Palgrave Macmillan. You can order the book on Amazon. Drop me a message if you're interested in me writing something for you or creating a systematic trading strategy for you! Please also come to our regular finance talks in London, New York, Budapest, Prague, Frankfurt, Zurich & San Francisco - join our Meetup.com group for more details here (Thalesians calendar below)

14 Apr - New York - Lawrence Glosten - Limit Order Book Tail Expectations (Thalesians/IAQF)
20 Apr - London - Jacob Bartram - Can option trading strategies enhance CTA/trend following
12 May - New York - Luis Seco - Are Negative Hedge Fund Fees on the Horizon?
13 May - Budapest - Saeed Amen/Paul Bilokon - Thalesians workshop on algo trading at Global Derivatives
20 May - London - Martin Bridson - Knots and what not

Saturday, 19 March 2016

Go-ing with quant trading

15:04 Posted by The Thalesians (@thalesians) 1 comment

When I think of the word "go", I think of its meaning according to the Cambridge Online Dictionary (written below):

go
verb UK ɡəʊ US ɡoʊ (present participle going, past tense went, past participle gone)
      
go verb (MOVE/TRAVEL)
A1 [I usually + adv/prep] to ​travel or ​move to another ​place:

This week, the word "go" was in the headlines for totally different reasons. Lee Se-Dol the best human player in the world at Go (the Chinese Chinese board game) was beaten by Google's AlphaGo artificial intelligence system. Whilst, chess champions have been beaten in the past, it was thought that it would take at least a decade more for them to accomplish the same thing in Go. Indeed, if you are interested in this topic and are based in London, I recommend you come to Robin Hanson's talk at Thalesians London on economics and robots on March 21st (free tickets)

Perhaps unsurprisingly, it has focused peoples' minds on what other things a computer can do, in areas which have been traditionally required humans. One such area is trading. Trading has seen a massive proliferation of technology. Systematic traders have been trading in markets for many years. Obviously, over the years, the increased processing power of computers and the greater availability of data has increased the types of trading strategies, which can be explored by systematic traders.

What is perhaps a fallacy though is thinking that systematic trading is a matter of computers trading in total isolation from humans! People still have to code up the algorithms executed by computers. Indeed, humans have to come in when a computer's trading algorithm goes wrong.

A computer doesn't understand "why" it is executing code, it simply does it. It can of course calculate all the trading signals, work out the P&L and even execute the trades, without a human touching a system. However, a computer cannot tell you whether you should trade a certain strategy or if there is theoretical basis for a strategy. In a sense, whilst systematic trading reduces the need for day to day decision making for every trade being executed, it increases the process of discretion you need to use on a more strategic level. In particular, this strategic "discretion" comes in, when you are developing the trading strategy and coming up with new ideas to add to your system. Your logic when putting together the model has to be very clear. Any mistakes at this level, will unfortunately persist, when the system goes live.

We sometimes think of systematic and discretionary trading as very different concepts, but in a sense they do share so many similarities. The main difference between them is at which points we employ our discretion.

Like my writing? Have a look at my book Trading Thalesians - What the ancient world can teach us about trading today is on Palgrave Macmillan. You can order the book on Amazon. Drop me a message if you're interested in me writing something for you or creating a systematic trading strategy for you! Please also come to our regular finance talks in London, New York, Budapest, Prague, Frankfurt, Zurich & San Francisco - join our Meetup.com group for more details here (Thalesians calendar below)

21 Mar - London - Robin Hanson - Robin Hanson, Economics when robots rule the Earth
23 Mar - Frankfurt - Miguel Vaz -  Finding structure in financial data: from point clouds to graphs
20 Apr - London - Jacob Bartram - Can option trading strategies enhance CTA/trend following
13 May - Budapest - Saeed Amen/Paul Bilokon - Thalesians workshop on algo trading at Global Derivatives
20 May - London - Martin Bridson - Knots and what not

Saturday, 12 March 2016

Excelling with & without Excel

14:18 Posted by The Thalesians (@thalesians) 2 comments

Travel does many things. The cliche tells us that it broadens the mind. Holidays are the tonic for the whispering monotony of the routine. Yet a holiday is never purely a matter of joy. Within the idea of holiday are bound up the logistics of transportation. None of us book a holiday for the experience of being squeezed on to a flight for hours, at the mercy of delays and heavily processed airline food. However, being able to get to our destination, is a necessary part of any holiday to far away places. Of course we could forgo that long airline journey, but then we'd forgo those sandy beaches, beneath the sunny rays of heat, and instead settle for staying at home.

When trying to analyse markets, we are in a way faced with similar conundrum. We want to find some novel and interesting way to look at market data. However, very often this route is laced with an Excel spreadsheet! Sometimes this approach can work very well, in particular given Excel spreadsheets are the preferred way to share ideas with traders.. but as soon as you have just a bit more data there, a spreadsheet can become unbearably slow to recalculate. Furthermore, when the complexity of your analysis rises, a spreadsheet can become increasingly unstable and easy to break. 

In a sense, there are only certainties in life for a quant researcher: having to use Excel and moaning about having to use Excel. I have to say that I have at times, used Excel far more than perhaps I should have done. One reason is that it makes it easy to explore simple ideas. The difficulty is that very often simple ideas, become very complicated very quickly! Whilst it might save time to use Excel initially, it makes it more difficult to reuse analysis and cost you in the longer term. As for using big datasets like news data, Excel is basically unworkable. Hence, it limits the type of analysis you can do.

To try to get past the issues with Excel, I started writing PyThalesians, an open source Python financial library over a year ago. I wanted to streamline the bulk of my analysis. Rather than reinventing the wheel every single time each time I want to do a new sort of analysis, I've tried to write functions of commonly used financial analysis. These can easily be used again and again, with small modifications. I've now written functions to do basic backtesting of trading strategies, plotting, and market data downloading from many sources including Bloomberg. In particular, I've tried to focus on making the various components interchangeable. Want to change the data source you're using? Just a few lines of code need to be changed, not the the details in your trading algorithm. Want to change how you plot your results? Again, just change a keyword in your code. I've designed the code from the perspective of my experience as a quant researcher and someone who enjoys coding, as opposed to purely looking at it as an IT problem to be solved.

Along the way I've utilised many great open source libraries such as pandas (time series), NumPy (mathematical computations), matplotlib, bokeh and plotly (plotting). Since it's open source, I'm hoping over time, that if users find it useful, they can contribute their own improvements to the library too. We can also blend the two solutions using libraries such as xlwings, which allow us to call complicated calculations in Python and display the results in Excel. In this way, traders who love Excel can still create funky models in Python, but fall back in the familiarity of Excel.

So ok, we often moan about having to use Excel (including me!), but sometimes we can excel both with and without it, if we use a bit of Python (and hopefully PyThalesians!)

Like my writing? Have a look at my book Trading Thalesians - What the ancient world can teach us about trading today is on Palgrave Macmillan. You can order the book on Amazon. Drop me a message if you're interested in me writing something for you or creating a systematic trading strategy for you! Please also come to our regular finance talks in London, New York, Budapest, Prague, Frankfurt, Zurich & San Francisco - join our Meetup.com group for more details here (Thalesians calendar below)

14 Mar - San Francisco - Quant Fintech Mixer Event
15 Mar - New York - Thalesians/IAQF - Alex Lipton - Modern Monetary Circuit Theory
21 Mar - London - Robin Hanson - Robin Hanson, Economics when robots rule the Earth
20 Apr - London - Oskar Mencer - FRTB, RWA, XVA, Scenarios, MiFiD II, fast?
13 May - Budapest - Saeed Amen/Paul Bilokon - Thalesians workshop on algo trading at Global Derivatives
20 May - London - Martin Bridson - Knots and what not