@@ -272,10 +272,10 @@ export default function OpenPositions() {
Open positions
- Load your settings once to unlock private position data.
+ Sign in once to view open positions
- This panel no longer triggers a wallet signature on its own while you browse. Open the Settings page and load once, then the cached permission will populate positions here.
+ Go to the Settings page and click Sign in to view your settings. After signing, your open positions will appear here automatically.
)
@@ -331,7 +331,7 @@ export default function OpenPositions() {
- Today realised
+ Today's realized
@@ -342,7 +342,7 @@ export default function OpenPositions() {
- {`incl. ${fmtMoney(today.open_realized_usd, { sign: true })} banked on open`}
+ {`incl. ${fmtMoney(today.open_realized_usd, { sign: true })} locked in on open trades`}
)}
@@ -387,7 +387,7 @@ export default function OpenPositions() {
padding: '20px 18px',
fontSize: 13, color: 'var(--ink-3)', textAlign: 'center',
}}>
- No open positions. The bot will appear here as soon as a signal triggers a trade.
+ No open positions. When the bot opens a trade, it will show up here.
)}
@@ -432,7 +432,7 @@ export default function OpenPositions() {
{closing.realized_usd != null && closing.realized_usd !== 0 && (
)}
diff --git a/components/signals/SystemControl.tsx b/components/signals/SystemControl.tsx
index ed4ebab..1dc9c55 100644
--- a/components/signals/SystemControl.tsx
+++ b/components/signals/SystemControl.tsx
@@ -126,7 +126,7 @@ export default function SystemControl({ system }: { system: 'trump' | 'btc' }) {
// wagmi state that resolves client-side.
if (!mounted) return null
- const settingsHref = `/${locale}/settings#${system === 'trump' ? 'trump-settings-panel' : 'btc-settings-panel'}`
+ const settingsHref = `/${locale}/settings#bot-config`
const settingsLabel = system === 'trump' ? 'Trump Signal' : 'Macro Vibes'
// Wallet not connected: a previous version showed a giant full-width
@@ -298,7 +298,7 @@ export default function SystemControl({ system }: { system: 'trump' | 'btc' }) {
}}>
- {isZh ? '⟹ 当前结果' : '⟹ Net result'}
+ {isZh ? '⟹ 当前状态' : '⟹ Current status'}
diff --git a/components/trades/BotConfigPanel.tsx b/components/trades/BotConfigPanel.tsx
index 87cbfc9..1b23e40 100644
--- a/components/trades/BotConfigPanel.tsx
+++ b/components/trades/BotConfigPanel.tsx
@@ -22,17 +22,14 @@ import { walletErrorLabel } from '@/lib/walletError'
import { getFirstReadyConnector, walletConnectErrorLabel } from '@/lib/walletConnect'
import { confirmSign } from '@/components/wallet/SignConfirmSheet'
-// Defaults shown to a brand-new, un-configured wallet. take_profit_pct,
-// stop_loss_pct and daily_budget_usd are all REQUIRED before the bot will
-// trade — we still initialise them so the inputs have sensible placeholders.
const DEFAULT_SETTINGS: UserSettings = {
leverage: 3, position_size_usd: 20, take_profit_pct: 2, stop_loss_pct: 1.5,
min_confidence: 70, daily_budget_usd: 15, sys2_leverage: 2,
sys2_mode: 'standard',
active_from: null, active_until: null,
+ trump_enabled: false, macro_enabled: false,
}
-// ── datetime-local helpers (browser local tz ↔ ISO UTC) ──────────────────────
function isoToLocalInput(iso: string | null): string {
if (!iso) return ''
const d = new Date(iso)
@@ -42,86 +39,76 @@ function isoToLocalInput(iso: string | null): string {
}
function localInputToIso(v: string): string | null {
if (!v) return null
- const d = new Date(v) // interpreted as local time
+ const d = new Date(v)
if (isNaN(d.getTime())) return null
return d.toISOString()
}
-// ─── Bot config panel ─────────────────────────────────────────────────────────
export default function BotConfigPanel() {
- const locale = useLocale()
- const isZh = false // i18n shelved — Chinese branches kept as dead code for future revival; see messages/zh.json
+ useLocale() // keep next-intl context hydrated even though i18n is shelved
const { address, isConnected } = useAccount()
const { connectAsync, connectors } = useConnect()
const { signMessageAsync } = useSignMessage()
const {
- isSubscribed, hlApiKeySet, hlApiKeyMasked, botReadiness,
+ isSubscribed, hlApiKeySet, hlApiKeyMasked,
setSubscribed, setBotReadiness, setHlApiKeySet,
} = useDashboardStore()
const [settings, setSettings] = useState(DEFAULT_SETTINGS)
- // Tracks whether the SERVER already has values for these required fields.
- const [tpConfigured, setTpConfigured] = useState(false)
- const [slConfigured, setSlConfigured] = useState(false)
- const [budgetConfigured, setBudgetConfigured] = useState(false)
- const [useSchedule, setUseSchedule] = useState(false)
- const [fromLocal, setFromLocal] = useState('')
- const [untilLocal, setUntilLocal] = useState('')
- const [dirty, setDirty] = useState(false)
- const [saveState, setSaveState] = useState<'idle'|'signing'|'saving'|'ok'|'err'>('idle')
- const [saveErr, setSaveErr] = useState('')
+ const [tpConfigured, setTpConfigured] = useState(false)
+ const [slConfigured, setSlConfigured] = useState(false)
+ const [useBudget, setUseBudget] = useState(false)
+ const [useSchedule, setUseSchedule] = useState(false)
+ const [fromLocal, setFromLocal] = useState('')
+ const [untilLocal, setUntilLocal] = useState('')
+ const [dirty, setDirty] = useState(false)
+ const [saveState, setSaveState] = useState<'idle'|'signing'|'saving'|'ok'|'err'>('idle')
+ const [saveErr, setSaveErr] = useState('')
+ const [apiKey, setApiKey] = useState('')
+ const [keyState, setKeyState] = useState<'idle'|'signing'|'saving'|'ok'|'err'>('idle')
+ const [keyErr, setKeyErr] = useState('')
+ const [subState, setSubState] = useState<'idle'|'signing'|'saving'|'err'>('idle')
+ const [subErr, setSubErr] = useState('')
+ const [subPaperChoice, setSubPaperChoice] = useState<'paper' | 'live'>('paper')
+ const [manualUntil, setManualUntil] = useState(null)
+ const [mwState, setMwState] = useState<'idle'|'signing'|'saving'|'err'>('idle')
+ const [mwErr, setMwErr] = useState('')
+ const [mwTick, setMwTick] = useState(0)
+ const [paperMode, setPaperMode] = useState(false)
+ const [showAdvanced, setShowAdvanced] = useState(false)
+ const [mounted, setMounted] = useState(false)
+ const [loadState, setLoadState] = useState<'idle'|'loading'|'loaded'|'err'>('idle')
+ const [loadErr, setLoadErr] = useState('')
+ const [connectErr, setConnectErr] = useState('')
- // HL key state
- const [apiKey, setApiKey] = useState('')
- const [keyState, setKeyState] = useState<'idle'|'signing'|'saving'|'ok'|'err'>('idle')
- const [keyErr, setKeyErr] = useState('')
-
- // Subscribe state. `subPaperChoice` is the user's selection on the
- // pre-subscribe form ("paper" or "live"); written to Subscription.paper_mode
- // when the signed subscribe goes through.
- const [subState, setSubState] = useState<'idle'|'signing'|'saving'|'err'>('idle')
- const [subErr, setSubErr] = useState('')
- const [subPaperChoice, setSubPaperChoice] = useState<'paper' | 'live'>('paper')
-
- // Manual window (convex-strategy "enable for N hours" override).
- // null = no override active; ISO string = bot armed until that UTC time.
- const [manualUntil, setManualUntil] = useState(null)
- const [mwState, setMwState] = useState<'idle'|'signing'|'saving'|'err'>('idle')
- const [mwErr, setMwErr] = useState('')
- const [mwTick, setMwTick] = useState(0) // forces countdown re-render
-
- // Mounted flag: avoid SSR/CSR mismatch since wagmi state differs between the two.
- const [mounted, setMounted] = useState(false)
useEffect(() => { setMounted(true) }, [])
- // Settings-load state. We do NOT auto-pop MetaMask — only fetch with a
- // cached signature; otherwise wait for the user to click "Load settings".
- const [loadState, setLoadState] = useState<'idle'|'loading'|'loaded'|'err'>('idle')
- const [loadErr, setLoadErr] = useState('')
- const [connectErr, setConnectErr] = useState('')
-
- // Apply a fetched user payload into local form state.
function applyUserPayload(u: {
active: boolean
hl_api_key_set: boolean
hl_api_key_masked: string | null
+ paper_mode?: boolean
settings: UserSettings
manual_window_until?: string | null
}) {
setSubscribed(u.active)
+ setPaperMode(!!u.paper_mode)
setHlApiKeySet(u.hl_api_key_set, u.hl_api_key_masked ?? undefined)
setManualUntil(u.manual_window_until ?? null)
if (u.settings) {
const s = u.settings
setTpConfigured(s.take_profit_pct != null)
setSlConfigured(s.stop_loss_pct != null)
- setBudgetConfigured(s.daily_budget_usd != null)
+ const hasBudget = s.daily_budget_usd != null
+ setUseBudget(hasBudget)
setBotReadiness(u.hl_api_key_set ? 'saved' : 'unknown')
setSettings({
...s,
take_profit_pct: s.take_profit_pct ?? 2,
stop_loss_pct: s.stop_loss_pct ?? 1.5,
daily_budget_usd: s.daily_budget_usd ?? 15,
+ trump_enabled: s.trump_enabled ?? false,
+ macro_enabled: s.macro_enabled ?? false,
})
const hasSched = s.active_from != null && s.active_until != null
setUseSchedule(hasSched)
@@ -130,8 +117,6 @@ export default function BotConfigPanel() {
}
}
- // On connect: fetch public state only (no signature). If a fresh view
- // envelope is already cached in sessionStorage, silently hydrate full data.
useEffect(() => {
if (!mounted || !isConnected || !address) return
let cancelled = false
@@ -157,10 +142,8 @@ export default function BotConfigPanel() {
setLoadErr(''); setLoadState('loading')
try {
const ok = await confirmSign({
- label: isZh ? '查看账户设置' : 'View account settings',
- description: isZh
- ? '读取你在 Trump Alpha 的订阅状态、风控参数和 API Key 状态。签名仅用于身份验证,不做任何链上操作。'
- : 'Read your Trump Alpha subscription state, risk settings, and API key status. The signature is only for identity verification. No on-chain action is performed.',
+ label: 'View account settings',
+ description: 'Read your Trump Alpha subscription state, risk settings, and API key status. The signature is only for identity verification — no on-chain action is performed.',
})
if (!ok) { setLoadState('idle'); return }
const env = await getOrCreateViewEnvelope({ action: 'view_user', wallet: address, signMessageAsync })
@@ -168,7 +151,7 @@ export default function BotConfigPanel() {
applyUserPayload(u)
setLoadState('loaded')
} catch (e: unknown) {
- setLoadErr(walletErrorLabel(e, isZh ? '已取消' : 'Cancelled', 120))
+ setLoadErr(walletErrorLabel(e, 'Cancelled', 120))
setLoadState('err')
}
}
@@ -190,16 +173,10 @@ export default function BotConfigPanel() {
if (!address) return
const paperMode = subPaperChoice === 'paper'
const ok = await confirmSign({
- label: paperMode
- ? (isZh ? '订阅 Trump Alpha(模拟模式)' : 'Subscribe to Trump Alpha (paper mode)')
- : (isZh ? '订阅 Trump Alpha(真实资金)' : 'Subscribe to Trump Alpha (live capital)'),
+ label: paperMode ? 'Start in paper mode' : 'Start live trading',
description: paperMode
- ? (isZh
- ? '注册为 Paper 模式订阅者。机器人开仓不涉及真实资金,仅供测试。'
- : 'Register as a paper-mode subscriber. Trades are simulated and do not touch real funds.')
- : (isZh
- ? '注册为正式订阅者。完成后需配置 Hyperliquid API Key 才能实际开仓。'
- : 'Register as a live subscriber. You still need to configure a Hyperliquid API key before any real trade can open.'),
+ ? 'Trades are simulated end-to-end — no funds are at risk. You can switch to live at any time from the settings panel.'
+ : 'Start live trading. You\'ll need to add a Hyperliquid API key (next step) before the bot can open any real position.',
danger: !paperMode,
})
if (!ok) return
@@ -210,14 +187,13 @@ export default function BotConfigPanel() {
setSubState('saving')
await subscribe(env, { paper_mode: paperMode })
setSubscribed(true)
+ setPaperMode(paperMode)
void refreshUserState(address)
setSubState('idle')
- setTpConfigured(false)
- setSlConfigured(false)
- setBudgetConfigured(false)
- setLoadState('loaded')
+ setTpConfigured(false); setSlConfigured(false)
+ setUseBudget(false); setLoadState('loaded')
} catch (e: unknown) {
- setSubErr(walletErrorLabel(e, isZh ? '已取消' : 'Cancelled', 100))
+ setSubErr(walletErrorLabel(e, 'Cancelled', 100))
setSubState('err')
}
}
@@ -225,10 +201,8 @@ export default function BotConfigPanel() {
async function handleSaveSettings() {
if (!address) return
const ok = await confirmSign({
- label: isZh ? '保存交易风控参数' : 'Save trading risk settings',
- description: isZh
- ? '保存杠杆、仓位大小、止盈止损比例和每日预算设置。签名后立即生效。'
- : 'Save leverage, position size, take-profit, stop-loss, and daily budget settings. Changes apply immediately after signing.',
+ label: 'Save trading settings',
+ description: 'Settings are saved to the server and apply to all new trades from this point forward. Open positions are not affected.',
})
if (!ok) return
setSaveErr(''); setSaveState('signing')
@@ -238,32 +212,26 @@ export default function BotConfigPanel() {
if (useSchedule) {
schedFrom = localInputToIso(fromLocal)
schedUntil = localInputToIso(untilLocal)
- if (!schedFrom || !schedUntil) {
- setSaveErr(isZh ? '请选择开始和结束时间' : 'Pick both a start and end time'); setSaveState('err'); return
- }
- if (new Date(schedUntil).getTime() <= new Date(schedFrom).getTime()) {
- setSaveErr(isZh ? '结束时间必须晚于开始时间' : 'End must be after start'); setSaveState('err'); return
- }
+ if (!schedFrom || !schedUntil) { setSaveErr('Pick both a start and end time'); setSaveState('err'); return }
+ if (new Date(schedUntil).getTime() <= new Date(schedFrom).getTime()) { setSaveErr('End must be after start'); setSaveState('err'); return }
}
const tp = settings.take_profit_pct, sl = settings.stop_loss_pct, bd = settings.daily_budget_usd
- if (tp == null || tp < 0.1 || tp > 50) { setSaveErr(isZh ? '止盈必须在 0.1% 到 50% 之间' : 'Take profit must be 0.1 – 50%'); setSaveState('err'); return }
- if (sl == null || sl < 0.1 || sl > 50) { setSaveErr(isZh ? '止损必须在 0.1% 到 50% 之间' : 'Stop loss must be 0.1 – 50%'); setSaveState('err'); return }
- if (bd == null || bd <= 0 || bd > 100000){ setSaveErr(isZh ? '每日预算必须大于 0 美元' : 'Daily budget must be > $0'); setSaveState('err'); return }
- const payload: UserSettings = {
- ...settings, take_profit_pct: tp, stop_loss_pct: sl, daily_budget_usd: bd,
- active_from: schedFrom, active_until: schedUntil,
+ if (trumpOn) {
+ if (tp == null || tp < 0.1 || tp > 50) { setSaveErr('Take profit must be 0.1–50%'); setSaveState('err'); return }
+ if (sl == null || sl < 0.1 || sl > 50) { setSaveErr('Stop loss must be 0.1–50%'); setSaveState('err'); return }
}
+ if (useBudget && (bd == null || bd <= 0 || bd > 100000)) { setSaveErr('Daily budget must be > $0'); setSaveState('err'); return }
+ const payload: UserSettings = { ...settings, daily_budget_usd: useBudget ? bd : null, active_from: schedFrom, active_until: schedUntil }
const env = await signRequest({ action: 'set_settings', wallet: address, body: payload, signMessageAsync })
setSaveState('saving')
await setUserSettings(env, payload)
setSettings(payload)
- setTpConfigured(true); setSlConfigured(true); setBudgetConfigured(true)
- setBotReadiness('saved')
- setDirty(false)
+ setTpConfigured(tp != null); setSlConfigured(sl != null)
+ setBotReadiness('saved'); setDirty(false)
setSaveState('ok')
- setTimeout(() => setSaveState('idle'), 2000)
+ setTimeout(() => setSaveState('idle'), 2500)
} catch (e: unknown) {
- setSaveErr(walletErrorLabel(e, isZh ? '已取消' : 'Cancelled', 100))
+ setSaveErr(walletErrorLabel(e, 'Cancelled', 100))
setSaveState('err')
}
}
@@ -272,13 +240,11 @@ export default function BotConfigPanel() {
if (!address || !apiKey.trim()) return
const trimmed = apiKey.trim()
if (!trimmed.startsWith('0x') || trimmed.length !== 66) {
- setKeyErr(isZh ? '必须是 0x 开头加 64 位十六进制字符' : 'Must be 0x + 64 hex chars'); setKeyState('err'); return
+ setKeyErr('Must be 0x + 64 hex chars'); setKeyState('err'); return
}
const ok = await confirmSign({
- label: isZh ? '绑定 Hyperliquid API Key' : 'Link Hyperliquid API key',
- description: isZh
- ? 'API Key 将加密存储在服务端,用于机器人在 Hyperliquid 上代替你下单。签名用于验证是你本人操作。'
- : 'The API key is stored encrypted on the server and used by the bot to place trades on Hyperliquid for you. The signature confirms this action came from you.',
+ label: 'Link Hyperliquid API key',
+ description: 'The API key is stored encrypted on the server and used by the bot to place trades on Hyperliquid for you.',
danger: true,
})
if (!ok) return
@@ -290,10 +256,9 @@ export default function BotConfigPanel() {
setHlApiKeySet(true, res.masked_key)
setBotReadiness('saved')
void refreshUserState(address)
- setApiKey('')
- setKeyState('ok')
+ setApiKey(''); setKeyState('ok')
} catch (e: unknown) {
- setKeyErr(walletErrorLabel(e, isZh ? '已取消' : 'Cancelled', 100))
+ setKeyErr(walletErrorLabel(e, 'Cancelled', 100))
setKeyState('err')
}
}
@@ -302,432 +267,287 @@ export default function BotConfigPanel() {
setConnectErr('')
try {
const connector = await getFirstReadyConnector(connectors)
- if (!connector) {
- setConnectErr('No wallet connector is available right now.')
- return
- }
+ if (!connector) { setConnectErr('No wallet connector is available right now.'); return }
await connectAsync({ connector })
} catch (err: unknown) {
setConnectErr(walletConnectErrorLabel(err))
}
}, [connectAsync, connectors])
- // ── Manual-window: arm for N hours, or clear (hours = 0) ──────────────────
async function handleManualWindow(hours: number) {
if (!address) return
+ const ok = await confirmSign(hours === 0
+ ? {
+ label: 'Cancel override window',
+ description: 'The bot will stop accepting new trades from this override. Any open position risk controls (stop-loss, de-risk) remain active.',
+ }
+ : {
+ label: `Open ${hours}h override window`,
+ description: `The bot will accept qualifying signals for the next ${hours} hour${hours > 1 ? 's' : ''}, regardless of your trading schedule. Use this for high-conviction catalysts (e.g. CPI, FOMC). Stop-loss is always active.`,
+ danger: true,
+ }
+ )
+ if (!ok) return
setMwErr(''); setMwState('signing')
try {
- const env = await signRequest({
- action: 'set_manual_window',
- wallet: address,
- body: { hours },
- signMessageAsync,
- })
+ const env = await signRequest({ action: 'set_manual_window', wallet: address, body: { hours }, signMessageAsync })
setMwState('saving')
const r = await setManualWindow(env, hours)
- setManualUntil(r.manual_window_until)
- setMwState('idle')
+ setManualUntil(r.manual_window_until); setMwState('idle')
} catch (e: unknown) {
- setMwErr(walletErrorLabel(e, isZh ? '已取消' : 'Cancelled', 100))
+ setMwErr(walletErrorLabel(e, 'Cancelled', 100))
setMwState('err')
}
}
- // Countdown re-render every 15s while a manual window is armed.
+ async function handleUpgradeToLive() {
+ if (!address) return
+ const ok = await confirmSign({
+ label: 'Switch to live trading',
+ description: 'Your subscription will change from paper mode to live. No trade opens immediately — you still need to add a Hyperliquid API key and enable a signal module before the bot can act.',
+ danger: true,
+ })
+ if (!ok) return
+ setSubErr(''); setSubState('signing')
+ try {
+ // paper_mode=false → signedBody=null (same as original live subscribe)
+ const env = await signRequest({ action: 'subscribe', wallet: address, body: null, signMessageAsync })
+ setSubState('saving')
+ await subscribe(env, { paper_mode: false })
+ setPaperMode(false)
+ void refreshUserState(address)
+ setSubState('idle')
+ } catch (e: unknown) {
+ setSubErr(walletErrorLabel(e, 'Cancelled', 100))
+ setSubState('err')
+ }
+ }
+
useEffect(() => {
if (!manualUntil) return
const id = setInterval(() => setMwTick(t => t + 1), 15000)
return () => clearInterval(id)
}, [manualUntil])
+ // ── Not connected ──────────────────────────────────────────────────────────
if (!mounted || !isConnected) {
return (
-
-
- {isZh ? '连接钱包后即可配置机器人并查看你的交易。' : 'Connect your wallet to configure the bot and view your trades.'}
-
-
- {connectErr ? (
-
{connectErr}
- ) : null}
+
+
Connect your wallet to continue
+
+ Your subscription, API key, and trade settings are wallet-bound. No account needed — just sign a message.
+
+
+ {connectErr &&
{connectErr}
}
)
}
- // ── small local helpers ───────────────────────────────────────────────────
- const Switch = ({ on, onChange, tone = 'amber' }: { on: boolean; onChange: (v: boolean) => void; tone?: 'amber' | 'up' | 'down' }) => (
+ // ── helpers ────────────────────────────────────────────────────────────────
+ const Switch = ({ on, onChange, tone = 'amber' }: { on: boolean; onChange: (v: boolean) => void; tone?: 'amber' | 'up' }) => (
)
- const saveBtnLabel =
- saveState === 'signing' ? (isZh ? '钱包签名中…' : 'Sign in wallet…')
- : saveState === 'saving' ? (isZh ? '保存中…' : 'Saving…')
- : saveState === 'ok' ? (isZh ? '✓ 已保存' : '✓ Saved')
- : (isZh ? '保存更改' : 'Save changes')
+ const trumpOn = !!settings.trump_enabled
+ const macroOn = !!settings.macro_enabled
- const keyHint =
- hlApiKeySet && !apiKey
- ? (isZh
- ? '已保存在你的机器人配置里。如果你在 Hyperliquid 轮换了 API 钱包,重新交易前请先在这里更新。'
- : 'Saved in your bot profile. If you rotate the API wallet in Hyperliquid, update it here before trading again.')
- : (isZh
- ? '请使用 app.hyperliquid.xyz/API 生成的 Hyperliquid API 钱包私钥。不要在这里粘贴 MetaMask 助记词或私钥。'
- : 'Use the Hyperliquid API wallet private key from app.hyperliquid.xyz/API. Never paste your MetaMask secret phrase or private key here.')
-
- const keyStatusHint =
- keyState === 'ok'
- ? (isZh
- ? 'API 钱包已保存。建议下一步先用极小仓位跑一次你自己的 BTC 测试,再把这套配置当成生产可用。'
- : 'API wallet saved. Recommended next step: keep size tiny and run your own first BTC test before treating the setup as production-ready.')
- : null
-
- function ScopePill({
- label,
- tone = 'amber',
- }: {
- label: string
- tone?: 'amber' | 'up' | 'violet'
- }) {
+ // ── Not subscribed ─────────────────────────────────────────────────────────
+ if (!isSubscribed) {
return (
-
- {label}
-
+
+
Set up your trading bot
+
+ The bot places trades on Hyperliquid with a trade-only API key — it can never withdraw funds.
+ Start in paper mode to try it safely, or choose Live if you already have a Hyperliquid API key.
+
+
+ {/* Paper / Live choice */}
+
+
+
+ {subPaperChoice === 'paper' ? '📝 Paper mode — simulated trades, no real funds' : '💰 Live trading — real positions on Hyperliquid'}
+
+
+ {subPaperChoice === 'paper'
+ ? 'Nothing is at risk. No Hyperliquid API key needed. You can switch to live at any time.'
+ : 'Real positions will be opened and managed on Hyperliquid. A trade-only API key is required before the first trade.'}
+
+
+
+ Paper
+ setSubPaperChoice(v ? 'live' : 'paper')}
+ tone="amber"
+ />
+ Live
+
- {hlApiKeySet ? '✓' : '◇'}
+ // ── Subscribed but settings not loaded yet ─────────────────────────────────
+ if (loadState !== 'loaded') {
+ return (
+
+
Sign in to view your settings
+
+ Your settings are private and wallet-bound. Sign once to load them — the permission is cached for 4 minutes so you won't be prompted again while you browse.
-
-
Hyperliquid API wallet
-
- {!isSubscribed
- ? 'Subscribe first to link your HL account'
- : hlApiKeySet && !apiKey
- ? <>Linked · {hlApiKeyMasked ?? '···'} · trade-only scope>
- : 'Paste your API wallet private key — trade-only, never withdraw'}
-
+
+ {/* ── HL API Key ─────────────────────────────────────────────────────── */}
+
+
+ {/* Status dot */}
+
+ {(paperMode || hlApiKeySet) ? '✓' : '◇'}
+
+
+
Hyperliquid API wallet
+
+ {paperMode
+ ? 📝 Paper mode — no real money involved. Add an API key below to switch to live.
+ : hlApiKeySet && !apiKey
+ ? <>{hlApiKeyMasked ?? '···'} · trade-only · cannot withdraw>
+ : 'Generate at app.hyperliquid.xyz/API — paste the private key here. Never your MetaMask key.'}
+
+
+ {/* Paper mode: show upgrade path instead of key input */}
+ {paperMode && (
+
+ )}
+ {/* Live mode: show key input */}
+ {!paperMode && (hlApiKeySet && !apiKey ? (
+
+ ) : (
+
- {armed
- ? <>Bot is live for {remainingLabel} more — overrides any schedule.>
- : 'Arm the bot for a specific window. Best for catalysts (CPI, FOMC, news drops).'}
-
- Wallet subscription, API wallet storage, and risk fields are all saved. Before you rely on automation, use your own account to run one tiny BTC test and confirm the live trade path behaves the way you expect.
-
-
-
- )}
-
- {/* Body */}
- {!isSubscribed ? (
-
-
- Subscribe to activate automated trading. The bot signs positions on Hyperliquid using an API wallet scoped to trade-only — it can never withdraw. You pick the size, leverage, risk limits, and signal threshold below.
-
-
- {/* ── Paper-vs-Live choice (P0.2) ────────────────────────────
- New users land on PAPER by default. Forces a conscious
- opt-in to live trading rather than auto-routing real money. */}
-
- {([
- {
- key: 'paper',
- title: '📝 Start in paper mode',
- tag: 'Recommended',
- body: 'Trades are simulated end-to-end. No funds at risk, no HL key needed. Promote to live anytime.',
- },
- {
- key: 'live',
- title: '💰 Start live',
- tag: 'Real money',
- body: 'Bot trades real positions on Hyperliquid. Requires an HL API key. Risk = your full position size.',
- },
- ] as const).map(opt => {
- const active = subPaperChoice === opt.key
- return (
-
- )
- })}
-
-
- {/* The subscribe button moves down here so paper choice is
- resolved before the wallet popup. */}
-
-
- {subState === 'err' && {subErr}}
-
-
- ) : loadState !== 'loaded' ? (
-
-
- Sign a one-time message with your wallet to load your bot settings and trade history. The signature is cached for 4 minutes so repeat visits won't prompt again.
-
-
-
- {loadState === 'err' && {loadErr}}
-
-
- ) : (
-
- {/* ── EXECUTION ── */}
-
- Trump Signal settings
-
-
-
- Event-driven trade sizing, leverage, and signal threshold for Trump-triggered entries.
-
+ {/* Form — only when enabled */}
+ {trumpOn && (
+
- Per-trade size
- Notional in USD. margin ≈ ${(settings.position_size_usd / settings.leverage).toFixed(2)} at {settings.leverage}×
+ Per-trade size
+ Notional in USD — margin ≈ ${(settings.position_size_usd / settings.leverage).toFixed(2)} at {settings.leverage}×
@@ -741,8 +561,8 @@ export default function BotConfigPanel() {
- Leverage (Trump / System 1)
- Event-driven scalp positions
+ Leverage
+ Event-driven scalp — use lower leverage if unsure
@@ -754,118 +574,10 @@ export default function BotConfigPanel() {
- Manage-only BTC mode, leverage, and pyramiding behavior for the Macro Vibes system.
-
-
-
- BTC strategy mode (System 2)
-
- Choose how hard the BTC system presses winners. Standard is calmer. Aggressive adds more leverage and wider pyramiding.
-
-
-
-
-
-
-
- {aggressive && (
-
- High-risk sleeve. Uses more leverage, pyramids harder, and gives back more off the peak. Best treated as a separate risk bucket.
-
- At {lev}× it sheds {e1} near −{(prot * 0.6).toFixed(0)}%, {e2} near −{(prot * 0.8).toFixed(0)}%, and is fully out by −{prot.toFixed(0)}%.
- Exchange liquidation would be around −{liq.toFixed(0)}%.
- {' '}
- {risky
- ? 'Above 2×, a normal bull-market correction can push you out early.'
- : 'This is wide enough to survive a normal correction; extra upside should come from pyramiding, not leverage.'}
-
-
-
- )
- })()}
-
- Min AI confidence
- Skip any signal below this score (0–100)
+ Min AI confidence
+ Skip signals below this score (0 = take all, 100 = only the highest-conviction)
@@ -877,36 +589,12 @@ export default function BotConfigPanel() {
- {/* ── LIMITS ── */}
-
- Global risk limits
-
-
-
- Shared safety rules that cap or gate automated trading across the account.
-
+
- Daily budget *
- Stop opening new trades once the day's total notional reaches this (UTC). Required.
-
+ {macroOn
+ ? 'You open a BTC long on Hyperliquid, then use /adopt in the Telegram bot to hand it to the bot for exit management.'
+ : 'Disabled — Macro Vibes alerts will not include bot management instructions.'}
+
+
+ updateSettings({ macro_enabled: v })} tone="up" />
+
+ At {lev}× it sheds ⅓ near −{(prot * 0.6).toFixed(0)}%, ⅓ near −{(prot * 0.8).toFixed(0)}%, fully out by −{prot.toFixed(0)}%.
+ Exchange liquidation ≈ −{liq.toFixed(0)}%.
+ {risky ? ' Above 2×, a normal correction can push you out early.' : ' Wide enough to survive a normal correction.'}
+
- Only run in a window
- Bot ignores signals outside this range. Shown in your browser's local time.
+ Daily trading cap
+ Optional — bot stops opening new trades once total notional crosses this limit in a UTC day.
+
+ Override window
+ Open a timed override so the bot accepts signals for the next 1–24 hours — useful for high-conviction catalysts like CPI or FOMC releases.
+