Skip to content

Commit

Permalink
fix: summarizer fail due to favapricemap vs beancount pricemap
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed Dec 30, 2023
1 parent adc5888 commit 08691bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions fava_investor/common/favainvestorapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from fava.context import g
from fava.core.conversion import convert_position
from beancount.core import realization
from beancount.core import prices


class FavaInvestorAPI:
Expand All @@ -14,6 +15,9 @@ def __init__(self):
def build_price_map(self):
return g.ledger.prices

def build_beancount_price_map(self):
return prices.build_price_map(g.ledger.all_entries)

def build_filtered_price_map(self, pcur, base_currency):
"""pcur and base_currency are currency strings"""
return {(pcur, base_currency): g.filtered.prices(pcur, base_currency)}
Expand Down
2 changes: 1 addition & 1 deletion fava_investor/common/libinvestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def sum_inventories(invs):
if t == Inventory:
total = sum_inventories([getattr(r, label) for r in rows])
total = total.reduce(convert_position, accapi.get_operating_currencies()[0],
accapi.build_price_map())
accapi.build_beancount_price_map())
elif t == decimal.Decimal:
total = sum([getattr(r, label) for r in rows])
ret_values.append(total)
Expand Down

0 comments on commit 08691bd

Please sign in to comment.