feat: May 2026 API updates — trading system audit pipeline (1057 tests)#28
feat: May 2026 API updates — trading system audit pipeline (1057 tests)#28redact22 wants to merge 19 commits into
Conversation
…lation Request translation (messages, tools, images, generation config), streaming SSE response translation, non-streaming JSON translation, tool use roundtrip with id→name mapping. Auto-routing: Haiku→Gemini primary, Sonnet/Opus→DeepSeek primary with cross-failover. Live switching via /_proxy/mode endpoint. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Alpha-parser: fix 3 engine.mjs bugs (dead code, sub-million display, false-positive low_holders), add hermetic test layer with injectable fetch, remove dead live mode CLI stub, add mock fixtures for offline tests. Audit tools: implement stop-loss/take-profit/SMA crossover exit logic in backtester, make startingEquity configurable across all functions, thread --equity CLI flag through to audit(). Gemini translator: map SAFETY→safety_blocked and RECITATION→recitation_blocked as distinct stop reasons, add console.warn for silently dropped unknown roles. Add package.json with "type": "module" and test scripts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
111 tests, 27 suites, 0 failures. Covers: Gemini translator (16), model-proxy routing/remap/sanitization (52), audit schemas/performance/ backtest (22), alpha-parser token scanning/audit/DEX integration (21). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…s pass Quant audit fixes across 5 modules: - gemini-translator: tool_result content extraction, FunctionResponse id field, thinking_level mapping, content_block_start input, output_config handling - backtest: look-ahead bias, SMA window alignment, exit_reason tracking, double-counted slippage - perf-audit: Sortino Infinity cap, trades type guard, equity curve start, unused param cleanup - alpha-parser: RugCheck fallback activation, API failure logging, parallel batch processing (concurrency=5) - model-proxy: adaptive thinking normalization, sampling param stripping, output_config migration, assistant prefill filter, OAuth key warning - start-proxy: dead code removal, --mode flag bounds check Tests: 143 pass, 0 fail across 32 suites (+53 new tests). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…8 tests) - proxy/observability.js: structured JSON logging, request metrics, Prometheus output, latency histograms, health reports - proxy/observability.test.js: 18 tests across 5 suites - proxy/circuit-breaker.js: 3-state breaker, retry with jitter, token bucket rate limiter, backend health tracker, fallback selection - audit/advanced-backtest.mjs: Monte Carlo simulation, walk-forward optimization, strategy comparison (Welch's t-test), drawdown analysis, equity curve metrics - proxy/model-proxy.js: 106 tests — normalizeThinkingBlocks, stripSamplingParamsOnThinking, normalizeOutputConfig, filterAssistantPrefill, warnOAuthToken, stripDeepSeekUnsupportedFields, mapEffortToReasoning, ANTHROPIC_THINKING_BACKENDS - shell scripts: May 2026 pricing, Gemini benchmark, auto-mode docs Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CircuitBreaker, withRetry, TokenBucket, BackendHealthTracker, selectFallback — all 7 suites green. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…er (264 tests) - model-proxy.js: structured JSON logging replaces console.log, per-request correlation IDs, /_proxy/health + /_proxy/metrics endpoints, CircuitBreaker per backend, withRetry wrapping, BackendHealthTracker integration, graceful fallback selection - cost-tracker.js: per-session cost tracking, token counting, backend comparison, formatted reports, active DeepSeek 75% discount - cost-tracker.test.js: 24 tests covering computeCost, createCostTracker, savings comparison Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…o signals (530 tests) - audit/microstructure.mjs: OrderBookAnalyzer (bid/ask imbalance, spoofing detection, iceberg orders, volume footprint, absorption, VPIN toxicity) + 56 tests - audit/liquidity-flow.mjs: VolumeProfile (VAP, value area, high/low volume nodes, skew), OrderFlowMomentum (momentum, absorption, cumulative delta), VolatilityEddyDetector (eddies, turbulence index) + 43 tests - audit/signal-fusion.mjs: SignalFusionEngine (weighted/bayesian/voting fusion, composite scores, BUY/SELL/HOLD decisions, correlation matrix), SignalQualityAnalyzer (accuracy tracking, weight calibration) + 80 tests - alpha-parser/crypto-signals.mjs: HMAC-signed signal envelopes, verification, provenance chains, replay guard, key derivation, signal bundles + 39 tests - audit/advanced-backtest.test.js: 48 tests (Monte Carlo, walk-forward, strategy comparison, drawdown analysis, equity curve metrics) Inspired by Leonardo da Vinci's polymathic approach — anatomical market dissection, fluid-dynamics liquidity modeling, cross-domain signal fusion. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Zone Detector: order blocks, FVGs, breaker zones, liquidity voids, streaming mode. Decision Graph: record/link/query trading decisions, pattern mining, graph queries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Classifies 8 market regimes (trending, ranging, accumulation, distribution, breakout, breakdown, volatile) with confidence, strength, and actionable trading parameters (stop multiplier, position sizing, TP aggressiveness). Includes streaming classifier with regime-change detection and multi-TF confluence. 45 tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wires Zone Detector + Market Regime + Signal Fusion + Order Book Microstructure into a single `run()` call that produces complete trading decisions (BUY/SELL/HOLD) with confidence, rationale, zone context, and strategy parameters. Includes `runBacktest()` for historical walk-forward simulation with stop-loss/take-profit, cooldown bars, and per-regime PnL stats. 37 tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Swing points, BOS/CHoCH, order blocks, mitigation blocks, breaker blocks, imbalance/FVG, inducement detection, SMC trend analysis, liquidity levels. Zero deps, ESM. Built via parallel agent dispatch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…86 tests) Trade CLI: single-command pipeline (--analyze, --backtest, --live) Multi-TF Confluence: zone clustering, heatmap, confluence scoring (75 tests) Terminal Dashboard: ANSI renderer, colorize, live streaming (69 tests) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The orchestrator passes { minConfidence } to getDecision() but the
method ignored it and always used the constructor default (0.6).
Now accepts opts.minConfidence to allow dynamic threshold tuning.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…to-end pipeline Optimizer: gridSearch, hillClimb, optimize, optimizePerRegime, sensitivity (18 tests) Grail Demo: --quick, --optimize, --full modes with dashboard + verdict (14 tests) Orchestrator: wired confluence zoneConfluenceScore into signal pipeline Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ation Previously signalsFromZones emitted both support AND resistance signals, which canceled in the fusion engine (~0 composite score). Now only the dominant direction is emitted when the strength difference exceeds the significance threshold (0.15). RR signal also requires clear asymmetry (>1.5 or <0.67). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ilures Binance OHLCV fetcher with geo-block detection, synthetic fallback caching, 7 trading presets (BTC/ETH/SOL/MBT/DEFAULT/AGGRESSIVE/SCALPING), and a multi-symbol optimizer scanner with ranking. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The orchestrator emitted signals with sources 'zone-detector', 'market-regime', 'confluence' but SignalFusionEngine silently dropped them (source not in VALID_SOURCES) and assigned zero weight (not in DEFAULT_WEIGHTS). Every backtest since the orchestration rewrite produced 0 trades. Live Scanner ties datafeed + optimizer + presets + grail into a single pipeline command. 3-symbol scan completes in 2.3s with ranked GRAIL verdicts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PaperTrader: simulated live trading with position management, SL/TP, equity curve, Sharpe/maxDD/PF metrics, JSON export. MTF scanner: single-symbol multi-timeframe analysis with directional conviction scoring. Correlation: Pearson matrix, portfolio variance, diversification scoring. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
deepclaude/proxy/start-proxy.js
Lines 15 to 18 in bf09907
The startup mode detection treats process.argv[2] and [3] as <targetUrl> <apiKey> unconditionally, so flag-based invocations like node proxy/start-proxy.js --mode auto or --port 3300 are misclassified as legacy mode (targetUrl='--mode', apiKey='auto') and then fail when new URL('--mode') is evaluated. This breaks the standalone control-server path that should accept --mode/--port options.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -254,7 +549,7 @@ export function startModelProxy({ targetUrl, apiKey, startPort = 3200, backends, | |||
| clientRes.end(JSON.stringify(result)); | |||
| return; | |||
| } | |||
| console.log(`[MODEL-PROXY] Mode switched: ${result.previous} → ${result.mode}`); | |||
| log.info(`Mode switched: ${result.previous} → ${result.mode}`, { correlationId: cid, reqId }); | |||
There was a problem hiding this comment.
Initialize request IDs before /_proxy/mode logging
A POST /_proxy/mode request can crash the proxy because the handler logs with cid and reqId before those const bindings are initialized on this code path. The control-endpoint branch returns before reaching the later declarations, so the callback hits a temporal-dead-zone ReferenceError and terminates the Node process, making backend switching unusable and allowing a single request to bring down the proxy.
Useful? React with 👍 / 👎.
Summary
feature/may-2026-api-updatesaudit/directory (zero changes to main CLI)What shipped
Data & Pipeline
Trading Engine
Scanners & Analysis
Critical Fixes
Test plan
node --test audit/*.test.js— 1057 tests, 0 failuresnode audit/live-scanner.mjs --symbols BTC-USD,ETH-USD --days 10node audit/trade.mjsintegrationdeepclaude.ps1,deepclaude.sh,proxy/)🤖 Generated with Claude Code