Conversation
…sed guardrails
- New 'llm' strategy: sends recent OHLCV + indicators to the Anthropic API,
maps schema-validated structured output to a Signal; any error (API
failure, refusal, validation, missing key) fails closed to HOLD
- Cost containment, three independent layers:
1. scheduler plan: llm runs only on the capped scheduler.llm_symbols
cohort (never the general watchlist, entries and exits alike)
2. daily call budget circuit breaker inside the strategy
(LLM_MAX_DAILY_CALLS, default 40)
3. notification enrichment never re-invokes the llm strategy
- config.json: 10-symbol llm cohort carved out of the general watchlist
(disjoint sets for clean per-strategy attribution); llm NOT enabled by
default — add 'llm' to scheduler.strategies to activate
- Model selectable at runtime via SSM ai_model (default claude-opus-4-8);
API key via SSM SecureString anthropic_api_key
- Structured LLM_METRIC log lines (action, confidence, latency, tokens)
for CloudWatch Logs Insights analysis
- 16 new tests; full suite 91 passed
Every generate_signal() result — HOLDs included — is appended to a signals table with the price at decision time, an inputs tag, and a context snapshot of non-reproducible data (LLM model id + the indicator values it was shown). Executed trades and risk rejections alone are a survivorship-biased view; this is the unbiased decision record any future model-driven arbitration must be measured against. Kept in its own SQLite file synced to S3 only by the daily scan, so it stays out of the per-minute trades.db version churn. Fail-open: a log write failure never interrupts the scan.
vishwakt
force-pushed
the
feat/llm-strategy
branch
from
September 2, 2026 06:41
c5e2994 to
dd81f6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parked for now (no spare paper account to run it) — kept current with
mainand complete for the talk.LLM strategy
llmstrategy: schema-validated Claude API signals behind the sameStrategyABC as the 7 technical strategies; fails closed to HOLD on any error (API failure, refusal, validation, missing key)LLM_MAX_DAILY_CALLS, default 40), no LLM re-invocation in notification enrichmentai_model(defaultclaude-opus-4-8); structuredLLM_METRIClog lines for CloudWatch Logs InsightsSignal log (
signals.db)inputstag, and acontextsnapshot of non-reproducible data (LLM model id + indicators shown)trades.dbversion churnTest plan
sam validate --lintpasses