use std::path::PathBuf;
use nautilus_core::time::get_atomic_clock_realtime;
use nautilus_data::client::DataClient;
use nautilus_model::identifiers::ClientId;
use pyo3::prelude::*;
use crate::data::{DatabentoDataClient, DatabentoDataClientConfig};
#[cfg(feature = "python")]
#[pymethods]
impl DatabentoDataClient {
#[new]
#[pyo3(signature = (client_id, api_key, publishers_filepath, use_exchange_as_venue = true, bars_timestamp_on_close = true))]
pub fn py_new(
client_id: ClientId,
api_key: String,
publishers_filepath: PathBuf,
use_exchange_as_venue: bool,
bars_timestamp_on_close: bool,
) -> PyResult<Self> {
let config = DatabentoDataClientConfig::new(
api_key,
publishers_filepath,
use_exchange_as_venue,
bars_timestamp_on_close,
);
Self::new(client_id, config, get_atomic_clock_realtime())
.map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!("{e}")))
}
#[getter]
pub fn client_id(&self) -> ClientId {
DataClient::client_id(self)
}
#[getter]
pub fn is_connected(&self) -> bool {
DataClient::is_connected(self)
}
#[getter]
pub fn is_disconnected(&self) -> bool {
DataClient::is_disconnected(self)
}
}