Skip to content

fix(buyer): cap against the market instead of the static override - #45

Merged
icemansparks merged 2 commits into
merkerhoodfrom
fix/buyer-cap-follows-market
Sep 20, 2026
Merged

icemansparks merged 2 commits into
merkerhoodfrom
fix/buyer-cap-follows-market

Conversation

@icemansparks

Copy link
Copy Markdown
Collaborator

Changes Proposed:

  • The moving average divides each history row by its quantity. final_price is what the whole stack went for, and everything downstream works per item.
  • New GetMarketReferencePrice(): the demand-adjusted moving average for an item, or 0 without trading history.
  • The buyer's ceiling is the higher of the price override cap and that market reference plus 15 percent, so the bot no longer refuses prices it asks for itself.
  • The market reference is only read for auctions the override cap would turn away, and cached for the rest of the pass.

Issues Addressed:

SOURCE:

On the live realm the override for Rugged Leather (8170) is avgPrice = minPrice = 11000, which collapses the cap to the average; #30's headroom lifts it to 12650 per leather. The bot's own listings for that item ran from 11241 to 13407 per item at the time of writing, five of eleven above its own buy ceiling, so a player pricing against what they see in the auction house lands above the cap about half the time. 6601 of 11469 override rows have minPrice = avgPrice, so this is not one bad row.

The unit bug feeds the same problem from the other side. The insert sites in AuctionHouseBotAuctionHouseScript.cpp write auction->bid / auction->buyout (stack totals) next to quantity, while CalculateMovingAveragePrices() averaged final_price as if it were a price per item. A twelve stack of leather therefore read as twelve times the price per leather, and the baseline ran into the avgPrice * 2 clamp for every item that sells in stacks.

Two things worth knowing about the new cap:

  • The moving average is only clamped (to avgPrice * 2) for items that have an override row. An item without one has no ceiling on its average, and the buyer now reads that average. With the default AuctionCount = 100 a single trade moves it by about a percent, so the drift is slow, but a very low AuctionCount would let a buyer and seller pair ratchet an unpriced item.
  • The demand multiplier is bounded by DynamicPricingMinMultiplier / DynamicPricingMaxMultiplier (0.5 to 3.0 by default).

Tests Performed:

  • AuctionHouseBot.cpp.o builds clean on TEST against the current tree.
  • Unit trace: the average stays per item through AdjustPrices(), Sell() multiplies by stackCount once at auction creation, and the buyer multiplies its cap by pItem->GetCount() once, against a currentPrice that is a stack total.

How to Test the Changes:

  1. List a stack of an item the bot also sells, priced at what the bot asks for its own listings, and confirm the bot bids on it within a bidding interval.
  2. Compare the bot's own listing prices for a stackable item before and after: they should sit near the per item transaction average instead of near avgPrice * 2.
  3. AuctionHouseBot.TRACE_BUYER = 1 logs the resulting Bid Max per auction.

The seller prices off the moving average and the demand multiplier, both of
which climb above the price override, while the buyer capped at the override
plus 15 percent. Listings priced the way the bot prices its own were refused,
which is what players see as an item the bot will not buy.

The moving average was also reading stack totals as per item prices, because
final_price holds what the whole stack went for. A twelve stack of leather
therefore read as twelve times the price per leather and pushed the baseline
into the avgPrice * 2 clamp for every item that sells in stacks.

Closes #39
…uses

The lookup costs two world database queries and a pass evaluates up to a
hundred auctions per bid it places, so it now runs only for auctions the
override cap would turn away, and the result is cached for the rest of the
pass.
@icemansparks
icemansparks merged commit 9a715ae into merkerhood Sep 20, 2026
1 check passed
@icemansparks
icemansparks deleted the fix/buyer-cap-follows-market branch September 20, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant