# 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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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`):

Which Treasury datasets to fetch.

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

Return only the most recent record(s). Turn off to fetch a historical range.

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

Range start (YYYY-MM-DD). Used when "Latest only" is off.

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

Range end (YYYY-MM-DD). Used when "Latest only" is off.

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

Cap on records per dataset when fetching a range.

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

For Exchange Rates only: filter to a country/currency, e.g. "Euro", "Japan". Leave empty for all.

## `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,
  "maxRecords": 60,
  "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"
    ],
    "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",
    ],
    "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"
  ],
  "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

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "US Treasury Data — Yields, Debt & Rates for AI Agents",
        "description": "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.",
        "version": "0.1",
        "x-build-id": "ckSZRLAEHkfvm4Goo"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/haketa~treasury-data/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-haketa-treasury-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/haketa~treasury-data/runs": {
            "post": {
                "operationId": "runs-sync-haketa-treasury-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/haketa~treasury-data/run-sync": {
            "post": {
                "operationId": "run-sync-haketa-treasury-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "datasets": {
                        "title": "Datasets",
                        "type": "array",
                        "description": "Which Treasury datasets to fetch.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "yield_curve",
                                "national_debt",
                                "interest_rates",
                                "interest_expense",
                                "exchange_rates"
                            ],
                            "enumTitles": [
                                "Daily Yield Curve",
                                "National Debt",
                                "Average Interest Rates",
                                "Interest Expense on Debt",
                                "Official Exchange Rates"
                            ]
                        },
                        "default": [
                            "yield_curve",
                            "national_debt",
                            "interest_rates"
                        ]
                    },
                    "latest": {
                        "title": "Latest only",
                        "type": "boolean",
                        "description": "Return only the most recent record(s). Turn off to fetch a historical range.",
                        "default": true
                    },
                    "startDate": {
                        "title": "Start date",
                        "type": "string",
                        "description": "Range start (YYYY-MM-DD). Used when \"Latest only\" is off."
                    },
                    "endDate": {
                        "title": "End date",
                        "type": "string",
                        "description": "Range end (YYYY-MM-DD). Used when \"Latest only\" is off."
                    },
                    "maxRecords": {
                        "title": "Max records per dataset",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Cap on records per dataset when fetching a range.",
                        "default": 60
                    },
                    "currency": {
                        "title": "Currency filter (optional)",
                        "type": "string",
                        "description": "For Exchange Rates only: filter to a country/currency, e.g. \"Euro\", \"Japan\". Leave empty for all."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify Proxy settings. The Treasury sources are public, so a proxy is OFF by default.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
