Commodities Buyer and Seller

Commodities Buyer and Seller

183 Downloads

Usage of cancelAuctions() unclear

steenert opened this issue ยท 5 comments

commented

Hi,

If possible, could you explain a little bit how we should call the "cancelAuctions()" function? Can it be called directly after "CommodityBuyerAndSeller.sell" or should it be used in some other way? Also is there a way to always cancel auctions that have been undercut?

Thanks in advance!

commented

Hi, in the current state it can be called manually to cancel auctions with: /run CommodityBuyerAndSeller.cancelAuctions().

commented

Hi Sanjo -
Also curious how this works. When you run the .cancelAuctions() command manually, what is the logic behind what it should cancel? Is it looking for undercut auctions, or some other flag?

commented

Based on the metric for how many auctions seem to be sold per day (from TradeSkillMaster), it cancels everything where it seems that the auction runs out.

With this implementation, even when there are some auctions for a lower price in the auction house, if enough of the commodity is sold per day, the auction is kept in the auction house.

The implementation can be found here:

local quantity = 0
Array.forEach(results, function(result)
if result.containsOwnerItem then
local estimatedAmountThatSellsUntilTheAuctionRunsOut = amountSoldPerDay * (result.timeLeftSeconds / (24 * 60 * 60))
if quantity > estimatedAmountThatSellsUntilTheAuctionRunsOut then
_.loadItem(result.itemID)
local itemLink = select(2, GetItemInfo(result.itemID))
print('Cancelling ' .. result.numOwnerItems .. ' x ' .. itemLink .. '.')
if _.showConfirmButton() then
C_AuctionHouse.CancelAuction(result.auctionID)
Events.waitForEventCondition('AUCTION_CANCELED', function(self, event, auctionID)
return auctionID == result.auctionID
end)
end
end
end
quantity = quantity + result.quantity
end)
.

commented

Ah I see, interesting! I can see how that would be useful for certain items.

I was hoping there might be a Cancel function that can cycle through existing auctions and check for undercuts and cancel those auctions. I know the logic exists to check for undercuts, as you have that working when posting items. When posting Region-Wide Commodities quickly, it's helpful to be able to cancel auctions immediately after running out of stock. Maybe even define just specific items to cancel on the AH via the API. The same way we define items to post via the CommodityBuyerAndSellerData.lua file.

commented

Thank you for explaining, however I do agree with fatmagic that it would be nice to have a function that does not consider the auctions sold per day before canceling. A function that only checks for undercuts.