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

Function _base_frame

python/tests/test_bars_module.py:8–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def _base_frame() -> pl.DataFrame:
9 ts = [
10 "2024-01-01 09:30:00",
11 "2024-01-01 09:31:00",
12 "2024-01-01 09:33:00",
13 "2024-01-01 09:34:00",
14 "2024-01-01 09:35:00",
15 "2024-01-01 09:36:00",
16 "2024-01-01 09:37:00",
17 "2024-01-01 09:39:00",
18 "2024-01-01 09:40:00",
19 "2024-01-01 09:41:00",
20 ]
21 close = [100.0, 100.4, 100.1, 100.8, 100.7, 101.2, 101.0, 101.5, 101.4, 101.7]
22 volume = [80_000.0, 85_000.0, 90_000.0, 88_000.0, 95_000.0, 300_000.0, 92_000.0, 98_000.0, 99_000.0, 97_000.0]
23 return pl.DataFrame(
24 {
25 "ts": ts,
26 "symbol": ["SPY"] * len(ts),
27 "open": close,
28 "high": [x * 1.001 for x in close],
29 "low": [x * 0.999 for x in close],
30 "close": close,
31 "volume": volume,
32 "adj_close": close,
33 }
34 )
35
36
37def _assert_bar_invariants(df: pl.DataFrame) -> None:

Calls

no outgoing calls

Tested by

no test coverage detected