Warn about missing symbols at CLI level
parent
61294c6c44
commit
2915e83324
|
@ -46,12 +46,7 @@ async def stocks_quote(
|
|||
"""Return quotes dict for ``tickers``.
|
||||
"""
|
||||
async with brokermod.get_client() as client:
|
||||
results = await client.quote(tickers)
|
||||
for val in results:
|
||||
if val is None:
|
||||
brokermod.log.warn(f"Could not find symbol {key}?")
|
||||
|
||||
return results
|
||||
return await client.quote(tickers)
|
||||
|
||||
|
||||
# TODO: these need tests
|
||||
|
|
|
@ -5,6 +5,7 @@ from functools import partial
|
|||
import json
|
||||
import os
|
||||
from operator import attrgetter
|
||||
from operator import itemgetter
|
||||
|
||||
import click
|
||||
import pandas as pd
|
||||
|
@ -101,6 +102,12 @@ def quote(loglevel, broker, tickers, df_output):
|
|||
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}?")
|
||||
|
||||
if df_output:
|
||||
cols = next(filter(bool, quotes.values())).copy()
|
||||
cols.pop('symbol')
|
||||
|
|
Loading…
Reference in New Issue