Quants: The Alchemists of Wall Street

The VPRO Backlight documentary Quants: The Alchemists of Wall Street provides a casual insight into the work of quantitative traders and researchers, "quants" for short. It features Paul Wilmott, a quantitative finance researcher and consultant, and Emanuel Derman, author of My Life as a Quant and professor in financial engineering at Columbia University, amongst others.

What is MATLAB?

MATLAB is a high-level programming language used most commonly in technical computing, such as for numerical computation or algorithm implementation. Developed originally by mathematician Cleve Moler in the 1970s, MATLAB was officially released in 1984 and has since grown into one of the most popular languages for scientists and engineers. It is also frequently used in the finance industry, a popular destination for young engineers looking for a job.

Why is MATLAB useful?

Most importantly, MATLAB is based on LAPACK, a linear algebra software library originally written for the scientific programming language FORTRAN. As a consequence, MATLAB offers powerful out-of-the-box functionality for operations on systems of linear equations (i.e. matrices) that would be way more difficult to implement in a language like C or Java.

I would even say that programming in MATLAB will generally take less time than in most traditional languages, which is why it is often used to prototype new ideas. Good MATLAB code is relatively concise. You won't see as many loops or if statements than in other languages, for instance, and variable declarations can be neglected in the majority of cases (memory pre-allocation is important, however). This not only reduces programming time but makes the code easier to read, too.

Furthermore, you do not have to compile MATLAB code before you can run it. Much like in Java and Python, MATLAB programmes can be run immediately and you can even test code snippets directly in the IDE's command window. That is possible because the compilation and interpretation tasks are done in the background when you run your software. This can be a big time saver for large projects where each recompilation would take several minutes or even hours to complete, but it comes with the obvious disadvantage that interpreted code is usually not as fast as compiled code.

What are MATLAB's disadvantages?

First of all, it is often said that software written MATLAB is slow. That statement is simply not universally true. With its new just-in-time (JIT) compiler, which pre-compiles certain parts of your code before actually running it, MATLAB performance has improved a lot over recent years, resulting in run times that are perfectly acceptable for almost all applications. However, it is true that for certain high-performance tasks where every microsecond (or even picosecond!) counts, as in high-frequency trading, it is recommended to run compiled software. Still, most firms prefer to test their ideas in MATLAB (or R or Python) due to the aforementioned time savings during development before porting the software to C.

Second, MATLAB was designed specifically for numeric tasks. Unlike C, Java or Python, it is no general-purpose programming language. Therefore, MATLAB should only be used when actually doing maths or when working with data. The interfacing with other applications or the operating system, for example, should be left to another language that is better equipped for that particular task.

Finally, compared to the open-source languages R and Python, an obvious disadvantage of MATLAB is that it is relatively expensive. Lower pricing for academic institutions and individual programmers is available, but when you need to purchase many of MATLAB's toolboxes the total can still be significant.

MATLAB in Finance

Taking these positives and negatives into account, it may become clear why MATLAB is widely used in the finance industry today. Financial markets deliver a constant stream of data that can be analysed in MATLAB more quickly than in many other languages. Learning MATLAB is definitely easier than learning C. (It will still take a lot of hands-on programming experience to discover the language's intricacies that ultimately result in elegant and efficient code, of course.) The available finance and trading toolboxes allow for an easy integration of MATLAB into a bank's or hedge fund's workflow without the need of extensive interface development.

Future posts will explain the MATLAB programming language in more detail and also highlight how to apply MATLAB to the world of finance.

Programming for investment managers

Being able to comprehend and ideally write code has become an important skill in almost every industry over the past 30 years. This is especially true since the breakthrough success of personal computing and eventually the internet in the mid-1990s. More recently, cloud computing and Big Data have boosted companies' reliance on programmers and data analysts to a whole new level.

In the finance profession, for example, programming in a scripting language has become a common task for quantitative researchers, risk managers, asset managers and, yes, even traders. For data analysts, financial markets are a dream-come-true because market participants' trading activities produce a constant stream of information, most of which is instantly available in numeric and machine-readable form. The amount of data produced is so vast that analysing the data manually is practically impossible, hence requiring analysts to be able to code so computers can do the work for them.

Geeks (or "quants", as they were warily called by old-school traders in the 90s) have consequently become a hot commodity in the banking and hedge fund world, despite their involvement in recent market meltdowns, such as the subprime mortgage crisis and the Flash Crash of May 2010. These setbacks notwithstanding, it is undeniable that diligent statistical analysis can add significant value to investment management in the long run, as proven by the real money track record of hedge funds and commodity trading advisors (CTAs) such as AQR, Winton Capital, AHL, the lesser known Millburn Ridgefield or the legendary Renaissance Technologies, although the latter is arguably impossible for outsiders to look into and hence judge objectively based on actual performance data.

Considering the importance of statistics and data analysis for today's asset management profession, I decided to add a "programming" category to this blog. I'm going to write tutorials and code examples for certain programming tasks that you might encounter in the investment profession as well as educational posts about language fundamentals, focussing on MATLAB, Python and R, all of which are commonly used by quants throughout the hedge fund world.

Euro depreciation continues after Draghi speech

As I wrote only two days ago, I was waiting for the EURUSD exchange rate to hit $1.0765 and $1.06 before closing my short positions. I would not have thought that both of these take profit limits would be hit within a mere two days. So as a follow-up to Monday's post let's take another look at the monthly EURUSD chart.

EURUSD Monthly Chart 11/03/2015

EURUSD is currently trading at $1.0583, which means that all of my short positions have now been closed. Considering that the exchange rate is at a point where two trend lines -- originating from the year 2008 and 2000 respectively -- cross each other, I'm going to wait and see where it will go from here before opening new positions. As of now, I'm biased towards going long given that the euro appears oversold on a short-term horizon. A move towards $1.2 would not be unusual after such sharp declines, although both economic fundamentals and central bank policies clearly speak against such a level right now. Perhaps it is more likely that we will see $1.1 in April or May before falling back towards parity by the end of 2015.

Today's extended drop in the relative value of the euro was ignited by Mario Draghi reiterating at the 16th "The ECB and its Watchers" conference in Frankfurt the ECB's commitment to reach its long-term inflation goal and to bring the central bank's balance sheet back to $3 trillion through 2016. The key statement:

Our decision in September to make use of asset purchases had significant effects. But still, when we announced the purchase of asset-backed securities (ABSs) and covered bonds, there were some in the market place who doubted our commitment and the effectiveness of our monetary policy. They thought we might be hampered either by there being a limited availability of assets that we could purchase in the market or by legal or political obstacles to our ability to expand the range of assets, should it become necessary. If we were so constrained, that would affect our credibility because our ability to anchor expectations relies in part on the fact that we are free to set the appropriate monetary stance.

In this context, the decisions we took in January to expand the range of our asset purchases must have assuaged those concerns. We can deploy – and we are deploying – monetary policy in a way that can – and will – stabilise inflation in line with our objective.

The yields of European countries' government bonds have fallen further since the ECB started its asset purchase programme on Monday. For instance, Italy's 10-year bond yield is now at a record low 1.17% after having fallen below 1.25% yesterday. The yield of German 10yr government bonds is just 0.205% as of this writing (German government bonds with shorter maturities have offered negative yields since the beginning of the year and have since fallen even further into negative territory).

Italian 10yr generic bond yield 11/03/2015

As long as market participants believe that the ECB will be able to achieve its monetary policy goals, there is no apparent reason why the euro should appreciate significantly in 2015 and 2016. My medium-term EUR bias remains firmly short.

Only the Federal Reserve would have the fire power to steer the EURUSD exchange rate in an upward direction, but that is not going to happen unless the United States begin to see the strong US dollar as a valid threat to the nation's economic recovery. That has not been the case so far, despite a few comments from US officials about the euro being artificially undervalued as a means to support European exports. One can only hope that the Federal Reserve will not deviate from its plan to raise interest rates in 2015, because anything else would likely mean an engagement in a full-blown global currency war with unknown consequences.

ECB starts QE programme

The European Central Bank (ECB) started its 1.1 trillion euro QE programme today at 9:25am Frankfurt time by purchasing German and Italian government bonds. While bond yields expectedly fell further, the euro remained almost unchanged.

The EURUSD exchange rate is trading at $1.0852 as of this writing -- having fallen sharply below $1.10 after Mario Draghi's press conference on Thursday last week.

EURUSD Monthly 15-Year Chart 2015-03-09

The euro remains a sell versus the US dollar. From a technical point of view, the next support level is the September 2003 low at $1.0765. A more significant support should be the crossing of the upward and downward sloping trend lines in the $1.057-1.060 area. The geopolitical and economic situations in and around Europe are not supporting the single currency, either. Greece remains a bottomless pit that European politicians continue to throw money into. Greece's list of proposed measures to counter its dire state was rejected by the country's creditors -- perhaps understandably so considering that the list contained such unconventional measures as "hiring non-professional tax collectors, such as tourists". The Russia/Ukraine conflict weighs on investor sentiment, too.

Taking all this into account, I still believe we will see parity by the end of this year, but a short-term upward correction becomes ever more likely. Euro bulls should perhaps wait until one of the above-mentioned support levels has been reached before adding euro long positions, because the trend is still very much intact. On the other hand, I would be very careful with entering into new EURUSD short positions at current levels. Personally, I choose to keep my existing short positions with a 50% take profit at $1.0765 and another 50% take profit at $1.06. If the exchange rate indeed turns around before reaching those levels, I'm prepared to add to my short positions once we get back into the $1.11-12 region.