[codex] fix strategist controls and restore entrypoints#7
Draft
zd87pl wants to merge 6 commits into
Draft
Conversation
…ions The original targets were too conservative ($0.25/day on $500). Recalibrated all 5 capital tiers x 3 risk levels for 24/7 crypto markets where higher volatility = more edge to capture. New targets (crypto-calibrated): $500 conservative -> $1/day, $31/mo, $1K year-end $500 aggressive -> $4/day, $135/mo, $9K year-end $5K moderate -> $25/day, $807/mo, $31K year-end $50K aggressive -> $350/day, $11K/mo, $638K year-end Added PortfolioDirective projection fields: - projection_daily_pnl, projection_weekly_pnl - projection_monthly_pnl, projection_monthly_balance - projection_yearly_pnl, projection_yearly_balance - projection_drawdown_dollar Added _compute_projections() using compound growth (365 trading days for crypto). Projections shown in reasoning text and in new Advisor dashboard "Compound Growth Projections" card with weekly/monthly/yearly/max-risk columns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace Alpaca dependency for crypto data with CCXT — 100+ exchanges, no API key needed for public OHLCV data. New: src/data/ingestion/ccxt_client.py - Drop-in replacement for AlpacaDataClient (same interface) - download_bars() / download_latest() with MultiIndex return format - Automatic pagination for large date ranges (>1000 candles) - Parquet caching for repeated queries - Symbol normalization: accepts both "BTCUSDT" and "BTC/USDT" - Timeframe mapping: "1Day" -> "1d", "1Hour" -> "1h", etc. - get_ticker() for live prices, list_symbols() for discovery - Default exchange: Kraken (no geo-restrictions) Data source selection in main.py: DATA_SOURCE=auto -> tries CCXT first, falls back to Alpaca DATA_SOURCE=ccxt -> CCXT only DATA_SOURCE=alpaca -> Alpaca only Tested: 91 BTC/USD daily candles from Kraken, multi-symbol ETH+SOL, live ticker at $74K, all free, zero API keys. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. _init_llm_client() imported from src.agents which triggered loading
RAGSystem -> faiss (not installed) -> ImportError -> llm_client=None.
Fix: import directly from src.agents.llm_client_factory.
2. pydantic Config only read .env, not .env.local — so API keys saved
via the dashboard Settings tab were invisible to ClaudeClient.
Fix: Config.env_file now reads both (".env", ".env.local").
3. ClaudeClient had a hardcoded model whitelist (only old claude-3 IDs)
that rejected newer models with ValueError.
Fix: accept any model ID, log a warning for unknown ones.
Also: main.py now loads .env.local into os.environ at startup before
any subsystem initializes, ensuring dashboard-saved keys are available
to ClaudeClient, CCXT, and all other components.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. settings_manager.get() returned "" instead of cached value because os.environ had empty string from .env (ANTHROPIC_API_KEY=), which passed the `is not None` check. Fix: also skip empty strings. 2. src/agents/__init__.py imported RAGSystem eagerly, which required faiss. Even direct imports of llm_client_factory triggered __init__.py. Fix: lazy-import RAGSystem with try/except ImportError. 3. pydantic Config rejected extra keys from .env.local (BROKER, DATA_SOURCE, CCXT_EXCHANGE, etc.) with "extra_forbidden" error. Fix: add extra="ignore" to SettingsConfigDict. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ault) No API key needed. Uses the local `claude` CLI tool which already has authentication via Claude Code. Default model: claude-opus-4-6. New: src/agents/claude_cli_client.py - Drop-in replacement for ClaudeClient (.complete() interface) - Shells out to `claude -p --model claude-opus-4-6 --output-format text` - Auto-detected: if `claude` CLI is on PATH, it's used automatically - 120s timeout, compatible with all pipeline consumers Updated: src/agents/llm_client_factory.py - Auto-detect priority: claude-cli (if on PATH) > claude API > mlx - LLM_BACKEND=claude-cli to force CLI mode - Skips config model override for CLI (uses opus 4.6 by default) Updated: src/autotrader/settings_manager.py - LLM Backend options: claude-cli (default), claude, mlx Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
What changed
This PR tightens the new strategist/autotrader integration and restores a few broken repo entrypoints and runtime paths.
It includes:
hourly/4h/dailyexperiment cadence instead of collapsing everything to hourlyAUTO_REASSESSandREASSESS_INTERVAL_MINaffect orchestrator behaviorWhy
The merged strategist work introduced a few integration bugs that would materially change runtime behavior:
dailyand4hdirectives would actually run hourlySeparately, the local publish/run surface still had obvious broken paths from the earlier review pass, including dead console-script targets and a CLI syntax error.
Impact
Validation
python -m compileall -q src main.py deploymentpython -m pytest -q