diff --git a/src/api/strategy.ts b/src/api/strategy.ts index 5f668491..6ca35c6b 100644 --- a/src/api/strategy.ts +++ b/src/api/strategy.ts @@ -48,13 +48,15 @@ export async function startStrategy(data: StrategyStartRequest): Promise { - const res = await apiRequest("POST", "/strategy/stop"); +export async function stopStrategy(mode?: string): Promise { + const url = mode ? `/strategy/stop?mode=${encodeURIComponent(mode)}` : "/strategy/stop"; + const res = await apiRequest("POST", url); return res.json(); } -export async function resumeStrategy(): Promise { - const res = await apiRequest("POST", "/strategy/resume"); +export async function resumeStrategy(mode?: string): Promise { + const url = mode ? `/strategy/resume?mode=${encodeURIComponent(mode)}` : "/strategy/resume"; + const res = await apiRequest("POST", url); return res.json(); } diff --git a/src/components/landing/PortfolioSection.tsx b/src/components/landing/PortfolioSection.tsx index f90ebb39..627e2b38 100644 --- a/src/components/landing/PortfolioSection.tsx +++ b/src/components/landing/PortfolioSection.tsx @@ -1193,7 +1193,7 @@ export default function PortfolioSection() { const handleStop = async () => { setIsStopping(true); try { - const result = await stopStrategy(); + const result = await stopStrategy("LIVE"); if (result?.status === "stopped") { clearFreshStartPreference(); if (result?.warning) { diff --git a/src/pages/PaperPortfolio.tsx b/src/pages/PaperPortfolio.tsx index 1bd5621f..4481a82d 100644 --- a/src/pages/PaperPortfolio.tsx +++ b/src/pages/PaperPortfolio.tsx @@ -548,7 +548,7 @@ function PaperTradingPortfolio() { const handleStop = async () => { setIsStopping(true); try { - await stopStrategy(); + await stopStrategy("PAPER"); setFreshStartRequested(false); toast({ title: "Paper strategy stopped",