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.
Company Data Point¶
The Company Data Point Endpoint is used to obtain a single date-value pair of data from one or more companies 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/companies/ |
Request Parameters¶
Parameter |
Required |
Description |
---|---|---|
symbol[s] |
Y |
The exchange symbol for a company, or a comma separated list of exchange symbols |
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 companies 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 company’s historical data page. For example, the price of AAPL is found at https://ycharts.com/companies/AAPL/price
Response Info¶
The response will contain one or more company objects. The key for each company object is the exchange symbol passed in the request.
Field |
Type |
Description |
---|---|---|
meta |
Meta |
This object contains information about the query for the company 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://api.ycharts.com/v3/companies/AAPL/points/price
Response
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL/points/price"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"price": {
"data": [
"2015-02-26",
130.42
],
"meta": {
"status": "ok"
}
}
}
}
}
}
The following is an example successful response with a relative date
Request URL
https://api.ycharts.com/v3/companies/AAPL/points/price?date=-44
Response
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL/points/price?date=-44"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"price": {
"data": [
"2015-01-13",
110.22
],
"meta": {
"status": "ok"
}
}
}
}
}
}
The following is an example successful request with multiple calculations
Request URL
https://api.ycharts.com/v3/companies/AAPL/points/price,pe_ratio
Response
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL/points/price,pe_ratio"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"pe_ratio": {
"data": [
"2015-02-26",
17.582143085643295
],
"meta": {
"status": "ok"
}
},
"price": {
"data": [
"2015-02-26",
130.42
],
"meta": {
"status": "ok"
}
}
}
}
}
}
The following is an example successful request with multiple companies
Request URL
https://api.ycharts.com/v3/companies/AAPL,MSFT/points/price
Response
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL,MSFT/points/price"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"price": {
"data": [
"2015-02-26",
130.42
],
"meta": {
"status": "ok"
}
}
}
},
"MSFT": {
"meta": {
"status": "ok"
},
"results": {
"price": {
"data": [
"2015-02-26",
44.05
],
"meta": {
"status": "ok"
}
}
}
}
}
}
The following is an example successful request with multiple companies, multiple calculations, and an absolute date
Request URL
https://api.ycharts.com/v3/companies/AAPL,MSFT/points/price,pe_ratio?date=2014-02-28
Respose
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL,MSFT/points/price,pe_ratio?date=2014-02-28"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"pe_ratio": {
"data": [
"2014-02-28",
13.0474
],
"meta": {
"status": "ok"
}
},
"price": {
"data": [
"2014-02-28",
75.1771
],
"meta": {
"status": "ok"
}
}
}
},
"MSFT": {
"meta": {
"status": "ok"
},
"results": {
"pe_ratio": {
"data": [
"2014-02-28",
14.1543
],
"meta": {
"status": "ok"
}
},
"price": {
"data": [
"2014-02-28",
38.31
],
"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/companies/AAPL/points/prce
Response
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL/points/prce"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"prce": {
"meta": {
"error_code": 404,
"error_message": "Calc Not Found.",
"status": "error"
}
}
}
}
}
}
The following is an example of an incorrect request, which contains an error in one of the companies
Request URL
https://api.ycharts.com/v3/companies/AAPL,BAD/points/price
Response
{
"meta": {
"status": "ok",
"url": "https://api.ycharts.com/v3/companies/AAPL,BAD/points/price"
},
"response": {
"AAPL": {
"meta": {
"status": "ok"
},
"results": {
"price": {
"data": [
"2015-02-26",
130.42
],
"meta": {
"status": "ok"
}
}
}
},
"BAD": {
"meta": {
"error_code": 404,
"error_message": "Symbol Not Found.",
"status": "error"
}
}
}
}