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
ddf49ec6
Commit
ddf49ec6
authored
Feb 06, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
d309074e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
update_report.py
app/controller/update_report.py
+1
-0
folio_comment_service.py
app/service/folio_comment_service.py
+32
-12
No files found.
app/controller/update_report.py
View file @
ddf49ec6
...
@@ -33,6 +33,7 @@ class UpdateReportHandlers(Resource):
...
@@ -33,6 +33,7 @@ class UpdateReportHandlers(Resource):
self
.
parser
.
add_argument
(
'customer_id'
,
type
=
str
,
required
=
True
,
help
=
'customer_id不能为空'
)
self
.
parser
.
add_argument
(
'customer_id'
,
type
=
str
,
required
=
True
,
help
=
'customer_id不能为空'
)
self
.
parser
.
add_argument
(
'suggest_data'
,
type
=
str
,
required
=
True
,
help
=
'组合建议数据'
)
self
.
parser
.
add_argument
(
'suggest_data'
,
type
=
str
,
required
=
True
,
help
=
'组合建议数据'
)
args
=
self
.
parser
.
parse_args
()
args
=
self
.
parser
.
parse_args
()
# print(args)
args
[
'ifa_id'
]
=
g
.
ifa_id
args
[
'ifa_id'
]
=
g
.
ifa_id
data
=
recalculation_fund_comment
(
args
)
data
=
recalculation_fund_comment
(
args
)
if
data
is
False
:
if
data
is
False
:
...
...
app/service/folio_comment_service.py
View file @
ddf49ec6
...
@@ -2,6 +2,7 @@ from app.service.portfolio_diagnose import PortfolioDiagnose
...
@@ -2,6 +2,7 @@ from app.service.portfolio_diagnose import PortfolioDiagnose
from
app.service.result_service_v2
import
UserCustomerResultAdaptor
from
app.service.result_service_v2
import
UserCustomerResultAdaptor
import
datetime
import
datetime
import
json
import
json
import
traceback
from
app.utils.draw
import
draw_combination_chart
from
app.utils.draw
import
draw_combination_chart
from
app.utils.format_transfer
import
npEncoder
from
app.utils.format_transfer
import
npEncoder
...
@@ -12,12 +13,16 @@ def recalculation_fund_comment(args):
...
@@ -12,12 +13,16 @@ def recalculation_fund_comment(args):
customer_id
=
args
.
get
(
"customer_id"
)
customer_id
=
args
.
get
(
"customer_id"
)
folio
=
args
.
get
(
"folio"
)
folio
=
args
.
get
(
"folio"
)
suggest_result
=
json
.
loads
(
args
.
get
(
"suggest_data"
))
suggest_result
=
json
.
loads
(
args
.
get
(
"suggest_data"
))
# ifa_id = "223164967317544960"
# customer_id = "app6755804805140590592"
suggest_fund_dict
=
{}
suggest_fund_dict
=
{}
suggest_fund_list
=
[]
suggest_fund_list
=
[]
suggest_amount_list
=
[]
suggest_amount_list
=
[]
all_sug_amount_dict
=
{}
for
key
,
value_list
in
suggest_result
.
items
():
for
key
,
value_list
in
suggest_result
.
items
():
for
value
in
value_list
:
for
value
in
value_list
:
all_sug_amount_dict
[
value
[
"fund_id"
]]
=
value
[
"after_optimization"
]
if
value
[
"after_optimization"
]
<=
0
:
if
value
[
"after_optimization"
]
<=
0
:
continue
continue
suggest_fund_dict
[
value
[
"fund_id"
]]
=
value
[
"fund_type"
]
suggest_fund_dict
[
value
[
"fund_id"
]]
=
value
[
"fund_type"
]
...
@@ -31,7 +36,7 @@ def recalculation_fund_comment(args):
...
@@ -31,7 +36,7 @@ def recalculation_fund_comment(args):
cur_folio_result
=
group_result
[
folio
]
cur_folio_result
=
group_result
[
folio
]
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
1
,
portfolio
=
user_customer
.
all_fund_type_dict
,
portfolio_diagnose
=
PortfolioDiagnose
(
client_type
=
1
,
portfolio
=
user_customer
.
all_fund_type_dict
,
invest_amount
=
float
(
cur_folio_result
[
"total_cost"
]
),
invest_amount
=
float
(
sum_amount
*
10000
),
start_date
=
user_customer
.
start_date
)
start_date
=
user_customer
.
start_date
)
portfolio_diagnose
.
proposal_customize
(
suggest_fund_list
,
suggest_weight_list
,
suggest_fund_dict
)
portfolio_diagnose
.
proposal_customize
(
suggest_fund_list
,
suggest_weight_list
,
suggest_fund_dict
)
...
@@ -39,18 +44,33 @@ def recalculation_fund_comment(args):
...
@@ -39,18 +44,33 @@ def recalculation_fund_comment(args):
abandon_fund
=
list
(
set
(
cur_folio_result
[
"fund_id_list"
])
-
set
(
suggest_fund_list
))
abandon_fund
=
list
(
set
(
cur_folio_result
[
"fund_id_list"
])
-
set
(
suggest_fund_list
))
portfolio_diagnose
.
abandon_fund_score
=
abandon_fund
portfolio_diagnose
.
abandon_fund_score
=
abandon_fund
finall_reslut
=
{}
dict_result
=
{}
finall_reslut
[
"suggestions_result"
],
finall_reslut
[
"suggestions_result_asset"
],
\
new_suggestions_result
,
new_suggestions_result_asset
,
return_compare_data
,
\
finall_reslut
[
"return_compare_data"
],
\
indicator_compare
,
new_group_evaluation
=
\
finall_reslut
[
"indicator_compare"
],
finall_reslut
[
"new_group_evaluation"
]
=
\
portfolio_diagnose
.
new_evaluation
(
folio
,
group_result
,
user_customer
,
suggest_fund_dict
)
portfolio_diagnose
.
new_evaluation
(
folio
,
group_result
,
user_customer
,
suggest_fund_dict
)
for
key_
,
value_
in
new_suggestions_result
.
items
():
for
new_sug
in
value_
:
new_sug
[
"after_optimization"
]
=
all_sug_amount_dict
.
get
(
new_sug
[
"fund_id"
],
0
)
finall_reslut
[
"return_compare_pic"
]
=
draw_combination_chart
(
new_suggestions_result_asset
[
"after"
]
=
sum_amount
finall_reslut
[
"return_compare_data"
][
"xlabels"
],
dict_result
[
"suggestions_result"
]
=
new_suggestions_result
finall_reslut
[
"return_compare_data"
][
"new_combination"
],
dict_result
[
"suggestions_result_asset"
]
=
new_suggestions_result_asset
finall_reslut
[
"return_compare_data"
][
"origin_combination"
],
# dict_result["return_compare_data"] = return_compare_data
finall_reslut
[
"return_compare_data"
][
"index"
])
dict_result
[
"indicator_compare"
]
=
indicator_compare
dict_result
[
"new_group_evaluation"
]
=
new_group_evaluation
new_correlation
=
portfolio_diagnose
.
new_correlation
new_correlation_columns
=
new_correlation
.
columns
.
tolist
()
new_correlation_values
=
new_correlation
.
values
.
tolist
()
dict_result
[
"new_correlation"
]
=
list
(
zip
(
range
(
1
,
len
(
new_correlation_columns
)
+
1
),
new_correlation_columns
,
new_correlation_values
))
dict_result
[
"return_compare_pic"
]
=
draw_combination_chart
(
return_compare_data
[
"xlabels"
],
return_compare_data
[
"new_combination"
],
return_compare_data
[
"origin_combination"
],
return_compare_data
[
"index"
])
except
Exception
as
e
:
except
Exception
as
e
:
print
(
traceback
.
print_exc
())
return
False
return
False
# print(json.dumps(dict_result, cls=npEncoder, ensure_ascii=False))
return
json
.
dumps
(
finall_reslu
t
,
cls
=
npEncoder
,
ensure_ascii
=
False
)
return
json
.
dumps
(
dict_resul
t
,
cls
=
npEncoder
,
ensure_ascii
=
False
)
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