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
015b6122
Commit
015b6122
authored
Dec 30, 2020
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复中证500的年化等,添加FOF判断策略分类
parent
1c6df9f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
portfolio_diagnose.py
app/service/portfolio_diagnose.py
+4
-4
result_service_v2.py
app/service/result_service_v2.py
+3
-1
No files found.
app/service/portfolio_diagnose.py
View file @
015b6122
...
@@ -818,12 +818,12 @@ class PortfolioDiagnose(object):
...
@@ -818,12 +818,12 @@ class PortfolioDiagnose(object):
index_return
[
"new_index_return"
]
=
(
index_return
[
"index"
]
-
start_index_return
)
/
(
1
+
start_index_return
)
index_return
[
"new_index_return"
]
=
(
index_return
[
"index"
]
-
start_index_return
)
/
(
1
+
start_index_return
)
index_return_ratio
=
index_return
[
"new_index_return"
]
.
values
[
-
1
]
index_return_ratio
=
index_return
[
"new_index_return"
]
.
values
[
-
1
]
index_return_ratio_year
=
annual_return
(
index_return
[
"new_index_return"
]
.
values
[
-
1
],
index_return_ratio_year
=
annual_return
(
index_return
[
"new_index_return"
]
.
values
[
-
1
],
index_return
[
"new_index_return"
],
n_freq
)
index_return
[
"new_index_return"
],
250
)
index_volatility
=
volatility
(
index_return
[
"new_index_return"
]
+
1
,
n_freq
)
index_volatility
=
volatility
(
index_return
[
"new_index_return"
]
+
1
,
250
)
index_drawdown
=
max_drawdown
(
index_return
[
"new_index_return"
]
+
1
)
index_drawdown
=
max_drawdown
(
index_return
[
"new_index_return"
]
+
1
)
index_sim
=
simple_return
(
index_return
[
"new_index_return"
]
+
1
)
index_sim
=
simple_return
(
index_return
[
"new_index_return"
]
+
1
)
index_exc
=
excess_return
(
index_sim
,
BANK_RATE
,
n_freq
)
index_exc
=
excess_return
(
index_sim
,
BANK_RATE
,
250
)
index_sharpe
=
sharpe_ratio
(
index_exc
,
index_sim
,
n_freq
)
index_sharpe
=
sharpe_ratio
(
index_exc
,
index_sim
,
250
)
# 收益对比数据
# 收益对比数据
return_compare_df
=
pd
.
merge
(
index_return
[[
"new_index_return"
]],
old_return_df
[[
"cum_return_ratio"
]],
return_compare_df
=
pd
.
merge
(
index_return
[[
"new_index_return"
]],
old_return_df
[[
"cum_return_ratio"
]],
...
...
app/service/result_service_v2.py
View file @
015b6122
...
@@ -434,7 +434,9 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
...
@@ -434,7 +434,9 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
# 基金持仓数据
# 基金持仓数据
total_market_values
=
p_sum_profit
+
p_total_amount
# 月末总市值
total_market_values
=
p_sum_profit
+
p_total_amount
# 月末总市值
fund_hoding_info
=
{
"fund_strategy_name"
:
dict_substrategy
[
int
(
row
[
"substrategy"
])],
"fund_name"
:
row
[
"fund_name"
]}
if
"长富"
in
row
[
"fund_name"
]
or
"盈沛"
in
row
[
"fund_name"
]:
fund_strategy_name
=
"FOF"
fund_hoding_info
=
{
"fund_strategy_name"
:
fund_strategy_name
,
"fund_name"
:
row
[
"fund_name"
]}
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
)
...
...
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