Skip to content

is_same_period correctness #167

@powellnorma

Description

@powellnorma
# 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions