# US Treasury Yield Curve (daily, 2s10s spread) (`barefoot_grade/treasury-yield-curve`) Actor

US Treasury daily yield curve: every trading day's curve (13 tenors, 1 Mo to 30 Yr) with the 2s10s spread on every row and the latest curve vs the 7-days-ago curve in the run summary — the recession-signal macro panel.

- **URL**: https://apify.com/barefoot_grade/treasury-yield-curve.md
- **Developed by:** [Philip Kirkbride](https://apify.com/barefoot_grade) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## US Treasury Yield Curve

### Quick Start

Collect the US Treasury daily par yield curve — all 13 tenors from 1 Mo to 30 Yr — with the 2s10s spread on every row.
Use it for macro dashboards, recession-signal tracking, and rate research.
Start with this minimal input:

```json
{"year": 2026}
```

Source: U.S. Department of the Treasury, "Daily Treasury Par Yield Curve Rates" — official public data from the US Treasury.

### Input

| Name | Type | Default | What it does |
| --- | --- | --- | --- |
| `year` | integer | current year | Which calendar year to fetch; the series starts in 1990. Future years are rejected up front with a clear error. |
| `maturities` | array | `[]` | Optional subset of the 13 tenors (`"10y"`, `"1mo"`, `"2 Yr"` forms accepted) to focus coverage and warnings on. Every row always carries all 13 tenor fields regardless. |

### Output

One dataset record per trading day (oldest to newest): `recordKey`, `source`, `kind`, `date`, `yield1Mo` … `yield30Yr` (percent; explicit `null` for unpublished tenors), `spread2s10s` (percentage points; negative = inverted curve), `sourceUrl`, `collectedAt`.

Example record:

```json
{"recordKey":"ustyc:2026-09-04","source":"treasury.gov","kind":"yield_curve","date":"2026-09-04","yield2Yr":4.37,"yield5Yr":4.24,"yield10Yr":4.78,"yield30Yr":4.86,"spread2s10s":0.41,"collectedAt":"2026-09-05T06:44:10Z"}
```

The run summary (KeyValue store `OUTPUT`) reports the latest curve, the curve ~7 days earlier, per-tenor week-over-week changes, coverage counters, and any warnings.

### FAQ

**How far back does history go?** To 1990. Each run fetches one full calendar year (about 250 trading-day records).

**Why do some tenors show `null`?** The Treasury added tenors over time (`2 Mo` in 2018, `4 Mo` in 2020) and dropped others in places; a tenor not published on a date is an explicit `null`, never interpolated.

**Is the data daily?** One row per trading day — weekends and US holidays have no rows.

**What is the 2s10s spread?** The 10 Yr yield minus the 2 Yr yield; a negative value is the classic inverted-curve recession signal.

For support, contact Apify support and include the Actor run ID.

# Actor input Schema

## `year` (type: `integer`):

Which calendar year's daily yield curve CSV to fetch (one request, full year). Defaults to the current year; the series starts in 1990. Treasury serves published years only, so a year after the current one is rejected at run time with a clear error.

## `maturities` (type: `array`):

Optional subset of the 13 tenors ('1 Mo', '2 Mo', '3 Mo', '4 Mo', '6 Mo', '1 Yr', '2 Yr', '3 Yr', '5 Yr', '7 Yr', '10 Yr', '20 Yr', '30 Yr'; '10y'/'1mo' shorthand accepted) to focus the run's coverage and warnings on. The dataset schema is fixed: every row always carries all 13 tenor fields regardless of this filter, so the output row shape never varies. Empty means all 13. The 2s10s spread is computed whenever the 2 Yr and 10 Yr data exists, filter or not.

## Actor input object example

```json
{
  "year": 2026,
  "maturities": []
}
```

# Actor output Schema

## `results` (type: `string`):

No description

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

No description

# 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 = {
    "year": 2026,
    "maturities": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("barefoot_grade/treasury-yield-curve").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 = {
    "year": 2026,
    "maturities": [],
}

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

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

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

```

## CLI example

```bash
echo '{
  "year": 2026,
  "maturities": []
}' |
apify call barefoot_grade/treasury-yield-curve --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,barefoot_grade/treasury-yield-curve"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

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