mirror of
https://github.com/Magnus167/msyrs.git
synced 2025-08-20 09:40:00 +00:00
Add Python wrappers for get_bdates_from_col_hv
and get_period_indices_hv
functions
This commit is contained in:
parent
d897965dd2
commit
48fe8db61e
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/// Python wrapper for [`crate::utils::qdf`].
|
/// Python wrapper for [`crate::utils::qdf`].
|
||||||
pub mod qdf;
|
pub mod qdf;
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use pyo3_polars::PyDataFrame;
|
use pyo3_polars::{PyDataFrame, PySeries};
|
||||||
|
|
||||||
/// Python wrapper for [`crate::panel`] module.
|
/// Python wrapper for [`crate::panel`] module.
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
#[pymodule]
|
#[pymodule]
|
||||||
pub fn panel(_py: Python, m: &PyModule) -> PyResult<()> {
|
pub fn panel(_py: Python, m: &PyModule) -> PyResult<()> {
|
||||||
m.add_function(wrap_pyfunction!(historic_vol, m)?)?;
|
m.add_function(wrap_pyfunction!(historic_vol, m)?)?;
|
||||||
|
m.add_function(wrap_pyfunction!(get_bdates_from_col_hv, m)?)?;
|
||||||
|
m.add_function(wrap_pyfunction!(get_period_indices_hv, m)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,3 +46,18 @@ pub fn historic_vol(
|
|||||||
.unwrap(),
|
.unwrap(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[pyfunction]
|
||||||
|
pub fn get_bdates_from_col_hv(dfw: PyDataFrame, est_freq: &str) -> PyResult<PySeries> {
|
||||||
|
Ok(PySeries(
|
||||||
|
crate::panel::historic_vol::get_bdates_from_col_hv(&dfw.into(), est_freq)
|
||||||
|
.unwrap()
|
||||||
|
.into(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[pyfunction]
|
||||||
|
pub fn get_period_indices_hv(dfw: PyDataFrame, est_freq: &str) -> PyResult<Vec<usize>> {
|
||||||
|
Ok(crate::panel::historic_vol::get_period_indices_hv(&dfw.into(), est_freq).unwrap())
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user