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
d993cc58
Commit
d993cc58
authored
Jan 22, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改持仓报告不经过建议计算
parent
5289a79c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
result_service_v2.py
app/service/result_service_v2.py
+16
-9
jinjia2html_v2.py
app/utils/jinjia2html_v2.py
+9
-4
No files found.
app/service/result_service_v2.py
View file @
d993cc58
...
@@ -12,6 +12,7 @@ import datetime
...
@@ -12,6 +12,7 @@ import datetime
from
decimal
import
Decimal
from
decimal
import
Decimal
from
app.service.data_service_v2_1
import
UserCustomerDataAdaptor
from
app.service.data_service_v2_1
import
UserCustomerDataAdaptor
from
app.utils.fund_rank
import
get_frequency
from
app.utils.fund_rank
import
get_frequency
from
app.service.portfolio_diagnose
import
cal_correlation
,
get_fund_name
,
get_frequency
from
app.utils.week_evaluation
import
*
from
app.utils.week_evaluation
import
*
...
@@ -194,6 +195,13 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -194,6 +195,13 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
"index"
)
"index"
)
folio_report_data
[
"index_result"
]
=
index_result
folio_report_data
[
"index_result"
]
=
index_result
folio_report_data
[
"return_df"
]
=
resample_df
folio_report_data
[
"return_df"
]
=
resample_df
# 对应组合相关性
min_date
=
cur_folio_order_data
[
"confirm_share_date"
]
.
min
()
df_
=
self
.
total_customer_order_cnav_df
[
fund_id_list
]
df_
=
df_
[
df_
.
index
>=
min_date
]
correlation
=
self
.
old_correlation
(
df_
)
folio_report_data
[
"correlation"
]
=
correlation
self
.
group_result_data
[
folio
]
=
folio_report_data
self
.
group_result_data
[
folio
]
=
folio_report_data
return
self
.
group_result_data
return
self
.
group_result_data
...
@@ -623,12 +631,11 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -623,12 +631,11 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
def
get_group_data
(
self
):
def
get_group_data
(
self
):
return
self
.
group_result_data
return
self
.
group_result_data
# def __month_return(self, folio_cnav_data):
def
old_correlation
(
self
,
cnav_data
):
# # 月度回报
folio_cnav_data
=
cnav_data
.
copy
()
# def year_month(x):
folio_cnav_data
=
folio_cnav_data
.
fillna
(
method
=
"bfill"
)
# a = x.year
old_correlation
=
cal_correlation
(
folio_cnav_data
)
# b = x.month
old_correlation
=
old_correlation
.
fillna
(
1
)
.
round
(
2
)
# return str(a) + "-" + str(b)
old_correlation
.
columns
=
old_correlation
.
columns
.
map
(
lambda
x
:
get_fund_name
(
x
,
self
.
all_fund_type_dict
[
x
])
.
values
[
0
][
0
])
# p_folio_cnav_data = folio_cnav_data.copy()
old_correlation
.
index
=
old_correlation
.
index
.
map
(
lambda
x
:
get_fund_name
(
x
,
self
.
all_fund_type_dict
[
x
])
.
values
[
0
][
0
])
# p_folio_cnav_data["date"] = p_folio_cnav_data.index
return
old_correlation
# grouped_data = p_folio_cnav_data.groupby(p_folio_cnav_data["date"].apply(year_month))
app/utils/jinjia2html_v2.py
View file @
d993cc58
...
@@ -56,7 +56,8 @@ class DataIntegrate:
...
@@ -56,7 +56,8 @@ class DataIntegrate:
'suggestions_result_asset'
:
{},
'suggestions_result_asset'
:
{},
'return_compare_pic'
:
[],
'return_compare_pic'
:
[],
'indicator_compare'
:
[],
'indicator_compare'
:
[],
'new_group_evaluation'
:
[]
'new_group_evaluation'
:
[],
"correlation"
:
group_result
[
"correlation"
]
}
}
# 旧持仓组合点评
# 旧持仓组合点评
...
@@ -84,10 +85,14 @@ class DataIntegrate:
...
@@ -84,10 +85,14 @@ class DataIntegrate:
def
get_portfolio_diagnose
(
self
,
portfolio
,
client_type
=
1
,
invest_amount
=
10000000
):
def
get_portfolio_diagnose
(
self
,
portfolio
,
client_type
=
1
,
invest_amount
=
10000000
):
if
invest_amount
<
10000000
:
if
invest_amount
<
10000000
:
invest_amount
=
10000000
invest_amount
=
10000000
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
client_type
,
portfolio
=
self
.
user_customer
.
all_fund_type_dict
,
folio_fund_dict
=
{}
for
fd
in
portfolio
:
folio_fund_dict
[
fd
]
=
self
.
user_customer
.
all_fund_type_dict
[
fd
]
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
client_type
,
portfolio
=
folio_fund_dict
,
invest_amount
=
float
(
invest_amount
),
invest_amount
=
float
(
invest_amount
),
start_date
=
self
.
user_customer
.
start_date
)
start_date
=
self
.
user_customer
.
start_date
)
portfolio_diagnose
.
optimize
()
if
self
.
type
==
2
:
portfolio_diagnose
.
optimize
()
return
portfolio_diagnose
return
portfolio_diagnose
# 全部数据综述结果
# 全部数据综述结果
...
@@ -169,7 +174,7 @@ class DataIntegrate:
...
@@ -169,7 +174,7 @@ class DataIntegrate:
def
get_old_correlation
(
self
,
portfolio_diagnose
,
cur_group_portfolio_result
):
def
get_old_correlation
(
self
,
portfolio_diagnose
,
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_columns
=
old_correlation
.
columns
.
tolist
()
old_correlation_values
=
old_correlation
.
values
.
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
))
cur_group_portfolio_result
[
"old_correlation"
]
=
list
(
zip
(
range
(
1
,
len
(
old_correlation_columns
)
+
1
),
old_correlation_columns
,
old_correlation_values
))
...
...
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