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
742c85d2
Commit
742c85d2
authored
Dec 09, 2020
by
李宗熹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改排名数据
parent
b192a760
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+18
-19
No files found.
app/service/portfolio_diagnose.py
View file @
742c85d2
...
@@ -109,18 +109,18 @@ def choose_good_evaluation(evaluation):
...
@@ -109,18 +109,18 @@ def choose_good_evaluation(evaluation):
v2
=
evaluation
[
2
]
v2
=
evaluation
[
2
]
v3
=
evaluation
[
3
]
v3
=
evaluation
[
3
]
v4
=
evaluation
[
4
]
v4
=
evaluation
[
4
]
v5
=
evaluation
[
5
]
v5
=
evaluation
.
get
(
5
)
if
v1
[
0
]
>
1
:
if
v1
[
0
]
>
1
:
del
evaluation
[
1
]
del
evaluation
[
1
]
# if v2[0] > 1:
if
v2
[
0
]
>
1
:
if
v2
:
del
evaluation
[
2
]
del
evaluation
[
2
]
if
v3
[
0
]
>
1
:
if
v3
[
0
]
>
1
:
del
evaluation
[
3
]
del
evaluation
[
3
]
if
v4
[
0
]
!=
0
or
v4
[
1
]
!=
0
:
if
v4
[
0
]
!=
0
or
v4
[
1
]
!=
0
:
del
evaluation
[
4
]
del
evaluation
[
4
]
if
v5
[
0
]
<
3
or
v5
[
2
]
>
1
:
# 基金经理的基金管理年限小于三年或平均业绩处于中下水平
# if v5[0] < 3 or v5[2] > 1: # 基金经理的基金管理年限小于三年或平均业绩处于中下水平
if
v5
:
del
evaluation
[
5
]
del
evaluation
[
5
]
return
evaluation
return
evaluation
...
@@ -134,8 +134,7 @@ def choose_bad_evaluation(evaluation):
...
@@ -134,8 +134,7 @@ def choose_bad_evaluation(evaluation):
if
v1
[
0
]
<
2
:
if
v1
[
0
]
<
2
:
del
evaluation
[
1
]
del
evaluation
[
1
]
# if v2[0] < 2:
if
v2
[
0
]
<
2
:
if
v2
:
del
evaluation
[
2
]
del
evaluation
[
2
]
if
v3
[
0
]
<
2
:
if
v3
[
0
]
<
2
:
del
evaluation
[
3
]
del
evaluation
[
3
]
...
@@ -152,7 +151,7 @@ def get_fund_rank():
...
@@ -152,7 +151,7 @@ def get_fund_rank():
"""
"""
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
tamp_fund_session
=
tamp_fund
.
session
tamp_fund_session
=
tamp_fund
.
session
sql
=
"SELECT * FROM fund_rank"
sql
=
"SELECT * FROM
new_
fund_rank"
# df = pd.read_sql(sql, con)
# df = pd.read_sql(sql, con)
# df = pd.read_csv('fund_rank.csv', encoding='gbk')
# df = pd.read_csv('fund_rank.csv', encoding='gbk')
...
@@ -455,8 +454,8 @@ class PortfolioDiagnose(object):
...
@@ -455,8 +454,8 @@ class PortfolioDiagnose(object):
"""
"""
self
.
old_correlation
=
cal_correlation
(
prod
)
self
.
old_correlation
=
cal_correlation
(
prod
)
for
fund
in
prod
.
columns
:
for
fund
in
prod
.
columns
:
print
(
fund
)
z_score
=
search_rank
(
fund_rank
,
fund
,
metric
=
'z_score'
)
z_score
=
search_rank
(
fund_rank
,
fund
,
metric
=
'z_score'
)
# 建议替换得分为60或与其他基金相关度大于0.8的基金
# 建议替换得分为60或与其他基金相关度大于0.8的基金
if
z_score
<
60
:
if
z_score
<
60
:
...
@@ -1061,14 +1060,14 @@ class PortfolioDiagnose(object):
...
@@ -1061,14 +1060,14 @@ class PortfolioDiagnose(object):
return
radar_data
return
radar_data
# portfolio = ['HF00002JJ2', 'HF00005DBQ', 'HF0000681Q', 'HF00006693', 'HF00006AZF', 'HF00006BGS']
portfolio
=
[
'HF00002JJ2'
,
'HF00005DBQ'
,
'HF0000681Q'
,
'HF00006693'
,
'HF00006AZF'
,
'HF00006BGS'
]
# portfolio_diagnose = PortfolioDiagnose(client_type=1, portfolio=portfolio, invest_amount=10000000)
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
1
,
portfolio
=
portfolio
,
invest_amount
=
10000000
)
# portfolio_diagnose.optimize()
portfolio_diagnose
.
optimize
()
# if __name__ == '__main__':
if
__name__
==
'__main__'
:
# print(portfolio_diagnose.single_fund_radar())
print
(
portfolio_diagnose
.
single_fund_radar
())
# print(portfolio_diagnose.propose_fund_radar())
print
(
portfolio_diagnose
.
propose_fund_radar
())
# print(portfolio_diagnose.old_portfolio_evaluation())
print
(
portfolio_diagnose
.
old_portfolio_evaluation
())
# print('旧组合相关性:', portfolio_diagnose.old_correlation)
print
(
'旧组合相关性:'
,
portfolio_diagnose
.
old_correlation
)
# print('新组合相关性:', portfolio_diagnose.new_correlation)
print
(
'新组合相关性:'
,
portfolio_diagnose
.
new_correlation
)
# print('旧组合个基评价:', portfolio_diagnose.old_portfolio_evaluation())
print
(
'旧组合个基评价:'
,
portfolio_diagnose
.
old_portfolio_evaluation
())
# print('新组合个基评价:', portfolio_diagnose.propose_fund_evaluation())
print
(
'新组合个基评价:'
,
portfolio_diagnose
.
propose_fund_evaluation
())
\ No newline at end of file
\ No newline at end of file
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