# Global Macro Liquidity & Fed Balance Sheet Intelligence (`khnaami/global-macro-liquidity-fed-balance-sheet-intelligence`) Actor

Calculates Federal Reserve Net Liquidity (WALCL - RRP - TGA), weekly Wednesday liquidity overlays on risk assets (SPY, BTC, QQQ, GLD), Pearson statistical correlations, and global macroeconomic cycle indicators from FRED.

- **URL**: https://apify.com/khnaami/global-macro-liquidity-fed-balance-sheet-intelligence.md
- **Developed by:** [khalid naami](https://apify.com/khnaami) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## Global Macro Liquidity & Fed Balance Sheet Intelligence 🌊🏛️

**Global Macro Liquidity & Fed Balance Sheet Intelligence** is a quantitative macroeconomics Actor on Apify. It extracts Federal Reserve balance sheet components, models weekly Wednesday **Net Banking Liquidity** ($\text{WALCL} - \text{RRP} - \text{TGA}$), calculates live Pearson statistical correlation overlays with major risk assets (**SPY, QQQ, BTC, ETH, GLD**), models US Real GDP & CPI economic cycle regimes, projects 12-month forward inflation paths, and formats multi-country G20 macroeconomic rankings.

***

### 🌟 Key Features

1. **Federal Reserve Net Liquidity Model ($\text{WALCL} - \text{RRP} - \text{TGA}$):**
   - **Total Assets (`WALCL`):** Fed balance sheet size in Billions ($B).
   - **Overnight Reverse Repo (`WLRRAL` / RRP):** Cash locked up at the Fed.
   - **Treasury General Account (`WDTGAL` / TGA):** US government cash buffer.
   - **Net Banking Liquidity:** Active reserves flowing through global financial markets with 1W, 1M, and 1Y momentum deltas.

2. **Risk Asset Historical Overlay & Pearson Correlation ($R$):**
   - Weekly Wednesday close price alignment across:
     - **SPY** (S\&P 500 ETF)
     - **QQQ** (Invesco QQQ Trust)
     - **BTC-USD** (Bitcoin)
     - **ETH-USD** (Ethereum)
     - **GLD** (SPDR Gold Shares)
   - Live Pearson correlation coefficients ($R$) and classification (Coupling vs Decoupling).

3. **US Real GDP Growth & CPI Inflation Engine:**
   - Real GDP YoY Growth (`GDPC1`) and CPI YoY Inflation (`CPIAUCSL`) tracking.
   - Automatic Macro Business Cycle determination: `Disinflationary Boom (Goldilocks)`, `Reflationary Expansion`, `Stagflationary Pressure`, or `Deflationary Contraction`.

4. **12-Month Forward CPI Inflation Simulator:**
   - Interactive simulation calculating monthly YoY CPI trajectories based on assumed MoM rates and projecting estimated 2.0% Fed target re-entry dates.

5. **G20 Global Macroeconomic Rankings:**
   - Multi-country GDP, inflation, unemployment, and debt-to-GDP metrics across all G20 nations.

***

### 📥 Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `overlayAssets` | `array` | `["SPY", "QQQ", "BTC-USD", "ETH-USD", "GLD"]` | Assets to align on Wednesday liquidity dates and compute correlation. |
| `timeHorizonDays` | `integer` | `1095` | Days of history for overlay and correlation analysis (3Y = 1095). |
| `includeGdpCpiAnalysis` | `boolean` | `true` | Include Real GDP, CPI Inflation, and regime classifications. |
| `cpiSimulationMomPct` | `number` | `0.20` | Assumed monthly MoM rate for forward inflation simulation (%). |
| `includeHistoricalLiquiditySeries` | `boolean` | `true` | Output weekly historical Net Liquidity time series. |
| `includeG20Indicators` | `boolean` | `true` | Include multi-country G20 macroeconomic database. |

***

### 📤 Output Schema

```json
{
  "recordType": "MACRO_LIQUIDITY_DOSSIER",
  "asOfDate": "2026-09-24",
  "totalAssetsBillions": 6845.2,
  "reverseRepoBillions": 235.4,
  "treasuryAccountBillions": 718.5,
  "netLiquidityBillions": 5891.3,
  "netLiquidityWeeklyDeltaBillions": -12.4,
  "netLiquidityMonthlyDeltaBillions": -42.8,
  "policyRegime": "Quantitative Tightening (QT)",
  "spyCorrelationR": 0.8842,
  "btcCorrelationR": 0.8215,
  "qqqCorrelationR": 0.8654,
  "gldCorrelationR": -0.3210,
  "realGdpGrowthYoY": 2.5,
  "cpiInflationYoY": 2.8,
  "macroEconomicRegime": "Disinflationary Boom (Goldilocks) 🌟",
  "fedTargetReentryDate": "November 2026",
  "assetCorrelations": { ... },
  "gdpCpiAnalysis": { ... },
  "g20Rankings": [ ... ]
}
```

***

### 🚀 Local Run

```bash
uv run --with apify --with pandas --with numpy --with yfinance --with requests --with pytz --with python-dateutil python -m src.main
```

# Actor input Schema

## `overlayAssets` (type: `array`):

List of tickers to align on weekly Wednesday Net Liquidity dates and compute Pearson correlation coefficients for.

## `timeHorizonDays` (type: `integer`):

Number of days back for historical overlay and correlation calculations (e.g. 365 = 1Y, 1095 = 3Y, 1825 = 5Y, 7300 = Max).

## `includeGdpCpiAnalysis` (type: `boolean`):

Calculate US Real GDP YoY Growth, CPI YoY Inflation, and identify Macro Economic Regimes.

## `cpiSimulationMomPct` (type: `number`):

Hypothetical month-over-month CPI rate to project 12-month YoY inflation trajectory and 2.0% Fed target re-entry date.

## `includeHistoricalLiquiditySeries` (type: `boolean`):

Output full weekly time series of Fed Total Assets, Reverse Repo, Treasury General Account, and Net Liquidity.

## `includeG20Indicators` (type: `boolean`):

Include multi-country GDP, inflation, unemployment, and debt metrics for G20 nations.

## Actor input object example

```json
{
  "overlayAssets": [
    "SPY",
    "QQQ",
    "BTC-USD",
    "ETH-USD",
    "GLD"
  ],
  "timeHorizonDays": 1095,
  "includeGdpCpiAnalysis": true,
  "cpiSimulationMomPct": 0.2,
  "includeHistoricalLiquiditySeries": true,
  "includeG20Indicators": true
}
```

# Actor output Schema

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

Dataset items and records produced by the Actor

## `overview` (type: `string`):

Summary report stored in Key-Value store

# 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 = {
    "overlayAssets": [
        "SPY",
        "QQQ",
        "BTC-USD",
        "ETH-USD",
        "GLD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khnaami/global-macro-liquidity-fed-balance-sheet-intelligence").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 = { "overlayAssets": [
        "SPY",
        "QQQ",
        "BTC-USD",
        "ETH-USD",
        "GLD",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("khnaami/global-macro-liquidity-fed-balance-sheet-intelligence").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 '{
  "overlayAssets": [
    "SPY",
    "QQQ",
    "BTC-USD",
    "ETH-USD",
    "GLD"
  ]
}' |
apify call khnaami/global-macro-liquidity-fed-balance-sheet-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khnaami/global-macro-liquidity-fed-balance-sheet-intelligence"
        }
    }
}
```

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/nKjwHpKVpL8N810Ka/builds/asqtpAopGVMspw1v4/openapi.json
