Skip to content

Commit

Permalink
fix SimAccount issue
Browse files Browse the repository at this point in the history
  • Loading branch information
foolcage committed Dec 27, 2019
1 parent 10324c6 commit c7963a3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.6.2', # Required
version='0.6.3', # Required

# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
Expand Down
16 changes: 5 additions & 11 deletions zvt/domain/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
from sqlalchemy.orm import relationship

# business data
from zvdata import Mixin
from zvdata.contract import register_schema

BusinessBase = declarative_base()


class Trader(BusinessBase):
class Trader(BusinessBase, Mixin):
__tablename__ = 'trader'
id = Column(String(length=128), primary_key=True)
# 时间
timestamp = Column(DateTime)
# 机器人名字
trader_name = Column(String(length=128))

Expand All @@ -34,13 +32,9 @@ class Trader(BusinessBase):


# 一天只有一条记录
class SimAccount(BusinessBase):
class SimAccount(BusinessBase, Mixin):
__tablename__ = 'sim_account'

id = Column(String(length=128), primary_key=True)
# 时间
timestamp = Column(DateTime)

# 机器人名字
trader_name = Column(String(length=128))
# 可用现金
Expand All @@ -57,7 +51,7 @@ class SimAccount(BusinessBase):


# 一天可有多条记录
class Position(BusinessBase):
class Position(BusinessBase, Mixin):
__tablename__ = 'position'

id = Column(String(length=128), primary_key=True)
Expand Down Expand Up @@ -92,7 +86,7 @@ class Position(BusinessBase):
trading_t = Column(Integer)


class Order(BusinessBase):
class Order(BusinessBase, Mixin):
__tablename__ = 'order'

id = Column(String(length=128), primary_key=True)
Expand Down
Binary file modified zvt/samples/data.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions zvt/utils/zip_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import zipfile

from zvt.settings import ZVT_TEST_HOME
from zvt.settings import ZVT_TEST_DATA_PATH, DATA_SAMPLE_ZIP_PATH


def zip_dir(src_dir,
Expand All @@ -16,7 +16,7 @@ def zip_dir(src_dir,
if dst_dir:
dst_path = os.path.join(dst_dir, zip_file_name)
else:
dst_path = os.path.abspath(os.path.join(src_dir, os.pardir, zip_file_name))
dst_path = zip_file_name

# os.remove(dst_path)

Expand Down Expand Up @@ -44,5 +44,5 @@ def unzip(zip_file, dst_dir):


if __name__ == '__main__':
zip_dir(ZVT_TEST_HOME, zip_file_name='datasample.zip')
zip_dir(ZVT_TEST_DATA_PATH, zip_file_name=DATA_SAMPLE_ZIP_PATH)
# unzip(DATA_SAMPLE_ZIP_PATH, DATA_SAMPLE_PATH)

0 comments on commit c7963a3

Please sign in to comment.