1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Plaid sync tests and multi-currency investment support (#1531)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* Plaid sync tests and multi-currency investment support

* Fix system test

* Cleanup

* Remove data migration
This commit is contained in:
Zach Gollwitzer 2024-12-12 08:56:52 -05:00 committed by GitHub
parent b2a56aefc1
commit 800eb4c146
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 406 additions and 165 deletions

View file

@ -52,13 +52,15 @@ class Account::HoldingCalculator
next if price.blank?
converted_price = Money.new(price.price, price.currency).exchange_to(account.currency, fallback_rate: 1).amount
account.holdings.build(
security: security.dig(:security),
date: date,
qty: qty,
price: price.price,
currency: price.currency,
amount: qty * price.price
price: converted_price,
currency: account.currency,
amount: qty * converted_price
)
end.compact
end
@ -145,7 +147,7 @@ class Account::HoldingCalculator
def load_current_holding_quantities
holding_quantities = load_empty_holding_quantities
account.holdings.where(date: Date.current).map do |holding|
account.holdings.where(date: Date.current, currency: account.currency).map do |holding|
holding_quantities[holding.security_id] = holding.qty
end