def METHOD_NAME(self, item: ItemType, quantity: int) -> None:
    for _ in range(quantity):
        if self.has_pending_orders(item):
            self.do_cancel_purchase(item)
        elif self.can_sell(item):
            self.do_sale(item)
        else:
            raise TransactionError(f"Cannot sell more {item}")
        self.coalition.adjust_budget(self.price_of(item))