My Review of Company Financial Statements API

·

8 min read

My goal is to bind my investment choices with data. Making a choice based on data is obviously a better choice than hearsay or trusting a consultant and spending money along the way. When choosing which company to invest in next, I tried building some algorithms to analyze the performance of the company, using this company financial statements API. Hope you find this inspiring and build an even better analysis than mine :)


First, Cash Flow API

Cash flow statements show the flow of money in and out of the company in the most basic words. The reason why I used cash flow API is that it fetches complete CF statement data, value by value, which I can implement into the analysis. Operations, investing and financing data can be acquired using this API for the latest period as well as historical. Obviously, I’m making use of the historical data more to see the performance over time while ruling out options without a positive cash flow.

DISCLAIMER: I’m focusing on US stocks only and my experience with the cash flow API is limited to these only. I’m not sure about the coverage for other regions. Better ask the company Finnworlds.

Example Output

https://api.finnworlds.com/api/v1/cashflows?key=APIKEY&ticker=AAPL&type=quarter&date_from=2021-11-31&date_to=2023-11-01

{
    "status": {
        "code": 200,
        "message": "OK",
        "details": ""
    },
    "result": {
        "basics": {
            "ticker": "AAPL",
            "period": "quarterly"
        },
        "output": {
            "cash_flow": [
                {
                    "date": "2023-09-30",
                    "beginning_cash_position": "29898000000",
                    "capital_expenditure": "-2163000000",
                    "cash_dividends_paid": "-3758000000",
                    "cash_flow_from_continuing_financing_activities": "-23153000000",
                    "cash_flow_from_continuing_investing_activities": "2394000000",
                    "cash_flow_from_continuing_operating_activities": "21598000000",
                    "change_in_account_payable": "14901000000",
                    "change_in_inventory": "952000000",
                    "change_in_other_current_assets": "-821000000",
                    "change_in_other_current_liabilities": "45000000",
                    "change_in_payable": "14901000000",
                    "change_in_payables_and_accrued_expense": "14901000000",
                    "change_in_receivables": "-21137000000",
                    "change_in_working_capital": "-6060000000",
                    "changes_in_account_receivables": "-9297000000",
                    "changes_in_cash": "839000000",
                    "common_stock_dividend_paid": "-3758000000",
                    "common_stock_payments": "-21003000000",
                    "depreciation_amortization_depletion": "2653000000",
                    "depreciation_and_amortization": "2653000000",
                    "end_cash_position": "30737000000",
                    "financing_cash_flow": "-23153000000",
                    "free_cash_flow": "19435000000",
                    "income_tax_paid_supplemental_data": "11659000000",
                    "interest_paid_supplemental_data": "1213000000",
                    "investing_cash_flow": "2394000000",
                    "issuance_of_debt": "0",
                    "long_term_debt_issuance": "0",
                    "long_term_debt_payments": "0",
                    "net_common_stock_issuance": "-21003000000",
                    "net_income_from_continuing_operations": "22956000000",
                    "net_investment_purchase_and_sale": "5141000000",
                    "net_issuance_payments_of_debt": "1993000000",
                    "net_long_term_debt_issuance": "0",
                    "net_other_financing_charges": "-385000000",
                    "net_other_investing_changes": "-584000000",
                    "net_ppepurchase_and_sale": "-2163000000",
                    "net_short_term_debt_issuance": "1993000000",
                    "operating_cash_flow": "21598000000",
                    "other_non_cash_items": "-576000000",
                    "purchase_of_investment": "-8557000000",
                    "purchase_of_ppe": "-2163000000",
                    "repayment_of_debt": "0",
                    "repurchase_of_capital_stock": "-21003000000",
                    "sale_of_investment": "13698000000",
                    "stock_based_compensation": "2625000000"
                },
….
…..
….
….
                {
                    "date": "2022-09-30",
                    "beginning_cash_position": "28861000000",
                    "capital_expenditure": "-3289000000",
                    "cash_dividends_paid": "-3703000000",
                    "cash_flow_from_continuing_financing_activities": "-26794000000",
                    "cash_flow_from_continuing_investing_activities": "-1217000000",
                    "cash_flow_from_continuing_operating_activities": "24127000000",
                    "change_in_account_payable": "15556000000",
                    "change_in_inventory": "435000000",
                    "change_in_other_current_assets": "-3210000000",
                    "change_in_other_current_liabilities": "5646000000",
                    "change_in_other_working_capital": "218000000",
                    "change_in_payable": "15556000000",
                    "change_in_payables_and_accrued_expense": "15556000000",
                    "change_in_receivables": "-18693000000",
                    "change_in_working_capital": "-48000000",
                    "changes_in_account_receivables": "-6384000000",
                    "changes_in_cash": "-3884000000",
                    "common_stock_dividend_paid": "-3703000000",
                    "common_stock_payments": "-24428000000",
                    "deferred_income_tax": "-1861000000",
                    "deferred_tax": "-1861000000",
                    "depreciation_amortization_depletion": "2865000000",
                    "depreciation_and_amortization": "2865000000",
                    "end_cash_position": "24977000000",
                    "financing_cash_flow": "-26794000000",
                    "free_cash_flow": "20838000000",
                    "income_tax_paid_supplemental_data": "7322000000",
                    "interest_paid_supplemental_data": "955000000",
                    "investing_cash_flow": "-1217000000",
                    "issuance_of_debt": "4450000000",
                    "long_term_debt_issuance": "5465000000",
                    "long_term_debt_payments": "-2793000000",
                    "net_business_purchase_and_sale": "-137000000",
                    "net_common_stock_issuance": "-24428000000",
                    "net_income_from_continuing_operations": "20721000000",
                    "net_investment_purchase_and_sale": "2806000000",
                    "net_issuance_payments_of_debt": "1657000000",
                    "net_long_term_debt_issuance": "2672000000",
                    "net_other_financing_charges": "-320000000",
                    "net_other_investing_changes": "-597000000",
                    "net_ppepurchase_and_sale": "-3289000000",
                    "net_short_term_debt_issuance": "-1015000000",
                    "operating_cash_flow": "24127000000",
                    "other_non_cash_items": "172000000",
                    "purchase_of_business": "-137000000",
                    "purchase_of_investment": "-6745000000",
                    "purchase_of_ppe": "-3289000000",
                    "repayment_of_debt": "-2793000000",
                    "repurchase_of_capital_stock": "-24428000000",
                    "sale_of_investment": "9551000000",
                    "short_term_debt_issuance": "-1015000000",
                    "stock_based_compensation": "2278000000"
                }
            ]
        }
    }
}

NodeJS Code Snippet for Retrieving Cash Flow Data

const https = require('https');

// Replace 'YOUR_API_KEY' with your actual API key
const apiKey = 'YOUR_API_KEY';
const url = `https://api.finnworlds.com/api/v1/cashflows?key=${apiKey}&ticker=AAPL&type=quarter&date_from=2021-11-31&date_to=2023-11-01`;

https.get(url, (res) => {
    let data = '';

    // A chunk of data has been received.
    res.on('data', (chunk) => {
        data += chunk;
    });

    // The whole response has been received. Print out the result.
    res.on('end', () => {
        console.log(JSON.parse(data));
    });

}).on("error", (err) => {
    console.log("Error: " + err.message);
});

Snippet for Parsing and Displaying Specific Cash Flow Data

https.get(url, (res) => {
    let data = '';

    res.on('data', (chunk) => {
        data += chunk;
    });

    res.on('end', () => {
        const parsedData = JSON.parse(data);
        const cashFlows = parsedData.result.output.cash_flow;

        cashFlows.forEach((item) => {
            console.log(`Date: ${item.date}`);
            console.log(`Net Income: ${item.net_income_from_continuing_operations}`);
            console.log(`Operating Cash Flow: ${item.operating_cash_flow}`);
            console.log(`Capital Expenditure: ${item.capital_expenditure}`);
            console.log(`Free Cash Flow: ${item.free_cash_flow}`);
            console.log('---------------------------');
        });
    });

}).on("error", (err) => {
    console.log("Error: " + err.message);
});

NOTE: I’ve picked some of the more useful fields from the cash flow data array that I use but feel free to focus on other fields using this snippet as an example.


Second, Balance Sheets API

Balance sheets are the second statement type of the holy trinity, giving insight into the company’s financial health. This includes indicting the current assets, liabilities, shareholder equity which will give you the company’s liquidity, obligation performance, debt level, ROI. In short, balance sheet data IMO is essential for risk assessment.

Example Output

https://api.finnworlds.com/api/v1/balancesheets?key=APIKEY&ticker=AAPL&type=quarter&date_from=2022-09-01&date_to=2023-11-01

{
    "status": {
        "code": 200,
        "message": "OK",
        "details": ""
    },
    "result": {
        "basics": {
            "ticker": "AAPL",
            "period": "quarterly"
        },
        "output": {
            "balance_sheet": [
                {
                    "date": "2023-09-30",
                    "accounts_payable": "62611000000",
                    "accounts_receivable": "29508000000",
                    "available_for_sale_securities": "100544000000",
                    "capital_stock": "73812000000",
                    "cash_and_cash_equivalents": "29965000000",
                    "cash_cash_equivalents_and_short_term_investments": "61555000000",
                    "commercial_paper": "5985000000",
                    "common_stock": "73812000000",
                    "common_stock_equity": "62146000000",
                    "current_assets": "143566000000",
                    "current_debt": "15807000000",
                    "current_debt_and_capital_lease_obligation": "15807000000",
                    "current_deferred_liabilities": "8061000000",
                    "current_deferred_revenue": "8061000000",
                    "current_liabilities": "145308000000",
                    "gains_losses_not_affecting_retained_earnings": "-11452000000",
                    "inventory": "6331000000",
                    "invested_capital": "173234000000",
                    "investmentin_financial_assets": "100544000000",
                    "investments_and_advances": "100544000000",
                    "long_term_debt": "95281000000",
                    "long_term_debt_and_capital_lease_obligation": "95281000000",
                    "net_debt": "81123000000",
                    "net_ppe": "43715000000",
                    "net_tangible_assets": "62146000000",
                    "ordinary_shares_number": "15550061000",
                    "other_current_assets": "14695000000",
                    "other_current_borrowings": "9822000000",
                    "other_current_liabilities": "58829000000",
                    "other_equity_adjustments": "-11452000000",
                    "other_non_current_assets": "64758000000",
                    "other_non_current_liabilities": "49848000000",
                    "other_receivables": "31477000000",
                    "other_short_term_investments": "31590000000",
                    "payables": "62611000000",
                    "payables_and_accrued_expenses": "62611000000",
                    "receivables": "60985000000",
                    "retained_earnings": "-214000000",
                    "share_issued": "15550061000",
                    "stockholders_equity": "62146000000",
                    "tangible_book_value": "62146000000",
                    "total_assets": "352583000000",
                    "total_capitalization": "157427000000",
                    "total_debt": "111088000000",
                    "total_equity_gross_minority_interest": "62146000000",
                    "total_liabilities_net_minority_interest": "290437000000",
                    "total_non_current_assets": "209017000000",
                    "total_non_current_liabilities_net_minority_interest": "145129000000",
                    "treasury_shares_number": "0",
                    "working_capital": "-1742000000"
                },
…..
…..
…..                {
                    "date": "2022-09-30",
                    "accounts_payable": "64115000000",
                    "accounts_receivable": "28184000000",
                    "accumulated_depreciation": "-72340000000",
                    "available_for_sale_securities": "120805000000",
                    "capital_stock": "64849000000",
                    "cash_and_cash_equivalents": "23646000000",
                    "cash_cash_equivalents_and_short_term_investments": "48304000000",
                    "cash_equivalents": "5100000000",
                    "cash_financial": "18546000000",
                    "commercial_paper": "9982000000",
                    "common_stock": "64849000000",
                    "common_stock_equity": "50672000000",
                    "current_assets": "135405000000",
                    "current_debt": "21110000000",
                    "current_debt_and_capital_lease_obligation": "21110000000",
                    "current_deferred_liabilities": "7912000000",
                    "current_deferred_revenue": "7912000000",
                    "current_liabilities": "153982000000",
                    "gains_losses_not_affecting_retained_earnings": "-11109000000",
                    "gross_ppe": "114457000000",
                    "inventory": "4946000000",
                    "invested_capital": "170741000000",
                    "investmentin_financial_assets": "120805000000",
                    "investments_and_advances": "120805000000",
                    "land_and_improvements": "22126000000",
                    "leases": "11271000000",
                    "long_term_debt": "98959000000",
                    "long_term_debt_and_capital_lease_obligation": "98959000000",
                    "machinery_furniture_equipment": "81060000000",
                    "net_debt": "96423000000",
                    "net_ppe": "42117000000",
                    "net_tangible_assets": "50672000000",
                    "ordinary_shares_number": "15943425000",
                    "other_current_assets": "21223000000",
                    "other_current_borrowings": "11128000000",
                    "other_current_liabilities": "60845000000",
                    "other_investments": "120805000000",
                    "other_non_current_assets": "54428000000",
                    "other_non_current_liabilities": "49142000000",
                    "other_receivables": "32748000000",
                    "other_short_term_investments": "24658000000",
                    "payables": "64115000000",
                    "payables_and_accrued_expenses": "64115000000",
                    "properties": "0",
                    "receivables": "60932000000",
                    "retained_earnings": "-3068000000",
                    "share_issued": "15943425000",
                    "stockholders_equity": "50672000000",
                    "tangible_book_value": "50672000000",
                    "total_assets": "352755000000",
                    "total_capitalization": "149631000000",
                    "total_debt": "120069000000",
                    "total_equity_gross_minority_interest": "50672000000",
                    "total_liabilities_net_minority_interest": "302083000000",
                    "total_non_current_assets": "217350000000",
                    "total_non_current_liabilities_net_minority_interest": "148101000000",
                    "tradeand_other_payables_non_current": "16657000000",
                    "working_capital": "-18577000000"
                }
            ]
        }
    }
}

JS Snippet For Getting Balance Sheet Data

const https = require('https');

// Replace 'YOUR_API_KEY' with your actual API key
const apiKey = 'YOUR_API_KEY';
const url = `https://api.finnworlds.com/api/v1/balancesheets?key=${apiKey}&ticker=AAPL&type=quarter&date_from=2022-09-01&date_to=2023-11-01`;

https.get(url, (res) => {
    let data = '';

    // A chunk of data has been received.
    res.on('data', (chunk) => {
        data += chunk;
    });

    // The whole response has been received. Print out the result.
    res.on('end', () => {
        try {
            const parsedData = JSON.parse(data);
            console.log(parsedData);
        } catch (e) {
            console.error(e.message);
        }
    });

}).on("error", (err) => {
    console.error("Error: " + err.message);
});

Parsing the Balance Sheet Data

This extracts the balance_sheet array from the response, iterates over each entry in the array. It also logs key info such as the date, total assets, total liabilities, and total equity from the balance sheet API output. This is of course an example, feel free to focus on values that you think matter the most.

const https = require('https');

// Replace 'YOUR_API_KEY' with your actual API key
const apiKey = 'YOUR_API_KEY';
const url = `https://api.finnworlds.com/api/v1/balancesheets?key=${apiKey}&ticker=AAPL&type=quarter&date_from=2022-09-01&date_to=2023-11-01`;

https.get(url, (res) => {
    let data = '';

    res.on('data', (chunk) => {
        data += chunk;
    });

    res.on('end', () => {
        try {
            const parsedData = JSON.parse(data);
            const balanceSheets = parsedData.result.output.balance_sheet;

            // Function to process and display each balance sheet entry
            balanceSheets.forEach(entry => {
                console.log(`Date: ${entry.date}`);
                console.log(`Total Assets: ${entry.total_assets}`);
                console.log(`Total Liabilities: ${entry.total_liabilities_net_minority_interest}`);
                console.log(`Total Equity: ${entry.stockholders_equity}`);
                console.log('----------------------------------');
            });
        } catch (e) {
            console.error(e.message);
        }
    });

}).on("error", (err) => {
    console.error("Error: " + err.message);
});

Third, Income Statement API

Finally. This is becoming another long post but we can’t forget the final leg of the holy trinity of statements. I can collect necessary info about the company’s based on the income statement data. Three key words would be revenue, expenses, gains and losses. This will help you see how well a company is managing it’s operations and what to expect if you choose to invest in it.

Example Output

https://api.finnworlds.com/api/v1/incomestatements?key=APIKEY&ticker=AAPL&type=quarter&date_from=2023-01-01&date_to=2023-11-01

{
    "status": {
        "code": 200,
        "message": "OK",
        "details": ""
    },
    "result": {
        "basics": {
            "ticker": "AAPL",
            "period": "quarterly"
        },
        "output": {
            "income_statement": [
                {
                    "date": "2023-09-30",
                    "basic_average_shares": "15599434000",
                    "basic_eps": "1.47",
                    "cost_of_revenue": "49071000000",
                    "diluted_average_shares": "15672400000",
                    "diluted_eps": "1.46",
                    "diluted_niavailto_com_stockholders": "22956000000",
                    "ebit": "26969000000",
                    "ebitda": "29622000000",
                    "gross_profit": "40427000000",
                    "net_income": "22956000000",
                    "net_income_common_stockholders": "22956000000",
                    "net_income_continuous_operations": "22956000000",
                    "net_income_from_continuing_and_discontinued_operation": "22956000000",
                    "net_income_from_continuing_operation_net_minority_interest": "22956000000",
                    "net_income_including_noncontrolling_interests": "22956000000",
                    "normalized_ebitda": "29622000000",
                    "normalized_income": "22956000000",
                    "operating_expense": "13458000000",
                    "operating_income": "26969000000",
                    "operating_revenue": "89498000000",
                    "other_income_expense": "29000000",
                    "other_non_operating_income_expenses": "29000000",
                    "pretax_income": "26998000000",
                    "reconciled_cost_of_revenue": "49071000000",
                    "reconciled_depreciation": "2653000000",
                    "research_and_development": "7307000000",
                    "selling_general_and_administration": "6151000000",
                    "tax_effect_of_unusual_items": "0",
                    "tax_provision": "4042000000",
                    "tax_rate_for_calcs": "0.149715",
                    "total_expenses": "62529000000",
                    "total_operating_income_as_reported": "26969000000",
                    "total_revenue": "89498000000"
                },
…
…
…
                {
                    "date": "2023-03-31",
                    "basic_average_shares": "15787154000",
                    "basic_eps": "1.53",
                    "cost_of_revenue": "52860000000",
                    "diluted_average_shares": "15847050000",
                    "diluted_eps": "1.52",
                    "diluted_niavailto_com_stockholders": "24160000000",
                    "ebit": "28318000000",
                    "ebitda": "31216000000",
                    "gross_profit": "41976000000",
                    "interest_expense": "930000000",
                    "interest_expense_non_operating": "930000000",
                    "interest_income": "918000000",
                    "interest_income_non_operating": "918000000",
                    "net_income": "24160000000",
                    "net_income_common_stockholders": "24160000000",
                    "net_income_continuous_operations": "24160000000",
                    "net_income_from_continuing_and_discontinued_operation": "24160000000",
                    "net_income_from_continuing_operation_net_minority_interest": "24160000000",
                    "net_income_including_noncontrolling_interests": "24160000000",
                    "net_interest_income": "-12000000",
                    "net_non_operating_interest_income_expense": "-12000000",
                    "normalized_ebitda": "31216000000",
                    "normalized_income": "24160000000",
                    "operating_expense": "13658000000",
                    "operating_income": "28318000000",
                    "operating_revenue": "94836000000",
                    "other_income_expense": "64000000",
                    "other_non_operating_income_expenses": "64000000",
                    "pretax_income": "28382000000",
                    "reconciled_cost_of_revenue": "52860000000",
                    "reconciled_depreciation": "2898000000",
                    "research_and_development": "7457000000",
                    "selling_general_and_administration": "6201000000",
                    "tax_effect_of_unusual_items": "0",
                    "tax_provision": "4222000000",
                    "tax_rate_for_calcs": "0.148756",
                    "total_expenses": "66518000000",
                    "total_operating_income_as_reported": "28318000000",
                    "total_revenue": "94836000000"
                }
            ]
        }
    }
}

Fetching the Income Statement Data

(Axios library as the others, npm used fetching income statements data). Here’s the nodejs code:

const axios = require('axios');

async function getIncomeStatementData() {
    const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key
    const url = `https://api.finnworlds.com/api/v1/incomestatements?key=${apiKey}&ticker=AAPL&type=quarter&date_from=2023-01-01&date_to=2023-11-01`;

    try {
        const response = await axios.get(url);
        console.log('Income Statement Data:', response.data);
    } catch (error) {
        console.error('Error fetching data:', error);
    }
}

getIncomeStatementData();

Parsing the Income Statements API Output

NOTE: I’ve used date, net income, gross profit values just as examples. You should probably focus on other and more valuable details in the income statements API output.

function displaySpecificData(data) {
    if (data.result && data.result.output && data.result.output.income_statement) {
        data.result.output.income_statement.forEach(statement => {
            console.log(`Date: ${statement.date}`);
            console.log(`Net Income: ${statement.net_income}`);
            console.log(`Gross Profit: ${statement.gross_profit}`);
            // Add more fields as required
            console.log('---------------------------------');
        });
    } else {
        console.log('No income statement data found.');
    }
}

// Modify the getIncomeStatementData function to use displaySpecificData
async function getIncomeStatementData() {
    // ... existing code ...

    try {
        const response = await axios.get(url);
        displaySpecificData(response.data);
    } catch (error) {
        console.error('Error fetching data:', error);
    }
}

getIncomeStatementData();

TIP: As this is just a sneak peek for the financial statements data, you should refer to the API provider Finnworlds’ documentation for all the specifications there are.


That’s It for the Financial Statements API!

This has been another long post because financial statements data comes in 3 key reports and I had to cover them all. This financial statements API has been pretty useful for me as it doesn’t just provide a link to the reports but the full content within them. This way, you can get cash flow, balance sheet and income statement data content (for the latest and historical reports) all under one API which is pretty cool.

Still, I have to admit that my analysis skills can be better. Happy to exchange ideas with fellow investors/developers!