Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
e6e5d8e8
Commit
e6e5d8e8
authored
Dec 09, 2020
by
李宗熹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改基金诊断
parent
742c85d2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
78 deletions
+95
-78
efficient_frontier.py
app/pypfopt/efficient_frontier.py
+3
-2
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+91
-75
fund_rank.py
app/utils/fund_rank.py
+1
-1
No files found.
app/pypfopt/efficient_frontier.py
View file @
e6e5d8e8
...
...
@@ -375,7 +375,7 @@ class EfficientFrontier(base_optimizer.BaseConvexOptimizer):
return
self
.
_solve_cvxpy_opt_problem
()
def
efficient_return
(
self
,
target_return
,
market_neutral
=
False
):
def
efficient_return
(
self
,
target_return
,
target_drawdown
,
market_neutral
=
False
):
"""
Calculate the 'Markowitz portfolio', minimising volatility for a given target return.
...
...
@@ -405,12 +405,13 @@ class EfficientFrontier(base_optimizer.BaseConvexOptimizer):
self
.
objective
=
cp
.
quad_form
(
self
.
_w
,
self
.
cov_matrix
)
ret
=
self
.
expected_returns
.
T
@
self
.
_w
drawdown
=
self
.
expected_drawdown
.
T
@
self
.
_w
for
obj
in
self
.
_additional_objectives
:
self
.
_objective
+=
obj
self
.
_constraints
.
append
(
ret
>=
target_return
)
self
.
_constraints
.
append
(
drawdown
<=
target_drawdown
)
# The equality constraint is either "weights sum to 1" (default), or
# "weights sum to 0" (market neutral).
if
market_neutral
:
...
...
app/service/portfolio_diagnose.py
View file @
e6e5d8e8
This diff is collapsed.
Click to expand it.
app/utils/fund_rank.py
View file @
e6e5d8e8
...
...
@@ -8,7 +8,7 @@
import
logging
logging
.
basicConfig
(
level
=
logging
.
INFO
)
from
app.api.engine
import
tamp_fund_engine
,
TAMP_SQL
from
app.api.engine
import
tamp_fund_engine
,
TAMP_SQL
,
tamp_product_engine
from
app.utils.week_evaluation
import
*
...
...
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