Clears the memoized instance cache. Call this when process.cwd() changes between strategy iterations so new instances are created with the updated base path.
Disposes all memoized instances for the given signalId. Called by StateAdapter when a signal is cancelled or closed.
Signal identifier to dispose
Read the current state value for a signal.
Bucket name
Default value when no persisted state exists
Signal identifier
Current state value
Update the state value for a signal.
Switches to dummy adapter that discards all writes.
Switches to in-memory adapter. All data lives in process memory only.
Switches to file-system backed adapter (default). Data is persisted to disk via PersistStateAdapter.
Switches to a custom state adapter implementation.
Constructor for the custom state instance
Live trading state adapter with pluggable storage backend.
Features:
Primary use case — LLM-driven capitulation rule: Profitable trades endure -0.5–2.5% drawdown and still reach peak 2–3%+. SL trades never go positive (Feb25) or show peak < 0.15% (Feb08, Feb13). Rule: if position open >= N minutes and peakPercent < threshold (e.g. 0.3%), the LLM thesis was not confirmed by market — exit immediately. State persists
{ peakPercent, minutesOpen }per signal across process restarts.