use nautilus_core::python::to_pyvalue_err;
use pyo3::prelude::*;
use crate::modules::fx_rollover::{FXRolloverInterestModule, InterestRateRecord};
#[pyo3_stub_gen::derive::gen_stub_pymethods]
#[pymethods]
impl InterestRateRecord {
#[new]
fn py_new(location: String, time: String, value: f64) -> PyResult<Self> {
let record = Self {
location,
time,
value,
};
record.validate().map_err(to_pyvalue_err)?;
Ok(record)
}
fn __repr__(&self) -> String {
format!("{self:?}")
}
}
#[pyo3_stub_gen::derive::gen_stub_pymethods]
#[pymethods]
impl FXRolloverInterestModule {
#[new]
fn py_new(records: Vec<InterestRateRecord>) -> PyResult<Self> {
Self::new(records).map_err(to_pyvalue_err)
}
fn __repr__(&self) -> String {
format!("{self:?}")
}
}