def setUp(self):
        self.env = env = TradingEnvironment()
        start_date = pd.Timestamp('2015-01-02', tz='UTC')
        start_ix = env.trading_days.get_loc(start_date)
        days = env.trading_days

        metadata = {
            0: {
                'symbol': 'X',
                'start_date': env.trading_days[start_ix + 2],
                'expiration_date': env.trading_days[start_ix + 5],
                'end_date': env.trading_days[start_ix + 6],
            },
            1: {
                'symbol': 'Y',
                'start_date': env.trading_days[start_ix + 4],
                'expiration_date': env.trading_days[start_ix + 7],
                'end_date': env.trading_days[start_ix + 8],
            }
        }

        env.write_data(futures_data=metadata)
        assetX, assetY = env.asset_finder.retrieve_all([0, 1])

        index_x = days[days.slice_indexer(assetX.start_date, assetX.end_date)]
        data_x = pd.DataFrame([[1, 100], [2, 100], [3, 100], [4, 100],
                               [5, 100]],
                              index=index_x, columns=['price', 'volume'])

        index_y = days[days.slice_indexer(assetY.start_date, assetY.end_date)]
        data_y = pd.DataFrame([[6, 100], [7, 100], [8, 100], [9, 100],
                               [10, 100]],
                              index=index_y, columns=['price', 'volume'])

        self.trade_data = pd.Panel({0: data_x, 1: data_y})
        self.live_asset_counts = []
        assets = env.asset_finder.retrieve_all([0, 1])
        for day in self.trade_data.major_axis:
            count = 0
            for asset in assets:
                # We shouldn't see assets on their expiration dates.
                if asset.start_date <= day <= asset.end_date:
                    count += 1
            self.live_asset_counts.append(count)
dataset/ETHPy150Open quantopian/zipline/tests/test_algorithm.py/TestRemoveData.setUp/original