Commit 387e28cf authored by 吕先亚's avatar 吕先亚

uarc&larc update

parent 8a727166
......@@ -133,6 +133,7 @@ portfolios: # 投组模块
cpi-expect: 2
max-w: 0.75
uarc-index: 3
larc-index: 3
matrix-rtn-days: 20 # 计算回报率矩阵时,回报率滚动天数
asset-count: [5,5] # 投组资产个数。e.g. count 或 [min, max] 分别表示 最大最小都为count 或 最小为min 最大为max,另外这里也可以类似上面给不同风险等级分别配置
mpt: # mpt计算相关
......
......@@ -347,12 +347,15 @@ class ARCSolver(DefaultSolver):
@property
def LARC(self):
if not self._config.get('larc-index'):
return self._config['LARC']
cash_uarc = self.compute_cash_uarc
LARC = self._config['LARC']
LARC[self._config['larc-index']] = cash_uarc
return LARC
@property
def UARC(self):
if not self._config.get('uarc-index'):
return self._config['UARC']
def compute_cash_uarc(self):
ecos = self._datum.get_datums(ticker=['CPI YOY Index', 'FDTR Index'])
cpi_id = [data['id'] for data in ecos if data['bloombergTicker'] == 'CPI YOY Index']
fdtr_id = [data['id'] for data in ecos if data['bloombergTicker'] == 'FDTR Index']
......@@ -363,6 +366,13 @@ class ARCSolver(DefaultSolver):
self._config['fix-w'] + self._config['fdtr-w'] * fdtr + abs(cpi - self._config['cpi-expect']) *
self._config['cpiyoy-w'], 2)
cash_uarc = self._config['max-w'] if cash_uarc > self._config['max-w'] else cash_uarc
return cash_uarc
@property
def UARC(self):
if not self._config.get('uarc-index'):
return self._config['UARC']
cash_uarc = self.compute_cash_uarc
UARC = self._config['UARC']
UARC[self._config['uarc-index']] = cash_uarc
return UARC
......
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