timescaledb-toolkit icon indicating copy to clipboard operation
timescaledb-toolkit copied to clipboard

Add $times and $values to lambda blocks

Open jonatas opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. I'm looking for building some finance indicators using pipeline functions.

When using lambdas I see the only predefined variables are the actual $time and $value. It would be great to have access to the series and previous elements somehow.

Describe the solution you'd like

For example, if I'd build some moving averages, I could use like $values[-1] to get the previous element or a range like $values[-1..-5] to get a range of the last 5 elements. Not sure about the range syntax but that is the idea.

I also see a great value to have access to the actual $index of the element in the collection during the iteration.

Describe alternatives you've considered I'm not sure maybe it can be done with some other pipeline functions, still learning here.

jonatas avatar Oct 21 '21 19:10 jonatas