Commit 734678f9 authored by stephen.wang's avatar stephen.wang

在mpt中調整報酬率入參->加入(MA5/MA10-1),用短期趨勢強弱變化來製作組合

parent c862f571
......@@ -75,8 +75,12 @@ class DefaultSolver(Solver):
@property
def rtn_annualized(self):
return list(self.rtn_matrix.mean() * 12)
if self.get_config('mpt.short-term-strength'):
result = self.navs.rolling(window=5).mean() / self.navs.rolling(window=10).mean() - 1
result.dropna(inplace=True)
return list(result.iloc[-1])
else:
return list(self.rtn_matrix.mean() * 12)
@property
def sigma(self):
rtn = (self.navs / self.navs.shift(1) - 1)[1:]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment