ofm-rebalancing-flow
by fmadzharov
README.md
# Rebalancing Flow — Public API Client, Agent Skills & Read-Only MCP Server
[](https://glama.ai/mcp/servers/fmadzharov/ofmcapital-rebalancing-flow-public)
Public developer kit for [**Rebalancing Flow**](https://rebalancingflow.ofmcapital.com/) by [**OFM Capital**](https://ofmcapital.com/) (OFM Capital Partners, Sofia, Bulgaria · founded 2012 · LEI [`2549009QAP6LUK11FL26`](https://lei.bloomberg.com/leis/view/2549009QAP6LUK11FL26)), built by founder and portfolio manager **Filip Madzharov, CAIA** and the OFM Capital desk.
Rebalancing Flow tracks day-by-day reported holdings changes across **15 US-listed preferred-stock ETFs** (`PFF`, `PGX`, `FPE`, `PFFA`, `PFFD`, `PFXF`, `VRP`, `PGF`, `PFFV`, `SPFF`, `FPEI`, `PSK`, `PREF`, `PFFR`, `EPRF`), exposing a **free, read-only, no-API-key JSON API** (`https://rebalancingflow.ofmcapital.com/openapi.json`).
> **Scope of this repository:** This repository contains **public client code, agent instructions (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `SKILL.md`), a read-only MCP server wrapper, a Google Colab notebook, OpenAPI specs, and an OFM-derived summary sample CSV (tickers and OFM IDs only, no CUSIPs/ISINs)**. It does not contain private infrastructure, scrapers, or trading strategies.
---
## 5 Questions You Can Answer in 10 Seconds
> **Note on `User-Agent`, compression & rate limits:** Always send an identifying `User-Agent` header (e.g., `OFM-RebalancingFlow-Client/1.0`) and `Accept-Encoding: gzip`. Default `Python-urllib` user-agents receive HTTP `403` (edge code `1010`) on HTML pages (`/`, `/etfs/*`, `/instruments/*`, `/how-it-works`), whereas JSON API endpoints (`/api/desk/*`) enforce burst throttling (`429` with `Retry-After`) and return `503` with `Retry-After` while a publication refreshes. The bundled Python client and MCP server handle gzip decompression and `Retry-After` backoff automatically.
### 1. Which preferred-stock ETFs are tracked and what is their latest holdings date?
```bash
curl -sS -A "OFM-RebalancingFlow-Client/1.0" \
"https://rebalancingflow.ofmcapital.com/api/desk/meta" | jq '.etfs[] | {symbol, issuer, latest: .dates[0]}'
```
### 2. What changed in `PFF` on the most recent holdings date?
```bash
curl -sS -A "OFM-RebalancingFlow-Client/1.0" \
"https://rebalancingflow.ofmcapital.com/api/desk/activity?etf=PFF&limit=10"
```
### 3. Which preferred-stock ETFs currently hold a specific preferred stock (e.g. `BAC` series)?
```bash
curl -sS -A "OFM-RebalancingFlow-Client/1.0" \
"https://rebalancingflow.ofmcapital.com/api/desk/instruments?q=BAC&limit=10"
```
### 4. What were the largest estimated flow-adjusted net increases and decreases over a period (example: Nov 2026)?
```bash
curl -sS --compressed -A "OFM-RebalancingFlow-Client/1.0" \
"https://rebalancingflow.ofmcapital.com/api/desk/period?start=2026-11-01&end=2026-11-27"
```
*(Period rankings report OFM's flow-adjusted choice estimates for exchange-listed securities separately from `$1,000`-par `otc` changes.)*
### 5. What is today's cross-ETF daily brief across all 15 funds?
```bash
curl -sS -A "OFM-RebalancingFlow-Client/1.0" \
"https://rebalancingflow.ofmcapital.com/api/desk/brief"
```
---
## Python Quickstart (Zero External Dependencies)
```python
from examples.rebalancing_flow_client import RebalancingFlowClient
client = RebalancingFlowClient()
meta = client.meta()
print("Revision:", meta["revision"], "| Expected date:", meta["expected_date"])
brief = client.brief()
print("Latest cross-ETF brief day:", brief["day"], "| Funds compared:", brief["funds_compared"])
print("Brief cite:", client.brief_citation_url(brief["day"]))
pff = client.activity(etf="PFF", limit=5)
print("PFF day:", pff["day"], "| Decreases:", pff["decrease_count"], "| Increases:", pff["increase_count"])
print("Cite:", client.etf_citation_url("PFF", pff["day"])) # includes &tab=changes
```
Run the built-in CLI demo:
```bash
python examples/rebalancing_flow_client.py
```
---
## Use with AI Coding & Research Agents
| Ecosystem | How to connect | File in this repo |
|---|---|---|
| **OpenAI Codex** | Clone repo or copy skill into `.agents/skills/` | [`AGENTS.md`](AGENTS.md), [`.agents/skills/ofm-rebalancing-flow/SKILL.md`](.agents/skills/ofm-rebalancing-flow/SKILL.md) |
| **Claude Code / Claude Desktop** | Copy skill into `.claude/skills/` or register MCP server | [`CLAUDE.md`](CLAUDE.md), [`.claude/skills/ofm-rebalancing-flow/SKILL.md`](.claude/skills/ofm-rebalancing-flow/SKILL.md) |
| **Google Antigravity & Gemini CLI** | `gemini extensions install <repo-url>` or register MCP server | [`GEMINI.md`](GEMINI.md), [`gemini-extension.json`](gemini-extension.json) |
| **Any MCP Client** | Run `python mcp-server/ofm_rebalancing_flow_mcp.py` (stdio) | [`mcp-server/ofm_rebalancing_flow_mcp.py`](mcp-server/ofm_rebalancing_flow_mcp.py), [`mcp-server/server.json`](mcp-server/server.json) |
### Read-Only MCP Server (Zero Dependencies)
This repository includes `.mcp.json` for project-local MCP discovery (configured with `python` for Windows/cross-platform portability; use `python3` on macOS/Linux if `python` is not on your `PATH`) and replace `/ABS/PATH/TO/ofmcapital-rebalancing-flow-public` with your local clone path for global configs.
**Claude Desktop / Cursor / Antigravity (JSON):**
```json
{
"mcpServers": {
"ofm-rebalancing-flow": {
"command": "python",
"args": ["/ABS/PATH/TO/ofmcapital-rebalancing-flow-public/mcp-server/ofm_rebalancing_flow_mcp.py"]
}
}
}
```
**OpenAI Codex (`~/.codex/config.toml`):**
```toml
[mcp_servers.ofm-rebalancing-flow]
command = "python"
args = ["/ABS/PATH/TO/ofmcapital-rebalancing-flow-public/mcp-server/ofm_rebalancing_flow_mcp.py"]
```
Tools exposed (100% read-only, User-Agent `OFM-RebalancingFlow-MCP/1.1`, strict public field allowlists — zero CUSIPs/ISINs/SEDOLs):
- `list_etfs` — Lists all 15 tracked preferred-stock ETFs, issuers, latest dates, date verification, freshness status, and full publication `revision`.
- `get_etf_changes` — Daily reported holdings increases, decreases, additions, removals, and `coverage` (`on_selected_date`, `latest_available_date`, `prior_date`, `date_verification`, `freshness_status`) with an explicit `no_filing_on_requested_date` warning when no filing exists on the requested date.
- `find_instrument` — Search preferred stocks and baby bonds by ticker or issuer and inspect compact cross-ETF holdings (OFM IDs, vetted tickers, OpenFIGI where available).
- `get_period_summary` — Multi-day/monthly `flow_adjusted_choice_estimate` rankings, separate `$1,000`-par `otc` summary, investor flows, exits, and date-verification notes.
- `get_daily_brief` — Cross-ETF daily summary across all 15 preferred-stock ETFs (citing `/?date=YYYY-MM-DD`).
Every MCP tool response (including errors) embeds an explicit `citation_url` (`/?date=...` for daily briefs, `/etfs/<SYM>?date=...&tab=changes` for ETF changes) and methodology caveat.
---
## Interactive Notebook & OFM-Derived Sample CSV
- **Jupyter / Google Colab Notebook:** [`notebooks/pff_vs_pgx_overlap.ipynb`](notebooks/pff_vs_pgx_overlap.ipynb) — Compares `PFF` vs `PGX` holdings overlap on their latest common holdings date and lists top current-month flow-adjusted choice estimates using the live API with gzip and `Retry-After` handling.
- **OFM-Derived Sample CSV:** [`data/sample_derived_changes_2026_11.csv`](data/sample_derived_changes_2026_11.csv) — Derived top November 2026 flow-adjusted choice estimates pinned to a recorded `dataset_revision`, `compared_through_date`, `date_verification`, and `metric_basis` using OFM `instrument_id` and ticker labels only (zero third-party CUSIPs, ISINs, SEDOLs, or raw issuer holdings files).
---
## Methodology, Licensing & Disclaimers
- **Holdings diffs, not trade records:** A change in a holding is the difference between two published issuer holdings files, **not proof of an executed market trade**. Holdings also change from ETF share creations/redemptions, issuer redemptions/calls, corporate actions, or issuer file corrections.
- **Keep data-quality flags:** Always preserve `date_basis`, `date_verification`, `date_notes`, `quantity_unit`, and `null` (which means unavailable, never zero) when quoting Rebalancing Flow data.
- **Not investment advice:** Published strictly for factual market-structure research. Nothing here or on Rebalancing Flow is investment advice, a recommendation, or an offer of any kind.
- **Licensing:**
- Client code, MCP server, notebook, and skills in this repository: **MIT License** ([`LICENSE`](LICENSE)).
- OFM Capital's derived analysis, methodology text, and derived summary tables: **CC BY 4.0** (`https://creativecommons.org/licenses/by/4.0/`). Issuer raw holdings files belong to their respective fund issuers.
- **Citation:** `OFM Capital, Rebalancing Flow, https://rebalancingflow.ofmcapital.com/` (see [`CITATION.cff`](CITATION.cff)).
---
## About OFM Capital
**OFM Capital** (legal name **OFM Capital Partners**, LEI `2549009QAP6LUK11FL26`) is an independent proprietary trading desk in Sofia, Bulgaria, trading US fixed income (preferred stocks, baby bonds, perpetuals, corporate bonds, Treasuries) and US equities (including CEFs, BDCs, and mREITs) exclusively with its own capital since 2012.
- Website: [ofmcapital.com](https://ofmcapital.com/)
- Research archive: [ofmcapital.com/research/](https://ofmcapital.com/research/)
- Open-source TradingView indicators: [ofmcapital.com/tools/](https://ofmcapital.com/tools/)
- Open roles (Sofia or remote EU — zero trader fees): [ofmcapital.com/careers/](https://ofmcapital.com/careers/)
- Contact: `operations@ofmcapital.com`