Compare commits
2 Commits
137aee510b
...
103967870e
| Author | SHA1 | Date |
|---|---|---|
|
|
103967870e | |
|
|
3b0e413e96 |
|
|
@ -1291,13 +1291,23 @@ async def deliver_trade_events(
|
||||||
case 'error':
|
case 'error':
|
||||||
# NOTE: see impl deats in
|
# NOTE: see impl deats in
|
||||||
# `Client.inline_errors()::push_err()`
|
# `Client.inline_errors()::push_err()`
|
||||||
err: dict = item
|
err: dict|str = item
|
||||||
|
|
||||||
# never relay errors for non-broker related issues
|
# std case, never relay errors for non-order-control
|
||||||
|
# related issues.
|
||||||
# https://interactivebrokers.github.io/tws-api/message_codes.html
|
# https://interactivebrokers.github.io/tws-api/message_codes.html
|
||||||
code: int = err['error_code']
|
if isinstance(err, dict):
|
||||||
reason: str = err['reason']
|
code: int = err['error_code']
|
||||||
reqid: str = str(err['reqid'])
|
reason: str = err['reason']
|
||||||
|
reqid: str = str(err['reqid'])
|
||||||
|
|
||||||
|
# XXX, sometimes you'll get just a `str` of the form,
|
||||||
|
# '[code 104] connection failed' or something..
|
||||||
|
elif isinstance(err, str):
|
||||||
|
code_part, _, reason = err.rpartition(']')
|
||||||
|
if code_part:
|
||||||
|
_, _, code = code_part.partition('[code')
|
||||||
|
reqid: str = '<unknown>'
|
||||||
|
|
||||||
# "Warning:" msg codes,
|
# "Warning:" msg codes,
|
||||||
# https://interactivebrokers.github.io/tws-api/message_codes.html#warning_codes
|
# https://interactivebrokers.github.io/tws-api/message_codes.html#warning_codes
|
||||||
|
|
|
||||||
|
|
@ -251,10 +251,20 @@ async def maybe_fill_null_segments(
|
||||||
end_dt=end_dt,
|
end_dt=end_dt,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if array.size == 0:
|
||||||
|
log.warning(
|
||||||
|
f'Valid gap from backend ??\n'
|
||||||
|
f'{end_dt} -> {start_dt}\n'
|
||||||
|
)
|
||||||
|
# ?TODO? do we want to remove the nulls and push
|
||||||
|
# the close price here for the gap duration?
|
||||||
|
await tractor.pause()
|
||||||
|
break
|
||||||
|
|
||||||
if (
|
if (
|
||||||
frame_start_dt := (
|
frame_start_dt := (from_timestamp(array['time'][0]))
|
||||||
from_timestamp(array['time'][0])
|
<
|
||||||
) < backfill_until_dt
|
backfill_until_dt
|
||||||
):
|
):
|
||||||
log.error(
|
log.error(
|
||||||
f'Invalid frame_start !?\n'
|
f'Invalid frame_start !?\n'
|
||||||
|
|
@ -616,10 +626,17 @@ async def start_backfill(
|
||||||
|
|
||||||
else:
|
else:
|
||||||
log.warning(
|
log.warning(
|
||||||
'0 BARS TO PUSH after diff!?\n'
|
f'0 BARS TO PUSH after diff!?\n'
|
||||||
f'{next_start_dt} -> {last_start_dt}'
|
f'{next_start_dt} -> {last_start_dt}'
|
||||||
|
f'\n'
|
||||||
|
f'This might mean we rxed a gap frame which starts BEFORE,\n'
|
||||||
|
f'backfill_until_dt: {backfill_until_dt}\n'
|
||||||
|
f'end_dt_param: {end_dt_param}\n'
|
||||||
|
|
||||||
)
|
)
|
||||||
await tractor.pause()
|
# XXX, to debug it and be sure.
|
||||||
|
# await tractor.pause()
|
||||||
|
break
|
||||||
|
|
||||||
# Check if we're about to exceed buffer capacity BEFORE
|
# Check if we're about to exceed buffer capacity BEFORE
|
||||||
# attempting the push
|
# attempting the push
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue