Hide the unit vlm after the $vlm is up

Since more curves costs more processing and since the vlm and $vlm
curves are normally very close to the same (graphically) we hide the
unit volume curve once the dollar volume is up (after the fsp daemon-task is
spawned) and just expect the user to understand the diff in axes units.
Also, use the new `title=` api to `.overlay_plotitem()`.
vlm_plotz
Tyler Goodlet 2022-01-21 08:30:53 -05:00
parent 26327e5462
commit 1a077c0553
1 changed files with 12 additions and 10 deletions

View File

@ -655,7 +655,7 @@ async def open_vlm_displays(
last_val_sticky.update_from_data(-1, value) last_val_sticky.update_from_data(-1, value)
chart.update_curve_from_array( vlm_curve = chart.update_curve_from_array(
'volume', 'volume',
shm.array, shm.array,
) )
@ -690,10 +690,11 @@ async def open_vlm_displays(
pi = chart.overlay_plotitem( pi = chart.overlay_plotitem(
'dolla_vlm', 'dolla_vlm',
index=0, # place axis on inside (nearest to chart)
axis_title=' $vlm',
axis_side='right',
axis_kwargs={ axis_kwargs={
# 'humanize': True, 'typical_max_str': ' 100.0 M ',
# 'text': 'dvlm',
'typical_max_str': ' 99.9 M ',
'formatter': partial( 'formatter': partial(
humanize, humanize,
digits=2, digits=2,
@ -702,10 +703,6 @@ async def open_vlm_displays(
) )
# add axis title
raxis = pi.getAxis('right')
raxis.set_title(' $vlm', view=pi.getViewBox())
# add custom auto range handler # add custom auto range handler
pi.vb._maxmin = partial(maxmin, name='dolla_vlm') pi.vb._maxmin = partial(maxmin, name='dolla_vlm')
@ -716,13 +713,18 @@ async def open_vlm_displays(
array_key='dolla_vlm', array_key='dolla_vlm',
overlay=pi, overlay=pi,
color='charcoal', # color='bracket',
# TODO: this color or dark volume
# color='charcoal',
step_mode=True, step_mode=True,
# **conf.get('chart_kwargs', {}) # **conf.get('chart_kwargs', {})
) )
# TODO: is there a way to "sync" the dual axes such that only # TODO: is there a way to "sync" the dual axes such that only
# one curve is needed? # one curve is needed?
# curve.hide() # hide the original vlm curve since the $vlm one is now
# displayed and the curves are effectively the same minus
# liquidity events (well at least on low OHLC periods - 1s).
vlm_curve.hide()
# TODO: we need a better API to do this.. # TODO: we need a better API to do this..
# specially store ref to shm for lookup in display loop # specially store ref to shm for lookup in display loop