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
093c1659
Commit
093c1659
authored
Nov 19, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update schedule setting
parent
b9b8fdd2
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
201 additions
and
194 deletions
+201
-194
api.py
alphamind/api.py
+2
-0
sqlengine.py
alphamind/data/engines/sqlengine.py
+8
-6
combined_model_training.py
alphamind/examples/combined_model_training.py
+191
-188
No files found.
alphamind/api.py
View file @
093c1659
...
...
@@ -50,6 +50,8 @@ def map_freq(freq):
horizon
=
19
elif
freq
==
'1d'
:
horizon
=
0
elif
freq
[
-
1
]
==
"b"
:
horizon
=
int
(
freq
[:
-
1
])
-
1
else
:
raise
ValueError
(
"Unrecognized freq: {0}"
.
format
(
freq
))
return
horizon
...
...
alphamind/data/engines/sqlengine.py
View file @
093c1659
...
...
@@ -184,18 +184,19 @@ class SqlEngine(object):
ref_date
:
str
,
codes
:
Iterable
[
int
],
expiry_date
:
str
=
None
,
horizon
:
int
=
0
)
->
pd
.
DataFrame
:
horizon
:
int
=
0
,
offset
:
int
=
0
)
->
pd
.
DataFrame
:
start_date
=
ref_date
if
not
expiry_date
:
end_date
=
advanceDateByCalendar
(
'china.sse'
,
ref_date
,
str
(
horizon
+
DAILY_RETURN_OFFSET
)
+
'b'
)
.
strftime
(
'
%
Y
%
m
%
d'
)
end_date
=
advanceDateByCalendar
(
'china.sse'
,
ref_date
,
str
(
horizon
+
offset
+
DAILY_RETURN_OFFSET
)
+
'b'
)
.
strftime
(
'
%
Y
%
m
%
d'
)
else
:
end_date
=
expiry_date
stats
=
func
.
sum
(
self
.
ln_func
(
1.
+
DailyReturn
.
d1
))
.
over
(
partition_by
=
DailyReturn
.
code
,
order_by
=
DailyReturn
.
trade_date
,
rows
=
(
DAILY_RETURN_OFFSET
,
horizon
+
DAILY_RETURN_OFFSET
))
.
label
(
'dx'
)
rows
=
(
DAILY_RETURN_OFFSET
+
offset
,
horizon
+
DAILY_RETURN_OFFSET
+
offset
))
.
label
(
'dx'
)
query
=
select
([
DailyReturn
.
trade_date
,
DailyReturn
.
code
,
stats
])
.
where
(
and_
(
...
...
@@ -213,13 +214,14 @@ class SqlEngine(object):
start_date
:
str
=
None
,
end_date
:
str
=
None
,
dates
:
Iterable
[
str
]
=
None
,
horizon
:
int
=
0
)
->
pd
.
DataFrame
:
horizon
:
int
=
0
,
offset
:
int
=
0
)
->
pd
.
DataFrame
:
if
dates
:
start_date
=
dates
[
0
]
end_date
=
dates
[
-
1
]
end_date
=
advanceDateByCalendar
(
'china.sse'
,
end_date
,
str
(
horizon
+
DAILY_RETURN_OFFSET
)
+
'b'
)
.
strftime
(
'
%
Y-
%
m-
%
d'
)
end_date
=
advanceDateByCalendar
(
'china.sse'
,
end_date
,
str
(
horizon
+
offset
+
DAILY_RETURN_OFFSET
)
+
'b'
)
.
strftime
(
'
%
Y-
%
m-
%
d'
)
cond
=
universe
.
query_range
(
start_date
,
end_date
)
big_table
=
join
(
DailyReturn
,
UniverseTable
,
...
...
@@ -230,7 +232,7 @@ class SqlEngine(object):
stats
=
func
.
sum
(
self
.
ln_func
(
1.
+
DailyReturn
.
d1
))
.
over
(
partition_by
=
DailyReturn
.
code
,
order_by
=
DailyReturn
.
trade_date
,
rows
=
(
DAILY_RETURN_OFFSET
,
horizon
+
DAILY_RETURN_OFFSET
))
.
label
(
'dx'
)
rows
=
(
offset
+
DAILY_RETURN_OFFSET
,
horizon
+
offset
+
DAILY_RETURN_OFFSET
))
.
label
(
'dx'
)
query
=
select
([
DailyReturn
.
trade_date
,
DailyReturn
.
code
,
stats
])
\
.
select_from
(
big_table
)
...
...
alphamind/examples/combined_model_training.py
View file @
093c1659
This diff is collapsed.
Click to expand it.
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