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
5cb8b014
Commit
5cb8b014
authored
4 years ago
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新版不需要经过计算推荐的客观持仓报告
parent
b6115f7f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
750 additions
and
17 deletions
+750
-17
fund_performance.py
app/service/fund_performance.py
+730
-0
result_service_v2.py
app/service/result_service_v2.py
+11
-9
monthReportV2.1.html
app/templates/v2/monthReportV2.1.html
+1
-1
jinjia2html_v2.py
app/utils/jinjia2html_v2.py
+8
-7
No files found.
app/service/fund_performance.py
0 → 100644
View file @
5cb8b014
This diff is collapsed.
Click to expand it.
app/service/result_service_v2.py
View file @
5cb8b014
...
...
@@ -11,6 +11,7 @@ import numpy as np
import
datetime
from
decimal
import
Decimal
from
app.service.data_service_v2
import
UserCustomerDataAdaptor
from
app.service.portfolio_diagnose
import
cal_correlation
,
get_fund_name
from
app.utils.week_evaluation
import
*
...
...
@@ -173,6 +174,10 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
"index"
)
folio_report_data
[
"index_result"
]
=
index_result
folio_report_data
[
"return_df"
]
=
resample_df
# 对应组合相关性
correlation
=
self
.
old_correlation
(
self
.
fund_cnav_total
[
fund_id_list
])
folio_report_data
[
"correlation"
]
=
correlation
self
.
group_result_data
[
folio
]
=
folio_report_data
return
self
.
group_result_data
...
...
@@ -562,12 +567,9 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
def
get_group_data
(
self
):
return
self
.
group_result_data
# def __month_return(self, folio_cnav_data):
# # 月度回报
# def year_month(x):
# a = x.year
# b = x.month
# return str(a) + "-" + str(b)
# p_folio_cnav_data = folio_cnav_data.copy()
# p_folio_cnav_data["date"] = p_folio_cnav_data.index
# grouped_data = p_folio_cnav_data.groupby(p_folio_cnav_data["date"].apply(year_month))
def
old_correlation
(
self
,
folio_cnav_data
):
old_correlation
=
cal_correlation
(
folio_cnav_data
)
old_correlation
=
old_correlation
.
fillna
(
1
)
.
round
(
2
)
old_correlation
.
columns
=
old_correlation
.
columns
.
map
(
lambda
x
:
get_fund_name
(
x
)
.
values
[
0
][
0
])
old_correlation
.
index
=
old_correlation
.
index
.
map
(
lambda
x
:
get_fund_name
(
x
)
.
values
[
0
][
0
])
return
old_correlation
This diff is collapsed.
Click to expand it.
app/templates/v2/monthReportV2.1.html
View file @
5cb8b014
...
...
@@ -959,7 +959,7 @@
</span>
</div>
<img
class=
"cover_img"
src=
{{red
-
rect}}
>
<img
class=
"cover_img"
src=
{{red
_
rect}}
>
<div
class=
"cover_title_text dcell"
>
资产
<br>
存续报告
...
...
This diff is collapsed.
Click to expand it.
app/utils/jinjia2html_v2.py
View file @
5cb8b014
...
...
@@ -54,7 +54,8 @@ class DataIntegrate:
'suggestions_result_asset'
:
{},
'return_compare_pic'
:
[],
'indicator_compare'
:
[],
'new_group_evaluation'
:
[]
'new_group_evaluation'
:
[],
"correlation"
:
group_result
[
"correlation"
]
}
# 旧持仓组合点评
...
...
@@ -64,11 +65,11 @@ class DataIntegrate:
# 目标与业绩
self
.
objectives_performance
(
group_result
,
cur_group_portfolio_result
)
# 个基点评
self
.
single_fund_comment
(
portfolio_diagnose
,
cur_group_portfolio_result
)
#
self.single_fund_comment(portfolio_diagnose, cur_group_portfolio_result)
# 旧收益比较
self
.
get_old_compare_pic
(
cur_group_portfolio_result
)
# 旧相关性
self
.
get_old_correlation
(
portfolio_diagnose
,
cur_group_portfolio_result
)
self
.
get_old_correlation
(
cur_group_portfolio_result
)
# # 新增基金
# self.propose_fund(portfolio_diagnose, cur_group_portfolio_result)
# # 新收益比较
...
...
@@ -81,7 +82,7 @@ class DataIntegrate:
def
get_portfolio_diagnose
(
self
,
portfolio
,
client_type
=
1
,
invest_amount
=
10000000
):
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
client_type
,
portfolio
=
portfolio
,
invest_amount
=
float
(
invest_amount
),
start_date
=
self
.
user_customer
.
start_date
)
portfolio_diagnose
.
optimize
()
#
portfolio_diagnose.optimize()
return
portfolio_diagnose
# 全部数据综述结果
...
...
@@ -169,9 +170,9 @@ class DataIntegrate:
cur_group_portfolio_result
[
"return_compare_data"
][
"origin_combination"
],
cur_group_portfolio_result
[
"return_compare_data"
][
"index"
])
def
get_old_correlation
(
self
,
portfolio_diagnose
,
cur_group_portfolio_result
):
def
get_old_correlation
(
self
,
cur_group_portfolio_result
):
"""旧相关性分析."""
old_correlation
=
portfolio_diagnose
.
old_correlation
old_correlation
=
cur_group_portfolio_result
[
"correlation"
]
old_correlation_columns
=
old_correlation
.
columns
.
tolist
()
old_correlation_values
=
old_correlation
.
values
.
tolist
()
cur_group_portfolio_result
[
"old_correlation"
]
=
list
(
zip
(
range
(
1
,
len
(
old_correlation_columns
)
+
1
),
old_correlation_columns
,
old_correlation_values
))
...
...
@@ -246,7 +247,7 @@ class DataIntegrate:
'logo'
:
template_folder
+
'/v2/img/logo.png'
,
'scene'
:
template_folder
+
'/v2/img/scene.png'
,
'team'
:
template_folder
+
'/v2/img/default-user.png'
,
'red
-
rect'
:
template_folder
+
'/v2/img/red-rect.png'
,
'red
_
rect'
:
template_folder
+
'/v2/img/red-rect.png'
,
'sh'
:
template_folder
+
'/v2/img/sh.png'
,
# 全局数据
'customer_name'
:
self
.
customer_name
,
...
...
This diff is collapsed.
Click to expand it.
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