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 zipline.assets import Equity, Future, Asset
  from .blotter import Blotter
  from zipline.extensions import register
  from zipline.finance.order import Order
  from zipline.finance.slippage import DEFAULT_FUTURE_VOLUME_SLIPPAGE_BAR_LIMIT, VolatilityVolumeShare, FixedBasisPointsSlippage
  from zipline.finance.commission import DEFAULT_PER_CONTRACT_COST, FUTURE_EXCHANGE_FEES_BY_SYMBOL, PerContract, PerShare
  from zipline.utils.input_validation import expect_types
label_desc: Use image node_id 5 for calling the SimulationBlotter obj's underlying member method code with example usage: obj.cancel_all_orders_for_asset(asset, warn, relay_status) without return types