To set up a portfolio configuration for an account, you need to specify the portfolio allocation in which the user wants to invest. Specifying the portfolio allocation for an account means that the money in that account will be invested and managed according to the defined allocation. In this sense, the portfolio configuration defines the target state of the user's investment in this account.
Note that you can only configure portfolio investments for accounts of the type PORTFOLIO. Furthermore, one portfolio allocation can be used for many portfolio configurations, while one configuration can only have one allocation at a time.
Before you can start configuring portfolios for your users, you must create portfolio accounts for them.
To configure a portfolio for a user, send the following request:
POST /portfolios/configurations
Example request
{
"account_id": "eb5ba93f-5dfe-4bf1-8571-4dadcaacc80c",
"allocation_id": "24c230eb-5d4f-4462-9af8-6612e7bd3afg"
}This sample request configures a portfolio investment for an account. Essentially, the portfolio configuration establishes a link between the account and the allocation. The response returns the account_id for which the portfolio was configured, since the account represents the entity through which a user's portfolio investment is managed. You can use this ID to manage a user's portfolio configuration at a later time.
We will soon provide you with the 'Setting up automated rebalancing' guide that shows how to additionally apply rebalancing strategies to a user's portfolio configuration.
You may want to delete an existing portfolio configuration in certain situations. For example, you may want to stop receiving rebalancing webhook events for an account with a portfolio configuration but no positions.
To delete a portfolio configuration, send the following request:
DELETE /portfolios/configurations/{account_id}
This request permanently deletes the portfolio configuration. It also automatically cancels all related portfolio orders that are in the NEW status. A successful request returns an HTTP 204 response with no body.
After deleting a portfolio configuration, you can use the POST /portfolios/configurations endpoint to create a new configuration.