Endpoint

This is the API's most interesting endpoint, currently.

It computes the return (positive or negative) of the portfolio. In order to do this it finds the value of every asset added to the portfolio and compares it to the value of those assets at the block requested (the latest by default).

As with all endpoints that return a value with regards to another token, the other token can be specified (quoteAddress).

All traded assets are included in the list of positions even when the balance is 0.

Note that some assets might return 0 value albeit having a non-zero balance. This is due to the fact that none of our price algorithms support that token.

Request

This is a sample request:

curl \
-H 'Authorization: Bearer <API KEY>' \
'https://gateway.credmark.com/v1/portfolio/1/0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A/returns

We only need to pass one value in the request header, our API Key.

The request URL construction is straightforward. These are the path segments, in order, and their meaning:

SegmentMeaning

v1

The API version.

portfolio

The API name.

1

The Chain ID, in this case, Ethereum mainnet.

0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A

The address of the wallet from which we want to extract positions to be valued.

returns

The requested resource, in this case, returns.

Instead of one wallet, we could have passed a comma-separated list.

This endpoint supports two optional parameters: blockNumber and timestamp. Refer to the Time section to understand their use.

It also supports the optional parameter quoteAddress, which defaults to USD, i.e., 0x0000000000000000000000000000000000000348.

Response

This is the response given the above request:

{
  "chainId": 1,
  "blockNumber": 17564308,
  "blockTimestamp": 1687791095,
  "accounts": [
    "0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A"
  ],
  "quoteAddress": "0x0000000000000000000000000000000000000348",
  "totalReturn": -2012.6830425388905,
  "returns": [
    {
      "tokenAddress": "0x3349217670f9aa55c5640a2b3d806654d27d0569",
      "balance": 0,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0x4123a133ae3c521fd134d7b13a2dec35b56c2463",
      "balance": 0,
      "value": 0,
      "return": -69.8047007525671
    },
    {
      "tokenAddress": "0x43f11c02439e2736800433b4594994bd43cd066d",
      "balance": 1370583.044686943,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0x68cfb82eacb9f198d508b514d898a403c449533e",
      "balance": 6992.11766117719,
      "value": 16.731523998163482,
      "return": -1554.260179984161
    },
    {
      "tokenAddress": "0x8588d3a5fa9f63fa150815a88fc97183104fb6dc",
      "balance": 250,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab",
      "balance": 57.912372252507524,
      "value": 76.2806453088368,
      "return": -363.67844061797985
    },
    {
      "tokenAddress": "0x8a40d1d5fd9c781e2eca06c78181f038ee4f4aa0",
      "balance": 23255,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "balance": 31.62,
      "value": 31.613978603400003,
      "return": -0.005388996600000695
    },
    {
      "tokenAddress": "0xcd6bcca48069f8588780dfa274960f15685aee0e",
      "balance": 0,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e",
      "balance": 1370583.044686943,
      "value": 36.13528068993775,
      "return": -24.93433218758259
    },
    {
      "tokenAddress": "0xd31a59c85ae9d8edefec411d448f90841571b89c",
      "balance": 0,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0xf61cacbd97a5f41e9bec170f21a8ff0b276b0266",
      "balance": 21129.148888,
      "value": 0,
      "return": 0
    },
    {
      "tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "balance": 0.2747114942399529,
      "value": 517.5840272594636,
      "return": 0
    }
  ]
}

You'll note that for every token for which we held a position, we compute the return. At the start of the response we aggregate those returns into totalReturn. As you can see, this portfolio didn't do so well!

Last updated