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",
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_market_data-0.1.9.tar.gz.
File metadata
- Download URL: pydantic_market_data-0.1.9.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab8c8dbbe327796f446fca7ecd3a4b49be1bfc4648f7745ce397c122be31fe15
|
|
| MD5 |
1e7f7c6d5c36c94ac5cdd29f307a1bbc
|
|
| BLAKE2b-256 |
9307ff750a659cb1b75e5409bfca03425dad07d7970594600ccc95f4dd3039ff
|
File details
Details for the file pydantic_market_data-0.1.9-py3-none-any.whl.
File metadata
- Download URL: pydantic_market_data-0.1.9-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee3ecc6cb8b5503136bc082d3b5d6c2e11d965329603791b269ab906064c0e8d
|
|
| MD5 |
ae69e76c13dda2f3f8008bd7e0900f3d
|
|
| BLAKE2b-256 |
1bcba4ce0cbb6735579e4744535771bab8a0c1185758aa6cfb1e8452b706b512
|