there is not any algorithm that can calculate a selling price for any good, because the parameters include human life.
Why human life cannot be framed into a mathematical system is only a question of belief.
Those who believe differently, follow a religion whose priests are the bankers.
You must endeavor to find the “Just price” for your goods. It is a question of experience in the trade of selling things to the people.
Be generous when you buy, generous when you sell, and kind when you ask for your due.