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
3052be21
Commit
3052be21
authored
Nov 21, 2022
by
jichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
依赖注入实现中
parent
4fb82792
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
+33
-4
api.py
api.py
+9
-0
crisis_signal.py
rebalance/crisis_signal.py
+1
-4
curve_drift.py
rebalance/curve_drift.py
+23
-0
No files found.
api.py
View file @
3052be21
...
...
@@ -80,6 +80,15 @@ class Datum(ABC):
'''
pass
@
abstractmethod
def
get_high_risk_datums
(
self
,
risk
:
PortfoliosRisk
):
'''
根据指定的投组风险等级,获取高风险资产资料数据
:param risk: 投组风险等级
:return: 高风险资料信息
'''
pass
class
Navs
(
ABC
):
'''
...
...
rebalance/crisis_signal.py
View file @
3052be21
...
...
@@ -114,10 +114,7 @@ class CrisisTwoSignal(CrisisSignal):
def
get_signal
(
self
,
day
,
risk
:
PortfoliosRisk
):
exp_date
=
self
.
get_exp_start_date
(
day
,
risk
)
if
exp_date
:
crisis_one
=
rrs
.
get_last_one
(
type
=
SignalType
.
CRISIS_ONE
,
risk
=
risk
,
max_date
=
day
,
effective
=
True
)
if
crisis_one
:
return
None
crisis_two
=
rrs
.
get_first_after
(
type
=
SignalType
.
CRISIS_TWO
,
risk
=
risk
,
min_date
=
exp_date
,
effective
=
True
)
crisis_two
=
rrs
.
get_first_after
(
type
=
SignalType
.
CRISIS_TWO
,
risk
=
risk
,
min_date
=
exp_date
)
if
not
crisis_two
:
ng_date
=
day
-
relativedelta
(
years
=
self
.
negative_growth_years
)
ten_today
=
self
.
_navs
.
get_last_index_close
(
max_date
=
day
,
ticker
=
'USGG10YR Index'
)
...
...
rebalance/curve_drift.py
View file @
3052be21
from
framework
import
component
,
autowired
from
api
import
SignalBuilder
,
PortfoliosRisk
,
SignalType
from
rebalance.dao
import
robo_rebalance_signal
as
rrs
@
component
(
bean_name
=
'curve-drift'
)
class
CurveDrift
(
SignalBuilder
):
@
property
def
exclude_last_type
(
self
):
return
[
SignalType
.
CRISIS_ONE
,
SignalType
.
CRISIS_TWO
,
SignalType
.
MARKET_RIGHT
,
SignalType
.
INIT
,
SignalType
.
LOW_BUY
]
def
get_signal
(
self
,
day
,
risk
:
PortfoliosRisk
):
last_re
=
rrs
.
get_last_one
(
max_date
=
day
,
risk
=
risk
,
effective
=
True
)
if
last_re
is
None
or
SignalType
(
last_re
[
'type'
])
in
self
.
exclude_last_type
:
return
None
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