Add instrument history helpers

This commit is contained in:
boris
2026-04-23 19:43:36 -07:00
parent ca49b6dbb3
commit f4030f2607
6 changed files with 60 additions and 16 deletions

View File

@@ -39,6 +39,12 @@ impl Instrument {
self.delisted_at
.is_some_and(|delisted_at| delisted_at < date)
}
pub fn is_active_on(&self, date: NaiveDate) -> bool {
self.listed_at.is_none_or(|listed_at| listed_at <= date)
&& !self.is_delisted_before(date)
&& !self.status.eq_ignore_ascii_case("inactive")
}
}
fn default_status() -> String {