{"id":19190117,"url":"https://github.com/brucify/revolutax","last_synced_at":"2025-05-08T04:51:17.877Z","repository":{"id":145534984,"uuid":"487241948","full_name":"brucify/revolutax","owner":"brucify","description":"Cryptocurrency Tax Calculator for Revolut CSV Statements - Rust CLI","archived":false,"fork":false,"pushed_at":"2023-05-02T16:51:22.000Z","size":118,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T07:41:27.591Z","etag":null,"topics":["account-statements","capital-gains","crypto-tax","cryptocurrency","csv","gains-calculator","k4-bilaga","kryptoskatt","revolut","revolut-csv","revolut-statement","skatteverket","sru","sru-fil","tax-calculator"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brucify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-30T10:01:15.000Z","updated_at":"2024-11-15T16:25:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"4ecb14b1-60f7-43e5-99bc-44f693194334","html_url":"https://github.com/brucify/revolutax","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Frevolutax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Frevolutax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Frevolutax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Frevolutax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brucify","download_url":"https://codeload.github.com/brucify/revolutax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253002841,"owners_count":21838637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["account-statements","capital-gains","crypto-tax","cryptocurrency","csv","gains-calculator","k4-bilaga","kryptoskatt","revolut","revolut-csv","revolut-statement","skatteverket","sru","sru-fil","tax-calculator"],"created_at":"2024-11-09T11:32:59.569Z","updated_at":"2025-05-08T04:51:17.852Z","avatar_url":"https://github.com/brucify.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# revolutax\n\nA Rust CLI tool for calculating taxes on cryptocurrencies traded on Revolut. It reads the \naccount statement CSV file from Revolut and generates a new CSV file summarizing the taxable\ntrades.\n\nThis tools can also generate an [SRU file](https://www.skatteverket.se/privat/deklaration/lamnaenbilagatilldeklarationen.4.515a6be615c637b9aa46366.html?q=sru+fil) \nthat can be uploaded to Swedish Tax Agency\n([K4-bilagan - Försäljning - Värdepapper m.m.](https://skatteverket.se/privat/skatter/vardepapper/deklareraaktierochovrigavardepapper/deklareravardepapperexempel.4.7afdf8a313d3421e9a9519.html))\nAlthough this program is specifically designed for reporting Swedish taxes, it can also be used\nfor general tax reporting purposes in other countries.\n\n## Installation\n\nTo install Rust, follow the official installation guide available at [rustup.rs](https://rustup.rs/).\n\nAfter Rust is installed, clone the repository and build the project:\n\n\n    $ cargo build\n\n## Usage\n\nThe program reads the transactions of type `EXCHANGE` and `CARD_PAYMENT` and generates a new csv file tax.csv. For example:\n\n    $ cargo run -- account_statement.csv \u003e tax.csv\n\nHere is an example input CSV file `account_statement.csv`:\n\n```csv\nType,Product,Started Date,Completed Date,Description,Amount,Currency,Fiat amount,Fiat amount (inc. fees),Fee,Base currency,State,Balance\nEXCHANGE,Current,2023-01-01 10:00:00,2023-01-01 10:00:00,Exchanged to EOS,100.0000,EOS,600.00,609.15,9.15,SEK,COMPLETED,100.0000\nEXCHANGE,Savings,2023-01-01 11:00:00,2023-01-01 11:00:00,Exchanged to EOS,50.0000,EOS,300.00,304.15,4.15,SEK,COMPLETED,50.0000\nEXCHANGE,Current,2023-01-02 10:00:00,2023-01-02 10:00:00,Exchanged to SEK,-30.0000,EOS,-400.00,-394.86,5.14,SEK,COMPLETED,70.0000\nCARD_PAYMENT,Current,2023-05-06 10:00:00,2023-05-06 10:00:00,Payment to Amazon,-25.0000,EOS,-500.00,-495.75,4.25,SEK,COMPLETED,45.0000\n```\n\nThe program generates a tax report `tax.csv` that looks like this:\n\n```csv\nDate;Currency;Amount;Income;Cost;Net Income\n2023-01-02 10:00:00;EOS;-30;394.86;-182.7450;212.1150\n2023-05-06 10:00:00;EOS;-25;495.75;-152.2875;343.4625\n```\nThis report shows the following information for each transaction:\n\n* Date: The date and time when the transaction occurred.\n* Currency (`Valutakod`): The currency used in the transaction.\n* Amount (`Antal`): The amount of currency used in the transaction.\n* Income (`Försäljningspris`): The income generated from the transaction, calculated in the base currency (SEK).\n* Cost (`Omkostnadsbelopp`): The cost of the transaction, calculated in the base currency (SEK).\n* Net Income (`Vinst/förlust`): The net income generated from the transaction, calculated by subtracting the cost from the income.\n\n#### Current vs. Savings\n\nThe program algorithm  takes into account the two types of `Product` of transactions: `Savings` and `Current`.\nSpecifically, when calculating the tax for a trade where you sold cryptocurrency, the program will first try to\nfind the costs for the sold crypto in the `Current` transactions and deduct them from there. Only when there are\nnot enough available costs to deduct on the `Current` transactions will the program deduct from the `Savings`\ntransactions.\n\n### Swedish Tax Agency\n\nTo generate an SRU file for the Skatteverket, provide the `--sru-file` flag. This will\nproduce a file with a .sru extension, containing the same capital gain information as\nthe CSV output, and is equivalent to a filled\n[K4-bilagan](https://skatteverket.se/privat/skatter/vardepapper/deklareraaktierochovrigavardepapper/deklareravardepapperexempel.4.7afdf8a313d3421e9a9519.html)\nform. The generated SRU file is formatted according to the [Skatteverket's specifications](https://www.skatteverket.se/download/18.6e8a1495181dad540843eb2/1665748259651/SKV269_28_(2022P4).pdf)\nand includes relevant headers such as `#BLANKETT` and `#UPPGIFT`.\n\nThe `--sru-org-num` flag should also be provided, followed by the personal/organization number of\nthe taxpayer. This number is included in the `#IDENTITET` header, which is required by \nthe Skatteverket. For example:\n\n    $ cargo run -- \\\n        --sru-file \\\n        --sru-org-num 195012310123 \\\n        --sru-org-name \"Svea Specimen\" \\\n        --year-traded 2023 \\\n        --sum \\\n        revolut-2023.csv \u003e BLANKETTER.sru\n\nWith `--sru-file` flag, the program generates an SRU file `BLANKETTER.sru`:\n\n```\n#BLANKETT K4-2022P4\n#IDENTITET 195012310123 20230428 222030\n#NAMN Svea Specimen\n#UPPGIFT 7014 1\n#UPPGIFT 3410 55\n#UPPGIFT 3411 EOS\n#UPPGIFT 3412 891\n#UPPGIFT 3413 335\n#UPPGIFT 3414 556\n#BLANKETTSLUT\n#FIL_SLUT\n```\n\nThe generated SRU file can be submitted to the Skatteverket electronically, simplifying\nthe tax reporting process for the taxpayer. If the `--sru-file` flag is not used, the program\nwill produce a CSV file containing the same information.\n\n### Available Options\n\nFLAGS:\n* `--print-exchanges-only`   (2022 csv only)Filter the input CSV file to show only items of type 'Exchange', and print to stdout\n* `--print-trades`           (2022 csv only) Merge two lines of a currency exchange into a single trade, and print to stdout\n* `--sru-file`               Print taxable trades in the Swedish Tax Agency's SRU file format\n* `--sum`                    Summarize taxable trades by currency (\"[genomsnittsmetoden](https://skatteverket.se/privat/skatter/vardepapper/andratillgangar/kryptovalutor.4.15532c7b1442f256bae11b60.html?q=kryptovalutor)\")\n* `-h, --help`                   Print help\n\nOPTIONS:\n* `-c, --currency \u003cCURRENCY\u003e`                  (2022 csv only) Specify the traded cryptocurrency to report the tax for. Use 'ALL' to show all currencies when using --print-exchanges-only\n* `-b, --base-currency \u003cBASE_CURRENCY\u003e`        (2022 csv only) Specify the base fiat currency to report the tax in. Defaults to 'SEK'\n* `--sru-org-name \u003cSRU_ORG_NAME\u003e`          Name to print in the SRU file\n* `--sru-org-num \u003cSRU_ORG_NUM\u003e`            Personal/organisational number to print in the SRU file\n* `--csv-version \u003cCSV_VERSION\u003e`            Specify the year of the Revolut CSV file to process. Defaults to 2023\n* `--year-traded \u003cYEAR_TRADED\u003e`            Only include taxable trades from this year\n\n## License\n```\nThis Source Code Form is subject to the terms of the Mozilla Public\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\nfile, You can obtain one at https://mozilla.org/MPL/2.0/.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucify%2Frevolutax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrucify%2Frevolutax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucify%2Frevolutax/lists"}