Port to new data apis

bar_select
Tyler Goodlet 2020-07-15 08:28:13 -04:00
parent 6802675637
commit 1a1e768126
4 changed files with 11 additions and 4 deletions

View File

@ -112,11 +112,11 @@ async def symbol_info(
async def symbol_search(
brokermod: ModuleType,
symbol: str,
pattern: str,
**kwargs,
) -> Dict[str, Dict[str, Dict[str, Any]]]:
"""Return symbol info from broker.
"""
async with brokermod.get_client() as client:
# TODO: support multiple asset type concurrent searches.
return await client.search_stocks(symbol, **kwargs)
return await client.search_stocks(pattern=pattern, **kwargs)

View File

@ -9,6 +9,7 @@ import tractor
from ..log import get_console_log, get_logger
from ..brokers import get_brokermod, config
log = get_logger('cli')
DEFAULT_BROKER = 'questrade'

View File

@ -16,6 +16,7 @@ import msgpack
import numpy as np
import pandas as pd
import pymarketstore as pymkts
import tractor
from trio_websocket import open_websocket_url
from ..log import get_logger, get_console_log
@ -320,7 +321,8 @@ async def stream_quotes(
# update cache
_cache[symbol].update(quote)
else:
quotes = {symbol: [{key.lower(): val for key, val in quote.items()}]}
quotes = {
symbol: [{key.lower(): val for key, val in quote.items()}]}
if quotes:
yield quotes

View File

@ -117,4 +117,8 @@ def chart(config, symbol, date, tl, rate, test):
"""
from ._chart import main
main(symbol)
# global opts
loglevel = config['loglevel']
brokername = config['broker']
main(sym=symbol, brokername=brokername, loglevel=loglevel)