Use `datad` names for quote timestamps and search
Finish the market-data naming cleanup after the datad/brokerd split. Rename the quote receipt field to `datad_ts` across all five provider producers, its typed schema, the FSP latency reader and the commented marketstore schema example. Keep timestamp values and their existing provider-specific semantics unchanged. Rename `search_w_brokerd()` to `search_w_datad()` together with its RPC call site. Correct sampler/search task descriptions, the dropped-feed log and the shared asyncio-spawn comments to reflect the current actor roles. This is a coordinated quote-field/RPC-name rename: restart actors together rather than mixing old producers with new consumers. Historical design records retain their original names. Keep this cleanup separate for replay onto the datad-introduction branch. (this patch was generated in some part by `opencode` using `openai/gpt-6-astra` (`openai`))wkt/history_segment_refill
parent
e02a6431e3
commit
a8ecbec3f3
|
|
@ -192,7 +192,7 @@ async def stream_messages(
|
||||||
piker_quote: dict = {
|
piker_quote: dict = {
|
||||||
'symbol': msg.s,
|
'symbol': msg.s,
|
||||||
'last': float(msg.p),
|
'last': float(msg.p),
|
||||||
'brokerd_ts': time.time(),
|
'datad_ts': time.time(),
|
||||||
'ticks': [{
|
'ticks': [{
|
||||||
'type': 'trade',
|
'type': 'trade',
|
||||||
'price': float(msg.p),
|
'price': float(msg.p),
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ async def bars(
|
||||||
return await client.bars(symbol, **kwargs)
|
return await client.bars(symbol, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
async def search_w_brokerd(
|
async def search_w_datad(
|
||||||
name: str,
|
name: str,
|
||||||
pattern: str,
|
pattern: str,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
|
|
@ -185,7 +185,7 @@ async def symbol_search(
|
||||||
results.append((
|
results.append((
|
||||||
brokername,
|
brokername,
|
||||||
await portal.run(
|
await portal.run(
|
||||||
search_w_brokerd,
|
search_w_datad,
|
||||||
name=brokername,
|
name=brokername,
|
||||||
pattern=pattern,
|
pattern=pattern,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,6 @@ _spawn_kwargs = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# annotation to let backend agnostic code
|
# annotation to let backend agnostic code
|
||||||
# know if ``brokerd`` should be spawned with
|
# know if ``datad``/``brokerd`` should be spawned with
|
||||||
# ``tractor``'s aio mode.
|
# ``tractor``'s aio mode.
|
||||||
_infect_asyncio: bool = True
|
_infect_asyncio: bool = True
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ async def stream_quotes(
|
||||||
first_quote = {
|
first_quote = {
|
||||||
'symbol': sym,
|
'symbol': sym,
|
||||||
'last': last_trade.price,
|
'last': last_trade.price,
|
||||||
'brokerd_ts': last_trade.timestamp,
|
'datad_ts': last_trade.timestamp,
|
||||||
'ticks': [{
|
'ticks': [{
|
||||||
'type': 'trade',
|
'type': 'trade',
|
||||||
'price': last_trade.price,
|
'price': last_trade.price,
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ _spawn_kwargs = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# annotation to let backend agnostic code
|
# annotation to let backend agnostic code
|
||||||
# know if ``brokerd`` should be spawned with
|
# know if ``datad``/``brokerd`` should be spawned with
|
||||||
# ``tractor``'s aio mode.
|
# ``tractor``'s aio mode.
|
||||||
_infect_asyncio: bool = True
|
_infect_asyncio: bool = True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1086,7 +1086,7 @@ def normalize(
|
||||||
data['tickByTicks'] = [tbt._asdict() for tbt in tbts]
|
data['tickByTicks'] = [tbt._asdict() for tbt in tbts]
|
||||||
|
|
||||||
# add time stamps for downstream latency measurements
|
# add time stamps for downstream latency measurements
|
||||||
data['brokerd_ts'] = time.time()
|
data['datad_ts'] = time.time()
|
||||||
|
|
||||||
# stupid stupid shit...don't even care any more..
|
# stupid stupid shit...don't even care any more..
|
||||||
# leave it until we do a proper latency study
|
# leave it until we do a proper latency study
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ _search_conf = {
|
||||||
@tractor.context
|
@tractor.context
|
||||||
async def open_symbol_search(ctx: tractor.Context) -> None:
|
async def open_symbol_search(ctx: tractor.Context) -> None:
|
||||||
'''
|
'''
|
||||||
Symbology search brokerd-endpoint.
|
Symbology search `datad` endpoint.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
from .api import open_client_proxies
|
from .api import open_client_proxies
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ def normalize(ohlc: OHLC) -> dict:
|
||||||
'''
|
'''
|
||||||
quote = ohlc.to_dict()
|
quote = ohlc.to_dict()
|
||||||
quote['broker_ts'] = quote['time']
|
quote['broker_ts'] = quote['time']
|
||||||
quote['brokerd_ts'] = time.time()
|
quote['datad_ts'] = time.time()
|
||||||
quote['symbol'] = quote['pair'] = quote['pair'].replace('/', '')
|
quote['symbol'] = quote['pair'] = quote['pair'].replace('/', '')
|
||||||
quote['last'] = quote['close']
|
quote['last'] = quote['close']
|
||||||
quote['bar_wap'] = ohlc.vwap
|
quote['bar_wap'] = ohlc.vwap
|
||||||
|
|
|
||||||
|
|
@ -896,7 +896,7 @@ async def iter_normed_quotes(
|
||||||
# semantic? can't we just read the ticks with our
|
# semantic? can't we just read the ticks with our
|
||||||
# .data.ticktools.frame_ticks()`/
|
# .data.ticktools.frame_ticks()`/
|
||||||
'last': trade_data.price,
|
'last': trade_data.price,
|
||||||
'brokerd_ts': last_trade_ts,
|
'datad_ts': last_trade_ts,
|
||||||
'ticks': [
|
'ticks': [
|
||||||
{
|
{
|
||||||
'type': 'trade',
|
'type': 'trade',
|
||||||
|
|
|
||||||
|
|
@ -600,10 +600,10 @@ async def sample_and_broadcast(
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
'''
|
'''
|
||||||
`brokerd`-side task which writes latest datum sampled data.
|
`datad`-side task which writes latest datum sampled data.
|
||||||
|
|
||||||
This task is meant to run in the same actor (mem space) as the
|
This task is meant to run in the same actor (mem space) as the
|
||||||
`brokerd` real-time quote feed which is being sampled to
|
`datad` real-time quote feed which is being sampled to
|
||||||
a ``ShmArray`` buffer.
|
a ``ShmArray`` buffer.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
@ -743,7 +743,7 @@ async def sample_and_broadcast(
|
||||||
# AND/OR instead of doing a fan out to TCP sockets
|
# AND/OR instead of doing a fan out to TCP sockets
|
||||||
# here, we add a shm-style tick queue which readers can
|
# here, we add a shm-style tick queue which readers can
|
||||||
# pull from instead of placing the burden of broadcast
|
# pull from instead of placing the burden of broadcast
|
||||||
# on solely on this `brokerd` actor. see issues:
|
# solely on this `datad` actor. see issues:
|
||||||
# - https://github.com/pikers/piker/issues/98
|
# - https://github.com/pikers/piker/issues/98
|
||||||
# - https://github.com/pikers/piker/issues/107
|
# - https://github.com/pikers/piker/issues/107
|
||||||
|
|
||||||
|
|
@ -805,7 +805,8 @@ async def sample_and_broadcast(
|
||||||
chan: Channel = ctx.chan
|
chan: Channel = ctx.chan
|
||||||
if ctx:
|
if ctx:
|
||||||
log.warning(
|
log.warning(
|
||||||
f'Dropped `brokerd`-feed for {broker_symbol!r} due to,\n'
|
f'Dropped `datad` feed for '
|
||||||
|
f'{broker_symbol!r} due to,\n'
|
||||||
f'x>) {ctx.cid}@{chan.uid}'
|
f'x>) {ctx.cid}@{chan.uid}'
|
||||||
f'|_{ipc_err!r}\n\n'
|
f'|_{ipc_err!r}\n\n'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class FeedQuote(TypedDict, total=False):
|
||||||
tradeRate: float
|
tradeRate: float
|
||||||
volumeRate: float
|
volumeRate: float
|
||||||
broker_ts: float
|
broker_ts: float
|
||||||
brokerd_ts: float
|
datad_ts: float
|
||||||
|
|
||||||
# tick-type-classes template for all possible "lowest level" events
|
# tick-type-classes template for all possible "lowest level" events
|
||||||
# that can can be emitted by the "top of book" L1 queues and
|
# that can can be emitted by the "top of book" L1 queues and
|
||||||
|
|
|
||||||
|
|
@ -68,5 +68,5 @@ async def latency(
|
||||||
# This is codified in the per-broker normalization layer
|
# This is codified in the per-broker normalization layer
|
||||||
# TODO: Add more measure points and diffs for full system
|
# TODO: Add more measure points and diffs for full system
|
||||||
# stack tracing.
|
# stack tracing.
|
||||||
value = quote['brokerd_ts'] - quote['broker_ts']
|
value = quote['datad_ts'] - quote['broker_ts']
|
||||||
yield value
|
yield value
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ _quote_dt = [
|
||||||
('Ask', 'f4'),
|
('Ask', 'f4'),
|
||||||
('Size', 'i8'),
|
('Size', 'i8'),
|
||||||
('Volume', 'i8'),
|
('Volume', 'i8'),
|
||||||
# ('brokerd_ts', 'i64'),
|
# ('datad_ts', 'i64'),
|
||||||
# ('VWAP', 'f4')
|
# ('VWAP', 'f4')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue