def add_contract(db_info, code):
    mongo_cli = pmg.MongoClient(db_info['host'])
    admin_db = mongo_cli.get_database('admin')
    admin_db.authenticate(db_info['user'], db_info['pwd'])
    db = mongo_cli.get_database(db_info['db'])
    contract_col = db.get_collection('realtime_future_contract_info')
    product_info = db.get_collection('realtime_future_product_info')
    contract_col.create_index([('DATE', pmg.DESCENDING), ('CODE', pmg.ASCENDING)], unique=True)
    contract_col.create_index([('CODE', pmg.ASCENDING)])
    product_info.create_index([('DATE', pmg.DESCENDING), ('CLASS_CODE', pmg.ASCENDING)], unique=True)
    product_info.create_index([('CLASS_CODE', pmg.ASCENDING)])
def add_contract(db_info, code):
    mongo_cli = pmg.MongoClient(db_info['host'])
    admin_db = mongo_cli.get_database('admin')
    admin_db.authenticate(db_info['user'], db_info['pwd'])
    db = mongo_cli.get_database(db_info['db'])
    contract_col = db.get_collection('realtime_future_contract_info')
    product_info = db.get_collection('realtime_future_product_info')
    contract_col.create_index([('DATE', pmg.DESCENDING), ('CODE', pmg.ASCENDING)], unique=True)
    contract_col.create_index([('CODE', pmg.ASCENDING)])
    product_info.create_index([('DATE', pmg.DESCENDING), ('CLASS_CODE', pmg.ASCENDING)], unique=True)
    product_info.create_index([('CLASS_CODE', pmg.ASCENDING)])