GET/companies/{ticker}/ratios

Get pre-calculated financial ratios including profitability, liquidity, leverage, and efficiency metrics. All ratios are calculated from SEC filing data.

Example Request

https://api.metricduck.com/api/v1/companies/AAPL/ratios?period=quarterly&limit=4

Path Parameters

ParameterTypeDescription
tickerrequired
stringStock ticker symbol (e.g., AAPL, MSFT, GOOGL)

Query Parameters

ParameterTypeDescription
period
stringReporting period: "quarterly" or "annual"
limit
integerNumber of periods to return (max: 100)
offset
integerNumber of periods to skip for pagination

Response

Returns company info and an array of financial ratio periods. All ratios are expressed as decimals (e.g., 0.25 = 25%).

Data Fields

FieldTypeDescription
period_end
string
End date of the reporting period (YYYY-MM-DD)
period_type
string
Period type: "quarterly" or "annual"
gross_margin
numbernullable
Gross profit / Revenue
operating_margin
numbernullable
Operating income / Revenue
net_margin
numbernullable
Net income / Revenue
roe
numbernullable
Return on equity (Net income / Shareholders' equity)
roa
numbernullable
Return on assets (Net income / Total assets)
roic
numbernullable
Return on invested capital
current_ratio
numbernullable
Current assets / Current liabilities
quick_ratio
numbernullable
(Current assets - Inventory) / Current liabilities
cash_ratio
numbernullable
Cash / Current liabilities
debt_to_equity
numbernullable
Total debt / Shareholders' equity
debt_to_assets
numbernullable
Total debt / Total assets
interest_coverage
numbernullable
EBIT / Interest expense
asset_turnover
numbernullable
Revenue / Average total assets
inventory_turnover
numbernullable
COGS / Average inventory
receivables_turnover
numbernullable
Revenue / Average accounts receivable

Example Response

{
  "company_name": "Apple Inc.",
  "ticker": "AAPL",
  "cik": "0000320193",
  "data": [
    {
      "period_end": "2024-09-30",
      "period_type": "quarterly",
      "gross_margin": 0.4464,
      "operating_margin": 0.2956,
      "net_margin": 0.1553,
      "roe": 1.0293,
      "roa": 0.0404,
      "roic": 0.5180,
      "current_ratio": 0.867,
      "quick_ratio": 0.826,
      "cash_ratio": 0.370,
      "debt_to_equity": 1.872,
      "debt_to_assets": 0.265,
      "interest_coverage": 27.24,
      "asset_turnover": 0.260,
      "inventory_turnover": 7.21,
      "receivables_turnover": 2.84
    }
  ],
  "count": 1,
  "has_more": true
}

Code Examples

Python

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://api.metricduck.com/api/v1"

# Get quarterly financial ratios
response = requests.get(
    f"{BASE_URL}/companies/AAPL/ratios",
    headers={"Authorization": f"Bearer {API_KEY}"},
    params={"period": "quarterly", "limit": 4}
)

data = response.json()
print(f"Company: {data['company_name']}")

for period in data['data']:
    print(f"\n{period['period_end']}:")
    print(f"  Gross Margin: {period['gross_margin']:.1%}")
    print(f"  Net Margin: {period['net_margin']:.1%}")
    print(f"  ROE: {period['roe']:.1%}")
    print(f"  Current Ratio: {period['current_ratio']:.2f}")

JavaScript

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://api.metricduck.com/api/v1';

// Get quarterly financial ratios
const response = await fetch(
  `${BASE_URL}/companies/AAPL/ratios?` +
  new URLSearchParams({ period: 'quarterly', limit: '4' }),
  {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  }
);

const data = await response.json();
console.log(`Company: ${data.company_name}`);

data.data.forEach(period => {
  console.log(`\n${period.period_end}:`);
  console.log(`  Gross Margin: ${(period.gross_margin * 100).toFixed(1)}%`);
  console.log(`  Net Margin: ${(period.net_margin * 100).toFixed(1)}%`);
  console.log(`  ROE: ${(period.roe * 100).toFixed(1)}%`);
  console.log(`  Current Ratio: ${period.current_ratio?.toFixed(2)}`);
});

Ratio Categories

Profitability

  • - Gross Margin, Operating Margin, Net Margin
  • - ROE, ROA, ROIC

Liquidity

  • - Current Ratio, Quick Ratio, Cash Ratio

Leverage

  • - Debt-to-Equity, Debt-to-Assets
  • - Interest Coverage

Efficiency

  • - Asset Turnover, Inventory Turnover
  • - Receivables Turnover

Notes

  • - All percentage ratios are expressed as decimals (0.25 = 25%)
  • - Ratios requiring trailing twelve months (TTM) data use rolling calculations
  • - Some ratios may be null if required data is missing
  • - ROIC uses NOPAT / Invested Capital formula