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

is_same_period correctness #167

Open
powellnorma opened this issue Feb 19, 2025 · 0 comments
Open

is_same_period correctness #167

powellnorma opened this issue Feb 19, 2025 · 0 comments

Comments

@powellnorma
Copy link

# 5min candles
c1 = OHLCV(time=datetime.fromisoformat('2024-01-02T15:45:00+00:00'), open=1, high=2, low=3, close=4)
c2 = OHLCV(time=datetime.fromisoformat('2024-01-02T15:50:00+00:00'), open=1, high=2, low=3, close=4)

s = Sampler(SamplingPeriodType.MIN_15)
print(s.is_same_period(c1, c2))

I think usually the time of a candle represents the end timestamp of the period (that the candle represents).
In that case c1 would represent 40-45, and c2 45-50. So c1 would belong to the 15min period 30-45, and c2 to 45-60. Yet, currently is_same_period returns True

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

No branches or pull requests

1 participant