Skip to main content

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 ftmarkets CLI is built on treaty and needs Python 3.14 and the cli extra. The library itself still supports Python 3.10 and later; on an older Python, or without the extra, ftmarkets exits 1 and says how to install it.

uv tool install --python 3.14 "py-ftmarkets[cli]"
# or, in a Python 3.14 environment
pip install "py-ftmarkets[cli]"

--format takes plain (the default on a terminal), json (the full response envelope with ok, data, error, warnings, and meta; the default when piped), jsonl, ndjson, and tsv. -v and -vv show info and debug logs on stderr. ftmarkets <command> --help lists the flags and --schema the input and output schemas.

Exit codes: 0 success, 2 invalid arguments (nothing ran), 5 security or history not found, 79 the price check failed (history --price).

Lookup a Security

Resolve an ISIN or Symbol to the Financial Times symbol format (e.g., AAPL:NSQ). Results keep FT's relevance order; --limit defaults to 1 and --limit 0 returns every match.

# Basic lookup by ISIN
ftmarkets lookup --isin DE000A0S9GB0

# Keep only matches that traded near a price on a date (--price needs --date)
ftmarkets lookup --isin DE000A0S9GB0 --price 117.81 --date 2025-12-12

# Lookup with filters (currency, country, asset class or FT security type, exchange)
ftmarkets lookup --isin DE000A0S9GB0 --currency EUR --country DE --asset-class ETF

# Every match as a JSON envelope; the securities are in .data
ftmarkets lookup --isin DE000A0S9GB0 --limit 0 --format json

# Every match as a table
ftmarkets lookup --isin DE000A0S9GB0 --limit 0 --format tsv

Fetch History and Validate

Fetch historical data for a resolved security and optionally validate a trade price on a specific date. The result holds the resolved security, its history (candles in ascending date order), and validated (true when the price matched, null without --price).

# Fetch 1 month of history for an ISIN
ftmarkets history --isin DE000A0S9GB0

# Fetch 1 year of history and validate a price; exits 79 (PRICE_MISMATCH) when it does not match
ftmarkets history --isin DE000A0S9GB0 --period 1y --price 120.50 --date 2025-01-15 --format json

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.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-ftmarkets 0.6.0
File Size Uploaded
py_ftmarkets-0.6.0.tar.gz 31.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-ftmarkets 0.6.0
File Interpreter ABI Platform
py_ftmarkets-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.9 kB

Release files / py_ftmarkets-0.6.0.tar.gz

Download URL py_ftmarkets-0.6.0.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
75a25f55f1e4821def0cd7f7483470f19fcd6834577944b3d199d4b27a7ae2ce
BLAKE2b-256 checksum
How to use checksums
09cb3d7e57008122420d57cf456e144fcddb41f20f03e1b467aca8440b6ab349
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.6.0-py3-none-any.whl

Download URL py_ftmarkets-0.6.0-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3abee129960674c73aca98ca431364e5b4cca51ec727aaa670590489ae36ab4e
BLAKE2b-256 checksum
How to use checksums
6a24a5bc1d778debfb546c0bf1a2b5349612723628283fe84030781be83f2421
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 history Release notifications | RSS feed

0.8.0

2 release files

0.7.0

2 release files

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page