diff --git a/worker.js b/worker.js index e405f4e..fa37797 100644 --- a/worker.js +++ b/worker.js @@ -72,6 +72,14 @@ async function main() { for (const strategy of strategies) { if (!strategy.enabled) continue; + // FIX: Prevent parallel betting! + // If the strategy has an unresolved position in limbo, it MUST wait. + // This protects the strict mathematical sequence of Martingale systems. + const acct = paper._getAccount(strategy.name); + if (acct.openPositions.size > 0) { + continue; + } + const signal = strategy.evaluate(state); if (signal) { console.log(`[Worker] Signal from ${strategy.name}: ${signal.side} @ ${signal.price}¢ — ${signal.reason}`);