Historical

In order to retrieve positions at multiple points in time, use the positions/historical endpoint.

To fully understand the output data, please refer to the Positions Point in time documentation and see the example below.

To fully understand how to specify the time series for which you want to retrieve data, please refer to the Historical Data documentation.

Request

This is a sample request for the positions in wallet 0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A from block 17540049 until the most recent block, every 1,000 blocks.

curl \
-H 'Authorization: Bearer <API KEY>' \
'https://gateway.credmark.com/v1/portfolio/1/0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A/positions/historical?startBlockNumber=17540049&blockInterval=1000'

Don’t forget to escape the ‘&’ when pasting this into a Unix terminal.

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

positions/historical

The requested resource, in this case, positions/historical

In this example we pass two query parameters, startBlockNumber and blockInterval. These mean that the first block for which positions should be retrieved is startBlockNumber, in this case, 17540049. Because we did not specify an endBlockNumber, it is assumed to be the latest block available when the API call is made. And finally, blockInterval is used to specify how often to retrieve positions between those two block numbers, in this case, once every 1,000 blocks.

Response

Given that input, this is what our output looks like. For brevity we've omitted part of the response and replaced it with an ellipsis.

{
  "chainId": 1,
  "startBlockNumber": 17540049,
  "endBlockNumber": 17554456,
  "startTimestamp": 1687496255,
  "endTimestamp": 1687671299,
  "accounts": [
    "0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A"
  ],
  "data": [
    {
      "blockNumber": 17540456,
      "blockTimestamp": 1687501211,
      "positions": [
        {
          "tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "balance": 0.2747114942399529
        },
        {
          "tokenAddress": "0x43f11c02439e2736800433b4594994bd43cd066d",
          "balance": 1370583.044686943
        },
        {
          "tokenAddress": "0x68cfb82eacb9f198d508b514d898a403c449533e",
          "balance": 6992.117661177189
        },
        {
          "tokenAddress": "0x8588d3a5fa9f63fa150815a88fc97183104fb6dc",
          "balance": 250
        },
        {
          "tokenAddress": "0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab",
          "balance": 57.912372252507524
        },
        {
          "tokenAddress": "0x8a40d1d5fd9c781e2eca06c78181f038ee4f4aa0",
          "balance": 23255
        },
        {
          "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "balance": 31.62
        },
        {
          "tokenAddress": "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e",
          "balance": 1370583.044686943
        },
        {
          "tokenAddress": "0xf61cacbd97a5f41e9bec170f21a8ff0b276b0266",
          "balance": 21129.148888
        }
      ]
    },
    {
      "blockNumber": 17541456,
      "blockTimestamp": 1687513475,
      "positions": [
        {
          "tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "balance": 0.2747114942399529
        },
        {
          "tokenAddress": "0x43f11c02439e2736800433b4594994bd43cd066d",
          "balance": 1370583.044686943
        },
        {
          "tokenAddress": "0x68cfb82eacb9f198d508b514d898a403c449533e",
          "balance": 6992.117661177189
        },
        {
          "tokenAddress": "0x8588d3a5fa9f63fa150815a88fc97183104fb6dc",
          "balance": 250
        },
        {
          "tokenAddress": "0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab",
          "balance": 57.912372252507524
        },
        {
          "tokenAddress": "0x8a40d1d5fd9c781e2eca06c78181f038ee4f4aa0",
          "balance": 23255
        },
        {
          "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "balance": 31.62
        },
        {
          "tokenAddress": "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e",
          "balance": 1370583.044686943
        },
        {
          "tokenAddress": "0xf61cacbd97a5f41e9bec170f21a8ff0b276b0266",
          "balance": 21129.148888
        }
      ]
    },
    ...,
    {
      "blockNumber": 17554456,
      "blockTimestamp": 1687671299,
      "positions": [
        {
          "tokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
          "balance": 0.2747114942399529
        },
        {
          "tokenAddress": "0x43f11c02439e2736800433b4594994bd43cd066d",
          "balance": 1370583.044686943
        },
        {
          "tokenAddress": "0x68cfb82eacb9f198d508b514d898a403c449533e",
          "balance": 6992.117661177189
        },
        {
          "tokenAddress": "0x8588d3a5fa9f63fa150815a88fc97183104fb6dc",
          "balance": 250
        },
        {
          "tokenAddress": "0x88acdd2a6425c3faae4bc9650fd7e27e0bebb7ab",
          "balance": 57.912372252507524
        },
        {
          "tokenAddress": "0x8a40d1d5fd9c781e2eca06c78181f038ee4f4aa0",
          "balance": 23255
        },
        {
          "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          "balance": 31.62
        },
        {
          "tokenAddress": "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e",
          "balance": 1370583.044686943
        },
        {
          "tokenAddress": "0xf61cacbd97a5f41e9bec170f21a8ff0b276b0266",
          "balance": 21129.148888
        }
      ]
    }
  ]
}

As with the output from our point in time example, our response body includes the context of the request. In this case:

FieldValueMeaning

chainID

1

The Chain ID, in this case, Ethereum mainnet.

startBlockNumber

17540049

This is the first block number that is included in our output.

endBlockNumber

17554456

This is the last block that is included in our output. Note that this was not specified but computed based on the input parameters provided.

startTimetamp

1687496255

This is the timestamp (number of seconds since January 1st, 1970) associated with the startBlockNumber.

endTimestamp

1687671299

This is the timestamp (number of seconds since January 1st, 1970) associated with the startBlockNumber.

accounts

[

"0x295B61866dAA53a76CE4b3a927EFAF0059b4a90A"

]

The list of accounts (wallets) from which positions were extracted.

The response then contains an array called data. Each array element includes a blockNumber, a blockTimestamp and an array of positions that existed at blockNumber in accounts.

Last updated