indicado icon indicating copy to clipboard operation
indicado copied to clipboard

API design: size of returned lists

Open germanftorres opened this issue 3 years ago • 0 comments

Hi!

Thanks for putting up this library, it's very helpful for financial exploration and I would like to use it with Livebook and Nx and Explorer. It's also great to learn how technical analysis works.

One suggestion from my side is that the returned list to be the same size of the input list.

Currently this is the behaviour

iex> [1, 2, 3, 4, 5] |> Indicado.SMA.eval!(3)
iex> [2.0, 3.0, 4.0]

In my opinion, it would be great that the Indicado library returned a list with exactly the same size as the source list, so that you can relate back each data point to the source list by a simple Enum.zip() and would be very useful for using with a DataFrame library like Explorer.

iex(1)> source = [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]

iex> sma = source |> Indicado.SMA(3) 
[nil, nil, 2.0, 3.0, 4.0]

iex(2)> source |> Enum.zip(sma) 
[{1, nil}, {2, nil}, {3, 2.0}, {4, 3.0}, {5, 4.0}]

Any thoughts?

Thanks!

Germán

germanftorres avatar Jul 08 '22 17:07 germanftorres