stock logic