Adjust cli to new api

kivy_mainline_and_py3.8
Tyler Goodlet 2018-02-08 19:15:21 -05:00
parent 224451f44a
commit 17c4ac3b8c
1 changed files with 3 additions and 4 deletions

View File

@ -75,19 +75,18 @@ def quote(loglevel, broker, tickers, df_output):
"""client for testing broker API methods with pretty printing of output. """client for testing broker API methods with pretty printing of output.
""" """
brokermod = import_module('.' + broker, 'piker.brokers') brokermod = import_module('.' + broker, 'piker.brokers')
data = run(partial(brokermod.quote, tickers), loglevel=loglevel) quotes = run(partial(brokermod.quote, tickers), loglevel=loglevel)
quotes = data['quotes']
cols = quotes[0].copy() cols = quotes[0].copy()
cols.pop('symbol') cols.pop('symbol')
if df_output: if df_output:
df = pd.DataFrame( df = pd.DataFrame(
data['quotes'], quotes,
index=[item['symbol'] for item in quotes], index=[item['symbol'] for item in quotes],
columns=cols, columns=cols,
) )
click.echo(df) click.echo(df)
else: else:
click.echo(colorize_json(data)) click.echo(colorize_json(quotes))
@cli.command() @cli.command()