eprbell / dali-rp2

DaLI (Data Loader Interface) is a data loader and input generator for RP2 (https://pypi.org/project/rp2), the privacy-focused, free, open-source cryptocurrency tax calculator: DaLI removes the need to manually prepare RP2 input files. Just like RP2, DaLI is also free, open-source and it prioritizes user privacy.
https://pypi.org/project/dali-rp2/
Apache License 2.0
62 stars 41 forks source link

Spot price for USD->USD not found #234

Closed tucamsam closed 1 week ago

tucamsam commented 2 months ago

Trying to last second get my taxes in, and found this project - super excited about it. However, when I tried to process my Pionex data, it seems to fall apart on this line

"Date","Received Quantity","Received Currency","Sent Quantity","Sent Currency","Fee Amount","Fee Currency","Tag"
"01/01/2023 00:36:22","4.00000000","DOGE","0.27800000","USD","0.00400000","DOGE",""

With the following output

╰─ dali_us -s -o output -p try_ config.ini
INFO: Country: us
INFO: Initialized input plugin 'dali.plugin.input.csv.pionex'
INFO: No pair converter plugins found in configuration file: using default pair converters.
INFO: Reading crypto data using plugin 'dali.plugin.input.csv.pionex'
INFO: Resolving transactions
ERROR: Fatal exception occurred:
Traceback (most recent call last):
  File "/Users/ctucker/.pyenv/versions/3.10.13/lib/python3.10/site-packages/dali/dali_main.py", line 181, in _dali_main_internal
    resolved_transactions: List[AbstractTransaction] = resolve_transactions(transactions, dali_configuration, args.read_spot_price_from_web)
  File "/Users/ctucker/.pyenv/versions/3.10.13/lib/python3.10/site-packages/dali/transaction_resolver.py", line 246, in resolve_transactions
    transaction = _update_spot_price_from_web(transaction, global_configuration)
  File "/Users/ctucker/.pyenv/versions/3.10.13/lib/python3.10/site-packages/dali/transaction_resolver.py", line 144, in _update_spot_price_from_web
    raise RP2RuntimeError(
rp2.rp2_error.RP2RuntimeError: Spot price for __unknown:2023-01-01 01:21:10+00:00:USD->USD not found on any pair converter plugin
INFO: Log file: ./log/rp2_2024_04_09_22_01_55_583554.log
INFO: Generated output directory: output
INFO: Done

I'm using the for-cointracker.csv file directly as mentioned in the docs, but for some reason it looks like it's trying to find a spot price for USD -> USD?

Am I misunderstanding this? It seems that it shouldn't be trying to do this.

Please let me know if there's any other info I can provide to better debug this. I'm hoping maybe once I get my taxes done this week, maybe I'll have some time to contribute to this project.

macanudo527 commented 2 months ago

The transaction it is choking on actually occurred at 2023-01-01 01:21:10+00:00.

The DOGE one that you submitted occurred at 01/01/2023 00:36:22

I just used the Pionex plugin to process my US taxes, but I never use fiat. I always trade and deal with USDT. So, there must be some issue with fiat processing. Maybe it is a bank deposit?

tucamsam commented 2 months ago

My fault - I grabbed the wrong stack trace - I had removed the offending line to see if it was just that one, or USD in general...here's that trace:

╰─ dali_us -s -o output -p try_ config.ini
INFO: Country: us
INFO: Initialized input plugin 'dali.plugin.input.csv.pionex'
INFO: No pair converter plugins found in configuration file: using default pair converters.
INFO: Reading crypto data using plugin 'dali.plugin.input.csv.pionex'
INFO: Resolving transactions
ERROR: Fatal exception occurred:
Traceback (most recent call last):
  File "/Users/ctucker/.pyenv/versions/3.10.13/lib/python3.10/site-packages/dali/dali_main.py", line 181, in _dali_main_internal
    resolved_transactions: List[AbstractTransaction] = resolve_transactions(transactions, dali_configuration, args.read_spot_price_from_web)
  File "/Users/ctucker/.pyenv/versions/3.10.13/lib/python3.10/site-packages/dali/transaction_resolver.py", line 246, in resolve_transactions
    transaction = _update_spot_price_from_web(transaction, global_configuration)
  File "/Users/ctucker/.pyenv/versions/3.10.13/lib/python3.10/site-packages/dali/transaction_resolver.py", line 144, in _update_spot_price_from_web
    raise RP2RuntimeError(
rp2.rp2_error.RP2RuntimeError: Spot price for __unknown:2023-01-01 00:36:22+00:00:USD->USD not found on any pair converter plugin
INFO: Log file: ./log/rp2_2024_04_09_21_56_36_401006.log
INFO: Generated output directory: output
INFO: Done

And for completeness sake, here are the first 3 transactions:

"Date","Received Quantity","Received Currency","Sent Quantity","Sent Currency","Fee Amount","Fee Currency","Tag"
"01/01/2023 00:11:25","0.00337580","ETH","0.42960000","ATOM","0.00000338","ETH",""
"01/01/2023 00:36:22","4.00000000","DOGE","0.27800000","USD","0.00400000","DOGE",""
"01/01/2023 01:21:10","399629.00000000","SHIB","3.21701345","USD","399.62900000","SHIB",""
macanudo527 commented 2 months ago

@tucamsam I wrote up a monkey patch that skips pricing of native fiat transactions that seems to resolve this.

Are you able to give it a try? Otherwise, we can try to get a release out with it, but it might take a while.

tucamsam commented 2 months ago

@macanudo527 - sure thing - I'd messed around with my own monkey patch, but it still ended up failing after running for a while

macanudo527 commented 1 week ago

I'm closing this as #225 should have fixed it.