Home Leaderboard Dashboard

Why We Built the Browser Heartbeat System (And Why It Saves Us Money)

Let's be transparent about something: running WeatherBot costs a significant amount of money in AI credits. Every 5 minutes, Claude analyzes 15 weather markets โ€” that's 15 separate API calls, each with a detailed meteorological prompt, forecast data, trade history, and market context. A single analysis cycle costs approximately $0.08-0.12 in Anthropic API credits. Over a full day, that's $23-35 per active user.

Before this update, the bot kept running indefinitely once you clicked "Start Bot" โ€” even after you closed your browser, went to sleep, or forgot about it entirely. We had users whose bots ran for 72+ hours straight while they weren't even watching. That's over $100 in wasted API credits with nobody monitoring the trades.

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 WeatherBot, 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 WeatherBot 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

Hong Kong Trades Are Now More Accurate Than Ever: We Plugged the Engine Straight Into the Source That Settles the Market

Read article โ†’

WeatherBot by the Numbers: 9,592 Traders, $2.87M in Member Profit, and Exactly What It Costs to Run

Read article โ†’

We Banned 213 Accounts for Engine Abuse โ€” Here Is Exactly What Happened, and Why

Read article โ†’
โ† All articles