Home Leaderboard Launch App

The Browser Heartbeat That Conserves Claude Credits

Some honesty up front: running this engine is expensive on the AI side. Every five minutes, Claude reviews fifteen books — fifteen separate API calls, each carrying a fully briefed meteorological prompt with forecast data, prior fills, and current order-book context. One analysis cycle lands at roughly $0.08–$0.12 in Anthropic spend. Multiply through a day and that becomes $23–$35 per active trader.

Before this update the engine kept running indefinitely once you hit "Start Bot" — including after you closed the tab, went to bed, or simply forgot. We had traders whose sessions ran for 72+ hours straight without anyone watching. That is over $100 of credits burned on trades nobody saw happen.

The Problem

We were burning through thousands of dollars in Claude API credits every week — and a large portion of that was for bots running with nobody watching. Trades were executing, positions were opening and closing, and users had no idea because their browser was closed. Some users came back to find unexpected losses from trades they never saw happen. That's not how a responsible trading platform should work.

How the Heartbeat Works

The solution is elegantly simple. Here's the exact mechanism:

1
Browser Sends a Ping Every 3 Minutes
As long as your browser tab is open (even in the background), the dashboard sends a tiny HTTP request to the server every 3 minutes: POST /api/heartbeat. This is a few bytes — essentially saying "I'm still here."
2
Server Tracks Last Heartbeat Per User
The server stores a timestamp for each user's last heartbeat. Every 60 seconds, a background checker scans all running bots and compares their last heartbeat against the current time.
3
6 Minutes of Silence = Auto-Stop
If no heartbeat is received for 6 minutes (two missed pings), the server immediately stops the bot — all AI analysis cycles, WebSocket price streaming, and trade execution are halted. The session is closed cleanly.
4
User Returns → Clear Notification
When you reopen StormBot, you'll see a prominent red banner: "Session Expired — Your previous session was automatically closed after 6 minutes of inactivity to conserve API credits." Simply click "Start Bot" to begin a new trading session.

The Impact

Since implementing the heartbeat system, we've reduced unnecessary API spending by an estimated 60-70%. That's money we're reinvesting directly into making StormBot better — faster servers, more weather data sources, and the Gemini + TensorFlow integrations you'll see launching soon.

More importantly, it protects you. No more waking up to find the bot made trades while you were sleeping. Every trade happens while you're actively monitoring.

Want to Trade Without the Heartbeat?

We understand some traders prefer 24/7 uninterrupted operation. If you'd like the heartbeat system removed from your account — allowing the bot to run continuously even when your browser is closed — we can arrange that on a per-account basis.

Please note that this will significantly increase your API credit consumption. We'll discuss the implications and ensure your account has appropriate credit limits configured before enabling always-on mode.

Contact Us to Schedule a Meeting
Read next

The Hong Kong Lock: We Stopped Forecasting the City and Started Reading It

Read article

Wiring WeatherNext 2 Into the Engine

Read article

Engine v2 Shipped — Faster Streams, Wider Books, Tighter AI

Read article
All articles