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

Match Plaid holding values on current day (#2212)

* Match Plaid holding values on current day

* Fix chart timezone issue

* Add timezone tests for syncs

* Hide sidebars on trades test
This commit is contained in:
Zach Gollwitzer 2025-05-06 09:25:49 -04:00 committed by GitHub
parent 470b753833
commit 2000f05453
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 242 additions and 21 deletions

View file

@ -16,7 +16,9 @@ class Holding::ReverseCalculator < Holding::BaseCalculator
Date.current.downto(account.start_date).each do |date|
today_trades = portfolio_cache.get_trades(date: date)
previous_portfolio = transform_portfolio(current_portfolio, today_trades, direction: :reverse)
holdings += build_holdings(current_portfolio, date)
# If current day, always use holding prices (since that's what Plaid gives us). For historical values, use market data (since Plaid doesn't supply historical prices)
holdings += build_holdings(current_portfolio, date, price_source: date == Date.current ? "holding" : nil)
current_portfolio = previous_portfolio
end