Skip to main content
Glama

nport

SEC Form N-PORT と Form N-CEN から構築され、GLEIF LEI レジスタに結合された、正規化されたファンド保有銘柄とサービスプロバイダーのグラフ。MCP 経由でエージェントに提供されます。

設計: docs/design.md. ソースデータに関する実証的メモ: docs/data-notes.md.

ステータス: インジェスト層のみ。 Raw 層と Parquet 層はエンドツーエンドでランディングされます。dbt トランスフォーム、MCP サーバー、Terraform はまだ構築されていません。

クイックスタート

uv sync
export SEC_USER_AGENT="Your Name your@email.com"   # the SEC throttles anonymous traffic

uv run nport-ingest periods nport    # what quarters are published upstream
uv run nport-ingest all              # N-PORT + N-CEN + GLEIF, latest available
uv run nport-ingest status           # what is landed, from the manifests

3 つのソースすべてのランディングには数分かかり、./data 配下に約 ~1 GB 書き込まれます。単一のソースまたは過去の四半期をランディングするには:

uv run nport-ingest land nport --period 2026q1
uv run nport-ingest land ncen --raw-only     # skip Parquet conversion
uv run nport-ingest land gleif --force       # re-download and re-convert

Related MCP server: civicgraph-mcp

ストレージ

NPORT_DATA_ROOT はすべての出力先を制御し、ローカルでの反復作業と ECS での実行との唯一の違いです。

export NPORT_DATA_ROOT=./data                 # default
export NPORT_DATA_ROOT=s3://my-bucket/nport   # needs the `s3` extra: uv sync --extra s3

レイアウトは、docs/design.md §2 に従う:

{root}/raw/{source}/{period}/{archive}.zip             original bytes, immutable
{root}/parquet/{table}/period={period}/data.parquet     zstd, all columns VARCHAR
{root}/parquet/_manifest/{source}/period={period}/
    manifest.json    source URL, raw SHA-256, per-table row counts
    schema.json      column names, types, descriptions and PKs, from the
                     CSVW sidecar the SEC ships inside each archive

ランディング済みの期間を再実行しても、--force が渡されない限り何も行われません。これにより、スケジュールからの再試行が安全になります。SEC が同じファイル名で四半期を再公開した場合、実行は、古いデータを黙って提供するのではなく、バイト数が変わったことを警告します。

インジェスト層の設計判断

すべての Parquet 列は VARCHAR です。 型付けは dbt staging/ で行うべきものです。ソースには型推論を壊す値が満ちています — 日付は 28-FEB-2026、数値は -.0091723714、数値列に N/A が現れる、など — したがって、ここで推論を行うと失敗するか、黙って型を強制することになり、生のバイトから再現可能でなければならない唯一の層にビジネスロジックを置くことになります。

ダウンロード URL は構築ではなく発見されます。 ほとんどの SEC アーカイブは {period}_{source}.zip に従いますが、いくつかの N-CEN 四半期は再公開後に 2025q1_ncen_0.zip として配信されました。インデックスページは href をスクレイピングし、従来のパターンをフォールバックとして使用します。

アーカイブ自体のスキーマメタデータが抽出されます。 両方の SEC ZIP には、テーブルごとの主キー、列タイプ、列の説明を宣言する CSVW *_metadata.json が含まれています。これは transform/ 内の粒度アサーションの信頼できる入力であるため、ZIP 内に残すのではなく schema.json として書き出されます。

レイアウト

src/nport/ingest/        fetch -> validate -> land as Parquet
    sources/             one module per upstream source
    convert.py           ZIP of delimited text -> Parquet, via DuckDB
    land.py              orchestration and manifests
    storage.py           URI addressing over fsspec (local or S3)
transform/               dbt project (dbt-duckdb)          [not built]
src/nport/server/        FastMCP server                    [not built]
evals/                   scored question set               [not built]
infra/                   Terraform                         [not built]

開発

uv run ruff check src/ && uv run ruff format src/
uv run pytest

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A 'Server of Servers' architecture that aggregates domain-specific financial data capabilities into a single governed interface. It enables users to access fund performance tools like returns, benchmark comparisons, and risk-adjusted metrics through a unified MCP-compliant gateway.
    -
  • A
    license
    A
    quality
    B
    maintenance
    An MCP server that wraps SEC EDGAR APIs to provide company financial data, screening metrics, and disclosure signals for investment diligence, with every figure traced to its source filing.
    8
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    MCP server that reconstructs hedge-fund/superinvestor portfolios from SEC EDGAR 13F filings, offering tools to query fund holdings, consensus activity, and quarter-over-quarter changes through a read-only API.
    4
    AGPL 3.0