Add vlm axis titles and humanized $vlm y-range
parent
e8cad45952
commit
56f9ddb880
|
@ -33,7 +33,9 @@ import pyqtgraph as pg
|
||||||
import trio
|
import trio
|
||||||
from trio_typing import TaskStatus
|
from trio_typing import TaskStatus
|
||||||
|
|
||||||
|
from ._axes import PriceAxis
|
||||||
from .._cacheables import maybe_open_context
|
from .._cacheables import maybe_open_context
|
||||||
|
from ..calc import humanize
|
||||||
from ..data._sharedmem import (
|
from ..data._sharedmem import (
|
||||||
ShmArray,
|
ShmArray,
|
||||||
maybe_open_shm_array,
|
maybe_open_shm_array,
|
||||||
|
@ -661,8 +663,11 @@ async def open_vlm_displays(
|
||||||
# size view to data once at outset
|
# size view to data once at outset
|
||||||
chart.view._set_yrange()
|
chart.view._set_yrange()
|
||||||
|
|
||||||
if not dvlm:
|
# add axis title
|
||||||
return
|
axis = chart.getAxis('right')
|
||||||
|
axis.set_title(' vlm')
|
||||||
|
|
||||||
|
if dvlm:
|
||||||
|
|
||||||
# spawn and overlay $ vlm on the same subchart
|
# spawn and overlay $ vlm on the same subchart
|
||||||
shm, started = await admin.start_engine_task(
|
shm, started = await admin.start_engine_task(
|
||||||
|
@ -685,7 +690,22 @@ async def open_vlm_displays(
|
||||||
|
|
||||||
pi = chart.overlay_plotitem(
|
pi = chart.overlay_plotitem(
|
||||||
'dolla_vlm',
|
'dolla_vlm',
|
||||||
|
axis_kwargs={
|
||||||
|
# 'humanize': True,
|
||||||
|
# 'text': 'dvlm',
|
||||||
|
'typical_max_str': ' 99.9 M ',
|
||||||
|
'formatter': partial(
|
||||||
|
humanize,
|
||||||
|
digits=2,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 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')
|
||||||
|
|
||||||
|
@ -710,7 +730,8 @@ async def open_vlm_displays(
|
||||||
# ``.draw_curve()``.
|
# ``.draw_curve()``.
|
||||||
chart._overlays['dolla_vlm'] = shm
|
chart._overlays['dolla_vlm'] = shm
|
||||||
|
|
||||||
# XXX: old dict-style config before it was moved into the helper task
|
# XXX: old dict-style config before it was moved into the
|
||||||
|
# helper task
|
||||||
# 'dolla_vlm': {
|
# 'dolla_vlm': {
|
||||||
# 'func_name': 'dolla_vlm',
|
# 'func_name': 'dolla_vlm',
|
||||||
# 'zero_on_step': True,
|
# 'zero_on_step': True,
|
||||||
|
@ -729,6 +750,12 @@ async def open_vlm_displays(
|
||||||
|
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
for name, axis_info in pi.axes.items():
|
||||||
|
# lol this sux XD
|
||||||
|
axis = axis_info['item']
|
||||||
|
if isinstance(axis, PriceAxis):
|
||||||
|
axis.size_to_values()
|
||||||
|
|
||||||
# built-in vlm fsps
|
# built-in vlm fsps
|
||||||
for display_name, conf in {
|
for display_name, conf in {
|
||||||
'vwap': {
|
'vwap': {
|
||||||
|
|
Loading…
Reference in New Issue