feat: add optional market sentiment tool#1
Conversation
|
Thanks for the contribution — the code quality is solid and the graceful degradation pattern is well done. We'd love to include structured sentiment as a capability, but we'd prefer a provider-agnostic architecture rather than binding to a specific vendor. Specifically:
This way the sentiment capability is extensible and vendor-neutral, which aligns better with the project's multi-source philosophy (same pattern as our 5 data source providers with auto-fallback). Happy to discuss the interface design if you'd like to iterate on this! |
|
Thanks, this makes sense. I agree with the provider-agnostic direction. My plan would be to:
That would keep the public sentiment capability vendor-neutral while still allowing Adanos as one optional backend via config. If that matches what you have in mind, I’m happy to rework this PR in that direction. |
|
Thanks for the clean implementation and willingness to iterate. After reviewing further, I think the current sentiment coverage (skills + swarm presets + web_search + read_url) is sufficient for now. Adding a dedicated provider layer makes more sense when there are multiple backends to justify the abstraction. Closing for now — if users report gaps in sentiment analysis, happy to revisit with a multi-provider design. Appreciate the contribution! |
- Widen SL cap (0.5%->1.2%) and raise risk cap (5%->10%) to stop sizing 0 - Disable Danger HKUDS#1 (SL-proximity) by default; only fires on chart reversal - Raise Danger HKUDS#5 floating-loss threshold to 10% so it stops acting as fake SL - Add 1H ADX gate to block choppy entries - Add same-direction loss cooldown (LOSS_COOLDOWN_MINUTES) after losing close - Add Rich-based console dashboard (console_ui.py) and silence noisy libs - Escape HTML special chars in Telegram messages to fix parse errors
… ledger
Two unrelated changes shipped together because both came from one root
diagnosis session:
1. agent/src/providers/openai_codex.py:396 — OpenAICodexLLM.stream() hung
forever on the first request because httpx's `timeout` parameter only
applies to each chunk read individually, not to total wall-clock time.
In production this manifested as 3 consecutive `research_to_cryptobur`
swarm runs failing with `Worker exceeded layer deadline of 1860s`
and `iterations: 0` — the worker never returned from iter_lines().
Added a hard wall-clock deadline (default 4× per-request timeout =
~480s for the default 120s timeout). Caller can override via
`config['deadline']`. Once exceeded, raises RuntimeError with model
identity and elapsed time so the layer-deadline RuntimeError above
has a precise upstream cause to point at.
2. coordination/ — new directory with shared-state ledger for Claude
and Codex CLI to coordinate trading strategies without losing context
between sessions. Pattern adapted from langchain-ai/langgraph durable
state graphs and microsoft/autogen role-based group chat.
- README.md — schema + workflow
- strategy_state.yaml — append-only decision journal (this PR is
entry HKUDS#1: documents the deadline fix + open MIN_CONFIDENCE proposal)
- open_questions.md — questions blocked on founder input (currently
Q1: grant `config.set_risk_param` MCP permission)
- roles.md — Claude=Researcher, Codex=Skeptic, both=Risk Gate,
founder=Executor; handoff + disagreement protocol
Every Claude/Codex session must read coordination/ first, append an
entry at the end. No live config writes without ledger record.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…187) * feat: publish pre-built image to GHCR on release (#183) * docs: remove Watchtower references from README * Add workflow_dispatch trigger to Docker publish workflow * Allow Docker publish on additional branch * Update Docker publish workflow triggers Removed manual trigger and restricted push branches. --------- authored-by: Kai Lüttmann <33122946+KaiLuettmann@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
…标准化为可查询资产) 用户定优先级 #1: 拒绝原因散在 RunCard/EvaluationReport/pipeline fail-closed 早退/component review 里, AutoResearch 会反复踩同一个坑。把它们标准化为一个可查询负样本资产。 - negative_assets.py: RejectionRecord(pydantic extra=forbid)+ 受控词表 SUBJECT_KINDS/STAGES/REASON_CODES (reason_code=机器可查维度英文 enum; reasons[]=自由文本/中文细节, 对齐 error_code 约定)。 - from_pipeline_result: 成功 verdict pass → 0 条(成功绝不记成拒绝); 早退 fail-closed → 1 条(stage→code); **verdict=fail → 按 evaluate() reason 前缀拆成 per-gate reason_code**(placebo/family/capacity/holdout), 无法识别 → fail-safe 落 evaluation_failed(拒绝绝不静默丢失)。 - anti-repeat: content_key=spec_hash(对齐 autoresearch explore_key 语义)+ already_rejected(content_key); append-only JSONL + rejection_key 幂等。query/why = CLI Why-Rejected 视图。selftest 12。 - run_construction_pipeline.py 配套硬化(查漏补缺): - **每条返回路径带 subject 身份**(strategy/spec_hash/dvid/run_id)→ 拒绝可归因/可查重(原早退分支不带身份)。 - **signal_engine_from_spec 不支持的因子: 从抛异常改成 fail-closed**(崩溃≠记录在案的拒绝)。 - cmd_run 自动 record_pipeline 落账(run_pipeline 仍纯函数, 由 caller 落账; selftest/CI 用 temp 不污染真 ledger)。 - selftest 8→10(+非carhart fail-closed / +fail 返回带身份)。 - 自查改名: family_budget_exceeded → family_budget_failed(reason_code 应是门标识, missing/exceeded 子模式留 reasons[])。 - ledger=运行时累积资产 → data/negative/ gitignore(像 factor_assets 本地 store)。CI: pre-commit + Actions。 - 真集成 demo: backtest失败→backtest_failed / 非carhart→fail-closed / capacity红线 verdict=fail→拆成 capacity_redline+family_budget_failed+placebo_failed 三条; Why-Rejected query + anti-repeat 均通。全 Phase 5=11 模块全绿。 待: retry_allowed/retry_condition 可重试语义 / factor侧(correlation_redundant)+promotion侧 reject 接线 / 并发写安全 / 前端视图。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
RAOS_AUDIT §5 七未决经用户逐个拍定。贯穿模式: 所有理念取舍(#2/HKUDS#5)都选"系统给完整信号+守事实硬门, 判断/取舍交还模型和人"(gate 信号化) — 把宪法 RAOS_LLM_BOUNDARY "规则守事实/判断归模型" 落成具体接线。 决策: #1 探索树=derived_from边 / #2 拒因默认§5→needs_human / #3 第二审先same-model去剧透 / HKUDS#4 aum从notional反算 / HKUDS#5 anchor不可得放行needs_human / HKUDS#6 persistence-null先(修失真nc) / HKUDS#7 .BJ加include_bse后门。 统一执行清单(决策+盘点P0): P0=整链真跑/真第二审/探索树边/persistence-null/gate信号化; P1/P2 见文。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…+ 真回填 32 边)
asset_graph 探索树落在边层非列 (用户拍定: 支持 DAG/多父/嫁接, 复用现有边机制, 不改 experiments schema):
- record_experiment(parent_exp_id=...) 自动建 Experiment --derived_from--> Experiment 边
- experiment_parents/children + exploration_tree(BFS 可观测视图 — 树是模型输入非禁令)
- backfill_exploration_edges: flat ledger 隐式父子({run}::{factor}::{hash} → arrun::{run})一次性迁移, 幂等
生产 ledger 真回填: created=32(全部因子探索挂上父 run), 重跑 0/32 幂等; 真树验证可查。
selftest 9 blocks; test_review_gate 33 不破坏。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…envelope 边界: §G tier-2(传感器身份事实) + §B(envelope 推广) + §1④ 复核裁决(codex r13 五点按主场分工): #1 evidence-label 派生/fail-closed 与 #2 FactorCard per-cell admission 视图 = 并行 session adjudication 波的活跃战场(B1 0d12be9/e976d8a 已接 negc+packet label, 裁决C 4a28ae5 在改卡), 让行; #3/HKUDS#4/HKUDS#5 全冷区, 本波落地: 1. registry_smoke 守护(审计 P1#6): ⑦⑧ 判定提取为 evaluate_smoke 纯函数 + 离线合成 正反例 selftest 6 checks(NaN 退化必 fail/覆盖率 fail/warmup 容忍/空面板 fail-closed/ 输出契约键齐) — "改一行恒 pass"从此当场红; pre-commit raos-registry-smoke 接入。 CP3 硬门真值源零守护的系统底座风险闭口。 2. sensor_fingerprint.py(契约 §G tier-2 最小执行版): 9 个核心传感器(compute/negc/smoke/ anchor/review_runner/reviewctl/protocol/threshold 资产)per-file sha + combined + git dirty 自述(_git_unavailable=fail-visible); selftest 5 checks(确定性/敏感性/缺文件 可见/清单敏感); pre-commit 接入。接线①=evidence.json 顶层盖指纹; contract 新验收: 指纹存在+无缺文件+双方自称干净却 combined 不一致=过期传感器身份 fail。 接线②(reviewctl admit 行, B1 收口后)③(RunCard/eval_summary schema)在 §H 排队。 3. API envelope(契约 §B 接线②): /alpha/list 顶层 evidence_meta{sensor_status/degradations/ generated_at/sensor_combined/sensor_dirty/stats_note} — staleness 与传感器健康度在 lean 入口可见, evidence.json 整体缺失时 status=missing 显式区分"传感器离线"vs"库里无证据"; lean cells 补 evidence_end(holdout_ic 裸数字无窗口边界=变相消费 holdout 的入口, 审计 P2); detail 面同样带 evidence_meta。 feedback_surface_contract 至 10 facts/12 checks。全量 pytest 2687 passed / 0 failed�� 工艺备忘: git commit --only 对 untracked 新文件报 pathspec 错 — 新文件先 git add 再 --only。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Task 4c: bracket the net-of-fee verdict with a taker lower bound and an optimistic-maker upper bound (no fill model yet). Tightened decision rule (Sharpe>1.5 AND profit/cost>1.0), analytic breakeven maker-rate + breakeven fill-rate, lookahead-bias as the HKUDS#1 correctness gate, real-funding feed. Incorporates three rounds of external review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Plan 4 Task A. Relocate has_cached_oauth_token into src/trading/_oauth_cache.py (standalone, no src.live dep) and delete the order path from trading/service.py (_order_classification, place_order, cancel_order, _audit_live_cancel) plus the trading_place_order/trading_cancel_order tool classes. The read-only trading_* surface now imports nothing from src.live, clearing the way to delete it. Order tools remain absent from the MCP catalogue (contract-locked, decision HKUDS#1). Signed-off-by: zly1 <10994824+zly21@user.noreply.gitee.com>
Plan 4 Task C (decision HKUDS#1: no live trading in the Claude Code port). Delete src/live/ (mandate, kill switch, order guard, sdk_order_gate, audit, enforcement, runtime daemon, registry) and the live-channel-gate support it solely fed: the 10 connector classification.py maps + robinhood/extractor.py. Delete the ~25 live/ mandate/runtime/sdk/audit test files. Edit test_trading_connections.py to monkeypatch the relocated oauth helper and drop the obsolete live-broker-wrapping test. The read-only trading_* surface is unaffected; order tools stay absent (contract green). Signed-off-by: zly1 <10994824+zly21@user.noreply.gitee.com>
Summary
market_sentimenttool for structured US-stock sentiment snapshots and trending namesWhy
Vibe-Trading already has strong social/sentiment swarm presets, but today they rely on broad web reading and manual synthesis. This patch adds a structured market-sentiment input that is useful when available, while remaining fully optional.
Design
ADANOS_API_KEYis configuredstatus=not_configuredso agents can fall back to existing web research flowssnapshotandtrendingmodes across Reddit, X, finance news, and PolymarketValidation
python3 -m pytest tests/ -qcd agent && python3 -m py_compile cli.py api_server.py mcp_server.py src/agent/loop.py src/tools/__init__.py src/tools/market_sentiment_tool.pygit diff --check