backend for time,price sorting complete