示例#1
0
文件: app.py 项目: kulsuri/B2C2
def request_for_quote(instrument, side, quantity):
    """Request for Quote"""

    print('\n ------------------------------------- \
            \n REQUEST FOR QUOTE \
            \n ------------------------------------- \n')

    quote_data = b2c2_lib(instrument, side, quantity).request_for_quote()
    pprint.pprint(quote_data)

    if quote_data != False:
        execute_decision = input('\n ------------------------------------- \
                                \n EXECUTE THIS QUOTE? (Y/n) \
                                \n ------------------------------------- \n')

        if execute_decision == 'Y':
            execute_order_data = b2c2_lib(quote_data).execute_order()

            if execute_order_data != False:
                print('\n ------------------------------------- \
                        \n ORDER FULFILLED \
                        \n ------------------------------------- \n')
                print('ACCOUNT BALANCE: \n')
                pprint.pprint(b2c2_lib().view_account_balance())
                print('\n ORDER DETAILS: \n')
                pprint.pprint(execute_order_data)
            else:
                print('\n ------------------------------------- \
                        \n ERROR: QUOTE EXPIRED - TIME VALID PASSED \
                        \n ------------------------------------- \n')
    else:
        print('\n ------------------------------------- \
                \n ERROR: INSTRUMENT INVALID \
                \n ------------------------------------- \n')
示例#2
0
文件: app.py 项目: kulsuri/B2C2
def view_ledger():
    """View ledger"""
    print('\n ------------------------------------- \
        \n VIEW LEDGER \
        \n ------------------------------------- \n')
    ledger = b2c2_lib().view_ledger()
    pprint.pprint(ledger)
    return ledger
示例#3
0
文件: app.py 项目: kulsuri/B2C2
def connection_status():
    """Check connection status"""
    print('\n ------------------------------------- \
        \n CONNECTION STATUS \
        \n ------------------------------------- \n')
    conn_status = b2c2_lib().check_connection_status()
    print(conn_status)
    return conn_status
示例#4
0
文件: app.py 项目: kulsuri/B2C2
def view_balance():
    """View account balance"""
    print('\n ------------------------------------- \
            \n VIEW BALANCE \
            \n ------------------------------------- \n')
    account_balance = b2c2_lib().view_account_balance()
    pprint.pprint(account_balance)
    return account_balance
示例#5
0
文件: app.py 项目: kulsuri/B2C2
def view_instruments():
    """View tradable instruments"""
    print('\n ------------------------------------- \
            \n VIEW TRADABLE INSTRUMENTS \
            \n ------------------------------------- \n')
    tradable_instruments = b2c2_lib().view_tradable_instruments()
    pprint.pprint(tradable_instruments)
    return tradable_instruments
示例#6
0
文件: app.py 项目: kulsuri/B2C2
def trade_history(order_id):
    """View specific trade information"""
    print('\n ------------------------------------- \
            \n VIEW TRADE \
            \n ------------------------------------- \n')
    trade_info = b2c2_lib(order_id).view_trade_info()
    pprint.pprint(trade_info)
    return trade_info