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
b03929b9
Commit
b03929b9
authored
Aug 03, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added one more risk
parent
5517da1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
sqlengine.py
alphamind/data/engines/sqlengine.py
+6
-4
No files found.
alphamind/data/engines/sqlengine.py
View file @
b03929b9
...
@@ -64,6 +64,8 @@ industry_styles = [
...
@@ -64,6 +64,8 @@ industry_styles = [
'Conglomerates'
'Conglomerates'
]
]
macro_styles
=
[
'COUNTRY'
]
def
append_industry_info
(
df
):
def
append_industry_info
(
df
):
industry_arr
=
np
.
array
(
industry_styles
)
industry_arr
=
np
.
array
(
industry_styles
)
...
@@ -146,7 +148,7 @@ class SqlEngine(object):
...
@@ -146,7 +148,7 @@ class SqlEngine(object):
factor_str
=
mapping_factors
(
factors
)
factor_str
=
mapping_factors
(
factors
)
total_risk_factors
=
list
(
set
(
risk_styles
+
industry_styles
)
.
difference
(
factors
))
total_risk_factors
=
list
(
set
(
risk_styles
+
industry_styles
+
macro_styles
)
.
difference
(
factors
))
if
total_risk_factors
:
if
total_risk_factors
:
risk_str
=
','
.
join
(
'risk_exposure.'
+
f
for
f
in
total_risk_factors
)
risk_str
=
','
.
join
(
'risk_exposure.'
+
f
for
f
in
total_risk_factors
)
...
@@ -205,15 +207,15 @@ class SqlEngine(object):
...
@@ -205,15 +207,15 @@ class SqlEngine(object):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
db_url
=
'mssql+pymssql://licheng:A12345678!@10.63.6.220/alpha?charset=
utf8
'
db_url
=
'mssql+pymssql://licheng:A12345678!@10.63.6.220/alpha?charset=
cp936
'
from
alphamind.data.dbmodel.models
import
Uqer
from
alphamind.data.dbmodel.models
import
Uqer
import
datetime
as
dt
import
datetime
as
dt
universe
=
Universe
(
'
zz500'
,
[
'ashare'
],
filter_cond
=
(
Uqer
.
BLEV
>=
0.
)
&
(
Uqer
.
BLEV
<=
0.1
),
include_universe
=
[
'hs300
'
])
universe
=
Universe
(
'
custom'
,
[
'ashare
'
])
engine
=
SqlEngine
(
db_url
)
engine
=
SqlEngine
(
db_url
)
ref_date
=
'2017-07-
04
'
ref_date
=
'2017-07-
21
'
codes
=
engine
.
fetch_codes
(
ref_date
,
universe
)
codes
=
engine
.
fetch_codes
(
ref_date
,
universe
)
...
...
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