From 19f28fc5999dbe8eafd1d203e5f9774b0f8294ff Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Sat, 11 Apr 2026 17:17:26 +0000 Subject: [PATCH] feat: use token from strategy config in simulation page Like the backtest page, simulation now extracts the token from the bot's strategy config instead of requiring user input. Shows token name and truncated address. --- .../src/routes/bot/[id]/simulate/+page.svelte | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/routes/bot/[id]/simulate/+page.svelte b/src/frontend/src/routes/bot/[id]/simulate/+page.svelte index 5e4cc6f..0ee24a3 100644 --- a/src/frontend/src/routes/bot/[id]/simulate/+page.svelte +++ b/src/frontend/src/routes/bot/[id]/simulate/+page.svelte @@ -7,7 +7,8 @@ import { SignalChart, ProUpgradeBanner } from '$lib/components'; let botId = $derived($page.params.id); - let token = $state('PEPE'); + let tokenName = $state(''); + let tokenAddress = $state(''); let intervalSeconds = $state(60); let autoExecute = $state(false); let isRunning = $state(false); @@ -27,6 +28,15 @@ try { const bot = await api.bots.get(botId); setCurrentBot(bot); + + // Extract token info from strategy config + const strategy = bot.strategy_config; + if (strategy) { + const condition = strategy.conditions?.[0]; + const action = strategy.actions?.[0]; + tokenName = condition?.token || action?.token || ''; + tokenAddress = condition?.token_address || action?.token_address || ''; + } } catch (e) { goto('/dashboard'); } @@ -57,7 +67,7 @@ try { const simulation = await api.simulate.start(botId, { - token, + token: tokenAddress, interval_seconds: intervalSeconds, auto_execute: autoExecute }); @@ -111,9 +121,14 @@
{ e.preventDefault(); startSimulation(); }}>
-
- - +
+ +
+ {tokenName || 'Not configured'} + {#if tokenAddress} + {tokenAddress.slice(0, 10)}...{tokenAddress.slice(-8)} + {/if} +
@@ -276,6 +291,27 @@ gap: 0.5rem; } + .token-display { + display: flex; + flex-direction: column; + gap: 0.25rem; + padding: 0.75rem; + background: rgba(255, 255, 255, 0.05); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 8px; + } + + .token-name { + font-weight: 600; + color: #667eea; + } + + .token-address { + font-size: 0.8rem; + color: #888; + font-family: 'Monaco', 'Menlo', monospace; + } + .checkbox-field { flex-direction: row; align-items: center;