Usfiscaldata
Automate and integrate US Fiscal Data for streamlined access to government financial datasets
US Fiscal Data is a community skill for accessing US government fiscal data, covering federal spending queries, revenue tracking, national debt monitoring, Treasury account analysis, and API integration for financial and economic research.
What Is This?
Overview
US Fiscal Data provides guidance on accessing and analyzing United States government financial information through the Fiscal Data API. It covers federal spending queries that retrieve detailed expenditure records by agency, category, and time period for budget analysis, revenue tracking that monitors tax collection and income sources across fiscal years with monthly and daily granularity, national debt monitoring that fetches current and historical debt figures including debt held by the public and intragovernmental holdings, Treasury account analysis that examines Daily Treasury Statements for cash position and transaction flow tracking, and dataset discovery that navigates available fiscal datasets with field-level documentation for building custom analytical queries. The skill helps researchers and analysts access official US fiscal information programmatically through structured REST API calls that return JSON-formatted records suitable for direct ingestion into analytical workflows.
Who Should Use This
This skill serves economic researchers analyzing federal budget trends, financial analysts tracking government debt and spending patterns, and data journalists building fiscal transparency visualizations. Policy analysts comparing spending allocations across agencies and fiscal years will also find the structured query guidance directly applicable.
Why Use It?
Problems It Solves
Federal fiscal data is distributed across multiple Treasury reports and datasets with different formats. Building time series of government spending requires joining records across fiscal years with consistent category mappings. Real-time debt and cash position data needs daily API polling with proper date handling. Understanding the available datasets and their field schemas requires navigating extensive documentation before writing a single query.
Core Highlights
Spending querier retrieves federal expenditure records by category. Revenue tracker monitors tax collection across fiscal periods. Debt monitor fetches current and historical national debt figures. Treasury analyzer examines daily cash position statements.
How to Use It?
Basic Usage
import requests
import pandas as pd
BASE = (
'https://api.fiscaldata'
'.treasury.gov/services'
'/api/fiscal_service')
def get_debt_data(
start_date, end_date
):
endpoint = (
'/v2/accounting/od/'
'debt_to_penny')
params = {
'filter': (
f'record_date:gte:'
f'{start_date},'
f'record_date:lte:'
f'{end_date}'),
'sort': '-record_date',
'page[size]': 100
}
resp = requests.get(
BASE + endpoint,
params=params)
data = resp.json()
return pd.DataFrame(
data['data'])
debt = get_debt_data(
'2024-01-01',
'2024-12-31')
print(debt[[
'record_date',
'tot_pub_debt_out_amt'
]].head())Real-World Examples
def get_revenue(
fiscal_year
):
endpoint = (
'/v1/accounting/'
'mts/'
'mts_table_4')
params = {
'filter': (
f'record_fiscal_year'
f':eq:{fiscal_year}'),
'fields': ','.join([
'record_date',
'classification_desc',
'current_month_gross_rcpt_amt',
'record_fiscal_year'
]),
'page[size]': 500
}
resp = requests.get(
BASE + endpoint,
params=params)
return pd.DataFrame(
resp.json()['data'])
revenue = get_revenue(2024)
by_type = revenue.groupby(
'classification_desc'
)['current_month_gross_rcpt_amt'
].sum()
print(by_type.sort_values(
ascending=False).head())Advanced Tips
Use pagination parameters to retrieve complete datasets that exceed the default page size limit. Combine filter expressions to narrow queries to specific agencies and time periods for faster response times. Cache frequently accessed historical data locally since past fiscal records do not change. When comparing spending across agencies, convert monetary string fields to float values explicitly before aggregation to avoid silent grouping errors in pandas.
When to Use It?
Use Cases
Track national debt growth over time with daily granularity for economic research. Compare federal revenue sources across fiscal years for budget analysis. Monitor Treasury daily cash position for understanding government liquidity. Identify seasonal spending patterns by filtering expenditure records to specific months across multiple years.
Related Topics
Government data, fiscal policy, Treasury Department, REST APIs, economic analysis, pandas, and financial research.
Important Notes
Requirements
Python with requests library for making HTTP calls to the Fiscal Data API endpoints. Pandas for organizing and analyzing tabular fiscal data returned from API queries. Understanding of US fiscal year calendar and Treasury reporting conventions for constructing correct date filters, noting that the federal fiscal year runs from October through September rather than following the standard calendar year.
Usage Recommendations
Do: use field selection parameters to retrieve only needed columns and reduce response payload sizes. Apply date range filters to avoid downloading entire dataset histories. Check the API metadata endpoint to understand available fields and their data types before building queries.
Don't: assume all fiscal datasets use the same field names since naming conventions vary across Treasury report types. Ignore pagination since many datasets have thousands of records that require multiple page requests. Parse monetary amounts as integers without checking for string formatting in the raw API response data.
Limitations
Some fiscal datasets have reporting delays and may not reflect the most recent transactions until the next reporting cycle. Historical data availability varies across datasets with some beginning only from recent fiscal years. API response times increase with larger queries spanning many records or complex filter combinations.
More Skills You Might Like
Explore similar skills to enhance your workflow
Launch Darkly Automation
Automate LaunchDarkly tasks via Rube MCP (Composio): feature
Customgpt Automation
Automate Customgpt operations through Composio's Customgpt toolkit via
Tech Stack Evaluator
Evaluate and compare tech stacks with automated analysis and integration tools
Digital Ocean Automation
Automate DigitalOcean tasks via Rube MCP (Composio)
Migration Architect
Design and execute complex system migrations with automated architectural tools
Groqcloud Automation
Automate AI inference, chat completions, audio translation, and TTS