Skip to main content

Shared models and interfaces for finance datasources

Project description

pydantic-market-data

Shared Pydantic models and interfaces for financial data sources. Defines a standard contract (DataSource) and data structures (OHLCV, Symbol, History) to interoperability between finance packages.

Installation

pip install pydantic-market-data

Usage

Models

Standardized data models for financial entities.

from pydantic_market_data.models import Symbol, OHLCV, History, SecurityCriteria

# Symbol Definition
s = Symbol(
    ticker="AAPL",
    name="Apple Inc.",
    exchange="NASDAQ",
    currency="USD"
)

# Historical Data Point
candle = OHLCV(
    date="2023-12-01",
    open=150.0,
    high=155.0,
    low=149.0,
    close=154.0,
    volume=50000000
)

# Security Lookup Criteria
criteria = SecurityCriteria(
    symbol="AAPL",
    preferred_exchanges=["NASDAQ"],
    target_date="2023-12-01"
)

Protocol

Implement the DataSource protocol to create compatible data providers.

from typing import Optional, List
from pydantic_market_data.interfaces import DataSource
from pydantic_market_data.models import SecurityCriteria, Symbol, History

class MySource(DataSource):
    def resolve(self, criteria: SecurityCriteria) -> Optional[Symbol]:
        # Implementation...
        pass

    def history(self, ticker: str, period: str = "1mo") -> History:
        # Implementation...
        pass

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_market_data-0.1.2.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_market_data-0.1.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_market_data-0.1.2.tar.gz.

File metadata

  • Download URL: pydantic_market_data-0.1.2.tar.gz
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_market_data-0.1.2.tar.gz
Algorithm Hash digest
SHA256 286c531965333cf9fa45c1c1c95fdf50ebc0480c3f054fdfd61a2e35bbeeb207
MD5 ed274dc3bdba5dd6fbe298a20f24f568
BLAKE2b-256 6a7cfca5b2c1d56e63d9dc89e47dc1b0ede00b6f1e10f722d5c0dc11c5b971b6

See more details on using hashes here.

File details

Details for the file pydantic_market_data-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pydantic_market_data-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pydantic_market_data-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97fad505e7691f6f3f9fdf81e37d9e2d67fc506fe400dfc84b4d876988d9e6c7
MD5 13914ba64fefc02c8196fc6b4bbe69ab
BLAKE2b-256 06e240850826ee593742deb2ee7c9ad76b1297ac962b0035dcf55c50af705daa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page