Skip to content

Commit

Permalink
0.9.57 新增最大夏普计算
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Jul 27, 2024
1 parent 4db0c34 commit eb7b8ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions czsc/utils/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def max_sharp(df, weight_bounds=(0, 1), **kwargs):
from czsc.utils.stats import daily_performance

logger = kwargs.get("logger", loguru.logger)
df = df.copy()
if 'dt' in df.columns:
df = df.set_index('dt')

mu = expected_returns.mean_historical_return(df, returns_data=True)
S = risk_models.risk_matrix(df, returns_data=True, method="sample_cov")
Expand Down

0 comments on commit eb7b8ba

Please sign in to comment.