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
d571d54e
Commit
d571d54e
authored
Jul 06, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update db models
parent
b6b4cb16
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
720 additions
and
651 deletions
+720
-651
models.py
alphamind/data/dbmodel/models.py
+711
-645
store.py
alphamind/data/store.py
+9
-6
No files found.
alphamind/data/dbmodel/models.py
View file @
d571d54e
This diff is collapsed.
Click to expand it.
alphamind/data/store.py
View file @
d571d54e
...
@@ -88,6 +88,14 @@ def industry_mapping(industry_arr, industry_codes, industry_dummies):
...
@@ -88,6 +88,14 @@ def industry_mapping(industry_arr, industry_codes, industry_dummies):
[
industry_codes
[
row
][
0
]
for
row
in
industry_dummies
],
[
industry_codes
[
row
][
0
]
for
row
in
industry_dummies
],
def
append_industry_info
(
df
):
industry_arr
=
np
.
array
(
industry_styles
)
industry_codes
=
np
.
arange
(
len
(
industry_styles
),
dtype
=
int
)
industry_dummies
=
df
[
industry_styles
]
.
values
.
astype
(
bool
)
df
[
'industry'
],
df
[
'industry_code'
]
=
industry_mapping
(
industry_arr
,
industry_codes
,
industry_dummies
)
def
fetch_data
(
factors
:
Iterable
[
str
],
def
fetch_data
(
factors
:
Iterable
[
str
],
start_date
:
str
,
start_date
:
str
,
end_date
:
str
,
end_date
:
str
,
...
@@ -157,12 +165,7 @@ def fetch_data(factors: Iterable[str],
...
@@ -157,12 +165,7 @@ def fetch_data(factors: Iterable[str],
benchmark_data
=
pd
.
read_sql
(
sql
,
engine
)
benchmark_data
=
pd
.
read_sql
(
sql
,
engine
)
total_data
[
'benchmark'
]
=
benchmark_data
total_data
[
'benchmark'
]
=
benchmark_data
industry_arr
=
np
.
array
(
industry_styles
)
append_industry_info
(
factor_data
)
industry_codes
=
np
.
arange
(
len
(
industry_styles
),
dtype
=
int
)
industry_dummies
=
factor_data
[
industry_styles
]
.
values
.
astype
(
bool
)
factor_data
[
'industry'
],
factor_data
[
'industry_code'
]
=
industry_mapping
(
industry_arr
,
industry_codes
,
industry_dummies
)
return
total_data
return
total_data
...
...
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