(rows_per_symbol: int, symbols: list[str])
| 145 | |
| 146 | |
| 147 | def make_dataset(rows_per_symbol: int, symbols: list[str]) -> pl.DataFrame: |
| 148 | frames: list[pl.DataFrame] = [] |
| 149 | ts_base = pl.datetime_range( |
| 150 | start=pl.datetime(2020, 1, 1), |
| 151 | end=pl.datetime(2020, 1, 1) + pl.duration(minutes=rows_per_symbol - 1), |
| 152 | interval="1m", |
| 153 | eager=True, |
| 154 | ) |
| 155 | for symbol in symbols: |
| 156 | frames.append( |
| 157 | pl.DataFrame( |
| 158 | { |
| 159 | "ts": ts_base, |
| 160 | "symbol": [symbol] * rows_per_symbol, |
| 161 | "open": pl.arange(0, rows_per_symbol, eager=True).cast(pl.Float64) + 100.0, |
| 162 | "high": pl.arange(0, rows_per_symbol, eager=True).cast(pl.Float64) + 100.5, |
| 163 | "low": pl.arange(0, rows_per_symbol, eager=True).cast(pl.Float64) + 99.5, |
| 164 | "close": pl.arange(0, rows_per_symbol, eager=True).cast(pl.Float64) + 100.2, |
| 165 | "volume": pl.repeat(1000.0, rows_per_symbol, eager=True), |
| 166 | } |
| 167 | ) |
| 168 | ) |
| 169 | return pl.concat(frames, rechunk=True) |
| 170 | |
| 171 | |
| 172 | def run_benchmarks(rows_per_symbol: int, symbols: int, iterations: int) -> dict[str, Any]: |
no test coverage detected