Skip to content

Commit

Permalink
As part of the fix for issue #6, accounting methods now return the fu…
Browse files Browse the repository at this point in the history
…ll crypto_balance_change, rather than only the taxable_amount
  • Loading branch information
eprbell committed Feb 4, 2022
1 parent 342c002 commit eaa5dc4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rp2/plugin/accounting_method/fifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_next_taxable_event_and_amount(
return TaxableEventAndAcquiredLot(
taxable_event=new_taxable_event,
acquired_lot=acquired_lot,
taxable_event_amount=new_taxable_event.crypto_taxable_amount,
taxable_event_amount=new_taxable_event.crypto_balance_change,
acquired_lot_amount=acquired_lot_amount - taxable_event_amount,
)

Expand Down
4 changes: 2 additions & 2 deletions src/rp2/plugin/accounting_method/lifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ def get_next_taxable_event_and_amount(
new_taxable_event: AbstractTransaction = next(self.__taxable_event_iterator)
except StopIteration:
raise TaxableEventsExhaustedException() from None
new_taxable_event_amount: RP2Decimal = new_taxable_event.crypto_taxable_amount
new_taxable_event_amount: RP2Decimal = new_taxable_event.crypto_balance_change

# If the new taxable event has different year than the acquired lot (and it's not earn-typed), also get a new acquired lot from the new year
if taxable_event and taxable_event.timestamp < new_taxable_event.timestamp:
if acquired_lot:
# Cache old-year acquired_lot amount
self.__acquired_lot_2_partial_amount[acquired_lot] = new_acquired_lot_amount
(_, new_acquired_lot, _, new_acquired_lot_amount) = self.get_acquired_lot_for_taxable_event(
new_taxable_event, acquired_lot, new_taxable_event.crypto_taxable_amount, new_acquired_lot_amount
new_taxable_event, acquired_lot, new_taxable_event_amount, new_acquired_lot_amount
)

return TaxableEventAndAcquiredLot(
Expand Down

0 comments on commit eaa5dc4

Please sign in to comment.