(
timestamps: Vec<String>,
prices: Vec<f64>,
volumes: Vec<f64>,
dollar_value_per_bar: f64,
)
| 51 | Ok(bars_to_rows(bars)) |
| 52 | } |
| 53 | |
| 54 | #[pyfunction(name = "build_dollar_bars")] |
| 55 | fn bars_build_dollar_bars( |
| 56 | timestamps: Vec<String>, |
| 57 | prices: Vec<f64>, |
| 58 | volumes: Vec<f64>, |
| 59 | dollar_value_per_bar: f64, |
| 60 | ) -> PyResult<Vec<(String, String, f64, f64, f64, f64, f64, f64, usize)>> { |
| 61 | if !dollar_value_per_bar.is_finite() || dollar_value_per_bar <= 0.0 { |
| 62 | return Err(PyValueError::new_err("dollar_value_per_bar must be > 0")); |
| 63 | } |
| 64 | let trades = build_trades(timestamps, prices, volumes)?; |
| 65 | let bars = standard_bars(&trades, dollar_value_per_bar, StandardBarType::Dollar); |
| 66 | Ok(bars_to_rows(bars)) |
| 67 | } |
| 68 |
nothing calls this directly
no test coverage detected