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
a8ec611a
Commit
a8ec611a
authored
Dec 09, 2020
by
赵杰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
db686a64
b4c95f2e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
38 deletions
+49
-38
efficient_frontier.py
app/pypfopt/efficient_frontier.py
+3
-2
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+45
-35
fund_rank.py
app/utils/fund_rank.py
+1
-1
No files found.
app/pypfopt/efficient_frontier.py
View file @
a8ec611a
...
...
@@ -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 @
a8ec611a
This diff is collapsed.
Click to expand it.
app/utils/fund_rank.py
View file @
a8ec611a
...
...
@@ -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