From b2b96bb9c091e1a2cb207e8a5b5feda6e6b98af4 Mon Sep 17 00:00:00 2001 From: k Date: Fri, 29 May 2026 15:04:36 +0800 Subject: [PATCH] fix: Macro panel manage-only (not auto-open), Trump-only auto-trade copy, store docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SystemControl was rendered as two per-system panels (Trump / Macro) that both flipped the SAME global auto_trade, and its copy claimed a "qualifying Macro Vibes signal auto-opens a trade". Both are wrong: bot_engine.process_post early-returns for System 2, so the auto_trade gate only ever fires for Trump (System 1). Macro Vibes is manage-only — it never auto-opens. - Macro (`system="btc"`) panel: replaced the misleading Auto-Trade ON/OFF toggle with a manage-only explainer (open on HL → /adopt via Telegram → bot manages exits) and a note that the Trump-page switch has no effect here. - Trump (`system="trump"`) panel: relabeled the switch "TRUMP (System 1)" and rewrote all copy/status lines to say Trump-only auto-open (was "GLOBAL (Trump + BTC)" / "both Trump & BTC"). - CLAUDE.md: corrected "No global store (no Redux/Zustand)" — the app DOES use a small Zustand store (store/dashboard.ts / useDashboardStore); documented what it holds and the guidance to keep it small. Note (not a bug): dashboard adopt/release is intentionally Telegram-only — there are no positions/adopt|hl|release client calls and the UI correctly points to the Telegram /adopt command. No dashboard wiring is "broken". tsc + next build clean. Co-Authored-By: Claude Opus 4.7 --- CLAUDE.md | 6 ++- components/signals/SystemControl.tsx | 67 +++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c9aab8f..ab634b8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -138,7 +138,11 @@ mutate the subscription. ## State management -- **No global store** (no Redux/Zustand). Tree-local state + props. +- **One small global store** — `store/dashboard.ts` (Zustand, `useDashboardStore`). + Holds cross-page UI/session state: selected post, chart asset/timeframe, + wallet address, subscription + bot-readiness flags, masked HL key hint, and + the live-price map. Everything else stays tree-local (state + props) — don't + grow this store into a catch-all; page-specific data belongs in the page. - **SWR-style cache** in `lib/cache.ts` for the API-heavy pages. - **WebSocket** singleton via `WsProvider` — used by `SignalMonitor` and live price tickers. diff --git a/components/signals/SystemControl.tsx b/components/signals/SystemControl.tsx index fc30494..0b6a930 100644 --- a/components/signals/SystemControl.tsx +++ b/components/signals/SystemControl.tsx @@ -134,6 +134,49 @@ export default function SystemControl({ system }: { system: 'trump' | 'btc' }) { const settingsHref = `/${locale}/settings#bot-config` const settingsLabel = system === 'trump' ? 'Trump Signal' : 'Macro Vibes' + // Macro Vibes (System 2) is MANAGE-ONLY by design — it NEVER auto-opens a + // trade. bot_engine.process_post early-returns for sys2 sources, so the + // master Auto-Trade switch only governs Trump (System 1). Presenting an + // ON/OFF auto-trade toggle here would (a) falsely imply Macro signals + // auto-open and (b) be a confusing second copy of the SAME global switch + // shown on the Trump page. Show the adopt-only flow instead. + if (system === 'btc') { + const linkStyle: React.CSSProperties = { + display: 'inline-flex', alignItems: 'center', gap: 8, padding: '8px 12px', + borderRadius: 999, border: '1px solid var(--line)', background: 'var(--surface)', + fontSize: 12, color: 'var(--ink)', textDecoration: 'none', fontWeight: 700, + boxShadow: 'var(--shadow-1)', + } + return ( +
+
+
+ {s.idx} {s.name} — manage-only +
+
+
+

+ Macro Vibes does not auto-open trades. When a bottom-reversal + signal fires you get a Telegram alert. You open the position yourself on + Hyperliquid, then hand it to the bot with /adopt — the bot then + manages the exit (staged stop ladder, de-risk, pyramid, peak-trail). +

+

+ The Auto-Trade switch on the Trump page controls Trump (System 1) + auto-opens only — it has no effect on Macro Vibes. +

+ + Settings + {settingsLabel} + + +
+
+ ) + } + // Wallet not connected: a previous version showed a giant full-width // "Connect a wallet..." card here, which was redundant with the navbar's // Connect button. The opposite extreme — rendering null — silently hid @@ -203,13 +246,13 @@ export default function SystemControl({ system }: { system: 'trump' | 'btc' }) { : `Circuit breaker tripped (${pub?.circuit_breaker_reason || 'risk limit'}). Turn Auto-Trade ON to acknowledge & resume.` } else if (!autoOn) { netMsg = isZh - ? 'Auto-Trade 当前为关闭(全局): Trump 和 BTC 信号仍会显示,但不会自动开仓。' - : 'Auto-Trade is OFF (global) — Trump AND Macro Vibes signals are shown in the feed but NOT traded.' + ? 'Auto-Trade 当前为关闭: Trump 信号仍会显示,但不会自动开仓。' + : 'Auto-Trade is OFF — Trump signals are shown in the feed but NOT traded.' } else { netOk = true netMsg = isZh - ? `Auto-Trade 已开启(全局,覆盖 Trump 和 BTC): 下一条合格信号会自动开出${paper ? '模拟' : '真实'}仓位。` - : `Auto-Trade ON (global, both Trump & BTC) — will open a ${paper ? 'PAPER' : 'LIVE'} trade on the next qualifying signal.` + ? `Auto-Trade 已开启(Trump 系统①): 下一条合格 Trump 信号会自动开出${paper ? '模拟' : '真实'}仓位。` + : `Auto-Trade ON (Trump / System 1) — will open a ${paper ? 'PAPER' : 'LIVE'} trade on the next qualifying Trump signal.` } const Pill = ({ active, onClick, children, tone }: { @@ -245,21 +288,23 @@ export default function SystemControl({ system }: { system: 'trump' | 'btc' }) {
Auto-Trade {isZh ? '· 全局(Trump + BTC)' : '· GLOBAL (Trump + BTC)'} + color: 'var(--ink-4)', marginLeft: 6 }}>{isZh ? '· Trump 系统①' : '· TRUMP (System 1)'}
{isZh ? ( <> - 一个开关控制两套系统。 关闭时:信号仍会扫描并显示,但不会自动交易。 - 开启时:满足条件的 Trump 或 BTC 信号都会自动开仓。无论开关状态如何, + 控制 Trump 信号是否自动开仓。 关闭时:信号仍会扫描并显示,但不会自动交易。 + 开启时:满足条件的 Trump 信号会自动开仓。无论开关状态如何, 已开仓位的止损和分级降风险都会继续保护持仓。 + (Macro Vibes 不自动开仓——见 Macro 页的 manage-only 说明。) ) : ( <> - One switch for both systems. OFF: signals scanned - & shown in the feed, nothing traded. ON: a qualifying Trump OR - Macro Vibes signal auto-opens a trade. Stop-loss / staged de-risk - always protect open positions either way. + Controls Trump (System 1) auto-opens. OFF: signals + scanned & shown in the feed, nothing traded. ON: a qualifying + Trump signal auto-opens a trade. Stop-loss / staged de-risk always + protect open positions either way. (Macro Vibes is manage-only and + never auto-opens — see its page.) )}