buy logic