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
21571ed1
Commit
21571ed1
authored
Dec 10, 2020
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复Decimal(NaN)
parent
e027a0cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
data_service.py
app/service/data_service.py
+6
-1
No files found.
app/service/data_service.py
View file @
21571ed1
...
...
@@ -11,6 +11,7 @@ import numpy as np
from
sqlalchemy
import
and_
import
tushare
as
ts
import
datetime
import
math
from
decimal
import
Decimal
from
app.api.engine
import
tamp_user_engine
,
tamp_product_engine
,
TAMP_SQL
# from app.model.tamp_user_models import CustomerOrder, CustomerInfo
...
...
@@ -128,6 +129,9 @@ class UserCustomerDataAdaptor:
all_fund_nav
=
all_fund_nav
[
all_fund_nav
.
index
<=
self
.
end_date
]
all_fund_cnav
=
all_fund_cnav
[
all_fund_cnav
.
index
<=
self
.
end_date
]
# for cur_fund_id in self.user_customer_order_df["fund_id"].unique():
# all_fund_nav[cur_fund_id][all_fund_nav[cur_fund_id].apply(lambda x: math.isnan(x))]=np.nan
# all_fund_cnav[cur_fund_id][all_fund_cnav[cur_fund_id].apply(lambda x: math.isnan(x))] = np.nan
self
.
last_nav_date
=
str
(
all_fund_cnav
.
dropna
(
how
=
"all"
)
.
index
.
values
[
-
1
])[:
10
]
return
all_fund_nav
,
all_fund_cnav
...
...
@@ -269,7 +273,7 @@ class UserCustomerDataAdaptor:
confirm_share_date
=
pd
.
to_datetime
(
row
[
"confirm_share_date"
])
# 根据确认净值日查看是否含有累积净值的数据,如果没有按照前后差值推算当天累积净值
if
pd
.
isnull
(
c
nav_df
.
loc
[
confirm_share_date
,
cur_fund_id
]):
if
pd
.
isnull
(
p_
nav_df
.
loc
[
confirm_share_date
,
cur_fund_id
]):
last_nav_data
=
p_nav_df
[
p_nav_df
.
index
<
confirm_share_date
][
cur_fund_id
]
.
dropna
()
.
tail
(
1
)
last_cnav_data
=
p_cnav_df
[
p_cnav_df
.
index
<
confirm_share_date
][
cur_fund_id
]
.
dropna
()
.
tail
(
1
)
# 判断上个净值日和当前确认日之中是否存在分红日
...
...
@@ -332,4 +336,5 @@ class UserCustomerDataAdaptor:
# cnav_df[p_fund_id_ + "_profit_ratio"] = cnav_df[p_fund_id_ + "_earn"].apply(lambda x: Decimal(x)) / cnav_df[
# p_fund_id_ + "_net_amount"].shift()
# cnav_df[p_fund_id_ + "_net_amount"] = cnav_df[p_fund_id_ + "_share"] * cnav_df[p_fund_id_]
return
cnav_df
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