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.
Custom Security Data Point¶
The Custom Security Data Point Endpoint is used to obtain a single date-value pair of data from one or more custom securities 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 Reference Guide
Request Info¶
Request Method |
GET |
URL |
/api/v3/custom_securities/ |
Request Parameters¶
Parameter |
Required |
Description |
---|---|---|
security_id[s] |
Y |
The security id (e.g. ‘Y:1234’) for a custom security, 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 custom securities 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 custom security’s historical data page. For example, the level of custom security Y:1234 is found at https://ycharts.com/custom_securities/1234/level
Response Info¶
The response will contain one or more custom security objects. The key for each custom Security object is the security id passed in the request.
Field |
Type |
Description |
---|---|---|
meta |
Meta |
This object contains information about the query for the custom security object |
results |
Results |
This object contains one or more calculation data objects. The key for each object is the code for the calculation. |
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://ycharts.com/api/v3/custom_securities/Y:1234/points/level
Response
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234/points/level"
},
"response": {
"Y: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://ycharts.com/api/v3/custom_securities/Y:1234/points/level?date=-44
Response
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234/points/level?date=-44"
},
"response": {
"Y: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://ycharts.com/api/v3/custom_securities/Y:1234/points/level,ytd_total_return
Response
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234/points/level,ytd_total_return"
},
"response": {
"Y:1234": {
"meta": {
"status": "ok"
},
"results": {
"ytd_total_return": {
"data": [
"2015-02-26",
0.61051
],
"meta": {
"status": "ok"
}
},
"level": {
"data": [
"2015-02-26",
130697.42
],
"meta": {
"status": "ok"
}
}
}
}
}
}
The following is an example successful request with multiple custom securities
Request URL
https://ycharts.com/api/v3/custom_securities/Y:1234,Y:5678/points/level
Response
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234,Y:5678/points/level"
},
"response": {
"Y:1234": {
"meta": {
"status": "ok"
},
"results": {
"level": {
"data": [
"2015-02-26",
130697.42
],
"meta": {
"status": "ok"
}
}
}
},
"Y:5678": {
"meta": {
"status": "ok"
},
"results": {
"level": {
"data": [
"2015-02-26",
448904.05
],
"meta": {
"status": "ok"
}
}
}
}
}
}
The following is an example successful request with multiple custom securities, multiple calculations, and an absolute date
Request URL
https://ycharts.com/api/v3/custom_securities/Y:1234,Y:5678/points/level,ytd_total_return?date=2014-02-28
Respose
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234,Y:5678/points/level,ytd_total_return?date=2014-02-28"
},
"response": {
"Y:1234": {
"meta": {
"status": "ok"
},
"results": {
"ytd_total_return": {
"data": [
"2014-02-28",
0.61051
],
"meta": {
"status": "ok"
}
},
"level": {
"data": [
"2014-02-28",
110034.22
],
"meta": {
"status": "ok"
}
}
}
},
"Y:5678": {
"meta": {
"status": "ok"
},
"results": {
"ytd_total_return": {
"data": [
"2014-02-28",
0.58741
],
"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://ycharts.com/api/v3/custom_securities/Y:1234/points/levl
Response
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234/points/levl"
},
"response": {
"Y: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 custom security ‘Y:0000’ that does not exist
Request URL
https://ycharts.com/api/v3/custom_securities/Y:1234,Y:0000/points/level
Response
{
"meta": {
"status": "ok",
"url": "http://ycharts.com/api/v3/custom_securities/Y:1234,Y:0000/points/level"
},
"response": {
"Y:1234": {
"meta": {
"status": "ok"
},
"results": {
"level": {
"data": [
"2015-02-26",
110034.22
],
"meta": {
"status": "ok"
}
}
}
},
"Y:0000": {
"meta": {
"error_code": 404,
"error_message": "Symbol Not Found.",
"status": "error"
}
}
}
}