Skip to content
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

[PART-3] Add transaction tax report #382

Merged

Conversation

ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented May 23, 2024

This PR adds ability to fetch transactions entries based on trades, movements and ledgers tables for Transaction Tax Report


It's a 1-part of the feature, the main idea taken from these PRs: #373, #378, #379

  • separates into small parts
  • improves and speeds up the currency conversion approach

Basic changes:

  • Adds ability to return exactUsdValue and _id for movements
  • Adds ability to fetch transactions

Copy link
Contributor

@ezewer ezewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment


continue
}
if (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this logic.
Is not the exact usd what we are trying to get.
Why would we need the first and last symbol price mapped to usd?
We should add the USD reference, lastSymbPriceUsd etc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to simplify tax calc I would like to have a distinct data structure: just have firstSymbPrice and lastSymbPrice for pairs eg tETHBTC
At the same time, we can have movements eg BTC deposits, and should consider it like tBTCUSD
exactUsdValue - is the amount in transaction in USD (the logic would be as we planned) that can be used for calc prices of pairs eg tETHBTC
In other words, in tables, have one additional field exactUsdValue
when have exactUsdValue -> calc firstSymbPrice, lastSymbPrice
if don't have exactUsdValue -> get from pub-trades, set exactUsdValue to appropriate tables -> calc firstSymbPrice, lastSymbPrice
having firstSymbPrice, lastSymbPrice can calc tax report
the idea is to not calculate everything in one place

Copy link
Contributor

@ezewer ezewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants