Pass confdir and watchlist path to cli

questrade_candles
Tyler Goodlet 2020-05-26 13:08:16 -04:00
parent 057086efdb
commit 9b91ecd408
1 changed files with 5 additions and 3 deletions

View File

@ -13,8 +13,8 @@ from ..brokers.core import _data_mods
log = get_logger('cli') log = get_logger('cli')
DEFAULT_BROKER = 'questrade' DEFAULT_BROKER = 'questrade'
# _config_dir = click.get_app_dir('piker') _config_dir = click.get_app_dir('piker')
# _watchlists_data_path = os.path.join(_config_dir, 'watchlists.json') _watchlists_data_path = os.path.join(_config_dir, 'watchlists.json')
_context_defaults = dict( _context_defaults = dict(
default_map={ default_map={
'monitor': { 'monitor': {
@ -53,16 +53,18 @@ def cli(ctx, broker, loglevel, configdir):
assert os.path.isdir(configdir), f"`{configdir}` is not a valid path" assert os.path.isdir(configdir), f"`{configdir}` is not a valid path"
config._override_config_dir(configdir) config._override_config_dir(configdir)
# ensure that ctx.obj exists even though we aren't using it (yet)
ctx.ensure_object(dict) ctx.ensure_object(dict)
ctx.obj.update({ ctx.obj.update({
'broker': broker, 'broker': broker,
'brokermod': get_brokermod(broker), 'brokermod': get_brokermod(broker),
'loglevel': loglevel, 'loglevel': loglevel,
'log': get_console_log(loglevel), 'log': get_console_log(loglevel),
'confdir': _config_dir,
'wl_path': _watchlists_data_path,
}) })
# load downstream cli modules # load downstream cli modules
from ..brokers import cli as _ from ..brokers import cli as _
from ..watchlists import cli as _ from ..watchlists import cli as _
from ..data import marketstore as _