diff --git a/worker.js b/worker.js index fa37797..9966df4 100644 --- a/worker.js +++ b/worker.js @@ -3,6 +3,10 @@ import { PaperEngine } from './lib/paper/engine.js'; import { MartingaleStrategy } from './lib/strategies/martingale.js'; import { MartingaleAlphaStrategy } from './lib/strategies/martingale-alpha.js'; import { ThresholdStrategy } from './lib/strategies/threshold.js'; +import { BullDipBuyer } from './lib/strategies/bull-dip-buyer.js'; +import { SniperReversalStrategy } from './lib/strategies/sniper-reversal.js'; +import { MomentumRiderStrategy } from './lib/strategies/momentum-rider.js'; +import { DontDoubtBullStrategy } from './lib/strategies/dont-doubt-bull.js'; import { getMarket } from './lib/kalshi/rest.js'; import { db } from './lib/db.js'; import { notify } from './lib/notify.js'; @@ -19,10 +23,15 @@ async function main() { const paper = new PaperEngine(1000); await paper.init(); + // Load all 7 strategies! const strategies = [ new MartingaleStrategy({ threshold: 70, baseBet: 1, maxDoublings: 5 }), new MartingaleAlphaStrategy({ minPct: 40, maxPct: 60, baseBet: 1, maxRounds: 3 }), - new ThresholdStrategy({ triggerPct: 65, betSize: 1 }) + new ThresholdStrategy({ triggerPct: 65, betSize: 1 }), + new BullDipBuyer({ maxYesPrice: 45, minYesPrice: 15, betSize: 2 }), + new SniperReversalStrategy({ triggerPct: 95, minsLeft: 3, betSize: 1 }), + new MomentumRiderStrategy({ triggerPct: 75, betSize: 2 }), + new DontDoubtBullStrategy({ minYesPct: 30, maxYesPct: 40, betSize: 2 }) ]; for (const s of strategies) { @@ -33,7 +42,6 @@ async function main() { let latestMarketState = null; - // Handles markets that rotated BEFORE Kalshi posted the final result async function processOrphans() { if (paper._resetting) return; try { @@ -54,7 +62,6 @@ async function main() { } } - // Check orphans immediately on startup, then every 60 seconds await processOrphans(); setInterval(processOrphans, 60000); @@ -72,9 +79,6 @@ 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; @@ -114,14 +118,14 @@ async function main() { ); } } else { - console.log(`[Worker] Result for ${ticker} pending. Background poller will handle it when Kalshi publishes the outcome.`); + console.log(`[Worker] Result for ${ticker} pending.`); } writeState(latestMarketState, paper, strategies); }); await tracker.start(); - await notify('🤖 Kalbot Worker started!', 'Kalbot Online', 'low', 'robot,green_circle'); + await notify('🤖 Kalbot Worker started with 7 strats!', 'Kalbot Online', 'low', 'robot,green_circle'); heartbeatTimer = setInterval(() => { writeState(latestMarketState, paper, strategies);