Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính51k · #3590

usfiscaldata

Skill này làm gì

Lấy dữ liệu tài chính của chính phủ Hoa Kỳ, như nợ quốc gia, tỷ giá hối đoái và số liệu thu chi. Không cần khóa API.

Khi nào nên dùng

  • ✓Khi kiểm tra nợ quốc gia hiện tại.
  • ✓Khi tra cứu tỷ giá hối đoái trong quá khứ.
  • ✓Khi lấy số liệu chi tiêu của chính phủ.

Liên kết skill

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/usfiscaldata/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/usfiscaldata/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Nợ quốc gia vào ngày 1 tháng 1 năm 2023 là bao nhiêu?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ này kết nối với cơ sở dữ liệu chính thức của Kho bạc Hoa Kỳ. Bạn yêu cầu một loại thông tin, và nó lấy dữ liệu mới nhất hoặc dữ liệu cho một giai đoạn cụ thể.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.

Installation

uv pip install requests pandas

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"])

Authentication

None required. The API is fully open and free.

Core Parameters

Parameter Example Description
fields= fields=record_date,tot_pub_debt_out_amt Select specific columns
filter= filter=record_date:gte:2024-01-01 Filter records
sort= sort=-record_date Sort (prefix - for descending)
format= format=json Output format: json, csv, xml
page[size]= page[size]=100 Records per page (default 100)
page[number]= page[number]=2 Page 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"

Key Datasets & Endpoints

Debt

Dataset Endpoint Frequency
Debt to the Penny /v2/accounting/od/debt_to_penny Daily
Historical Debt Outstanding /v2/accounting/od/debt_outstanding Annual
Schedules of Federal Debt /v1/accounting/od/schedules_fed_debt Monthly

Daily & Monthly Statements

Dataset Endpoint Frequency
DTS Operating Cash Balance /v1/accounting/dts/operating_cash_balance Daily
DTS Deposits & Withdrawals /v1/accounting/dts/deposits_withdrawals_operating_cash Daily
Monthly Treasury Statement (MTS) /v1/accounting/mts/mts_table_1 (18 tables — see datasets-fiscal.md) Monthly

Interest Rates & Exchange

Dataset Endpoint Frequency
Average Interest Rates on Treasury Securities /v2/accounting/od/avg_interest_rates Monthly
Treasury Reporting Rates of Exchange /v1/accounting/od/rates_of_exchange Quarterly
Interest Expense on Public Debt /v2/accounting/od/interest_expense Monthly

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.

Securities & Auctions

Dataset Endpoint Frequency
Treasury Securities Auctions Data /v1/accounting/od/auctions_query As Needed
Treasury Securities Upcoming Auctions /v1/accounting/od/upcoming_auctions As Needed
Treasury Securities Buybacks /v1/accounting/od/buybacks_operations As Needed

Savings Bonds

Dataset Endpoint Frequency
I Bonds Interest Rates /v1/accounting/od/i_bonds_interest_rates Semi-Annual
Savings Bonds Issues, Redemptions & Maturities /v1/accounting/od/savings_bonds_report Monthly

Response Structure

{
  "data": [...],
  "meta": {
    "count": 100,
    "total-count": 3790,

…
Câu hỏi thường gặp

Tôi có cần đăng ký hoặc trả phí để dùng không?

Không, API này miễn phí và mở, không cần đăng ký hay khóa.

Tôi có thể lấy những loại dữ liệu nào?

Bạn có thể lấy dữ liệu về nợ quốc gia, báo cáo hằng ngày và hằng tháng của Kho bạc, lãi suất, tỷ giá, trái phiếu tiết kiệm và số liệu thu chi của chính phủ Hoa Kỳ.

Dữ liệu được trình bày như thế nào?

Dữ liệu được trả về dưới dạng danh sách hoặc bảng, thường là văn bản. Số và ngày có thể cần chuyển đổi trước khi tính toán.

Chi tiết

Mô tả gốc của tác giả

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.

repo: K-Dense-AI/scientific-agent-skills

Độ phổ biến

Sao GitHub
51k
Vị trí xếp hạng
#3590
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự