Optimising Batteries on Energy Markets