From f86d848b980f66da6a7e9cca622f1436727d92df Mon Sep 17 00:00:00 2001 From: Aaron Qiu Date: Thu, 9 May 2019 19:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF=E5=A4=9A?= =?UTF-8?q?=E5=88=97=E7=B4=A2=E5=BC=95=E9=A1=BA=E5=BA=8F=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=95=88=E7=8E=87?= =?UTF-8?q?=E4=BD=8E=E4=B8=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/database/database_mongo.py | 4 ++-- vnpy/trader/database/database_sql.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vnpy/trader/database/database_mongo.py b/vnpy/trader/database/database_mongo.py index f1e7c4a9..19292e66 100644 --- a/vnpy/trader/database/database_mongo.py +++ b/vnpy/trader/database/database_mongo.py @@ -55,7 +55,7 @@ class DbBarData(Document): meta = { "indexes": [ { - "fields": ("datetime", "interval", "symbol", "exchange"), + "fields": ("symbol", "exchange", "interval", "datetime"), "unique": True, } ] @@ -150,7 +150,7 @@ class DbTickData(Document): meta = { "indexes": [ { - "fields": ("datetime", "symbol", "exchange"), + "fields": ("symbol", "exchange", "datetime"), "unique": True, } ], diff --git a/vnpy/trader/database/database_sql.py b/vnpy/trader/database/database_sql.py index 37c2e609..5f08f0e8 100644 --- a/vnpy/trader/database/database_sql.py +++ b/vnpy/trader/database/database_sql.py @@ -82,7 +82,7 @@ def init_models(db: Database, driver: Driver): class Meta: database = db - indexes = ((("datetime", "interval", "symbol", "exchange"), True),) + indexes = ((("symbol", "exchange", "interval", "datetime"), True),) @staticmethod def from_bar(bar: BarData): @@ -194,7 +194,7 @@ def init_models(db: Database, driver: Driver): class Meta: database = db - indexes = ((("datetime", "symbol", "exchange"), True),) + indexes = ((("symbol", "exchange", "datetime"), True),) @staticmethod def from_tick(tick: TickData):