build(agent): new-agents-4#58ba63 iteration
This commit is contained in:
parent
8d1e0eb445
commit
4028ae6868
|
|
@ -26,6 +26,28 @@ class CentralCurator:
|
||||||
merged = []
|
merged = []
|
||||||
for p in plans:
|
for p in plans:
|
||||||
merged.extend(p.deltas)
|
merged.extend(p.deltas)
|
||||||
|
|
||||||
|
# ADMM-lite balancing: attempt to enforce cross-venue coherence by
|
||||||
|
# driving the net delta toward zero. This is a lightweight, deterministic
|
||||||
|
# adjustment suitable for a toy MVP and deterministic replay.
|
||||||
|
if len(merged) > 0:
|
||||||
|
total = sum(d.delta for d in merged)
|
||||||
|
mean_adjust = total / len(merged)
|
||||||
|
# Create adjusted copies to avoid mutating existing deltas
|
||||||
|
adjusted = []
|
||||||
|
for d in merged:
|
||||||
|
adj = StrategyDelta(
|
||||||
|
asset=d.asset,
|
||||||
|
delta=d.delta - mean_adjust,
|
||||||
|
vega=d.vega,
|
||||||
|
gamma=d.gamma,
|
||||||
|
target_pnl=d.target_pnl,
|
||||||
|
max_order_size=d.max_order_size,
|
||||||
|
timestamp=d.timestamp,
|
||||||
|
)
|
||||||
|
adjusted.append(adj)
|
||||||
|
merged = adjusted
|
||||||
|
|
||||||
return PlanDelta(deltas=merged, venue=None, author="curator")
|
return PlanDelta(deltas=merged, venue=None, author="curator")
|
||||||
|
|
||||||
def enforce_with_fallback(self, plans: List[PlanDelta], fallback: Optional["ShadowFallback"] = None) -> PlanDelta:
|
def enforce_with_fallback(self, plans: List[PlanDelta], fallback: Optional["ShadowFallback"] = None) -> PlanDelta:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
DSL Sketch: Core Primitives for DeltaForge MVP
|
||||||
|
|
||||||
|
- Asset
|
||||||
|
- Canonical representation of tradable instruments.
|
||||||
|
- Fields: type (equity, option, future), symbol/underlying, strike, expires
|
||||||
|
- Methods: canonical_id() for stable identifiers
|
||||||
|
|
||||||
|
- MarketSignal
|
||||||
|
- Encapsulates observable market data used by adapters to produce StrategyDelta inputs.
|
||||||
|
- Fields: asset (Asset), price, volatility, liquidity, timestamp
|
||||||
|
|
||||||
|
- StrategyDelta
|
||||||
|
- Local hedge/trade intent for an asset; acts as a primitive building block for plans.
|
||||||
|
- Fields: asset, delta, vega, gamma, target_pnl, max_order_size, timestamp
|
||||||
|
|
||||||
|
- PlanDelta
|
||||||
|
- Incremental set of StrategyDelta decisions for one or more venues.
|
||||||
|
- Fields: deltas (List[StrategyDelta]), confidence, venue, author, timestamp, signature
|
||||||
|
|
||||||
|
- LocalProblem (concept, not yet implemented)
|
||||||
|
- SharedVariables (concept, not yet implemented)
|
||||||
|
- DualVariables (concept, not yet implemented)
|
||||||
|
- AuditLog (concept, not yet implemented)
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- The MVP uses a lightweight, in-process coordination between two venues. The DSL above is:
|
||||||
|
a) lightweight, self-describing, and easily serializable; b) designed so adapters can plug into it without deep coupling.
|
||||||
|
- This document is a living sketch; future iterations may formalize validation, schemas, and a small encoder/decoder for wire transport.
|
||||||
Loading…
Reference in New Issue