# Deciding how many trades to make

I recently sat a technical interview with a prop trading and market making firm. I didn't pass the interview, and I was wondering about answering one of the questions they asked me.

So the interviewer had a deck of cards and said that each card is worth it's face values, with A = \$1, J = \$11, Q = \$12 and K = \$13. He then dealt out three cards face down and told me that he was willing to trade them with me for \$15. So I could choose to sell them to him for \$15 or buy them off him for \$15. Now I know the expected value of the 3 cards is \$21, so I should obviously choose to buy them off him to make an expected profit of \$6 per trade. But he also asked me how many times I wanted to make the trade, and I don't know how to answer that question. What goes into the decision making process to determine the number of times you execute a trade? He said I started off with \$1000

• On average you make 6, how much do you lose in the worst case? How many such losses would you be willing to take before walking away with what's left of your 1000? (I am not sure what he has in mind, but I think he is asking you to set some a priori risk guidelines before you start playing). – Alex C May 31 '18 at 12:31
• look at Kelly criterion. – kdragger May 31 '18 at 12:38
• @kdragger Kelly Criteria is a great starting point and is what you get from maximizing the expectation of log wealth. More generally, you can solve for alternative decision rules based upon higher or lower risk aversion. With CRRA utility (such as log utility of Kelly betting), you obtain an optimal fraction of your total wealth to bet, which is slightly different. This question has a certain discreteness to it. – Matthew Gunn May 31 '18 at 19:16
• IMHO this is a kind of an uninteresting game because there's no substantive risk of ruin. – Matthew Gunn May 31 '18 at 20:06
• sounds like optivers first round – Dale C Jun 4 '18 at 5:43

If this was actually for Optiver, essentially they were just looking for you to be able to intuitively size your bets using the same logic that the Kelly Criterion sizes bets, without actually deriving it.

Essentially you should've deduced something like:

1. Playing this game correctly is always non negative EV, so you want to place as much money in total at it as possible (so bet more).

2. You have a finite source however and ever hitting 0 is a permanent loss of EV in future turns you could've kept playing this game (so bet less).

3. You have a finite number of turns (at least in Optiver) (so bet more).

Synthesising all this you should be able to assume that,

1. The higher the EV of the individual offer the more you should bet (obviously).
2. The more turns you play, the closer you get to the end of the game, the more you should bet (EV being equal). In fact when they say its the last turn, you should always go all in. (Addresses point 3).
3. The less money you have, the less you should bet, and in fact if you're self consistent, it should be proportional. (Addresses point 2)

This is all just qualitative Kelly Criterion.

They don't really care about risk aversion or utility theory based on my experience, in fact they stated they just want you to maximise dollar value.

• Why should you go all in the last turn? If the objective is to maximize your expected winnings, the solution is to go all-in every turn. It the objective is to maximize your growth rate, you shouldn't go all in on any turn. – Matthew Gunn Jun 5 '18 at 13:59
• Going all-in every turn does not maximise EV for +EV multiple turn games, that's the point of Kelly Criterion. As an extreme example, say you're playing betting on a biased coin-flip with even payouts which is slightly positive EV (51-49), and you get to play this game 1,000,000 times. According to you, we should go all-in from the start since we are +EV. However we have a 49% chance to lose all our money straight away, missing out on 999,999 more chances at this positive EV game. Going bankrupt on the last turn doesn't matter as you don't get to play the game anymore regardless of your profit – Dale C Jun 5 '18 at 23:54
• @MatthewGunn Hence maximising EV on the last turn is just putting as much money as you have (or can afford to lose in the case of shorting) – Dale C Jun 5 '18 at 23:57
• Imagine there's a fair coin where if it lands heads, you get paid 2 to 1. You get two flips. You bet $b$ of your wealth on the first flip, then 100% of your wealth on the 2nd flip. After the first flip, you have either $1 + 2b$ or $1 - b$ with equal probability. Therefore after the 2nd flip, you have either $0$, $3 + 6b$, or $3 - 3b$ with probability $\frac{1}{2}$, $\frac{1}{4}$, and $\frac{1}{4}$ respectively. The expected value is hence $\frac{3 + 6 b + 3 - 3 b}{4} = \frac{6 + 3b}{4}$. What value of $b \in [0, 1]$ maximizes the expected value? – Matthew Gunn Jun 6 '18 at 1:16
• In the game I described above, going all in every round ($b=1$) for $n$ rounds gives you a $\left(\frac{1}{2}\right)^n$ probability of having $3^n$ and $1 - \left(\frac{1}{2}\right)^n$ probability of having 0, hence an expected value of $\left(\frac{3}{2}\right)^n$ . You cannot get an EV higher than that. In contrast, the kelly fraction would maximize $\frac{1}{2}\log(1+2b) + \frac{1}{2}\log(1 - b)$. The solution to that is $b_{kelly}=\frac{1}{4}$. – Matthew Gunn Jun 6 '18 at 1:34

As the problem is currently formulated, you have a binary decision (whether to buy the cards or not) and a single state variable (your current wealth). I'm assuming the deck is reshuffled every play.

A policy function will be a function $f: \mathbb{R} \rightarrow \{0, 1\}$ that will say whether to buy or not buy the cards as a function of your wealth.

How to find a sensible $f$? If your preferences over risk satisfy the Von Neumann-Morgernstern axioms, those preferences can be represented by an expected utility function. You can then compare the expected utility of buying the cards vs. not buying the cards and find which is higher.

As an example, I will use $u(x)=\log(x)$ which is the same objective of the Kelly criterion.

## Expected Utility Theory

Let $w$ be a scalar denoting your wealth, $X$ a random variable denoting the sum of the three cards, and $u(x)$ a bernoulli utility function whose curvature formalizes a notion of risk aversion.

For $w=1000$, we can simply compare $u(w)$ with $\operatorname{E}[u(X+w-15)]$ where $u(x)$ is perhaps something like $u(x) = \log x$.

### How much would we be willing to for this gamble?

Solve for $p$ in:

$$u(w) = \mathrm{E}[ u(w + X - p) ]$$

MATLAB code to do this:

cards = ones(4,1) * (1:13); % Matrix of all the cards
deck = cards(:);  % vectorize it
three_card_hands = combnk(deck, 3); % all combinations of 3 card hands
X = sum(three_card_hands, 2); % sum across columns to get a vector with all 3 card sums
w = 1000; % set initial wealth
myfun = @(p) mean(log(X+w-p)) - log(w)
p = fzero(myfun, 15)


I compute that at a wealth of \$1000 and using log utility you'd be willing to pay 20.9798 for the 3 cards. At a wealth or$w=50$, you'd still be willing to pay 20.3 for the cards. If you had only \$15, you'd still buy the cards because $\log(15) < \operatorname{E}[\log(15 + X - 15)]$. You always buy!

A useful, related concept is the certainty equivalent which I discuss in this answer.

### Classic Kelly criteria

Kelly betting is to choose a bet size to maximize the expected growth rate of your wealth which is equivalent to maximizing the expected log wealth (i.e. you use a log utility function).

(Digression: maximizing your expected wealth typically leads to solutions where you bet everything on any positive expected value bet but go broke almost certainly. That's horribly dumb! Expected wealth is a poor objective. Kelly's insight is that maximizing the expected logarithm of wealth has far better properties)

The classic Kelly betting question of what fraction of your wealth to bet is a different question than the one presented here. For fun, we can solve for the Kelly fraction:

$$\begin{array}{*2{>{\displaystyle}r}} \mbox{maximize (over \alpha)} & \operatorname{E}[\log(w + \alpha (X - 15))] \\ \end{array}$$

Solve this with MATLAB code:

a = fmincon(@(a) -sum(log(w+a*w*(X/15-1))), 1)


I find optimal $\alpha^* \approx 1.2488$, that is, the Kelly fraction is to spend $\approx 124.88\%$ of your wealth each bet. (This can never take you below zero, because you can lose at most $\frac{12}{15}=80\%$ of your bet). If the $\frac{1}{22100}$, worst case happens of drawing three aces, you lose 99.9% of your wealth! In the median case, you add 50% to your wealth. (Yes, Kelly betting is quite aggressive.)

### Risk of ruin? (Monte-Carlo simulation)

In a quick Monte-Carlo sim I wrote of 1 million runs of up to 2000 plays, the minimum wealth I ever had was 960, and the minimum ending wealth (after 2000 plays) was 11533.

The game is fantastically attractive at a price of 15.

A real risk here is counterparty risk or risk the game is somehow different than what I've modeled here. (eg. why the heck would your counterparty play this insane game? Are you getting scammed?) If you lose more than \$40 playing this game, it raises serious questions that something is wrong and you're not playing the game modeled. It can be useful to have risk controls robust to model misspecification. Playing an aggressive strategy that assumes your model is exactly correct can be quite dangerous. Wall Street has many stories of funds/firms blowing up due to risk outside the model. • I guess in your example if one starts changing risk aversion in a CRRA utility there might be a threshold where you stop playing the game altogether (except for extreme values of initial wealth). Not sure if my intuition is correct. Maybe I should solve that problem. – phdstudent Jun 5 '18 at 16:25 I have asked broadly similar questions in interviews to traders. Generally one is looking for candidates to evaluate the strength of the trade and consider their loss limits - there is a limit on the precise quantitative calculations a candidate can be expected to make. In the interview I would have commented the following: • the maximum loss is \$12, and the maximum gain \$24. • the expected gain is \$6 and therefore this instinctively reflects an intuitively sound trade. If you went further and guessed the standard deviation of the return at \$6 then you have a Sharpe Ratio of 1.0 which is often considered very attractive, but not worth risking everything you own. • How much of your capital do you expose? I.e say you have a 95% VaR of \$100 then you can probably buy around 10 copies of the trade.