G53 (08 22524): Risk Analytics
Colin Rowat
Room 220, J.G. Smith Building c.rowat@bham.ac.uk www.socscistaff.bham.ac.uk/rowat
2018-10-09
regulator-approved standard risk models used in financial institutions …under-forecast risk before the announcement and over-forecast risk after the announcement, getting it wrong in all states of the world. Jon Danielsson
You must understand, anyone who was worried was fired a long time ago and is not in this room. (Veteran risk manager to Ragjuram Rajan, spring 2007)
It’s a complete tempest in a teapot. Every bank has a major portfolio. In those portfolios, you make investments that you think are wise, that offset your exposures. Obviously, it’s a big portfolio. We’re a large company and we try to run it. It’s sophisticated, well, obviously, a complex thing. But at the end of the day, that’s our job, is to invest that portfolio wisely and intelligently to – over a long period of time to earn income and to offset other exposures we have. (Jamie Dimon, or Doug Braunstein?)
The real risk is the one you can’t see (Richard Bookstaber)
Tim Geithner said he realised Merrill Lynch’s risk culture was not in great shape when John Thain, then chief executive, did not know the name of his chief risk officer – who at the time was sitting next to him. …the driver of bank failure is not insufficient capital but rather a bad “risk culture”. (Simon Samuels)
WARNING: Risk Analytics is taught to job market standards. It will be the most demanding module that you take this year. Its average mark is consistently the lowest of all modules in the Department of Economics; about a third of students fail their first sit of the exam. You can perform well on G53 if you prepare for lectures and problems classes in advance, and start early on the project. Students who attend all of the lectures (without reading the material in advance) and classes (without working through the problems in advance), and who successfully complete the term project (but without beginning it in the first term), consistently fail their first sit; if you follow their pattern, you can expect to as well. I tell students this every year; every year, students fail to prepare adequately, and fail. Some, as a result, do not obtain the MSc.
1 Goals
Risk Analytics is designed to train you to perform risk assessment and management, a high demand area of the financial services sector. You will be introduced to:
1
C. Rowat Risk Analytics
1. concepts of risks analysis and management, including market, credit and operational risk; 2. the theory of risk analysis, drawing from statistics, finance and computer science;
3. the practice of risk management.
Thus, you are to gain a conceptual framework and proper technical grounding for understanding risk, as well as learning how to actually practice risk analysis and management.
By the end of the module, you should be able to:
1.
2.
3.
display a systematic understanding of the main risk measures available, the motivations underlying each, and be able to critically evaluate each of them, and suggest new measures that improve on them;
display a similar understanding of the major existing regulatory requirements associated with risk management, the limitations of these requirements, and be in a position to crit- ically comment on drivers of future risk management regulation;
be able to assess, develop and apply strategies for managing portfolio risk, with a particular focus on understanding recent failures in risk management.
Lectures and office hours
2
2.1 Lectures
Lectures take place on Tuesdays from 2pm to 4pm in JG Smith G22; they begin on 9 October (Aut2). There will be no lecture on Tuesday 23 October; instead, this lecture will be held on Monday 15 October, from 5–7pm in room 429 of the Muirhead Tower.
2.2 Office hours
During term time, I have office hours on Tuesdays from 16:00 – 17:30 and on Wednesdays from 13:00 – 14:30. In emergencies, I can arrange by e-mail to see you outside these hours.
2.3 Problem classes
Weekly problem sets include both pencil-and-paper and Python exercises. Classes will be held in Room G19 of 52 Pritchatt’s Road from 5–7pm on Tuesdays, starting on 16 October. They will be taken by Giovanni Guglielmi (GXG647@student.bham.ac.uk. Each week, Gianni will ask for a volunteer to present the answer to each question. If no one volunteers, Gianni will pick someone to do so. You must prepare the problems in advance; failing to prepare properly for the classes will lead you to fall behind in the module, placing you at increased risk of failure. Gianni will help you find and fix mistakes in your solutions; he will not solve the problems for you.
Working through the pencil-and-paper problems before the classes is one of the best ways to prepare for the exam; working through the Python exercises will strengthen your skills with one of the most important software packages in quantitative finance. The document from which the coding exercises are drawn specifies MATLAB; you will need to transpose the problems into Python. You will need to draw on Python libraries like NumPy, SciPy and scikit-learn.
You can arrange to see Gianni outside of the classes by e-mail.
2
C. Rowat Risk Analytics
lecture 9Oct 15Oct 16Oct 30Oct 6Nov 13Nov 20Nov 27Nov 4Dec 11Dec class 16Oct 23Oct 30Oct 6Nov 13Nov 20Nov 27Nov 4Dec 11Dec
Table 1: Dates of lectures and corresponding classes
3 Reading material and resources
The textbook for this module is Meucci (2005).1 It is available online as an electronic resource via the library; sections of it can be downloaded from https://www.arpm.co, which also contains worked problems (used for problems classes), technical appendices, and MATLAB code. You may wish to join the LinkedIn group based on it.2 In working through the problems, you should also become familiar with the appendices of Meucci (2005) and the online technical appendices. The primary strength of Meucci (2005) is its emphasis on solid methodological foundations; while these are applicable to modelling any aspect of risk, it devotes less effort to presentation and discussion of any but the simplest models.
Students will have a 12-month subscription to the Python code available on the ARPM Lab (Meucci, 2017). Passwords allowing access will be distributed shortly.
The University also has access to the Numerical Algorithm Group’s Python library.
Students will also receive an Interactive Brokers trading account.3 This is an extremely powerful, industry-standard trading platform. Among other features, it allows users to run their own code on the trading platform via its API.4
McNeil, Frey and Embrechts (2015, Chapter 7) will be used for its material on copulas; a digitised version is available online here. McNeil, Frey and Embrechts (2015) is more extensive and often clearer in exposition than Meucci (2005); its webpage contains errata as well as some R code. Resti and Sironi (2007, Part V) will be cited on risk regulation. It is also comprehens- ive, devoting whole parts to models for each of the main classes of risk – market, credit and operational. The library has copies of both of these texts.5
Shin (2010) presents an alterative critique to the usual one, noting that widespread use of VaR can create endogenous risk and instability.
Whenever possible, you should read the original journal articles. You can find these either by using Google’s www.scholar.google.com, or FindIt@Bham.6
If I hand material out in class, I shall also post it on my website. Any important announce- ments made during a lecture will also be posted there.7
4 Assessment
The module is assessed by means of a two hour final exam, accounting for 60% of the overall mark, and a 30% Python-based portfolio risk modelling project and two class tests (at 5% each).
1The 2009 edition corrects some misprints in the initial printing.
2Meucci teaches a one-week course in August, for which a certificate is available. The University of Birmingham has a partnership agreement with ARPM.
3You are free to continue using these accounts until the end of May. 4https://interactivebrokers.github.io/tws-api/introduction.html documents the Python API.
5Connor, Goldberg and Korajczyk (2010) also seems good, decomposing risk into industry, country and mac-
roeconomic factors; it explicitly treats foreign exchange, credit and liquidity risks.
6If you are having IT difficulties, including finding articles online, please seek help either from a classmate or
from the University’s dedicated IT support as I am unable to provide this sort of support myself. Lisa Anderson, l.anderson@bham.ac.uk, the Economics subject advisor, is particularly helpful.
7If you miss a lecture, please catch up by first speaking to a classmate.
3
C. Rowat Risk Analytics
4.1 Final exam
The exam will be open book: a copy of Meucci (2005) and a binder of notes (including Meucci’s technical appendix, worked problems, photocopied articles and chapters, etc.) should be brought into it. The only electronic devices allowed in the exam are calculators: laptop computers, e-book readers, etc. may not be used. The technical difficulty of the questions will be similar to those in Meucci’s worked problems. Preparation for the exam should involve working through those. Before the exam there will be a revision lecture; you are responsible for bringing your questions to the lecture; I will help you answer them. You will be required to answer all questions on the exam.
4.2 Class tests
There will be a class test in the last 30 minutes of the 6 November class. On 4 December, a take-home test will be distributed at the end of the class; you are to submit a scanned copy of your answers to Canvas by 7pm on 5 December.
4.3 Term project
The term project is to use Python to build a trading algorithm that maximises net profits over its deployment period, subject to the VaR constraint that the probability of it losing more than 10% of its value during that period is less than 1%. After you submit the project, I will deploy your algorithm on my machine, run it, and assess its performance at the end of an hour.
- Pick a trading algorithm and five assets available on IB’s student trading platform. If you pick an algorithm of current interest this should help you on the job market.
- By 5pm GMT 29 October, e-mail me with the name of your algorithm, a source for it (code as well as description), and the five assets that you plan to use. I will then add them to a list to ensure that none of you are trading the same assets, and that no more than four of you are using the same algorithm. I will also randomly match each of you to another student, your ‘validator’.
- In calculating VaR, your time series modelling should use:
(a) one of the six standard estimation methods mentioned in Daníelsson (2015). (b) one of the estimation methods available in scikit-learn.
- Start developing your code as soon as possible. This is a serious project: students who leave it until next term will do poorly, and risk failing.
- By noon on 4 February 2019, submit your project as a Jupyter Notebook to your validator.
- As validator, submit a report (again, as a Jupyter Notebook) on the project sent to you
by noon on 11 February 2019.8
- By noon on 18 February 2019, submit the project via Canvas.
Your submission should have the following structure:
8Check https://github.com/jupyterlab to see if a Commenting/Annotating repository has been created. If so, use it to add comments/annotations to the original .ipynb project. If not, indicate your comments in the .ipynb file by prefixing markdown with your initials.
4
C. Rowat Risk Analytics
- six page PowerPoint presentation to your clients, as follows:
- (a) title slide.
- (b) executive summary: a brief overview of what you’ve done, including your understand- ing of your goals, your algorithm, how it’s supposed to work, how you tested it, and what you learned. Write this last, once you know.
- (c) algorithm and market: an intuition introduction to the algorithm and market you’re trading in.
- (d) customisation/fine tuning: intuitively, what you did to tune your algorithm to work on your chosen market.
- (e) performance: how has your algorithm done when tested? Why?
- (f) conclusions: what have you learned; how can you do better?
- a ZIP file containing a Jupyter Notebook technical document, including the .ipynb file and any supporting files. This must — first — allow me to run your algorithm, and — second — document your code in enough detail for me to understand what you have done (including how you’ve responded to your validator’s report). You do not need to provide full derivations; references to standard texts are fine.
- a ZIP file containing the validator’s Jupyter Notebook report.
To pass, your code must – on my machine — run, open Trader Workstation, login to your IB account, close out all positions, reset your account balance to US$1mn, and trade for an hour. Beyond this, the project’s mark will reflect its performance, ambition, the quality of its execution, and the clarity of its exposition.
Here are some more specific do’s and don’ts on the project:
- don’t ignore the module content to use techniques with which you are more familiar;
- don’t go over the page limit, or otherwise ignore these instructions, even if you have some- thing important to say;
- don’t ensure that everything conforms to the standard Meucci approach;
- do re-use existing code, as long as you properly document this;
- don’t tell clients about IID invariants;
- don’t implement the wrong mandate, even if it’s easier for you;
- don’t blindly copy the code of the first student to get something running;
- do provide clear intuitions throughout;
- do label graphs properly, including axes;
- do describe your data sources;
- don’t waste space in your technical document explaining generic matters (e.g. why we need to identify invariants).
- don’t make vacuous suggestions for improving your algorithm (e.g. used longer time series, tested on more data, etc.)
5
C. Rowat Risk Analytics
• do write new code if it doesn’t exist, and upload it to GitHub
To install Juypter Notebooks on your personal machine follow the instructions here, noting the strong recommendation to do so via Anaconda.
The IB platform will contain all the historical data required for the project. The IB Python API is designed to work via the command line, so occasionally runs into problems in a Note- book. (This stackoverflow thread documents a problem with argparse.) One workaround is to individually alter elements of the API. Another is to use a framework like IB insync to meld the API into non-command line environments like Notebooks.
Other financial libraries that can be used in Python include Alphalens, QuantLib, and Pyfolio.
Students can also use the Bloomberg terminals available in the Alan Walters building. (Fa- miliarity with Bloomberg terminals would look good on a CV.) The University also subscribes to Thomson Reuters’ Datastream and ThomsonONE.
References
Connor, Gregory, Lisa R. Goldberg and Robert A. Korajczyk (2010). Portfolio Risk Analysis. Princeton University Press.
Daníelsson, Jón (2015). What the Swiss FX shock says about risk models. Tech. rep. url: http: //voxeu.org/article/what-swiss-fx-shock-says-about-risk-models.
McNeil, Alexander J., Rüdiger Frey and Paul Embrechts (2015). Quantitative Risk Management: Concepts, Techniques, and Tools. revised. Princeton Series in Finance. Princeton University Press.
Meucci, Attilio (2005). Risk and Asset Allocation. Springer Finance. Springer.
— (2017). ARPM Lab. url: https://www.arpm.co/lab (visited on 14/09/2017).
Resti, Andrea and Andrea Sironi (2007). Risk Management and Shareholders’ Value in Banking.
Wiley Finance. John Wiley & Sons.
Shin, Hyun Song (2010). Risk and liquidity. Clarendon Lectures in Finance. Oxford: Oxford
University Press.
6