Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
6f5267fd
Commit
6f5267fd
authored
Jul 20, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug for daily return calculation
parent
a56d4d0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
sqlengine.py
alphamind/data/engines/sqlengine.py
+4
-4
No files found.
alphamind/data/engines/sqlengine.py
View file @
6f5267fd
...
...
@@ -111,15 +111,15 @@ class SqlEngine(object):
return
sorted
(
codes_set
)
def
fetch_dx_return
(
self
,
ref_date
,
codes
,
expiry_date
=
None
,
horizon
=
1
):
def
fetch_dx_return
(
self
,
ref_date
,
codes
,
expiry_date
=
None
,
horizon
=
0
):
start_date
=
ref_date
if
not
expiry_date
and
horizon
:
if
not
expiry_date
:
end_date
=
advanceDateByCalendar
(
'china.sse'
,
ref_date
,
str
(
horizon
)
+
'b'
)
.
strftime
(
'
%
Y
%
m
%
d'
)
el
if
expiry_dat
e
:
el
s
e
:
end_date
=
expiry_date
query
=
select
([
DailyReturn
.
Code
,
func
.
sum
(
DailyReturn
.
d1
)
.
label
(
'dx'
)])
.
where
(
query
=
select
([
DailyReturn
.
Code
,
func
.
sum
(
func
.
log
(
1.
+
DailyReturn
.
d1
)
)
.
label
(
'dx'
)])
.
where
(
and_
(
DailyReturn
.
Date
.
between
(
start_date
,
end_date
),
DailyReturn
.
Code
.
in_
(
codes
)
...
...
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