-
Notifications
You must be signed in to change notification settings - Fork 32
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
Kraken: Action Types in CSV Exports #97
Comments
Hi @shredEngineer @wearymanateevedaknotstabooresisting, I'm asking you since you worked on previous Kraken implementations: Do you happen to have old ledger CSV exports that include staking, unstaking and staking rewards? |
@Griffsano Sorry, I don't have staking or margin trades in my data. :/ |
Hi all, Is somebody working on this one? I get an error for type staking on my kraken report.
|
I don't know if I can allocate time for this right now, but I do know that we would need some sample data beforehand. :) So if you could provide us with some real exported data on this, that would certainly help. I'm no Kraken power user myself, so I don't have exports with staking in it. |
Will be happy to share. How can we do that best? I have created a csv, with no fees, amount and balance. Still dates are there and txIDs.... So sharing this in public may be a bit odd.... Any idea is welcome. |
Txids=replace with something |
Hey, I'll push my working hotfix in a couple of hours and will tag you. |
Ok. I have removed txids and altered the dates. This is just a snapshot of the data.... I will be happy to test any fix you push.
|
I'm not sure my problem fits here, but I get the following error for a kraken import:
The assertion fails at this line:
And it stems from the following two values Any ideas? |
CoinTaxman is trying to match kraken internal deposit and withdrawal operations together. It expects two refids ( ... and it looks like kraken is using weird symbols.... try to replace |
Just to clarify, I do indeed have two lines with the same transaction and this is what it looks like
Somehow strange, it only appears for |
Btw have a look at |
It ran through successfully! Thanks for the tip! You can add it to the |
@gladomat Just did it :) |
I do not know if my stuff belongs here or not. This is of course not manually calculateable at all if you have > 1000 spot and margin trades as FIFO and fractions become utterly insane. I do not even know if CTM can do any of this. But even just exporting my ledger and running CTM leads to this:
I do not know if this is because the ledger mixes margin trading and spot (which this issue seems to be about???? The error/debug info isn't helpful to me at all to know what is wrong), but clearly I cannot be the only person affected by an exchange messing up like this, especially as a Kraken user. All of this is such a nightmare and I am pretty sure I have a decent chance of becoming an unwilling criminal thanks to exchanges not giving us summaries and none of these calculations being possible by hand. I don't know what to do or what is wrong with CTM. I do not see a solution here. I used cointracer (well worth supporting but abandoned in 2022 sadly, also open source and truly a great solution) for the spot profit / losses, but these tiny fee conversions? I have no idea what to do.. |
CoinTaxman expects the changes to be positive. Therefore the assert. If your change value is negative, you have to make sure that the row from the csv is correctly converted to a CoinTaxman. You might to program an if case if change<0 and append the correct operation type to book. |
Summary
The current implementation for reading the Kraken CSV exports is according to the documentation of the "type" field:
https://support.kraken.com/hc/en-us/articles/360001169383-Explanation-of-Ledger-Fields
However, it seems like the CSV exports have changed and do not correspond to the definition above anymore. This leads to completely different behavior for some action types.
For the exports that I have, I can see the following behavior:
To-do list
Actions that currently do not work
Staking / Unstaking
A combination of "withdrawal"/"deposit" and two "transfer" rows.
The current implementation considers "transfer" as airdrop. Depending on how the CSV exports looked before, it could be more or less complicated to guarantee backwards-compatibility. Also related to #57.
For #87, a similar behavior was observed, although slightly different (four "transfer" rows).
For ETH, replace asset with XETH and asset.S with ETH2.S.
Staking
Unstaking
Staking Rewards
According to the Kraken documentation, staking rewards should be listed as "reward".
However, they are actually logged as "deposit" and "staking" actions. The "deposit" row would probably mess with #4 and "staking" is currently not known and throws an error.
We should be careful when adding the "staking" operation: We want to add the rewarded coin to staking, not just any via FIFO.
For ETH, replace asset.S with ETH2 (not ETH2.S as for ETH staking above).
Margin Trades
Margin trades are opened with "margin" and closed with "margin"/"settled", in-between there may be "rollover" fees for the open position.
I could not find any "margin trade" as documented on the Kraken website.
The row "margin" is currently not known and throws an error. "settled" and "rollover" rows are detected but also throw an error because margin trades are not supported yet (related to #52). For now, I would suggest to skip these lines with a warning, but still process the rest of the CSV.
Closed Position
Note that the CSV export only contains the base currency for the position (e.g. ZEUR for BTC/EUR). There is no way of finding out for which crypto the position was opened (BTC in this case).
Also, there is no way of linking the opening and closing actions ("margin" types) as they have different "refid" values.
Settled Position
There is no way of linking the opening and settling actions as they have different "refid" values.
The sign of "amount" depends if the position was settled with gains or losses.
Adjustment / Sale
Two further types could occur in the CSV export according to the documentation: "adjustment" and "sale". I don't think we need to implement them for now as they cover only very special actions.
Actions that work
The following actions work with the current implementation and are just for information.
Deposit / Withdrawal
Two "deposit" / "withdrawal" rows.
Deposit
Withdrawal
Spend / Receive (Trade via the Buy Crypto button)
A combination of "spend" and "receive" rows. Example for buying crypto with fiat:
Trades
A combination of two "trade" rows. Example for buying crypto with fiat:
The text was updated successfully, but these errors were encountered: