Struct dbn::symbol_map::TsSymbolMap
source · pub struct TsSymbolMap(/* private fields */);
Expand description
A timeseries symbol map. Generally useful for working with historical data
and is commonly built from a Metadata
object via Self::from_metadata()
.
Implementations§
source§impl TsSymbolMap
impl TsSymbolMap
sourcepub fn from_metadata(metadata: &Metadata) -> Result<Self>
pub fn from_metadata(metadata: &Metadata) -> Result<Self>
Creates a new timeseries symbol map from the metadata.
§Errors
This function returns an error if neither stype_in or stype_out are
SType::InstrumentId
. It will also return an error if it can’t
parse a symbol into u32
instrument ID.
sourcepub fn insert(
&mut self,
instrument_id: u32,
start_date: Date,
end_date: Date,
symbol: Arc<String>
) -> Result<()>
pub fn insert( &mut self, instrument_id: u32, start_date: Date, end_date: Date, symbol: Arc<String> ) -> Result<()>
Inserts a new mapping into the symbol map.
If the map already had a mapping, the mapping is updated.
§Errors
This function returns an error if start_date
comes after end_date
.
sourcepub fn get(&self, date: Date, instrument_id: u32) -> Option<&String>
pub fn get(&self, date: Date, instrument_id: u32) -> Option<&String>
Returns the symbol mapping for the given date and instrument ID. Returns None
if no mapping exists.
Trait Implementations§
source§impl Clone for TsSymbolMap
impl Clone for TsSymbolMap
source§fn clone(&self) -> TsSymbolMap
fn clone(&self) -> TsSymbolMap
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TsSymbolMap
impl Debug for TsSymbolMap
source§impl Default for TsSymbolMap
impl Default for TsSymbolMap
source§fn default() -> TsSymbolMap
fn default() -> TsSymbolMap
Returns the “default value” for a type. Read more
source§impl PartialEq for TsSymbolMap
impl PartialEq for TsSymbolMap
source§fn eq(&self, other: &TsSymbolMap) -> bool
fn eq(&self, other: &TsSymbolMap) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl SymbolIndex for TsSymbolMap
impl SymbolIndex for TsSymbolMap
source§impl TryFrom<&Metadata> for TsSymbolMap
impl TryFrom<&Metadata> for TsSymbolMap
impl Eq for TsSymbolMap
impl StructuralPartialEq for TsSymbolMap
Auto Trait Implementations§
impl Freeze for TsSymbolMap
impl RefUnwindSafe for TsSymbolMap
impl Send for TsSymbolMap
impl Sync for TsSymbolMap
impl Unpin for TsSymbolMap
impl UnwindSafe for TsSymbolMap
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
Mutably borrows from an owned value. Read more