class_docstr: Helper for different ways we can get benchmark data for the Zipline CLI and
  zipline.utils.run_algo.run_algorithm.
  
  Parameters
  ----------
  benchmark_returns : pd.Series, optional
      Series of returns to use as the benchmark.
  benchmark_file : str or file
      File containing a csv with `date` and `return` columns, to be read as
      the benchmark.
  benchmark_sid : int, optional
      Sid of the asset to use as a benchmark.
  benchmark_symbol : str, optional
      Symbol of the asset to use as a benchmark. Symbol will be looked up as
      of the end date of the backtest.
  no_benchmark : bool
      Flag indicating that no benchmark is configured. Benchmark-dependent
      metrics will be calculated using a dummy benchmark of all-zero returns.
class_docstr_tok: ["Helper","for","different","ways","we","can","get","benchmark","data","for","the","Zipline","CLI","and","zipline.utils.run_algo.run_algorithm",".","Parameters","--","--","--","--","--","benchmark_returns",":","pd.Series",",","optional","Series","of","returns","to","use","as","the","benchmark",".","benchmark_file",":","str","or","file","File","containing","a","csv","with","`","date","`","and","`","return","`","columns",",","to","be","read","as","the","benchmark",".","benchmark_sid",":","int",",","optional","Sid","of","the","asset","to","use","as","a","benchmark",".","benchmark_symbol",":","str",",","optional","Symbol","of","the","asset","to","use","as","a","benchmark",".","Symbol","will","be","looked","up","as","of","the","end","date","of","the","backtest",".","no_benchmark",":","bool","Flag","indicating","that","no","benchmark","is","configured",".","Benchmark-dependent","metrics","will","be","calculated","using","a","dummy","benchmark","of","all-zero","returns","."]
docstr: Resolve inputs into values to be passed to TradingAlgorithm.
  
  Returns a pair of ``(benchmark_sid, benchmark_returns)`` with at most
  one non-None value. Both values may be None if no benchmark source has
  been configured.
  
  Parameters
  ----------
  asset_finder : zipline.assets.AssetFinder
      Asset finder for the algorithm to be run.
  start_date : pd.Timestamp
      Start date of the algorithm to be run.
  end_date : pd.Timestamp
      End date of the algorithm to be run.
  
  Returns
  -------
  benchmark_sid : int
      Sid to use as benchmark.
  benchmark_returns : pd.Series
      Series of returns to use as benchmark.
docstr_tok: ["Resolve","inputs","into","values","to","be","passed","to","TradingAlgorithm",".","Returns","a","pair","of","``","(","benchmark_sid",",","benchmark_returns",")","``","with","at","most","one","non-None","value",".","Both","values","may","be","None","if","no","benchmark","source","has","been","configured",".","Parameters","--","--","--","--","--","asset_finder",":","zipline.assets.AssetFinder","Asset","finder","for","the","algorithm","to","be","run",".","start_date",":","pd.Timestamp","Start","date","of","the","algorithm","to","be","run",".","end_date",":","pd.Timestamp","End","date","of","the","algorithm","to","be","run",".","Returns","--","--","--","-","benchmark_sid",":","int","Sid","to","use","as","benchmark",".","benchmark_returns",":","pd.Series","Series","of","returns","to","use","as","benchmark","."]
code: def resolve(self, asset_finder, start_date, end_date):
      """
      Resolve inputs into values to be passed to TradingAlgorithm.
  
      Returns a pair of ``(benchmark_sid, benchmark_returns)`` with at most
      one non-None value. Both values may be None if no benchmark source has
      been configured.
  
      Parameters
      ----------
      asset_finder : zipline.assets.AssetFinder
          Asset finder for the algorithm to be run.
      start_date : pd.Timestamp
          Start date of the algorithm to be run.
      end_date : pd.Timestamp
          End date of the algorithm to be run.
  
      Returns
      -------
      benchmark_sid : int
          Sid to use as benchmark.
      benchmark_returns : pd.Series
          Series of returns to use as benchmark.
      """
      if self.benchmark_returns is not None:
          benchmark_sid = None
          benchmark_returns = self.benchmark_returns
      elif self.benchmark_file is not None:
          benchmark_sid = None
          benchmark_returns = get_benchmark_returns_from_file(
              self.benchmark_file,
          )
      elif self.benchmark_sid is not None:
          benchmark_sid = self.benchmark_sid
          benchmark_returns = None
      elif self.benchmark_symbol is not None:
          try:
              asset = asset_finder.lookup_symbol(
                  self.benchmark_symbol,
                  as_of_date=end_date,
              )
              benchmark_sid = asset.sid
              benchmark_returns = None
          except SymbolNotFound:
              raise _RunAlgoError(
                  "Symbol %r as a benchmark not found in this bundle."
                  % self.benchmark_symbol
              )
      elif self.no_benchmark:
          benchmark_sid = None
          benchmark_returns = self._zero_benchmark_returns(
              start_date=start_date,
              end_date=end_date,
          )
      else:
          log.warn(
              "No benchmark configured. "
              "Assuming algorithm calls set_benchmark."
          )
          log.warn(
              "Pass --benchmark-sid, --benchmark-symbol, or"
              " --benchmark-file to set a source of benchmark returns."
          )
          log.warn(
              "Pass --no-benchmark to use a dummy benchmark "
              "of zero returns.",
          )
          benchmark_sid = None
          benchmark_returns = None
  
      return benchmark_sid, benchmark_returns
  
imports: import click
  import os
  import sys
  import warnings
  import logbook
  import pandas
  import six
  from toolz import concatv
  from trading_calendars import get_calendar
  from zipline.data import bundles
  from zipline.data.benchmarks import get_benchmark_returns_from_file
  from zipline.data.data_portal import DataPortal
  from zipline.finance import metrics
  from zipline.finance.trading import SimulationParameters
  from zipline.pipeline.data import USEquityPricing
  from zipline.pipeline.loaders import USEquityPricingLoader
  import zipline.utils.paths
  from zipline.extensions import load
  from zipline.errors import SymbolNotFound
  from zipline.algorithm import TradingAlgorithm, NoBenchmark
  from zipline.finance.blotter import Blotter
label_desc: Use image node_id 4 for calling the BenchmarkSpec obj's underlying member method code with example usage: obj.resolve(asset_finder, start_date, end_date) and returns: benchmark_sid,  benchmark_returns