use databento::dbn::SType;
use smallstr::SmallString;
use std::fmt::Write;
use crate::instrument::{InstrumentKind, InstrumentTicker};
pub(crate) trait Symbology {
fn symbol(&self) -> (SmallString<[u8; 8]>, SType);
}
impl Symbology for InstrumentTicker {
fn symbol(&self) -> (SmallString<[u8; 8]>, SType) {
let mut symbol = SmallString::new();
let stype = match self.instrument_kind() {
InstrumentKind::Future => {
write!(
symbol,
"{}.v.0",
self.bare_symbol()
)
.unwrap();
SType::Continuous
}
_ => unimplemented!(),
};
(symbol, stype)
}
}