Claude/continue previous work vvwws6#346
Open
harrisonm23-byte wants to merge 30 commits into
Open
Conversation
Adds examples/analyze_market.py with three modes: - forecast: probabilistic forecast with sample-path quantile bands, plot + CSV - backtest: walk-forward model evaluation (directional accuracy, MAE/RMSE/MAPE) plus a forecast-driven long/flat strategy vs buy-and-hold - signal: decision-support JSON report (trend, support/resistance, implied return, dispersion-based confidence) Supports local model/tokenizer dirs for offline use and configurable CSV column mapping. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Snkpa9NxHpLnBphcE5Luy8
…_market Pulls daily OHLCV for US tickers/ETFs into the CSV schema analyze_market.py expects, sourcing stockanalysis.com with a Nasdaq API fallback. Enables running Kronos forecast/signal/backtest on live-fetched symbols like SPY and QQQ.
analyze_market backtest now reports grouped stats: directional (terminal + per-step accuracy, up/down precision, return correlation), accuracy (terminal MAPE mean/median/p90/worst, path MAPE, MAE/RMSE), bias (signed error, predicted vs actual return), strategy (win rate, profit factor, Sharpe, max drawdown), and naive baselines (buy-and-hold, majority-class direction). fetch_market_data gains an --interval flag for intraday bars (1m/5m/15m/30m/1h) via Alpha Vantage (--av-key / ALPHAVANTAGE_API_KEY), with --months for historical intraday. Daily remains keyless via stockanalysis/nasdaq.
Alpha Vantage moved intraday behind premium. Alpaca's free IEX feed provides 1m/5m/15m/30m/1h bars with generous rate limits via paper-trading keys. The fetcher now paginates via next_page_token for full history depth.
…ng symbols Adds fetch_alpaca_crypto() using the v1beta3 crypto endpoint, with auto-detection of crypto symbols and proper pagination. Output filenames now sanitize / characters so BTC/USD writes to BTCUSD_1h.csv instead of creating subdirectories.
New 'aggregate' mode forecasts N low-timeframe bars then rolls them up into candles at multiple aggregation levels (e.g. 5m -> 15m -> 30m -> 1h -> 2h), scoring each level on candle color (direction), close accuracy, high/low range error, and price-zone overlap (IoU). Tests whether the model reconstructs the coarser-timeframe candle's shape even when individual bars are noisy -- the 'does the paragraph match even if the words differ' framing.
- research/FINDINGS.md: frozen baseline grid, keeper specs, context grade, validated principles, debunked list, goal spec, loop state - engine.py: daily-bar backtest engine (next-open fills, stop/regime/hold support) - 26 study scripts: strategy suite, forensics, intraday scans, options sim, band-walk/trend-break studies, context dictionary, anomaly tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
…dies Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
…t debunk Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
…alidation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
…nal, not directional
…(downside travels)
…track 2 untested)
…tries lose even in native habitat
…interaction Section 10 in FINDINGS.md. Key findings: - Down-down days recover 57% O→C, but first 30 min determines camp (70% bounce vs 33% flush) - Gap-fill probability scales linearly with magnitude (ladder quantified) - Adding down-down context to IBS doesn't improve it (decayed in 2021-26 half) - Not deployable as trades, but valuable as descriptive market laws Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
Entry 75.22 (7/14), exit est 71.23 (7/22 open - 2bp slip). Worst mark -10.2% on 7/20. Two consecutive A-sleeve losses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
TQQQ gapped down from 71.37 close to 69.77 open on exit day. Actual fill 69.77 - 2bp = 69.63, ret = -7.43%. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A6hZxScXSnjZkT7h87gMe8
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.
No description provided.