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
1ee42bc5
Commit
1ee42bc5
authored
Dec 29, 2022
by
jichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6138
parent
9c794552
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
config.yml
config.yml
+1
-1
curve_drift.py
rebalance/signals/curve_drift.py
+5
-4
No files found.
config.yml
View file @
1ee42bc5
...
@@ -151,7 +151,7 @@ rebalance: # 再平衡模块
...
@@ -151,7 +151,7 @@ rebalance: # 再平衡模块
fed-threshold
:
-0.75
# fed判断阀值
fed-threshold
:
-0.75
# fed判断阀值
right-side
:
# 市场右侧相关
right-side
:
# 市场右侧相关
rtn-days
:
5
# 计算spx回报率滚动天数,交易日
rtn-days
:
5
# 计算spx回报率滚动天数,交易日
min-threshold
:
-0.0
3
# spx回报率跌破阀值
min-threshold
:
-0.0
5
# spx回报率跌破阀值
coef
:
0.95
# 计算cvar的系数
coef
:
0.95
# 计算cvar的系数
cvar-min-volume
:
30
# 计算cvar至少需要多少交易日数据
cvar-min-volume
:
30
# 计算cvar至少需要多少交易日数据
high-low-buy
:
# 高低买入相关
high-low-buy
:
# 高低买入相关
...
...
rebalance/signals/curve_drift.py
View file @
1ee42bc5
...
@@ -22,22 +22,23 @@ class CurveDrift(BaseRebalanceSignal):
...
@@ -22,22 +22,23 @@ class CurveDrift(BaseRebalanceSignal):
SignalType
.
CRISIS_ONE
,
SignalType
.
CRISIS_ONE
,
SignalType
.
CRISIS_TWO
,
SignalType
.
CRISIS_TWO
,
SignalType
.
MARKET_RIGHT
,
SignalType
.
MARKET_RIGHT
,
SignalType
.
INIT
SignalType
.
INIT
,
SignalType
.
LOW_BUY
]
]
def
is_trigger
(
self
,
day
,
risk
:
PortfoliosRisk
)
->
bool
:
def
is_trigger
(
self
,
day
,
risk
:
PortfoliosRisk
)
->
bool
:
last_re
=
rrs
.
get_last_one
(
max_date
=
day
,
risk
=
risk
,
effective
=
True
)
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
:
if
last_re
is
None
or
SignalType
(
last_re
[
'type'
])
in
self
.
exclude_last_type
:
return
False
return
False
#
if last_re['date'] + relativedelta(days=120) <= day:
if
last_re
[
'date'
]
+
relativedelta
(
days
=
120
)
<=
day
:
#
return True
return
True
hr_datums
=
self
.
_datum
.
get_high_risk_datums
(
risk
)
hr_datums
=
self
.
_datum
.
get_high_risk_datums
(
risk
)
datum_ids
=
[
x
[
'id'
]
for
x
in
hr_datums
]
datum_ids
=
[
x
[
'id'
]
for
x
in
hr_datums
]
normal_portfolio
=
self
.
_builder
.
get_portfolios
(
day
,
risk
)
normal_portfolio
=
self
.
_builder
.
get_portfolios
(
day
,
risk
)
normal_weight
=
round
(
sum
([
x
[
1
]
for
x
in
normal_portfolio
.
items
()
if
x
[
0
]
in
datum_ids
]),
2
)
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_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
)
hold_weight
=
round
(
sum
([
x
[
1
]
for
x
in
hold_portfolio
.
items
()
if
x
[
0
]
in
datum_ids
]),
2
)
return
abs
(
normal_weight
-
hold_weight
)
>=
self
.
_solver
.
get_drift
(
day
,
risk
)
return
normal_weight
-
hold_weight
>=
self
.
_solver
.
get_drift
(
day
,
risk
)
@
property
@
property
def
signal_type
(
self
)
->
SignalType
:
def
signal_type
(
self
)
->
SignalType
:
...
...
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