这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented Apr 18, 2025

This PR adds ability to deduct trading fees in the tax report. Adds a flag shouldFeesBeDeducted to use that via a checkbox in the UI


Example:

  • 1_transaction buy BTC: amount 1, price 100_000 USD, fee: -10 USD
  • 2_transaction buy BTC: amount 2, price 200_000 USD, fee: -20 USD
  • 3_transaction sale BTC: amount -1.5, price 150_000 USD, fee: -15 USD

Result:

  • PnL: (1.5 * 150_000) - (1 * 100_000 + 0.5 * 200_000) = 25_000 USD
  • fees: 15 (from sale) + 10 (from buy 1) + (20 * (0.5 / 2)) (form buy 2, here we consider amount 0.5) = 30 USD
  • PnL with fees: 25_000 - 30 = 24970 USD

Request example:

{
    "auth": {
        "token": "auth-token"
    },
    "method": "getTransactionTaxReport",
    "params": {
      "start": 1681803136154,
      "end": 1744961536154,
      "strategy": "LIFO",
      "shouldFeesBeDeducted": true // The corresponding flag
    }
}

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!

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.

3 participants