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
a90eac30
Commit
a90eac30
authored
Nov 11, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made risk_exp can be unused
parent
63610e55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
sqlengine.py
alphamind/data/engines/sqlengine.py
+5
-5
combined_model_training.py
alphamind/examples/combined_model_training.py
+4
-6
No files found.
alphamind/data/engines/sqlengine.py
View file @
a90eac30
...
...
@@ -323,7 +323,7 @@ class SqlEngine(object):
query
=
select
(
[
FullFactor
.
trade_date
,
FullFactor
.
code
,
FullFactor
.
isOpen
]
+
list
(
factor_cols
.
keys
()))
\
.
select_from
(
big_table
)
.
select_from
(
big_table
)
.
distinct
()
df
=
pd
.
read_sql
(
query
,
self
.
engine
)
.
sort_values
([
'trade_date'
,
'code'
])
...
...
@@ -387,7 +387,7 @@ class SqlEngine(object):
risk_exposure_cols
=
[
FullFactor
.
__table__
.
columns
[
f
]
for
f
in
total_risk_factors
if
f
not
in
set
(
excluded
)]
query
=
select
([
FullFactor
.
code
,
special_risk_col
]
+
risk_exposure_cols
)
\
.
where
(
and_
(
FullFactor
.
trade_date
==
ref_date
,
FullFactor
.
code
.
in_
(
codes
)))
.
where
(
and_
(
FullFactor
.
trade_date
==
ref_date
,
FullFactor
.
code
.
in_
(
codes
)))
.
distinct
()
risk_exp
=
pd
.
read_sql
(
query
,
self
.
engine
)
...
...
@@ -429,7 +429,7 @@ class SqlEngine(object):
query
=
select
(
[
FullFactor
.
trade_date
,
FullFactor
.
code
,
special_risk_col
]
+
risk_exposure_cols
)
\
.
select_from
(
big_table
)
.
select_from
(
big_table
)
.
distinct
()
risk_exp
=
pd
.
read_sql
(
query
,
self
.
engine
)
...
...
@@ -450,7 +450,7 @@ class SqlEngine(object):
Industry
.
code
.
in_
(
codes
),
Industry
.
industry
==
industry_category_name
)
)
)
.
distinct
()
return
pd
.
read_sql
(
query
,
self
.
engine
)
...
...
@@ -481,7 +481,7 @@ class SqlEngine(object):
query
=
select
([
Industry
.
trade_date
,
Industry
.
code
,
Industry
.
industryID1
.
label
(
'industry_code'
),
Industry
.
industryName1
.
label
(
'industry'
)])
.
select_from
(
big_table
)
Industry
.
industryName1
.
label
(
'industry'
)])
.
select_from
(
big_table
)
.
distinct
()
return
pd
.
read_sql
(
query
,
self
.
engine
)
def
fetch_data
(
self
,
ref_date
:
str
,
...
...
alphamind/examples/combined_model_training.py
View file @
a90eac30
...
...
@@ -17,11 +17,11 @@ plt.style.use('ggplot')
Back test parameter settings
"""
start_date
=
'201
2
-01-01'
end_date
=
'2017-11-0
7
'
start_date
=
'201
7
-01-01'
end_date
=
'2017-11-0
8
'
benchmark_code
=
300
universe_name
=
'zz800'
universe
=
Universe
(
universe_name
,
[
universe_name
]
)
universe_name
=
[
'zz500'
,
'hs300'
,
'sh50'
]
universe
=
Universe
(
universe_name
,
universe_name
)
frequency
=
'1w'
batch
=
8
method
=
'risk_neutral'
...
...
@@ -85,7 +85,6 @@ const_model_factor_data = engine.fetch_data_range(universe,
total_features
,
dates
=
ref_dates
,
benchmark
=
benchmark_code
)[
'factor'
]
"""
Training phase
"""
...
...
@@ -101,7 +100,6 @@ for ref_date in ref_dates:
models_series
.
loc
[
ref_date
]
=
model
alpha_logger
.
info
(
'trade_date: {0} training finished'
.
format
(
ref_date
))
"""
Predicting and re-balance phase
"""
...
...
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