ib; return `None` on empty bars frame resp so as to trigger raising `NoData` in the caller

distribute_dis
Tyler Goodlet 2024-01-03 18:16:48 -05:00
parent 2669db785c
commit b23d44e21a
1 changed files with 39 additions and 43 deletions

View File

@ -434,11 +434,8 @@ async def get_bars(
# current impl) to detect a cancel case. # current impl) to detect a cancel case.
# timeout=timeout, # timeout=timeout,
) )
# usually either a request during a venue closure
# not enough bars signal, likely due to venue # or into a large (weekend) closure gap.
# operational gaps.
# too_little: bool = False
if end_dt:
if not bars: if not bars:
# no data returned? # no data returned?
log.warning( log.warning(
@ -447,14 +444,13 @@ async def get_bars(
f'end_dt: {end_dt}\n' f'end_dt: {end_dt}\n'
f'duration: {dt_duration}\n' f'duration: {dt_duration}\n'
) )
# NOTE: REQUIRED to pass back value..
result = None result = None
return None return None
# raise NoData(
# f'{fqme}\n'
# f'end_dt:{end_dt}\n'
# )
else: # not enough bars signal, likely due to venue
# operational gaps.
if end_dt:
dur_s: float = len(bars) * timeframe dur_s: float = len(bars) * timeframe
bars_dur = Duration(seconds=dur_s) bars_dur = Duration(seconds=dur_s)
dt_dur_s: float = dt_duration.in_seconds() dt_dur_s: float = dt_duration.in_seconds()