Make <brokermod>.quoter() a simple factory func
parent
a6dc697327
commit
02a71c51ba
|
@ -284,7 +284,6 @@ async def get_client() -> Client:
|
||||||
write_conf(client)
|
write_conf(client)
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
|
||||||
async def quoter(client: Client, tickers: [str]):
|
async def quoter(client: Client, tickers: [str]):
|
||||||
"""Quoter context.
|
"""Quoter context.
|
||||||
"""
|
"""
|
||||||
|
@ -328,7 +327,7 @@ async def quoter(client: Client, tickers: [str]):
|
||||||
quotes[quote['symbol']] = quote
|
quotes[quote['symbol']] = quote
|
||||||
|
|
||||||
if quote.get('delay', 0) > 0:
|
if quote.get('delay', 0) > 0:
|
||||||
log.warning(f"Delayed quote:\n{quote}")
|
log.warn(f"Delayed quote:\n{quote}")
|
||||||
|
|
||||||
return quotes
|
return quotes
|
||||||
|
|
||||||
|
@ -338,7 +337,7 @@ async def quoter(client: Client, tickers: [str]):
|
||||||
# re-save symbol ids cache
|
# re-save symbol ids cache
|
||||||
ids = ','.join(map(str, t2ids.values()))
|
ids = ','.join(map(str, t2ids.values()))
|
||||||
|
|
||||||
yield get_quote
|
return get_quote
|
||||||
|
|
||||||
|
|
||||||
# Questrade key conversion / column order
|
# Questrade key conversion / column order
|
||||||
|
|
|
@ -72,11 +72,10 @@ async def get_client() -> Client:
|
||||||
yield Client()
|
yield Client()
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
|
||||||
async def quoter(client: Client, tickers: [str]):
|
async def quoter(client: Client, tickers: [str]):
|
||||||
"""Quoter context.
|
"""Quoter context.
|
||||||
"""
|
"""
|
||||||
yield client.quote
|
return client.quote
|
||||||
|
|
||||||
|
|
||||||
# Robinhood key conversion / column order
|
# Robinhood key conversion / column order
|
||||||
|
|
Loading…
Reference in New Issue