docstr: Cancel all open orders for a given asset.
docstr_tok: ["Cancel","all","open","orders","for","a","given","asset","."]
code: def cancel_all_orders_for_asset(
      self, asset, warn=False, relay_status=True
  ):
      """
      Cancel all open orders for a given asset.
      """
      # (sadly) open_orders is a defaultdict, so this will always succeed.
      orders = self.open_orders[asset]
  
      # We're making a copy here because `cancel` mutates the list of open
      # orders in place.  The right thing to do here would be to make
      # self.open_orders no longer a defaultdict.  If we do that, then we
      # should just remove the orders once here and be done with the matter.
      for order in orders[:]:
          self.cancel(order.id, relay_status)
          if warn:
              # Message appropriately depending on whether there's
              # been a partial fill or not.
              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]
  
imports: from logbook import Logger
  from collections import defaultdict
  from copy import copy
  from six import iteritems
  from catalyst.assets import Equity, Future, Asset
  from catalyst.finance.order import Order
  from catalyst.finance.slippage import DEFAULT_FUTURE_VOLUME_SLIPPAGE_BAR_LIMIT, VolatilityVolumeShare, VolumeShareSlippage
  from catalyst.finance.commission import DEFAULT_PER_CONTRACT_COST, FUTURE_EXCHANGE_FEES_BY_SYMBOL, PerContract, PerShare
  from catalyst.finance.cancel_policy import NeverCancel
  from catalyst.utils.input_validation import expect_types
  from catalyst.constants import LOG_LEVEL
label_desc: Use image node_id 7 for calling the Blotter obj's underlying member method code with example usage: obj.cancel_all_orders_for_asset(asset, warn, relay_status) without return types