'Cancel all open orders for a given asset.'

def cancel_all_orders_for_asset(self, asset, warn=False, relay_status=True):

    orders = self.open_orders[asset]
    for order in orders[:]:
        self.cancel(order.id, relay_status)
        if warn:
            if (order.filled > 0):
                warning_logger.warn('Your    order    for    {order_amt}    shares    of    {order_sym}    has    been    partially    filled.    {order_filled}    shares    were    successfully    purchased.    {order_failed}    shares    were    not    filled    by    the    end    of    day    and    were    canceled.'.format(order_amt=order.amount, order_sym=order.asset.symbol, order_filled=order.filled, order_failed=(order.amount - order.filled)))
            elif (order.filled < 0):
                warning_logger.warn('Your    order    for    {order_amt}    shares    of    {order_sym}    has    been    partially    filled.    {order_filled}    shares    were    successfully    sold.    {order_failed}    shares    were    not    filled    by    the    end    of    day    and    were    canceled.'.format(order_amt=order.amount, order_sym=order.asset.symbol, order_filled=((-1) * order.filled), order_failed=((-1) * (order.amount - order.filled))))
            else:
                warning_logger.warn('Your    order    for    {order_amt}    shares    of    {order_sym}    failed    to    fill    by    the    end    of    day    and    was    canceled.'.format(order_amt=order.amount, order_sym=order.asset.symbol))
    assert (not orders)
    del self.open_orders[asset]
