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
3a23edc9
Commit
3a23edc9
authored
Dec 09, 2020
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
样式
parent
3e6b279e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99736 additions
and
15 deletions
+99736
-15
data_service.py
app/service/data_service.py
+2
-2
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+6
-3
draw.py
app/utils/draw.py
+1
-0
jinjia2html.py
app/utils/jinjia2html.py
+1
-2
timed_task.py
app/utils/timed_task.py
+8
-8
tamp_course_order.log
logs/tamp_course_order.log
+99718
-0
No files found.
app/service/data_service.py
View file @
3a23edc9
...
...
@@ -35,10 +35,10 @@ class UserCustomerDataAdaptor:
p_end_date
=
pd
.
to_datetime
(
end_date
)
.
date
()
p_end_date
=
datetime
.
date
(
year
=
p_end_date
.
year
,
month
=
p_end_date
.
month
,
day
=
1
)
-
datetime
.
timedelta
(
days
=
1
)
self
.
end_date
=
pd
.
to_datetime
(
str
(
p_end_date
))
# self.end_date = pd.to_datetime("2020-11-23
")
self
.
end_date
=
pd
.
to_datetime
(
"2020-12-04
"
)
p_start_date
=
datetime
.
date
(
year
=
p_end_date
.
year
,
month
=
p_end_date
.
month
,
day
=
1
)
self
.
month_start_date
=
p_start_date
# self.month_start_date = pd.to_datetime("2020-11-16
")
self
.
month_start_date
=
pd
.
to_datetime
(
"2020-11-1
"
)
self
.
user_customer_order_df
=
self
.
get_user_customer_order_data
()
self
.
fund_nav_total
,
self
.
fund_cnav_total
=
self
.
get_customer_fund_nav_data
()
self
.
index_df
=
self
.
get_customer_index_nav_data
()
...
...
app/service/portfolio_diagnose.py
View file @
3a23edc9
...
...
@@ -634,9 +634,12 @@ class PortfolioDiagnose(object):
# 覆盖的基金名称
strategy_name_evaluate
=
""
.
join
(
uniqe_strategy_name
)[:
-
1
]
if
len
(
uniqe_strategy
)
/
float
(
len
(
strategy_list
))
>
0.6
:
strategy_distribution_evaluate
=
"策略上有一定分散"
else
:
try
:
if
len
(
uniqe_strategy
)
/
float
(
len
(
strategy_list
))
>
0.6
:
strategy_distribution_evaluate
=
"策略上有一定分散"
else
:
strategy_distribution_evaluate
=
"策略分散程度不高"
except
ZeroDivisionError
:
strategy_distribution_evaluate
=
"策略分散程度不高"
# 相关性
if
len
(
self
.
abandon_fund_corr
)
>
0
:
...
...
app/utils/draw.py
View file @
3a23edc9
...
...
@@ -117,6 +117,7 @@ def draw_contribution_chart(xlabels, product_list, cumulative):
ax1
.
set_xticks
(
loc
)
ax1
.
set_xticklabels
(
xlabels
)
ax1
.
yaxis
.
set_major_formatter
(
FuncFormatter
(
to_percent
))
ax1
.
grid
(
axis
=
'y'
)
# temp_rate = np.zeros(max_x_count)
# for i in range(len(product_list)):
# temp_rate += product_list[i]['data']
...
...
app/utils/jinjia2html.py
View file @
3a23edc9
...
...
@@ -216,7 +216,6 @@ class DataIntegrate:
'title'
:
'10月综述'
,
'brand_name'
:
'小飞象<br>工作室'
,
'customer_old'
:
42
,
'customer_level'
:
'平衡型'
,
# 'new_evaluation': self.new_evaluation,
'position_years'
:
'5年'
,
'planned_allocation_amount'
:
2000.00
,
'now_allocation_amount'
:
self
.
total_cost
,
'now_yield'
:
self
.
now_yield
,
'index_yield'
:
self
.
index_yield
,
'expected_yield'
:
20
,
'now_annualised_return'
:
self
.
now_annualised_return
,
...
...
@@ -273,5 +272,5 @@ class DataIntegrate:
if
__name__
==
'__main__'
:
start
=
time
.
time
()
DataIntegrate
()
DataIntegrate
(
ifa_id
=
'189138514712358912'
,
customer_id
=
'6716613796058116091'
)
print
(
'耗时{}秒'
.
format
(
round
(
time
.
time
()
-
start
,
2
)))
app/utils/timed_task.py
View file @
3a23edc9
...
...
@@ -8,7 +8,7 @@
from
app.api.engine
import
tamp_user_engine
,
tamp_order_engine
,
TAMP_SQL
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy
import
Column
,
String
,
Integer
from
sqlalchemy
import
Column
,
String
,
Integer
,
and_
from
app.utils.jinjia2html
import
DataIntegrate
Base
=
declarative_base
()
...
...
@@ -36,25 +36,25 @@ 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
,
'{}_{}_.pdf'
.
format
(
ifauser_name
,
customer_name
))
except
:
print
(
"发生异常,下一个走起!"
)
#
print('开始制作IFA: {}, 客户: {}的基金月报'.format(ifauser_name, customer_name))
#
try:
DataIntegrate
(
ifauser_id
,
customer_id
,
'{}_{}_.pdf'
.
format
(
ifauser_name
,
customer_name
))
# except IndexError
:
#
print("发生异常,下一个走起!")
with
TAMP_SQL
(
tamp_user_engine
)
as
tamp_user
,
TAMP_SQL
(
tamp_order_engine
)
as
tamp_order
:
tamp_user_session
=
tamp_user
.
session
# 获取所有 ifauser
ifausers
=
tamp_user_session
.
query
(
IfaUser
)
.
all
()
ifausers
=
tamp_user_session
.
query
(
IfaUser
)
.
filter
(
IfaUser
.
id
.
in_
([
'USER_INFO15916072577875'
]))
.
all
()
tamp_order_session
=
tamp_order
.
session
# for ifauser in ifausers:
for
ifauser
in
ifausers
:
# 获取某个 ifa 的所有 customer
customers
=
tamp_order_session
.
query
(
Ifa_Customer
)
.
\
filter
_by
(
ifa_id
=
ifauser
.
id
)
.
all
()
filter
(
and_
(
Ifa_Customer
.
ifa_id
==
ifauser
.
id
,
Ifa_Customer
.
customer_id
.
in_
([
'6716613804182482944'
,
'6716613804966817792'
]))
)
.
all
()
# 循环这个 ifa 的所有 customer
for
customer
in
customers
:
...
...
logs/tamp_course_order.log
View file @
3a23edc9
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