ib: only normalize and log first quote if it arrives
parent
637d33d7cc
commit
543c11f377
|
@ -1000,7 +1000,9 @@ _scan_ignore: set[tuple[str, int]] = set()
|
||||||
|
|
||||||
def get_config() -> dict[str, Any]:
|
def get_config() -> dict[str, Any]:
|
||||||
|
|
||||||
conf, path = config.load('brokers')
|
conf, path = config.load(
|
||||||
|
conf_name='brokers',
|
||||||
|
)
|
||||||
section = conf.get('ib')
|
section = conf.get('ib')
|
||||||
|
|
||||||
accounts = section.get('accounts')
|
accounts = section.get('accounts')
|
||||||
|
|
|
@ -25,6 +25,7 @@ from contextlib import (
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from pprint import pformat
|
||||||
from math import isnan
|
from math import isnan
|
||||||
import time
|
import time
|
||||||
from typing import (
|
from typing import (
|
||||||
|
@ -836,9 +837,12 @@ async def stream_quotes(
|
||||||
|
|
||||||
con: Contract = details.contract
|
con: Contract = details.contract
|
||||||
first_ticker: Ticker = await proxy.get_quote(contract=con)
|
first_ticker: Ticker = await proxy.get_quote(contract=con)
|
||||||
|
if first_ticker:
|
||||||
first_quote: dict = normalize(first_ticker)
|
first_quote: dict = normalize(first_ticker)
|
||||||
|
log.info(
|
||||||
log.warning(f'FIRST QUOTE: {first_quote}')
|
'Rxed init quote:\n'
|
||||||
|
f'{pformat(first_quote)}'
|
||||||
|
)
|
||||||
|
|
||||||
# TODO: we should instead spawn a task that waits on a feed to start
|
# TODO: we should instead spawn a task that waits on a feed to start
|
||||||
# and let it wait indefinitely..instead of this hard coded stuff.
|
# and let it wait indefinitely..instead of this hard coded stuff.
|
||||||
|
@ -858,7 +862,10 @@ async def stream_quotes(
|
||||||
'crypto',
|
'crypto',
|
||||||
}
|
}
|
||||||
):
|
):
|
||||||
task_status.started((init_msgs, first_quote))
|
task_status.started((
|
||||||
|
init_msgs,
|
||||||
|
first_quote,
|
||||||
|
))
|
||||||
|
|
||||||
# it's not really live but this will unblock
|
# it's not really live but this will unblock
|
||||||
# the brokerd feed task to tell the ui to update?
|
# the brokerd feed task to tell the ui to update?
|
||||||
|
@ -889,7 +896,10 @@ async def stream_quotes(
|
||||||
# only on first entry at feed boot up
|
# only on first entry at feed boot up
|
||||||
if startup:
|
if startup:
|
||||||
startup = False
|
startup = False
|
||||||
task_status.started((init_msgs, first_quote))
|
task_status.started((
|
||||||
|
init_msgs,
|
||||||
|
first_quote,
|
||||||
|
))
|
||||||
|
|
||||||
# start a stream restarter task which monitors the
|
# start a stream restarter task which monitors the
|
||||||
# data feed event.
|
# data feed event.
|
||||||
|
|
Loading…
Reference in New Issue