32 lines
962 B
Python
32 lines
962 B
Python
from __future__ import annotations
|
|
from dataclasses import dataclass, asdict
|
|
from typing import Dict, Any
|
|
import json
|
|
|
|
from .core import LocalProblem, PlanDelta
|
|
|
|
|
|
@dataclass
|
|
class LocalSolver:
|
|
name: str = "toy-solver"
|
|
|
|
def solve(self, problem: LocalProblem) -> PlanDelta:
|
|
# Minimal toy objective: compute a simple plan delta based on price_target
|
|
delta = {
|
|
"contract_id": f"{problem.id}:{problem.venue}",
|
|
"action": "place_order",
|
|
"asset": problem.asset,
|
|
"price_target": problem.price_target,
|
|
"tolerance": problem.tolerance,
|
|
"notes": "toy-arbitrage-step"
|
|
}
|
|
import datetime
|
|
timestamp = datetime.datetime.utcnow().isoformat() + "Z"
|
|
return PlanDelta(
|
|
delta=delta,
|
|
timestamp=timestamp,
|
|
author=self.name,
|
|
contract_id=f"{problem.id}:{problem.venue}",
|
|
privacy_budget=0.0,
|
|
)
|