Skip to content

Commit

Permalink
Merge pull request #120 from tarioch/feature/beancount3
Browse files Browse the repository at this point in the history
Use CostSpec instead of Cost
  • Loading branch information
tarioch authored Jan 2, 2025
2 parents e9af0af + 4eed081 commit fd09e6f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/tariochbctools/importers/bitst/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ def fetchSingle(self, trx: dict[str, Any]) -> data.Transaction:
if type == 0:
narration = "Deposit"
if posCcy:
cost = data.Cost(
self.priceLookup.fetchPriceAmount(posCcy, date), "CHF", None, None
cost = data.CostSpec(
self.priceLookup.fetchPriceAmount(posCcy, date),
None,
"CHF",
None,
None,
False,
)
postings = [
data.Posting(
Expand Down
2 changes: 1 addition & 1 deletion src/tariochbctools/importers/blockchain/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def extract(self, filepath: str, existing: data.Entries) -> data.Entries:

date = trx["confirmed"].date()
price = priceLookup.fetchPriceAmount(currency, date)
cost = data.Cost(price, baseCcy, None, None)
cost = data.CostSpec(price, None, baseCcy, None, None, None, False)

outputType = "ether" if currency.lower() == "eth" else "btc"
amt = blockcypher.from_base_unit(trx["value"], outputType)
Expand Down
2 changes: 1 addition & 1 deletion src/tariochbctools/importers/ibkr/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def createBuy(
data.Posting(
assetAccount,
amount.Amount(quantity, asset),
data.Cost(price, baseCcy, None, None),
data.CostSpec(price, None, baseCcy, None, None, False),
None,
None,
None,
Expand Down

0 comments on commit fd09e6f

Please sign in to comment.