Repository navigation
feat: convert sent and received exports into trades and events - #13
Merged
Merged
Conversation
Exports of other tax tools, such as Koinly, CoinTracker, Awaken and ZenLedger files, record each transaction as what it sent and what it received: both sides make a trade, one side a deposit or a withdrawal. A recipe could only write trades or events for a whole file. Recipes are now version 2, and version 1 files load unchanged: - format `both` writes a trades file and an events file from one export; `route` holds the conditions that make a row a trade - a field can have fallbacks, tried in order when its source is empty, each under conditions, as an event's currency from the sent side when the received side is empty - a condition tests one column: filled, empty, or one of a list The wizard offers Both as a third format and suggests it for sent and received headers. The mapping step shows the rule for trades with how it splits the sample, a fallback column for an event's currency and amount, and types an event by its side when its label is empty. A label nobody mapped is still rejected rather than typed by its side. Event types and samples come from the rows that go to each file. The preview shows a table per file, and the convert step offers each file that got rows with where to import it in rotki. The worker writes one file per format and counts rows per format. The README describes the recipe file format.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 66.20% 69.12% +2.91%
==========================================
Files 40 40
Lines 1595 1807 +212
Branches 373 427 +54
==========================================
+ Hits 1056 1249 +193
+ Misses 472 471 -1
- Partials 67 87 +20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exports of other tax tools, such as Koinly, CoinTracker, Awaken and ZenLedger files, record each transaction as what it sent and what it received: both sides make a trade, one side a deposit or a withdrawal. Until now a recipe wrote either trades or events for a whole file. This lets one recipe write both, and is what presets for those tools will be built on.
Recipe format, version 2
Version 1 recipe files keep loading, and are upgraded on load.
format: 'both'writes a trades file and an events file from one export.routeholds the conditions a row has to meet to become a trade; every other row becomes an event.Received Currency, or fromSent Currencywhen the row received nothing.filled,empty, orone_ofa list of values. A condition list the reader cannot fully read is dropped whole rather than loosened.Wizard
Sent Amount,Received Quantity,IN Amount,Out Currencyand similar).both, a "Trades and events" section with the rule ("a row is a trade when … and also … have a value") and how it splits the sample; the event fields grouped as "Deposits and withdrawals"; "If empty, use" for an event's currency and amount; and a checkbox that types an event with an empty label by its side, Deposit when it received and Withdrawal when it sent. A label nobody mapped is still rejected, not typed by its side. Rules and fallbacks from a recipe file that the guided controls cannot edit are described instead.Worker
The start request names a file per format, all checked and all distinct. The worker opens only the files the recipe writes, closes every one of them on failure, and counts converted rows per format.
Testing
both, the preview tables and the two downloads.