aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Hoerr <kjhoerr@submelon.dev>2026-04-16 17:10:11 -0400
committerKevin Hoerr <kjhoerr@submelon.dev>2026-04-16 17:10:11 -0400
commitfb43ec916a6ebb4142717eca5a09829636f926bf (patch)
tree9fef2adb585a8abe3d196d7f4a0f5fbdf97db926 /src
parentf6c34724c49de095055f0861128682440af9bd74 (diff)
downloadequity-tracker-fb43ec916a6ebb4142717eca5a09829636f926bf.tar.gz
equity-tracker-fb43ec916a6ebb4142717eca5a09829636f926bf.tar.bz2
equity-tracker-fb43ec916a6ebb4142717eca5a09829636f926bf.zip
ledger.rs: Remove usd spec
Diffstat (limited to 'src')
-rw-r--r--src/app/store/ledger.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/app/store/ledger.rs b/src/app/store/ledger.rs
index 841f7b3..df65b58 100644
--- a/src/app/store/ledger.rs
+++ b/src/app/store/ledger.rs
@@ -9,7 +9,7 @@ pub struct EstimatedLedger<'a> {
pub equity_change_events: Vec<&'a EquityChangeEvent>,
pub account_symbol_quantity: BigDecimal,
pub account_symbol_cost_basis_price: BigDecimal,
- pub account_symbol_cost_basis_total_usd: BigDecimal,
+ pub account_symbol_cost_basis_total: BigDecimal,
pub account_symbol_last_effective_price: BigDecimal,
pub account_symbol_last_update_timestamp: chrono::DateTime<chrono::Utc>,
}
@@ -41,13 +41,15 @@ impl EstimatedLedger<'_> {
acsym_events.push(event);
}
+ let cost_basis_price = (cost_basis_total.clone() / quantity.clone()).with_scale_round(2, ROUNDING_MODE);
+
EstimatedLedger {
fiduciary_account,
equity_symbol,
equity_change_events: acsym_events,
- account_symbol_quantity: quantity.clone(),
- account_symbol_cost_basis_price: (cost_basis_total.clone() / quantity).with_scale_round(2, ROUNDING_MODE),
- account_symbol_cost_basis_total_usd: cost_basis_total.with_scale_round(2, ROUNDING_MODE),
+ account_symbol_quantity: quantity,
+ account_symbol_cost_basis_price: cost_basis_price,
+ account_symbol_cost_basis_total: cost_basis_total.with_scale_round(2, ROUNDING_MODE),
account_symbol_last_effective_price: last_event.map_or_else(|| BigDecimal::zero().with_scale(2), |ev| ev.estimated_price()),
account_symbol_last_update_timestamp: last_event.map_or_else(|| chrono::DateTime::<chrono::Utc>::MIN_UTC, |ev| ev.equity_change_timestamp),
}