Vixen
c7401864
csharp
public sealed class MovingAverageMarket

A moving average over the last few sales of each thing.

Read the guide page for this →

Remarks

⚠ Weighted by count. One sale of a hundred ore says more about what ore is worth than one sale of a single one, and an unweighted mean lets somebody move the reference price by listing one of something at an absurd number.

⚠ A fixed window of recent sales rather than a decay over time. A time decay needs a clock every read and answers differently depending on when it is asked, which makes a vendor's displayed price flicker while nobody trades. A window of the last n only changes when something actually sells.

Fields and properties (2)

  • public int Window

    How many sales of each thing it remembers.

  • public int Assets

    How many things it has seen sold.

Methods (5)

  • public MovingAverageMarket(int window = 20)

    Makes one.

  • public int SalesOf(DefId asset)

    How many sales of something it is remembering.

  • public void Record(in TradeRecord sale)

    Records a sale.

  • public long Suggest(DefId asset, long fallback = 0)

    What one of something is worth.

  • public bool Forget(DefId asset)

    Forgets everything about something. What a content removal does.

Used by (2)

  • AuctionTestsVixen.Gameplay.Economy.Tests
  • PriceModelTestsVixen.Gameplay.Economy.Tests