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
272 stars 43 forks source link

Example files do not work #10

Closed Exegetech closed 2 years ago

Exegetech commented 2 years ago

Hi, I'm trying to run the example files:

But upon running, get these errors

INFO: Country: us
INFO: Accounting Method: fifo
INFO: Configuration file: crypto_example.config
INFO: Input file: crypto_example.ods
INFO: Processing BTC
INFO: Processing ETH
ERROR: Fatal exception occurred:
Traceback (most recent call last):
  File "/Users/swissarmybox/Desktop/cry/rp2stuff/venv/lib/python3.8/site-packages/rp2/rp2_main.py", line 91, in _rp2_main_internal
    input_data: InputData = parse_ods(configuration=configuration, asset=asset, input_file_handle=input_file_handle)
  File "/Users/swissarmybox/Desktop/cry/rp2stuff/venv/lib/python3.8/site-packages/rp2/ods_parser.py", line 123, in parse_ods
    transaction = _create_transaction(configuration, current_table_type, i + 1, row_values)
  File "/Users/swissarmybox/Desktop/cry/rp2stuff/venv/lib/python3.8/site-packages/rp2/ods_parser.py", line 190, in _create_transaction
    argument_pack: Dict[str, Any] = configuration.get_in_table_constructor_argument_pack(row_values)
  File "/Users/swissarmybox/Desktop/cry/rp2stuff/venv/lib/python3.8/site-packages/rp2/configuration.py", line 163, in get_in_table_constructor_argument_pack
    return self.__get_table_constructor_argument_pack(data, "in", self.__in_header)
  File "/Users/swissarmybox/Desktop/cry/rp2stuff/venv/lib/python3.8/site-packages/rp2/configuration.py", line 154, in __get_table_constructor_argument_pack
    raise RP2ValueError(
rp2.rp2_error.RP2ValueError: Parameter 'data' has length 13, but required minimum from in-table headers in crypto_example.config is 14: ['2020-06-03T11:23Z', 'Coinbase', 'Bob', 'brown', 'fox', 'Buy', 'ETH', 10.0, 244.0, 2440.0, 2465.0, 25.0, None]
INFO: Log file: ./log/rp2_2022_02_26_09_58_40_020721.log
INFO: Generated output directory: output
INFO: Done
eprbell commented 2 years ago

Thanks for reporting! This is most likely because you're not using the latest version of RP2 (v0.9.16 or better). I recently added to RP2 the unique_id field, which captures transaction hash and I updated crypto_example with this new field. As a result the example no longer works with previous versions of RP2. Documentation always points to top-of-tree version of files, so this kind of issues can happen, especially during heavy development.

So in a nutshell: update to the latest version of RP2 and let me know if the problem disappears or if it's still there.

Exegetech commented 2 years ago

Thanks for reporting! This is most likely because you're not using the latest version of RP2 (v0.9.16 or better). I recently added to RP2 the unique_id field, which captures transaction hash and I updated crypto_example with this new field. As a result the example no longer works with previous versions of RP2. Documentation always points to top-of-tree version of files, so this kind of issues can happen, especially during heavy development.

So in a nutshell: update to the latest version of RP2 and let me know if the problem disappears or if it's still there.

Yes I actually used the latest one for it.

❯ rp2_us -v
RP2 0.9.16 (https://pypi.org/project/rp2/)
eprbell commented 2 years ago

Can you type: rp2_us --version and report what it says? If RP2 is the latest version then perhaps the problem is the opposite and the example files are old: can you download the latest version of https://github.com/eprbell/rp2/tree/main/input/crypto_example.ods and https://github.com/eprbell/rp2/tree/main/config/crypto_example.config and try again?

I ran it manually and it works ok (with latest versions of rp2, crypto_example.ods and crypto_example.config):

rp2_us -m fifo -o output -p crypto_example_ crypto_example.config crypto_example.ods

INFO: Country: us
INFO: Accounting Method: fifo
INFO: Configuration file: crypto_example.config
INFO: Input file: crypto_example.ods
INFO: Processing BTC
INFO: Processing ETH
INFO: Generating output for plugin 'rp2.plugin.report.rp2_full_report'
INFO: Plugin 'rp2.plugin.report.rp2_full_report' output: <snip>
INFO: Generating output for plugin 'rp2.plugin.report.us.tax_report_us'
INFO: Plugin 'rp2.plugin.report.us.tax_report_us' output: <snip>
INFO: Log file: ./log/rp2_2022_02_26_07_22_31_149180.log
INFO: Generated output directory: output
INFO: Done
Exegetech commented 2 years ago

Can you type: rp2_us --version and report what it says? If RP2 is the latest version then perhaps the problem is the opposite and the example files are old: can you download the latest version of https://github.com/eprbell/rp2/tree/main/input/crypto_example.ods and https://github.com/eprbell/rp2/tree/main/config/crypto_example.config and try again?

I ran it manually and it works ok (with latest versions of rp2, crypto_example.ods and crypto_example.config):

rp2_us -m fifo -o output -p crypto_example_ crypto_example.config crypto_example.ods

INFO: Country: us
INFO: Accounting Method: fifo
INFO: Configuration file: crypto_example.config
INFO: Input file: crypto_example.ods
INFO: Processing BTC
INFO: Processing ETH
INFO: Generating output for plugin 'rp2.plugin.report.rp2_full_report'
INFO: Plugin 'rp2.plugin.report.rp2_full_report' output: <snip>
INFO: Generating output for plugin 'rp2.plugin.report.us.tax_report_us'
INFO: Plugin 'rp2.plugin.report.us.tax_report_us' output: <snip>
INFO: Log file: ./log/rp2_2022_02_26_07_22_31_149180.log
INFO: Generated output directory: output
INFO: Done

Thank you. It worked. I think my files were old.

Exegetech commented 2 years ago

Sorry I have some questions regarding the example file. I don't know if I should open a new issue or I should just describe it here.

In the generated full report file, BTC In-Out, row 24, 26, 27, why is it a taxable event? Is it a taxable event to Bob? Same goes with row 16, 17, why is it a taxable event? Is it a taxable event to Bob?

eprbell commented 2 years ago

No worries, here is fine, since it's still related to crypto_example.

Row 16 and 17 are a gift and a donation by Bob, which are taxable events (see fields highlighted in yellow for the fiat amount of the event). They are reported in the Donations and Gifts tab in the tax_report_us.ods output file.

Rows 24, 26, 27 refer to the fees for moving funds from one account to another (again, see highlighted field). Technically these fees are similar to very small sales and they do affect the in/out relationships among lots, so RP2 captures them in the full report and groups them together in the "Investment Expenses" tab in the tax_report_us.ods output file. I'm not 100% sure if transfer fees are taxable or not (see also this relevant FAQ: you can either err on the side of safety and treat them as sales or double check with a tax professional (show them the "Investment Expenses" tab in tax_report_us.ods).

Hope this helps.

Exegetech commented 2 years ago

Thanks, yeah definitely helps. I'll study more of the examples and will probably ask more questions here. Thanks a lot.

Exegetech commented 2 years ago

How do we handle crypto loss? i.e, from scam or from forgetting keys?

eprbell commented 2 years ago

Thanks for all the good questions and feedback: this will be useful for others too.

Here's my understanding on the topic of theft, displacement and rug pulls:

Here are articles that discuss this topic:

From the perspective of RP2 the only question is: is a new transaction type required? I think the answer is no (existing ones are sufficient to capture these scenarios), but I'm happy to stand corrected if anybody has a better understanding.

Exegetech commented 2 years ago

Gotcha, that makes sense. Thanks.

Exegetech commented 2 years ago

I looked at the "Investment Expenses". I don't understand how transfer fee is considered as gain. When I see this data:

The way I see it is that I paid fee to the Blockchain network for 0.01. I don't own this 0.01 anymore. Could you explain why this is taxed? Sorry I'm not an expert in tax related matters.

I.e, say I am a dropshipper. I buy a doll from A for $100 with shipping fee to my warehouse for $1, then someone buys my doll for $110. I send that person this doll for $1 shipping fee. Doesn't that mean that my gain is

$110 - ($100 + $1 + $1) = $8

But in the crypto Investment Expenses above, it seems that I am actually gaining the transfer fee?

eprbell commented 2 years ago

The transfer fee affects the in/out relationship (because it's crypto that is coming out of your stash) and as such they need to be part of tax calculation, so RP2 captures them in their own "Investment expense" category. However RP2 doesn't tell users what is taxed/not taxed on any given year: it performs lot fractioning and in/out lot pairing (according to the selected accounting method), and then it groups all lot fractions in categories (corresponding to each sheet in the tax_report_us output). How to treat each category from the tax perspective is the user's responsibility: if you're not 100% sure what to do, speaking with a tax professional is a good idea.

In the specific case of the transfer fee I heard two interpretations: a) it's a non-taxable investment expense; b) it's crypto that is coming out of your stash, so it's similar to a sale and therefore it needs to be taxed. If anybody has a definitive answer to this quesiton (with a source) I can add it to the FAQ.

If you use a) then you can ignore the investment expense tab altogether, otherwise you have to use it to file taxes.

To summarize, RP2 does all the calculations and groups all possible taxable events, but it doesn't tell you what actually needs to be filed or what forms to use (that can change from year to year).

Hope this helps.

Exegetech commented 2 years ago

The transfer fee affects the in/out relationship (because it's crypto that is coming out of your stash) and as such they need to be part of tax calculation, so RP2 captures them in their own "Investment expense" category. However RP2 doesn't tell users what is taxed/not taxed on any given year: it performs lot fractioning and in/out lot pairing (according to the selected accounting method), and then it groups all lot fractions in categories (corresponding to each sheet in the tax_report_us output). How to treat each category from the tax perspective is the user's responsibility: if you're not 100% sure what to do, speaking with a tax professional is a good idea.

In the specific case of the transfer fee I heard two interpretations: a) it's a non-taxable investment expense; b) it's crypto that is coming out of your stash, so it's similar to a sale and therefore it needs to be taxed. If anybody has a definitive answer to this quesiton (with a source) I can add it to the FAQ.

If you use a) then you can ignore the investment expense tab altogether, otherwise you have to use it to file taxes.

To summarize, RP2 does all the calculations and groups all possible taxable events, but it doesn't tell you what actually needs to be filed or what forms to use (that can change from year to year).

Hope this helps.

Oh I see, okay I think I got it confused. That makes sense. Thanks.

As for the investment expense. This seems to be the source. https://www.blog.cointracking.info/is-transferring-bitcoin-between-wallets-taxable

It seems that it is indeed an investment expense.

eprbell commented 2 years ago

No, you're asking good questions and it's good to discuss publicly so that others can read too. Also thanks for the link.