Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Followed the installation and running the example. #126

Closed
haavardf opened this issue Jul 27, 2024 · 5 comments
Closed

Followed the installation and running the example. #126

haavardf opened this issue Jul 27, 2024 · 5 comments

Comments

@haavardf
Copy link

sudo apt-get install python3 python3-pip
pip install rp2
Downloaded: crypto_example.ini crypto_example.ods

Ran the suggested command:~/rp2$ ~/.local/bin/rp2_us -m fifo -o output -p crypto_example_ crypto_example.ini crypto_example.ods
INFO: Country: us
INFO: Generation Language: en
INFO: Accounting method: fifo
INFO: Configuration file: crypto_example.ini
INFO: Input file: crypto_example.ods
INFO: Processing BTC
ERROR: Fatal exception occurred:
Traceback (most recent call last):
File "/home/haavard/.local/lib/python3.10/site-packages/rp2/rp2_main.py", line 154, in _rp2_main_internal
computed_data: ComputedData = compute_tax(configuration=configuration, accounting_engine=accounting_engine, input_data=input_data)
File "/home/haavard/.local/lib/python3.10/site-packages/rp2/tax_engine.py", line 47, in compute_tax
return ComputedData(
File "/home/haavard/.local/lib/python3.10/site-packages/rp2/computed_data.py", line 222, in init
self.__filtered_balance_set: BalanceSet = BalanceSet(unfiltered_taxable_event_set.configuration, input_data, to_date)
File "/home/haavard/.local/lib/python3.10/site-packages/rp2/balance.py", line 172, in init
raise RP2ValueError(
rp2.rp2_error.RP2ValueError: BTC balance of account "Coinbase" (holder "Bob") went negative (-0.30000000000) on the following transaction: OutTransaction:
id=15
timestamp=2020-02-11 19:58:00.000000 +0000
asset=BTC
exchange=Coinbase
holder=Bob
transaction_type=TransactionType.SELL
spot_price=12200.0000
crypto_out_no_fee=1.00000000
crypto_fee=0.00000000
unique_id=
is_taxable=True
fiat_taxable_amount=12200.0000

@haavardf haavardf changed the title Followed the installation and running guid. Followed the installation and running the example. Jul 27, 2024
@haavardf
Copy link
Author

I just updated ID 4 from 1 BTC to 5 BTC and the example works well. I am happy to set up the project and try to help out while I am testing it. Never really done python, but that should be OK.

@jayr0d
Copy link
Contributor

jayr0d commented Jul 28, 2024

Although crypto_example.ods has not changed in two years, it seems the Coinbase wallet does in fact go negative. Bob bought 1 BTC, sold 0.2, transferred 0.1 to BlockFi, and at this point has 0.7 BTC in Coinbase. He then sold 1 BTC, which results in a negative balance for Coinbase of 0.3. Prior to this, he bought 2 BTC on BlockFi.

There was likely a code change at some point where RP2 was previously looking at asset balance in aggregate (all Exchanges) and now looks at asset balance per Exchange.

I suggest you make some changes to crypto_example.ods and submit a pull request. I would suggest changing it from 1 to something smaller than 5. Maybe try 0.7 and see if it errors out elsewhere.

@eprbell
Copy link
Owner

eprbell commented Jul 28, 2024

You have to run the command with the -n option which allows negative balances:

rp2_us -n -m fifo -o output -p crypto_example_ crypto_example.ini crypto_example.ods

The reason for the introduction of -n is explained in #106.

The problem here was that the README.md hadn't been updated to reflect that -n should be used with crypto_example: I just fixed that so that this should not happen again. Thanks for reporting.

@eprbell eprbell closed this as completed Jul 28, 2024
@jayr0d
Copy link
Contributor

jayr0d commented Jul 28, 2024

Thanks for catching my oversight :)

@eprbell
Copy link
Owner

eprbell commented Jul 28, 2024

Not an oversight: there was a bit of missing info in the docs, so thanks for pointing that out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants