Add instrument history helpers
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user