Commit Graph
313 Commits
Author SHA1 Message Date
jackyu66git 02a52c04dd feat: 所有页面接入 Google Analytics (G-LVVXH3TL04) 2026-07-02 15:38:31 +08:00
jackyu66git 19c8f86862 docs: API 手册新增 Onchain Metrics 专题 + endpoints 表更新 2026-07-02 15:19:45 +08:00
jackyu66git ffe7074fef data_provider: 新增链上指标模块 (btc_netflow/stablecoin_supply/etf_flow/mvrv_zscore)
- onchain_metrics.py: 独立模块,CoinMetrics/CoinGecko/Farside 免费数据源
- main.py: 集成后台线程 + REST API (/api/onchain/metrics, /latest, /available)
- requirements.txt: 添加 requests 依赖
- 5分钟自动刷新,CSV 落盘到 data/onchain/
2026-07-02 15:09:02 +08:00
jackyu66git 7b91f459d7 scheduler: auto-detect new signals once per day, deduplicate existing
- scheduler tick runs detect after fetch+score (once per UTC day)
- ChanSignalDetector skips already-recorded signals
- Prevents duplicate signal_features entries on repeated runs
2026-06-24 19:19:40 +08:00
jackyu66git 3c72aa1310 chan_integration: auto-detect BSP signals from daily+4h Chan pipeline
- ChanSignalDetector: runs TF_DF pipeline on historical OHLCV
- Extracts B1/B2/B3/S1/S2/S3 with entry price, date, signal grade
- Populates signal_features via SignalTracker with forward outcomes
- CLI: python main.py detect --from 2024-01-01
- 15 signals detected (5 daily + 10 4h), all directionally correct
- Expectancy API now returns real conditional probabilities
2026-06-24 19:19:11 +08:00
jackyu66git 8d916371e2 backfill: historical breadth + regime computation from TOP50 OHLCV
- Step 1: fetch BTC OHLCV
- Step 2: fetch TOP50 daily data → compute breadth per date → store breadth_daily
- Step 3: compute Price/Breadth/OI/Vol → detect regime → store regime_history
- 175 days backfilled (2026-01-01 to 2026-06-24)
2026-06-24 18:37:20 +08:00
jackyu66git 7e19c9858e scheduler: auto fetch+score every 60min, integrated into web and CLI 2026-06-24 18:35:47 +08:00
jackyu66git efb721b39f fix: persist regime to DB in shared _build_state, deduplicate save logic
- _build_market_state (CLI) now saves regime_history automatically
- _build_state (web) now saves regime_history automatically
- Remove duplicate regime save from cmd_score
- Remove unused imports (timedelta, get_connection)
- Fix: web dashboard never updated regime_history table
2026-06-24 18:31:00 +08:00
jackyu66git 7813e319b4 web: professional trading-terminal redesign — dark theme, chart grid, progress bars 2026-06-24 18:28:40 +08:00
jackyu66git f391020f78 web: fix dark theme readability — explicit bright colors for all factor values 2026-06-24 18:27:41 +08:00
jackyu66git 0ba5b3bd71 chanmacro: add web dashboard (Flask + Chart.js, port 8124)
- /api/state: current market state with all factor scores
- /api/history: regime + breadth history for charts
- /api/expectancy: signal expectancy query
- Bootstrap 5 + Chart.js dark theme, Chinese UI
- Factor cards, regime timeline, breadth chart, expectancy table
2026-06-24 18:25:33 +08:00
jackyu66git 50a609f7b9 chanmacro: connect to production provider, fix Breadth symbol list and regime crash
- Change provider_url to https://provider.jackyu66.com
- Update top50_symbols to match provider's actual 20 symbols
- Fix cmd_score crash: all_scores keys are already strings, not enums
- Add .gitignore to exclude data/ directory
2026-06-24 18:23:27 +08:00
jackyu66git 48e69179b3 data_provider: add /api/derivatives endpoint documentation 2026-06-24 17:47:42 +08:00
jackyu66gitandClaude 71951019fb chanmacro: Signal Expectancy Engine V1 — Market Memory System
Phase A-C complete: 4 core factors, regime detection, signal tracking, Bayesian expectancy.

chanmacro/ (32 files, ~4000 lines):
- models: 12 enums + 15 Pydantic v2 models (DateAwareModel, MarketStateVector, etc.)
- fetchers: OHLCV + Breadth (from data_provider) + Derivatives (new endpoint)
- scoring: Price Structure / Breadth (quantile buckets) / OI Matrix (5 discrete states) / Volatility Regime
- regime_detector: 3-state (TREND/RANGE/PANIC), factor-locked (Price+Breadth+Vol), versioned, 2-day confirmation
- expectancy: SignalTracker (record+outcomes), TimeDecay (half-life=180d), BayesianExpectancyEngine (Empirical Bayes, Leveled, SufficiencyGuard)
- validation: FactorValidator (IC/ICIR/Hit Ratio), RegimeValidator (MI/KL/ANOVA), TransitionValidator (stability)
- CLI: fetch|score|regime|track|backfill|expectancy|validate|serve
- tests: 52 passing (models, scoring, regime, expectancy)

data_provider:
- /api/derivatives endpoint: funding rate, OI, OI change, basis
- _derivatives storage: same persist pattern as K-line (merge→lock→snapshot→atomic write)
- background refresh every 60s

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-24 17:44:55 +08:00
jackyu66git 34040575c1 bsp_monitor: fetcher limit=1000, engine/main tweaks 2026-06-04 12:51:58 +08:00
jackyu66git e1116edb7b 更新了本地数据拉取 2026-05-26 14:49:31 +08:00
jackyu66gitandClaude Opus 4.7 8bc23c0507 notify: 移除持久化去重,BSP 由新笔确认驱动不重复
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:46:10 +08:00
jackyu66gitandClaude Opus 4.7 c75d5e11fc notify: Telegram token/chatid 直接硬编码
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:45:41 +08:00
jackyu66gitandClaude Opus 4.7 8eb50e3eae bsp_monitor: 多周期 BSP 推送 (1m/5m/15m/1h),中枢监控代码保留但暂停
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:42:53 +08:00
jackyu66gitandClaude Opus 4.7 42296ef971 refactor: BSP推送提取公共函数 + 清理
- _push_bsp() 提取重复的key构造+推送逻辑
- bsp.klc None防护
- getattr替代hasattr+属性访问
- 修正首轮日志(不再写"不推送")

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:05:20 +08:00
jackyu66gitandClaude Opus 4.7 a84a80cb62 Revert: BSP独立跟踪confirmed[-1],不与中枢监控耦合
B1/B2依赖中枢存在,不能等中枢更新才查BSP。
保持独立bi_id跟踪confirmed[-1]变化,分型确认时即查BSP。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:02:07 +08:00
jackyu66gitandClaude Opus 4.7 63787b173a fix: 新笔确认即查BSP(反向二类分型触发),首轮也查confirmed[-1]
笔被反向二类分型确认时is_sure=True,不需要等下一笔。
- 跟踪confirmed[-1]变化→查新确认那笔自身的BSP
- 首轮也查confirmed[-1],避免漏掉监控启动前刚确认的BSP

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 13:59:02 +08:00
jackyu66gitandClaude Opus 4.7 07f079067f fix: 跟踪confirmed[-1],新笔确认时查上一轮confirmed[-1]的BSP
以前跟踪bi_list[-1](含未确认)导致时序不对。
现在跟踪confirmed[-1]的稳定ID,变化时在bi_list中精确定位
上一轮的那笔,查其end_klc是否为BSP。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 13:55:48 +08:00
jackyu66gitandClaude Opus 4.7 ae4c79c133 fix: BSP检测用last_bi_id精确定位旧笔,替代confirmed[-2]索引
管线重算后笔列表可能变化,confirmed[-2]不一定是刚结束的笔。
改为用上一轮的last_bi_id在当前bi_list中精确查找,
找到后再检查其end_klc是否为BSP。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 13:35:20 +08:00
jackyu66gitandClaude Opus 4.7 743c5d342e fix: review修复 — 补回last_df_ts、枚举替换魔数、移除死代码
- SymbolState 补回 last_df_ts,无效新K线时跳过管线
- _bi_id 添加 start_klc None 防护
- last_bi.dir.value == 1 改为 Chan_BI_DIR.UP 枚举比较
- notify.py 移除未使用的 register_bsp_keys

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 12:56:17 +08:00
jackyu66gitandClaude Opus 4.7 78d02cf2ef refactor: BSP检测改为新笔驱动,不再逐tick对比BSP列表
- 用 last_bi_id (start_klc.start_time) 跟踪最后一笔
- 新笔确认时检查上一笔终点是否为 BSP → 推送
- 中枢更新同样在新笔产生时触发
- 移除时间过滤、BSP列表diff、持久化去重等冗余逻辑
- 无新笔时快速跳过,tick从40s降到15s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 12:52:36 +08:00
jackyu66gitandClaude Opus 4.7 cf9097a540 fix: zs_id 使用稳定时间戳替代 DataFrame 位置索引
_make_zs_id 原来用 start_klc.index,每次新K线导致 index 偏移,
monitor 误判为新中枢,每 tick 都推送。改为 start_klc.start_time,
时间戳不随 DataFrame 窗口偏移变化。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 12:07:58 +08:00
jackyu66gitandClaude Opus 4.7 881c9d5eac bsp_monitor: 支持全部20个币对 + 数据源切换至data_provider + Python 3.9兼容
- fetcher.py: 数据源从CCXT改为data_provider HTTP API,新增get_symbols()自动获取所有币对
- main.py: 重构为多币对架构,每个币对独立SymbolState(pivot_monitor/BSP去重/首轮抑制)
- engine.py: format_bsp_detail()支持动态币对名
- ChanPivotMonitor/Classifier: 修复Python 3.9类型注解兼容(X|None → Optional[X])
- 首轮初始化时不推送中枢和BSP,避免启动时20条消息轰炸

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 11:55:23 +08:00
jackyu66gitandClaude Opus 4.7 b1cbdca707 ChanPivotMonitor: 实时中枢特征跟踪 + Telegram推送
- ChanPivotClassifier: 提取 calc_duration/contraction/shift 为 @staticmethod,新增 compute_features()
- ChanPivotMonitor: 实时追踪当前中枢,bi_count 增长时重新计算 shift/contraction/duration
- bsp_monitor/fetcher: 改用 data_provider HTTP API 替代直连 CCXT
- bsp_monitor/notify: 新增 send_telegram_message() 通用推送
- bsp_monitor/main: 集成 ChanPivotMonitor,有新笔或 BSP 时推送到 Telegram

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 11:35:09 +08:00
jackyu66gitandClaude Opus 4.6 5ad761fad4 添加 ChanPivotClassifier: 中枢结构特征提取 + 标签化
Phase 1 训练数据集构建工具,从笔中枢提取 3 特征 (duration_norm, contraction, shift_norm) + 1 标签 (break_direction)。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-25 18:33:56 +08:00
jackyu66git 9eae12f07d 修改了一点 2026-05-20 02:02:53 +08:00
jackyu66git 9b876c45ed 修改了bsp state,继续测试 2026-05-20 00:49:53 +08:00
jackyu66git 91148a648a 添加新的策略 2026-05-19 09:58:33 +08:00
jackyu66git 5dc0c4cffd data_provider: 添加 ccxt.pro WebSocket 实时K线监听;端口 9009→80;web/*.sh 权限修正 2026-05-19 09:56:37 +08:00
jackyu66git f0ea6a6065 添加 bsp_monitor: BTC/USDT 1m 缠论买卖点实时监控
- 每整分钟拉取 Binance 永续合约 1m K 线
- 运行完整缠论管线检测买卖点 (BSP)
- 新 BSP 推送到 Telegram
- fix: fetcher 用 limit=1000 替代固定 since,避免 API 500 根限制截断新数据
2026-05-18 08:43:23 +08:00
jackyu66git bc085171f4 添加新策略用第三类买卖点 2026-05-17 14:54:00 +08:00
jackyu66git 050ebeb849 添加tradingview advanced chart lib和实现chan_tv网页 2026-05-14 14:16:06 +08:00
jackyu66git ca2cf86138 Merge origin/dev: resolve conflicts in data_provider main.py 2026-05-13 18:37:53 +08:00
jackyu66git 0dd8f8a585 feat: multi-symbol support and per-tf start_time in data_provider 2026-05-13 18:34:39 +08:00
jackyu66gitandClaude Opus 4.6 ebcb3dce73 添加 StructureZone 结构价值区系统,支持多周期支撑/阻力分析
- 新增 ChanZone.py: 从笔中枢/线段中枢/EMA52 提取价格区,聚类评分
- ChanLun.py 新增 get_structure_zones() 方法
- web/app.py: 独立拉取多周期数据 + 缓存 + limit 传参避免全量传输
- web/index.html: 结构区勾选框 + K线数量输入 + 半透明填充区绘制
- tests/test_chan_zone.py: 24 个单元测试

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 01:31:56 +08:00
jackyu66gitandClaude Opus 4.6 d8069e977f 添加 CLAUDE.md,为 Claude Code 提供项目指引
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 09:52:05 +08:00
jackyu66git 3f68a8305a 修改了一点 2026-05-03 15:43:56 +08:00
jackyu66git deeea55237 ignore update 2026-05-02 02:12:46 +08:00
jackyu66git 5ab69c2a64 更新data_provider逻辑,能够更快开始提供服务,添加说明 2026-05-01 17:13:24 +08:00
jackyu66git 425d513a37 修改笔中枢第三类卖卖点识别,识别好后直接完成笔中枢 2026-04-30 15:20:37 +08:00
jackyu66git 8ff1515f8b 改了ema的颜色 2026-04-24 10:13:30 +08:00
jackyu66git d8e3cdd9e9 修改小周期笔无法显示bug 2026-04-16 23:53:40 +08:00
jackyu66git 04d8f73b94 修正了刷新图表缩放和位置不变的bug 2026-04-16 02:31:48 +08:00
jackyu66git 7815eada00 添加动能理论,修改klc整体显示 2026-04-10 13:01:07 +08:00
jackyu66git 957ef62407 修改bug 2026-04-08 01:27:57 +08:00