npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nbb-client

v0.1.0

Published

A Node.js client for the National Bank of Belgium (NBB) API with XBRL parsing and financial ratio calculation.

Readme

nbb-client

npm version License: MIT TypeScript CI

A robust, type-safe Node.js client for the National Bank of Belgium (NBB) CBSO API.

It simplifies fetching financial data, parses complex XBRL deposits into usable JSON, and automatically calculates key financial ratios (ROE, Liquidity, Solvency, etc.) with multilingual labels (EN, FR, NL).

Features

  • 🚀 Easy API: Simple getFinancials(enterpriseNumber) method.
  • 📊 Automatic Ratios: Calculates Net Profit Margin, Current Ratio, Debt-to-Equity, and more.
  • 🌍 Multilingual: Full support for English, French, and Dutch labels.
  • ⚡ Built-in Caching: File-system caching to avoid redundant API calls and rate limits.
  • 📅 Multi-Year Support: Fetch the latest year, last N years, or all available history.
  • 💾 Raw Data Mode: Option to retrieve pure XBRL data without calculations.
  • 🛠️ CLI Tool: Includes a command-line tool for quick lookups.
  • 📦 Zero Runtime Dependencies: Lightweight and fast (uses native fetch).

Installation

npm install nbb-client

Usage

Basic Usage

import { NbbClient } from 'nbb-client';

const client = new NbbClient('YOUR_NBB_SUBSCRIPTION_KEY');

async function main() {
    try {
        // Fetch latest financials for a company (e.g., 0462.925.669)
        const data = await client.getFinancials('0462925669');

        console.log(`Year: ${data.year}`);
        console.log(`Revenue: ${data.ratios.revenue.value}`);
        console.log(`Net Profit Margin: ${data.ratios.net_profit_margin.value}`);
        
        // Access multilingual labels
        console.log(data.ratios.net_profit_margin.label_en); // "Net Profit Margin"
        console.log(data.ratios.net_profit_margin.label_fr); // "Marge bénéficiaire nette"

    } catch (err) {
        console.error(err);
    }
}

main();

Caching (Optional but Recommended)

To avoid hitting NBB rate limits and speed up repeated lookups, you can optionally provide a cache implementation. We provide a simple FileSystemCache, but you can implement the ICache interface for Redis, Memcached, etc.

import { NbbClient, FileSystemCache } from 'nbb-client';

// Without cache (default)
// const client = new NbbClient('YOUR_KEY');

// With file-system cache
const client = new NbbClient('YOUR_KEY', {
    cache: new FileSystemCache('./.nbb-cache')
});

Multi-Year Retrieval

// Fetch last 3 years
const history = await client.getFinancials('0462925669', { limit: 3 });

// Fetch ALL available years
const fullHistory = await client.getFinancials('0462925669', { all: true });

Raw Data Only

If you don't need the calculated ratios:

const raw = await client.getFinancials('0462925669', { includeRatios: false });
console.log(raw.raw['70']); // Access raw XBRL rubric 70 (Turnover)

CLI Usage

You can use the client directly from your terminal:

# Fetch latest data
npx nbb-client 0462925669 --key YOUR_KEY

# Fetch last 3 years
npx nbb-client 0462925669 --limit 3 --key YOUR_KEY

# Output raw JSON
npx nbb-client 0462925669 --json --key YOUR_KEY

License

MIT