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
Getasseconds
Converts a count of time units into seconds.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Readnestedmapvalueofinin
Reads a value from a two-level keyed map in the socket's persistent storage.
Calculate
Applies a binary arithmetic operation to two values and returns the result.
Bubble
Surfaces a value as an output of this plug.
Related plugs · 8
Not ready to run as it stands: it waits on values or a position of your own.