pub struct BetfairDataLoader { /* private fields */ }Expand description
Reads Betfair historical data files and converts them into Nautilus domain objects.
Each file contains newline-delimited JSON from the Betfair Exchange Streaming API. The loader handles gzip decompression, stateful traded volume tracking, and instrument creation from market definitions.
Implementations§
Source§impl BetfairDataLoader
impl BetfairDataLoader
Sourcepub fn new(currency: Currency, min_notional: Option<Money>) -> Self
pub fn new(currency: Currency, min_notional: Option<Money>) -> Self
Creates a new BetfairDataLoader.
Sourcepub fn instruments(&self) -> &AHashMap<InstrumentId, InstrumentAny>
pub fn instruments(&self) -> &AHashMap<InstrumentId, InstrumentAny>
Returns the instruments cached from the most recent load.
Sourcepub fn load(&mut self, filepath: &Path) -> Result<Vec<BetfairDataItem>>
pub fn load(&mut self, filepath: &Path) -> Result<Vec<BetfairDataItem>>
Loads a Betfair historical data file and returns all parsed data items.
Supports gzip-compressed (.gz), bzip2-compressed (.bz2), and plain JSON files.
Each line is deserialized as a Betfair stream message. MCM and RCM
messages are parsed into Nautilus domain objects; other message types
are skipped.
§Errors
Returns an error if the file cannot be opened or a line fails to parse.
Sourcepub fn load_instruments(
&mut self,
filepath: &Path,
) -> Result<Vec<InstrumentAny>>
pub fn load_instruments( &mut self, filepath: &Path, ) -> Result<Vec<InstrumentAny>>
Loads only instrument definitions from a Betfair historical data file.
Scans the file for market definitions and creates instruments, but
skips all other data processing. Faster than load() when only
instruments are needed.
§Errors
Returns an error if the file cannot be opened or parsed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BetfairDataLoader
impl RefUnwindSafe for BetfairDataLoader
impl Send for BetfairDataLoader
impl Sync for BetfairDataLoader
impl Unpin for BetfairDataLoader
impl UnsafeUnpin for BetfairDataLoader
impl UnwindSafe for BetfairDataLoader
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