Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
R
robo-dividend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenwen.tang
robo-dividend
Commits
387e28cf
Commit
387e28cf
authored
Oct 21, 2024
by
吕先亚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uarc&larc update
parent
8a727166
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
config-stable_prr3_t.yml
config-stable_prr3_t.yml
+1
-0
solver.py
portfolios/solver.py
+14
-4
No files found.
config-stable_prr3_t.yml
View file @
387e28cf
...
...
@@ -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计算相关
...
...
portfolios/solver.py
View file @
387e28cf
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment