bitsofwinter / cryptotaxsweden

Script for generating a tax report for cryptocurrency trading which can be sent to the Swedish tax authorities.
GNU General Public License v3.0
52 stars 24 forks source link

Deposit/Withdraw account value confusion #9

Open metalmetalmetal opened 6 years ago

metalmetalmetal commented 6 years ago

Having done a fair amount of work with CoinTracking I'm surprised to see something I can't really understand.

Adding Deposits as Gift/Tip [In], includes them in the calculation for profit, loss and tax. However, adding Withdraws as Gift [Out], doesn't include them in the calculation for profit, loss and tax.

I don't really grasp this. If a Gift/Tip [In] is seen as an increase in account value, then surely a Gift [Out] should be seen as a decrease, right? Should I simply detract my withdraws from my deposits to get the correct total account value as a base for tax calculation?

What gives?

bitsofwinter commented 6 years ago

Gift/Tip [In] is currently used for reporting hard forks and airdrops, or other income that should have a cost basis of 0.

Gift/Tip [Out] isn't handled right now so it will be ignored.

There are likely a lot of situations not handled properly yet, I've mostly just covered my own needs with the script. It should be fairly easy to add new rules to handle more trade types as long as it can be easily defined what the cost basis should be for income and which trades are to be treated as sells.

metalmetalmetal commented 6 years ago

Ok, I can understand that you'll be building it to support your own needs first.

I'm not sure where you're the most active (here or the forum), I'm not sure where we should hold the bulk of the discussions. Are general questions on "how to use this tool?" suitable here?

bitsofwinter commented 6 years ago

Discussing here is fine I think. Then other people will be able to find the discussion more easily.

bitsofwinter commented 6 years ago

I might not be super active all the time though so if there are requests for changes, write down a clear description of what you need and I have a better chance at actually implementing it correctly once I have time. If you know how to program python it should be fairly easy to modify the script according to your needs as well. You can see most of the logic for the tax computation in tax.py in the compute_tax function.

metalmetalmetal commented 6 years ago

Ok, so coming from another conversation in the forum, this is what I see and experience:

If you have done mining you get two options for reporting on Cointracking, currently:


Making detailed reports

In order to have Cointracking track things in the exact right way and get the script to take this into account, you need to:

  1. Record your acquired mining as the type "Mining", the amount mined (and some comment where it's been mined could be useful) - This is what the script takes into account
  2. Record a Withdraw from the place you've mined with the amount you withdrew
  3. Record a Deposit to the place you withdrew to with the amount deposited (which should be the same amount as in step 2)

Making slim reports

In order to have only the script take your mining into account, you need to:

  1. Record your acquired mining as the type "Mining", the amount mined (and some comment where it's been mined could be useful) - This is what the script takes into account

(Do be aware that this means CoinTracking doesn't "know" if you've made any deposit/withdraw of these assets)


Is this interpretation correct? If my instructions are clear as well, you're more than welcome to reuse it.

bitsofwinter commented 6 years ago

I'm not sure what you mean in the slim report case but the first 3 step description seems correct.

metalmetalmetal commented 6 years ago

I mean the slim report as a variant to the detailed report.

So, you either input all three transactions for both Cointracking and the script to calculate correctly, or you only follow the slim report guide, which means you only input one mining transaction and skip the withdraw/deposit one.

I understood the description/discussion about what the script takes into account, that it ignores the Withdraw/Deposits, so in practice, to get the final tax report from the script, you only need the Mining transaction. That way you can skip the extra steps in describing withdraw and deposit in cointracking.

bitsofwinter commented 6 years ago

If you only have mining income, but haven't traded the crypto you got from mining, then I don't think you have to file a capital gains report at all. Instead you should file a income tax report on a T2 form. But if you traded the crypto you got from mining then you will get capital gains as well and that should be reported on a K4 form, but in this case you will also have Trades on cointracking, not only Mining.

metalmetalmetal commented 6 years ago

Thanks for the input.

I wanted to first make sure I've input everything correctly, and that's the reason for the basic questions about how to do that. When I know that's correct, I can start looking at the report the script provides.

What's making me suspicious that I'm either doing something wrong, or the script is, is because I'm currently having a tax value that's 56% of the current value of my current assets. I mean, It's stating that I've made a massive profit during 2017, but. I haven't "cashed" any of it out at that point. The profits I "made" during 2017 is 100% more than the assets I held at the end of December. So I'm more than a little confused.

metalmetalmetal commented 6 years ago

There's one thing I especially can't wrap my head around for the most basic use of this script. The procedure goes like this:

  1. Export the ledger from Kraken
  2. Import the ledger CSV from Kraken into Cointracking
  3. Review the data (I can see I have 5 deposits, 5 withdraws and a smaller number of trades)
  4. Export the CSV from Cointracking Trades Prices
  5. Put the CSV where the script can access it
  6. Run the script, I immediately hit "Selling currency BTC which has not been bought yet"

This, to me looks like the script is trying to log a "sell" entry based on a previous "buy" entry that has not happened. And it has not happened, because it's been a deposit and not a purchase. Does that make sense? I mean, I didn't buy the BTC on the exchange through a trade, I bought it somewhere else, then transferred it, to trade for. Is there any way to get this part to work out, without necessarily changing/modifying the script?

joelfak commented 6 years ago

Then you have to add the initial buy as well (even though it was done on another exchange). The service that was used does not matter, that is why deposits and withdrawals are ignored. The only thing that is relevant to your tax is when a cryptocurrency is traded for another or for a fiat currency. So you have to enter the initial buy of cryptocurrency to make it work as intended.

For example, I send euro to Kraken from my swedish bank, which was listed as a deposit. I therefore got the same error as you do (selling euros before I bought them). Therefore I need to enter the initial buy of euros (from swedish crowns) performed in my bank.

I hope this will make it a bit more clear.

On Wed, 25 Apr 2018, 15:26 metalmetalmetal, notifications@github.com wrote:

There's one thing I especially can't wrap my head around for the most basic use of this script. The instruction goes like this:

  1. Export the ledger from Kraken
  2. Import the ledger CSV from Kraken into Cointracking
  3. Review the data (I can see I have 5 deposits, 5 withdraws and smaller number of trades)
  4. Export the VSC from Cointracking Trades Prices
  5. Put the CSV where the script can access it
  6. Run the script, I immediately hit "Selling currency BTC which has not been bought yet"

This, to me looks like the script is trying to log a "sell" entry based on a previous "buy" entry that has not happened. And it has not happened, because it's been a deposit and not a purchase. Does that make sense? I mean, I didn't buy the BTC on the exchange through a trade, I bought it somewhere else, then transferred it, to trade for. Is there any way to get this part to work out, without necessarily changing/modifying the script?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitsofwinter/cryptotaxsweden/issues/9#issuecomment-384285556, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbdH6iPQg8OvJo8JiLakxOYiw-UhBhdks5tsHlpgaJpZM4TgvSp .

metalmetalmetal commented 6 years ago

Okok.

Given this, then, I should be able to:

add a (Buying) Trade transaction to the list, of an arbitrary number of BTC, that covers the first purchase to another currency (and potentially others along the line if there isn't enough).

Correct?

bitsofwinter commented 6 years ago

Pro tip: Cointracking has a pretty good FAQ section which covers a lot of this. :) This isn't really related to what this script does but more related to how to enter trades in general to be able to do a capital gains report.

metalmetalmetal commented 6 years ago

Edit (solves this sub-issue)

Argh. So, I learned that the CSV export from Cointracking is on a minute basis, not on a second basis. So I thought I had "fixed" the order of parsing by changing the second, but the CSV will only consider minutes during export.

Original sub-issue

Did the script change with regards to Withdraw/Deposit/(Gift/Tip [In])? Or did I misunderstand that it should take Gift/Tip into account as a balance that's available for selling?

raise Exception(f"Selling currency {trade.sell_coin} which has not been bought yet")

I've got stuck in a situation where the script thinks I'm trying to sell a crypto that I haven't yet bought, but I've added the crypto as a Gift/Tip (it's an airdrop). However, it doesn't seem to take that into account when processing the sell transaction following it.

(I'd love if the script could tell what line in the CSV it's getting stuck so I could look it up, btw)

Any thoughts on this?

bitsofwinter commented 6 years ago

Adding as Gift/Tip is the right way to do this. Have you checked if you are using the same symbol name in the airdrop as when you sell it?

A good way to verify that you have entered everything correctly on cointracking is to make sure that the total balance of your portfolio is correct on cointracking.

I'm adding line numbers in the errors to the script now btw. Hope it will be useful.

Greveyaro commented 6 years ago

Hello

Thank you for a very helpful script.

I have a question.

I have staked a sum of coins and received dividends / capital income(in coins) from this. Some of those new coins have in turn been sold.

I use Cointracking.info to track all transactions.

The problem I have is to calculate the average cost basis from these newly generated coins.

I do know the market value at the time of reward.

It's not mining, so I've instead recorded the transactions as income.

Is there a way for the script to calculate the average cost basis of the new coins without taking the "old" staked coins into account, as they are locked and never sold.

I've tried the exclude-groups argument but I'm not sure I'm doing it correctly as I'm getting the same result as without it.