Stock Financial Ratios API
getFinancialRatios
The getFinancialRatios API provides key financial ratios for equities based on symbol. The fields include earnings per share, return on equity and price to earnings. Up to 8 years of financial ratios can be provided. This data can be used to asses a company's financial status and make informed decisions.
View All APIsContact Us to Get Access
Inputs
symbolsrequired
A symbol or code that identifies a financial instrument.
Type
list (A comma or semi-colon delimited string.)
Example
AAPL,GOOG
fieldsoptional
The fields requested.
Type
list (A comma or semi-colon delimited string.)
Example
debtEquity,interestCoverage,bookValue,dividendPayout
Outputs
symbol
always returned
always returned
A symbol or code that identifies a financial instrument.
string
A sequence of characters. (example: GOOG)
A sequence of characters. (example: GOOG)
eps
always returned
always returned
Earnings per share, calculated by dividing the total net income by the company's outstanding shares.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
profitMargin
always returned
always returned
Net profit divided by revenue, expressed as a percentage.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
roe
always returned
always returned
Net income divided by shareholder equity, expressed as a percentage.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
roa
always returned
always returned
Net income divided by total assets, expressed as a percentage.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
priceSales
always returned
always returned
Market capitalization divided by revenue.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
priceEarnings
always returned
always returned
Stock price divided by earnings per share.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
priceBook
always returned
always returned
Market capitalization divided by total book value.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
debtEquity
as requested
as requested
Total debt divided by equity.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
interestCoverage
as requested
as requested
A measurement of a company's ability to pay interest on outstanding debt.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
bookValue
as requested
as requested
Total assets less intangible assets and liabilities.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
dividendPayout
as requested
as requested
The percentage of net income a firm pays to its shareholders as dividends.
double
A numeric type defining a number with fractional parts. (example: 2.14)
A numeric type defining a number with fractional parts. (example: 2.14)
Status Code Responses
200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.
JSON
GET
GET https://ondemand.websol.barchart.com/getFinancialRatios.json?apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=debtEquity%2CinterestCoverage%2CbookValue%2CdividendPayout
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getFinancialRatios.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=debtEquity%2CinterestCoverage%2CbookValue%2CdividendPayout
Response
{
"status": {
"code": 200,
"message": "Success."
},
"results": [
{
"symbol": "AAPL",
"eps": 6.75,
"profitMargin": 23.97,
"roe": 152.94,
"roa": 29.98,
"priceSales": 8.81432,
"priceEarnings": 33.78,
"priceBook": 51.57,
"debtEquity": 1.87,
"interestCoverage": 5.73,
"bookValue": 3.77,
"dividendPayout": 14.39
},
{
"symbol": "GOOG",
"eps": 7.54,
"profitMargin": 27.74,
"roe": 31.66,
"roa": 22.79,
"priceSales": 7.0405,
"priceEarnings": 23.45,
"priceBook": 5.25,
"debtEquity": 0.04,
"interestCoverage": 2.93,
"bookValue": 25.66,
"dividendPayout": 5.21
}
]
}
XML
GET
GET https://ondemand.websol.barchart.com/getFinancialRatios.xml?apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=debtEquity%2CinterestCoverage%2CbookValue%2CdividendPayout
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getFinancialRatios.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=debtEquity%2CinterestCoverage%2CbookValue%2CdividendPayout
Response
<?xml version="1.0" encoding="utf-8"?>
<getFinancialRatios>
<status>
<code>200</code>
<message>Success.</message>
</status>
<item>
<symbol>AAPL</symbol>
<eps>6.75</eps>
<profitMargin>23.97</profitMargin>
<roe>152.94</roe>
<roa>29.98</roa>
<priceSales>8.81432</priceSales>
<priceEarnings>33.78</priceEarnings>
<priceBook>51.57</priceBook>
<debtEquity>1.87</debtEquity>
<interestCoverage>5.73</interestCoverage>
<bookValue>3.77</bookValue>
<dividendPayout>14.39</dividendPayout>
</item>
<item>
<symbol>GOOG</symbol>
<eps>7.54</eps>
<profitMargin>27.74</profitMargin>
<roe>31.66</roe>
<roa>22.79</roa>
<priceSales>7.0405</priceSales>
<priceEarnings>23.45</priceEarnings>
<priceBook>5.25</priceBook>
<debtEquity>0.04</debtEquity>
<interestCoverage>2.93</interestCoverage>
<bookValue>25.66</bookValue>
<dividendPayout>5.21</dividendPayout>
</item>
</getFinancialRatios>
CSV
GET
GET https://ondemand.websol.barchart.com/getFinancialRatios.csv?apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=debtEquity%2CinterestCoverage%2CbookValue%2CdividendPayout
Host: ondemand.websol.barchart.com
POST
POST https://ondemand.websol.barchart.com/getFinancialRatios.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
apikey=YOUR_API_KEY&symbols=AAPL%2CGOOG&fields=debtEquity%2CinterestCoverage%2CbookValue%2CdividendPayout
Response
symbol,eps,profitMargin,roe,roa,priceSales,priceEarnings,priceBook,debtEquity,interestCoverage,bookValue,dividendPayout
"AAPL","6.75","23.97","152.94","29.98","8.81432","33.78","51.57","1.87","5.73","3.77","14.39"
"GOOG","7.54","27.74","31.66","22.79","7.0405","23.45","5.25","0.04","2.93","25.66","5.21"
PHP
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbols' => 'AAPL,GOOG',
'fields' => 'debtEquity,interestCoverage,bookValue,dividendPayout',
];
$result = $ondemand->getFinancialRatios($params);
var_dump($result);
Classic ASP
Dim ondemand
Dim result
Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")
Set result = ondemand.getFinancialRatios("YOUR_API_KEY", "AAPL,GOOG", "debtEquity,interestCoverage,bookValue,dividendPayout")
Perl
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getFinancialRatios('YOUR_API_KEY', 'AAPL,GOOG', 'debtEquity,interestCoverage,bookValue,dividendPayout');
print $result;
Python
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getFinancialRatios('YOUR_API_KEY', 'AAPL,GOOG', 'debtEquity,interestCoverage,bookValue,dividendPayout')
print(result)
Ruby
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getFinancialRatios,
message: {
apikey: 'YOUR_API_KEY',
symbols: 'AAPL,GOOG',
fields: 'debtEquity,interestCoverage,bookValue,dividendPayout',
}
)
response.body