02-data-models

02-data-models is a cursor rule for Cursor from juandoroteoflesiauni-lang/Market-options-stocks-Scanner. It costs 26 tokens per session (1,217 once invoked), scanned A, original, Apache-2.0.

Rules for defining financial and market data with Pydantic, a Python library that checks data as objects are created. The models must be read-only and include information about where each value came from and when it was recorded.

In plain words
What is it for?
Use it when creating or changing market snapshots and other data models that cross system stages, especially prices, volumes, timestamps and source records.
Why use it?
It helps reject incomplete, mutable or imprecise data before it reaches later parts of the trading system.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when creating or changing market snapshots and other data models that cross system stages, especially prices, volumes, timestamps and source records.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/juandoroteoflesiauni-lang/Market-options-stocks-Scanner

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 02-data-models

README.md
[![agentmods](https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models/github.svg)](https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models)
Your own site
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 02-data-models

Your own site · 80×15
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/02-data-models.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,217 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.01217
Opus 5 $0.00013 $0.00609
Sonnet 5 $0.00005 $0.00243
Haiku 4.5 $0.00003 $0.00122

Measured 11d ago against content hash b52d1345b932, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

02-data-models scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/02-data-models.mdc · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🏛️ DATA MODELING — GOBERNANZA FINOS CDM v3.0

PRINCIPIO FUNDAMENTAL

Todo dato que cruce una frontera de fase DEBE ser:

  1. Pydantic BaseModel con model_config = ConfigDict(frozen=True)
  2. Validado al construirse (Pydantic v2 lo hace automático)
  3. Con data_lineage: DataLineage obligatorio — NUNCA opcional
  4. Con exchange_timestamp en UTC timezone-aware

Un MarketSnapshot sin linaje es un "dato huérfano" → rechazado por cualquier motor Fase B/C.

PATRÓN BASE — MarketSnapshot

from pydantic import BaseModel, ConfigDict, Field, field_validator
from decimal import Decimal
from datetime import datetime

class DataLineage(BaseModel):
    model_config = ConfigDict(frozen=True)
    source: str                          # "fmp" | "massive" | "local"
    ingestion_latency_ms: int = Field(ge=0)
    raw_field_count: int = Field(ge=0)

class MarketSnapshot(BaseModel):
    model_config = ConfigDict(frozen=True)
    ticker: str
    exchange: str
    price: Decimal = Field(ge=Decimal("0"))  # ← Decimal, nunca float
    volume: int = Field(ge=0)
    exchange_timestamp: datetime             # ← debe ser UTC aware
    data_lineage: DataLineage                # ← JAMÁS Optional

    @field_validator("ticker")
    @classmethod
    def ticker_uppercase(cls, v: str) -> str:
        return v.upper().strip()

    @field_validator("exchange_timestamp")
    @classmethod
    def must_be_utc(cls, v: datetime) -> datetime:
        if v.tzinfo is None:
            raise ValueError("exchange_timestamp debe ser UTC aware")
        return v

MODELOS DERIVADOS — Herencia correcta

# ✅ CORRECTO — extiende sin debilitar el contrato
class EnrichedSnapshot(MarketSnapshot):
    vpin_score: float
    ofi_score: float
    # frozen=True heredado automáticamente

# ❌ PROHIBIDO — debilita el tipo de precio
class BadSnapshot(MarketSnapshot):
    price: float           # Tipo más débil → RECHAZAR

# ❌ PROHIBIDO — hace el linaje opcional
class IncompleteSnapshot(MarketSnapshot):
    data_lineage: DataLineage | None = None  # RECHAZAR

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 146 lines · 1,217 tokens per session scan A b52d1345b932

Subscribe to this mod's changes

02-data-models is a cursor rule published in the GitHub repository juandoroteoflesiauni-lang/Market-options-stocks-Scanner (11 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 26 tokens to every session and 1,217 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other cursor rules, from other repositories