Get Price Running Total
0x484428507A212cA56D71baa27Ca6089a6dB63a88

What this does

This plug reads a stored simple moving average value from the socket's sma map and adds it to a running price total. It asks the caller for token, today, days_back, and price_running_total. It fires each time the caller runs it, converting days_back into seconds, subtracting that from today to form the lookup timestamp, and reading the sma keyed by token and that timestamp. Computing the offset timestamp and summing by hand risks keying the wrong day and corrupting the accumulated total.

Actions · 5

  • Get duration
    Get as seconds
    Converts a count of time units into seconds.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Read nested map value
    Read nested map value of in in
    Reads a value from a two-level keyed map in the socket's persistent storage.
  • Calculate
    Calculate
    Applies a binary arithmetic operation to two values and returns the result.
  • Bubble
    Bubble
    Surfaces a value as an output of this plug.

Related plugs · 8