Live demo · Battery energy trading
An AI that trades a grid battery, and protects it.
The agent plans 48 hours of buying and selling on the wholesale market from a price forecast. It counts battery wear as a real cost, so it only trades when the profit is worth it.
More settings
How it compares
Same prices, same battery, same accounting. The bot buys when the price dips below its 3-hour average and sells when it rises above it. Perfect hindsight is the most any strategy could earn.
Profit after battery wear
Buy low, sell high
The agent charges in the overnight lull and the midday solar dip, then sells into the morning and evening peaks.
Every cycle has a price
Each MWh through the battery carries a wear cost. Trades that don't beat it are skipped, so the asset lasts longer.
Plans on forecasts, not hindsight
It trades on an imperfect forecast and re-plans every hour, the way a real operator must, and is scored on what actually happened.
How the agent decides
Every 15 minutes the agent picks how much to charge, discharge or hold. Its reward is:
reward = arbitrage cash − battery wear − micro-cycling penalty
The state is the time, the battery's charge level and whether it is currently charging, discharging or holding. The agent's decision table is computed with exact Bellman updates, which give the same answer a fully trained Q-learning agent converges to.
In Forecast mode the agent never sees the real future. Every hour it receives a fresh price forecast (the actual prices plus simulated forecast error that grows with lead time and smooths out peaks and dips), re-plans the rest of the horizon, and executes the next hour. Perfect hindsight plans on the actual prices and shows the theoretical maximum.