Refactor strategy execution logic to improve clarity on arming conditions
This commit is contained in:
parent
3640cd745e
commit
67b633ae9b
@ -629,8 +629,7 @@ export default function PortfolioSection() {
|
|||||||
: "Strategy stopped";
|
: "Strategy stopped";
|
||||||
|
|
||||||
const marketState = marketStatus?.status ?? "UNKNOWN";
|
const marketState = marketStatus?.status ?? "UNKNOWN";
|
||||||
const executionAllowed =
|
const canArmStrategy = liveness === "ACTIVE" || liveness === "STOPPED";
|
||||||
marketState === "OPEN" && (liveness === "ACTIVE" || liveness === "STOPPED");
|
|
||||||
|
|
||||||
const nextEligibleTs = engineStatus?.next_eligible_ts
|
const nextEligibleTs = engineStatus?.next_eligible_ts
|
||||||
? new Date(engineStatus.next_eligible_ts)
|
? new Date(engineStatus.next_eligible_ts)
|
||||||
@ -1143,7 +1142,7 @@ export default function PortfolioSection() {
|
|||||||
<MotionButton
|
<MotionButton
|
||||||
{...ctaMotionProps}
|
{...ctaMotionProps}
|
||||||
onClick={handleStart}
|
onClick={handleStart}
|
||||||
disabled={isStarting || !executionAllowed || isStrategyActive}
|
disabled={isStarting || !canArmStrategy || isStrategyActive}
|
||||||
className="shimmer"
|
className="shimmer"
|
||||||
>
|
>
|
||||||
{isStarting ? "Starting..." : "Start Strategy"}
|
{isStarting ? "Starting..." : "Start Strategy"}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user