provinzio / CoinTaxman

Calculate your taxes from cryptocurrency gains
GNU Affero General Public License v3.0
142 stars 31 forks source link

[feature request] import bittytax exports #55

Open pardofelis opened 3 years ago

pardofelis commented 3 years ago

Hi folks,

The project bittytax (https://github.com/BittyTax/BittyTax) is a tax solution for UK. One of its modules (bittytax_conv) allows the user to simplify their exported transaction files to a single xlsx file with different spreadsheets for every transaction file. The columns which are the same for every file are:

Type | Buy Quantity | Buy Asset | Buy Value | Sell Quantity | Sell Asset | Sell Value | Fee Quantity | Fee Asset | Fee Value | Wallet | Timestamp

Maybe this exported file can be added as import file for CoinTaxman. This way, many exchanges could be added without the need for a new parser. Also it would be a nice input file for custom transactions to be added.

Thank you Sincerely pardofelis

provinzio commented 3 years ago

I already thought about a general input file, and why shouldn't we use this one. Great idea!

We should keep in mind, that we currently do not support all of these exchanges for price gathering. #16 is tackling this issue. But as long as the buy/sell/fee value is given in the input file, everything should be fine.

provinzio commented 2 years ago

I am currently implementing a custom import format which is based in bittytax's format (see #127). I haven't checked out the bittytax conv tool, so my column format (e.g. format of datetime) might be different. Also my values (e.g. Sell value in GBP) are changed to Sell value in {config.FIAT}.

If anyone wants to work with bittytax, feel free to checkout the custom account statements type in book.py and give me a hint, if something isn't working as expected or open a PR yourself. :)

blaaaaaaa commented 2 years ago

Hi, thanks for your efforts! I used to do UK crypto tax with BittyTax and so it would be awesome to have that (or any custom import type) for taxman/german tax. I am in germany now, tried cointracking but even after hours of digging can't make up why the numbers make no sense. About the custom import type, I tried to put the example custom csv in account statement folder but only get WARNING Unable to detect the exchange of file. If we import the custom file already with EUR prices (I usally do the prices myself) then there is no need to fetch them right? Because for my first atttempt with coinbase I already get errors like: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.pro.coinbase.com/products/MKR-EUR/candles?start=2021-12-31T23:54:59+01:00&end=2022-01-01T00:04:59+01:00&granularity=60

provinzio commented 2 years ago

About the custom import type, I tried to put the example custom csv in account statement folder but only get WARNING Unable to detect the exchange of file.

Your header is currently unknown to CoinTaxman. For my implementation, I varied it a bit. Please checkout detect_exchange in book.py and compare your header with the "custom_eur" header (view it in GitHub). If you're willing to share your current csv header line, I might be able to help you, too.

If we import the custom file already with EUR prices (I usally do the prices myself) then there is no need to fetch them right? Because for my first atttempt with coinbase I already get errors like: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.pro.coinbase.com/products/MKR-EUR/candles?start=2021-12-31T23:54:59+01:00&end=2022-01-01T00:04:59+01:00&granularity=60

If all prices are present in the csv, there shouldn't be a need to fetch further prices (except for the unrealized sell at end of year, but this is optional and only raises a warning, not an error). If you're willing to share the corresponding transactions from your account statement, I might be able to indicate the problem. It's easiest for me, when you create me minimal working example with a mini account statement file which shows your problem.

blaaaaaaa commented 2 years ago

Hi, thx with the newest branch I got the custom import to work for few examples. Regarding Airdrops/(Staking)Rewards I used either Type Income in BittyTax or Trade with Sell Quantity 0, so e.g. for UNI rewards: Gain/Buy X amount of UNI for 0 EUR. Both fail with assertion Error for SellQuantity, which of course kind of makes sense. In germany as far I understand it and what my tax advisor is saying, A UNI reward (or airdrop) would be Income (Sonstige Einkünfte) with e.g 100 UNI at 2 EUR, so 200 EURO Income and a trade for 200 EUR to 100 UNI the day you claim it. ( I know there is conflicting infos about that on the internet, and maybe LP rewards and airdrops would be treated differently). So I would add that trade to cointaxman and keep a seperate sheet for incomes? Or how would you treat go about, integrating airdrop/rewards into cointaxman? And what about coins which didn't have a price when you got them or claim them. To add them with price Zero kind of makes sense to me. (Kostenbasis 0)

provinzio commented 2 years ago

As far as I know. Airdrops can be taxed as (a) Einkünfte aus sonstigen Leistungen or as (b) Schenkung.

There is currently only a bool in the config file which makes that all airdrops will be evaluated as (a) or all as (b). Something in between is currently not implemented (#115 )

When no price is given. It should be fine to set it to 0.

Regarding your account statement. You could use the custom account statement file (see wiki) and add your airdrops there.

blaaaaaaa commented 2 years ago

Ok thx I would go with (a), but how to import an airdrop via custom import?

provinzio commented 2 years ago

Take the file from wiki. Add a row with type airdrop to the file.

blaaaaaaa commented 2 years ago

Hi, if operation_type != "Deposit": assert sell_quantity this line will still catch it, also when it type is Airdrop.

provinzio commented 2 years ago

this shouldnt happen for airdrop either. Feel free to open a pull request.

provinzio commented 2 years ago

Hi, if operation_type != "Deposit": assert sell_quantity this line will still catch it, also when it type is Airdrop.

Should be fixed now.

provinzio commented 2 years ago

As this bittytax import / custom import is kindof implemented, I am going to close this issue.