#!/usr/bin/env python3 """Two-venue ArbSphere Demo (Toy MVP). This script demonstrates a minimal end-to-end flow using the existing ArbSphere primitives and two starter adapters (price feed and broker). """ from __future__ import annotations import json from idea159_arbsphere_federated_cross.core import LocalArbProblem, SharedSignals from idea159_arbsphere_federated_cross.solver import admm_step from idea159_arbsphere_federated_cross.energi_bridge import EnergiBridge from idea159_arbsphere_federated_cross.adapters.mock_price_feed import MockPriceFeedAdapter from idea159_arbsphere_federated_cross.adapters.mock_broker import route_plan_delta def main(): # Starter adapters produce a LocalArbProblem and SharedSignals for two venues price_adapter = MockPriceFeedAdapter() local, signals = price_adapter.emit() # Generate a deterministic PlanDelta for this toy pair delta = admm_step(local, signals) # Translate to a canonical IR representation ir = EnergiBridge.to_ir(local, signals, delta) print("Canonical IR payload:") print(json.dumps(ir, indent=2, default=str)) # Simulate routing the plan delta through a broker adapter ack = route_plan_delta(delta) print("Broker ack:") print(json.dumps(ack, indent=2, default=str)) if __name__ == "__main__": main()