Make search work with ib backend

bar_select
Tyler Goodlet 2020-07-02 16:02:58 -04:00
parent 99c18abfea
commit 7a660b335d
1 changed files with 21 additions and 0 deletions

View File

@ -248,3 +248,24 @@ def symbol_info(config, tickers):
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 = tractor.run(
partial(core.symbol_search, brokermod, pattern),
start_method='forkserver',
loglevel='info',
)
if not quotes:
log.error(f"No matches could be found for {pattern}?")
return
click.echo(colorize_json(quotes))