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
7801abf3
Commit
7801abf3
authored
Nov 26, 2020
by
pengxiong@wealthgrow.cn
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
745c54cb
8853b6d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
engine.py
app/api/engine.py
+3
-3
week_evaluation.py
app/utils/week_evaluation.py
+17
-1
No files found.
app/api/engine.py
View file @
7801abf3
...
@@ -58,9 +58,9 @@ tamp_user_engine = create_engine(
...
@@ -58,9 +58,9 @@ tamp_user_engine = create_engine(
),
),
echo
=
True
echo
=
True
)
)
tamp_product_session
=
sessionmaker
(
bind
=
tamp_product_engine
)()
tamp_product_session
=
sessionmaker
(
bind
=
tamp_product_engine
,
autocommit
=
True
)()
tamp_order_session
=
sessionmaker
(
bind
=
tamp_order_engine
)()
tamp_order_session
=
sessionmaker
(
bind
=
tamp_order_engine
,
autocommit
=
True
)()
tamp_user_session
=
sessionmaker
(
bind
=
tamp_user_engine
)()
tamp_user_session
=
sessionmaker
(
bind
=
tamp_user_engine
,
autocommit
=
True
)()
# redis = redis.StrictRedis(
# redis = redis.StrictRedis(
# host=config[env]['redis']['host'],
# host=config[env]['redis']['host'],
...
...
app/utils/week_evaluation.py
View file @
7801abf3
...
@@ -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