Skip to content

Portfolio


Endpoints

POST      /portfolios
GET       /portfolios
GET       /portfolios/:id
PUT       /portfolios/:id
DELETE    /portfolios/:id

A portfolio is a collection of financial investments like stocks, bonds, derivatives, commodities, cash, and cash equivalents. Each security can be traded in a specific local currency. The portfolio has a base currency that is required to reflect each FX risk.

The portfolio object

What a portfolio object looks like?

{
  "updated": 1625680032,
  "description": "This is my first portfolio",
  "created": 1625680032,
  "tags": [
    "first",
    "portfolio",
    "20210622"
  ],
  "securities": [
    {
      "status": "OK",
      "cost_price": null,
      "fx_rate": null,
      "unrealized_pl_in_base": null,
      "exchange": "XNAS",
      "symbol": "AAPL",
      "multiplier": null,
      "label": null,
      "currency": "USD",
      "market_price": null,
      "unrealized_pl": null,
      "isin": null,
      "extra_data": null,
      "id": "id1",
      "quantity": 1000.0,
      "name": "Apple Inc"
    },
    ...
  ],
  "date": "20210622",
  "workspace": "main",
  "nlv": null,
  "base_currency": "USD",
  "id": "port_V7xU8dwCMnJIuyUPHJPx2ynuz",
  "name": "My First Portfolio"
}
Property Description
id string Unique identifier (UID) for the portfolio.
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 portfolio's name.
description string An arbitrary string attached to the portfolio. Often useful for finding detailed information about the portfolio or for filtering a search based on the present hashtags.
tags array Sequence of hashtags used to find the related portfolio. 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.
date string date Portfolio date in the format: YYYYMMDD. The Portfolio Date is important because it instructs the API to use the market conditions and security prices prevailing on that date. In order to run the portfolio using the market conditions prevailing today, use null.
base_currency string 3-letter ISO 4217 code for currency. Portfolios can have their base currency changed via the API call. To see all supported currencies click here.
nlv file The net liquidating value of the portfolio (also called NAV). When not supplied by user, the API will calculate the net liquidating value of all the cash securities. Securities traded on margin are assumed to have NLV zero. Supplying a NLV effectively reconciles the margin.
securities array It is an array of objects to describe the securities in the portfolio. Each object represents a security with a unique id, symbol, quantity and label. For more details click here.
workspace string The workspace where the portfolio was generated.

Create a portfolio

To create a new portfolio, run the following:

curl https://api.everysk.com/v2/portfolios \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
        "name": "My First Portfolio",
        "tags": [
          "first",
          "portfolio",
          "20210622"
        ],
        "securities": [
          {
            "id": "id1",
            "symbol": "AAPL",
            "quantity": 1000.0
          },
          {
            "id": "id2",
            "symbol": "SIE:XETR",
            "quantity": 750.0
          }
        ],
        "workspace": "main"
      }' \
  -X POST

The above call returns the following JSON object:

{
  "portfolio": {
    "updated": 1625680032,
    "description": "",
    "created": 1625680032,
    "tags": [
      "first",
      "portfolio",
      "20210622"
    ],
    "securities": [
      {
        "status": "OK",
        "cost_price": null,
        "fx_rate": null,
        "unrealized_pl_in_base": null,
        "exchange": "XNAS",
        "symbol": "AAPL",
        "multiplier": null,
        "label": null,
        "currency": "USD",
        "market_price": null,
        "unrealized_pl": null,
        "isin": null,
        "extra_data": null,
        "id": "id1",
        "quantity": 1000.0,
        "name": "Apple Inc"
      },
      ...
    ],
    "date": "20210622",
    "workspace": "main",
    "nlv": null,
    "base_currency": "USD",
    "id": "port_V7xU8dwCMnJIuyUPHJPx2ynuz",
    "name": "My First Portfolio"
  }
}

Creates and then returns the new portfolio.

HTTP Request

POST /portfolios

HTTP Parameters

Parameter Description
name string REQUIRED A mnemonic string to identify a portfolio, besides the portfolio's unique id.
description string optional, default is null Provides detailed information about your portfolio. You may add hashtags to create tags allowing you to search for them later.
date string date optional, default is null (today) Portfolio date in the format: YYYYMMDD. The Portfolio Date is important because it instructs the API to use the market conditions and security prices prevailing on that date. Therefore, historical portfolios will be calculated without look ahead. In order to run the portfolio using market conditions prevailing today, use null.
base_currency string optional, default is USD 3-letter ISO 4217 code for currency. Portfolios can have their base currency changed via the API call. To see all supported currencies click herehere.
nlv file optional, default is null (calculated) The net liquidating value of the portfolio (also called NAV). When not supplied by user, the API will calculate the net liquidating value of all the cash securities. Securities traded on margin are assumed to have NLV zero. Supplying a NLV effectively reconciles the margin.
securities array REQUIRED It is an array of objects to describe the securities in the portfolio. Each object represents a security, which requires a unique id, symbol, quantity. For more details click here.
with_securities boolean optional, default is True When True, the the securities inside the generated portfolio will be returned in the api response.
workspace string optional, default is main Determines on which workspace the request will be made.

List all portfolios

To list all portfolios, run the following:

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

The above call returns the following JSON object:

{
  "portfolios": [
    {
      "updated": 1625064158,
      "description": "",
      "created": 1625064158,
      "tags": [
        "first",
        "portfolio",
        "20210622"
      ],
      "date": "20210622",
      "workspace": "main",
      "nlv": null,
      "base_currency": "USD",
      "id": "port_EUCUUH8M3GNeopdFvrZ47qGx3",
      "name": "My First Portfolio"
    },
    ...
  ],
  "next_page_token": null
}

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

HTTP Request

GET /portfolios

HTTP Parameters

Parameter Description
query string optional, default is null Request a list of portfolios 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.
workspace string optional, default is main Determines on which workspace the request will be made.
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 portfolio

To retrieve a portfolio, run the following:

curl https://api.everysk.com/v2/portfolios/port_V7xU8dwCMnJIuyUPHJPx2ynuz?workspace=main \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -G

The above call returns the following JSON object:

{
  "portfolio": {
    "updated": 1625680032,
    "description": "",
    "created": 1625680032,
    "tags": [
      "first",
      "portfolio",
      "20210622"
    ],
    "securities": [
      {
        "status": "OK",
        "cost_price": null,
        "fx_rate": null,
        "unrealized_pl_in_base": null,
        "exchange": "XNAS",
        "symbol": "AAPL",
        "multiplier": null,
        "label": null,
        "currency": "USD",
        "market_price": null,
        "unrealized_pl": null,
        "isin": null,
        "extra_data": null,
        "id": "id1",
        "quantity": 1000.0,
        "name": "Apple Inc"
      },
      ...
    ],
    "date": "20210622",
    "workspace": "main",
    "nlv": null,
    "base_currency": "USD",
    "id": "port_V7xU8dwCMnJIuyUPHJPx2ynuz",
    "name": "My First Portfolio"
  }
}

Retrieves the details of an existing portfolio by supplying the portfolio's id.

HTTP Request

GET /portfolios/:id

HTTP Parameters

Parameter Description
id string REQUIRED A unique identifier (UID) for a portfolio. A portfolio's id will always look like this: port_V7xU8dwCMnJIuyUPHJPx2ynuz
workspace string optional, default is main Determines on which workspace the request will be made.

Update a portfolio

To update a portfolio, run the following:

curl https://api.everysk.com/v2/portfolios/port_V7xU8dwCMnJIuyUPHJPx2ynuz \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
        "name": "New Portfolio's Name",
        "description": "New Portfolio's Description",
        "securities": [
          {
            "id": "id3",
            "symbol": "NFLX",
            "quantity": 500.0
          }
        ],
        "workspace": "main"
      }' \
  -X PUT

The above call returns the following JSON object:

{
  "portfolio": {
    "updated": 1625680366,
    "description": "New Portfolio's Description",
    "created": 1625680032,
    "tags": ["first", "portfolio", "20210622"],
    "securities": [
      {
        "status": "OK",
        "cost_price": null,
        "fx_rate": null,
        "unrealized_pl_in_base": null,
        "exchange": "XNAS",
        "symbol": "NFLX",
        "multiplier": null,
        "label": null,
        "currency": "USD",
        "market_price": null,
        "unrealized_pl": null,
        "isin": null,
        "extra_data": null,
        "id": "id3",
        "quantity": 500.0,
        "name": "NetFlix Inc"
      }
    ],
    "date": "20210707",
    "workspace": "main",
    "nlv": null,
    "base_currency": "USD",
    "id": "port_V7xU8dwCMnJIuyUPHJPx2ynuz",
    "name": "New Portfolio's Name"
  }
}

Updates a portfolio and then returns the updated portfolio.

HTTP Request

PUT /portfolios/:id

HTTP Parameters

Parameter Description
id string REQUIRED A unique identifier (UID) for a portfolio.
name string optional, default is null A string to identify a portfolio besides the portfolio's id. Feel free to use a meaningful name for your portfolio.
description string optional, default is null Use this field to provide detailed information about your portfolio. You also can add hashtags to create groups or categories allowing you to search for them later.
base_currency string optional, default is null 3-letter ISO 4217 code for currency. Entering a currency here changes the base currency of the portfolio. To see all supported currencies click here.
securities array It is an array of objects to describe the securities in the portfolio. Each object represents a security with a unique id, symbol, quantity and label. For more details click here.
workspace string optional, default is main Determines on which workspace the request will be made.

Delete a portfolio

To delete a portfolio, run the following:

curl https://api.everysk.com/v2/portfolios/port_V7xU8dwCMnJIuyUPHJPx2ynuz?workspace=main \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -X DELETE

The above call returns the following JSON object:

{
  "portfolio": {
    "deleted": true,
    "id": "port_V7xU8dwCMnJIuyUPHJPx2ynuz",
    "name": "My First Portfolio"
  }
}

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

HTTP Request

DELETE /portfolios/:id

HTTP Parameters

Parameter Description
id string REQUIRED The portfolio's unique indetifier.
workspace string optional, default is main Determines on which workspace the request will be made.