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
9b2205d5
Commit
9b2205d5
authored
Feb 19, 2021
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组合收益率等修复
parent
efe0d5cd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
result_service_v2.py
app/service/result_service_v2.py
+8
-8
No files found.
app/service/result_service_v2.py
View file @
9b2205d5
...
@@ -522,14 +522,14 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -522,14 +522,14 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
# nav_net_amount_df = resample(return_ratio_df, self.trade_cal_date, freq_max)
# nav_net_amount_df = resample(return_ratio_df, self.trade_cal_date, freq_max)
nav_net_amount_df
[
"sum_net_amount"
]
=
nav_net_amount_df
[
fund_id_list_amount
]
.
sum
(
axis
=
1
)
.
apply
(
lambda
x
:
Decimal
.
from_float
(
x
))
nav_net_amount_df
[
"sum_net_amount"
]
=
nav_net_amount_df
[
fund_id_list_amount
]
.
sum
(
axis
=
1
)
.
apply
(
lambda
x
:
Decimal
.
from_float
(
x
))
for
amount_name
in
fund_id_list
:
for
amount_name
in
fund_id_list
:
#
price = nav_net_amount_df[amount_name].dropna()
price
=
nav_net_amount_df
[
amount_name
]
.
dropna
()
#
profit = price.diff().fillna(Decimal(0))
profit
=
price
.
diff
()
.
fillna
(
Decimal
(
0
))
#
profit_ratio_new = profit / price.shift(1)
profit_ratio_new
=
profit
/
price
.
shift
(
1
)
#
profit_ratio_old = nav_net_amount_df[amount_name+"_profit_ratio"]
profit_ratio_old
=
nav_net_amount_df
[
amount_name
+
"_profit_ratio"
]
#
nan_index = profit_ratio_new[pd.isna(profit_ratio_new)].index
nan_index
=
profit_ratio_new
[
pd
.
isna
(
profit_ratio_new
)]
.
index
#
profit_ratio_new[nan_index] = profit_ratio_old[nan_index]
profit_ratio_new
[
nan_index
]
=
profit_ratio_old
[
nan_index
]
#
#
nav_net_amount_df[amount_name + "_profit_ratio"] = profit_ratio_new
nav_net_amount_df
[
amount_name
+
"_profit_ratio"
]
=
profit_ratio_new
nav_net_amount_df
[
amount_name
+
"_amount_ratio"
]
=
nav_net_amount_df
[
amount_name
+
"_net_amount"
]
/
(
nav_net_amount_df
[
"sum_net_amount"
])
nav_net_amount_df
[
amount_name
+
"_amount_ratio"
]
=
nav_net_amount_df
[
amount_name
+
"_net_amount"
]
/
(
nav_net_amount_df
[
"sum_net_amount"
])
fund_profit_ratio
=
nav_net_amount_df
[
amount_name
+
"_profit_ratio"
]
.
dropna
()
+
1
fund_profit_ratio
=
nav_net_amount_df
[
amount_name
+
"_profit_ratio"
]
.
dropna
()
+
1
...
...
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