Timeframes Module¶
The Timeframe class represents a range of kline candles with start/end timestamps,
timezone, and iteration support.
Timeframe class: represents a discrete time range of klines.
Uses KlineTimestamp from kline-timestamp library for candle boundary calculations.
Classes:
|
- class Timeframe(start: str | int | datetime | KlineTimestamp | None, end: str | int | datetime | KlineTimestamp | None, timezone_IANA: str | None = 'UTC', tick_interval: str | None = '1m', hours: int = None, limit: int = None, closed: bool = True)[source]¶
Bases:
objectMethods:
Converts the Timeframe to a formatted string.
adjust_to_open([inplace])Adjusts the start and end to the beginning of their respective tick intervals.
get_ms()Returns the total milliseconds from start to end.
update_tick_interval(tick_interval[, inplace])Updates the tick interval.
Returns the number of hours in the Timeframe.
Returns the number of candles (len).
get_pandas_index([name])Returns a pandas DatetimeIndex for the Timeframe.
- adjust_to_open(inplace: bool = False) Timeframe[source]¶
Adjusts the start and end to the beginning of their respective tick intervals.