auctions ======== .. py:module:: sidequest_common.models.auctions .. autoapi-nested-parse:: Auction house prices synced from Battle.net, member price watches, and the bot's alert queue. ``AuctionHousePriceRow`` holds each house's current price per item, replaced wholesale for a house on every sync. ``AuctionHouseState`` tracks which houses are currently part of the guild's faction, so a house dropped from the faction (or gone empty) can have its stale price rows pruned. ``AuctionDailyHistory`` keeps one lowest-price row per (item, day) for the trend chart, pruned past ``AUCTION_HISTORY_DAYS``. ``AuctionWatch``/``AuctionAlert`` back a member's price alerts. .. py:class:: AuctionHousePriceRow Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` One auction house's current price for one item, keyed by ``(house_id, item_id)``. Replaced wholesale for a house on every sync: the sync deletes a house's existing rows and bulk-inserts the freshly aggregated ones in one transaction, so a price that drops off the house never lingers. .. py:attribute:: house_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: item_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: house_name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: unit_price :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: quantity :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: listings :type: sqlalchemy.orm.Mapped[int] .. py:class:: AuctionHouseState Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` Sync bookkeeping for one auction house: whether it's currently part of the guild's faction, and counts. ``is_active`` lets a sync prune ``AuctionHousePriceRow`` rows for a house that dropped out of the faction set (Battle.net could in principle reshuffle which houses are Alliance/Horde/Blackwater). .. py:attribute:: house_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: house_name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: is_active :type: sqlalchemy.orm.Mapped[bool] .. py:attribute:: auctions_count :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: commodities_count :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: last_synced_at :type: sqlalchemy.orm.Mapped[datetime.datetime | None] .. py:class:: AuctionDailyHistory Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` One item's lowest unit price and latest total quantity for one UTC day, across the faction's houses. .. py:attribute:: item_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: day :type: sqlalchemy.orm.Mapped[datetime.date] .. py:attribute:: unit_price :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: quantity_total :type: sqlalchemy.orm.Mapped[int] .. py:class:: AuctionWatch Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` One member's price watch on an item: alert when the lowest unit price is at or below ``max_unit_price``. .. py:attribute:: member_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: item_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: max_unit_price :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: last_alerted_at :type: sqlalchemy.orm.Mapped[datetime.datetime | None] .. py:attribute:: last_alerted_price :type: sqlalchemy.orm.Mapped[int | None] .. py:class:: AuctionAlert Bases: :py:obj:`advanced_alchemy.base.UUIDAuditBase` One queued price alert for a watch, the bot DMs and acks (``posted_at``). ``discord_user_id``/``member_name`` are snapshotted at queue time so the alert reads correctly even if the member later renames or unlinks. ``created_at`` (from the audit base) orders the pending queue oldest first. .. py:attribute:: watch_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: discord_user_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: member_name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: item_id :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: unit_price :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: max_unit_price :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: quantity :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: house_name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: posted_at :type: sqlalchemy.orm.Mapped[datetime.datetime | None]