Skip to content

Custom Index


Endpoints

POST      /custom_indexes
GET       /custom_indexes
GET       /custom_indexes/:id
PUT       /custom_indexes/:id
DELETE    /custom_indexes/:id

A custom index is a proprietary vector of date-value tuples. It can represent a proprietary benchmark, a risk factor, a proxy or any other measure. Even when persisted to your account, it is only available to the account.

Not bound to a workspace

Custom indexes are scoped to the account, not to a workspace. Every workspace in the account sees the same custom indexes.

The symbol must match the pattern ^CUSTOM:[A-Z0-9_]*$: the CUSTOM: prefix followed by uppercase letters, digits and underscores, for example CUSTOM:AAPLBRL.

The Custom Index Object

What a custom index object looks like?

{
  "updated": 1625598288,
  "description": "This is my first custom index",
  "data_type": "PRICE",
  "created": 1625598288,
  "symbol": "CUSTOM:AAPLBRL",
  "tags": ["first", "custom_index", "20210622"],
  "name": "AAPL in BRL",
  "currency": "BRL",
  "data": [
    ["20201209", 554.69],
    ["20190814", 985.45],
    ["20171012", 885.07]
  ],
  "periodicity": "D",
  "base_price": 1.0
}
Property Description
symbol string Unique identifier for the custom index. Must match ^CUSTOM:[A-Z0-9_]*$.
created timestamp Time at which the object was created. Measured in seconds since the Unix epoch.
updated timestamp Time at which the object was updated. Measured in seconds since the Unix epoch.
name string The name of the custom index.
description string An arbitrary string attached to the custom index. Often useful for finding detailed information about the custom index or for filtering a search based on the present hashtags.
tags array Sequence of hashtags used to find the related Custom Index. The more hashtags that are used, the more elements that are filtered out from the search. Labels, dates and any other hashtag can be used.
data_type string The type of data sent through the data parameter. It can be: PRICE, RETURN(Decimal) or RETURN_100(Percentual).
currency string 3-letter ISO 4217 code for currency. To see all supported currencies click here.
version string Indicates the custom index's current version.
periodicity string The periodicity of the data changes. It can be: D (Daily) or M (Monthly).
base_price float The base price when data_type is set to RETURN or RETURN_100 .
data array The content that will be stored inside the Custom Index.

Create a custom index

Creates and then returns the new custom index.

To create a new custom index, run the following:

curl https://api.everysk.com/v2/custom_indexes \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
        "symbol": "CUSTOM:AAPLBRL",
        "name": "AAPL-BRL",
        "tags": [
          "first",
          "custom_index",
          "20210622"
        ],
        "description": "This is my first custom index",
        "currency": "BRL",
        "date": "20210622",
        "data": [
          ["20201209", 554.69],
          ["20190814", 985.45],
          ["20171012", 885.07]
        ]
      }' \
  -X POST

The above call returns the following JSON object:

{
  "custom_index": {
    "updated": 1625598288,
    "description": "This is my first custom index",
    "data_type": "PRICE",
    "created": 1625598288,
    "symbol": "CUSTOM:AAPLBRL",
    "tags": ["first", "custom_index", "20210622"],
    "name": "AAPL in BRL",
    "currency": "BRL",
    "data": [
      ["20201209", 554.69],
      ["20190814", 985.45],
      ["20171012", 885.07]
    ],
    "periodicity": "D",
    "base_price": 1.0
  }
}

HTTP Request

POST /custom_indexes

HTTP Parameters

Parameter Description
symbol string REQUIRED A unique identifier (UID) for a custom index. Every custom index symbol must begins with CUSTOM and have no spaces between words.
name string REQUIRED A string to identify a custom index besides the custom index's id. Feel free to use a meaningful name for your custom index.
description string optional, default is null Use this field to provide detailed information about your custom index. You also can add hashtags to create groups or categories allowing you to search for them later.
tags string optional, default is null Filters the list of custom indexes through the tags added in the description. Do not use hashtags when passing a value to this parameter.
data_type string optional, default is PRICE The type of data sent through the data parameter. It can be: PRICE, RETURN(Decimal) or RETURN_100(Percentual).
periodicity string optional, default is D The periodicity of the data changes. It can be: D (Daily) or M (Monthly).
currency string optional, default is USD 3-letter ISO 4217 code for currency. To see all supported currencies click here.
base_price float optional, default is 1.0 The base price when data_type is set to RETURN or RETURN_100.
data array REQUIRED The content that will be stored inside the Custom Index.

List all custom indexes

To list all custom indexes, run the following:

curl https://api.everysk.com/v2/custom_indexes?query=#20210622 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -G

The above call returns the following JSON object:

{
  "custom_indexes": [
    {
      "updated": 1625598288,
      "description": "This is my first custom index",
      "data_type": "PRICE",
      "created": 1625598288,
      "symbol": "CUSTOM:APPLBRL",
      "tags": [
        "first",
        "custom_index",
        "20210622"
      ],
      "name": "AAPL in BRL",
      "currency": "USD",
      "periodicity": "D",
      "base_price": 1.0
    },
    ...
  ],
  "next_page_token": null
}

Returns a list of custom indexes you’ve previously created. The custom indexes are returned in sorted order, with the most recent custom index appearing first.

HTTP Request

GET /custom_indexes

HTTP Parameters

Parameter Description
query string optional, default is null Request a list of custom indexes filtering it by name or tag. When using a tag to perform a query, each term must include a hashtag prefix. (e.g: query="#april #sample") See Filter with query.
page_size integer optional, default is 10 Set the number of objects that will be listed per page.
page_token integer optional, default is null The token defines which page will be returned to the user. For further information, please check out our pagination guide.

Retrieve a Custom Index

To retrieve a custom index, run the following:

curl https://api.everysk.com/v2/custom_indexes/CUSTOM:APPLBRL \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -G

The above call returns the following JSON object:

{
  "custom_index": {
    "updated": 1625598288,
    "description": "This is my first custom index",
    "data_type": "PRICE",
    "created": 1625598288,
    "symbol": "CUSTOM:AAPLBRL",
    "tags": ["first", "custom_index", "20210622"],
    "name": "AAPL in BRL",
    "currency": "BRL",
    "data": [
      ["20201209", 554.69],
      ["20190814", 985.45],
      ["20171012", 885.07]
    ],
    "periodicity": "D",
    "base_price": 1.0
  }
}

Retrieves the details of an existing custom index by supplying the custom index's symbol.

HTTP Request

GET /custom_indexes/:id

HTTP Parameters

Parameter Description
symbol string REQUIRED A unique identifier (UID) for a custom index. A custom index symbol will always look like this: CUSTOM:APPLBRL.

Update a custom index

Updates a custom index and then returns the updated custom index.

To update a custom index, run the following:

curl https://api.everysk.com/v2/custom_indexes/CUSTOM:AAPLBRL \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
        "data": [
            ["20200630", 952.12],
            ["20200731", 953.06],
            ["20200831", 953.25]
        ],
        "description": "My new custom index description",
        "data_type": "PRICE",
        "periodicity": "M"
      }' \
  -X PUT

The above call returns the following JSON object:

{
  "custom_index": {
    "updated": 1625668154,
    "description": "My new custom index description",
    "data_type": "PRICE",
    "created": 1625598288,
    "symbol": "CUSTOM:AAPLBRL",
    "tags": ["first", "custom_index", "20210622"],
    "name": "My New Custom Index",
    "currency": "BRL",
    "data": [
      ["20200630", 952.12],
      ["20200731", 953.06],
      ["20200831", 953.25]
    ],
    "periodicity": "M",
    "base_price": 1.0
  }
}

HTTP Request

PUT /custom_indexes/:symbol

HTTP Parameters

Parameter Description
name string REQUIRED A string to identify a custom index besides the custom index's id. Feel free to use a meaningful name for your custom index.
description string optional, default is null Use this field to provide detailed information about your custom index. You also can add hashtags to create groups or categories allowing you to search for them later.
tags string optional, default is null Filters the list of custom indexes through the tags added in the description. Do not use hashtags when passing a value to this parameter.
data_type string optional, default is PRICE The type of data sent through the data parameter. It can be: PRICE, RETURN(Decimal) or RETURN_100(Percentual).
periodicity string optional, default is D The periodicity of the data changes. It can be: D (Daily) or M (Monthly).
currency string optional, default is USD 3-letter ISO 4217 code for currency. To see all supported currencies click here.
base_price float optional, default is 1.0 The base price when data_type is set to RETURN or RETURN_100.
data array REQUIRED The content that will be stored inside the Custom Index.

Delete a custom index

To delete a custom index, run the following:

curl https://api.everysk.com/v2/custom_indexes/CUSTOM:AAPLBRL \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -X DELETE

The above call returns the following JSON object:

{
  "custom_index": {
    "deleted": true,
    "symbol": "CUSTOM:AAPLBRL",
    "name": "AAPL in BRL"
  }
}

Permanently deletes a custom index. It cannot be undone. Returns an object with the custom index's id and an attribute specifying whether the custom index was successfully deleted or not.

HTTP Request

DELETE /custom_indexes/:id

HTTP Parameters

Parameter Description
symbol string REQUIRED A unique identifier (UID) for a custom index. Every custom index symbol must begins with CUSTOM and have no spaces between words.