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
159d5ea8
Commit
159d5ea8
authored
Dec 03, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模版
parent
bdb494df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
136 deletions
+32
-136
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+1
-1
monthReport.html
app/templates/monthReport.html
+5
-125
radar_chart.py
app/utils/radar_chart.py
+3
-1
jinjia2html.py
jinjia2html.py
+23
-9
No files found.
app/service/portfolio_diagnose.py
View file @
159d5ea8
...
@@ -747,7 +747,7 @@ portfolio_diagnose = PortfolioDiagnose(client_type=1, portfolio=portfolio, inves
...
@@ -747,7 +747,7 @@ portfolio_diagnose = PortfolioDiagnose(client_type=1, portfolio=portfolio, inves
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)
...
...
app/templates/monthReport.html
View file @
159d5ea8
...
@@ -2518,82 +2518,6 @@
...
@@ -2518,82 +2518,6 @@
</table>
</table>
</li>
</li>
{% endfor %}
{% endfor %}
<li
class=
"self_item"
>
<table>
<tr>
<td
style=
"padding: 0;text-align: left;vertical-align: middle;"
>
<div
class=
"self_item_left"
>
<div
class=
"self_header"
>
<div
class=
"self_title"
>
远澜银杏 1 号
<div
class=
"self_title_tri"
></div>
</div>
<div
class=
"self_type red"
>
保留
</div>
</div>
<div
class=
"self_description"
>
<div
class=
"self_description_item"
>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_text"
>
1、该基金整体表现
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
,
收益能力
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
,
回撤控制能力
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
,
风险收益比例
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
;
</div>
</div>
<div
class=
"self_description_item"
>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_text"
>
2、在收益方面,该基金年化收益能力
<span
class=
"self_description_red"
>
高于
</span>
/
<span
class=
"self_description_green"
>
持平
</span>
/
<span
class=
"self_description_green"
>
低于
</span>
,
同类基金平均水平,有x%区间跑赢大盘/指数,绝对收益能力
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
;
</div>
</div>
<div
class=
"self_description_item"
>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_text"
>
3、在风险方面,该基金抵御风险能力优秀,在同类基金中处于中等水平,最大回撤为x%,低于同类基金平均水平;
</div>
</div>
</div>
</div>
</td>
<td
style=
"padding: 0;text-align: left;vertical-align: middle;"
>
<div
class=
"self_item_right"
>
<img
src=
"./img/logo-blue.png"
alt=
""
class=
"self_img"
>
</div>
</td>
</tr>
</table>
</li>
<li
class=
"self_item"
>
<li
class=
"self_item"
>
<table>
<table>
<tr>
<tr>
...
@@ -3487,7 +3411,7 @@
...
@@ -3487,7 +3411,7 @@
</div>
</div>
<div
class=
"self_content"
>
<div
class=
"self_content"
>
{% for single_fund in propose_fund_data_list %}
<div
class=
"self_item"
>
<div
class=
"self_item"
>
<table>
<table>
<tr>
<tr>
...
@@ -3495,7 +3419,7 @@
...
@@ -3495,7 +3419,7 @@
<div
class=
"self_item_left"
>
<div
class=
"self_item_left"
>
<div
class=
"self_header"
>
<div
class=
"self_header"
>
<div
class=
"self_title"
>
<div
class=
"self_title"
>
远澜银杏 1 号
{{single_fund.fund_name}}
<div
class=
"self_title_tri"
></div>
<div
class=
"self_title_tri"
></div>
</div>
</div>
</div>
</div>
...
@@ -3503,51 +3427,7 @@
...
@@ -3503,51 +3427,7 @@
<div
class=
"self_description_item"
>
<div
class=
"self_description_item"
>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_text"
>
<div
class=
"self_description_text"
>
1、该基金整体表现
{{single_fund.evaluation}}
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
,
收益能力
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
,
回撤控制能力
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
,
风险收益比例
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
;
</div>
</div>
<div
class=
"self_description_item"
>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_text"
>
2、在收益方面,该基金年化收益能力
<span
class=
"self_description_red"
>
高于
</span>
/
<span
class=
"self_description_green"
>
持平
</span>
/
<span
class=
"self_description_green"
>
低于
</span>
,
同类基金平均水平,有x%区间跑赢大盘/指数,绝对收益能力
<span
class=
"self_description_red"
>
优秀
</span>
/
<span
class=
"self_description_red"
>
良好
</span>
/
<span
class=
"self_description_green"
>
一般
</span>
/
<span
class=
"self_description_green"
>
合格
</span>
/
<span
class=
"self_description_green"
>
较差
</span>
;
</div>
</div>
<div
class=
"self_description_item"
>
<div
class=
"self_description_dot"
></div>
<div
class=
"self_description_text"
>
3、在风险方面,该基金抵御风险能力优秀,在同类基金中处于中等水平,最大回撤为x%,低于同类基金平均水平;
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -3555,13 +3435,13 @@
...
@@ -3555,13 +3435,13 @@
</td>
</td>
<td
style=
"padding: 0;text-align: left;vertical-align: middle;"
>
<td
style=
"padding: 0;text-align: left;vertical-align: middle;"
>
<div
class=
"self_item_right"
>
<div
class=
"self_item_right"
>
<img
src=
"./img/logo-blue.png"
alt=
""
class=
"self_img"
>
<img
src=
{{single_fund.radar_chart_path}}
alt=
""
class=
"self_img"
>
</div>
</div>
</td>
</td>
</tr>
</tr>
</table>
</table>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
...
...
app/utils/radar_chart.py
View file @
159d5ea8
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
# @Email : acepengxiong@163.com
# @Email : acepengxiong@163.com
# @Software : PyCharm
# @Software : PyCharm
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
import
os
import
imgkit
import
imgkit
import
pyecharts.options
as
opts
import
pyecharts.options
as
opts
...
@@ -25,7 +27,6 @@ def gen_radar_chart(radar_chart_data):
...
@@ -25,7 +27,6 @@ def gen_radar_chart(radar_chart_data):
# v1 = [[4300, 10000, 28000, 35000, 50000]]
# v1 = [[4300, 10000, 28000, 35000, 50000]]
radar_chart
=
radar_chart_data
[
'data'
][
0
:
5
]
radar_chart
=
radar_chart_data
[
'data'
][
0
:
5
]
v1
=
[[
data
[
'data'
]
for
data
in
radar_chart
]]
v1
=
[[
data
[
'data'
]
for
data
in
radar_chart
]]
print
(
radar_chart
)
radar
=
Radar
(
radar
=
Radar
(
init_opts
=
opts
.
InitOpts
(
bg_color
=
"#fff"
,
animation_opts
=
opts
.
AnimationOpts
(
animation
=
False
)))
.
add_schema
(
init_opts
=
opts
.
InitOpts
(
bg_color
=
"#fff"
,
animation_opts
=
opts
.
AnimationOpts
(
animation
=
False
)))
.
add_schema
(
schema
=
[
schema
=
[
...
@@ -81,6 +82,7 @@ def gen_radar_chart(radar_chart_data):
...
@@ -81,6 +82,7 @@ def gen_radar_chart(radar_chart_data):
img
=
img
[
0
:
height
,
160
:
750
]
img
=
img
[
0
:
height
,
160
:
750
]
cv2
.
imwrite
(
img_name
,
img
)
cv2
.
imwrite
(
img_name
,
img
)
os
.
popen
(
'rm -f {}'
.
format
(
html_name
))
return
img_name
return
img_name
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
jinjia2html.py
View file @
159d5ea8
...
@@ -46,15 +46,28 @@ contribution_decomposition = draw_contribution_chart(g_data['xlabels'], g_data['
...
@@ -46,15 +46,28 @@ contribution_decomposition = draw_contribution_chart(g_data['xlabels'], g_data['
single_fund_data_list
=
[]
single_fund_data_list
=
[]
portfolio_evaluation
=
portfolio_diagnose
.
old_portfolio_evaluation
()
portfolio_evaluation
=
portfolio_diagnose
.
old_portfolio_evaluation
()
radar_chart_data
=
portfolio_diagnose
.
single_fund_radar
()
radar_chart_data
=
portfolio_diagnose
.
single_fund_radar
()
# for one in radar_chart_data:
for
i
in
range
(
len
(
portfolio_evaluation
)):
# print(gen_radar_chart(one))
single_fund_data_list
.
append
({
radar_chart_path
=
gen_radar_chart
(
radar_chart_data
[
0
])
'fund_name'
:
portfolio_evaluation
[
i
][
'name'
],
single_fund_data_list
.
append
({
'fund_name'
:
radar_chart_data
[
0
][
'name'
],
'status'
:
'保留'
,
'status'
:
'保留'
,
'evaluation'
:
portfolio_evaluation
[
0
][
'data'
],
'evaluation'
:
portfolio_evaluation
[
i
][
'data'
],
'radar_chart_path'
:
radar_chart_path
'radar_chart_path'
:
gen_radar_chart
(
radar_chart_data
[
i
])
})
})
# 优化组合建议1 -- 新增基金
propose_fund_data_list
=
[]
propose_fund_evaluation
=
portfolio_diagnose
.
propose_fund_evaluation
()
propose_radar_chart_data
=
portfolio_diagnose
.
propose_fund_radar
()
for
i
in
range
(
len
(
propose_fund_evaluation
)):
propose_fund_data_list
.
append
({
'fund_name'
:
propose_fund_evaluation
[
i
][
'name'
],
'status'
:
'保留'
,
'evaluation'
:
propose_fund_evaluation
[
i
][
'data'
],
'radar_chart_path'
:
gen_radar_chart
(
propose_radar_chart_data
[
i
])
})
print
(
propose_fund_data_list
)
print
(
len
(
propose_fund_data_list
))
now_month_income
=
int
(
group_result
[
"cur_month_profit"
])
# 本月收益
now_month_income
=
int
(
group_result
[
"cur_month_profit"
])
# 本月收益
now_year_income
=
int
(
group_result
[
"cur_year_profit"
])
# 今年累计收益
now_year_income
=
int
(
group_result
[
"cur_year_profit"
])
# 今年累计收益
totoal_rate_of_return
=
round
((
group_result
[
'cumulative_return'
]
-
1
)
*
100
,
2
)
# 累计收益率
totoal_rate_of_return
=
round
((
group_result
[
'cumulative_return'
]
-
1
)
*
100
,
2
)
# 累计收益率
...
@@ -100,7 +113,8 @@ data = {'customer_name':'成龙', 'customer_gender':'女',
...
@@ -100,7 +113,8 @@ data = {'customer_name':'成龙', 'customer_gender':'女',
'group_hoding_info'
:
group_hoding_info
,
'group_hoding_info'
:
group_hoding_info
,
'old_evaluation'
:
old_evaluation
,
'old_evaluation'
:
old_evaluation
,
'contribution_decomposition'
:
contribution_decomposition
,
'contribution_decomposition'
:
contribution_decomposition
,
'single_fund_data_list'
:
single_fund_data_list
'single_fund_data_list'
:
single_fund_data_list
,
'propose_fund_data_list'
:
propose_fund_data_list
}
}
...
...
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