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
654e566b
Commit
654e566b
authored
Nov 26, 2020
by
赵杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改计算夏普率mean问题
parent
ab92ee39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
week_evaluation.py
app/utils/week_evaluation.py
+17
-1
No files found.
app/utils/week_evaluation.py
View file @
654e566b
...
@@ -42,7 +42,7 @@ def sharpe_ratio(excess_return, simple_return, n):
...
@@ -42,7 +42,7 @@ def sharpe_ratio(excess_return, simple_return, n):
n: 数据类型, 周(52), 月(12), 日(250)
n: 数据类型, 周(52), 月(12), 日(250)
"""
"""
import
math
import
math
d
=
math
.
sqrt
(
n
)
*
excess_return
.
mean
()
/
simple_return
.
std
(
ddof
=
1
)
d
=
math
.
sqrt
(
n
)
*
excess_return
/
simple_return
.
std
(
ddof
=
1
)
return
d
return
d
...
@@ -257,3 +257,19 @@ def cvar(returns, alpha):
...
@@ -257,3 +257,19 @@ def cvar(returns, alpha):
# Return the average VaR
# Return the average VaR
# CVaR should be positive
# CVaR should be positive
return
abs
(
sum_var
/
index
)
return
abs
(
sum_var
/
index
)
def
freq_days
(
fav_freq
):
if
fav_freq
==
1
:
N
=
250
# 日更新
elif
fav_freq
==
2
:
N
=
52
# 周更新
elif
fav_freq
==
3
:
N
=
24
# 半周更新
elif
fav_freq
==
4
:
N
=
12
# 月更新
elif
fav_freq
==
5
:
N
=
3
# 季度更新
else
:
N
=
250
# 没有设置freq默认是天更
return
N
\ No newline at end of file
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