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
97a3a779
Commit
97a3a779
authored
Apr 05, 2024
by
stephen.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev-dividend' into dev-dividend
parents
17d2a2e8
dc58d48b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
utils.py
portfolios/utils.py
+2
-2
No files found.
portfolios/utils.py
View file @
97a3a779
...
@@ -41,9 +41,9 @@ def format_weight(weight: dict, to=1) -> dict:
...
@@ -41,9 +41,9 @@ def format_weight(weight: dict, to=1) -> dict:
low
=
get_config
(
'portfolios.solver.mpt.low-weight'
)
low
=
get_config
(
'portfolios.solver.mpt.low-weight'
)
high
=
get_config
(
'portfolios.solver.mpt.high-weight'
)[
0
]
high
=
get_config
(
'portfolios.solver.mpt.high-weight'
)[
0
]
# 低风险
# 低风险
minidx
=
[
i
for
i
in
id_sort
if
weight
[
i
]
<
high
][
0
]
minidx
=
[
i
for
i
in
id_sort
if
weight
_series
[
i
]
<
high
][
0
]
# 高风险
# 高风险
maxidx
=
[
i
for
i
in
id_sort
if
weight
[
i
]
>
low
][
-
1
]
maxidx
=
[
i
for
i
in
id_sort
if
weight
_series
[
i
]
>
low
][
-
1
]
if
weight_series
.
sum
()
<
to
:
if
weight_series
.
sum
()
<
to
:
weight_series
[
minidx
]
+=
to
-
weight_series
.
sum
()
weight_series
[
minidx
]
+=
to
-
weight_series
.
sum
()
elif
weight_series
.
sum
()
>
to
:
elif
weight_series
.
sum
()
>
to
:
...
...
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