Python में फाइनेंशियल ट्रेडिंग
Chelsea Yang
Data Science Instructor
$$
$$

$$ \text{Sharpe Ratio} = (R_p - R_r)/\sigma_p $$
$$
$$
$$
$$
resInfo = bt_result.stats
# बैकटेस्ट stats से Sharpe ratios प्राप्त करें
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
# वार्षिक रिटर्न प्राप्त करें annual_return = resInfo.loc['yearly_mean']# वार्षिक वोलैटिलिटी प्राप्त करें volatility = resInfo.loc['yearly_vol']# Sharpe ratio मैन्युअली निकालें 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
# बैकटेस्ट stats से Sortino ratio प्राप्त करें
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
Python में फाइनेंशियल ट्रेडिंग