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
df75ef5a
Commit
df75ef5a
authored
Dec 22, 2022
by
jichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
613回测
parent
32bdb40e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
drift_solver.py
rebalance/drift_solver.py
+2
-1
curve_drift.py
rebalance/signals/curve_drift.py
+2
-3
No files found.
rebalance/drift_solver.py
View file @
df75ef5a
...
@@ -20,7 +20,8 @@ class DateCurve(DriftSolver):
...
@@ -20,7 +20,8 @@ class DateCurve(DriftSolver):
def
get_drift
(
self
,
day
,
risk
:
PortfoliosRisk
):
def
get_drift
(
self
,
day
,
risk
:
PortfoliosRisk
):
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
)
return
self
.
diff_threshold
-
self
.
init_factor
*
(
day
-
last_re
[
'date'
])
.
days
**
4
result
=
self
.
diff_threshold
-
self
.
init_factor
*
(
day
-
last_re
[
'date'
])
.
days
**
4
return
max
(
0
,
result
)
@
component
(
bean_name
=
'high-weight'
)
@
component
(
bean_name
=
'high-weight'
)
...
...
rebalance/signals/curve_drift.py
View file @
df75ef5a
...
@@ -21,8 +21,7 @@ class CurveDrift(BaseRebalanceSignal):
...
@@ -21,8 +21,7 @@ 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
:
...
@@ -35,7 +34,7 @@ class CurveDrift(BaseRebalanceSignal):
...
@@ -35,7 +34,7 @@ class CurveDrift(BaseRebalanceSignal):
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
normal_weight
-
hold_weight
>=
self
.
_solver
.
get_drift
(
day
,
risk
)
return
abs
(
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