Skip to content

Commit 11c4c63

Browse files
VasilyVasily
authored andcommitted
Use date for market currency conversion
1 parent 0d439af commit 11c4c63

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/fava_portfolio_returns/api/portfolio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def first(x):
113113
clamp_date = max(date, start_date)
114114
market = market_value_of_inv(p.pricer, p.target_currency, balance, clamp_date)
115115
cost = cost_value_of_inv(p.pricer, p.target_currency, balance)
116-
cash = -inv_to_currency(p.pricer, p.target_currency, cf_balance) # sum of cash flows
116+
cash = -inv_to_currency(p.pricer, p.target_currency, cf_balance, clamp_date) # sum of cash flows
117117
values.append(PortfolioValue(date=clamp_date, market=market, cost=cost, cash=cash))
118118

119119
return values

src/fava_portfolio_returns/core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def market_value_of_inv(
3636
value_balance = balance.reduce(convert.get_value, pricer.price_map, date)
3737

3838
# then convert to target currency
39-
return inv_to_currency(pricer, target_currency, value_balance)
39+
return inv_to_currency(pricer, target_currency, value_balance, date)
4040

4141

4242
def inv_to_currency(

0 commit comments

Comments
 (0)