Displaying Unrealized Gain/Loss

Unrealized gain/loss (e.g. +5%) is a core API capability delivered by TaxBit. Computing unrealized g/l requires a “current price” input, which in Enterprise Tax is assumed to be provided by the Client such that the price used to compute the unrealized g/l lines up with the price of the asset they are showing in real-time in their app

Basic Equation for Displaying Unrealized % Gain/Loss

🧮

( (Total Quantity * Current Price / Total Cost) - 1.0 ) * 100 = % Gain/Loss

Gain Example: (Buy 1 BTC at $20K, current price $24K)

( (1.0 * $24,000 / $20,000) - 1.0 ) * 100 = 20%

Loss Example: (Buy 1 BTC at $60K, current price $24K)

( (1.0 * 24,000 / $60,000) - 1.0 ) * 100 = - 60%

📘

This example talks about % gain/loss. Same ideas apply for displaying total gain/loss, just simpler equations: G/L = Total Quantity * Price - Total Cost.

Let’s use a sample /v1/inventory/summaries response to show how to calculate using API data for BTC.

curl  --request GET \
  --url 'https://api.multi1.enterprise.taxbit.com/v1/inventory/summaries?account_id={{account-id}}' \
  --header 'authorization: Bearer {{token}}'
HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
    {
      "asset": {
        "uuid": "9cd9f4d4-078b-4e44-a308-7662fec0f546",
        "name": "Bitcoin",
        "code": "BTC",
        "type": "Crypto"
      },
      "fiat_asset": {
        "uuid": "df939ab7-b7ed-4216-be63-ca1d2a130396",
        "name": "United States Dollar",
        "code": "USD",
        "type": "Fiat"
      },
      "summary": {
        "total_quantity": "2",
        "total_cost": "60010",
        "average_unit_cost": "30005",
        "total_quantity_with_cost_basis": "2"
      }
    },
    {
      "asset": {
        "uuid": "b7a005b5-f4d5-44ea-ae80-d4f9e8313558",
        "name": "Ethereum",
        "code": "ETH",
        "type": "Crypto"
      },
      "fiat_asset": {
        "uuid": "df939ab7-b7ed-4216-be63-ca1d2a130396",
        "name": "United States Dollar",
        "code": "USD",
        "type": "Fiat"
      },
      "summary": {
        "total_quantity": "1",
        "total_cost": "2005",
        "average_unit_cost": "2005",
        "total_quantity_with_cost_basis": "1"
      }
    }
  ]
}

Our total quantity is 2, our total cost is $60,010 (note that total cost is NOT average cost per unit, but the total amount paid for all units in inventory). Let’s assume the current price of BTC is $75,000.

( (2.0 * $75,000 / $60,010) - 1.0 ) * 100 =149.58% unrealized gain

The end user would be able to easily determine they are sitting on ~150% of unrealized gain, which can better inform their decision to sell or hold their units of BTC.

Transfers and Missing Cost Basis

In today’s world, Transfers (transfer-in, aka deposits) don’t include Cost Basis. These transactions will increase a user’s inventory, but the impact on the user’s unrealized gain/loss takes some interpretation.

Each platform has options for how they display this nuance to the user. TaxBit APIs provide the necessary data for the platform to choose the best user experience.

Three options:

  1. (Recommended) Display the unrealized gain/loss only for inventory for which cost basis is known.
  2. (Not Recommended) Assume inventory with unknown cost basis has 0 cost basis. This in effect is what would happen if you apply the basic equation above.
  3. Assume the cost basis is the FMV of when the transfer-in transaction occurred. The idea here is that you would be showing the user the unrealized gain/loss that they experienced holding the assets on the platform. Note: This is possible with TaxBit APIs today, but it’s quite a bit more complicated to implement. If this is a desirable option, we should see how we could streamline the APIs needed to reduce complexity.

Equation for displaying unrealized % gain/loss with MCB

🧮

(((Total Quantity - MCB Quantity) * Current Price / Total Cost) - 1.0) * 100 = % Gain/Loss

Gain Example: (Buy 1 BTC at $20K, deposit 1 BTC, current price $24K)
(((2.0- 1.0) * $24,000 / $20,000) - 1.0) * 100 = 20%

Loss Example: (Buy 1 BTC at $60K, deposit 1 BTC. current price $24K)
(((2.0-1.0) * $24,000 / $60,000) - 1.0) * 100 = -60%