Commit b1976ded authored by jichao's avatar jichao

6237

parent fdf03472
......@@ -151,7 +151,7 @@ rebalance: # 再平衡模块
fed-threshold: -0.75 # fed判断阀值
right-side: # 市场右侧相关
rtn-days: 5 # 计算spx回报率滚动天数,交易日
min-threshold: -0.03 # spx回报率跌破阀值
min-threshold: -0.05 # spx回报率跌破阀值
coef: 0.95 # 计算cvar的系数
cvar-min-volume: 30 # 计算cvar至少需要多少交易日数据
high-low-buy: # 高低买入相关
......
......@@ -21,7 +21,7 @@ class DateCurve(DriftSolver):
def get_drift(self, day, risk: PortfoliosRisk):
last_re = rrs.get_last_one(max_date=day, risk=risk, effective=True)
result = self.diff_threshold - self.init_factor * (day - last_re['date']).days ** 4
return result
return max(0, result)
@component(bean_name='high-weight')
......
......@@ -22,7 +22,8 @@ class CurveDrift(BaseRebalanceSignal):
SignalType.CRISIS_ONE,
SignalType.CRISIS_TWO,
SignalType.MARKET_RIGHT,
SignalType.INIT
SignalType.INIT,
SignalType.LOW_BUY
]
def is_trigger(self, day, risk: PortfoliosRisk) -> bool:
......@@ -37,7 +38,7 @@ class CurveDrift(BaseRebalanceSignal):
normal_weight = round(sum([x[1] for x in normal_portfolio.items() if x[0] in datum_ids]), 2)
hold_portfolio = self._hold.get_portfolios_weight(day, risk)
hold_weight = round(sum([x[1] for x in hold_portfolio.items() if x[0] in datum_ids]), 2)
return normal_weight - hold_weight >= self._solver.get_drift(day, risk)
return abs(normal_weight - hold_weight) >= self._solver.get_drift(day, risk)
@property
def signal_type(self) -> SignalType:
......
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