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
c5fc0389
Commit
c5fc0389
authored
Mar 11, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指数去重
parent
99f85f44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
data_service_v2_1.py
app/service/data_service_v2_1.py
+8
-7
No files found.
app/service/data_service_v2_1.py
View file @
c5fc0389
...
@@ -35,7 +35,7 @@ class UserCustomerDataAdaptor:
...
@@ -35,7 +35,7 @@ class UserCustomerDataAdaptor:
all_fund_distribution
=
{}
all_fund_distribution
=
{}
all_fund_performance
=
{}
all_fund_performance
=
{}
def
__init__
(
self
,
user_id
,
customer_id
,
end_date
=
str
(
datetime
.
datetime
.
now
()),
index_id
=
"
IN0000007M
"
):
def
__init__
(
self
,
user_id
,
customer_id
,
end_date
=
str
(
datetime
.
datetime
.
now
()),
index_id
=
"
4000233
"
):
self
.
user_id
=
user_id
self
.
user_id
=
user_id
self
.
customer_id
=
customer_id
self
.
customer_id
=
customer_id
self
.
compare_index_id
=
index_id
self
.
compare_index_id
=
index_id
...
@@ -274,7 +274,7 @@ class UserCustomerDataAdaptor:
...
@@ -274,7 +274,7 @@ class UserCustomerDataAdaptor:
tamp_product_session
=
tamp_product
.
session
tamp_product_session
=
tamp_product
.
session
tamp_fund_session
=
tamp_fund
.
session
tamp_fund_session
=
tamp_fund
.
session
now_date
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d"
)
now_date
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d"
)
trade_date_df
=
self
.
get_trade_cal
(
"200
0
0101"
,
now_date
)
trade_date_df
=
self
.
get_trade_cal
(
"200
5
0101"
,
now_date
)
self
.
trade_cal_date
=
trade_date_df
self
.
trade_cal_date
=
trade_date_df
all_fund_nav
=
pd
.
DataFrame
(
index
=
trade_date_df
[
"datetime"
])
all_fund_nav
=
pd
.
DataFrame
(
index
=
trade_date_df
[
"datetime"
])
all_fund_cnav
=
pd
.
DataFrame
(
index
=
trade_date_df
[
"datetime"
])
all_fund_cnav
=
pd
.
DataFrame
(
index
=
trade_date_df
[
"datetime"
])
...
@@ -369,11 +369,12 @@ class UserCustomerDataAdaptor:
...
@@ -369,11 +369,12 @@ class UserCustomerDataAdaptor:
return
all_fund_nav
,
all_fund_cnav
return
all_fund_nav
,
all_fund_cnav
# 获取客户对比指数净值数据
# 获取客户对比指数净值数据
def
get_customer_index_nav_data
(
self
,
index_id
=
"IN0000007M"
):
def
get_customer_index_nav_data
(
self
,
index_id
=
"4000233"
):
with
TAMP_SQL
(
tamp_product_engine
)
as
tamp_product
:
with
TAMP_SQL
(
tamp_fund_engine
)
as
tamp_fund
:
tamp_product_session
=
tamp_product
.
session
tamp_fund_session
=
tamp_fund
.
session
sql
=
"select distinct price_date,close from fund_market_indexes where index_id='{}' order by price_date ASC"
.
format
(
index_id
)
sql
=
"select DISTINCT `price_date`, `close` from tx_fund_market_indexes where index_id='{}' order by price_date ASC"
.
format
(
cur
=
tamp_product_session
.
execute
(
sql
)
index_id
)
cur
=
tamp_fund_session
.
execute
(
sql
)
data
=
cur
.
fetchall
()
data
=
cur
.
fetchall
()
index_df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'price_date'
,
'index'
])
index_df
=
pd
.
DataFrame
(
list
(
data
),
columns
=
[
'price_date'
,
'index'
])
index_df
[
"price_date"
]
=
pd
.
to_datetime
(
index_df
[
"price_date"
])
index_df
[
"price_date"
]
=
pd
.
to_datetime
(
index_df
[
"price_date"
])
...
...
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