From 2d7cc3767c08d1c592bb0b1be2ae6b5477509e44 Mon Sep 17 00:00:00 2001 From: agent-dd492b85242a98c5 Date: Mon, 20 Apr 2026 15:03:36 +0200 Subject: [PATCH] build(agent): new-agents-3#dd492b iteration --- mercurymesh/__init__.py | 8 ++++++++ mercurymesh/bridge_ir.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 mercurymesh/bridge_ir.py diff --git a/mercurymesh/__init__.py b/mercurymesh/__init__.py index e1a9b0e..4c6b271 100644 --- a/mercurymesh/__init__.py +++ b/mercurymesh/__init__.py @@ -1,8 +1,14 @@ """MercuryMesh Core Primitives Public API for lightweight MVP of the privacy-preserving market data federation. + +This package also exposes a small canonical bridge utility to translate +MercuryMesh primitives to a vendor-agnostic Interoperability Registry (IR) +representation. The bridge is intentionally lightweight and intended for MVP +interop demos and testing. """ from .contracts import MarketSignal, AggregatedSignal, PlanDelta, PrivacyBudget, AuditLog, ProvenanceProof +from .bridge_ir import to_ir_market_signal, to_ir_aggregated_signal __all__ = [ "MarketSignal", "AggregatedSignal", @@ -10,4 +16,6 @@ __all__ = [ "PrivacyBudget", "AuditLog", "ProvenanceProof", + "to_ir_market_signal", + "to_ir_aggregated_signal", ] diff --git a/mercurymesh/bridge_ir.py b/mercurymesh/bridge_ir.py new file mode 100644 index 0000000..afbcf0d --- /dev/null +++ b/mercurymesh/bridge_ir.py @@ -0,0 +1,36 @@ +from __future__ import annotations + +from typing import Dict + +from .contracts import MarketSignal, AggregatedSignal + + +def to_ir_market_signal(ms: MarketSignal) -> Dict[str, object]: + """Translate a MarketSignal to a canonical IR-like dict. + + This is a lightweight representation suitable for interoperability tests + and demonstrations. It does not alter the original data model; it's a + serializable view suitable for cross-venue adapters. + """ + return { + "local_context": { + "venue": ms.venue_id, + "instrument": ms.symbol, + "timestamp": ms.timestamp.isoformat(), + "features": ms.features, + "version": ms.version, + } + } + + +def to_ir_aggregated_signal(agg: AggregatedSignal) -> Dict[str, object]: + """Translate an AggregatedSignal to a canonical IR-like dict.""" + return { + "aggregated": { + "venues": agg.venues, + "feature_vector": agg.feature_vector, + "privacy_budget_used": agg.privacy_budget_used, + "nonce": agg.nonce, + "merkle_proof": agg.merkle_proof, + } + }