Fix and pass through piker loglevel correctly
parent
aa4a2ef64f
commit
6fb1945360
|
@ -936,14 +936,13 @@ async def test_bed(
|
||||||
|
|
||||||
|
|
||||||
async def _async_main(
|
async def _async_main(
|
||||||
sym: str,
|
|
||||||
brokername: str,
|
|
||||||
|
|
||||||
# implicit required argument provided by ``qtractor_run()``
|
# implicit required argument provided by ``qtractor_run()``
|
||||||
widgets: Dict[str, Any],
|
widgets: Dict[str, Any],
|
||||||
|
|
||||||
# all kwargs are passed through from the CLI entrypoint
|
sym: str,
|
||||||
loglevel: str = None,
|
brokername: str,
|
||||||
|
loglevel: str,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Main Qt-trio routine invoked by the Qt loop with
|
"""Main Qt-trio routine invoked by the Qt loop with
|
||||||
the widgets ``dict``.
|
the widgets ``dict``.
|
||||||
|
@ -1093,7 +1092,7 @@ async def _async_main(
|
||||||
async for msg in trades_stream:
|
async for msg in trades_stream:
|
||||||
|
|
||||||
fmsg = pformat(msg)
|
fmsg = pformat(msg)
|
||||||
log.info(f'Received order msg: {fmsg}')
|
log.info(f'Received order msg:\n{fmsg}')
|
||||||
|
|
||||||
# delete the line from view
|
# delete the line from view
|
||||||
oid = msg['oid']
|
oid = msg['oid']
|
||||||
|
@ -1121,7 +1120,7 @@ async def _async_main(
|
||||||
elif resp in (
|
elif resp in (
|
||||||
'dark_executed'
|
'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
|
# for alerts add a triangle and remove the
|
||||||
# level line
|
# level line
|
||||||
|
@ -1300,7 +1299,7 @@ async def chart_from_quotes(
|
||||||
if (mx > last_mx) or (
|
if (mx > last_mx) or (
|
||||||
mn < last_mn
|
mn < last_mn
|
||||||
):
|
):
|
||||||
print(f'new y range: {(mn, mx)}')
|
# print(f'new y range: {(mn, mx)}')
|
||||||
|
|
||||||
chart._set_yrange(
|
chart._set_yrange(
|
||||||
yrange=(mn, mx),
|
yrange=(mn, mx),
|
||||||
|
@ -1581,6 +1580,7 @@ async def check_for_new_bars(feed, ohlcv, linked_charts):
|
||||||
def _main(
|
def _main(
|
||||||
sym: str,
|
sym: str,
|
||||||
brokername: str,
|
brokername: str,
|
||||||
|
piker_loglevel: str,
|
||||||
tractor_kwargs,
|
tractor_kwargs,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Sync entry point to start a chart app.
|
"""Sync entry point to start a chart app.
|
||||||
|
@ -1589,7 +1589,7 @@ def _main(
|
||||||
# Qt entry point
|
# Qt entry point
|
||||||
run_qtractor(
|
run_qtractor(
|
||||||
func=_async_main,
|
func=_async_main,
|
||||||
args=(sym, brokername),
|
args=(sym, brokername, piker_loglevel),
|
||||||
main_widget=ChartSpace,
|
main_widget=ChartSpace,
|
||||||
tractor_kwargs=tractor_kwargs,
|
tractor_kwargs=tractor_kwargs,
|
||||||
)
|
)
|
||||||
|
|
|
@ -197,7 +197,7 @@ def run_qtractor(
|
||||||
name='qtractor',
|
name='qtractor',
|
||||||
**tractor_kwargs,
|
**tractor_kwargs,
|
||||||
):
|
):
|
||||||
await func(*(args + (widgets,)))
|
await func(*((widgets,) + args))
|
||||||
|
|
||||||
# guest mode entry
|
# guest mode entry
|
||||||
trio.lowlevel.start_guest_run(
|
trio.lowlevel.start_guest_run(
|
||||||
|
|
|
@ -126,27 +126,26 @@ def optschain(config, symbol, date, tl, rate, test):
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help='Enable pyqtgraph profiling'
|
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.argument('symbol', required=True)
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def chart(config, symbol, date, rate, test, profile):
|
def chart(config, symbol, profile):
|
||||||
"""Start a real-time chartng UI
|
"""Start a real-time chartng UI
|
||||||
"""
|
"""
|
||||||
from .. import _profile
|
from .. import _profile
|
||||||
from ._chart import _main
|
from ._chart import _main
|
||||||
|
|
||||||
# possibly enable profiling
|
# toggle to enable profiling
|
||||||
_profile._pg_profile = profile
|
_profile._pg_profile = profile
|
||||||
|
|
||||||
# global opts
|
# global opts
|
||||||
brokername = config['broker']
|
brokername = config['broker']
|
||||||
tractorloglevel = config['tractorloglevel']
|
tractorloglevel = config['tractorloglevel']
|
||||||
|
pikerloglevel = config['loglevel']
|
||||||
|
|
||||||
_main(
|
_main(
|
||||||
sym=symbol,
|
sym=symbol,
|
||||||
brokername=brokername,
|
brokername=brokername,
|
||||||
|
piker_loglevel=pikerloglevel,
|
||||||
tractor_kwargs={
|
tractor_kwargs={
|
||||||
'debug_mode': True,
|
'debug_mode': True,
|
||||||
'loglevel': tractorloglevel,
|
'loglevel': tractorloglevel,
|
||||||
|
|
Loading…
Reference in New Issue