[Add]mongoengine into requirements.txt

This commit is contained in:
vn.py 2019-04-16 13:49:50 +08:00
parent a5550d42c7
commit 4da519bd2c
2 changed files with 8 additions and 2 deletions

View File

@ -13,3 +13,4 @@ futu-api
tigeropen tigeropen
ta-lib ta-lib
ibapi ibapi
mongoengine

View File

@ -16,10 +16,12 @@ def init(_: Driver, settings: dict):
username = settings["user"] username = settings["user"]
password = settings["password"] password = settings["password"]
authentication_source = settings["authentication_source"] authentication_source = settings["authentication_source"]
if not username: # if username == '' or None, skip username if not username: # if username == '' or None, skip username
username = None username = None
password = None password = None
authentication_source = None authentication_source = None
connect( connect(
db=database, db=database,
host=host, host=host,
@ -28,6 +30,7 @@ def init(_: Driver, settings: dict):
password=password, password=password,
authentication_source=authentication_source, authentication_source=authentication_source,
) )
return MongoManager() return MongoManager()
@ -51,7 +54,8 @@ class DbBarData(Document):
meta = { meta = {
"indexes": [ "indexes": [
{"fields": ("datetime", "interval", "symbol", "exchange"), "unique": True} {"fields": ("datetime", "interval", "symbol",
"exchange"), "unique": True}
] ]
} }
@ -141,7 +145,8 @@ class DbTickData(Document):
ask_volume_4: float = FloatField() ask_volume_4: float = FloatField()
ask_volume_5: float = FloatField() ask_volume_5: float = FloatField()
meta = {"indexes": [{"fields": ("datetime", "symbol", "exchange"), "unique": True}]} meta = {"indexes": [
{"fields": ("datetime", "symbol", "exchange"), "unique": True}]}
@staticmethod @staticmethod
def from_tick(tick: TickData): def from_tick(tick: TickData):