Rest API

Base URL

Default:
https://www.cfbenchmarks.com/api/v1/
Nasdaq Indices:
https://nciprod1.cfbenchmarks.com/api/v1/

Authorization

This API requires users to specify an API key. This key can be obtained by contacting CF Benchmarks for a license.

Once given a username and key, you would provide both in the request header with a header field of the form Authorization: Basic <credentials> where credentials is the Base64 encoding of the username and key joined by a single colon ':'.

Info
Request

Path: /api/v1/info

Example: https://www.cfbenchmarks.com/api/v1/info

Response

Will return the list of indices accessible by the API key. Returns the ID of each index, and the number of decimal places in the result.

{
  "serverTime": "2021-02-23T10:24:57.680Z",
  "payload": [
    {
      "id": "BRR",
      "decimals": 2
    },
    {
      "id": "BRTI",
      "decimals": 2
    },
    {
      "id": "ETHUSD_RR",
      "decimals": 2
    },
    {
      "id": "ETHUSD_RTI",
      "decimals": 2
    }
  ]
}
Values
Request

Path: /api/v1/values

Parameters:

  • id=[ String ] Required. ID of stream.

Example: https://www.cfbenchmarks.com/api/v1/values?id=BRTI

Response

Will return the most recent values in ascending order of time (10 minutes for RTIs and 1 year for RRs).

Each value object is composed as follows:

  • value Published index value.
  • time Milliseconds since Unix epoch.
{
  "serverTime": "2019-08-13T23:27:03.170Z",
  "payload": [
    {
      "value": "10855.99",
      "time": 1565739760000
    },
    {
      "value": "10856.06",
      "time": 1565739761000
    }
  ]
}

In exceptional circumstances index values may be delayed or amended after publication. In such cases cases, the value object may also contain either of the following two fields:

  • amendTime If the value has been amended after being previously published, this field indicates the time of the amendment in milliseconds since Unix epoch. If no amendment has been made, the field will not be present.
  • repeatOfPreviousValue If an error has occurred during calculation such that an index value could not be calculated for that day, and it has been replaced with the value from the previous day, this boolean field will exist, and will be true. If no such error has occurred, the field will not be present.

E.g.

{
  "serverTime": "2019-08-13T23:27:03.170Z",
  "payload": [
    {
      "value": "10855.99",
      "time": 1565739760000,
      "amendTime": 1565739860000,
      "repeatOfPreviousValue": true
    },
    {
      "value": "10856.06",
      "time": 1565739761000
    }
  ]
}
Stats
Request

Path: /api/v1/stats

Parameters:

  • id=[ String ] Mandatory. ID of stream. Must be a reference rate.
  • streamtype=[ String ] Mandatory. Type of stream. Must be one of volume, weight.

Example: https://www.cfbenchmarks.com/api/v1/stats?id=BRR&streamtype=volume

Response (streamtype volume)

Will return the most recent volume records in ascending order of time. Note that the volume exchanges may not add up exactly to 100 due to the effects of rounding.

Each value object is composed as follows:

  • value Published index value.
  • time Milliseconds since Unix epoch.
  • volume Total volume during the calculation window.
  • volumes Map of exchange name to volume objects, where each volume object is composed as follows:
    • volumePercent Percent of total volume from exchange.
{
  "serverTime": "2019-08-13T23:27:03.170Z",
  "payload": [
    {
      "value": "10856.29",
      "time": 1565739900000,
      "volume": "123.45",
      "volumes": {
        "bitstamp": {
          "volumePercent": "58.21"
        },
        "coinbase": {
          "volumePercent": "7.70"
        },
        "gemini": {
          "volumePercent": "7.73"
        },
        "itbit": {
          "volumePercent": "24.61"
        },
        "kraken": {
          "volumePercent": "2.26"
        }
      }
    }
  ]
}
Response (streamtype weight)

Will return the most recent basket weight records in ascending order of time. Note that the weights may not add up exactly to 100 due to the effects of rounding.

Each value object is composed as follows:

  • value Published index value.
  • time Milliseconds since Unix epoch.
  • weights Map of constituent symbol to weight objects, where each weight object is composed as follows:
    • weightPercent Percent of weight in basket.
{
  "serverTime": "2020-09-11T08:47:39.031Z",
  "payload": [
    {
      "time": 1599814058000,
      "value": "1313.31",
      "weights": {
          "BCH": {
              "weightPercent": "1.37"
          },
          "ETH": {
              "weightPercent": "18.93"
          },
          "LTC": {
              "weightPercent": "1.52"
          },
          "XBT": {
              "weightPercent": "74.75"
          },
          "XRP": {
              "weightPercent": "3.44"
          }
      }
    }
  ]
}
Response (streamtype constituentresult)

(If you require access to this stream type, please contact CF Benchmarks)
Will return the most recent constituent values and weights of an index in ascending order of time. Note that the weights may not add up exactly to 100 due to the effects of rounding.

Each value object is composed as follows:

  • value Published index value.
  • time Milliseconds since Unix epoch.
  • divisor Divisor used in calculation.
  • constituents Array of constituent result objects, where each object is composed as follows:
    • constituent Constituent symbol.
    • value Value of constituent.
    • weightPercent Percent of weight in basket.
    • exchanges Array of exchange result objects, where each object is composed as follows:
      • exchange Exchange name.
      • weightPercent Percent of weight of exchange in constituent result.
{
  "serverTime": "2021-01-10T09:13:45.032Z",
  "payload": [
    {
      "time": 1610270025000,
      "divisor": "356025403.2106",
      "value": "2026.34",
      "constituents": [
          {
            "constituent": "XBT",
            "value": "33049.27",
            "weightPercent": "75.29",
            "exchanges": [
                {
                  "exchange": "exchangeA",
                  "weightPercent": "75.29"
                },
                {
                  "exchange": "exchangeB",
                  "weightPercent": "10.55"
                },
                {
                  "exchange": "exchangeC",
                  "weightPercent": "14.16"
                }
              ]
          },
          {
            "constituent": "ETH",
            "value": "984.23",
            "weightPercent": "24.71",
            "exchanges": [
                {
                  "exchange": "exchangeA",
                  "weightPercent": "65.30"
                },
                {
                  "exchange": "exchangeB",
                  "weightPercent": "20.55"
                },
                {
                  "exchange": "exchangeC",
                  "weightPercent": "14.15"
                }
            ]
          }
      ]
    }
  ]
}

In addition to the above, each object in the payload array may contain any of the following fields:

  • amendTime If the value has been amended after being previously published, this field indicates the time of the amendment in milliseconds since Unix epoch. If no amendment has been made, the field will not be present.
  • repeatOfPreviousValue If an error has occurred during calculation such that an index value could not be calculated for that day, and it has been replaced with the value from the previous day, this boolean field will exist, and will be true. If no such error has occurred, the field will not be present.
Summary
Request

Path: /api/v1/summary

Parameters:

  • id=[ String ] Required. ID of stream.

Example: https://www.cfbenchmarks.com/api/v1/summary?id=BRTI

Response

Will return a summary of the given stream.

The summary object is composed as follows:

  • value Most recently published index value.
  • time Milliseconds since Unix epoch of value.
  • last24Hours Value and time for each of the last published values over the last 24 hours.
{
    "payload": {
        "last24Hours": [
            {
                "value": "9093.68",
                "time": 1583406000000
            },
            {
                "value": "9111.76",
                "time": 1583409600000
            },
            {
                "value": "9086.05",
                "time": 1583413200000
            },
            {
                "value": "9094.99",
                "time": 1583416800000
            },
            {
                "value": "9041.78",
                "time": 1583420400000
            },
            {
                "value": "9099.04",
                "time": 1583424000000
            },
            {
                "value": "9101.01",
                "time": 1583427600000
            },
            {
                "value": "9112.52",
                "time": 1583431200000
            },
            {
                "value": "9129.84",
                "time": 1583434800000
            },
            {
                "value": "9168.75",
                "time": 1583438400000
            },
            {
                "value": "9131.45",
                "time": 1583442000000
            },
            {
                "value": "9116.60",
                "time": 1583445600000
            },
            {
                "value": "9074.97",
                "time": 1583449200000
            },
            {
                "value": "9068.55",
                "time": 1583452800000
            },
            {
                "value": "9003.90",
                "time": 1583456400000
            },
            {
                "value": "9031.42",
                "time": 1583460000000
            },
            {
                "value": "9063.96",
                "time": 1583463600000
            },
            {
                "value": "9048.93",
                "time": 1583467200000
            },
            {
                "value": "9059.72",
                "time": 1583470800000
            },
            {
                "value": "9122.05",
                "time": 1583474400000
            },
            {
                "value": "9109.43",
                "time": 1583478000000
            },
            {
                "value": "9110.24",
                "time": 1583481600000
            },
            {
                "value": "9127.09",
                "time": 1583485200000
            },
            {
                "value": "9128.67",
                "time": 1583488800000
            }
        ],
        "value": "9141.73",
        "time": 1583495915000
    },
    "serverTime": "2020-03-06T11:58:36.518Z"
}
Latest Values
Request

Path: /api/v1/latest_values

Parameters:

  • id=[ String ] Required. ID(s) of stream. May contain up to 30 differents IDs, separates by commas.

Example: https://www.cfbenchmarks.com/api/v1/latest_values?id=BRR,BRTI

Response

Will return the latest values for the given stream(s).

The latest_values object is a map with an entry for each stream. In each case the value is composed as follows:

  • value Most recently published index value.
  • time Milliseconds since Unix epoch of value.
{
    "payload": {
        "latest_values": {
            "BRR": {
                "time": 1599750000000,
                "value": "10437.33"
            },
            "BRTI": {
                "time": 1599814290000,
                "value": "10291.07"
            }
        }
    },
    "serverTime": "2020-09-11T08:51:31.149Z"
}

In addition to the above, each object value in the latest_values map may contain any of the following fields:

  • amendTime If the value has been amended after being previously published, this field indicates the time of the amendment in milliseconds since Unix epoch. If no amendment has been made, the field will not be present.
  • repeatOfPreviousValue If an error has occurred during calculation such that an index value could not be calculated for that day, and it has been replaced with the value from the previous day, this boolean field will exist, and will be true. If no such error has occurred, the field will not be present.
Errors

Example: https://www.cfbenchmarks.com/api/v1/asdf

{
  "serverTime": "2019-08-13T23:30:53.992Z",
  "error": "api function was not found"
}
Great! Check your inbox and click the link to confirm your subscription.
Please enter a valid email address!