getFinancialRatios API

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.

All APIs

Contact Us to Get Access

Inputs

symbols required

A symbol or code that identifies a financial instrument.

Type
list (A comma or semi-colon delimited string.) 
Example
AAPL,GOOG 

fields optional

The fields requested.

Type
list (A comma or semi-colon delimited string.) 
Example
debtEquity,interestCoverage,bookValue,dividendPayout 

Outputs

Name / Requirement
Description
Type
symbol
always returned
A symbol or code that identifies a financial instrument.
string
A sequence of characters. (example: GOOG)
eps
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)
profitMargin
always returned
Net profit divided by revenue, expressed as a percentage.
double
A numeric type defining a number with fractional parts. (example: 2.14)
roe
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)
roa
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)
priceSales
always returned
Market capitalization divided by revenue.
double
A numeric type defining a number with fractional parts. (example: 2.14)
priceEarnings
always returned
Stock price divided by earnings per share.
double
A numeric type defining a number with fractional parts. (example: 2.14)
priceBook
always returned
Market capitalization divided by total book value.
double
A numeric type defining a number with fractional parts. (example: 2.14)
debtEquity
as requested
Total debt divided by equity.
double
A numeric type defining a number with fractional parts. (example: 2.14)
interestCoverage
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)
bookValue
as requested
Total assets less intangible assets and liabilities.
double
A numeric type defining a number with fractional parts. (example: 2.14)
dividendPayout
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)

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": 9.2,
            "profitMargin": 21.09,
            "roe": 36.29,
            "roa": 13.95,
            "priceSales": 3.87793,
            "priceEarnings": 18.82,
            "priceBook": 6.67,
            "debtEquity": 0.72517,
            "interestCoverage": 0,
            "bookValue": 25.95,
            "dividendPayout": 25.91
        },
        {
            "symbol": "GOOG",
            "eps": 29.87,
            "profitMargin": 20.09,
            "roe": 14.26,
            "roa": 11.87,
            "priceSales": 7.96221,
            "priceEarnings": 34.63,
            "priceBook": 4.58,
            "debtEquity": 0.0283,
            "interestCoverage": 0,
            "bookValue": 226.11,
            "dividendPayout": 0
        }
    ]
}

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>9.2</eps>
   <profitMargin>21.09</profitMargin>
   <roe>36.29</roe>
   <roa>13.95</roa>
   <priceSales>3.87793</priceSales>
   <priceEarnings>18.82</priceEarnings>
   <priceBook>6.67</priceBook>
   <debtEquity>0.72517</debtEquity>
   <interestCoverage>0</interestCoverage>
   <bookValue>25.95</bookValue>
   <dividendPayout>25.91</dividendPayout>
  </item>
  <item>
   <symbol>GOOG</symbol>
   <eps>29.87</eps>
   <profitMargin>20.09</profitMargin>
   <roe>14.26</roe>
   <roa>11.87</roa>
   <priceSales>7.96221</priceSales>
   <priceEarnings>34.63</priceEarnings>
   <priceBook>4.58</priceBook>
   <debtEquity>0.0283</debtEquity>
   <interestCoverage>0</interestCoverage>
   <bookValue>226.11</bookValue>
   <dividendPayout>0</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","9.2","21.09","36.29","13.95","3.87793","18.82","6.67","0.72517","0","25.95","25.91"
"GOOG","29.87","20.09","14.26","11.87","7.96221","34.63","4.58","0.0283","0","226.11","0"


PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    '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("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('AAPL,GOOG', 'debtEquity,interestCoverage,bookValue,dividendPayout');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getFinancialRatios('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: {
        symbols: 'AAPL,GOOG',
        fields: 'debtEquity,interestCoverage,bookValue,dividendPayout',
    }
)

response.body