Look up "index field" in display cycles
Again, to make epoch indexing a flip-of-switch for testing look up the `Viz.index_field: str` value when updating labels. Also, drops the legacy tick-type set tracking which we no longer use thanks to the new throttler subsys and it's framing msgs.epoch_indexing_and_dataviz_layer
parent
382a619a03
commit
309ae240cf
|
@ -303,17 +303,25 @@ async def graphics_update_loop(
|
||||||
fqsn = symbol.fqsn
|
fqsn = symbol.fqsn
|
||||||
|
|
||||||
# update last price sticky
|
# update last price sticky
|
||||||
fast_pi = fast_chart._vizs[fqsn].plot
|
fast_viz = fast_chart._vizs[fqsn]
|
||||||
|
index_field = fast_viz.index_field
|
||||||
|
fast_pi = fast_viz.plot
|
||||||
last_price_sticky = fast_pi.getAxis('right')._stickies[fqsn]
|
last_price_sticky = fast_pi.getAxis('right')._stickies[fqsn]
|
||||||
last_price_sticky.update_from_data(
|
last_price_sticky.update_from_data(
|
||||||
*ohlcv.array[-1][['index', 'close']]
|
*ohlcv.array[-1][[
|
||||||
|
index_field,
|
||||||
|
'close',
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
last_price_sticky.show()
|
last_price_sticky.show()
|
||||||
|
|
||||||
slow_pi = hist_chart._vizs[fqsn].plot
|
slow_pi = hist_chart._vizs[fqsn].plot
|
||||||
hist_last_price_sticky = slow_pi.getAxis('right')._stickies[fqsn]
|
hist_last_price_sticky = slow_pi.getAxis('right')._stickies[fqsn]
|
||||||
hist_last_price_sticky.update_from_data(
|
hist_last_price_sticky.update_from_data(
|
||||||
*hist_ohlcv.array[-1][['index', 'close']]
|
*hist_ohlcv.array[-1][[
|
||||||
|
index_field,
|
||||||
|
'close',
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
vlm_chart = vlm_charts[fqsn]
|
vlm_chart = vlm_charts[fqsn]
|
||||||
|
@ -515,12 +523,12 @@ def graphics_update_cycle(
|
||||||
chart = ds.chart
|
chart = ds.chart
|
||||||
# TODO: just pass this as a direct ref to avoid so many attr accesses?
|
# TODO: just pass this as a direct ref to avoid so many attr accesses?
|
||||||
hist_chart = ds.godwidget.hist_linked.chart
|
hist_chart = ds.godwidget.hist_linked.chart
|
||||||
assert hist_chart
|
|
||||||
|
|
||||||
flume = ds.flume
|
flume = ds.flume
|
||||||
sym = flume.symbol
|
sym = flume.symbol
|
||||||
fqsn = sym.fqsn
|
fqsn = sym.fqsn
|
||||||
main_viz = chart._vizs[fqsn]
|
main_viz = chart._vizs[fqsn]
|
||||||
|
index_field = main_viz.index_field
|
||||||
|
|
||||||
profiler = Profiler(
|
profiler = Profiler(
|
||||||
msg=f'Graphics loop cycle for: `{chart.name}`',
|
msg=f'Graphics loop cycle for: `{chart.name}`',
|
||||||
|
@ -607,7 +615,7 @@ def graphics_update_cycle(
|
||||||
# if the segment of history that is being prepended
|
# if the segment of history that is being prepended
|
||||||
# isn't in view there is no reason to do a graphics
|
# isn't in view there is no reason to do a graphics
|
||||||
# update.
|
# update.
|
||||||
log.debug('Skipping prepend graphics cycle: frame not in view')
|
log.info('Skipping prepend graphics cycle: frame not in view')
|
||||||
return
|
return
|
||||||
|
|
||||||
# TODO: eventually we want to separate out the utrade (aka
|
# TODO: eventually we want to separate out the utrade (aka
|
||||||
|
@ -639,11 +647,6 @@ def graphics_update_cycle(
|
||||||
# do_append=do_append,
|
# do_append=do_append,
|
||||||
)
|
)
|
||||||
|
|
||||||
# NOTE: we always update the "last" datum
|
|
||||||
# since the current range should at least be updated
|
|
||||||
# to it's max/min on the last pixel.
|
|
||||||
typs: set[str] = set()
|
|
||||||
|
|
||||||
# from pprint import pformat
|
# from pprint import pformat
|
||||||
# frame_counts = {
|
# frame_counts = {
|
||||||
# typ: len(frame) for typ, frame in frames_by_type.items()
|
# typ: len(frame) for typ, frame in frames_by_type.items()
|
||||||
|
@ -667,11 +670,6 @@ def graphics_update_cycle(
|
||||||
price = tick.get('price')
|
price = tick.get('price')
|
||||||
size = tick.get('size')
|
size = tick.get('size')
|
||||||
|
|
||||||
if typ in typs:
|
|
||||||
continue
|
|
||||||
|
|
||||||
typs.add(typ)
|
|
||||||
|
|
||||||
# compute max and min prices (including bid/ask) from
|
# compute max and min prices (including bid/ask) from
|
||||||
# tick frames to determine the y-range for chart
|
# tick frames to determine the y-range for chart
|
||||||
# auto-scaling.
|
# auto-scaling.
|
||||||
|
@ -681,7 +679,6 @@ def graphics_update_cycle(
|
||||||
mn = min(price - tick_margin, mn)
|
mn = min(price - tick_margin, mn)
|
||||||
|
|
||||||
if typ in clear_types:
|
if typ in clear_types:
|
||||||
|
|
||||||
# XXX: if we only wanted to update graphics from the
|
# XXX: if we only wanted to update graphics from the
|
||||||
# "current"/"latest received" clearing price tick
|
# "current"/"latest received" clearing price tick
|
||||||
# once (see alt iteration order above).
|
# once (see alt iteration order above).
|
||||||
|
@ -694,7 +691,10 @@ def graphics_update_cycle(
|
||||||
# set.
|
# set.
|
||||||
|
|
||||||
# update price sticky(s)
|
# update price sticky(s)
|
||||||
end_ic = array[-1][['index', 'close']]
|
end_ic = array[-1][[
|
||||||
|
index_field,
|
||||||
|
'close',
|
||||||
|
]]
|
||||||
ds.last_price_sticky.update_from_data(*end_ic)
|
ds.last_price_sticky.update_from_data(*end_ic)
|
||||||
ds.hist_last_price_sticky.update_from_data(*end_ic)
|
ds.hist_last_price_sticky.update_from_data(*end_ic)
|
||||||
|
|
||||||
|
@ -827,7 +827,10 @@ def graphics_update_cycle(
|
||||||
|
|
||||||
# always update y-label
|
# always update y-label
|
||||||
ds.vlm_sticky.update_from_data(
|
ds.vlm_sticky.update_from_data(
|
||||||
*array[-1][['index', 'volume']]
|
*array[-1][[
|
||||||
|
index_field,
|
||||||
|
'volume',
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -1124,7 +1127,7 @@ async def display_symbol_data(
|
||||||
# avoiding needless Qt-in-guest-mode context switches
|
# avoiding needless Qt-in-guest-mode context switches
|
||||||
tick_throttle=min(
|
tick_throttle=min(
|
||||||
round(_quote_throttle_rate/len(fqsns)),
|
round(_quote_throttle_rate/len(fqsns)),
|
||||||
22,
|
22, # aka 6 + 16
|
||||||
),
|
),
|
||||||
|
|
||||||
) as feed:
|
) as feed:
|
||||||
|
@ -1374,8 +1377,7 @@ async def display_symbol_data(
|
||||||
# trigger another view reset if no sub-chart
|
# trigger another view reset if no sub-chart
|
||||||
hist_chart.default_view()
|
hist_chart.default_view()
|
||||||
rt_chart.default_view()
|
rt_chart.default_view()
|
||||||
|
# let qt run to render all widgets and make sure the
|
||||||
# let Qt run to render all widgets and make sure the
|
|
||||||
# sidepanes line up vertically.
|
# sidepanes line up vertically.
|
||||||
await trio.sleep(0)
|
await trio.sleep(0)
|
||||||
|
|
||||||
|
@ -1423,9 +1425,6 @@ async def display_symbol_data(
|
||||||
vlm_charts,
|
vlm_charts,
|
||||||
)
|
)
|
||||||
|
|
||||||
rt_chart.default_view()
|
|
||||||
await trio.sleep(0)
|
|
||||||
|
|
||||||
mode: OrderMode
|
mode: OrderMode
|
||||||
async with (
|
async with (
|
||||||
open_order_mode(
|
open_order_mode(
|
||||||
|
|
Loading…
Reference in New Issue