What is the USD Liquidity Index
The USD Liquidity Index is a measure that indicates the dollars available in the market. This index indicates the ease with which banks and companies can access dollars for their activities.
When there is a high availability of dollars, interest rates are usually low, and conversely, when liquidity is low, interest rates rise, making access to financing more difficult.
The factors involved in this index are the monetary policies of the Federal Reserve of the United States, global economic conditions, and the global demand for dollars.
The formula is defined as:
WALCL (All Liabilities) – WLRRAL (RRP) – WDTGAL (TGA)
Where:
- WALCL represents the total amount of Federal Reserve liabilities, which includes bank reserves and other factors that inject liquidity into the system.
- WLRRAL (RRP) and WDTGAL (TGA) are mechanisms that drain or withdraw liquidity from the system. By subtracting them, you are eliminating the operations that decrease the amount of dollars available in the financial system.
Result: The net difference provides you with a measure of the available liquidity in the US financial system. The higher the number, the greater the amount of money circulating in the system.
Calculating the USD Liquidity Index in Python
To obtain these series, we will use OpenBB, specifically the openbb-fred extension and the openbb-economy extension. The first step is to import all the necessary libraries.
from openbb import obb
from pandas import DataFrameAs we mentioned, we need two modules within the OpenBB library, which we will call as follows:
obb.economy.fred_search()obb.economy.fred_series()
data = obb.economy.fred_series(["WALCL", "WLRRAL", "WDTGAL", "SP500"])
dataOBBject
id: 066c7874-2012-7189-8000-1e79898a8a3c
results: [{'date': datetime.date(2002, 12, 18), 'WALCL': 719542.0, 'WLRRAL': 21905....
provider: fred
warnings: None
chart: None
extra: {'results_metadata': {'WALCL': {'title': 'Assets: Total Assets: Total Assets...
To access the metadata
metadata = data.extra["results_metadata"]
metadata.keys()
metadata["WALCL"].get("title")
metadata["WALCL"].get("units")
dict_keys(['WALCL', 'WLRRAL', 'WDTGAL', 'SP500'])'Assets: Total Assets: Total Assets (Less Eliminations from Consolidation): Wednesday Level''Millions of U.S. Dollars'
Searching and retrieving indices from FRED
First, let's search for the Wednesday level indices
obb.economy.fred_search("Wednesday Levels").to_df().head(3)
| series_id | title | observation_start | observation_end | frequency | frequency_short | units | units_short | seasonal_adjustment | seasonal_adjustment_short | last_updated | popularity | group_popularity | notes | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | WALCL | Assets: Total Assets: Total Assets (Less Elimi... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted | NSA | 2024-08-15 15:37:22-05:00 | 94 | 94 | NaN |
| 1 | H41RESPPALDKNWW | Assets: Liquidity and Credit Facilities: Loans... | 2002-12-18 | 2024-08-14 | Weekly | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted | NSA | 2024-08-15 15:37:01-05:00 | 76 | 76 | NaN |
| 2 | TREAST | Assets: Securities Held Outright: U.S. Treasur... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ |
Next, we will search for the reverse repo Wednesday levels
obb.economy.fred_search("Wednesday Levels Reverse Repo").to_df().head(3)
| series_id | title | observation_start | observation_end | frequency | frequency_short | units | units_short | seasonal_adjustment | seasonal_adjustment_short | last_updated | notes | popularity | group_popularity | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | WLRRAL | Liabilities and Capital: Liabilities: Reverse ... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted | NSA | 2024-08-15 15:37:49-05:00 | Reverse repurchase agreements are transactions... | 63 | 63 |
| 1 | WLRRAFOIAL | Liabilities and Capital: Liabilities: Reverse ... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted | NSA | 2024-08-15 15:37:36-05:00 | Reverse repurchase agreements are transactions... | 40 | 40 |
| 2 | WLRRAOL | Liabilities and Capital: Liabilities: Reverse ... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ |
And the Treasury General Wednesday levels
obb.economy.fred_search("Wednesday Levels Treasury General").to_df().head(3)
| series_id | title | observation_start | observation_end | frequency | frequency_short | units | units_short | seasonal_adjustment | seasonal_adjustment_short | last_updated | notes | popularity | group_popularity | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | WDTGAL | Liabilities and Capital: Liabilities: Deposits... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted | NSA | 2024-08-15 15:38:33-05:00 | This account is the primary operational accoun... | 64 | 64 |
| 1 | D2WLTGAL | Liabilities and Capital: Liabilities: Deposits... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted | NSA | 2024-08-15 15:38:37-05:00 | NaN | 60 | 60 |
| 2 | WLDLCL | Liabilities and Capital: Liabilities: Deposits... | 2002-12-18 | 2024-08-14 | Weekly, As of Wednesday | W | Millions of U.S. Dollars | Mil. of U.S. $ | Not Seasonally Adjusted |
And the S&P 500 price
obb.economy.fred_search("SP500").to_df().head(2)
| series_id | title | observation_start | observation_end | frequency | frequency_short | units | units_short | seasonal_adjustment | seasonal_adjustment_short | last_updated | notes | popularity | group_popularity | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | SP500 | S&P 500 | 2014-08-22 | 2024-08-21 | Daily, Close | D | Index | Index | Not Seasonally Adjusted |
We print the metadata
for id in metadata:
display(f"{id}: {metadata[id]['units']}")
'WALCL: Millions of U.S. Dollars''WLRRAL: Millions of U.S. Dollars''WDTGAL: Millions of U.S. Dollars''SP500: Index'
And we generate the Liquidity Index
data.to_df().head(4)
data.to_df().dropna().head(4)
liquidity_index = DataFrame(data.to_df().dropna())
| WALCL | WLRRAL | WDTGAL | SP500 | |
|---|---|---|---|---|
| date | ||||
| 2002-12-18 | 719542.0 | 21905.0 | 6595.0 | NaN |
| 2002-12-25 | 732059.0 | 20396.0 | 4662.0 | NaN |
| 2003-01-01 | 730994.0 | 21091.0 | 4420.0 | NaN |
| 2003-01-08 | 723762.0 | 18709.0 | 5490.0 | NaN |
| WALCL | WLRRAL | WDTGAL | SP500 | |
|---|---|---|---|---|
| date | ||||
| 2014-08-27 | 4413736.0 | 282002.0 | 29547.0 | 2000.12 |
| 2014-09-03 | 4415587.0 | 250306.0 | 21036.0 | 2000.72 |
| 2014-09-10 | 4421408.0 | 267602.0 | 31872.0 | 1995.69 |
| 2014-09-17 | 4449588.0 | 252224.0 | 123965.0 | 2001.57 |
Organizing the Final DataFrame
liquidity_index["USD Liquidity Index"] = (
liquidity_index["WALCL"] - liquidity_index["WLRRAL"] - liquidity_index["WDTGAL"]
)
liquidity_index.tail(4)
| WALCL | WLRRAL | WDTGAL | SP500 | USD Liquidity Index | |
|---|---|---|---|---|---|
| date | |||||
| 2024-07-24 | 7205455.0 | 805967.0 | 767419.0 | 5427.13 | 5632069.0 |
| 2024-07-31 | 7178391.0 | 813261.0 | 854001.0 | 5522.30 | 5511129.0 |
| 2024-08-07 | 7175256.0 | 681881.0 | 785233.0 | 5199.50 | 5708142.0 |
| 2024-08-14 | 7177688.0 | 722198.0 | 788823.0 | 5455.21 | 5666667.0 |
$$L_{\text{USD}} = \text{Fed BS} - \text{TGA} - \text{RRP}$$
Plotting using Plotly and normalizing the data so they can be compared
y_axis = liquidity_index[["USD Liquidity Index", "SP500"]]
def absolute_maximum_scale(series):
return series / series.abs().max()
def min_max_scaling(series):
return (series - series.min()) / (series.max() - series.min())
def z_score_standardization(series):
return (series - series.mean()) / series.std()
methods = {
"z": z_score_standardization,
"m": min_max_scaling,
"a": absolute_maximum_scale,
}
def normalize(data: DataFrame, method: str = "z") -> DataFrame:
for col in data.columns:
data.loc[:, col] = methods[f"{method}"](data.loc[:, col])
return data
normalized = normalize(y_axis, method="m")
normalized.tail(3)
| USD Liquidity Index | SP500 | |
|---|---|---|
| date | ||
| 2024-07-31 | 0.643578 | 0.970490 |
| 2024-08-07 | 0.698835 | 0.885139 |
| 2024-08-14 | 0.687202 | 0.952750 |
import pandas as pd
pd.options.plotting.backend = "plotly"
normalized.plot()
fig = go.Figure()
fig.add_scatter(
x=normalized.index, y=normalized["USD Liquidity Index"], name="USD Liquidity Index"
)
fig.add_scatter(x=normalized.index, y=normalized["SP500"], name="S&P 500 Index")
fig.update_layout(
title="USD Liquidity Index vs. S&P 500 Index (Normalized)",
title_y=0.90,
title_x=0.5,
autosize=True,
)