def init_database(db_conn): from mantis.sg.fisher.model import model conn = db_conn db = conn[config.STRATEGY_DB_NAME] model.set_database(db) return db
def init_mongodb(host='127.0.0.1', port=27017, date=None): """ date : str 默认为当日 """ from pymongo import MongoClient dbname = config.STRATEGY_DB_NAME mg_conn = MongoClient(host, port) model.set_database(mg_conn[dbname]) return mg_conn
def init_mongodb(host='127.0.0.1', port=27017, date=None): """ date : str 默认为当日 """ from pymongo import MongoClient from mantis.sg.fisher.stutils import get_trade_database_name # dbname = get_trade_database_name(dbname = 'TradeFisherCtp',date = date) dbname = database_name mg_conn = MongoClient(host, port) model.set_database(mg_conn[dbname]) return mg_conn
def open(self, dbname='TradeFisher', host='127.0.0.1', port=27017): from pymongo import MongoClient from mantis.sg.fisher import model self.conn = MongoClient(host, port) model.set_database(self.conn[dbname]) # 策略名称为数据库名 return self
def init_mongodb(dbname='TradeFisher', host='127.0.0.1', port=27017): from pymongo import MongoClient mg_conn = MongoClient(host, port) model.set_database(mg_conn[dbname]) return mg_conn
def init_database(self): conn = instance.datasourceManager.get('mongodb').conn db = conn['CTP_BlackLocust'] set_database(db) return db