Port to new `.update_graphics_from_array()`, pause quote updates on chart interaction

marketstore_backup
Tyler Goodlet 2022-04-03 23:34:55 -04:00
parent a9c07ab6ab
commit 2c4f434ffa
2 changed files with 23 additions and 7 deletions

View File

@ -53,6 +53,10 @@ from ._forms import (
mk_order_pane_layout,
)
from .order_mode import open_order_mode
# from .._profile import (
# pg_profile_enabled,
# ms_slower_then,
# )
from ..log import get_logger
log = get_logger(__name__)
@ -284,6 +288,12 @@ async def graphics_update_loop(
chart.pause_all_feeds()
continue
ic = chart.view._ic
if ic:
chart.pause_all_feeds()
await ic.wait()
chart.resume_all_feeds()
# sync call to update all graphics/UX components.
graphics_update_cycle(ds)
@ -299,8 +309,9 @@ def graphics_update_cycle(
profiler = pg.debug.Profiler(
disabled=True, # not pg_profile_enabled(),
delayed=False,
gt=1/12 * 1e3,
)
# unpack multi-referenced components
chart = ds.chart
vlm_chart = ds.vlm_chart
@ -409,9 +420,11 @@ def graphics_update_cycle(
if (
# if zoomed out alot don't update the last "bar"
(xpx < update_uppx or i_diff > 0)
# and r >= i_step
and r >= i_step
):
vlm_chart.update_curve_from_array('volume', array)
# TODO: make it so this doesn't have to be called
# once the $vlm is up?
vlm_chart.update_graphics_from_array('volume', array)
if (
mx_vlm_in_view != vars['last_mx_vlm']
@ -485,7 +498,8 @@ def graphics_update_cycle(
xpx < update_uppx
or i_diff > 0
):
chart.update_ohlc_from_array(
# chart.update_ohlc_from_array(
chart.update_graphics_from_array(
chart.name,
array,
)
@ -524,7 +538,7 @@ def graphics_update_cycle(
if wap_in_history:
# update vwap overlay line
chart.update_curve_from_array(
chart.update_graphics_from_array(
'bar_wap',
array,
)

View File

@ -89,7 +89,7 @@ def update_fsp_chart(
# update graphics
# NOTE: this does a length check internally which allows it
# staying above the last row check below..
chart.update_curve_from_array(
chart.update_graphics_from_array(
graphics_name,
array,
array_key=array_key or graphics_name,
@ -425,6 +425,7 @@ class FspAdmin:
) as (ctx, last_index),
ctx.open_stream() as stream,
):
# register output data
self._registry[
(fqsn, ns_path)
@ -440,6 +441,7 @@ class FspAdmin:
async with stream.subscribe() as stream:
async for msg in stream:
if msg == 'update':
log.info(f'Re-syncing graphics for fsp: {ns_path}')
self.linked.graphics_cycle()
else:
log.info(f'recved unexpected fsp engine msg: {msg}')
@ -674,7 +676,7 @@ async def open_vlm_displays(
last_val_sticky.update_from_data(-1, value)
vlm_curve = chart.update_curve_from_array(
vlm_curve = chart.update_graphics_from_array(
'volume',
shm.array,
)