Introduction

The Investment Portfolio service lets you store, update, and query your investment portfolios and associated holdings using flexible object definitions so you can store more information without worrying about format. With outstanding performance, flexible storage, filtering, and data retrieval, you can make informed and timely investment decisions quickly.

Error handling

This API uses standard HTTP response codes to indicate whether a method completed successfully. A 200 response always indicates success. A 400 type response is some sort of failure, and a 500 type response usually indicates an internal system error.

Methods

Create multiple portfolios

This operation creates or updates multiple portfolios at once. For example, you can limit a number of writes to a single command by using this operation to create two portfolios and update three more. To update an existing portfolio with a specific timestamp, include the _rev property in the definition.

POST /bulk_portfolios
Request
Response

Status Code

  • Request handled. See result for status of each portfolio in the array.

  • Invalid request.

Example responses

Get portfolios

This operation returns all portfolios from the system that the caller has access to based on the specified parameters. Each portfolio name may have multiple entries with different timestamps. Use the latest parameter to retrieve only the most recent entry for each portfolio and use the openOnly parameter to retrieve only open portfolios.

GET /portfolios
Request

Query Parameters

  • When the value is true, the most recent entry for each portfolio is returned. When the value is false, all entries are returned for all portfolios. The default value is false.

    Allowable values: [true,false]

  • When the value is true, only open portfolios are returned. When the value is false, all portfolios are returned. The default value is false.

    Allowable values: [true,false]

Response

Status Code

  • Successful operation.

  • Invalid request. See description for details.

Example responses

Create portfolio

This operation creates a portfolio entry. Values are required for name and timestamp.

POST /portfolios
Request
Response

Status Code

  • Successful operation.

  • Invalid request. See description for details.

No Sample Response

This method does not specify any sample responses.

Find portfolios by selector

This operation returns portfolios that have data matching the specified selector. Use this operation for complex queries. For more information about the syntax, see Selector Syntax.

POST /portfolios/_find
Request
Response

Status Code

  • Successful operation.

  • Invalid request. See description for details.

No Sample Response

This method does not specify any sample responses.

Find portfolio by name

This operation returns the named portfolio. Use the atDate parameter to retrieve only the portfolios on or before a specified date and time and the hasAnyKey, hasKey, hasKeyValue, and hasNoKey parameters to retrieve portfolios based on the keys in their data field. Use the limit parameter to return only a specified number of portfolios.

GET /portfolios/{portfolioName}
Request

Path Parameters

  • Name of the portfolio to retrieve

Query Parameters

  • When this parameter specifies a date and time, the portfolios with timestamps on or before the specified date and time are returned. If the time is not specified, the default is 00:00:00.000.

  • When the data field of the portfolio contains any of the keys specified by this parameter, that portfolio is returned. For example, to get portfolios with either the manager or acting-manager keys defined, you can specify hasAnyKey=manager,acting-manager.

  • When the data field of the portfolio contains the keys specified by this parameter, that portfolio is returned. For example, to get portfolios with the manager and acting-manager keys defined, you can either specify hasKey=manager,acting-manager or you can specify multiple hasKey parameters: hasKey=manager&hasKey=acting-manager.

  • When the data field of the portfolio contains the keys and values specified by this parameter, that portfolio is returned. For example, to get portfolios where Edward Lam is the manager, specify hasKeyValue=manager:Edward Lam.

  • When the data field of the portfolio doesn't contain the keys and values specified by this parameter, that portfolio is returned. For example, to get portfolios without the cancelled key defined, specify hasNoKey=cancelled.

  • When the value is an integer, the number of portfolios returned is limited to the number specified. If a number is not specified, all portfolios matching the other criteria are returned.

  • When the value is asc, the portfolios with the earliest timestamps are returned first. When the value is desc returns the portfolios with the most recent timestamps first. If no value is specified, then the portfolios are not sorted.

    Allowable values: [asc,desc]

Response

Status Code

  • Successful operation.

  • Portfolio not found.

No Sample Response

This method does not specify any sample responses.

Find named portfolio by selector

This operation returns the named portfolio that has data matching the specified selector. Use this operation for complex queries. For more information about the syntax, see Selector Syntax.

POST /portfolios/{portfolioName}/_find
Request

Path Parameters

  • Name of the portfolio to retrieve

Response

Status Code

  • Successful operation.

  • Invalid request. See description for details.

No Sample Response

This method does not specify any sample responses.

Delete portfolio

This operation deletes the portfolio entry where the name and timestamp match. Note that when you creating holdings associated with a portfolio, the date of the holdings must be on or after the date of the first entry for that portfolio. However, if you delete that first portfolio entry, the holdings data that exists after that entry but before the next entry for that portfolio are not deleted.

DELETE /portfolios/{portfolioName}/{timestamp}
Request

Path Parameters

  • Name of the portfolio to delete

  • Date and time of the portfolio entry to delete. If the time is not specified, the default is 00:00:00.000.

Query Parameters

  • The current _rev of the portfolio entry

Response

Status Code

  • Successful operation.

  • Invalid submission.

  • Portfolio at timestamp not found.

  • Invalid revision.

No Sample Response

This method does not specify any sample responses.

Update portfolio

This operation updates the portfolio entry where the portfolio name and timestamp match.

PUT /portfolios/{portfolioName}/{timestamp}
Request

Path Parameters

  • Name of the portfolio to update

  • Date and time of the portfolio entry to update

Response

Status Code

  • Successful operation. Returns the new revision _rev.

  • Invalid submission.

  • Invalid revision.

No Sample Response

This method does not specify any sample responses.

Create multiple holdings

This operation creates or updates multiple holdings at once. For example, you can limit a number of writes to a single command by using this operation to create two new holdings and update three more. To update an existing holding, include the _rev property in the definition.

POST /portfolios/{portfolioName}/bulk_holdings
Request

Path Parameters

  • Name of the portfolio with which the holdings are associated

Response

Status Code

  • Successful operation. See result for status of each holdings definition in the array.

  • Invalid request. See description for details.

  • Portfolio does not exist.

Example responses

Get holdings

This operation returns holdings associated with the specified portfolio. Use the latest parameter to retrieve only the holdings for the most recent entry for the specified portfolio, the atDate parameter to retrieve holdings on or before the specified timestamp, and the hasKey parameter to retrieve holdings that have the specified keys defined.

GET /portfolios/{portfolioName}/holdings
Request

Path Parameters

  • Name of the portfolio with which the holdings are associated

Query Parameters

  • When the value is a date and time, the holdings with timestamps on or before the specified date and time are returned.

  • When the value contains the names of keys, the holdings that have the specified keys defined are returned. For example, to get holdings with the isin and quantity keys defined, you can either specify hasKey=isin,quantity or you can specify multiple hasKey parameters: hasKey=isin&hasKey=quantity.

  • When the value is true, the most recent holdings entry is returned. When the value is false, all holdings are returned. The default value is false.

    Allowable values: [true,false]

Response

Status Code

  • Successful operation.

  • Portfolio does not exist.

Example responses

Create holdings

This operation creates holdings associated with the specified portfolio entry. Use the portfolioName parameter to specify the portfolio with which to associate the new holdings. New holdings must have a timestamp specifying a date and time either on or after the date and time specified by the timestamp of the associated portfolio.

POST /portfolios/{portfolioName}/holdings
Request

Path Parameters

  • Name of the portfolio to associate holdings with

Response

Status Code

  • Successful operation.

  • Invalid request. See description for details.

  • Portfolio does not exist.

No Sample Response

This method does not specify any sample responses.

Delete holdings

This operation deletes the holdings entry where name and timestamp match.

DELETE /portfolios/{portfolioName}/holdings/{timestamp}
Request

Path Parameters

  • Name of the portfolio the holdings is associated with

  • Date and time of the holdings entry to delete

Query Parameters

  • The current _rev of the holdings entry

Response

Status Code

  • Successful operation.

  • Invalid submission.

  • Holdings for portfolio at timestamp not found.

  • Invalid revision.

No Sample Response

This method does not specify any sample responses.

Update holdings

This operation updates the holdings entry where portfolio name and timestamp match.

PUT /portfolios/{portfolioName}/holdings/{timestamp}
Request

Path Parameters

  • Name of the portfolio with which the holdings are associated

  • Date and time of the holdings entry to update

Response

Status Code

  • Successful operation. Returns the new revision _rev.

  • Invalid submission.

  • Portfolio at timestamp not found.

  • Invalid revision.

No Sample Response

This method does not specify any sample responses.