From a13096ea86134b84b060c2190e249f4cd74b3824 Mon Sep 17 00:00:00 2001 From: Senofy <63175905+Senofy@users.noreply.github.com> Date: Tue, 10 Mar 2026 03:35:50 -0500 Subject: [PATCH] =?UTF-8?q?Add=20Random=20direction=20option=20=E2=80=94?= =?UTF-8?q?=20picks=20Buy=20or=20Sell=20once=20per=20batch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All accounts in the same batch trade the same resolved direction. Each new batch (after positions are flat) picks a fresh random direction. Co-Authored-By: Claude Sonnet 4.6 --- app/api/trade/route.ts | 2 +- app/page.tsx | 10 ++++++++-- lib/auto-trade.ts | 24 ++++++++++++++---------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/api/trade/route.ts b/app/api/trade/route.ts index 56fc66b..c7789e8 100644 --- a/app/api/trade/route.ts +++ b/app/api/trade/route.ts @@ -4,7 +4,7 @@ import { POINT_VALUES } from '@/lib/trading-logic'; export async function POST(req: NextRequest) { try { - const body = await req.json() as { action: 'Buy' | 'Sell'; symbol: string }; + const body = await req.json() as { action: 'Buy' | 'Sell' | 'Random'; symbol: string }; const { action, symbol } = body; if (!action || !symbol) { diff --git a/app/page.tsx b/app/page.tsx index f278b4f..9d9a3ef 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -247,7 +247,7 @@ function FirmRows({ state, firm, deleteMode, selected, onToggle, hideDead, priva interface SchedulerStatus { running: boolean; - action: 'Buy' | 'Sell'; + action: 'Buy' | 'Sell' | 'Random'; symbol: string; lastRun: string | null; } @@ -267,7 +267,7 @@ export default function Home() { const [scheduler, setScheduler] = useState({ running: false, action: 'Buy', symbol: 'NQ', lastRun: null }); const [enabledSymbols, setEnabledSymbols] = useState([]); const [tradeSymbol, setTradeSymbol] = useState(''); - const [tradeAction, setTradeAction] = useState<'Buy' | 'Sell'>('Buy'); + const [tradeAction, setTradeAction] = useState<'Buy' | 'Sell' | 'Random'>('Buy'); const [tradeLoading, setTradeLoading] = useState(false); const handleSort = (col: SortKey) => { @@ -487,6 +487,12 @@ export default function Home() { > Sell +