docs: align M2 with actual feed buffer

This commit is contained in:
2026-10-24 03:25:31 -07:00
parent d46581f23e
commit 91841cd96c
+18 -15
View File
@@ -12,25 +12,28 @@ and explicit backpressure without silent drop. External stream adapters remain o
scaffold C2. scaffold C2.
## 3. Language & location ## 3. Language & location
TBD · `src/economy/feeds/`. Needs async I/O for streaming data (WebSockets, SSE, RSS polling). **Tcl 8.6 core buffer** · `core/src/economy/feeds.tcl`. V1 provides normalized in-session
Pony actors are a natural fit (async, backpressure-aware). history and explicit capacity backpressure. External WebSocket/SSE/RSS/RPC adapters, subscriptions,
and persistent storage remain separate ingress work.
## 4. Does / does-not ## 4. Does / does-not
- **Does:** ingest live market data from external sources (RSS, price APIs, DEX subgraphs, - **Does now:** accept already-normalized `NormalizedDatum` records; validate confidence;
on-chain event logs); normalize heterogeneous data into a common internal format; distribute retain ordered per-feed in-session history up to a configured capacity; return explicit
to Sims (M3) for prediction and to Traders (M5) for decision-making; ingest Marketplace (M1) `backpressure` instead of silently evicting or dropping data; expose history to native M3
execution data (fills, portfolio state) and feed it back into Sims for calibration; maintain bridges. Current calibrated consumers use `price_tick`, `rss_news`, `dex_pool_state`, and
time-series history within session (ring buffer). `on_chain_event`.
- **Does-not:** predict (Sims do); trade (Marketplace does); filter or editorialize data — it - **Does not now:** open external streams, poll APIs, persist history, maintain subscriptions,
delivers raw, normalized feeds. Interpretation is the consumer's job. transform heterogeneous provider payloads, or synthesize execution fills.
- **Does not conceptually:** predict or trade; interpretation belongs to consumers.
## 5. Interface contract ## 5. Interface contract
- `subscribe(feed_type: FeedType, consumer_id) -> subscription_handle`. - Implemented: `publish(feed_type, source, timestamp, payload, confidence)`.
`FeedType` ∈ { `price_tick`, `rss_news`, `on_chain_event`, `dex_pool_state`, `execution_fill`, - Implemented: `history(feed_type) -> [NormalizedDatum]`.
`portfolio_state` }. - Planned, not implemented: source adapters, subscriptions, time-range queries, persistence, and
- `publish(feed_type, data_point: NormalizedDatum)` — internal; sources push into the pipeline. provider-specific normalization.
- `query_history(feed_type, time_range) -> [NormalizedDatum]` — sims and traders can pull - `FeedType` remains open-ended; the economy currently exercises `price_tick`, `rss_news`,
historical data within the session window. `on_chain_event`, and `dex_pool_state`, with `execution_fill` / `portfolio_state`
reserved for later execution feedback.
- `NormalizedDatum { feed_type, source, timestamp, payload, confidence }` — common shape. - `NormalizedDatum { feed_type, source, timestamp, payload, confidence }` — common shape.
`confidence` ∈ [0.0, 10.0] — data source reliability per position produced (exchange-reported `confidence` ∈ [0.0, 10.0] — data source reliability per position produced (exchange-reported
price = high; RSS sentiment = lower). Sims produce even finer-grained confidence. price = high; RSS sentiment = lower). Sims produce even finer-grained confidence.