Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created broker list option #63

Merged
merged 6 commits into from
Oct 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion zipline/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import pandas as pd
from six import text_type

import pkgutil

from zipline.data import bundles as bundles_module
from zipline.utils.cli import Date, Timestamp
from zipline.utils.run_algo import _run, load_extensions
from zipline.gens import brokers

try:
__IPYTHON__
Expand Down Expand Up @@ -210,6 +213,11 @@ def _(*args, **kwargs):
metavar='DIRNAME',
help='Directory where the realtime collected minutely bars are saved'
)
@click.option(
'--list-brokers',
is_flag=True,
help='Get list of available brokers'
)
@click.pass_context
def run(ctx,
algofile,
Expand All @@ -227,9 +235,18 @@ def run(ctx,
broker,
broker_uri,
state_file,
realtime_bar_target):
realtime_bar_target,
list_brokers):
"""Run a backtest for the given algorithm.
"""

if list_brokers:
click.echo("Supported brokers:")
for _, name, _ in pkgutil.iter_modules(brokers.__path__):
if name != 'broker':
click.echo(name)
return

# check that the start and end dates are passed correctly
if not broker and start is None and end is None:
# check both at the same time to avoid the case where a user
Expand Down