Finanzhandel mit Python
Chelsea Yang
Data Science Instructor
$$
$$

$$ \text{Sharpe Ratio} = (R_p - R_r)/\sigma_p $$
$$
$$
$$
$$
resInfo = bt_result.stats
# Sharpe-Ratios aus den Backtest-Statistiken holen
print('Sharpe ratio daily: %.2f'% resInfo.loc['daily_sharpe'])
print('Sharpe ratio monthly %.2f'% resInfo.loc['monthly_sharpe'])
print('Sharpe ratio annually %.2f'% resInfo.loc['yearly_sharpe'])
Sharpe ratio daily: 0.49
Sharpe ratio monthly 0.48
Sharpe ratio annually 1.34
# Jahresrendite abrufen annual_return = resInfo.loc['yearly_mean']# Jährliche Volatilität abrufen volatility = resInfo.loc['yearly_vol']# Sharpe-Ratio manuell berechnen sharpe_ratio = annual_return / volatility print('Sharpe ratio annually %.2f'% sharpe_ratio)
Sharpe ratio annually 1.34

$$ \text{Sortino Ratio} = (R_p - R_r)/\sigma_d $$

resInfo = bt_result.stats
# Sortino-Ratio aus den Backtest-Statistiken holen
print('Sortino ratio daily: %.2f'% resInfo.loc['daily_sortino'])
print('Sortino ratio monthly %.2f'% resInfo.loc['monthly_sortino'])
print('Sortino ratio annually %.2f'% resInfo.loc['yearly_sortino'])
Sortino ratio daily: 0.70
Sortino ratio monthly 0.86
Sortino ratio annually 2.29
Finanzhandel mit Python