done logic of selling and buying