示例#1
0
def get_book_from_db(book_name, status):
    cnx = dbaccess.connect(**dbaccess.trade_dbconfig)
    df = dbaccess.load_deal_data(cnx, dbtable = 'deals', book = book_name, deal_status = status)
    deal_list = df.to_dict(orient = 'record')
    book_data = {'book': book_name,  'owner': 'harvey', 'reporting_ccy': 'USD', \
                 'status': CMQBookStatus.Prod, 'deal_list': deal_list }
    book_obj = CMQBook(book_data)
    return book_obj
示例#2
0
def get_book_from_db(book='',
                     strategy='',
                     status=[2, 0],
                     dbtable='trade_data'):
    cnx = dbaccess.connect(**dbaccess.trade_dbconfig)
    df = dbaccess.load_deal_data(cnx,
                                 dbtable,
                                 book=book,
                                 strategy=strategy,
                                 deal_status=status)
    deal_list = df.to_dict(orient='record')
    book_data = {'book': '_'.join([book, strategy]),  'owner': 'harvey', 'reporting_ccy': 'USD', \
                 'status': CMQBookStatus.Prod, 'deal_list': deal_list }
    book_obj = CMQBook(book_data)
    return book_obj