py-ftmarkets
Financial Times (markets.ft.com) data source for Python. Provides a high-level API and CLI to search for securities, fetch historical data, and validate prices.
Installation
uv add py-ftmarkets
# or
pip install py-ftmarkets
CLI Usage
The package provides a CLI tool named ftmarkets.
Lookup a Security
Resolve an ISIN or Symbol to the Financial Times symbol format (e.g., AAPL:NSQ).
# Basic lookup by ISIN
ftmarkets lookup --isin DE000A0S9GB0
# Lookup with price and date validation (Returns 1 best matching security)
ftmarkets lookup --isin DE000A0S9GB0 --price 117.81 --date 2025-12-12 --limit 1
# Lookup with filters (currency, country, asset-class)
ftmarkets lookup --isin DE000A0S9GB0 --currency EUR --country DE --asset-class ETF
# Return all matching results in JSON format
ftmarkets lookup --isin DE000A0S9GB0 --limit 0 --format json
Fetch History and Validate
Fetch historical data for a resolved security and optionally validate a trade price on a specific date.
# Fetch 1 month of history for an ISIN
ftmarkets history --isin DE000A0S9GB0
# Fetch 1 year of history and validate a price
ftmarkets history --isin DE000A0S9GB0 --period 1y --price 120.50 --date 2025-01-15
Library Usage
py-ftmarkets implements the DataSource interface from pydantic-market-data.
from ftmarkets.api import FTDataSource
from pydantic_market_data.models import SecurityCriteria
source = FTDataSource()
# Resolve a security
criteria = SecurityCriteria(isin="DE000A0S9GB0")
security = source.resolve(criteria)
print(f"Symbol: {security.symbol}")
# Fetch history
history = source.history(security.symbol, period="1mo")
df = history.to_pandas()
print(df.tail())
# Validate price
is_valid = source.validate(security.symbol, target_date="2025-01-15", target_price=120.50)
print(f"Price valid: {is_valid}")
Features
- Robust Resolution: Searches by ISIN, Symbol, or Description.
- Smart Mapping: Prioritizes results based on preferred exchanges and currency.
- Price Validation: Verifies if a security traded within a range or near a specific price on a given date.
- Pandas Integration: Historical data is easily convertible to Pandas DataFrames.
- Modern Python: Built with Pydantic v2 and async-ready architecture (though currently synchronous).
Metadata
Release files for py-ftmarkets 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_ftmarkets-0.5.1.tar.gz | 26.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_ftmarkets-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.8 kB
Release files / py_ftmarkets-0.5.1.tar.gz
| Download URL | py_ftmarkets-0.5.1.tar.gz |
|---|---|
| Size | 26.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c80cec82040e4f634bdc3769d2113c6341a5f1f1b240a0d49ffe84ca7d57a61
|
|
BLAKE2b-256 checksum How to use checksums |
f771d8c2b8e7527ec6aa4759d72f6a09fe1fbb8ee0d266309b0d18a0c5510ca5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","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}
|
Release files / py_ftmarkets-0.5.1-py3-none-any.whl
| Download URL | py_ftmarkets-0.5.1-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d05e0ad93042edcca1352ea0a0b6351ecd5ca3ee4d984d2c541e03278b63ddd
|
|
BLAKE2b-256 checksum How to use checksums |
b02ee8371ed8d403a8fa49ee800d9e185f69b238eb2d9ef0b30178ec22925421
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","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}
|