Sunday 26 July 2015

Streetwise quants

08:53 Posted by The Thalesians (@thalesians) No comments

Who is an expert on Greece? Me? No. You? You can answer that, rather than me. Economists covering Greece? Yes (although admittedly not all of them). The market as a whole? Probably not, judging by all the volatility around recent events. However, if you traded any sort of macro asset class in recent years, it was difficult to make decisions without considering the situation in Greece. Of course, the market's focus on Greece has gone through phases, with potentially the most acute stage leading into the recent deal. This article isn't really about me espousing any view about the deal, given I've already admitted I am not a Greek expert. That being said, I do hear the echoing sound of can getting kicked down the road....

Instead, I brought up the matter of Greece, to illustrate my main point, namely the link between trading on what you do know and what you don't know. There are things, we clearly don't know, namely the precise outcome of the future. There are things we do know (or at least can learn to know), such as understanding current market dynamics from which we can seek to make predictions about the future. There is obviously a question of how much detail we drill down into any specific area when analysing market dynamics. A first glance does not always reveal much about a situation (for example, the picture above: is that an ordinary burger, a second glance might yield the true answer? Contact me for the answer!)

Time is the limiting factor, when trying to research the market. Hiring additional people can alleviate this, but that costs money. In effect a trader's job is not only about allocating capital for investing, but also appropriately allocating intellectual capital that needs to be made to come up with trade ideas.

Quantitative traders sit at the crossroads between markets and quantitative analysis. Hence, it can become very easy to overemphasis the quantitative analysis part and everything that goes on around that. To trade systematically, quant traders need to have a trading system which does the job. They need to think about quantitative techniques which can be used to implement a trading strategy. The temptation is to try to make a "perfect" trading system, a "perfect" trading strategy which is incomprehensible to anyone but a maths professor.

Sure, it'll make you feel smart. But will it make money, if it takes so long to implement? Furthermore, is the complexity just making you look smart, and not adding value? If it's not adding value, you've wasted time, and hence money. Make a trading strategy simpler and then elaborate and tune it, rather than the other way round. Complexity is not necessarily a way to make a good trading strategy. I absolutely love maths, but maths is a tool for traders, not the main objective of a trader.

The simplest trading strategy of all, long only, has made money over the decades! Being a quant trader can be fun, but always remember the end goal is to trade (profitably!) and not purely to write code. A bit of "streetsmart" or "sweetwise" knowledge about markets can sometimes go further than very deep analysis. At the other end of a trade is not physics but another human looking to beat you.

If you're on the US East Coast, I'll be in Washington DC 26 Sep, NYC 28 Sep-3 Oct and Boston 5 Oct if you'd like to meet me and hear more about systematic trading! If you're in mainland Europe, I'll be in Frankfurt 7 Sep and Zurich 8 Sep.

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- join our Meetup.com group for more details here (Thalesians calendar below)

22 Jul - London - Paul Bilokon - Stochastic Filtering
07 Sep - Frankfurt - Saeed Amen/Yves Hilpisch/Thomas Wiecki/Jochen Papenbrock/Miguel Vaz/Adrian Zymolka - Quant Evening (Thalesians/Quant Finance Group Germany)
08 Sep - Zurich - Saeed Amen - How to build a CTA? / interactive Python demo
23 Sep - London - Stephen Pulman - Multi-Dimensional Sentiment Analysis

Friday 17 July 2015

Listening is better than hearing

15:37 Posted by The Thalesians (@thalesians) No comments

We all know the difference between listening and hearing. You can hear what someone says, yet can understand comparatively little. If I attend a lecture on a subject I know nothing about, I might be able to make out the words, yet ask me about the narrative of the presentation, and I'll be absolutely stumped! Furthermore, even if I understand what is being said, my interpretation could differ significantly from other people in the audience. There will be even more ambiguity, if we include body language into the mix.

So just because interpreting language is difficult, should we just ignore language? Hopefully not! Language is an important part of human civilisation and thankfully so! We simply have to live with all the ambiguities in interpreting language and use our judgement to overcome them.

When it comes to markets, numbers are clearly very important. Market prices, the values of economic variables, forecasts etc. they are often quantified with numbers. Traders have market information flowing into them. However, what about when the big news is the language of the news story itself? Traders of course digest and interpret news trying to decipher the details. For example, if we were trying to calculate the total value of the cars above, it might well help to count them. However, unless we know which type of cars they are, an estimation on their total value is likely to be poor.

There are of course many different types of news. There might be news related to economic data releases, there might be news related to politics and so on. Another important type of market news is what central banks say. Often central banks might not change their monetary policy. However, through central bank communications they might hint about future interest rate policy. We have seen this recently most notably from the BoE and also the Fed.

What central bankers say, is important for understanding markets. However, can we read central bank communications in an automated and totally unbiased way? I recently did a project for a US based company called Prattle. They read central bank communications in an automated fashion and come up with unbiased "sentiment" scores based on these. Bullish sentiment from a central bank, can be interpreted as a more hawkish central bank (so more likely to hike rates). Conversely, we'd interpret bearish sentiment as dovish (more likely to cut rates). As well as coming up with an FX trading strategy by looking at the data, I also wanted to see whether the data could be used to answer other questions about central banks.


One question I had in mind, was trying to see if there was any shift in tone by the ECB after Draghi took over. I wasn't so much concerned with individual central bank communications, more their general path. I examined Prattle's ECB index and calculated the average score during the last few months of Trichet's tenure, which covered a period of interest rate rises. I then compared this to Draghi's first few months when he cut rates. Comparing the scores, shows a slightly more dovish outlook from the ECB after Draghi took over! This fits in with market perceptions about Draghi being more dovish than Trichet.

Computers can really help us to listen, rather than simply "hear", when it comes to central bankers! If you are systematically trading the markets but ignore what central bankers say, ignore economic news and only rely on price inputs, there's a question to ask: aren't you missing a factor, that discretionary traders have known for years? Whether or not you agree, isn't it at least worth investigating?

If you'd like to read my full paper on Prattle's central bank sentiment data to systemically trade FX, drop me a message! (An abridged version of the paper can be found here)

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 interesting 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- join our Meetup.com group for more details here (Thalesians calendar below)

22 Jul - London - Paul Bilokon - Stochastic Filtering
07 Sep - Frankfurt - Saeed Amen/Yves Hilpisch/Thomas Wiecki/Jochen Papenbrock/Miguel Vaz/Adrian Zymolka - Quant Evening (Thalesians/Quant Finance Group Germany)
08 Sep - Zurich - Saeed Amen - How to build a CTA? / interactive Python demo
23 Sep - London - Stephen Pulman - Multi-Dimensional Sentiment Analysis

Saturday 11 July 2015

Follow the leader & CTAs

15:51 Posted by The Thalesians (@thalesians) No comments

When everything is going well, who doesn't like to bask in all the glory? When stuff is maybe not going quite as well, it's easier to hide and avoid comment. The difficulty with trading, is that you'll be wrong a lot of the time, no matter how successful you might be in the long term.

With strategies such as trend following strategies which CTA (commodity trade adviser) funds typically use, you might actually be wrong *most* of the time, if we measure being right as the proportion of up days versus down you'll have. Yet over the long term trend following strategies are still profitable, if we look at historical data! So why is this the case?

The answer is in the skew of your returns. They'll be periods where your trend following returns are fairly lackluster and the market is devoid of any clear trends or a turning point has been reached. Indeed, in recent months CTAs have suffered because of this. Then when there are large market trends, returns are comparatively large, such as we had in the second half of 2014 and early 2015, which saw record returns for many CTAs. Hence, it's the opposite of the typical "long only" or positive carry trading strategy, where you are "picking up pennies in front of the steamroller". In other words, you get relatively consistent returns followed by large drawdowns (bigger than those typically suffered by CTAs). Plot most equity indices and you'll see this type of behaviour. People however seem comfortable with being long only investors despite this. Potentially one reason is that the trade is pretty simple, you simply buy and hold an basket of stocks.

By contrast CTA strategies, are somewhat more complicated. That's not to say you need a postgraduate math degree to understand the general concepts. It's just that they are made up of many simple concepts, which when joined together seem more complicated. It's like the picture above from Castle Howard. We can all understand how a painter has created such a masterpiece, yet the final result is impressive and requires considerable skill to complete. Also because the return distribution is somewhat more unusual, compared to a long only strategy, investors need to different expectations when they invest in CTAs. In order to get the benefits of a CTA, you need to be invested for a reasonable period of time. Furthermore, because the returns distribution are somewhat different from that of a typical long only investment, a CTA offers some level of diversification for investors who are mainly long bonds and equities. One of the most obvious periods when this diversification effect kicked in was during 2008. Whilst equities sold off considerably, CTAs actually outperformed.

If you choose to "follow the leader" and trade trends, have patience in the strategy and your overall portfolio will benefit from the diversification effects, if you already have long only exposure. Judging a CTA by very short term performance misses the point, that by construction having CTA exposure is like being long volatility.

I'll be speaking on "How to build a CTA?" in Zurich in September. If you're interested in research I've written on CTAs, let me know, in particular on the diversification aspects! You can download PyThalesians code from the GitHub PyThalesians page here - which I've written to do a lot of my research.

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 interesting 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- join our Meetup.com group for more details here (Thalesians calendar below)

22 Jul - London - Paul Bilokon - Stochastic Filtering
07 Sep - Frankfurt - Saeed Amen/Yves Hilpisch/Thomas Wiecki/Jochen Papenbrock/Miguel Vaz/Adrian Zymolka - Quant Evening (Thalesians/Quant Finance Group Germany)
08 Sep - Zurich - Saeed Amen - How to build a CTA? / interactive Python demo

Sunday 5 July 2015

It's here... PyThalesians open source library!

16:33 Posted by The Thalesians (@thalesians) No comments

Just imagine if everything in life were proprietary? You want to speak a language? Pay a licence fee to the company who owns the language. You want to walk through on a street? Pay a toll based on the number of steps you take. Want to see street art, like the above photo? That won't be free. Ludicrous? Yes. Human languages are a product of the work of many humans over millennia. It would be ridiculous for a company to claim to own a language. It would also stifle innovation of society more broadly.

Does this mean that everything should be open sourced in the same way? Well, maybe not. Let's take the example of software. If you spend many years creating software which let's others generate significant profits, should that time you spent always be given away free? It depends!

In recent years, we have seen the the open source movement expand in the software world. People are literally posting their code projects on the internet for free. If you are a businessman this might seem odd. Yet it can make business sense.

Indeed, I wrote about about the benefits of open sourcing your software in a blog post a while back, after I had gone to an open source in finance conference in Frankfurt organised by the ever enthusiastic Python expert Yves Hilpisch. Thomas Wiecki, from Quantopian, outlined the obvious benefits of open source, that the software you produce will end up being better - because you'll have a community of people working on it. Furthermore, you can use open source software to show what you can do, a powerful advert. He also noted that you do not have to open source all your software.

Several weeks later, I've followed up that blog article with some action (rather than just writing about it)! I've open sourced some of my PyThalesians Python financial analysis code library this week. It's taken me a year and hundreds of hours of my time to write my library, so it's certainly not been "free" for me to produce. Yet, I think it's still been beneficial to open up some of the more generic parts of the library. The feedback I have got back so far has been great, so I'm very glad to have done so.

Whilst, I've not included any of my proprietary trading algorithms and some of the more fiddly bits of financial analysis I've written (!), I have included a lot of my code for making it easy to download market data from a multitude of sources like Bloomberg. I've also included a lot of code for making great visualisations too (like below).

I'd encourage you to take a look at the code I've written and hopefully you'll like it. Furthermore, if you are interested in supporting the project through sponsorship, whether directly or indirectly, such as by using the Thalesians to consult for you or through purchasing our research on systematic trading, let me know.

I'll be speaking at Yves' next Python Quants London event on Friday 10th July (sign up here), mainly on Big Data in Finance and there'll also be an interactive demo of PyThalesians too. You can download PyThalesians code from the GitHub PyThalesians page here.

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 interesting 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- join our Meetup.com group for more details here (Thalesians calendar below)

22 Jul - London - Paul Bilokon - Stochastic Filtering (title TBC)
07 Sep - Frankfurt - Saeed Amen/Yves Hilpisch/Thomas Wiecki/Jochen Papenbrock/Miguel Vaz/Adrian Zymolka - Quant Evening (Thalesians/Quant Finance Group Germany)
08 Sep - Zurich - Saeed Amen - How to build a CTA? / interactive Python demo