pub struct DatabentoDataLoader { /* private fields */ }
Expand description
A Nautilus data loader for Databento Binary Encoding (DBN) format data.
§Supported schemas:
MBO
->OrderBookDelta
MBP_1
->(QuoteTick, Option<TradeTick>)
MBP_10
->OrderBookDepth10
BBO_1S
->QuoteTick
BBO_1M
->QuoteTick
CMBP_1
->(QuoteTick, Option<TradeTick>)
CBBO_1S
->QuoteTick
CBBO_1M
->QuoteTick
TCBBO
->(QuoteTick, TradeTick)
TBBO
->(QuoteTick, TradeTick)
TRADES
->TradeTick
OHLCV_1S
->Bar
OHLCV_1M
->Bar
OHLCV_1H
->Bar
OHLCV_1D
->Bar
OHLCV_EOD
->Bar
DEFINITION
->Instrument
IMBALANCE
->DatabentoImbalance
STATISTICS
->DatabentoStatistics
STATUS
->InstrumentStatus
§References
Implementations§
Source§impl DatabentoDataLoader
impl DatabentoDataLoader
Sourcepub fn new(publishers_filepath: Option<PathBuf>) -> Result<Self>
pub fn new(publishers_filepath: Option<PathBuf>) -> Result<Self>
Creates a new DatabentoDataLoader
instance.
§Errors
Returns an error if locating or loading publishers data fails.
Sourcepub fn load_publishers(&mut self, filepath: PathBuf) -> Result<()>
pub fn load_publishers(&mut self, filepath: PathBuf) -> Result<()>
Load the publishers data from the file at the given filepath
.
§Errors
Returns an error if the file cannot be read or parsed as JSON.
Sourcepub const fn get_publishers(&self) -> &IndexMap<u16, DatabentoPublisher>
pub const fn get_publishers(&self) -> &IndexMap<u16, DatabentoPublisher>
Returns the internal Databento publishers currently held by the loader.
Sourcepub fn set_dataset_for_venue(&mut self, dataset: Dataset, venue: Venue)
pub fn set_dataset_for_venue(&mut self, dataset: Dataset, venue: Venue)
Sets the venue
to map to the given dataset
.
Sourcepub fn get_dataset_for_venue(&self, venue: &Venue) -> Option<&Dataset>
pub fn get_dataset_for_venue(&self, venue: &Venue) -> Option<&Dataset>
Returns the dataset which matches the given venue
(if found).
Sourcepub fn get_venue_for_publisher(
&self,
publisher_id: PublisherId,
) -> Option<&Venue>
pub fn get_venue_for_publisher( &self, publisher_id: PublisherId, ) -> Option<&Venue>
Returns the venue which matches the given publisher_id
(if found).
Sourcepub fn schema_from_file(&self, filepath: &Path) -> Result<Option<String>>
pub fn schema_from_file(&self, filepath: &Path) -> Result<Option<String>>
Returns the schema for the given filepath
.
§Errors
Returns an error if the file cannot be decoded or metadata retrieval fails.
Sourcepub fn read_definition_records(
&mut self,
filepath: &Path,
use_exchange_as_venue: bool,
) -> Result<impl Iterator<Item = Result<InstrumentAny>> + '_>
pub fn read_definition_records( &mut self, filepath: &Path, use_exchange_as_venue: bool, ) -> Result<impl Iterator<Item = Result<InstrumentAny>> + '_>
§Errors
Returns an error if decoding the definition records fails.
Sourcepub fn read_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
include_trades: bool,
bars_timestamp_on_close: Option<bool>,
) -> Result<impl Iterator<Item = Result<(Option<Data>, Option<Data>)>> + '_>where
T: Record + HasRType + 'static,
pub fn read_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
include_trades: bool,
bars_timestamp_on_close: Option<bool>,
) -> Result<impl Iterator<Item = Result<(Option<Data>, Option<Data>)>> + '_>where
T: Record + HasRType + 'static,
§Errors
Returns an error if reading records fails.
Sourcepub fn load_instruments(
&mut self,
filepath: &Path,
use_exchange_as_venue: bool,
) -> Result<Vec<InstrumentAny>>
pub fn load_instruments( &mut self, filepath: &Path, use_exchange_as_venue: bool, ) -> Result<Vec<InstrumentAny>>
§Errors
Returns an error if loading instruments fails.
Sourcepub fn load_order_book_deltas(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<OrderBookDelta>>
pub fn load_order_book_deltas( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<OrderBookDelta>>
§Errors
Returns an error if loading order book deltas fails.
Sourcepub fn load_order_book_depth10(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<OrderBookDepth10>>
pub fn load_order_book_depth10( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<OrderBookDepth10>>
§Errors
Returns an error if loading order book depth10 fails.
Sourcepub fn load_quotes(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<QuoteTick>>
pub fn load_quotes( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<QuoteTick>>
§Errors
Returns an error if loading quotes fails.
Sourcepub fn load_bbo_quotes(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<QuoteTick>>
pub fn load_bbo_quotes( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<QuoteTick>>
§Errors
Returns an error if loading BBO quotes fails.
Sourcepub fn load_tbbo_trades(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<TradeTick>>
pub fn load_tbbo_trades( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<TradeTick>>
§Errors
Returns an error if loading TBBO trades fails.
Sourcepub fn load_tcbbo_trades(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<TradeTick>>
pub fn load_tcbbo_trades( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<TradeTick>>
§Errors
Returns an error if loading TCBBO trades fails.
Sourcepub fn load_trades(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<Vec<TradeTick>>
pub fn load_trades( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, ) -> Result<Vec<TradeTick>>
§Errors
Returns an error if loading trades fails.
Sourcepub fn load_bars(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
timestamp_on_close: Option<bool>,
) -> Result<Vec<Bar>>
pub fn load_bars( &self, filepath: &Path, instrument_id: Option<InstrumentId>, price_precision: Option<u8>, timestamp_on_close: Option<bool>, ) -> Result<Vec<Bar>>
§Errors
Returns an error if loading bars fails.
Sourcepub fn load_status_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
) -> Result<impl Iterator<Item = Result<InstrumentStatus>> + '_>where
T: Record + HasRType + 'static,
pub fn load_status_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
) -> Result<impl Iterator<Item = Result<InstrumentStatus>> + '_>where
T: Record + HasRType + 'static,
§Errors
Returns an error if loading status records fails.
Sourcepub fn read_imbalance_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<impl Iterator<Item = Result<DatabentoImbalance>> + '_>where
T: Record + HasRType + 'static,
pub fn read_imbalance_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<impl Iterator<Item = Result<DatabentoImbalance>> + '_>where
T: Record + HasRType + 'static,
§Errors
Returns an error if reading imbalance records fails.
Sourcepub fn read_statistics_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<impl Iterator<Item = Result<DatabentoStatistics>> + '_>where
T: Record + HasRType + 'static,
pub fn read_statistics_records<T>(
&self,
filepath: &Path,
instrument_id: Option<InstrumentId>,
price_precision: Option<u8>,
) -> Result<impl Iterator<Item = Result<DatabentoStatistics>> + '_>where
T: Record + HasRType + 'static,
§Errors
Returns an error if reading statistics records fails.
Trait Implementations§
Source§impl Debug for DatabentoDataLoader
impl Debug for DatabentoDataLoader
Source§impl<'py> IntoPyObject<'py> for DatabentoDataLoader
impl<'py> IntoPyObject<'py> for DatabentoDataLoader
Source§type Target = DatabentoDataLoader
type Target = DatabentoDataLoader
Source§type Output = Bound<'py, <DatabentoDataLoader as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <DatabentoDataLoader as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for DatabentoDataLoader
impl PyClass for DatabentoDataLoader
Source§impl PyClassImpl for DatabentoDataLoader
impl PyClassImpl for DatabentoDataLoader
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§type ThreadChecker = SendablePyClass<DatabentoDataLoader>
type ThreadChecker = SendablePyClass<DatabentoDataLoader>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<DatabentoDataLoader> for PyClassImplCollector<DatabentoDataLoader>
impl PyClassNewTextSignature<DatabentoDataLoader> for PyClassImplCollector<DatabentoDataLoader>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a DatabentoDataLoader
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a DatabentoDataLoader
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut DatabentoDataLoader
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut DatabentoDataLoader
Source§impl PyMethods<DatabentoDataLoader> for PyClassImplCollector<DatabentoDataLoader>
impl PyMethods<DatabentoDataLoader> for PyClassImplCollector<DatabentoDataLoader>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for DatabentoDataLoader
impl PyTypeInfo for DatabentoDataLoader
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.impl DerefToPyAny for DatabentoDataLoader
Auto Trait Implementations§
impl Freeze for DatabentoDataLoader
impl RefUnwindSafe for DatabentoDataLoader
impl Send for DatabentoDataLoader
impl Sync for DatabentoDataLoader
impl Unpin for DatabentoDataLoader
impl UnwindSafe for DatabentoDataLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self
into an owned Python object, dropping type information and unbinding it
from the 'py
lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self
into a Python object. Read more