Refactor to fetch_prices function.