ta-rs icon indicating copy to clipboard operation
ta-rs copied to clipboard

Add simple RollingWindow trait

Open apriori opened this issue 5 years ago • 1 comments

Pretty much just

trait RollingWindow {
  fn length(&self) -> usize;
}

for all indicators. This won't hide the fact that all these indicators are essentially rolling window filters and need to be pre-fed with historical data with length (RollingWindow::length -1). For combined indicators this is of course the max rolling window length of all indicators (-1, of course).

I use this information in order to read the pre-feed for the window e.g. via ordinary rest calls and then turn to websockets based listening and async streaming. The first yielded value is then the current (in time) value for the given indicator.

apriori avatar Jan 03 '20 23:01 apriori

Thanks for your report. I may name the trait differently I got the idea and thinks your requirement is reasonable so I'll implement it.

greyblake avatar Jan 06 '20 12:01 greyblake