Enabling portfolio investments
This guide will walk you through the implementation steps necessary to offer portfolio products to your users, how users can invest in the portfolios and how you can manage these portfolio investments.
Placing the first portfolio order
1. Creating a portfolio allocation
Before your users can invest in a portfolio of selected instruments, the target allocation of the respective portfolio must be defined. This is typically a step in which a portfolio manager (or the asset management department) selects the most suitable instruments - and their respective weightings. In this way, the investor's preferences can be best reflected in the resulting portfolio investment.
In the Investment API, this step is performed by creating a portfolio allocation resource. Portfolio allocations are standalone resources, you can create them at any time. This resource reflects the target state of a portfolio investment and is - if desired - reusable across the entire user base on your platform. In the traditional world, this is more commonly referred to as a 'model portfolio'.
Portfolio allocation specification
A portfolio allocation is defined by a list of instruments and their respective portfolio weights as a percentage of the total investment. They have the following specifications:
- The sum of the weights of all instruments in the allocation must equal 1.
- Each individual weight must be greater than 0 (i.e., no short positions are allowed).
- A portfolio allocation must include at least one instrument and no instrument can be listed twice.
- You can only include instruments that are tradable on the Investment API.
To create a portfolio allocation, send the following request:
This example request creates a new portfolio allocation containing two different instruments.
||You can use the returned allocation ID to continuously manage the created portfolio allocation and to configure a portfolio investment for your users (see next step).|
||Optional: Naming the created allocation is optional.|
As soon as a new portfolio allocation has been created, you will receive a webhook confirming the creation.
2. Setting up a portfolio configuration
Before you can start configuring portfolios for your users, you must create portfolio accounts for them.
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 is required to ensure that the money in that account is 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.
To configure a portfolio for a user, send the following request:
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.
3. Placing an order
Before a user can start investing money, the account must be funded and in
ACTIVE status, which means that all checks have been passed.
Once a configuration is created for an active account, the user can make an investment. Placing a portfolio order follows our standard order approach. However, instead of calculating the order volume for each individual instrument, you only need to specify the desired investment amount to place a portfolio order. The Investment API handles the conversion to individual orders in the background based on the instrument weight specified in the portfolio allocation.
To place a portfolio order, send the following request:
In the example request, a user has placed a portfolio order for 100€. Furthermore, the request returns a
portfolio_order_id which allows you to transparently track the progress of a portfolio order in its entirety.
You can find more details about this process in the guide 'Understanding portfolio orders'.
This concludes the step-by-step process of how to enable portfolio investments to your users from scratch. Now you have all the knowledge you need to start integrating the portfolio functionality into your application.
The Investment API will support smart order functionality to ensure that each cash inflow and outflow is performed in a way that after the order execution, the current holdings of a user best matches the defined portfolio allocation.
Managing portfolio allocations
As you have seen, enabling portfolio investments with our Investment API can be very simple, requiring only a couple of API calls from initial setup to the first investment for your users. Of course, the ongoing operation and maintenance of portfolio investments does not stop there. In this chapter, we list some common use cases required to confidently run a large number of portfolio investments for your users.
1. Listing portfolio allocations
You can list all created portfolio allocations as follows:
To get a more selective overview of portfolio allocations, query the list endpoint using the following parameters:
||Filters the list to show only portfolio allocations that contain the specified instruments.
||Filters the list to show only portfolio allocations created as of this date.
You can combine
||Filters the list to show only portfolio allocations that were created up to this date.
You can combine
2. Listing a portfolio allocation by ID
You can retrieve a single allocation by referencing its
3. Changing a portfolio allocation
The Investment API provides flexibility in customising initial portfolio allocations.
With the following API call, you can add, replace, or remove individual instruments, adjust respective target weights or modify the naming of the allocation. This allows you and your users to react to changing market conditions, investor preferences, and new information at any time:
Please note that the
allocation array included in this request must always contain the complete new allocation and thus fully represent the new target state (i.e. no delta updates).
The example call results in the following changes to the portfolio allocation:
- The weight of the first instrument is reduced from 0.7 to 0.5
- A third instrument is added to the allocation using an Upvest UUID as instrument identifier (i.e. for a cryptocurrency).
Once a portfolio allocation is successfully updated, you will receive a webhook notifying you about the change.
Note that by changing an allocation that is already used in one or more portfolio configurations, you automatically change the defined target allocation of the investment in the respective accounts. If you want the change to take effect immediately, you can trigger a rebalancing of the accounts to the new target allocation as described in the guide 'Triggering a rebalancing'.
Switching portfolio allocations ('reallocation')
A portfolio switch entails a reallocation of the invested capital from one predefined portfolio target allocation to another. Using the Investment API, this can be done in two steps:
- Changing the allocation in the portfolio configuration of the account
- Triggering a rebalancing of this specific account to reach its new target allocation.
Your user's investments are not affected by step 1 alone; this step only defines the new target state. The actual reallocation takes place after a rebalancing of the user's account is triggered. Once the rebalancing is triggered, the underlying process ensures that only the net differences within a user's account are sold and rebalanced. This has the advantage that users do not suffer any adverse tax implications resulting from liquidating the entire portfolio and purchasing a new allocation. It also eliminates the need to close the user's account.
1. Changing the allocation
To change the allocation, you need to adjust the portfolio configuration of the account by replacing the existing allocation with the new one.
In this sample request, a new target portfolio allocation is set for the user's account. From now on, the user's investments in this account will be managed according to the new allocation.
2. Triggering a rebalancing
To complete rebalancing of the portfolio, you can trigger a rebalancing for that account:
For more information on triggering a rebalancing, see the respective guide.
Now you can offer portfolio products to your users and know how to manage them. As a next step, we recommend you look at the mechanics of a portfolio order before exploring how to trigger a rebalancing.
Was this page helpful?