# What’s the derivative of the sharpe ratio for one asset? Trying to optimize on it for a model

It seems most Sharpe ratio derivations seem to be for portfolios but I am just tracking a single asset?

$SR = (r_p - r_f) / \sigma_p$ but what would I derive with respect to for an optimization/ automated use case?

I am trying to understand how they use the Sharpe Ratio in this paper:

"Algorithm Trading using Q-Learning and Recurrent Reinforcement Learning", by Xin Du, Jinjian Zhai, Koupin Lv.

• The derivative with respect to what ? – Alex C Jan 28 '18 at 23:47
• Trying to understand this paper. Not sure what they used as DSR when they use it as a reward function did their trading agent: Algorithm Trading using Q-Learning and Recurrent Reinforcement Learning citeseerx.ist.psu.edu/viewdoc/… – sharpe_r_image Jan 29 '18 at 0:06

I agree that the paper could be much clearer: what it calls the “Sharp ratio derivative” is actually the “differential Sharpe ratio” proposed in a NIPS paper by Moody & Safell.

In Section 2.2 of that (cited) paper, they define the differential Sharpe ratio as a value function that represents the influence of the trading strategy’s return $R_t$ realized at time $t$ on the Sharpe ratio $S_t$. Such a quantity is needed for on-line learning to occur.

For a Sharpe ratio $S_t$, the differential Sharpe ratio $D_t$ is the derivative taken with respect to a first-order exponential moving average decay rate $\eta$ in the first and second moments of the returns:

$D_t = \frac{d S_t}{d \eta} = \frac{B_{t-1} \Delta A_t - \frac{1}{2} A_{t-1} \Delta B_t}{(B_{t-1} - A_{t-1}^2)^\frac{3}{2}}$

where $A_t$ and $B_t$ are exponential moving estimates of the first and second moments of the returns $R_t$, respectively:

$A_t = A_{t-1} + \eta \Delta A_t = A_{t-1} + \eta (R_t - A_{t-1})$

$B_t = B_{t-1} + \eta \Delta B_t = B_{t-1} + \eta (R_t ^2- B_{t-1})$

• Nice to see an answer from someone who does not guess, but knows the literature. – Alex C Feb 3 '18 at 21:43

The paper is not very specific regarding methodology for taking the derivative Sharpe ratio (DSR). Based purely on subtext, I am inferring that the author intends to differentiate the Sharpe ratio with respect to itself.

The closest that the author comes to specifying DSR:

Economically speaking, the derivative sharp ratio is analogous to the marginal utility in terms of willingness to bear how much risk for one unit increment of sharp ratio.

which makes me think that it might be the change in SR with respect to itself.

In any case, we begin with the definition of a derivative: $$\frac{dS}{d\tau}=\lim_{\tau \to 0}\frac{S[t+\tau]-S[t]}{\tau}$$

The paper further says that rather than find a symbolic solution to the derivative, the gradient would be measured across multiple time steps. Thus, we can discretize $\frac{dS}{S}$ as such:

$$\frac{\sum_{t}^T (S[\tau]-S[\tau-1])}{\sum_{t-1}^TS[\tau]}$$

...which expands to:

$$\left(\frac{r_{a(T))}-r_{m(T)}}{\sigma_{a(T)}}-\frac{r_{a(t)}-r_{m(t)}}{\sigma_{a(t)}}\right) * \left(\frac{\bar{r}_a-\bar{r}_m}{\bar{\sigma}_a}\right)^{-1}$$

which gives us something akin to the author's specification for a the marginal utility function of an incremental gain in the SR. In this case, the "derivative Sharpe ratio" (DSR) is not really a performance metric itself, but rather a sensitivity metric to changes in risk adjusted performance.