Fix and pass through piker loglevel correctly

basic_orders
Tyler Goodlet 2021-02-21 11:50:33 -05:00
parent aa4a2ef64f
commit 6fb1945360
3 changed files with 14 additions and 15 deletions

View File

@ -936,14 +936,13 @@ async def test_bed(
async def _async_main(
sym: str,
brokername: str,
# implicit required argument provided by ``qtractor_run()``
widgets: Dict[str, Any],
# all kwargs are passed through from the CLI entrypoint
loglevel: str = None,
sym: str,
brokername: str,
loglevel: str,
) -> None:
"""Main Qt-trio routine invoked by the Qt loop with
the widgets ``dict``.
@ -1093,7 +1092,7 @@ async def _async_main(
async for msg in trades_stream:
fmsg = pformat(msg)
log.info(f'Received order msg: {fmsg}')
log.info(f'Received order msg:\n{fmsg}')
# delete the line from view
oid = msg['oid']
@ -1121,7 +1120,7 @@ async def _async_main(
elif resp in (
'dark_executed'
):
log.info(f'Dark order filled for {fmsg}')
log.info(f'Dark order triggered for {fmsg}')
# for alerts add a triangle and remove the
# level line
@ -1300,7 +1299,7 @@ async def chart_from_quotes(
if (mx > last_mx) or (
mn < last_mn
):
print(f'new y range: {(mn, mx)}')
# print(f'new y range: {(mn, mx)}')
chart._set_yrange(
yrange=(mn, mx),
@ -1581,6 +1580,7 @@ async def check_for_new_bars(feed, ohlcv, linked_charts):
def _main(
sym: str,
brokername: str,
piker_loglevel: str,
tractor_kwargs,
) -> None:
"""Sync entry point to start a chart app.
@ -1589,7 +1589,7 @@ def _main(
# Qt entry point
run_qtractor(
func=_async_main,
args=(sym, brokername),
args=(sym, brokername, piker_loglevel),
main_widget=ChartSpace,
tractor_kwargs=tractor_kwargs,
)

View File

@ -197,7 +197,7 @@ def run_qtractor(
name='qtractor',
**tractor_kwargs,
):
await func(*(args + (widgets,)))
await func(*((widgets,) + args))
# guest mode entry
trio.lowlevel.start_guest_run(

View File

@ -126,27 +126,26 @@ def optschain(config, symbol, date, tl, rate, test):
is_flag=True,
help='Enable pyqtgraph profiling'
)
@click.option('--date', '-d', help='Contracts expiry date')
@click.option('--test', '-t', help='Test quote stream file')
@click.option('--rate', '-r', default=1, help='Logging level')
@click.argument('symbol', required=True)
@click.pass_obj
def chart(config, symbol, date, rate, test, profile):
def chart(config, symbol, profile):
"""Start a real-time chartng UI
"""
from .. import _profile
from ._chart import _main
# possibly enable profiling
# toggle to enable profiling
_profile._pg_profile = profile
# global opts
brokername = config['broker']
tractorloglevel = config['tractorloglevel']
pikerloglevel = config['loglevel']
_main(
sym=symbol,
brokername=brokername,
piker_loglevel=pikerloglevel,
tractor_kwargs={
'debug_mode': True,
'loglevel': tractorloglevel,