What this does
This plug records the named token's latest Chainlink USD price under a day-aligned key in socket storage and returns the simple moving average across a caller-set window of days. It asks the caller for a token address and a window count of days. It runs when invoked, reading the current block timestamp and looping over the window to sum daily prices before dividing by the window. Computing this manually or off a stale stored reading yields an average that misstates the token's true price trend.
Actions · 15















Related plugs · 8