# How to answer this interview programming question about drawdowns?

I saw this question as an interview, and to be honest, I have no idea what it's even asking for:

Write a function (in R or Python) that finds the stock drawdown which will trigger a rebalance, if given:

1. an X% stock (vs bond) target allocation; and

2. a Y% drift threshold from target allocation.

Do I pick a drawdown figure (20%?) and then calculate how much stocks need to fall to hit 20% portfolio DD given x% in stocks?

Do bond returns stay constant?

Same thing with the 2nd question, I just don't seem to understand what they are asking?

Any help appreciated!

## 1 Answer

Say X0 is the % of stock at the peek

For 1), assuming the bond return stays constant, we will trigger a rebalance when:

$\frac{X_0(1 - DD)}{X_0(1-DD) + (1 - X_0)} = \frac{X_0(1-DD)}{1-X0.DD} = X$, and solving for DD gives $DD = \frac{X_0 - X}{X_0(1 - X)}$

For 2), I would say same answer replacing $X$ by $X(1 - Y)$

Not sure if this the correct answer, question formulation is weird.

• Not sure here, assume bond return is $r_B$, stock return is $r_S$ and define bond weight $B_0 = 1 - X_0$, then you get $X_1 = X_0 (1+r_S)$ and $B_1 = B_0 ( 1+r_B) = (1-X_0)(1+r_B)$ but if you want to see them as weight, you need to "re-normalize" them like $X_1' = \frac{X_1}{X_1+X_2}$ and same for $B_1'$... – SRKX Jan 1 '16 at 9:18
• @SRXK do you mean $X_1' = \frac{X_1}{X_1+B_1}$ ? – Alex C Jan 1 '16 at 11:32
• Hmm SRKX has a valid point, my answer didn't "assume the bond return stays constant", it assumed bond return was 0% over the period !! – Karim L Jan 1 '16 at 18:25