Skill Tracer
Skills › Scientific Agent Skills › usfiscaldata

usfiscaldata

skill · 205 lines · MIT · skills/usfiscaldata/SKILL.md

The facts

Its description

Queries the U.S. Treasury Fiscal Data REST API for federal financial data. No API key required. Use for national debt (Debt to the Penny), Daily Treasury Statements, Monthly Treasury Statements, Treasury securities auctions, interest rates, foreign exchange rates, savings bonds, or U.S. government revenue and spending statistics.

The description the agent reads to decide when to use it.

From its settingsline 3

Tools it may use, or may not

allowed-tools: Read Write Edit Bash

Tools it may use while it runs without asking you first.

From its settingsline 6

Files it mentions

references/datasets-fiscal.md, references/parameters.md, references/api-basics.md, references/datasets-debt.md (first 5 of 10 lines)

Files the text names, such as ones to read or write. Found by matching words, so treat them as pointers.

Found by matching wordsline 95 line 145 line 181 line 182 line 183

Licence

MIT, from the skill file

The terms its author shares it under, which let it be shown here.

From its settingsline 4 licence text

Other settings

compatibility: Requires Python 3.10+ with requests and pandas for Python examples; R with httr and jsonlite for R examples. Requires network access; no credentials. metadata: version: "1.5" last-reviewed: "2026-09-30" skill-author: K-Dense Inc.

More settings at the top of the file, shown as written.

From its settingsline 5 line 7
Other files in this skill (8) Close

The text

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1---
2name: usfiscaldata
3description: Queries the U.S. Treasury Fiscal Data REST API for federal financial data. No API key required. Use for national debt (Debt to the Penny), Daily Treasury Statements, Monthly Treasury Statements, Treasury securities auctions, interest rates, foreign exchange rates, savings bonds, or U.S. government revenue and spending statistics.
4license: MIT
5compatibility: Requires Python 3.10+ with requests and pandas for Python examples; R with httr and jsonlite for R examples. Requires network access; no credentials.
6allowed-tools: Read Write Edit Bash
7metadata:
8 version: "1.5"
9 last-reviewed: "2026-09-30"
10 skill-author: K-Dense Inc.
11---
13# U.S. Treasury Fiscal Data API
15Free, open REST API from the U.S. Department of the Treasury for federal financial data. No API key or registration required.
17**Base URL:** `https://api.fiscaldata.treasury.gov/services/api/fiscal_service`
19Browse [the current dataset catalog](https://fiscaldata.treasury.gov/datasets/) via the dataset search. Verify endpoint paths on each dataset's API Quick Guide — paths change over time.

U.S. Treasury Fiscal Data API

Free, open REST API from the U.S. Department of the Treasury for federal financial data. No API key or registration required.

Base URL: https://api.fiscaldata.treasury.gov/services/api/fiscal_service

Browse the current dataset catalog via the dataset search. Verify endpoint paths on each dataset's API Quick Guide — paths change over time.

Raw lines 1 to 20
21## Installation
23```bash
24uv pip install requests pandas
25```

Installation

uv pip install requests pandas
Raw lines 21 to 26
27## Quick Start
29```python
30import requests
31import pandas as pd
33BASE_URL = "https://api.fiscaldata.treasury.gov/services/api/fiscal_service"
35# Get the current national debt (Debt to the Penny)
36resp = requests.get(f"{BASE_URL}/v2/accounting/od/debt_to_penny", params={
37 "sort": "-record_date",
38 "page[size]": 1
39}, timeout=30)
40resp.raise_for_status()
41data = resp.json()["data"][0]
42print(f"Total public debt as of {data['record_date']}: ${float(data['tot_pub_debt_out_amt']):,.0f}")
43```
45```python
46# Preview Treasury exchange-rate rows for recent quarters (first page only)
47resp = requests.get(f"{BASE_URL}/v1/accounting/od/rates_of_exchange", params={
48 "fields": "country_currency_desc,exchange_rate,record_date,effective_date",
49 "filter": "record_date:gte:2024-01-01",
50 "sort": "-record_date",
51 "page[size]": 100
52}, timeout=30)
53resp.raise_for_status()
54df = pd.DataFrame(resp.json()["data"])
55```

Quick Start

import requests
import pandas as pd

BASE_URL = "https://api.fiscaldata.treasury.gov/services/api/fiscal_service"

# Get the current national debt (Debt to the Penny)
resp = requests.get(f"{BASE_URL}/v2/accounting/od/debt_to_penny", params={
    "sort": "-record_date",
    "page[size]": 1
}, timeout=30)
resp.raise_for_status()
data = resp.json()["data"][0]
print(f"Total public debt as of {data['record_date']}: ${float(data['tot_pub_debt_out_amt']):,.0f}")
# Preview Treasury exchange-rate rows for recent quarters (first page only)
resp = requests.get(f"{BASE_URL}/v1/accounting/od/rates_of_exchange", params={
    "fields": "country_currency_desc,exchange_rate,record_date,effective_date",
    "filter": "record_date:gte:2024-01-01",
    "sort": "-record_date",
    "page[size]": 100
}, timeout=30)
resp.raise_for_status()
df = pd.DataFrame(resp.json()["data"])
Raw lines 27 to 56
57## Authentication
59None required. The API is fully open and free.

Authentication

None required. The API is fully open and free.

Raw lines 57 to 60
61## Core Parameters
63| Parameter | Example | Description |
64|-----------|---------|-------------|
65| `fields=` | `fields=record_date,tot_pub_debt_out_amt` | Select specific columns |
66| `filter=` | `filter=record_date:gte:2024-01-01` | Filter records |
67| `sort=` | `sort=-record_date` | Sort (prefix `-` for descending) |
68| `format=` | `format=json` | Output format: `json`, `csv`, `xml` |
69| `page[size]=` | `page[size]=100` | Records per page (default 100) |
70| `page[number]=` | `page[number]=2` | Page index (starts at 1) |
72**Filter operators:** `lt`, `lte`, `gt`, `gte`, `eq`, `in`
74```python
75# Multiple filters separated by comma
76"filter=country_currency_desc:in:(Canada-Dollar,Mexico-Peso),record_date:gte:2024-01-01"
77```

Core Parameters

ParameterExampleDescription
fields=fields=record_date,tot_pub_debt_out_amtSelect specific columns
filter=filter=record_date:gte:2024-01-01Filter records
sort=sort=-record_dateSort (prefix - for descending)
format=format=jsonOutput format: json, csv, xml
page[size]=page[size]=100Records per page (default 100)
page[number]=page[number]=2Page index (starts at 1)

Filter operators: lt, lte, gt, gte, eq, in

# Multiple filters separated by comma
"filter=country_currency_desc:in:(Canada-Dollar,Mexico-Peso),record_date:gte:2024-01-01"
Raw lines 61 to 78
79## Key Datasets & Endpoints

Key Datasets & Endpoints

Raw lines 79 to 80
81### Debt
83| Dataset | Endpoint | Frequency |
84|---------|----------|-----------|
85| Debt to the Penny | `/v2/accounting/od/debt_to_penny` | Daily |
86| Historical Debt Outstanding | `/v2/accounting/od/debt_outstanding` | Annual |
87| Schedules of Federal Debt | `/v1/accounting/od/schedules_fed_debt` | Monthly |

Debt

DatasetEndpointFrequency
Debt to the Penny/v2/accounting/od/debt_to_pennyDaily
Historical Debt Outstanding/v2/accounting/od/debt_outstandingAnnual
Schedules of Federal Debt/v1/accounting/od/schedules_fed_debtMonthly
Raw lines 81 to 88
89### Daily & Monthly Statements
91| Dataset | Endpoint | Frequency |
92|---------|----------|-----------|
93| DTS Operating Cash Balance | `/v1/accounting/dts/operating_cash_balance` | Daily |
94| DTS Deposits & Withdrawals | `/v1/accounting/dts/deposits_withdrawals_operating_cash` | Daily |
95| Monthly Treasury Statement (MTS) | `/v1/accounting/mts/mts_table_1` (18 tables — see [datasets-fiscal.md](references/datasets-fiscal.md)) | Monthly |

Daily & Monthly Statements

DatasetEndpointFrequency
DTS Operating Cash Balance/v1/accounting/dts/operating_cash_balanceDaily
DTS Deposits & Withdrawals/v1/accounting/dts/deposits_withdrawals_operating_cashDaily
Monthly Treasury Statement (MTS)/v1/accounting/mts/mts_table_1 (18 tables — see datasets-fiscal.md)Monthly
Raw lines 89 to 96
97### Interest Rates & Exchange
99| Dataset | Endpoint | Frequency |
100|---------|----------|-----------|
101| Average Interest Rates on Treasury Securities | `/v2/accounting/od/avg_interest_rates` | Monthly |
102| Treasury Reporting Rates of Exchange | `/v1/accounting/od/rates_of_exchange` | Quarterly |
103| Interest Expense on Public Debt | `/v2/accounting/od/interest_expense` | Monthly |
105**Exchange-rate interpretation:** Treasury Reporting Rates are foreign-currency units per USD, so divide a foreign-currency amount by the rate to obtain USD (and multiply USD to obtain foreign currency). These are government reporting rates, not live trading quotes. Preserve both `record_date` and `effective_date`, and check amendments before applying a rate to a reporting period.

Interest Rates & Exchange

DatasetEndpointFrequency
Average Interest Rates on Treasury Securities/v2/accounting/od/avg_interest_ratesMonthly
Treasury Reporting Rates of Exchange/v1/accounting/od/rates_of_exchangeQuarterly
Interest Expense on Public Debt/v2/accounting/od/interest_expenseMonthly

Exchange-rate interpretation: Treasury Reporting Rates are foreign-currency units per USD, so divide a foreign-currency amount by the rate to obtain USD (and multiply USD to obtain foreign currency). These are government reporting rates, not live trading quotes. Preserve both record_date and effective_date, and check amendments before applying a rate to a reporting period.

Raw lines 97 to 106
107### Securities & Auctions
109| Dataset | Endpoint | Frequency |
110|---------|----------|-----------|
111| Treasury Securities Auctions Data | `/v1/accounting/od/auctions_query` | As Needed |
112| Treasury Securities Upcoming Auctions | `/v1/accounting/od/upcoming_auctions` | As Needed |
113| Treasury Securities Buybacks | `/v1/accounting/od/buybacks_operations` | As Needed |

Securities & Auctions

DatasetEndpointFrequency
Treasury Securities Auctions Data/v1/accounting/od/auctions_queryAs Needed
Treasury Securities Upcoming Auctions/v1/accounting/od/upcoming_auctionsAs Needed
Treasury Securities Buybacks/v1/accounting/od/buybacks_operationsAs Needed
Raw lines 107 to 114
115### Savings Bonds
117| Dataset | Endpoint | Frequency |
118|---------|----------|-----------|
119| I Bonds Interest Rates | `/v1/accounting/od/i_bonds_interest_rates` | Semi-Annual |
120| Savings Bonds Issues, Redemptions & Maturities | `/v1/accounting/od/savings_bonds_report` | Monthly |

Savings Bonds

DatasetEndpointFrequency
I Bonds Interest Rates/v1/accounting/od/i_bonds_interest_ratesSemi-Annual
Savings Bonds Issues, Redemptions & Maturities/v1/accounting/od/savings_bonds_reportMonthly
Raw lines 115 to 121
122## Response Structure
124```json
126 "data": [...],
127 "meta": {
128 "count": 100,
129 "total-count": 3790,
130 "total-pages": 38,
131 "labels": {"field_name": "Human Readable Label"},
132 "dataTypes": {"field_name": "STRING|NUMBER|DATE|CURRENCY"},
133 "dataFormats": {"field_name": "String|10.2|YYYY-MM-DD"}
134 },
135 "links": {"self": "...", "first": "...", "prev": null, "next": "...", "last": "..."}
137```
139**Note:** Data-row values are returned as strings; metadata counts are JSON numbers. Convert as needed (e.g., `float()`, `pd.to_datetime()`). Null values appear as the string `"null"`.

Response Structure

{
  "data": [...],
  "meta": {
    "count": 100,
    "total-count": 3790,
    "total-pages": 38,
    "labels": {"field_name": "Human Readable Label"},
    "dataTypes": {"field_name": "STRING|NUMBER|DATE|CURRENCY"},
    "dataFormats": {"field_name": "String|10.2|YYYY-MM-DD"}
  },
  "links": {"self": "...", "first": "...", "prev": null, "next": "...", "last": "..."}
}

Note: Data-row values are returned as strings; metadata counts are JSON numbers. Convert as needed (e.g., float(), pd.to_datetime()). Null values appear as the string "null".

Raw lines 122 to 140
141## Common Patterns

Common Patterns

Raw lines 141 to 142
143### Load all pages into a DataFrame
145Use the bounded `fetch_all()` helper in [parameters.md](references/parameters.md). For small result sets, a single request with `page[size]=10000` may suffice when `meta.total-pages` is 1.
147```python
148# Single-page fetch when total-pages == 1
149params = {"sort": "-record_date", "page[size]": 10000}
150resp = requests.get(f"{BASE_URL}/v2/accounting/od/debt_outstanding", params=params, timeout=30)
151resp.raise_for_status()
152result = resp.json()
153if result["meta"]["total-pages"] > 1:
154 raise ValueError("Use fetch_all() from parameters.md for multi-page results")
155df = pd.DataFrame(result["data"])
156```

Load all pages into a DataFrame

Use the bounded fetch_all() helper in parameters.md. For small result sets, a single request with page[size]=10000 may suffice when meta.total-pages is 1.

# Single-page fetch when total-pages == 1
params = {"sort": "-record_date", "page[size]": 10000}
resp = requests.get(f"{BASE_URL}/v2/accounting/od/debt_outstanding", params=params, timeout=30)
resp.raise_for_status()
result = resp.json()
if result["meta"]["total-pages"] > 1:
    raise ValueError("Use fetch_all() from parameters.md for multi-page results")
df = pd.DataFrame(result["data"])
Raw lines 143 to 157
Reads a file references/parameters.md :145
158### Aggregation (automatic sum)
160Selecting fewer fields can aggregate non-unique rows. It can also sum balances or rates that should not be added, and combine statement totals with their components. Inspect the full row grain first:
162```python
163# Preview full DTS rows, preserving account and category dimensions
164resp = requests.get(f"{BASE_URL}/v1/accounting/dts/deposits_withdrawals_operating_cash", params={
165 "filter": "record_date:eq:2024-01-16", "page[size]": 1000
166}, timeout=30)
167resp.raise_for_status()
168```

Aggregation (automatic sum)

Selecting fewer fields can aggregate non-unique rows. It can also sum balances or rates that should not be added, and combine statement totals with their components. Inspect the full row grain first:

# Preview full DTS rows, preserving account and category dimensions
resp = requests.get(f"{BASE_URL}/v1/accounting/dts/deposits_withdrawals_operating_cash", params={
    "filter": "record_date:eq:2024-01-16", "page[size]": 1000
}, timeout=30)
resp.raise_for_status()
Raw lines 158 to 169
170## Interpretation checks
172- DTS amounts are in millions. Since April 18, 2022, find the `Treasury General Account (TGA) Closing Balance` row and read `open_today_bal`; `close_today_bal` is null.
173- MTS tables have different amount fields and row hierarchies. The compact monthly summary uses `mil_amt` (millions); do not assign that scale to every MTS field.
174- Interest expense uses `month_expense_amt` and `fytd_expense_amt`. Never sum FYTD values across months.
175- Auctions use `auction_date` for event timing; `record_date` is publication date. I Bond rates require the bond's `issue_year_month` as well as earning period.
177Reviewed against the [official API guide](https://fiscaldata.treasury.gov/api-documentation/), dataset data dictionaries, and unauthenticated live GET responses on 2026-09-30. See references for table-specific caveats.

Interpretation checks

  • DTS amounts are in millions. Since April 18, 2022, find the Treasury General Account (TGA) Closing Balance row and read open_today_bal; close_today_bal is null.
  • MTS tables have different amount fields and row hierarchies. The compact monthly summary uses mil_amt (millions); do not assign that scale to every MTS field.
  • Interest expense uses month_expense_amt and fytd_expense_amt. Never sum FYTD values across months.
  • Auctions use auction_date for event timing; record_date is publication date. I Bond rates require the bond's issue_year_month as well as earning period.

Reviewed against the official API guide, dataset data dictionaries, and unauthenticated live GET responses on 2026-09-30. See references for table-specific caveats.

Raw lines 170 to 178
179## Reference Files
181- **[api-basics.md](references/api-basics.md)** — URL structure, HTTP methods, versioning, data types
182- **[parameters.md](references/parameters.md)** — All parameters with detailed examples and edge cases
183- **[datasets-debt.md](references/datasets-debt.md)** — Debt datasets: Debt to the Penny, Historical Debt, Schedules of Federal Debt, TROR
184- **[datasets-fiscal.md](references/datasets-fiscal.md)** — Daily Treasury Statement, Monthly Treasury Statement, revenue, spending
185- **[datasets-interest-rates.md](references/datasets-interest-rates.md)** — Average interest rates, exchange rates, TIPS/CPI, certified interest rates
186- **[datasets-securities.md](references/datasets-securities.md)** — Treasury auctions, savings bonds, SLGS, buybacks
187- **[response-format.md](references/response-format.md)** — Response objects, error handling, pagination, response codes
188- **[examples.md](references/examples.md)** — Python, R, and pandas code examples for common use cases

Reference Files

  • api-basics.md — URL structure, HTTP methods, versioning, data types
  • parameters.md — All parameters with detailed examples and edge cases
  • datasets-debt.md — Debt datasets: Debt to the Penny, Historical Debt, Schedules of Federal Debt, TROR
  • datasets-fiscal.md — Daily Treasury Statement, Monthly Treasury Statement, revenue, spending
  • datasets-interest-rates.md — Average interest rates, exchange rates, TIPS/CPI, certified interest rates
  • datasets-securities.md — Treasury auctions, savings bonds, SLGS, buybacks
  • response-format.md — Response objects, error handling, pagination, response codes
  • examples.md — Python, R, and pandas code examples for common use cases
Raw lines 179 to 189
Boilerplate, lines 190 to 205. The same text appears in 125 other files here. Close
190## Citing Scientific Agent Skills
192This skill is part of Scientific Agent Skills by K-Dense. If it materially contributed to a
193manuscript, report, presentation, or code release, add the paper to the references or
194software section and tell the user you did so:
196> Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent
197> Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065.
198> https://doi.org/10.48550/arXiv.2609.00065
200Always cite the current version. The DOI and https://arxiv.org/abs/2609.00065 resolve to the
201latest arXiv version, so never append a version suffix such as `v1`. When network access is
202available, fetch https://arxiv.org/abs/2609.00065 (or
203http://export.arxiv.org/api/query?id_list=2609.00065) before writing the reference and take
204the author list, year, and version from that record. If the record lists a journal reference
205or publisher DOI, cite the published version instead.

From K-Dense-AI/scientific-agent-skills at 5f2bc03, 2026-10-26. Not read by a model yet. Summary and techniques by Claude Opus 5.5 on 2026-11-06.