idea159-arbsphere-federated.../arbsphere/primitives.py

52 lines
1.2 KiB
Python

from dataclasses import dataclass
from typing import List, Tuple, Dict, Any
@dataclass(frozen=True)
class LocalArbProblem:
asset_pair: Tuple[str, str]
target_mispricing: float
liquidity_budget: float
latency_budget: float
# Optional identifiers for cross-system tracing; kept optional to remain
# backwards-compatible with tests that instantiate with the original fields.
id: str | None = None
venue: str | None = None
@dataclass
class SharedSignals:
deltas: List[float]
cross_venue_corr: float
liquidity_availability: Dict[str, float]
latency_proxy: float
@dataclass
class DualVariables:
"""Federated optimization dual variables (shadow prices per asset pair).
This is a lightweight stand-in for the real project's duals used by the
ADMM-like coordinator to balance cross-venue objectives.
"""
shadow_prices: Dict[str, float]
@dataclass
class AuditLogEntry:
ts: float
event: str
details: Dict[str, Any]
signature: str
@dataclass
class AuditLog:
entries: List[AuditLogEntry]
@dataclass
class PrivacyBudget:
"""Simple privacy budget per signal source or metric."""
budgets: Dict[str, float]