Portfolio testing in Sandbox
Testing portfolio rebalancing is a valuable way to verify the effectiveness and accuracy of rebalancing executions, while understanding the flow of events and how best to integrate this functionality into your platform.
Our sandbox environment provides a controlled and safe space to simulate specific use cases without affecting real investments or financial assets. This guide walks you through the steps to effectively test portfolio rebalancing in our Sandbox environment.
Before reading this guide, you should already be familiar with the basic concepts of how portfolio investing works within the Investment API.
Performing a rebalancing in Sandbox
You can test a rebalancing trigger by performing a portfolio switch in the Sandbox. A portfolio switch means a reallocation of the invested capital from one predefined portfolio target allocation to another. For more information on portfolio switches, see the 'Enabling portfolio investments' tutorial guide.
Follow these steps to perform a rebalancing in Sandbox:
Create an account of the type
PORTFOLIO
.Create at least two portfolio allocations and change the weighting.
To link the account to one of the allocations, call POST
/portfolios/configurations
.Place a buy order for this account to establish a portfolio position for this account.
Perform the portfolio change with PATCH
/portfolios/configurations/{account_id}
referring to the ID of the second portfolio assignment created.Trigger a rebalancing on that account with POST
/portfolios/rebalancing/executions
.
You can repeat steps 5 & 6 indefinitely, using the two (or more) allocations for continuous testing.
This way you can already test the rebalancing flow, familiarise yourself with the mechanics and observe the different intersections where you receive webhook notifications.
In addition, you can also perform steps 3, 4 and 5 for multiple accounts at the same time or trigger a rebalancing at the global portfolio allocation level (instead of an account) in step 6, and observe that all accounts associated with this allocation are rebalanced.
For more context, see the relevant section in our API instructions: 'Triggering a rebalancing'.