docstr: Held orders act almost identically to open orders, except for the
  status indication. When a fill happens, the order should switch
  status to OPEN/FILLED as necessary
docstr_tok: ["Held","orders","act","almost","identically","to","open","orders",",","except","for","the","status","indication",".","When","a","fill","happens",",","the","order","should","switch","status","to","OPEN\/FILLED","as","necessary"]
code: def test_order_hold(self):
      """
      Held orders act almost identically to open orders, except for the
      status indication. When a fill happens, the order should switch
      status to OPEN/FILLED as necessary
      """
      blotter = Blotter(self.sim_params.data_frequency)
      # Nothing happens on held of a non-existent order
      blotter.hold(56)
      self.assertEqual(blotter.new_orders, [])
  
      open_id = blotter.order(self.asset_24, 100, MarketOrder())
      open_order = blotter.open_orders[self.asset_24][0]
      self.assertEqual(open_order.id, open_id)
  
      blotter.hold(open_id)
      self.assertEqual(len(blotter.new_orders), 1)
      self.assertEqual(len(blotter.open_orders[self.asset_24]), 1)
      held_order = blotter.new_orders[0]
      self.assertEqual(held_order.status, ORDER_STATUS.HELD)
      self.assertEqual(held_order.reason, "")
  
      blotter.cancel(held_order.id)
      self.assertEqual(len(blotter.new_orders), 1)
      self.assertEqual(len(blotter.open_orders[self.asset_24]), 0)
      cancelled_order = blotter.new_orders[0]
      self.assertEqual(cancelled_order.id, held_order.id)
      self.assertEqual(cancelled_order.status, ORDER_STATUS.CANCELLED)
  
      for data in (
          [100, self.sim_params.sessions[0]],
          [400, self.sim_params.sessions[1]],
      ):
          # Verify that incoming fills will change the order status.
          trade_amt = data[0]
          dt = data[1]
  
          order_size = 100
          expected_filled = float(
              trade_amt * DEFAULT_EQUITY_VOLUME_SLIPPAGE_BAR_LIMIT
          )
          expected_open = order_size - expected_filled
          expected_status = (
              ORDER_STATUS.OPEN
              if expected_open
              else ORDER_STATUS.FILLED
          )
  
          blotter = Blotter(self.sim_params.data_frequency)
          open_id = blotter.order(
              self.asset_24, order_size, MarketOrder()
          )
          open_order = blotter.open_orders[self.asset_24][0]
          self.assertEqual(open_id, open_order.id)
          blotter.hold(open_id)
          held_order = blotter.new_orders[0]
  
          filled_order = None
          blotter.current_dt = dt
          bar_data = self.create_bardata(
              simulation_dt_func=lambda: dt,
          )
          txns, _, _ = blotter.get_transactions(bar_data)
          for txn in txns:
              filled_order = blotter.orders[txn.order_id]
  
          self.assertEqual(filled_order.id, held_order.id)
          self.assertEqual(filled_order.status, expected_status)
          self.assertEqual(filled_order.filled, expected_filled)
          self.assertEqual(filled_order.open_amount, expected_open)
  
imports: from nose_parameterized import parameterized
  import pandas
  from catalyst.assets import Equity
  from catalyst.finance.blotter import Blotter
  from catalyst.finance.cancel_policy import EODCancel, NeverCancel
  from catalyst.finance.commission import PerTrade
  from catalyst.finance.execution import LimitOrder, MarketOrder, StopLimitOrder, StopOrder
  from catalyst.finance.order import ORDER_STATUS, Order
  from catalyst.finance.slippage import DEFAULT_EQUITY_VOLUME_SLIPPAGE_BAR_LIMIT, FixedSlippage
  from catalyst.gens.sim_engine import BAR, SESSION_END
  from catalyst.testing.fixtures import WithCreateBarData, WithDataPortal, WithLogger, WithSimParams, CatalystTestCase
  from catalyst.utils.classproperty import classproperty
label_desc: Use image node_id 10 for calling the BlotterTestCase obj's underlying member method code with example usage: obj.test_order_hold() without return types