-
Notifications
You must be signed in to change notification settings - Fork 53
Create plugin to process Crypto.com App exported CSV #290
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
base: main
Are you sure you want to change the base?
Create plugin to process Crypto.com App exported CSV #290
Conversation
|
Since Crypto.com tax was deprecated. I created this plugin for my use case and wanted to share in case it is of value for the project. |
|
Thanks! Appreciate the contribution. We'll review it soon. |
eprbell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good: just a few minor nits.
| @@ -0,0 +1,248 @@ | |||
| import math | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the Copyright/Apache license header to this file.
| ) -> None: | ||
| super().__init__(account_holder=account_holder, native_fiat=native_fiat) | ||
| self.__in_csv_file: Optional[str] = in_csv_file | ||
| self.__logger: logging.Logger = create_logger(self.__CRYPTO_COM_APP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Append account holder to log name.
| ): | ||
| self.raw_data = raw_data | ||
| self.timestamp = time | ||
| self.abs_float_amount = abs(float(amount)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use RP2Decimal instead of float throughout the file to avoid precision problems.
| assert result.asset == "CRO" | ||
| assert result.timestamp == "2022-03-31 00:03:00+0000" | ||
| assert result.transaction_type.lower() == Keyword.INCOME.value.lower() | ||
| assert math.isclose(float(result.crypto_in), float(transaction.amount), rel_tol=1e-9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After switching to RP2Decimal, use is_equal_within_precision instead of isclose (seej https://github.com/eprbell/rp2/blob/main/src/rp2/out_transaction.py#L99). Same thing in the rest of the file.
Plugin to process transactions exported from the Crypto.com app.
I did my best to map the transactions correctly, but could have misinterpreted any of them.