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
Gud Boi 2026-11-03 09:35:27 -05:00
parent e02a6431e3
commit a8ecbec3f3
13 changed files with 18 additions and 17 deletions

View File

@ -192,7 +192,7 @@ async def stream_messages(
piker_quote: dict = {
'symbol': msg.s,
'last': float(msg.p),
'brokerd_ts': time.time(),
'datad_ts': time.time(),
'ticks': [{
'type': 'trade',
'price': float(msg.p),

View File

@ -131,7 +131,7 @@ async def bars(
return await client.bars(symbol, **kwargs)
async def search_w_brokerd(
async def search_w_datad(
name: str,
pattern: str,
) -> dict:
@ -185,7 +185,7 @@ async def symbol_search(
results.append((
brokername,
await portal.run(
search_w_brokerd,
search_w_datad,
name=brokername,
pattern=pattern,
),

View File

@ -72,6 +72,6 @@ _spawn_kwargs = {
}
# 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.
_infect_asyncio: bool = True

View File

@ -150,7 +150,7 @@ async def stream_quotes(
first_quote = {
'symbol': sym,
'last': last_trade.price,
'brokerd_ts': last_trade.timestamp,
'datad_ts': last_trade.timestamp,
'ticks': [{
'type': 'trade',
'price': last_trade.price,

View File

@ -84,7 +84,7 @@ _spawn_kwargs = {
}
# 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.
_infect_asyncio: bool = True

View File

@ -1086,7 +1086,7 @@ def normalize(
data['tickByTicks'] = [tbt._asdict() for tbt in tbts]
# 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..
# leave it until we do a proper latency study

View File

@ -189,7 +189,7 @@ _search_conf = {
@tractor.context
async def open_symbol_search(ctx: tractor.Context) -> None:
'''
Symbology search brokerd-endpoint.
Symbology search `datad` endpoint.
'''
from .api import open_client_proxies

View File

@ -195,7 +195,7 @@ def normalize(ohlc: OHLC) -> dict:
'''
quote = ohlc.to_dict()
quote['broker_ts'] = quote['time']
quote['brokerd_ts'] = time.time()
quote['datad_ts'] = time.time()
quote['symbol'] = quote['pair'] = quote['pair'].replace('/', '')
quote['last'] = quote['close']
quote['bar_wap'] = ohlc.vwap

View File

@ -896,7 +896,7 @@ async def iter_normed_quotes(
# semantic? can't we just read the ticks with our
# .data.ticktools.frame_ticks()`/
'last': trade_data.price,
'brokerd_ts': last_trade_ts,
'datad_ts': last_trade_ts,
'ticks': [
{
'type': 'trade',

View File

@ -600,10 +600,10 @@ async def sample_and_broadcast(
) -> 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
`brokerd` real-time quote feed which is being sampled to
`datad` real-time quote feed which is being sampled to
a ``ShmArray`` buffer.
'''
@ -743,7 +743,7 @@ async def sample_and_broadcast(
# AND/OR instead of doing a fan out to TCP sockets
# here, we add a shm-style tick queue which readers can
# 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/107
@ -805,7 +805,8 @@ async def sample_and_broadcast(
chan: Channel = ctx.chan
if ctx:
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'|_{ipc_err!r}\n\n'
)

View File

@ -43,7 +43,7 @@ class FeedQuote(TypedDict, total=False):
tradeRate: float
volumeRate: float
broker_ts: float
brokerd_ts: float
datad_ts: float
# tick-type-classes template for all possible "lowest level" events
# that can can be emitted by the "top of book" L1 queues and

View File

@ -68,5 +68,5 @@ async def latency(
# This is codified in the per-broker normalization layer
# TODO: Add more measure points and diffs for full system
# stack tracing.
value = quote['brokerd_ts'] - quote['broker_ts']
value = quote['datad_ts'] - quote['broker_ts']
yield value

View File

@ -303,7 +303,7 @@ _quote_dt = [
('Ask', 'f4'),
('Size', 'i8'),
('Volume', 'i8'),
# ('brokerd_ts', 'i64'),
# ('datad_ts', 'i64'),
# ('VWAP', 'f4')
]