Warning

The YCharts API is available to our API customers for their internal use only. Any redistribution or commercial use of data from the API is strictly prohibited without prior written consent from YCharts. For more details on our API’s capabilities and pricing please contact sales@ycharts.com or call (866) 965-7552.

Model Portfolio Holdings

The Model Portfolio Holdings Endpoint is used to return a list of holdings objects.

Request Info

Request Method

GET

URL

https://api.ycharts.com/v3/model_portfolios/symbol[s]/holdings?weight_type=weight_type

Request Parameters

Parameter

Required

Description

symbol[s]

Y

The security id for a model portfolio, or a comma separated list of security ids.

weight_type

N

Options: target or current. Whether to return the target weights or current weights of holdings.

Note

  • There is a maximum of 25 symbols per request.

Response Info

The response will contain one or more model portfolio objects. The key for each model portfolio object is the security id passed in the request.

Model Portfolio Object Fields

Field

Type

Description

meta

Meta

This object contains information about the query for the model portfolio object.

results

Results

This object contains one or more holding objects.

Holding Object Fields

Field

Type

Description

weight

decimal

Current Weight or Target Weight

name

string

Name

security_id

string

Security ID

Examples

The following is an example successful request for 1 model portfolio.

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1/holdings

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1/holdings"
    },
    "response": {
        "P:1": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "ok"
                    },
                    "data": [
                      {
                          "weight": 50,
                          "name": "Apple Inc",
                          "security_id": "AAPL"
                      },
                      {
                          "weight": 25,
                          "name": "Vanguard Total Stock Market ETF",
                          "security_id": "VTI"
                      },
                      {
                          "weight": 25,
                          "name": "Vanguard 500 Index Admiral",
                          "security_id": "M:VFIAX"
                      }
                  ]

                }
            }
        }
    }
}

The following is an example successful request for multiple model portfolios.

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1,P:2/holdings

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1,P:2/holdings"
    },
    "response": {
        "P:1": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "ok"
                    },
                    "data": [
                        {
                          "weight": 50,
                          "name": "Apple Inc",
                          "security_id": "AAPL"
                      },
                      {
                          "weight": 25,
                          "name": "Vanguard Total Stock Market ETF",
                          "security_id": "VTI"
                      },
                      {
                          "weight": 25,
                          "name": "Vanguard 500 Index Admiral",
                          "security_id": "M:VFIAX"
                      }
                    ]
                }
            }
        },
        "P:2": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "ok"
                    },
                    "data": [
                        {
                          "weight": 50,
                          "name": "Apple Inc",
                          "security_id": "AAPL"
                      },
                      {
                          "weight": 25,
                          "name": "Vanguard Total Stock Market ETF",
                          "security_id": "VTI"
                      },
                      {
                          "weight": 25,
                          "name": "Vanguard 500 Index Admiral",
                          "security_id": "M:VFIAX"
                      }
                    ]
                }
            }
        }
    }
}

The following is an example incorrect request for a model portfolio that does not exist.

Request URL

https://api.ycharts.com/v3/model_portfolios/P:0000/holdings

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:0000/holdings"
    },
    "response": {
        "P:0000": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "error",
                        "error_code": 404,
                        "error_message": "Security Not Found."
                    }
                }
            }
        }
    }
}

The following is an example incorrect request for a model portfolio that the user does not have access to.

Request URL

https://api.ycharts.com/v3/model_portfolios/P:3/holdings

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:3/holdings"
    },
    "response": {
        "P:3": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "error",
                        "error_code": 404,
                        "error_message": "You do not have access to the requested model portfolio."
                    }
                }
            }
        }
    }
}

The following is an example incorrect request for a model portfolio that is in the state ‘needs review’.

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1/holdings

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1/holdings"
    },
    "response": {
        "P:1": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "error",
                        "error_code": 404,
                        "error_message": "The model portfolio is in the state needs review and cannot be viewed."
                    }
                }
            }
        }
    }
}

The following is an example incorrect request for a model portfolio that is in the state ‘calculating’.

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1/holdings

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1/holdings"
    },
    "response": {
        "P:1": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "holdings": {
                    "meta": {
                        "status": "error",
                        "error_code": 404,
                        "error_message": "The model portfolio is in the state calculating and cannot be viewed."
                    }
                }
            }
        }
    }
}