Example #1
0
def insert_QuoteRequest(j_transaction, session):
    insert_transaction_message(j_transaction, session)
    quote_request_msg = messages.parse_from_json(json.dumps(j_transaction))
    quote_request = tables.QuoteRequest(quote_request_msg)
    session.add(quote_request)
    session.commit()
    quote_req_id = quote_request.quote_req_id
    update_transaction_with_blotter_like_info(session, quote_req_id)
Example #2
0
def get_transaction(msg_type, msg_id):
    result = databus.get(f'Transactions/Messages/{msg_type}/{msg_id}')
    if result:
        j = json.loads(result)
        msg = messages.parse_from_json(j.get('msg'))
        return msg, j.get('details')

    return None, None
Example #3
0
def insert_ExecReport(j_transaction, session):
    update_transaction(j_transaction, session)
    exec_report_msg = messages.parse_from_json(json.dumps(j_transaction))
    exec_report = tables.ExecReport(exec_report_msg)
    session.add(exec_report)
    session.commit()
    quote_req_id = exec_report.quote_req_id
    update_transaction_with_blotter_like_info(session, quote_req_id)
Example #4
0
def insert_NewOrder(j_transaction, session):
    update_transaction(j_transaction, session)
    new_order_msg = messages.parse_from_json(json.dumps(j_transaction))
    new_order = tables.NewOrder(new_order_msg)
    session.add(new_order)
    session.commit()
    quote_req_id = new_order.quote_req_id
    update_transaction_with_blotter_like_info(session, quote_req_id)
Example #5
0
def insert_QuoteCancel(j_transaction, session):
    update_transaction(j_transaction, session)
    quote_cancel_msg = messages.parse_from_json(json.dumps(j_transaction))
    quote_cancel = tables.QuoteCancel(quote_cancel_msg)
    session.add(quote_cancel)
    session.commit()
    quote_req_id = quote_cancel.quote_req_id
    update_transaction_with_blotter_like_info(session, quote_req_id)
Example #6
0
def insert_ExecAck(j_transaction, session):
    update_transaction(j_transaction, session)
    exec_ack_msg = messages.parse_from_json(json.dumps(j_transaction))
    exec_ack = tables.ExecAck(exec_ack_msg)
    session.add(exec_ack)
    session.commit()

    revenue_brl = 0.0
    quote_req_id = exec_ack.quote_req_id
    quote_id = exec_ack.quote_id
    quote = session.query(tables.Quote).filter_by(quote_id=quote_id).first()
    if quote:
        revenue_brl = quote.revenue_brl
    update_transaction_column(session, quote_req_id, "revenue_brl",
                              revenue_brl)
    update_transaction_with_blotter_like_info(session, quote_req_id)
Example #7
0
def insert_Quote(j_transaction, session):
    update_transaction(j_transaction, session)
    quote_msg = messages.parse_from_json(json.dumps(j_transaction))
    quote = tables.Quote(quote_msg)
    session.add(quote)
    session.commit()