eprbell / rp2

Privacy-focused, free, open-source cryptocurrency tax calculator for multiple countries: it handles multiple coins/exchanges and computes long/short-term capital gains, cost bases, in/out lot relationships/fractioning, and account balances. It supports FIFO, LIFO, HIFO and it outputs in form 8949 format. It has a programmable plugin architecture
https://pypi.org/project/rp2/
Apache License 2.0
256 stars 42 forks source link

Error total in-transaction crypto value < total taxable crypto value #98

Closed Larision closed 1 year ago

Larision commented 1 year ago
2023-05-24 21:46:37,867/rp2/DEBUG: tax_engine: taxable > acquired: 196.32830000000 > 79.14167600000 / 145.71905600000 + 79.14167600000 = 224.86073200000: GainLoss:
  id=880->12
  crypto_amount=79.14167600
  fiat_cost_basis=70.0000
  fiat_gain=-0.3696
  is_long_term_capital_gains=False
  taxable_event_fiat_amount_with_fee_fraction=69.6304
  taxable_event_fraction_percentage=40.3109%
  taxable_event=OutTransaction:
    id=880
    timestamp=2021-11-18 04:01:08.000000 +0000
    asset=USDT
    exchange=Binance.com
    holder=fran
    transaction_type=TransactionType.SELL
    spot_price=0.8798
    crypto_out_no_fee=196.32830000
    crypto_fee=0.00000000
    unique_id=XXXXXXXXX.0
    is_taxable=True
    fiat_taxable_amount=172.7335
  acquired_lot_fiat_amount_with_fee_fraction=70.0000
  acquired_lot_fraction_percentage=100.0000%
  acquired_lot=InTransaction:
    id=12
    timestamp=2021-11-05 14:17:35.000000 +0000
    asset=USDT
    exchange=Coinbase
    holder=fran
    transaction_type=TransactionType.BUY
    spot_price=0.8687
    crypto_in=79.14167600
    fiat_fee=1.2500
    fiat_in_no_fee=68.7500
    fiat_in_with_fee=70.0000
    unique_id=YYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYY
    is_taxable=False
    fiat_taxable_amount=0.0000
2023-05-24 21:46:37,868/rp2/ERROR: Fatal exception occurred:
Traceback (most recent call last):
  File "/home/kali/renta/rp2/src/rp2/rp2_main.py", line 146, in _rp2_main_internal
    computed_data: ComputedData = compute_tax(configuration=configuration, accounting_engine=accounting_engine, input_data=input_data)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/renta/rp2/src/rp2/tax_engine.py", line 44, in compute_tax
    unfiltered_gain_loss_set: GainLossSet = _create_unfiltered_gain_and_loss_set(configuration, accounting_engine, input_data, unfiltered_taxable_event_set)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/renta/rp2/src/rp2/tax_engine.py", line 197, in _create_unfiltered_gain_and_loss_set
    raise RP2ValueError("Total in-transaction crypto value < total taxable crypto value") from None
rp2.rp2_error.RP2ValueError: Total in-transaction crypto value < total taxable crypto value

And here parsing rows

2023-05-24 21:46:37,618/rp2/DEBUG: parsing row: ['2021-11-05 14:17:35+0000', 'USDT', 'Coinbase', 'fran', 'Buy', None, 0.868695275040675, 79.141676, None, 68.75, 70.0, 1.25, 'YYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYY', 'Buy side of conversion from 1555385.55018671 SHIB -> 79.141676 USDT (SHIB out-transaction unique id: YYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYY)', None, None, None, None, None, None]

2023-05-24 21:46:37,736/rp2/DEBUG: parsing row: ['2021-11-18 04:01:08+0000', 'USDT', 'Binance.com', 'fran', 'Sell', None, 0.8798195752, 196.3283, 0.0, 196.3283, None, None, XXXXXXXXX.0, 'nearest spot_price read from CCXT-converter plugin; Sell side of conversion from 196.3283 USDT -> 10.3 UMA(UMA in-transaction unique id: XXXXXXXXX', None, None, None, None, None, None]

any tip?

Larision commented 1 year ago

Checked and i noticed not rp2 problem but dali missing transactions problem.

Moving to dali issues.