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
565999c1
Commit
565999c1
authored
Jan 27, 2021
by
wang zhengwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
1975f9d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
data_service_v2_1.py
app/service/data_service_v2_1.py
+3
-2
result_service_v2.py
app/service/result_service_v2.py
+13
-4
No files found.
app/service/data_service_v2_1.py
View file @
565999c1
...
@@ -142,9 +142,10 @@ class UserCustomerDataAdaptor:
...
@@ -142,9 +142,10 @@ class UserCustomerDataAdaptor:
need_less_share
-=
ori_share
need_less_share
-=
ori_share
user_customer_order_df
.
loc
[
index_ori
,
"confirm_share"
]
=
0
user_customer_order_df
.
loc
[
index_ori
,
"confirm_share"
]
=
0
else
:
else
:
user_customer_order_df
.
loc
[
index_ori
,
"confirm_share"
]
=
row_ori
[
"confirm_share"
]
-
need_less_share
need_less_share
=
0
need_less_share
=
0
user_customer_order_df
.
loc
[
index_ori
,
"confirm_share"
]
=
row_ori
[
#
user_customer_order_df.loc[index_ori, "confirm_share"] = row_ori[
"confirm_share"
]
-
need_less_share
#
"confirm_share"] - need_less_share
if
need_less_share
<=
0
:
if
need_less_share
<=
0
:
break
break
user_customer_order_df
=
user_customer_order_df
[(
user_customer_order_df
[
"order_type"
]
==
1
)
&
(
user_customer_order_df
[
"confirm_share"
]
>
0
)]
user_customer_order_df
=
user_customer_order_df
[(
user_customer_order_df
[
"order_type"
]
==
1
)
&
(
user_customer_order_df
[
"confirm_share"
]
>
0
)]
...
...
app/service/result_service_v2.py
View file @
565999c1
...
@@ -455,16 +455,25 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -455,16 +455,25 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
fund_hoding_info
[
"confirm_date"
]
=
row
[
"confirm_share_date"
]
.
strftime
(
"
%
Y-
%
m-
%
d"
)
fund_hoding_info
[
"confirm_date"
]
=
row
[
"confirm_share_date"
]
.
strftime
(
"
%
Y-
%
m-
%
d"
)
fund_hoding_info
[
"hold_year"
]
=
"
%.2
f"
%
round
((
self
.
end_date
-
pd
.
to_datetime
(
row
[
"confirm_share_date"
]))
.
days
/
365.0
,
2
)
# 存续年数
fund_hoding_info
[
"hold_year"
]
=
"
%.2
f"
%
round
((
self
.
end_date
-
pd
.
to_datetime
(
row
[
"confirm_share_date"
]))
.
days
/
365.0
,
2
)
# 存续年数
fund_hoding_info
[
"market_values"
]
=
round
((
float
(
row
[
"confirm_share"
])
*
(
fund_basic_info
[
"cur_cnav"
]
-
confirm_cnav
)
+
float
(
row
[
"confirm_amount"
]))
/
10000
,
2
)
fund_hoding_info
[
"market_values"
]
=
round
((
float
(
row
[
"confirm_share"
])
*
(
fund_basic_info
[
"cur_cnav"
]
-
confirm_cnav
)
+
float
(
row
[
"confirm_amount"
]))
/
10000
,
2
)
temp_market_values
=
float
(
row
[
"confirm_share"
])
*
(
fund_basic_info
[
"cur_cnav"
]
-
confirm_cnav
)
+
float
(
row
[
"confirm_amount"
])
# temp_market_values = float(row["confirm_share"]) * (fund_basic_info["cur_cnav"] - confirm_cnav) + float(row["confirm_amount"])
fund_hoding_info
[
"weight"
]
=
"
%.2
f"
%
round
(
float
(
fund_hoding_info
[
"market_values"
])
/
total_market_values
*
10000.0
*
100
,
2
)
# 月末占比
# fund_hoding_info["weight"] = "%.2f" % round(float(fund_hoding_info["market_values"]) / total_market_values * 10000.0 * 100, 2) # 月末占比
fund_hoding_info
[
"cost"
]
=
"
%.2
f"
%
round
(
float
(
row
[
"confirm_amount"
])
/
10000
,
2
)
# 投资本金
# # fund_hoding_info["cost"] = "%.2f" % round(float(row["confirm_amount"])/10000, 2) # 投资本金
# fund_hoding_info["cost"] = "%.2f" % round(float(row["confirm_share"]*row["nav"])/10000, 2)
temp_market_values
=
float
(
row
[
"confirm_share"
])
*
(
fund_basic_info
[
"cur_cnav"
]
-
confirm_cnav
+
float
(
row
[
"nav"
]))
fund_hoding_info
[
"market_values"
]
=
round
(
temp_market_values
/
10000.0
,
2
)
fund_hoding_info
[
"weight"
]
=
"
%.2
f"
%
round
(
float
(
fund_hoding_info
[
"market_values"
])
/
total_market_values
*
10000.0
*
100
,
2
)
# 月末占比
fund_hoding_info
[
"cost"
]
=
"
%.2
f"
%
round
(
float
(
row
[
"confirm_share"
]
*
row
[
"nav"
])
/
10000
,
2
)
# 投资本金
# 当月收益
# 当月收益
if
row
[
'confirm_share_date'
]
>
self
.
month_start_date
:
if
row
[
'confirm_share_date'
]
>
self
.
month_start_date
:
cal_month_start_date
=
row
[
'confirm_share_date'
]
cal_month_start_date
=
row
[
'confirm_share_date'
]
last_month_cnav_serise
=
p_result_cnav_data
[
p_result_cnav_data
.
index
==
pd
.
to_datetime
(
cal_month_start_date
)][
last_month_cnav_serise
=
p_result_cnav_data
[
p_result_cnav_data
.
index
==
pd
.
to_datetime
(
cal_month_start_date
)][
row
[
"fund_id"
]]
.
dropna
()
row
[
"fund_id"
]]
.
dropna
()
else
:
else
:
cal_month_start_date
=
self
.
month_start_date
-
datetime
.
timedelta
(
days
=
1
)
# cal_month_start_date = self.month_start_date - datetime.timedelta(days=1)
cal_month_start_date
=
self
.
month_start_date
last_month_cnav_serise
=
p_result_cnav_data
[
p_result_cnav_data
.
index
<
pd
.
to_datetime
(
cal_month_start_date
)][
row
[
"fund_id"
]]
.
dropna
()
last_month_cnav_serise
=
p_result_cnav_data
[
p_result_cnav_data
.
index
<
pd
.
to_datetime
(
cal_month_start_date
)][
row
[
"fund_id"
]]
.
dropna
()
if
len
(
last_month_cnav_serise
)
==
0
:
if
len
(
last_month_cnav_serise
)
==
0
:
fund_hoding_info
[
"profit"
]
=
round
(
float
(
row
[
"confirm_share"
])
*
(
fund_basic_info
[
"cur_cnav"
]
-
confirm_cnav
)
/
10000
,
2
)
fund_hoding_info
[
"profit"
]
=
round
(
float
(
row
[
"confirm_share"
])
*
(
fund_basic_info
[
"cur_cnav"
]
-
confirm_cnav
)
/
10000
,
2
)
...
...
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