code: def __init__(
      self,
      benchmark_asset,
      trading_calendar,
      sessions,
      data_portal,
      emission_rate="daily",
      benchmark_returns=None,
  ):
      self.benchmark_asset = benchmark_asset
      self.sessions = sessions
      self.emission_rate = emission_rate
      self.data_portal = data_portal
  
      if len(sessions) == 0:
          self._precalculated_series = pd.Series()
      elif benchmark_asset is not None:
          self._validate_benchmark(benchmark_asset)
  
          self._precalculated_series = (
              self._initialize_precalculated_series(
                  benchmark_asset,
                  trading_calendar,
                  self.sessions,
                  self.data_portal,
              )
          )
      elif benchmark_returns is not None:
          daily_series = benchmark_returns[sessions[0] : sessions[-1]]
  
          if self.emission_rate == "minute":
              # we need to take the env's benchmark returns, which are daily,
              # and resample them to minute
              minutes = trading_calendar.minutes_for_sessions_in_range(
                  sessions[0], sessions[-1]
              )
  
              minute_series = daily_series.reindex(
                  index=minutes, method="ffill"
              )
  
              self._precalculated_series = minute_series
          else:
              self._precalculated_series = daily_series
      else:
          raise Exception(
              "Must provide either benchmark_asset or "
              "benchmark_returns."
          )
  
file_path: catalyst/catalyst/sources/benchmark_source.py
imports: import pandas
  from catalyst.errors import InvalidBenchmarkAsset, BenchmarkAssetNotAvailableTooEarly, BenchmarkAssetNotAvailableTooLate
label_desc: Use image node_id 1 to create a new BenchmarkSource object from inherited base classes: object with example: obj = BenchmarkSource(benchmark_asset, trading_calendar, sessions, data_portal, emission_rate, benchmark_returns)