# US Treasury Yield Curve: Real Yields & Inversions (`automatic/treasury-yield-curve`) Actor

Monitor US Treasury nominal and TIPS real yields across years. Calculate approximate breakeven inflation, curve inversions, inversion duration, tenor changes and threshold alerts.

- **URL**: https://apify.com/automatic/treasury-yield-curve.md
- **Developed by:** [Philip Kirkbride](https://apify.com/automatic) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 2 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: Real Yields & Inversions

### What it does

Get a nominal and real US yield curve monitor using Treasury public history, including yield spreads, inversions, changes and threshold matches. No external notifications are sent.

### Input

```json
{"startDate":"2024-01-01","endDate":"2025-12-31","includeReal":true,"alerts":[{"field":"spread2s10s","operator":"lt","value":0}]}
```

Or use `{"year":2025}`. Default is current year. Dates are inclusive; use either a year or both ISO dates. Nominal history starts in 1990; real history starts in 2003, with tenor availability varying over time. `maturities` selects the tenors checked for coverage; every row retains all nominal yield columns. Set `includeReal:false` to omit real yields. Invalid input fails with a plain message.

### Coverage and limits

Treasury sources: [nominal](https://home.treasury.gov/resource-center/data-chart-center/interest-rates/interest-rates-curve?type=daily_treasury_yield_curve) and [real TIPS](https://home.treasury.gov/resource-center/data-chart-center/interest-rates/interest-rates-curve?type=daily_treasury_real_yield_curve). If real yields are unavailable, nominal rows remain available with a warning. Missing dates and tenors remain null; no forward fill.

### Output

Fields include nominal yields and `spread2s10s`, plus `realYields` and `breakevenApproximation` keyed by matched 5/7/10/20/30-year tenor; `realStatus`, `realSourceUrl`; `spread3m10y`; `inversions`; `changes`; `alerts`. Rates, spreads and changes are percentage points. Nominal minus real par yields is only an approximation of inflation compensation, not a forecast or exact zero-coupon breakeven.

Inversions use strict negative 10y-minus-2y and 10y-minus-3m spreads. `observations` counts consecutive published observations, not calendar days; missing legs break the run. `since` is the first observed inverted date and `leftCensored` warns when a run could have begun before available history. Durations are limited to the available history. Changes use the preceding observation for day, and the latest observation on or before 7/30 calendar days earlier for week/month. Baseline dates are included; absent baselines or legs yield nulls. A baseline may predate your selected start date when available within the covered years; prior history is not guaranteed.

Threshold rules support nominal yield fields and both spreads, `lt` or `gt`, and a finite numeric `value`. Each row lists matching rules with the observed value; equality does not trigger. No separate alert rows or notification charges.

Example row with illustrative values:

**Selected fields only.**

```json
{"recordKey":"ustyc:2025-01-02","source":"treasury.gov","kind":"yield_curve","date":"2025-01-02","yield2Yr":4.25,"yield10Yr":4.45,"spread2s10s":0.20,"spread3m10y":null}
```

### Limits and tips

The run summary includes nominal latest/week values and delivery status. If the source is slow or unavailable, the run keeps collected rows and reports incomplete history in its warnings. A very long date range may return partial history; inspect warnings. Schedules re-deliver and re-charge rows; deduplicate by recordKey downstream.

### Pricing

One trading date is one dataset item and one dataset-item charge. Threshold matches do not add separate rows or notification charges. A run-start fee also applies, including empty runs. It is charged per GB of memory, with a one-start minimum; the default 512 MB run is one start event. See the Pricing tab for current prices.

# Actor input Schema

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

Which calendar year's daily yield curve CSV to fetch (one request, full year). Ignored when startDate/endDate are supplied. 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.

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

ISO date. Supply with endDate; these dates take precedence over year; 1990 through today.

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

Inclusive ISO date, at most today.

## `includeReal` (type: `boolean`):

Join Treasury TIPS curve; failures preserve nominal rows with warnings.

## `alerts` (type: `array`):

Rules: field (nominal yield field or spread2s10s/spread3m10y), operator lt/gt, value in percentage points.

## Actor input object example

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

# 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("automatic/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("automatic/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 automatic/treasury-yield-curve --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automatic/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/Ed7lK8uZTWsKt5a1j/openapi.json
