feat: pass mode when stopping/resuming strategy
stopStrategy and resumeStrategy now accept an optional mode string and append ?mode= to the API call. PaperPortfolio passes PAPER, PortfolioSection passes LIVE, so each page only stops its own run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e19440b438
commit
caa3fc8838
@ -48,13 +48,15 @@ export async function startStrategy(data: StrategyStartRequest): Promise<Strateg
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function stopStrategy(): Promise<StrategyActionResponse> {
|
||||
const res = await apiRequest("POST", "/strategy/stop");
|
||||
export async function stopStrategy(mode?: string): Promise<StrategyActionResponse> {
|
||||
const url = mode ? `/strategy/stop?mode=${encodeURIComponent(mode)}` : "/strategy/stop";
|
||||
const res = await apiRequest("POST", url);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function resumeStrategy(): Promise<StrategyActionResponse> {
|
||||
const res = await apiRequest("POST", "/strategy/resume");
|
||||
export async function resumeStrategy(mode?: string): Promise<StrategyActionResponse> {
|
||||
const url = mode ? `/strategy/resume?mode=${encodeURIComponent(mode)}` : "/strategy/resume";
|
||||
const res = await apiRequest("POST", url);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -548,7 +548,7 @@ function PaperTradingPortfolio() {
|
||||
const handleStop = async () => {
|
||||
setIsStopping(true);
|
||||
try {
|
||||
await stopStrategy();
|
||||
await stopStrategy("PAPER");
|
||||
setFreshStartRequested(false);
|
||||
toast({
|
||||
title: "Paper strategy stopped",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user