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
3bb9d66d
Commit
3bb9d66d
authored
Sep 08, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update model
parent
d46f2ebf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
models.py
alphamind/data/dbmodel/models.py
+5
-1
sqlengine.py
alphamind/data/engines/sqlengine.py
+3
-7
No files found.
alphamind/data/dbmodel/models.py
View file @
3bb9d66d
...
@@ -5,7 +5,7 @@ Created on 2017-6-29
...
@@ -5,7 +5,7 @@ Created on 2017-6-29
@author: cheng.li
@author: cheng.li
"""
"""
from
sqlalchemy
import
BigInteger
,
Column
,
DateTime
,
Float
,
Index
,
Integer
,
JSON
,
String
,
Text
,
Table
from
sqlalchemy
import
BigInteger
,
Column
,
DateTime
,
Float
,
Index
,
Integer
,
JSON
,
String
,
Text
,
Boolean
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.ext.declarative
import
declarative_base
Base
=
declarative_base
()
Base
=
declarative_base
()
...
@@ -1707,6 +1707,10 @@ class DailyPortfolios(Base):
...
@@ -1707,6 +1707,10 @@ class DailyPortfolios(Base):
portfolio_name
=
Column
(
String
(
50
),
primary_key
=
True
,
nullable
=
False
)
portfolio_name
=
Column
(
String
(
50
),
primary_key
=
True
,
nullable
=
False
)
code
=
Column
(
BigInteger
,
primary_key
=
True
,
nullable
=
False
)
code
=
Column
(
BigInteger
,
primary_key
=
True
,
nullable
=
False
)
weight
=
Column
(
Float
(
53
),
nullable
=
False
)
weight
=
Column
(
Float
(
53
),
nullable
=
False
)
er
=
Column
(
Float
(
53
),
nullable
=
False
)
industry
=
Column
(
String
(
50
),
nullable
=
False
)
benchmark_weight
=
Column
(
Float
(
53
),
nullable
=
False
)
is_tradable
=
Column
(
Boolean
,
nullable
=
False
)
class
PortfolioSettings
(
Base
):
class
PortfolioSettings
(
Base
):
...
...
alphamind/data/engines/sqlengine.py
View file @
3bb9d66d
...
@@ -535,20 +535,16 @@ class SqlEngine(object):
...
@@ -535,20 +535,16 @@ class SqlEngine(object):
def
fetch_model
(
self
,
def
fetch_model
(
self
,
ref_date
,
ref_date
,
portfolio
=
None
,
model_type
=
None
,
model_type
=
None
,
version
=
None
)
->
pd
.
DataFrame
:
model_
version
=
None
)
->
pd
.
DataFrame
:
conditions
=
[
Models
.
trade_date
==
ref_date
]
conditions
=
[
Models
.
trade_date
==
ref_date
]
if
portfolio
:
conditions
.
append
(
Models
.
portfolio_name
==
portfolio
)
if
model_type
:
if
model_type
:
conditions
.
append
(
Models
.
model_type
==
model_type
)
conditions
.
append
(
Models
.
model_type
==
model_type
)
if
version
:
if
model_
version
:
conditions
.
append
(
Models
.
version
==
version
)
conditions
.
append
(
Models
.
model_version
==
model_
version
)
query
=
select
([
Models
])
.
where
(
and_
(
*
conditions
))
query
=
select
([
Models
])
.
where
(
and_
(
*
conditions
))
...
...
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