Skip to main content

Financial Times (markets.ft.com) data source for Python

Project description

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

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

py_ftmarkets-0.3.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

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

py_ftmarkets-0.3.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file py_ftmarkets-0.3.0.tar.gz.

File metadata

  • Download URL: py_ftmarkets-0.3.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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 py_ftmarkets-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b612104d19def5e4cfb10a7f021b11ca707eff866c6b038a3f53c45e4a5e4929
MD5 eb85cd192651328cdddc6c0603856775
BLAKE2b-256 8e2a8cf4bd9850af5ca85d7fe35b68451da25e52c1e026256e29d51e14b2a815

See more details on using hashes here.

File details

Details for the file py_ftmarkets-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: py_ftmarkets-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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 py_ftmarkets-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc8346d0ab878d133465acad49b507f9fa0b4234dd26a42ec191209fef7ca37b
MD5 f5788930b9185d3d979469bd9d520c29
BLAKE2b-256 361dfd8d7dc0da9ea80de2baf42dc8c6b3344bebfbe4af9caa4aad0c6e648b40

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