adding the buy function to batches