Two small follow-ups from the session:
- kevin-analyze.sh: always cp the local analyze_kevin_video.py into
the pod before exec, so the wrapper works even before CI ships an
image with scripts/ baked in (saw this hit the user with
ModuleNotFoundError on stale images).
- reanalyze_kevin_videos.py: switch from DELETE+INSERT to
append-only. The old behaviour violated the FK constraint on
kevin_signal_bridge_state.mention_id; the new behaviour adds a
fresh v2 analysis alongside the v1 row and lets the API surface
the latest. Old v1 rows preserved for audit.
User reported that the old prompt could emit 'sell' on backward-looking
capitulation ('Kevin sold after a 20% drop') — exactly the false signal
to avoid. v2 reframes every per-ticker field as forward-looking and
adds an explicit expected_move enum for the trading bot to weight.
Changes:
- New ExpectedMove enum (up_strong/up_mild/sideways/down_mild/
down_strong/unknown) in shared/schemas + shared/models, with
matching kevin_expected_move Postgres enum + column on
kevin_stock_mentions (migration e5f6a7b8c9d0). NOT NULL with
server_default 'unknown' so existing rows backfill cleanly.
- SYSTEM_PROMPT rewritten: action semantics now require a FORWARD
view; reactive sells get downgraded to 'watch' or skipped; the
rationale_quote must contain forward reasoning. Quality
checklist updated.
- _ANALYSIS_TOOL JSON schema gains expected_move (required).
- prompt_version v1 → v2 in config + infra + ad-hoc CLI default.
- pipeline.py persists ticker.expected_move into the new column.
Migration safety: the column is NOT NULL DEFAULT 'unknown' so 96
existing mentions auto-fill with 'unknown' (no forward call known
for backward analyses) without breaking any reads.
Cost to backfill the 27 existing analyses with v2 prompt: ~$3 LLM
spend. A follow-up reanalyze script will replay them after this
ships.
Given a YouTube video ID or URL, runs the same caption-extraction +
LLM-analysis pipeline the watcher uses in prod, then prints the
extracted tickers + actions sorted by action priority and conviction
descending. No DB writes, no Redis publish — strictly observational.
Two entry points:
- scripts/analyze_kevin_video.py — pure Python; needs yt-dlp +
Anthropic OAuth token in env. Local laptop yt-dlp tends to hit
"Sign in to confirm you're not a bot" rate-limits; running inside
a cluster pod avoids this.
- scripts/kevin-analyze.sh — wrapper that finds the running
trading-bot-workers pod and execs the Python script in the
meet-kevin-watcher container. Easiest invocation.
Example:
$ ./scripts/kevin-analyze.sh poUJIZRmFew
=== Meet Kevin analysis — poUJIZRmFew ===
Market outlook: bullish
TICKERS (12):
SYMBOL ACTION CONV HORIZON RATIONALE
APPF buy 85.0% long_term Apploven's looking fantastic ...
SOX buy 80.0% months Semiconductor ETF momentum ...
...
- Point Ollama to local instance via host.docker.internal, use gemma3 model
- Remove Docker Ollama service (using host's Ollama instead)
- Add company-name-to-ticker mapping (Apple→AAPL, Tesla→TSLA, etc.) for RSS articles
- Lower signal thresholds for faster feedback with paper trading:
- FinBERT confidence: 0.6→0.4, signal strength: 0.3→0.15
- News strategy: article_count 2→1, confidence 0.5→0.3, score ±0.3→±0.15
- Fix market data BarSet access bug (BarSet.__contains__ returns False incorrectly)
- Fix market data SIP feed error by switching to IEX feed for free Alpaca accounts
- Fix nginx proxy routing for /api/auth/* to api-gateway /auth/*
- Add seed_sample_data script
- Update tests for new thresholds and alpaca mock modules
Add integration tests for the news pipeline (test_news_pipeline.py) and
trading flow (test_trading_flow.py) using real Redis with mocked FinBERT
and Alpaca. Add seed_strategies.py to insert default strategies (momentum,
mean_reversion, news_driven) with equal weights. Add smoke_test.sh for
end-to-end stack validation. Update pyproject.toml with integration marker
and scripts package discovery.