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
69fb8f61
Commit
69fb8f61
authored
Jan 22, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
持仓报告不经过建议计算
parent
5e8a8a60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
result_service_v2.py
app/service/result_service_v2.py
+9
-9
jinjia2html_v2.py
app/utils/jinjia2html_v2.py
+12
-4
No files found.
app/service/result_service_v2.py
View file @
69fb8f61
...
@@ -209,13 +209,13 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -209,13 +209,13 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
report_data
=
{}
report_data
=
{}
cur_folio_result_cnav_data
=
self
.
total_customer_order_cnav_df
.
copy
()
cur_folio_result_cnav_data
=
self
.
total_customer_order_cnav_df
.
copy
()
cur_folio_order_data
=
self
.
user_customer_order_df
cur_folio_order_data
=
self
.
user_customer_order_df
.
copy
()
freq_max
=
cur_folio_order_data
[
"freq"
]
.
max
()
#
freq_max = cur_folio_order_data["freq"].max()
#
freq_list = [get_frequency(cur_folio_result_cnav_data[[p_nav]]) for p_nav in
freq_list
=
[
get_frequency
(
cur_folio_result_cnav_data
[[
p_nav
]])
for
p_nav
in
#
cur_folio_result_cnav_data.columns]
cur_folio_result_cnav_data
.
columns
]
#
freq_dict = {250: 1, 52: 2, 24: 4, 12: 3, 4: 5}
freq_dict
=
{
250
:
1
,
52
:
2
,
24
:
4
,
12
:
3
,
4
:
5
}
#
freq_max = freq_dict[min(freq_list)]
freq_max
=
freq_dict
[
min
(
freq_list
)]
#
fund_id_list
=
list
(
cur_folio_order_data
[
"fund_id"
]
.
unique
())
fund_id_list
=
list
(
cur_folio_order_data
[
"fund_id"
]
.
unique
())
fund_id_list_earn
=
[
i
+
"_earn"
for
i
in
fund_id_list
]
fund_id_list_earn
=
[
i
+
"_earn"
for
i
in
fund_id_list
]
fund_id_list_amount
=
[
i
+
"_net_amount"
for
i
in
fund_id_list
]
fund_id_list_amount
=
[
i
+
"_net_amount"
for
i
in
fund_id_list
]
...
@@ -634,6 +634,6 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -634,6 +634,6 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
folio_cnav_data
=
folio_cnav_data
.
fillna
(
method
=
"bfill"
)
folio_cnav_data
=
folio_cnav_data
.
fillna
(
method
=
"bfill"
)
old_correlation
=
cal_correlation
(
folio_cnav_data
)
old_correlation
=
cal_correlation
(
folio_cnav_data
)
old_correlation
=
old_correlation
.
fillna
(
1
)
.
round
(
2
)
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
.
columns
=
old_correlation
.
columns
.
map
(
lambda
x
:
get_fund_name
(
x
,
self
.
all_fund_type_dict
[
x
]
)
.
values
[
0
][
0
])
old_correlation
.
index
=
old_correlation
.
index
.
map
(
lambda
x
:
get_fund_name
(
x
)
.
values
[
0
][
0
])
old_correlation
.
index
=
old_correlation
.
index
.
map
(
lambda
x
:
get_fund_name
(
x
,
self
.
all_fund_type_dict
[
x
]
)
.
values
[
0
][
0
])
return
old_correlation
return
old_correlation
app/utils/jinjia2html_v2.py
View file @
69fb8f61
...
@@ -57,7 +57,8 @@ class DataIntegrate:
...
@@ -57,7 +57,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"
]
}
}
# 旧持仓组合点评
# 旧持仓组合点评
...
@@ -83,9 +84,16 @@ class DataIntegrate:
...
@@ -83,9 +84,16 @@ class DataIntegrate:
self
.
all_folio_result
[
group_name
]
=
cur_group_portfolio_result
self
.
all_folio_result
[
group_name
]
=
cur_group_portfolio_result
def
get_portfolio_diagnose
(
self
,
portfolio
,
client_type
=
1
,
invest_amount
=
10000000
):
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
),
if
invest_amount
<
10000000
:
invest_amount
=
10000000
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
),
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
# 全部数据综述结果
# 全部数据综述结果
...
@@ -167,7 +175,7 @@ class DataIntegrate:
...
@@ -167,7 +175,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