provinzio / CoinTaxman

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

Support old Kraken statement files #18

Closed provinzio closed 3 years ago

provinzio commented 3 years ago

The Kraken ledger file changed over the years. While current Kraken users may be able to generate a fresh statement (in the supported format), we could adjust our code, to support old files.

wearymanateevedaknotstabooresisting commented 3 years ago

Experienced Behavior

Trying to import Kraken account statements from September 2020 and before results in non-recognition of the Kraken export files.

Desired Behavior

Kraken account statements should be processable, regardless if they are in October 2020 format or September 2020 format. The files should be recognized for import and include all ledger entries and trades.

Possible Reason for Bug

Kraken changed the columns on their account statement export files, adding one additional column in ledger.csv as well as trades.csv. The additional columns are already respected by src/book.py through column names "" and "subtype". However, they are regarded as required by the code. Therefore, if no all required columns are present, the account statement type is not regarded as valid Kraken file.

Actually, "" is a bug in the implementation since this empty column is not present in real exports.

Possible Solution

Another quick fix would be neglecting the "" and "subtype" columns by removing them from src/book.py since they are not used anyway, expect for a processing line without functionality with respect to the subtype column.

Hint

When importing without those columns, Kraken exchange has another issue finding prices of certain times for certain pairs, see #17.

Valid importing also works by just using a fresh Kraken export. However, users who do not have access to their account anymore can not use their old statements. A work around by inserting new columns may lead to invalid datatypes if not done properly (correct Excel DE/EN configurations, CSV importing and exporting or Python fiddling which may be non-trivial for the common user).

Attachements

These are .csv files, extension is not supported for upload by GitHub, thus using artificial .txt. Stupid rule.

wearymanateevedaknotstabooresisting commented 3 years ago

Recognized, that kraken_trades actually had a bug in the implementation, since the empty column "" is not present in todays exports. So only ledgers is affected, with the added "subtype" by Kraken.

Above comment with detailed explanation has been adjusted.

wearymanateevedaknotstabooresisting commented 3 years ago

I went through all my exports and found that the change of ledgers export format, by adding subtype, occurred in October 2020.