public sealed class MovingAverageMarketA moving average over the last few sales of each thing.
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 WindowHow many sales of each thing it remembers.
public int AssetsHow 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