(
timestamps: Vec<String>,
prices: Vec<f64>,
volumes: Vec<f64>,
interval_seconds: i64,
)
| 6 | |
| 7 | use crate::helpers::{bars_to_rows, build_trades}; |
| 8 | |
| 9 | #[pyfunction(name = "build_time_bars")] |
| 10 | fn bars_build_time_bars( |
| 11 | timestamps: Vec<String>, |
| 12 | prices: Vec<f64>, |
| 13 | volumes: Vec<f64>, |
| 14 | interval_seconds: i64, |
| 15 | ) -> PyResult<Vec<(String, String, f64, f64, f64, f64, f64, f64, usize)>> { |
| 16 | if interval_seconds <= 0 { |
| 17 | return Err(PyValueError::new_err("interval_seconds must be > 0")); |
| 18 | } |
| 19 | let trades = build_trades(timestamps, prices, volumes)?; |
| 20 | let bars = time_bars(&trades, chrono::Duration::seconds(interval_seconds)); |
| 21 | Ok(bars_to_rows(bars)) |
| 22 | } |
| 23 |
nothing calls this directly
no test coverage detected