Models
Models are target portfolios that you assign to households and accounts. AdviceCloud proposes the trades of a household or an account from its model when it builds a rebalance.
A model combines primary securities, security groups and sleeves, each with a target weight from 0 to 100. A model can also have security restrictions and a benchmark.
To see a portfolio's performance, asset allocation or risk allocation before you save it as a model, call Calculate the performance of a portfolio, Calculate the asset allocation of a portfolio or Calculate the risk allocation of a portfolio. To see a model as one combined weight for each security, call Get a flattened model.
List models
Returns your firm's models, in ascending order of `id`. The list does not include each model's primary securities, security groups, sleeves or security restrictions: call **Get a model** for those.
Create a model
Creates a model with the name, benchmark, primary securities, security groups, sleeves and security restrictions in the request body.
Get a model
Returns the model with the given ID, with its primary securities, security groups, sleeves and security restrictions. If your firm has no model with that ID, the response is `404`.
Delete a model
Deletes the model with the given ID. If accounts or households are assigned to the model, send `newModelId` to assign them another model of your firm, or `0` to leave them with no model; the change and the delete succeed or fail together. To see whether any are assigned, call **Get the number of accounts and households assigned to a model**. Returns `deleted: true`. If your firm has no model with the given ID, or no model with the ID in `newModelId`, the response is `404`.
Update a model
Replaces the model with the given ID with the one in the request body. Send every field: primary securities, security groups, sleeves and security restrictions that you leave out of their arrays are removed from the model. Other fields in the body, such as `id`, are ignored. If your firm has no model with that ID, the response is `404`.
Get a flattened model
Returns the model with the given ID as one combined weight for each security, as the console shows it under Flattened Model. If your firm has no model with that ID, the response is `404`.
Get the number of accounts and households assigned to a model
Returns the number of your firm's accounts and households assigned to the model with the given ID. Call it before **Delete a model** to know whether to send `newModelId`. If your firm has no model with that ID, the response is `200` with both numbers `0`.
Calculate the performance of a portfolio
Calculates the annualized returns, expense ratio, dividend yield and alpha of the portfolio in the request body. Nothing is saved. Security group and sleeve IDs that are not your firm's are ignored. The console shows the result under Performance on a model's page.
Calculate the asset allocation of a portfolio
Calculates the percent of the portfolio in the request body that is in each of your firm's asset classes. Each security counts toward the asset classes of its security category. Nothing is saved. Security group and sleeve IDs that are not your firm's are ignored. Returns the asset classes in your firm's order.
Calculate the risk allocation of a portfolio
Calculates the percent of the portfolio in the request body that is in each of your firm's risk levels, and returns it in `current`. `target` is always `{}`. Nothing is saved. Security group and sleeve IDs that are not your firm's are ignored.