MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _interval_to_seconds

Function _interval_to_seconds

python/openquant/bars.py:12–22  ·  view source on GitHub ↗
(interval: str)

Source from the content-addressed store, hash-verified

10
11
12def _interval_to_seconds(interval: str) -> int:
13 s = interval.strip().lower()
14 if s.endswith("d"):
15 return int(s[:-1]) * 24 * 3600
16 if s.endswith("h"):
17 return int(s[:-1]) * 3600
18 if s.endswith("m"):
19 return int(s[:-1]) * 60
20 if s.endswith("s"):
21 return int(s[:-1])
22 raise ValueError(f"unsupported interval format: {interval}")
23
24
25def _rows_to_frame(symbol: str, rows: list[tuple[str, str, float, float, float, float, float, float, int]]) -> pl.DataFrame:

Callers 1

build_time_barsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected