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
c19f7bb1
Commit
c19f7bb1
authored
May 02, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update db models
parent
712a47a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
models.py
alphamind/data/dbmodel/models.py
+14
-16
sqlengine.py
alphamind/data/engines/sqlengine.py
+0
-1
No files found.
alphamind/data/dbmodel/models.py
View file @
c19f7bb1
...
@@ -12,6 +12,19 @@ Base = declarative_base()
...
@@ -12,6 +12,19 @@ Base = declarative_base()
metadata
=
Base
.
metadata
metadata
=
Base
.
metadata
class
Categories
(
Base
):
__tablename__
=
'categories'
__table_args__
=
(
Index
(
'categories_pk'
,
'trade_date'
,
'code'
,
unique
=
True
),
)
trade_date
=
Column
(
DateTime
,
primary_key
=
True
,
nullable
=
False
)
code
=
Column
(
BigInteger
,
primary_key
=
True
,
nullable
=
False
)
sw1
=
Column
(
Integer
)
sw1_adj
=
Column
(
Integer
)
class
DailyPortfolios
(
Base
):
class
DailyPortfolios
(
Base
):
__tablename__
=
'daily_portfolios'
__tablename__
=
'daily_portfolios'
__table_args__
=
(
__table_args__
=
(
...
@@ -301,21 +314,6 @@ class PortfolioSettings(Base):
...
@@ -301,21 +314,6 @@ class PortfolioSettings(Base):
weight
=
Column
(
Float
(
53
),
nullable
=
False
)
weight
=
Column
(
Float
(
53
),
nullable
=
False
)
class
Positions
(
Base
):
__tablename__
=
'positions'
__table_args__
=
(
Index
(
'positions_idx'
,
'trade_date'
,
'source'
,
'universe'
,
'benchmark'
,
'portfolio'
,
'type'
,
unique
=
True
),
)
source
=
Column
(
String
(
50
),
primary_key
=
True
,
nullable
=
False
)
universe
=
Column
(
String
(
50
),
primary_key
=
True
,
nullable
=
False
)
benchmark
=
Column
(
Integer
,
primary_key
=
True
,
nullable
=
False
)
trade_date
=
Column
(
DateTime
,
primary_key
=
True
,
nullable
=
False
)
portfolio
=
Column
(
String
(
50
),
primary_key
=
True
,
nullable
=
False
)
type
=
Column
(
String
(
50
),
primary_key
=
True
,
nullable
=
False
)
weight
=
Column
(
JSON
)
class
RebalanceLog
(
Base
):
class
RebalanceLog
(
Base
):
__tablename__
=
'rebalance_log'
__tablename__
=
'rebalance_log'
__table_args__
=
(
__table_args__
=
(
...
@@ -1316,5 +1314,5 @@ class Outright(Base):
...
@@ -1316,5 +1314,5 @@ class Outright(Base):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
from
sqlalchemy
import
create_engine
from
sqlalchemy
import
create_engine
engine
=
create_engine
(
'postgres+psycopg2://postgres:
we083826@192.168.0.102
/alpha'
)
engine
=
create_engine
(
'postgres+psycopg2://postgres:
A12345678!@10.63.6.220
/alpha'
)
Base
.
metadata
.
create_all
(
engine
)
Base
.
metadata
.
create_all
(
engine
)
alphamind/data/engines/sqlengine.py
View file @
c19f7bb1
...
@@ -32,7 +32,6 @@ from alphamind.data.dbmodel.models import Universe as UniverseTable
...
@@ -32,7 +32,6 @@ from alphamind.data.dbmodel.models import Universe as UniverseTable
from
alphamind.data.dbmodel.models
import
Formulas
from
alphamind.data.dbmodel.models
import
Formulas
from
alphamind.data.dbmodel.models
import
DailyPortfoliosSchedule
from
alphamind.data.dbmodel.models
import
DailyPortfoliosSchedule
from
alphamind.data.dbmodel.models
import
Performance
from
alphamind.data.dbmodel.models
import
Performance
from
alphamind.data.dbmodel.models
import
Positions
from
alphamind.data.dbmodel.models
import
Outright
from
alphamind.data.dbmodel.models
import
Outright
from
alphamind.data.dbmodel.models
import
RiskExposure
from
alphamind.data.dbmodel.models
import
RiskExposure
from
alphamind.data.transformer
import
Transformer
from
alphamind.data.transformer
import
Transformer
...
...
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