Under dynamic pricing, organizations can reduce their electricity cost by varying their load with price. When the end load is inflexible, storage can match the energy draw from the grid to the price. In this paper we present a general model for power cost management by shifting demand for high power away from high electricity price periods through imperfect energy storages. Using Lyapunov optimization, we present a policy that achieves a solution with bounded suboptimality. We demonstrate that the sampling rate must increase as either the battery capacity decreases or the charge rate increases.