Simplify to only needed one LHS axis for clearing rates

windows_fixes_yo
Tyler Goodlet 2022-02-04 16:49:06 -05:00
parent 73faafcfc1
commit 87653ddca2
1 changed files with 99 additions and 55 deletions

View File

@ -715,7 +715,13 @@ async def open_vlm_displays(
dvlm_pi.vb._maxmin = partial( dvlm_pi.vb._maxmin = partial(
maxmin, maxmin,
# keep both regular and dark vlm in view # keep both regular and dark vlm in view
names=['dolla_vlm', 'dark_vlm'], names=[
'dolla_vlm',
'dark_vlm',
'dvlm_rate',
'dark_dvlm_rate',
],
) )
curve, _ = chart.draw_curve( curve, _ = chart.draw_curve(
@ -741,22 +747,21 @@ async def open_vlm_displays(
################ ################
# dark vlm curve # dark vlm curve
################ ################
# darker theme hue (obvsly)
dark_vlm_color = 'charcoal'
curve, _ = chart.draw_curve( curve, _ = chart.draw_curve(
name='dark_vlm', name='dark_vlm',
data=dvlm_shm.array, data=dvlm_shm.array,
array_key='dark_vlm', array_key='dark_vlm',
overlay=dvlm_pi, overlay=dvlm_pi,
color='charcoal', # darker theme hue color=dark_vlm_color,
step_mode=True, step_mode=True,
# **conf.get('chart_kwargs', {}) # **conf.get('chart_kwargs', {})
) )
chart._overlays['dark_vlm'] = dvlm_shm chart._overlays['dark_vlm'] = dvlm_shm
################## # spawn flow rates fsp **ONLY AFTER** the 'dolla_vlm' fsp is
# Vlm rate overlay # up since this one depends on it.
##################
# spawn and overlay $ vlm on the same subchart
fr_shm, started = await admin.start_engine_task( fr_shm, started = await admin.start_engine_task(
flow_rates, flow_rates,
{ # fsp engine conf { # fsp engine conf
@ -765,82 +770,121 @@ async def open_vlm_displays(
# loglevel, # loglevel,
) )
await started.wait() await started.wait()
trade_rate_color = vlm_rate_color = 'i3'
fr_pi = chart.overlay_plotitem( # curve, _ = chart.draw_curve(
'vlm_rates', # name='1m_vlm_rate',
index=0, # place axis on inside (nearest to chart) # data=fr_shm.array,
# array_key='1m_vlm_rate',
# overlay=fr_pi,
# color='jet',
# style='solid',
# )
# chart._overlays['1m_vlm_rate'] = fr_shm
# NOTE: we might want to suffix with a \w # use slightly less light (then bracket) gray
# on lhs and prefix for the rhs axis labels? # for volume from "main exchange".
axis_title=' vlm/m', vlm_color = 'i3'
axis_side='left',
axis_kwargs={
'typical_max_str': ' 100.0 M ',
'formatter': partial(
humanize,
digits=2,
),
'text_color': vlm_rate_color,
},
)
# add custom auto range handler
fr_pi.vb._maxmin = partial(
maxmin,
# keep both regular and dark vlm in view
names=[
'1m_vlm_rate',
],
)
curve, _ = chart.draw_curve( curve, _ = chart.draw_curve(
name='1m_vlm_rate', name='dvlm_rate',
data=fr_shm.array, data=fr_shm.array,
array_key='1m_vlm_rate', array_key='dvlm_rate',
overlay=fr_pi, overlay=dvlm_pi,
color=vlm_rate_color, color=vlm_color,
style='solid', style='solid',
) )
chart._overlays['1m_vlm_rate'] = fr_shm chart._overlays['dvlm_rate'] = fr_shm
curve, _ = chart.draw_curve(
name='dark_dvlm_rate',
data=fr_shm.array,
array_key='dark_dvlm_rate',
overlay=dvlm_pi,
color=dark_vlm_color,
style='solid',
)
chart._overlays['dark_dvlm_rate'] = fr_shm
# vlm rate overlay
####################
# (needs separate axis since trade counts are likely
# different scale then vlm)
# vlmrate_pi = chart.overlay_plotitem(
# 'vlm_rates',
# index=0, # place axis on inside (nearest to chart)
# # NOTE: we might want to suffix with a \w
# # on lhs and prefix for the rhs axis labels?
# axis_title=' vlm/m',
# axis_side='left',
# axis_kwargs={
# 'typical_max_str': ' 100.0 M ',
# 'formatter': partial(
# humanize,
# digits=2,
# ),
# 'text_color': vlm_color,
# },
# )
# # add custom auto range handler
# vlmrate.vb._maxmin = partial(
# maxmin,
# # keep both regular and dark vlm in view
# names=[
# # '1m_vlm_rate',
# ],
# )
#################### ####################
# Trade rate overlay # Trade rate overlay
#################### ####################
fr_pi = chart.overlay_plotitem( tr_pi = chart.overlay_plotitem(
'trade_rates', 'trade_rates',
index=1, # place axis on inside (nearest to chart) index=1, # place axis on inside (nearest to chart)
axis_title='trades/m ', axis_title='tr(16) ',
axis_side='left', axis_side='left',
axis_kwargs={ axis_kwargs={
'typical_max_str': ' 100.0 M ', 'typical_max_str': ' 10.0 M ',
'formatter': partial( 'formatter': partial(
humanize, humanize,
digits=2, digits=2,
), ),
'text_color': trade_rate_color, 'text_color': vlm_color,
}, },
) )
fields = [
'trade_rate',
'dark_trade_rate',
# '1m_trade_rate',
]
# add custom auto range handler # add custom auto range handler
fr_pi.vb._maxmin = partial( tr_pi.vb._maxmin = partial(
maxmin, maxmin,
# keep both regular and dark vlm in view # keep both regular and dark vlm in view
names=[ names=fields,
'1m_trade_rate',
],
) )
for field in fields:
if 'dark' in field:
color = dark_vlm_color
else:
color = vlm_color
curve, _ = chart.draw_curve( curve, _ = chart.draw_curve(
name='1m_trade_rate', name=field,
data=fr_shm.array, data=fr_shm.array,
array_key='1m_trade_rate', array_key=field,
overlay=fr_pi, overlay=tr_pi,
color=trade_rate_color, color=color,
# dashed line to represent "individual trades" being
# more "granular" B)
style='dash', style='dash',
) )
chart._overlays['1m_trade_rate'] = fr_shm chart._overlays[field] = fr_shm
for pi in (dvlm_pi, fr_pi): for pi in (dvlm_pi, tr_pi):
for name, axis_info in pi.axes.items(): for name, axis_info in pi.axes.items():
# lol this sux XD # lol this sux XD
axis = axis_info['item'] axis = axis_info['item']