Adjust cli to new api
parent
224451f44a
commit
17c4ac3b8c
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue