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
7c1787a7
Commit
7c1787a7
authored
Dec 07, 2020
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改写死的评价数据
parent
fc4a1165
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
22 deletions
+27
-22
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+11
-11
result_service_v2.py
app/service/result_service_v2.py
+2
-1
jinjia2html.py
app/utils/jinjia2html.py
+13
-9
timed_task.py
app/utils/timed_task.py
+1
-1
No files found.
app/service/portfolio_diagnose.py
View file @
7c1787a7
...
...
@@ -940,14 +940,14 @@ class PortfolioDiagnose(object):
return
radar_data
portfolio
=
[
'HF00002JJ2'
,
'HF00005DBQ'
,
'HF0000681Q'
,
'HF00006693'
,
'HF00006AZF'
,
'HF00006BGS'
]
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
1
,
portfolio
=
portfolio
,
invest_amount
=
10000000
)
portfolio_diagnose
.
optimize
()
if
__name__
==
'__main__'
:
print
(
portfolio_diagnose
.
single_fund_radar
())
print
(
portfolio_diagnose
.
propose_fund_radar
())
print
(
portfolio_diagnose
.
old_portfolio_evaluation
())
print
(
'旧组合相关性:'
,
portfolio_diagnose
.
old_correlation
)
print
(
'新组合相关性:'
,
portfolio_diagnose
.
new_correlation
)
print
(
'旧组合个基评价:'
,
portfolio_diagnose
.
old_portfolio_evaluation
())
print
(
'新组合个基评价:'
,
portfolio_diagnose
.
propose_fund_evaluation
())
\ No newline at end of file
# portfolio = ['HF00002JJ2', 'HF00005DBQ', 'HF0000681Q', 'HF00006693', 'HF00006AZF', 'HF00006BGS']
# portfolio_diagnose = PortfolioDiagnose(client_type=1, portfolio=portfolio, invest_amount=10000000)
# portfolio_diagnose.optimize()
# if __name__ == '__main__':
# print(portfolio_diagnose.single_fund_radar())
# print(portfolio_diagnose.propose_fund_radar())
# print(portfolio_diagnose.old_portfolio_evaluation())
# print('旧组合相关性:', portfolio_diagnose.old_correlation)
# print('新组合相关性:', portfolio_diagnose.new_correlation)
# print('旧组合个基评价:', portfolio_diagnose.old_portfolio_evaluation())
# print('新组合个基评价:', portfolio_diagnose.propose_fund_evaluation())
\ No newline at end of file
app/service/result_service_v2.py
View file @
7c1787a7
...
...
@@ -36,6 +36,7 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
fund_id_list_earn
=
[
i
+
"_earn"
for
i
in
fund_id_list
]
# fund_id_list_amount = [i + "_amount" for i in fund_id_list]
profit_df
=
cur_folio_result_cnav_data
[
fund_id_list_earn
]
folio_report_data
[
"fund_id_list"
]
=
fund_id_list
# 组合收益率数组
# return_ratio_df, contribution_decomposition= self.combination_yield(cur_folio_result_cnav_data, fund_id_list)
...
...
@@ -296,7 +297,7 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
now_year
=
datetime
.
datetime
.
now
()
.
year
month_return_data_dict
=
{}
for
i
in
range
(
now_year
-
start_year
+
1
):
month_return_data_dict
[
start_year
+
i
]
=
{
j
+
1
:
{
"profit"
:
0
,
"net_amount"
:
0
}
for
j
in
range
(
12
)}
month_return_data_dict
[
start_year
+
i
]
=
{
j
+
1
:
{
"profit"
:
"-"
,
"net_amount"
:
"-"
}
for
j
in
range
(
12
)}
for
d_index
,
d_row
in
month_sum
.
items
():
cur_year
=
int
(
d_index
[:
4
])
cur_month
=
int
(
d_index
[
5
:])
...
...
app/utils/jinjia2html.py
View file @
7c1787a7
...
...
@@ -4,7 +4,7 @@ import uuid
from
jinja2
import
PackageLoader
,
Environment
from
app.api.engine
import
work_dir
,
pdf_folder
,
template_folder
from
app.service.portfolio_diagnose
import
portfolio_d
iagnose
from
app.service.portfolio_diagnose
import
PortfolioD
iagnose
from
app.service.result_service_v2
import
UserCustomerResultAdaptor
import
numpy
as
np
...
...
@@ -23,6 +23,7 @@ class DataIntegrate:
self
.
d
=
self
.
user_customer
.
calculate_group_result_data
()
# 组合数据
self
.
group_result
=
self
.
d
[
"default"
]
self
.
get_portfolio_diagnose
(
self
.
group_result
[
"fund_id_list"
])
# 几月综述部分
self
.
get_summarize
()
# 月度回报
...
...
@@ -50,6 +51,9 @@ class DataIntegrate:
# 渲染模版
self
.
render_data
()
def
get_portfolio_diagnose
(
self
,
portfolio
,
client_type
=
1
,
invest_amount
=
10000000
):
self
.
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
client_type
,
portfolio
=
portfolio
,
invest_amount
=
invest_amount
)
self
.
portfolio_diagnose
.
optimize
()
def
get_summarize
(
self
):
"""几月综述部分."""
...
...
@@ -69,7 +73,7 @@ class DataIntegrate:
def
comments_on_position_portfolio
(
self
):
"""旧持仓组合点评."""
self
.
old_evaluation
=
portfolio_diagnose
.
old_evaluation
(
'default'
,
self
.
d
,
self
.
user_customer
)
self
.
old_evaluation
=
self
.
portfolio_diagnose
.
old_evaluation
(
'default'
,
self
.
d
,
self
.
user_customer
)
def
contribution_deco
(
self
):
"""贡献分解."""
...
...
@@ -79,8 +83,8 @@ class DataIntegrate:
def
single_fund_comment
(
self
):
"""个基点评."""
self
.
single_fund_data_list
=
[]
portfolio_evaluation
=
portfolio_diagnose
.
old_portfolio_evaluation
()
radar_chart_data
=
portfolio_diagnose
.
single_fund_radar
()
portfolio_evaluation
=
self
.
portfolio_diagnose
.
old_portfolio_evaluation
()
radar_chart_data
=
self
.
portfolio_diagnose
.
single_fund_radar
()
for
i
in
range
(
len
(
portfolio_evaluation
)):
if
portfolio_evaluation
[
i
][
'status'
]
==
'保留'
:
portfolio_evaluation
[
i
][
'status'
]
=
'<div class="self_type fl">保留</div>'
...
...
@@ -100,7 +104,7 @@ class DataIntegrate:
def
get_old_compare_pic
(
self
):
"""旧收益比较"""
self
.
suggestions_result
,
self
.
suggestions_result_asset
,
self
.
return_compare_data
,
\
self
.
indicator_compare
,
self
.
new_group_evaluation
=
portfolio_diagnose
.
new_evaluation
(
"default"
,
self
.
d
,
self
.
user_customer
)
self
.
indicator_compare
,
self
.
new_group_evaluation
=
self
.
portfolio_diagnose
.
new_evaluation
(
"default"
,
self
.
d
,
self
.
user_customer
)
self
.
old_return_compare_pic
=
draw_old_combination_chart
(
self
.
return_compare_data
[
"xlabels"
],
self
.
return_compare_data
[
"origin_combination"
],
self
.
return_compare_data
[
"index"
])
def
get_transfer_suggestions
(
self
):
...
...
@@ -111,7 +115,7 @@ class DataIntegrate:
def
get_old_correlation
(
self
):
"""旧相关性分析."""
old_correlation
=
portfolio_diagnose
.
old_correlation
old_correlation
=
self
.
portfolio_diagnose
.
old_correlation
old_correlation_columns
=
old_correlation
.
columns
.
tolist
()
old_correlation_values
=
old_correlation
.
values
.
tolist
()
self
.
old_correlation
=
list
(
zip
(
range
(
1
,
len
(
old_correlation_columns
)
+
1
),
old_correlation_columns
,
old_correlation_values
))
...
...
@@ -119,7 +123,7 @@ class DataIntegrate:
def
get_new_correlation
(
self
):
"""新相关性分析."""
new_correlation
=
portfolio_diagnose
.
new_correlation
new_correlation
=
self
.
portfolio_diagnose
.
new_correlation
new_correlation_columns
=
new_correlation
.
columns
.
tolist
()
new_correlation_values
=
new_correlation
.
values
.
tolist
()
self
.
new_correlation
=
list
(
zip
(
range
(
1
,
len
(
new_correlation_columns
)
+
1
),
new_correlation_columns
,
new_correlation_values
))
...
...
@@ -129,8 +133,8 @@ class DataIntegrate:
"""新增基金"""
# 优化组合建议1 -- 新增基金
self
.
propose_fund_data_list
=
[]
propose_fund_evaluation
=
portfolio_diagnose
.
propose_fund_evaluation
()
propose_radar_chart_data
=
portfolio_diagnose
.
propose_fund_radar
()
propose_fund_evaluation
=
self
.
portfolio_diagnose
.
propose_fund_evaluation
()
propose_radar_chart_data
=
self
.
portfolio_diagnose
.
propose_fund_radar
()
for
i
in
range
(
len
(
propose_fund_evaluation
)):
self
.
propose_fund_data_list
.
append
({
'fund_name'
:
propose_fund_evaluation
[
i
][
'name'
],
...
...
app/utils/timed_task.py
View file @
7c1787a7
...
...
@@ -38,7 +38,7 @@ class Customer(Base):
def
call_month_report
(
ifauser_id
,
ifauser_name
,
customer_id
,
customer_name
):
print
(
'开始制作IFA: {}, 客户: {}的基金月报'
.
format
(
ifauser_name
,
customer_name
))
try
:
DataIntegrate
(
ifauser_id
,
customer_id
,
customer_name
)
DataIntegrate
(
ifauser_id
,
customer_id
)
except
:
print
(
"发生异常,下一个走起!"
)
...
...
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