computer: add tx annualized volume + tx velocity + rename _in_usd/_in_btc to _usd/_btc

This commit is contained in:
nym21
2025-09-13 00:29:34 +02:00
parent e3b4b9b618
commit 38d5c7dff6
11 changed files with 466 additions and 335 deletions
@@ -134,3 +134,8 @@ impl CheckedSub<usize> for Bitcoin {
Some(Self(self.0 - rhs as f64))
}
}
impl CheckedSub<Bitcoin> for Bitcoin {
fn checked_sub(self, rhs: Bitcoin) -> Option<Self> {
Some(Self(self.0 - rhs.0))
}
}
@@ -175,3 +175,10 @@ impl Sum for StoredF64 {
Self(iter.map(|v| v.0).sum::<f64>())
}
}
impl Div<Bitcoin> for StoredF64 {
type Output = Self;
fn div(self, rhs: Bitcoin) -> Self::Output {
Self(self.0 / f64::from(rhs))
}
}