Repository: quantopian/zipline
File: zipline/utils/run_algo.py (Python)

Code before:
            ),
            metrics_set=metrics_set,
            blotter=blotter,
            benchmark_returns=benchmark_returns,
            benchmark_sid=benchmark_sid,
            **{
                'initialize': initialize,
                'handle_data': handle_data,
                'before_trading_start': before_trading_start,
                'analyze': analyze,
            } if algotext is None else {
                'algo_filename': getattr(algofile, 'name', '<algorithm>'),
                'script': algotext,
            }
        ).run()
    except NoBenchmark:
        raise _RunAlgoError(
            (
                'no ``benchmark_spec`` was provided and'
                ' ``zipline.api.set_benchmark`` was not called in'
                ' ``initialize``'
            ),
            (
                "neither '--benchmark-symbol' nor '--benchmark-sid' was"
                " provided and ``zipline.api.set_benchmark`` was not called"
                " in ``initialize``, did you mean to pass '--no-benchmark'"
            ),
        )

    if output == '-':
        click.echo(str(perf))
    elif output != os.devnull:  # make the zipline magic not write any data
        perf.to_pickle(output)

    return perf


# All of the loaded extensions. We don't want to load an extension twice.
_loaded_extensions = set()


def load_extensions(default, extensions, strict, environ, reload=False):
    """Load all of the given extensions. This should be called by run_algo
    or the cli.

    Parameters
    ----------
    default : bool
        Load the default exension (~/.zipline/extension.py)?
    extension : iterable[str]
        The paths to the extensions to load. If the path ends in ``.py`` it is

Review comment (suggestion):
```suggestion
                "Neither '--benchmark-symbol' nor '--benchmark-sid' was"
                " provided, and ``zipline.api.set_benchmark`` was not called"
                " in ``initialize``. Did you mean to pass '--no-benchmark'?"
```

Code after:
            ),
            metrics_set=metrics_set,
            blotter=blotter,
            benchmark_returns=benchmark_returns,
            benchmark_sid=benchmark_sid,
            **{
                'initialize': initialize,
                'handle_data': handle_data,
                'before_trading_start': before_trading_start,
                'analyze': analyze,
            } if algotext is None else {
                'algo_filename': getattr(algofile, 'name', '<algorithm>'),
                'script': algotext,
            }
        ).run()
    except NoBenchmark:
        raise _RunAlgoError(
            (
                'No ``benchmark_spec`` was provided, and'
                ' ``zipline.api.set_benchmark`` was not called in'
                ' ``initialize``.'
            ),
            (
                "Neither '--benchmark-symbol' nor '--benchmark-sid' was"
                " provided, and ``zipline.api.set_benchmark`` was not called"
                " in ``initialize``. Did you mean to pass '--no-benchmark'?"
            ),
        )

    if output == '-':
        click.echo(str(perf))
    elif output != os.devnull:  # make the zipline magic not write any data
        perf.to_pickle(output)

    return perf


# All of the loaded extensions. We don't want to load an extension twice.
_loaded_extensions = set()


def load_extensions(default, extensions, strict, environ, reload=False):
    """Load all of the given extensions. This should be called by run_algo
    or the cli.

    Parameters
    ----------
    default : bool
        Load the default exension (~/.zipline/extension.py)?
    extension : iterable[str]
        The paths to the extensions to load. If the path ends in ``.py`` it is