refactor : a skeleton for strategy optimize

a skeleton,
refactor : move count_best_price as a function

Then the test cases can call count_best_price for reuse.