While calculating the Sharpe ratio in Quantra-Blueshift what is the risk free rate you are assuming.
What is the coding for calculating the number of days in drawdown.
We assume a 0% risk-free rate
Blueshift uses a c-extension module to compute drawdowns directly from algo returns via memoryview. But you can refer to this link for how it can be calculated in pure python.
We do not report max number of days in drawdowns on Blueshift. But if you have the drawdown series (which is always negative or zero), you can use the following code to compute that
runs = np.diff(np.where(max_dd<0,1,0))
startpoints = np.where(runs==1)[0]
endpoints = np.where(runs==-1)[0] if np.sum(runs)==0 \
else np.append(np.where(runs==-1)[0],len(max_dd))
max_dd_days = np.max(endpoints - startpoints)