price algorithm