idea159-arbsphere-federated.../arbsphere/adapters/data_feed_adapter.py

38 lines
1011 B
Python

"""Toy Data Feed Adapter for ArbSphere MVP.
Simulates a venue data feed producing LocalArbProblem and SharedSignals.
In a real deployment this would subscribe to market data across venues.
"""
from __future__ import annotations
import time
from typing import Optional
from arbsphere.primitives import LocalArbProblem, SharedSignals
def synth_local_arb_problem() -> LocalArbProblem:
return LocalArbProblem(
venue_id="VENUE-A",
asset_pair=["AAPL", "MSFT"],
target_mispricing=0.25,
liquidity_budget=1_000_000.0,
latency_budget_ms=5,
)
def synth_shared_signals() -> SharedSignals:
return SharedSignals(
version=1,
price_delta=0.12,
cross_venue_correlations={"VENUE-A|VENUE-B": 0.85},
available_borrow_liquidity=500_000.0,
)
def stream_once() -> tuple[LocalArbProblem, SharedSignals | None]: # pragma: no cover - integration helper
lp = synth_local_arb_problem()
ss = synth_shared_signals()
return lp, ss