Drop tick frame builder loop for now

multi_symbol_input
Tyler Goodlet 2022-11-15 16:10:41 -05:00
parent eac79c5cdd
commit 92c50aa6a7
1 changed files with 24 additions and 18 deletions

View File

@ -580,9 +580,8 @@ def graphics_update_cycle(
profiler('view incremented') profiler('view incremented')
ticks_frame = quote.get('ticks', ()) ticks_frame = quote.get('ticks', ())
# frames_by_type: dict[str, dict] = {}
frames_by_type: dict[str, dict] = {} # lasts = {}
lasts = {}
# build tick-type "frames" of tick sequences since # build tick-type "frames" of tick sequences since
# likely the tick arrival rate is higher then our # likely the tick arrival rate is higher then our
@ -616,22 +615,22 @@ def graphics_update_cycle(
log.debug('Skipping prepend graphics cycle: frame not in view') log.debug('Skipping prepend graphics cycle: frame not in view')
return return
for tick in ticks_frame: # for tick in ticks_frame:
price = tick.get('price') # price = tick.get('price')
ticktype = tick.get('type') # ticktype = tick.get('type')
# if ticktype == 'n/a' or price == -1: # # if ticktype == 'n/a' or price == -1:
# # okkk.. # # # okkk..
# continue # # continue
# keys are entered in olded-event-inserted-first order # # keys are entered in olded-event-inserted-first order
# since we iterate ``ticks_frame`` in standard order # # since we iterate ``ticks_frame`` in standard order
# above. in other words the order of the keys is the order # # above. in other words the order of the keys is the order
# of tick events by type from the provider feed. # # of tick events by type from the provider feed.
frames_by_type.setdefault(ticktype, []).append(tick) # frames_by_type.setdefault(ticktype, []).append(tick)
# overwrites so the last tick per type is the entry # # overwrites so the last tick per type is the entry
lasts[ticktype] = tick # lasts[ticktype] = tick
# from pprint import pformat # from pprint import pformat
# frame_counts = { # frame_counts = {
@ -675,12 +674,19 @@ def graphics_update_cycle(
# NOTE: we always update the "last" datum # NOTE: we always update the "last" datum
# since the current range should at least be updated # since the current range should at least be updated
# to it's max/min on the last pixel. # to it's max/min on the last pixel.
typs: set[str] = set()
for typ, tick in lasts.items(): # for typ, tick in lasts.items():
for tick in ticks_frame:
typ = tick.get('type')
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.