# US Treasury Data — Yields, Debt & Rates for AI Agents (`haketa/treasury-data`) Actor

Get official US Treasury data for AI agents: daily yield curve (with 2s10s spread), national debt, average interest rates, interest expense and official exchange rates. Real-time fiscal & rates grounding for finance, macro and trading agents — keyless.

- **URL**: https://apify.com/haketa/treasury-data.md
- **Developed by:** [Haketa](https://apify.com/haketa) (community)
- **Categories:** AI, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## US Treasury Data — Yield Curve, Debt & Rates for AI Agents

Get official **US Treasury** fiscal data in one call: the **daily Treasury yield curve**, the **national debt**, **average interest rates**, **interest expense**, and **official exchange rates** — as clean, structured records with a human-readable summary for every one.

Built for **AI finance & macro agents, trading tools, and research**. No API key, no setup — just current, authoritative government data.

***

### Why this Actor?

An LLM can't know today's 10-year yield, this week's national debt, or the current Treasury exchange rate — these change constantly and are the kind of hard, citable numbers a finance agent must get exactly right. This Actor is that **fiscal grounding**: ask for the yield curve and get back every tenor with the 2s10s spread already computed; ask for the debt and get the exact figure to the penny.

- **Macro & rates agents** — the yield curve (and its inversion) is the single most-watched recession signal; this gives it to you live.
- **Trading & fixed-income tools** — current and historical Treasury rates, debt and interest expense.
- **Research & dashboards** — pull a date range and chart debt or yields over time.
- **FX reference** — the official US Treasury reporting rates of exchange, used for government accounting.

It complements company-level financial data (filings, fundamentals) and market FX with the **government/sovereign** side — the yield curve and debt figures that aren't in those sources.

***

### Datasets

Pick any combination:

| Dataset | What it gives |
| --- | --- |
| **Daily Yield Curve** | Par yield for every tenor (1 Mo → 30 Yr), with the 2s10s spread and an inversion flag |
| **National Debt** | Total public debt outstanding, split into public vs intragovernmental (to the penny) |
| **Average Interest Rates** | Average rate the Treasury pays on each type of security |
| **Interest Expense** | Interest expense on the public debt |
| **Official Exchange Rates** | Treasury reporting rate of exchange, USD → each currency |

***

### What you get

Each record is normalized to the same simple shape:

| Field | Description |
| --- | --- |
| `dataset` | Which dataset |
| `recordDate` | The date of the figure |
| `headline` | The key number(s), formatted (e.g. `10Y 4.48% · 2Y 4.13% · 2s10s 0.35%`) |
| `summary` | A human/agent-readable sentence |
| `valuesJson` | All metrics for the record as JSON |
| `unit` | Unit of the values (percent, USD, per USD) |
| `source` | US Department of the Treasury |
| `scrapedAt` | Timestamp |

The `headline` and `summary` are ready to drop into an agent's context; `valuesJson` holds the full detail for programmatic use.

***

### Example output

```json
{
  "dataset": "yield_curve",
  "recordDate": "2026-07-06",
  "headline": "10Y 4.48% · 2Y 4.13% · 3M 3.87% · 2s10s 0.35%",
  "summary": "US Treasury par yield curve (2026-07-06): 3M 3.87%, 1Y 3.95%, 2Y 4.13%, 5Y 4.21%, 10Y 4.48%, 30Y 4.99%. 10Y–2Y spread 0.35% (normal).",
  "valuesJson": "{\"1 Mo\":\"3.69\",\"3 Mo\":\"3.87\",\"2 Yr\":\"4.13\",\"10 Yr\":\"4.48\",\"30 Yr\":\"4.99\"}",
  "unit": "percent",
  "source": "US Department of the Treasury",
  "scrapedAt": "2026-07-07T15:00:00.000Z"
}
```

```json
{
  "dataset": "national_debt",
  "recordDate": "2026-07-03",
  "headline": "Total public debt outstanding: $39.38T",
  "summary": "US national debt on 2026-07-03: $39.38T total — $31.68T held by the public, $7.70T intragovernmental.",
  "unit": "USD"
}
```

***

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `datasets` | array | yield\_curve, national\_debt, interest\_rates | Which datasets to fetch. |
| `latest` | boolean | `true` | Return only the most recent record(s). |
| `startDate` | string | — | Range start `YYYY-MM-DD` (when `latest` is off). |
| `endDate` | string | — | Range end `YYYY-MM-DD`. |
| `maxRecords` | integer | `60` | Cap on records per dataset in range mode. |
| `currency` | string | — | For Exchange Rates: filter to a currency/country (e.g. `Euro`, `Japan`). |

#### Current snapshot

```json
{ "datasets": ["yield_curve", "national_debt", "interest_rates"], "latest": true }
```

#### Historical yield curve

```json
{
  "datasets": ["yield_curve"],
  "latest": false,
  "startDate": "2026-01-01",
  "endDate": "2026-07-06",
  "maxRecords": 200
}
```

#### Just the Euro exchange rate

```json
{ "datasets": ["exchange_rates"], "latest": true, "currency": "Euro" }
```

***

### Use cases in detail

#### 1. Macro & rates agents

The yield curve is the headline macro indicator. This Actor returns every tenor plus the **2s10s spread with an inversion flag** — so an agent can answer "is the curve inverted?" directly, with the number.

#### 2. Trading & fixed-income tools

Pull current Treasury rates and debt to inform positioning, or a historical range to backtest against rate moves.

#### 3. Fiscal & policy research

Track the national debt and interest expense over time — the cost of servicing the debt is an increasingly important macro story.

#### 4. FX reference & accounting

The Treasury reporting rates of exchange are the official rates used for US government accounting and many contracts.

#### 5. Dashboards & alerts

Schedule the Actor and alert when the curve inverts, the debt crosses a threshold, or a rate moves.

***

### How to use it

1. Click **Try for free**.
2. Pick your `datasets` (and a date range if you want history).
3. Click **Start**.
4. Read the results as **JSON, CSV, Excel**, or via the Apify API.

Runs finish in seconds.

***

### Calling from the API

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "datasets": ["yield_curve", "national_debt"], "latest": true }'
```

Then fetch the dataset:

```bash
curl "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs/last/dataset/items?token=YOUR_APIFY_TOKEN"
```

Works with webhooks, Zapier, Make and n8n.

***

### Frequently asked questions

**How fresh is the data?**
It's pulled live from official Treasury sources on each run. The yield curve updates each business day; debt is daily; interest and exchange rates on their own schedules.

**What's the 2s10s spread?**
The 10-year yield minus the 2-year. When it's negative (inverted), it's historically been a recession signal — the Actor flags it for you.

**Can I get history, not just the latest?**
Yes — set `latest` to false and give a `startDate`/`endDate`.

**Which currencies are in Exchange Rates?**
The full Treasury reporting list (150+). Use the `currency` filter to narrow it.

**Is this the same as market data?**
These are official Treasury/government figures (par yields, debt, reporting FX). They complement live market quotes rather than replace them.

**Can an AI agent call this automatically?**
Yes — it's keyless and returns structured JSON with ready-made summaries, ideal as an agent/MCP tool.

***

### Notes

This Actor retrieves publicly available fiscal data published by the US Department of the Treasury. Figures are provided for information and research; for official use, consult the Treasury's own publications. Data is public domain as a work of the US government.

***

### Support

Want another Treasury dataset, an extra field, or a computed indicator? Open an issue from the Actor's page.

# Actor input Schema

## `datasets` (type: `array`):

Pick the official Treasury datasets you want. Choose one or many — results are combined into a single, clean output.

## `latest` (type: `boolean`):

Keep this on for the most recent snapshot (fast). Turn it off to pull a historical date range.

## `startDate` (type: `string`):

Only used when "Latest values only" is off. Beginning of the date range, e.g. 2024-01-01.

## `endDate` (type: `string`):

Only used when "Latest values only" is off. End of the date range, e.g. 2024-12-31. Leave empty for up to today.

## `maxRecords` (type: `integer`):

Limit how many records each dataset returns when fetching history. Keep it modest for fast, low-cost runs.

## `currency` (type: `string`):

For the Official Exchange Rates dataset only. Pick a country to see just its rate against the US Dollar, or leave on "All countries".

## `currencyText` (type: `string`):

Optional. Not in the list above? Type any country or currency name (e.g. "Kenya", "Ariary"). Used only if the dropdown is set to "All countries".

## `proxyConfiguration` (type: `object`):

Apify Proxy settings. The Treasury sources are public, so a proxy is OFF by default.

## Actor input object example

```json
{
  "datasets": [
    "yield_curve",
    "national_debt",
    "interest_rates"
  ],
  "latest": true,
  "startDate": "2024-01-01",
  "maxRecords": 60,
  "currency": "",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Which dataset

## `recordDate` (type: `string`):

Record date

## `headline` (type: `string`):

Key figure(s)

## `summary` (type: `string`):

Human-readable summary

## `valuesJson` (type: `string`):

All metrics for this record as JSON

## `unit` (type: `string`):

Unit of the values

## `source` (type: `string`):

Source dataset name

## `scrapedAt` (type: `string`):

Timestamp

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "datasets": [
        "yield_curve",
        "national_debt",
        "interest_rates"
    ],
    "startDate": "2024-01-01",
    "maxRecords": 60
};

// Run the Actor and wait for it to finish
const run = await client.actor("haketa/treasury-data").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "datasets": [
        "yield_curve",
        "national_debt",
        "interest_rates",
    ],
    "startDate": "2024-01-01",
    "maxRecords": 60,
}

# Run the Actor and wait for it to finish
run = client.actor("haketa/treasury-data").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "datasets": [
    "yield_curve",
    "national_debt",
    "interest_rates"
  ],
  "startDate": "2024-01-01",
  "maxRecords": 60
}' |
apify call haketa/treasury-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=haketa/treasury-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Ggaga6UY3O4pNy6qZ/builds/kkxERrpZuvGQFl7Hy/openapi.json
