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

@fiale-plus/treasury-cli

v0.1.0

Published

Unofficial CLI and TypeScript client for the US Treasury Fiscal Data API — designed for AI agents

Downloads

19

Readme

@fiale-plus/treasury-cli

npm version npm downloads Test License: MIT

Unofficial CLI and TypeScript client for the US Treasury Fiscal Data API — designed for AI agents.

Features

  • 14 Treasury API endpoints mapped to intuitive CLI commands
  • No API key required — Treasury Fiscal Data API is completely open
  • Zero runtime dependencies — Node 18+ native fetch and parseArgs
  • JSON output by default — structured, agent-friendly, pipe to jq
  • CSV and table formats--format csv or --format table for human workflows
  • Truncation detection — auto-adds _truncated and _next_page to JSON when results are paginated
  • TypeScript library — import TreasuryClient for programmatic use with full type safety

Quick Start

npm install -g @fiale-plus/treasury-cli

treasury debt
treasury rates --limit 20
treasury exchange --filter "country_currency_desc:eq:Canada-Dollar"
treasury cash --limit 5

No API key needed.

Installation

# Global (CLI usage)
npm install -g @fiale-plus/treasury-cli

# Local (library usage)
npm install @fiale-plus/treasury-cli

Requires Node.js >= 18.0.0.

CLI Usage

Debt Commands

treasury debt                     # Latest total public debt
treasury debt history             # Debt with date range filter
treasury debt mspd                # Monthly statement of public debt
treasury rates                    # Average interest rates on Treasury securities

Daily Treasury Statement Commands

treasury cash                     # Operating cash balance
treasury deposits                 # Deposits & withdrawals of operating cash
treasury debt-transactions        # Public debt transactions
treasury debt-limit               # Debt subject to limit
treasury tax-deposits             # Federal tax deposits
treasury refunds                  # Income tax refunds issued

Monthly Treasury Statement Commands

treasury spending                 # Monthly receipts & outlays (MTS Table 1)
treasury revenue                  # Receipts by source (MTS Table 5)

Exchange Rates

treasury exchange                 # Foreign exchange rates

Raw Query

treasury query <endpoint>         # Query any Fiscal Data endpoint

Common Options

| Flag | Description | |------|-------------| | -f, --format <json\|csv\|table> | Output format (default: json) | | --limit <n> | Max results per page | | --sort <field> | Sort field (-field for descending) | | --filter <field:op:value> | Filter expression | | --fields <field1,field2> | Comma-separated fields to return | | --page <n> | Page number | | --page-size <n> | Page size (alias for --limit) |

Filter Operators

| Operator | Description | |----------|-------------| | eq | Equal to | | lt | Less than | | lte | Less than or equal to | | gt | Greater than | | gte | Greater than or equal to | | in | In list | | range | Within range |

Example: --filter "record_date:gte:2024-01-01"

Pagination and Truncation

The API uses page-based pagination. When results span multiple pages:

  • JSON: Adds _truncated: true and _next_page fields
  • Table: Shows footer with page info
  • CSV: Adds comment header with page info

Library Usage

import { TreasuryClient } from "@fiale-plus/treasury-cli";

const treasury = new TreasuryClient();

// Get latest total public debt
const debt = await treasury.getDebtToPenny({ page_size: 1, sort: "-record_date" });
console.log(debt.data[0].tot_pub_debt_out_amt);

// Get exchange rates for Canada
const rates = await treasury.getExchangeRates({
  filter: "country_currency_desc:eq:Canada-Dollar",
  sort: "-record_date",
  page_size: 5,
});
console.log(rates.data);

// Query any endpoint
const custom = await treasury.query("v1/accounting/dts/operating_cash_balance", {
  page_size: 10,
});
console.log(custom.data);

All endpoints are available as typed methods on TreasuryClient.

Development

git clone https://github.com/fiale-plus/treasury-cli.git
cd treasury-cli
npm install
npm run build
npm test

# Dev mode (runs TypeScript directly)
npm run dev -- debt
npm run dev -- exchange --limit 5

# Integration tests (no API key needed)
npm run test:integration

Disclaimer

This is an unofficial, community-maintained tool. It is not affiliated with, endorsed by, or connected to the US Department of the Treasury, the Bureau of the Fiscal Service, or any government entity.

This tool accesses the publicly available Treasury Fiscal Data API. Data retrieved through this tool is sourced from the US Treasury and is provided for informational purposes only. It should not be used as the sole basis for financial decisions. Always verify data against official sources.

This software is provided "AS IS" under the MIT License, without warranty of any kind.

Links

License

MIT