Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable start time for sampling #141

Open
CITIZENDOT opened this issue Jun 26, 2024 · 0 comments · May be fixed by #142
Open

Customizable start time for sampling #141

CITIZENDOT opened this issue Jun 26, 2024 · 0 comments · May be fixed by #142

Comments

@CITIZENDOT
Copy link

CITIZENDOT commented Jun 26, 2024

First of all, Thank you for such a great library ❤️. There are not a lot of packages which offer streaming calculations.

Coming to the issue, Start time of sampling is restricted to the semantic beginning of time units.

https://nardew.github.io/talipp/latest/reference/talipp/input/

Each timeframe is counted from different starting point. Seconds are counted since whole minutes, minutes are counted since whole hours, hours are counted since whole days and days are counted since the beginning of the year.

Why this is an issue? Let's take an example:

  • Market starts at 09:15 AM
  • A Sampler of MIN_4 is being used in an indicator.
  • In this case, It makes more sense to merge 09:15 AM and 09:19 AM into one period, because market started at 09:15 AM, and 09:19 is 4 minutes away from it.
  • But the sampler says, 09:15 AM comes into the period of 09:12 AM to 09:16 AM. (minutes are counted since whole hours), and does not merge 09:19 AM into first period.

I think, Sampler can have an optional starting point (datetime). If user did not set it, it can behave just as it's behaving now. But if user sets it, it'll use it instead.

So, Everyday, user can set it to market's opening time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant