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 Data Point

The Model Portfolio Data Point Endpoint is used to obtain a single date-value pair of data from one or more model portfolios for one or more calculations. It takes an optional date parameter and will return the latest value before the requested date.

Note

Full list of calcs can be found in the API Reference Guide

Request Info

Request Method

GET

URL

https://api.ycharts.com/v3/model_portfolios/security_ids[s]/points/calc[s]?date=date

Request Parameters

Parameter

Required

Description

symbol[s]

Y

The security id (e.g. ‘P:1234’) for a model portfolio, or a comma separated list of security ids

calc[s]

Y

The code for a calculation, or a comma separated list of calculations

date

N

Date of the desired data point, defaults to the latest data point

Note

  • There is a maximum of 100 model portfolios per request.

  • There is a maximum of 100 calculations per request.

Tip

The code for a calculation can be found in the url of the model portfolio’s historical data page. For example, the level of model portfolio P:1234 is found at https://ycharts.com/model_portfolios/1234/level

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 calculation data objects. The key for each object is the code for the calculation.

Calculation Data Object Fields

Field

Type

Description

data

Array

An array containing a date-value pair

meta

Meta

This object contains information about the query for the data

Examples

The following is an example successful response

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234/points/level

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234/points/level"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "level": {
                    "data": [
                        "2015-02-26",
                        130697.42
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        }
    }
}

The following is an example successful response with a relative date

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234/points/level?date=-44

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234/points/level?date=-44"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "level": {
                    "data": [
                        "2015-01-13",
                        110034.22
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        }
    }
}

The following is an example successful request with multiple calculations

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234/points/level,drift

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234/points/level,drift"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "drift": {
                    "data": [
                        "2015-02-26",
                        0.0582117
                    ],
                    "meta": {
                        "status": "ok"
                    }
                },
                "level": {
                    "data": [
                        "2015-02-26",
                        130697.42
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        }
    }
}

The following is an example successful request with multiple model portfolios

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234,P:5678/points/level

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234,P:5678/points/level"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "level": {
                    "data": [
                        "2015-02-26",
                        130697.42
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        },
        "P:5678": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "level": {
                    "data": [
                        "2015-02-26",
                        448904.05
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        }
    }
}

The following is an example successful request with multiple model portfolios, multiple calculations, and an absolute date

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234,P:5678/points/level,drift?date=2014-02-28

Respose

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234,P:5678/points/level,drift?date=2014-02-28"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "drift": {
                    "data": [
                        "2014-02-28",
                        0.04332
                    ],
                    "meta": {
                        "status": "ok"
                    }
                },
                "level": {
                    "data": [
                        "2014-02-28",
                        110034.22
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        },
        "P:5678": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "drift": {
                    "data": [
                        "2014-02-28",
                        0.00337
                    ],
                    "meta": {
                        "status": "ok"
                    }
                },
                "level": {
                    "data": [
                        "2014-02-28",
                        448904.05
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        }
    }
}

The following is an example of an incorrect request, which contains an error in the calculation

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234/points/levl

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234/points/levl"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "levl": {
                    "meta": {
                        "error_code": 404,
                        "error_message": "Calc Not Found.",
                        "status": "error"
                    }
                }
            }
        }
    }
}

The following is an example of an incorrect request, which requests a model portfolio ‘P:0000’ that does not exist

Request URL

https://api.ycharts.com/v3/model_portfolios/P:1234,P:0000/points/level

Response

{
    "meta": {
        "status": "ok",
        "url": "https://api.ycharts.com/v3/model_portfolios/P:1234,P:0000/points/level"
    },
    "response": {
        "P:1234": {
            "meta": {
                "status": "ok"
            },
            "results": {
                "level": {
                    "data": [
                        "2015-02-26",
                        110034.22
                    ],
                    "meta": {
                        "status": "ok"
                    }
                }
            }
        },
        "P:0000": {
            "meta": {
                "error_code": 404,
                "error_message": "Symbol Not Found.",
                "status": "error"
            }
        }
    }
}