Browse Month

October 2017

Quantitative Challenges

I spent about two to three hours studying and then working through mathematical problems on quantitative finance today. Specifically, these were questions from Blyth’s An Introduction to Quantitative Finance and dealt with interest rate swaps. These are contracts where one party typically pays fixed payments (e.g. 5%) and receives floating payments, which are dependent on market rates (e.g. LIBOR + 1.5%), though float-float swaps exist too (e.g. across currencies). Swaps can be used to mitigate interest rate risk (or gain exposure!); they can also be mutually beneficial depending on companies’ borrowing characteristics.

If I had to classify the mathematics involved in the problems I did, beyond “applied” I’m not sure how else I could label it. For many of these problems, the first steps involved figuring out how to mathematically model the financial products involved. There then followed some elementary algebra, along with proofs that required some intuition to pick the right approach (for lack of a better word). The exercises I did this time around relied less on probability than normal; much of this probably stemmed from a result that forward interest rates (i.e. the interest rate you’d get from future time T1 to later future time T2) could be valued independent of the distribution of possible values.

I’ve struggled quite a fair bit with the book, both in terms of the reading material as well as the exercises. Today’s chapter was relatively easier, though that might have been because I was reading through the chapter for the second time. It was my first time doing many of the exercises, though it seems like they went relatively smoothly today.

Some of this might be because I work through the chapters at a very relaxed clip of about one per month. Like many other mathematical domains, there tend to be many dependencies on previous topics. The earlier result I mentioned on forward interest rates, for example, was from the previous chapter; yet, it was instrumental in computing the valuation of a swap. There are certain fundamental ideas that I learned way back in 422 (Computational Finance at Imperial). I also think my mathematical knowledge and logical intuition have (hopefully) mostly stayed with me. Furthermore, I like to think that I remember the concepts at a high level. However, many proofs require recognizing that expressions are in certain forms and can thus be rewritten; I’m still yet to develop that level of familiarity – or shall I say intimacy – with the content.

This might also be partially self-created, especially where the reading material is concerned. When I see theorems, I tend to try my hand at proving them on my own first. These often prove to be rather tricky endeavors; the aforementioned lack of keen familiarity with the material certainly doesn’t help. Typically, I can understand the proofs fairly easily when reading them. However, I usually expect myself to figure out the intuition behind the proof (including reproducing it, at least at a high level), which isn’t always so forthcoming. That actually reminds me of what I used to do at Imperial for certain modules, especially the (in my opinion) two hardest of the course: 438 Complexity and 493 Intelligent Data and Probabilistic Inference. I would make the effort to understand why many of the proofs in those courses worked. I’d also try to figure out how the author might have come up with the proof, or at least what the core intuitions might have been. This included relatively nasty ones (e.g. SAT being NP-complete via direct argument, or ELBO results in variational inference), and I think it paid off in terms of understanding.

It could be argued that finding the material difficult is expected, because the subject matter is itself complex. I tried to obtain a popular estimate of the complexity of the material covered by the book, but didn’t find much data; there were only a handful of reviews on Amazon, which offered a wide spectrum of views (from “[o]ne of the best introductory treatise (sic)” to “I would hardly call it an “Introduction” to quantitative finance”). I’m not sure how to start more simply, though; there is a fair bit of assumed mathematical knowledge, but this is at least partly spelled out in the introduction.

While the book has proved challenging at times, I’ve not found it too hard to follow. Discussing the problems with a friend has also helped a fair bit, especially since the book doesn’t have solutions!

503 Service Unavailable

I had a somewhat nasty chest infection over last week. It seemed to reach its peak last Sunday. I think “incapacitation” describes what happened fairly well; I felt like I was consistently running headfirst into an imaginary wall. I slept for about 4 hours on Sunday afternoon, and another 12 at night; probably at least 11 if not 12 on Monday evening as well.

I think I recovered somewhat through the week, though not yet completely. It was enough to host a programming contest on Friday, and to sing (though not convincingly) on Friday evening as well. It has been quite a while since I had been unwell to this extent. I don’t think I’ve had anything of this scale since I started studying at Imperial 5 years ago.

It served as a good reminder of the importance of health, something which I tend to not really think about very much. The cough did get in the way of my sleep as well, so I spent a good amount of time thinking. These thoughts ranged over quite a number of issues, including goals, planning, work and logic. I’m sure some of these must have been influenced by said illness, but there were some actionable ideas and thoughts. I did think about two aspects of what I call the “dark side of compound interest”: (i) the possibility that one may not be around to enjoy the results, and (ii) the inclination to discount present purchases by a lot by thinking about their value in the far future. I don’t think my chest infection was that serious at all, but (i) certainly looks influenced by it.

The post for this week is much shorter than normal, as I haven’t been able to gather the mental resources to write much longer. This also isn’t one of those “if I had time, I would have written a shorter letter” scenarios, to be clear! I’ve been making an effort to produce somewhat more readable and simpler writing. I think it’s a sufficient status update.

The Time Value of Money

There is an apocryphal interview question I’ve come across several times:

Would you prefer to have a dollar today or a dollar one year from now?

I do technical interviews for software engineers. Hence, this isn’t a question I would typically ask candidates (even if at times I wish it was – it could be interesting to see how candidates react!). Although it naturally seems like it would fit in a financial context, it seems too easy to be used as a serious question.

Anyway, the answer I’d go for is “today”, because I could take the dollar and put it in the bank to earn interest. In practice, I’d invest the dollar. Furthermore, inflation is more likely to be positive than not, and this eats away at the value of the dollar. The idea that getting the dollar now is better is known as the time value of money. That said, I can also see legitimate cases why one might argue for “one year from now” – mainly centering around the idea that custody of the dollar is taken care of (assuming we allow this to be assumed!).

Conversely, if you asked me a slightly different question:

Would you prefer to have a dollar today or $100 one year from now?

I would probably go for the hundred dollars, because my investments are very unlikely to increase hundred-fold (unless we have hyperinflation) in a year. As before, there are legitimate cases why one might go against the grain of financial theory – cash flow issues, in particular.

If the amount is reduced a fair bit, such as to $1.09 (for me at least), then the decision gets more difficult. Using some kind of intermediate value theorem, there should be some value of r for which I’m indifferent to this question:

Would you prefer to have a dollar today or $(1 + r) of today’s dollars one year from now?

The conventional theory here is that if I got the dollar today, invested it for a year, and then have (1 + r) of today’s dollars, then I should be indifferent. I’m not sure I agree in practice. This is mainly because of the aforementioned cash flow issues. If 6 months on I find that I need the dollar, I can take it out and still keep the partial returns. You would need to give me an illiquidity premium. (Of course, I’ve assumed here that I invest in liquid securities.)

There is also another shortcoming of this question. The size of the capital relative to my net worth would also affect my answer. Rather interestingly, I think I would take the money early for small or large amounts, but consider waiting for medium-sized ones.

For small amounts, I would need to remember that a capital inflow is coming in a year’s time. The cost of tracking this could exceed the “premium” I derive from waiting. Conversely, for massive amounts, we start delving into the realm of diminishing marginal utility – if I could pick between $1 trillion today and $1.1 trillion this time next year, I’m pretty sure I’d pick the former.

Up to this point, we’ve also avoided what’s known as counterparty risk. The person offering the money might become insolvent within the year. This would bias people towards taking the money now, and is reminiscent of a well-known proverb (“a bird in the hand is worth two in the bush”).

Nonetheless, this practice of time discounting is useful when trying to assess the value of investments or securities, such as annuities or structured products. It is also frequently used in discounted cash-flow analyses, which are useful for determining if business ventures are likely to be profitable. I have not had to put this skill into practice yet, though (well, apart from the Computational Finance exam I did at Imperial).

In theory, these concepts should be applicable to other resources or assets which (1) appreciate over time, and (2) can accumulate in value without substantial effort. That said, I’ve struggled to think of assets outside of the standard “investment” universe (stocks, bonds, real-estate, commodities, private equity, collectibles?) that satisfy both criteria.

I did think of social capital (i.e. friendships, reputations) and human capital (for me, software development and other skills). They don’t seem to satisfy (2), though it could be argued that (2) is too strict. For example, by going about my daily routine, I already (hopefully) absorb more and better dev practices. Similarly, one needs to (well, should) do one’s homework regarding asset allocation and understanding one’s investments. Also, in practice to maintain one’s asset allocation one needs to rebalance a portfolio.

Road to Somewhere (2017 Q3 Review)

Q3 felt very much like a quarter of consolidation, as opposed to development or novelty. The two main highlights of the quarter for me were IJCAI17 and a rather convoluted hack week project at Palantir that reminded me of the applicability of raw CS theory to daily work (of course, getting an award for technical achievement was great as well).

On the coding front, there was a goal last quarter to merge 30 pull requests on AtlasDB. I hadn’t been tracking this, but it turns out that this target was actually hit on the nose. I’m somewhat surprised, as I was out of the office for two weeks, and a fair bit of my time was spent looking at other projects as well. It is very tempting to set the next goal at 31, and I think I’ll bite – though given a likely winter break and some other leave that I do want to take, I’m somewhat doubtful that I’ll hit 31 in Q4. I also had a good conversation with my lead on possible next steps for growth; I can’t say too much other than that there is consensus, and I’m excited.

Turning towards an academic focus, the elephant in the room is IJCAI 17. I was initially skeptical I would enjoy it. I initially imagined that I would be unable to follow the presenters as they eagerly pushed the boundaries of our AI knowledge. Furthermore, the amount of money I spent on it in total was a very solid chunk of the quarter’s expenditure. However, it turns out these concerns were unfounded. There were some talks that I wasn’t able to follow, likely owing to a lack of familiarity in the relevant field, but many of them were very understandable. In general I really enjoyed the experience; I was impressed by the intellectual depth and complexity of many of the presentations.

The LDLK talk itself also went better than expected; it was scheduled at 8.30 am on a Friday morning, but nonetheless many people showed up! I was happy to present in person; this is one of the few things from my time at Imperial that I can truly say I’m proud of. In general, I also enjoyed the social events, meeting Alessio and subsequently exploring a bit of Melbourne (granted, this does not have an academic focus).

Looking forward, MCMAS-Dynamic still has one more paper that can be wrung from it, this time on some of the later-stage results. The paper is well in the pipeline now, though writing it is proving more difficult than either of the previous papers. When I was writing the thesis, I focused more on getting the algorithm right and implementing it correctly than giving a full formal proof! Thus, the core algorithm remained unchanged, but I certainly waved my hands a fair bit regarding some of the more intricate details.

Financially, my portfolio pretty much went sideways over the period, though a late rally pushed it up a bit, leaving it at plus 0.9 percent (total return). In spite of surges in international stock markets, I think the pound recovered a little bit as well especially towards the end on news of a possible Bank of England rate rise. I also sold off a bunch of pounds when GBPUSD broke 1.35. We can see how this compares against a bunch of other investment options:

(N.B. I have positions in the Fidelity World Index and iShares Global Property Securities Tracker. Also I do have holdings in active funds, although I’ve been comparing with trackers for benchmarking purposes.)

Not too unreasonable. UK stocks look like they outperformed and REITs were pretty battered, hence I did worse than the Vanguard fund. Also, we can see the impact of the pound’s (minimal) recovery in some of the delta between the Fidelity and Vanguard total world funds.

Spending this quarter shot up significantly. The obvious rises were in travel and individual meals, which was to be expected given IJCAI. Clothing expenses fell significantly, though I think there might have been some self-control failures last quarter as the amount spent in Q2 looks absurd in hindsight. I’ve been keeping up the routine of walking to and from work, and this shows in transport expenditures as well. Last year’s mean transport expenditure was 81.82; this quarter’s was 18.80 (and the average for the year-to-date is 25.02). That said, I noticed that I’ve been wearing through shoes faster, but I haven’t weighed that cost in yet!

On the comms front generally things have been going well too, though there have been some minor lapses. I think a fair bit of this is not so much in that I’m not seeing my friends, but in terms of the side activities (reading groups) we used to do more actively and/or diligently. I guess being aware’s the first step here. Also, reconnecting with some friends from high school and from my UTA group has also been great.

I think the period was somewhat gentle overall, but in no way calm. I have a tendency to expect higher standards from myself if things seem easy-going, and this can be stressful (I know, it’s a bit of a perennial struggle for me). I’d toss my standard “A League of Their Own” quotes at it if I’m feeling energetic – good things are often meant to be hard – but for some reason I haven’t always had the energy this time around. Some of this might be due to mild illness (had a cold in Melbourne, now having a cough).

I’m not sure why, but Shawn Mendes’s “Mercy” has been a song I’ve been listening to a fair bit this quarter. The obvious interpretation is one where the speaker is singing to an unreciprocated love interest. However, Mendes has suggested an alternative (about mercy from the stress of his career). I independently came up with another variant; I see the speaker singing it to an idealized, but critical version of himself, which is a voice I have in my head at times. We have from the chorus:

Please have mercy on me, take it easy on my heart
Even though you don’t mean to hurt me, you keep tearing me apart
Would you please have mercy on me, I’m a puppet on your string
And even though you’ve got good intentions, I need you to set me free –

It’s kind of a spirit willing / flesh weak type of problem; there are many things I know I want to do that I think would be beneficial, but I find that my bandwidth is already pretty heavily taxed. “Why aren’t you finishing that feature yet?” “Why aren’t you getting your 8 hours of sleep?” “When are you going to get round to writing that paper?” It’s painful, and at times I need respite, but I still do appreciate this voice. It does often serve me well, even if it has to cry out multiple times with the same request before corrective action is taken.

Q4 will have the usual engineering, finance and friendships targets. I have relatively fewer plans for the period (going into Q3 I knew that IJCAI was a thing). I might need to consider and decide if there is anything additional I should pick up.