358 points · by dmmalam · 10y ago · 145 comments
Note there's broadly two kinds of quants.
One is a derivatives quant, basically someone who spends a lot of time working out the values of derivatives. So you're looking at ito calculus and iterative methods to find the value of contracts with weird clauses (Knockouts, Cliquets, vanillas, etc), and then building spreadsheets to calculate the hedges for those trades as time goes by.
The other is strategy quants. Here you're looking for some way to beat the market. So you're reading in a bunch of data from various sources and applying some sort of quite open-ended analysis on it to come up with rules for a trading system. You then build a framework for trading such systems, which can get very involved eg execution algos that read realtime market data.
I started off in derivatives as a trader but quickly moved on to the other. They're both fairly deep, and both require you to know coding and math.
The questions here seem to apply mostly to derivs quants, but strategy quants have found many things applicable.
- You get to know something that isn't published. You find a strategy, you don't tell anyone. Sure, you can talk about it in broad strokes (we're trend following...) but it's pretty unlikely you'll ever tell anyone enough for them to be able to replicate it. Except people you trust, of course.
- You're always thinking about philosophy of science. How do I know that this series of steps I'm doing is not just a monkey and a dartboard? Again, there isn't going to be a specific written paper that tells you the answer.
- At one end of it, you are working with cutting edge technology. Anything that shaves a microsecond off the speed is useful, and you can spend a lot of time optimising such things. I've been staring at a C++ solution that is 100% in house. No STL.
- At the other end, you are working with data in very modern ways. All that ML stuff in the news is interesting to quants, because if there's one thing ML papers are about, it's how to avoid overfitting. Just a few years ago people in the field had not come across ML, or at least the point of view that ML brings. Plenty of other things had already come up, though, like information theory, time series econometrics, signal theory, and so on.
- About derivs quants, it's not my cup of tea, but I can see how others like it. You're basically pricing things hoping that you've noticed something the counterpart hasn't, or hoping you've found a cheaper way to hedge than your competitors, or simply hoping your salesman is a better salesman than the other guy's.
I could see derivatives pricing being boring, not as much room for creativity there. The strategy/trading quant work is like a super open-ended science problem with a constant stream of new challenges as you try to outperform yourself or the competition.
FWIW, I don't think these are great questions for strategy quants. Some of the best people I've worked with a.) used very, very basic ML techniques b.) were just naturally smart/clever enough to engineer great features. and c.) had incredible attention to detail, didn't "hand wave" away the dirty work like checking/cleaning data or executing the model in practice.
Imagine playing a huge board game with a bunch of very smart (as in, MIT math PhD smart) players that spend every waking hour trying to come up with strategies, and every time you come up with a good strategy the entire metagame of all players quickly adapts to its existence so the game stays interesting (except for some that lose before they can adapt and have to leave the game.)
Factors in a good game strategy might include fast thinking, every historical move a player played in the game, human psychology, poker-type bluffing, reverse engineering algorithms based only on their outputs, correctly predicting the future of industries and companies, headlines on the news, sentiment analysis on social networks, predictions of election results (and stuff like the Brexit referendum), as well as the complicated rules of the game itself, and Sicilian Reasoning (http://webdocs.cs.ualberta.ca/~darse/rsb-results1.html).
Some things you might do as part of a strategy: charter a fast ship to send information to your friends in another market before it becomes public, so they can buy a lot of stuff before it's price goes up; buy a donut every week in the same shop and keep track of receipt serial numbers to estimate changes in a franchise's weekly sales before anyone else knows them; use satellite imagery of Walmart parking lots and some computer vision algorithms to get a very good estimate of their sales; borrow $10Bn from your friends and use it all to sell British pounds in a very short period of time, forcing the British government to stop pinning the pound-dollar exchange rate and making $1Bn in the process; install a spy network throughout Europe so you get information on the result of the battle of Waterloo a day before the King's intelligence service, spread a rumor that Napoleon won, buy everything that got cheaper because of the rumor, then the next day sell it when the truth that he lost arrives and use the money to more or less buy everything of value in Britain.
At each point in time there is a clear tracking of scores so you can know exactly how well you're doing relative to every other player.
And the best thing is, you get paid the best salaries in the market to play this game.
I love being an entrepreneur because of how open the rules of the game are and how many creative moves I can pull off to get advantage without having to convince some judge or committee or boss that this is a good idea. Strategic quants have all this and the additional benefits of immediate feedback and a great salary with low risk.
I enjoy the domain, but also that I can use functional programming languages.
So during his interview, they spent half an hour deriving the Ito integral from scratch and then proving some properties of it.
Basically, it's a "have you heard of this" type thing.
https://news.ycombinator.com/item?id=8698986#8699260
I think most of what I wrote is still valid.
I believe the below reference:
http://www.decal.org/file/2945
and the book Heard on teh street are also great refresher's for the type of material you'll need.
https://www.amazon.ca/Heard-Street-Quantitative-Questions-In...
To be honest most of this won't matter, the number one qualification for becoming a quant is a Phd from a top tier university.
I'm one of the very few quants i've met that doesn't have a Phd, if you don't have one then its going to be a tough road ahead. YOu'll often hear people call themselves a quantitative developer if they come from a computer science background.
That might be the most over used phrase on wall street:) It's kind of akin to calling yourself an architect, in that one firms architect is another's junior developer. The term really means nothing and is given out like water, sort of how the engineering term gets tossed around in software dev firms.
I've got a pretty long back list of emails from hacker news to get through but if you have any questions about the job, please feel free to email. Just keep in mind that between year end, the US election and life a reply might take a while.
EDIT sorry I see that someone used the term quant dev while I was typing. No insult intended. There are some amazing quant dev people on the street.
We're going to play a game. You draw a random number uniformly between 0 and 1. If you like it, you can keep it. If you don't, you can have a do-over and re-draw, but then you have to keep that final result.
I do the same. You do not know whether I've re-drawn and I do not know whether you've re-drawn. Decisions are made independently. We compare our numbers and the highest one wins $1.
What strategy do you use?
EDIT: The answer is not 0.5, it is not 0.7 either.
EDIT: I'll show my work, rot13'd...
Jr pna cnenzrgrevmr n fgengrtl ol n guerfubyq g: gur inyhr gung gur svefg qenj arrqf gb or yrff guna va beqre gb pubbfr gb qenj ntnva. Hfvat guerfubyq g, gur cebonovyvgl bs trggvat yrff guna g vf g^2 orpnhfr lbh unir gb qenj orybj gur guerfubyq gjvpr va n ebj. Gung chgf gur cebonovyvgl bs raqvat hc nobir gur guerfubyq ng 1-g^2.
Gur cebonovyvgl vf havsbez nobir naq orybj gur guerfubyq fb gur cebonovyvgl qvfgevohgvba bs lbhe ahzore vf:
cqs(k) = { g vs k<g ryfr g+1 }
(Gur g+1 vf sebz fbyivat gb znxr gur vagrteny sebz 0 gb 1 or 1.)Fnl lbhe bccbarag hfrf fgengrtl h naq lbh hfr fgengrtl g. Gura jr jnag gb znkvzvmr gur cebonovyvgl gung K~cqs(g) vf terngre guna L~cqs(h). Zngurzngvpn jvyy gryy hf gung vs jr nfx yvxr fb:
q[g_] := CebonovyvglQvfgevohgvba[Vs[k<g, g, g+1], {k,0,1}]
Fvzcyvsl[
Cebonovyvgl[k<l, {Qvfgevohgrq[k, q[g]],
Qvfgevohgrq[l, q[h]]}],
0<g<1 && 0<gh<1]
Gung tvirf hf gur cebonovyvgl gung g orngf h yvxr fb: c[h_,g_] := Cvrprjvfr[{
{(1+g-(1+g+g^2)*h+(1+g)*h^2)/2, h>g},
{(1+g-g^2+(g-g^2-1)*h+g*h^2)/2, h<g},
{((g^2-1)^2-g*(g^2-2)*h)/2, h==g}}]
Abj jr jnag gur g gung znkvzvmrf gung sbe n tvira h, juvpu jr trg ol gnxvat gur qrevingvir jvgu erfcrpg gb g, frggvat vg gb mreb, naq fbyivat sbe g: Fvzcyvsl[Fbyir[Q[c[g, h], g] == 0, g], 0<h<1]
Fb abj jr unir gur orfg erfcbafr gb na neovgenel fgengrtl g: oe[g_] := Cvrprjvfr[{
{(1+g+g^2)/(2+2*g), g<(Fdeg[5]-1)/2},
{(1-g+g^2)/(2*g), g>(Fdeg[5]-1)/2}}]
Vs lbh cybg gung lbh frr gung gur orfg erfcbafr vf nyjnlf orgjrra .5 naq .618. Vs lbhe bccbarag nyjnlf xrrcf gurve svefg qenj gura lbh fubhyq hfr n guerfubyq bs .5. (Fnzr vs gurl nyjnlf gnxr gur frpbaq qenj bs pbhefr.)Ohg gurl jba'g qb gung. Vs gurl hfr n guerfubyq bs 1/2 gurzfrys gura oe[1/2] == 7/12. Ohg gurl jba'g qb gung rvgure. Jung jr jnag bs pbhefr vf gur svkrq cbvag, vr, gur Anfu rdhvyvoevhz, jurer oe[g]==g. Gung, boivbhf va gur cybg, vf g = (Fdeg[5]-1)/2 nxn gur tbyqra engvb!
After some simplification, total Player A win probabilty is (-ba^2 + (b^2-b+1)a +(b^2-b+1))/2. Find a that maximizes this probability for any given b by taking the derivative and setting it to 0, which would be a = (b^2-b+1)/2b.
The game is symmetric, so at Nash equilibrium a==b. Now solve a = (a^2-a+1)/2a to get the golden ratio.
The lift over naive 0.5 threshold is very small, though, less than 1%.
Edit: thanks. This is convincing, but... given that we're looking for a fixed point of a process like... [bah, I lack words to describe a vague, non-rigorous intuition]... I expect that there is a convincing one-sentence explanation that also shows it to be the golden ratio. Am I wrong? Can anyone give a simpler explanation?
Your optimal strategy involves maximizing an objective function that depends upon your opponent's strategy. "Assume nothing" about your opponent is an incomplete problem specification, because you must assume something in order to determine which function to maximize.
For example, consider that your opponent chooses to redraw any time his number is greater than 0.5. His expected value then becomes less than 0.5, which means that if you choose to redraw any time your own number is below 0.618..., then your strategy is suboptimal.
So, we have to assume something about the opponent's strategy. Is it a uniform strategy state space? Is it a state space where both players are superrational?
Decisions and draws are independent - we can ignore the other guy and just go for the highest value. Draw the first number. If it's below 0.5, draw again, since the odds then are that the next draw will be higher.
Is there more?
def tournament(a, b, n=1000):
return sum(a() > b() for _ in xrange(n)) / n
def redraw_below(c):
x = random.random()
if x < c:
x = random.random()
return x
In [23]: tournament(lambda: redraw_below(0.5), lambda: redraw_below(0.6), n=10000000)
Out[23]: 0.4948004
In [24]: tournament(lambda: redraw_below(0.5), lambda: redraw_below(0.6), n=10000000)
Out[24]: 0.4948039
In [25]: tournament(lambda: redraw_below(0.5), lambda: redraw_below(0.6), n=10000000)
Out[25]: 0.4948802
`redraw_below(0.5)` only beats `redraw_below(0.6)` 0.4948 of the times, very consistently, over three sets of a million rounds.This is despite `0.5` giving a better average (0.624 vs. 0.620).
I'll think about why, but the result is very consistent and can't be ignored.
For example, suppose you're playing against someone who has taken the "reroll values greater than 0.5", giving them the expected value of 0.625.
If you roll the value 0.55, you expected to lose more than half the time, because their expected value is 0.625. So you should reroll anyway.
The reason I'm wrong is that you are opposing another person's numbers - the expected dollars for a given number isn't linear. A .30 is worth way less than half as likely win you money than a .60 is.
Because of this, the shape of your distribution matters more than its "average" value.
I can't believe I forgot that AVG(F(X)) ain't necessarily F(AVG(X))
def round():
x = random.random()
if x <= 0.66666:
x = random.random()
y = random.random()
if y <= 0.5:
y = random.random()
return x >= y
sum(round() for _ in xrange(10000000))
5001450
sum(round() for _ in xrange(10000000))
5004434
sum(round() for _ in xrange(10000000))
5000238
I also ran a test of 0.6666 vs. 0.625, and... sorry to say, but 0.625 wins hands down.Now, you get. 0.500001 on your first turn. There is a 25% chance they got less than 0.5 so you win 25% of the time. Well, if they are randomly under 50% then you have a better than 75% shot of beating them with a reroll. (50% your over 0.5 and thus win and 25% you are under 0.5 and still win.)
But, they are above 0.50 then you gain a 25% chance of beating them (coin flip for over 50% and 50/50 odd or 50% of a loss) your under 50% and have even odds. Thus, you go from 25% win chance to .25 * .75 + 0.75 * 0.25 or 0.375% which is better odds for re rolling.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
for (double d = 0.25; d < .75; d += 0.01) {
double e = 0;
for (int j = 0; j < 100000; j++) {
float r = ((float) random()) / ((float) RAND_MAX);
if (r < d)
r = ((float) random()) / ((float) RAND_MAX);
e += r;
}
printf("d %lf e %lf\n", d, e / 100000);
}
}[1] probably has to do with the probability distribution having a shape more interesting than a Gaussian bell
For example, consider a similar game where you draw and then optionally re-draw (like in the original game) but the amount of money you win if you end up with a number p is p if p < 0.8 and p + b if p > 0.8, where b is some constant. Then you're also trying to "go for the highest value". However it is clear that in the limit of large b, your best strategy is to redraw if p < 0.8.
Though in this problem it seems the "average" final number would be 0.625, not 0.75 - since half the time you have an 0.75 expected outcome and the other half a 0.5 expected.
I haven't solved it yet, but it's definitely some kinda recursive formula where you have to assume the other guy is also playing the optimal strategy.
I think it can be solved by searching for a pure strategy nash equilibrium
So is this one of those questions that's not possible to answer you're just trying to see how they handle the stress of the unsolvable?
If the adversary was only allowed one pick I guess I'd only re-draw if I had less than 0.5 since statistically you'd be more likely to have a greater number than a weaker one. I'm not sure what the maths are but a simple implementation gave me an average value of about 0.625 using this strategy, so definitely an improvement over a single pick.
But I have the feeling that since the adversary can chose the same strategy maybe you should be a little more aggressive and redraw if you are at 0.5? But then the adversary would do the same so I guess the solution would eventually converge to a value a little above 0.6?
That'd be my guess at least.
calc: p(a union b) = p(a) + p(b) - (p(a)*p(b)); p(>=.7)=3/10; .51 = (3/10) + (3/10) - (.3)(.3)
The idea is to find a Nash equilibrium, but the question is stated in the wrong way, since it gives no indication that you're in a position to make any assumptions about your opponent's strategy.
Mark Joshi has a cheat sheet intro to the profession: http://www.markjoshi.com/downloads/advice.pdf
Joshi co-authored the standard reference for quant interview preps called Quant Job Interview. Interview questions with solutions. It's available on Amazon.
If you just wanna try brain teasers, google something like "ext:pdf quant interview". There are many of them.
I personally believe it's hard to self-study since there's many graduate-level math prerequisites that are required if you don't want to just be a programmer.
For example stochastic calculus which is the area of math around black scholes option pricing requires graduate level probability (i.e., one taught with measure theory which is itself is a graduate level class after analysis).
I do know of some people who tried to put together their own curriculum though: https://www.quantstart.com/articles/How-to-Learn-Advanced-Ma....
I'm curious what sort of side projects I could try that others could take notice on.
I would say those questions are for recent graduates who want a junior quant role.
What I mean is that you should be learning basics maths anyway, and when you know a bit you can solve all those questions.
What a lot of people could benefit from is learning how to learn.
EDIT: Thanks for downvotes guys. Should I also downvote when someone says "don't be discouraged with distributed systems, or asynchronous programming" etc? I don't know those things, so maybe I should downvote those people?
Anyway, thanks for the feedback.
Parts 2 and 3 are probability and statistics, but they are the kind of advanced statistics that is typically only taught to math students. Second and third year university courses in probability and statistics would let you answer these questions.
Part 4 is statistical mechanics, I think. That's a third-year physics course, and one of the more mathematically demanding ones, at that.
Part 5 is specific to finance. The course you are looking for is probably called Mathematical Finance.
The conventional route to learning all this stuff is an undergraduate degree in mathematics, with an emphasis on statistics. Now, getting there is a long road, but you have to start somewhere. You might possibly be able to learn it all on your own, but it's easy to get stuck and hard to get unstuck without a teacher to help you.
If you are in the US, start by taking a couple of classes in a community college. In your case, the course you are looking for is probably called Pre-Calculus or maybe Algebra II. If things go well you can continue from there.
As for what use this is, apparently you can get a good job as a quantitative financial analyst if you know this stuff.
I'd be willing to bet that the vast majority of people who got through a college CS degree would be able to pass this after a couple months of self-study.
(On that note, anyone want to chime in on what the job options would look like if someone had a CS degree and could pass this?)
It's just such a terrible feeling, knowing at one point in the past you would have been more speedy with something and noticing what time has done to your skills.
Do any of you have any strategies for not loosing knowledge? Would re-reading textbooks every couple months be a solution? How do I decide if it's even worth - I don't necessarily _need_ this type of knowledge for what I'm doing now but loosing skills you know you once had feels awful.
Mathematical Finance Cheat Sheet:
I know Oana, if there are any questions about the problems or the course sequence that they fit into let me know.
IIRC Consider sqrt(x+sqrt(x +... = x
You need to check the series converges (this can sometimes be tricky but seems the questions tell you they converge). Then you can do this substitution for the infinite piece:
sqrt(x+x) = x
x^2 = 2x
x^2 - 2x = 0
...
y = 1/(1+y)
[IIRC there are situations where a different substitution yields a different result - I don't recall the details]
I guess those Ramanujan-like infinite series are a bit like trivia questions, right? Does anyone really have an intuition to solve something like that?
Options pricing is Black-Scholes equation and related equations
Based on the challenge of most of these questions, I would hazard a guess and say only very recent grads would be able complete these. I'm 6 years out of Princeton, but I've forgotten how to do probably 90% of these questions.
Parts 3/4/5 require some pretty specific rules that are more rote memory than anything else.