예제 #1
0
    def sell_market(symbol, quantity):

        order = client.sell_market(symbol, quantity)

        if 'msg' in order:
            Messages.get(order['msg'])

        return order
예제 #2
0
    def sell_limit(symbol, quantity, sell_price):

        order = client.sell_limit(symbol, quantity, sell_price)

        if 'msg' in order:
            Messages.get(order['msg'])

        return order
예제 #3
0
    def buy_limit(symbol, quantity, buyPrice):

        order = client.buy_limit(symbol, quantity, buyPrice)

        if 'msg' in order:
            Messages.get(order['msg'])

        # Buy order created.
        return order['orderId']
예제 #4
0
    def get_order_status(symbol, orderId):
        try:

            order = client.query_order(symbol, orderId)

            if 'msg' in order:
                Messages.get(order['msg'])

            return order['status']

        except Exception as e:
            print('get_order_status Exception: %s' % e)
            return None
예제 #5
0
    def get_order(symbol, orderId):
        try:

            order = client.query_order(symbol, orderId)

            if 'msg' in order:
                #import ipdb; ipdb.set_trace()
                Messages.get(order['msg'])  # TODO
                return False

            return order

        except Exception as e:
            print('get_order Exception: %s' % e)
            return False
예제 #6
0
    def cancel_order(symbol, orderId):

        try:

            order = client.cancel(symbol, orderId)
            if 'msg' in order:
                Messages.get(order['msg'])

            print('Profit loss, called order, %s' % (orderId))

            return True

        except Exception as e:
            print('cancel_order Exception: %s' % e)
            return False