code: def test_orders_stop_limit(self):
      slippage_model = VolumeShareSlippage()
      slippage_model.data_portal = self.data_portal
  
      # long, does not trade
      open_orders = [
          Order(
              **{
                  "dt": datetime.datetime(
                      2006, 1, 5, 14, 30, tzinfo=pytz.utc
                  ),
                  "amount": 100,
                  "filled": 0,
                  "asset": self.ASSET133,
                  "stop": 4.0,
                  "limit": 3.0,
              }
          )
      ]
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[2],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[3],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      # long, does not trade - impacted price worse than limit price
      open_orders = [
          Order(
              **{
                  "dt": datetime.datetime(
                      2006, 1, 5, 14, 30, tzinfo=pytz.utc
                  ),
                  "amount": 100,
                  "filled": 0,
                  "asset": self.ASSET133,
                  "stop": 4.0,
                  "limit": 3.5,
              }
          )
      ]
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[2],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[3],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      # long, does trade
      open_orders = [
          Order(
              **{
                  "dt": datetime.datetime(
                      2006, 1, 5, 14, 30, tzinfo=pytz.utc
                  ),
                  "amount": 100,
                  "filled": 0,
                  "asset": self.ASSET133,
                  "stop": 4.0,
                  "limit": 3.6,
              }
          )
      ]
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[2],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[3],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 1)
      _, txn = orders_txns[0]
  
      expected_txn = {
          "price": float(3.50021875),
          "dt": datetime.datetime(2006, 1, 5, 14, 34, tzinfo=pytz.utc),
          "amount": int(50),
          "asset": self.ASSET133,
      }
  
      for key, value in expected_txn.items():
          self.assertEquals(value, txn[key])
  
      # short, does not trade
  
      open_orders = [
          Order(
              **{
                  "dt": datetime.datetime(
                      2006, 1, 5, 14, 30, tzinfo=pytz.utc
                  ),
                  "amount": -100,
                  "filled": 0,
                  "asset": self.ASSET133,
                  "stop": 3.0,
                  "limit": 4.0,
              }
          )
      ]
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[0],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[1],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      # short, does not trade - impacted price worse than limit price
      open_orders = [
          Order(
              **{
                  "dt": datetime.datetime(
                      2006, 1, 5, 14, 30, tzinfo=pytz.utc
                  ),
                  "amount": -100,
                  "filled": 0,
                  "asset": self.ASSET133,
                  "stop": 3.0,
                  "limit": 3.5,
              }
          )
      ]
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[0],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[1],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      # short, does trade
      open_orders = [
          Order(
              **{
                  "dt": datetime.datetime(
                      2006, 1, 5, 14, 30, tzinfo=pytz.utc
                  ),
                  "amount": -100,
                  "filled": 0,
                  "asset": self.ASSET133,
                  "stop": 3.0,
                  "limit": 3.4,
              }
          )
      ]
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[0],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 0)
  
      bar_data = self.create_bardata(
          simulation_dt_func=lambda: self.minutes[1],
      )
  
      orders_txns = list(
          slippage_model.simulate(
              bar_data,
              self.ASSET133,
              open_orders,
          )
      )
  
      self.assertEquals(len(orders_txns), 1)
      _, txn = orders_txns[0]
  
      expected_txn = {
          "price": float(3.49978125),
          "dt": datetime.datetime(2006, 1, 5, 14, 32, tzinfo=pytz.utc),
          "amount": int(-50),
          "asset": self.ASSET133,
      }
  
      for key, value in expected_txn.items():
          self.assertEquals(value, txn[key])
  
imports: from collections import namedtuple
  import datetime
  from math import sqrt
  from nose_parameterized import parameterized
  from pandas.tslib import normalize_date
  import numpy
  import pandas
  import pytz
  from catalyst.assets import Equity, Future
  from catalyst.data.data_portal import DataPortal
  from catalyst.finance.asset_restrictions import NoRestrictions
  from catalyst.finance.order import Order
  from catalyst.finance.slippage import EquitySlippageModel, fill_price_worse_than_limit_price, FutureSlippageModel, SlippageModel, VolatilityVolumeShare, VolumeShareSlippage
  from catalyst.protocol import DATASOURCE_TYPE, BarData
  from catalyst.testing import create_minute_bar_data, tmp_bcolz_equity_minute_bar_reader
  from catalyst.testing.fixtures import WithCreateBarData, WithDataPortal, WithSimParams, WithTradingEnvironment, CatalystTestCase
  from catalyst.utils.classproperty import classproperty
label_desc: Use image node_id 7 for calling the SlippageTestCase obj's underlying member method code with example usage: obj.test_orders_stop_limit() without return types