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

Function _make_base_frame

notebooks/python/scripts/bar_diagnostics.py:10–26  ·  view source on GitHub ↗
(n: int = 720, seed: int = 11)

Source from the content-addressed store, hash-verified

8
9
10def _make_base_frame(n: int = 720, seed: int = 11) -> pl.DataFrame:
11 ds = openquant.research.make_synthetic_futures_dataset(n_bars=n, seed=seed, asset_names=["SPY", "QQQ", "IWM"])
12 volume = [float(80_000 + int(25_000 * (1.0 + math.sin(i / 17.0)))) for i in range(n)]
13 outlier_idx = max(n // 3, 1)
14 volume[outlier_idx] *= 25.0
15 return pl.DataFrame(
16 {
17 "ts": ds.timestamps,
18 "symbol": ["SPY"] * n,
19 "open": ds.close,
20 "high": [c * 1.002 for c in ds.close],
21 "low": [c * 0.998 for c in ds.close],
22 "close": ds.close,
23 "volume": volume,
24 "adj_close": ds.close,
25 }
26 )
27
28
29def main() -> None:

Callers 1

mainFunction · 0.85

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected