Move UI spawning cmds to new module
parent
eddd8aacab
commit
b670af484c
|
@ -131,7 +131,6 @@ def bars(config, symbol, count, df_output):
|
|||
click.echo(colorize_json(bars))
|
||||
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('--rate', '-r', default=5, help='Logging level')
|
||||
@click.option('--filename', '-f', default='quotestream.jsonstream',
|
||||
|
@ -226,43 +225,3 @@ def optsquote(config, symbol, df_output, date):
|
|||
click.echo(df)
|
||||
else:
|
||||
click.echo(colorize_json(quotes))
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument('tickers', nargs=-1, required=True)
|
||||
@click.pass_obj
|
||||
def symbol_info(config, tickers):
|
||||
"""Print symbol quotes to the console
|
||||
"""
|
||||
# global opts
|
||||
brokermod = config['brokermod']
|
||||
|
||||
quotes = trio.run(partial(core.symbol_info, brokermod, tickers))
|
||||
if not quotes:
|
||||
log.error(f"No quotes could be found for {tickers}?")
|
||||
return
|
||||
|
||||
if len(quotes) < len(tickers):
|
||||
syms = tuple(map(itemgetter('symbol'), quotes))
|
||||
for ticker in tickers:
|
||||
if ticker not in syms:
|
||||
brokermod.log.warn(f"Could not find symbol {ticker}?")
|
||||
|
||||
click.echo(colorize_json(quotes))
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument('pattern', required=True)
|
||||
@click.pass_obj
|
||||
def search(config, pattern):
|
||||
"""Search for symbols from broker backend(s).
|
||||
"""
|
||||
# global opts
|
||||
brokermod = config['brokermod']
|
||||
|
||||
quotes = trio.run(partial(core.symbol_search, brokermod, pattern))
|
||||
if not quotes:
|
||||
log.error(f"No matches could be found for {pattern}?")
|
||||
return
|
||||
|
||||
click.echo(colorize_json(quotes))
|
||||
|
|
Loading…
Reference in New Issue