commit
735fcb94c2
|
@ -206,11 +206,12 @@ def load(ctx, data):
|
||||||
|
|
||||||
@watchlists.command(help='add ticker to watchlist')
|
@watchlists.command(help='add ticker to watchlist')
|
||||||
@click.argument('name', nargs=1, required=True)
|
@click.argument('name', nargs=1, required=True)
|
||||||
@click.argument('ticker_name', nargs=1, required=True)
|
@click.argument('ticker_names', nargs=-1, required=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def add(ctx, name, ticker_name):
|
def add(ctx, name, ticker_names):
|
||||||
watchlist = wl.add_ticker(name, ticker_name,
|
for ticker in ticker_names:
|
||||||
ctx.obj['watchlist'])
|
watchlist = wl.add_ticker(
|
||||||
|
name, ticker, ctx.obj['watchlist'])
|
||||||
wl.write_to_file(watchlist, ctx.obj['path'])
|
wl.write_to_file(watchlist, ctx.obj['path'])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -150,9 +150,15 @@ def test_dump_watchlists(capfd, piker_dir, ex_watchlists):
|
||||||
assert out.strip() == expected_out
|
assert out.strip() == expected_out
|
||||||
|
|
||||||
|
|
||||||
def test_ticker_added_to_watchlists(capfd, piker_dir, ex_watchlists):
|
@pytest.mark.parametrize(
|
||||||
ex_watchlists['pharma'].append('CRACK')
|
'tickers', [('CRACK',), ('CRACK', 'SUIT',)]
|
||||||
run(f"piker watchlists -d {piker_dir} add pharma CRACK")
|
)
|
||||||
|
def test_ticker_added_to_watchlists(capfd, piker_dir, ex_watchlists, tickers):
|
||||||
|
"""Verify that single or multi-ticker lists can be added.
|
||||||
|
"""
|
||||||
|
for ticker in tickers:
|
||||||
|
ex_watchlists['pharma'].append(ticker)
|
||||||
|
run(f"piker watchlists -d {piker_dir} add pharma {' '.join(tickers)}")
|
||||||
out = wl.ensure_watchlists(piker_dir)
|
out = wl.ensure_watchlists(piker_dir)
|
||||||
assert out == ex_watchlists
|
assert out == ex_watchlists
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue