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:
parent
470b753833
commit
2000f05453
16 changed files with 242 additions and 21 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue