Skip to main content

Python SDK for the TickerDB financial data API

Project description

TickerDB Python SDK

PyPI version Python versions

The official Python SDK for TickerDB -- financial data and market intelligence API.

  • Sync and async clients
  • Full type hints for IDE autocompletion
  • Typed exceptions for every error class
  • Rate limit information on every response

Full API documentation: https://tickerdb.com/docs

Installation

pip install tickerdb

Quick Start

Synchronous

from tickerdb import TickerDB

client = TickerDB("your_api_key")

# Get a ticker summary
result = client.summary("AAPL")
print(result["data"])

# Rate limit info is included on every response
print(result["rate_limits"]["requests_remaining"])

Asynchronous

import asyncio
from tickerdb import AsyncTickerDB

async def main():
    async with AsyncTickerDB("your_api_key") as client:
        result = await client.summary("AAPL")
        print(result["data"])

asyncio.run(main())

Endpoints

Summary

Get a detailed summary for a single ticker.

result = client.summary("AAPL")
result = client.summary("AAPL", timeframe="weekly")
result = client.summary("AAPL", date="2025-01-15")

Summary with Date Range

Get a summary series for one ticker across a date range by passing start and end.

result = client.summary("AAPL", start="2025-01-01", end="2025-03-31")
result = client.summary("AAPL", timeframe="weekly", start="2024-01-01", end="2025-03-31")

Summary with Events Filter

Query event occurrences for a specific band field.

result = client.summary("AAPL", field="rsi_zone", band="deep_oversold")

Watchlist

Post a list of tickers to get watchlist data.

result = client.watchlist(["AAPL", "MSFT", "TSLA"])
result = client.watchlist(["AAPL", "MSFT"], timeframe="weekly")

Watchlist Changes

Get field-level state changes for your saved watchlist tickers since the last pipeline run.

result = client.watchlist_changes()
result = client.watchlist_changes(timeframe="weekly")

Band Stability Metadata

Every band field (trend direction, momentum zone, etc.) now includes a sibling _meta object with stability context. This tells you how long a state has been held, how often it has flipped recently, and an overall stability label.

result = client.summary("AAPL")
data = result["data"]

# The band value itself
print(data["trend"]["direction"])          # "uptrend"

# Stability metadata for that band
print(data["trend"]["direction_meta"])
# {"stability": "established", "periods_in_current_state": 18, "flips_recent": 1, "flips_lookback": 20}

# Type hints available
from tickerdb import Stability, BandMeta

Stability is one of "fresh", "holding", "established", or "volatile". BandMeta contains the full metadata dict. Stability metadata is available on Plus and Pro tiers only.

Stability context also appears in Watchlist Changes, which include stability fields for each changed band.

Query Builder

The SDK includes a fluent query builder for searching assets by categorical state. Chain methods in order: select, filters, sort, limit.

results = client.query() \
    .select('ticker', 'sector', 'momentum_rsi_zone') \
    .eq('momentum_rsi_zone', 'oversold') \
    .eq('sector', 'Technology') \
    .sort('extremes_condition_percentile', 'asc') \
    .limit(10) \
    .execute()

Error Handling

The SDK raises typed exceptions for all API errors:

from tickerdb import TickerDB, TickerDBError, RateLimitError, NotFoundError

client = TickerDB("your_api_key")

try:
    result = client.summary("INVALID_TICKER")
except NotFoundError as e:
    print(f"Ticker not found: {e.message}")
except RateLimitError as e:
    print(f"Rate limited! Resets at: {e.reset}")
    print(f"Upgrade: {e.upgrade_url}")
except TickerDBError as e:
    print(f"API error [{e.status_code}]: {e.message}")

Exception Hierarchy

Exception Status Code Description
TickerDBError any Base exception for all API errors
AuthenticationError 401 Invalid or missing API key
ForbiddenError 403 Endpoint restricted to higher tier
NotFoundError 404 Asset not found
RateLimitError 429 Rate limit exceeded
DataUnavailableError 503 Data temporarily unavailable

All exceptions include status_code, error_type, message, and optionally upgrade_url and reset attributes.

Rate Limits

Every response includes a rate_limits dict parsed from the API headers:

result = client.summary("AAPL")
limits = result["rate_limits"]

print(limits["request_limit"])           # Total request limit
print(limits["requests_remaining"])      # Requests remaining
print(limits["request_reset"])           # Reset timestamp
print(limits["hourly_request_limit"])    # Hourly limit
print(limits["hourly_requests_remaining"])  # Hourly remaining

Links

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

tickerdb-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

tickerdb-0.1.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file tickerdb-0.1.1.tar.gz.

File metadata

  • Download URL: tickerdb-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for tickerdb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 655ad58798dc94ddac72d41499493c2f42b126d0021725f79c256347a36e7c2c
MD5 bed6af4c6310e34241c6a09c86b7f18a
BLAKE2b-256 e5fa62664e1c877278772e287f5b87432ba80891b31d29087a045a1f10e31a0e

See more details on using hashes here.

File details

Details for the file tickerdb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tickerdb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for tickerdb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4ff7396e98cbfdb0218f2bc17ca0a2b2ddcf8613d3f6424210ef1088501ba50
MD5 7f062b54b5e3352417b3cd0dbed4e983
BLAKE2b-256 5662ef0f8688d44fa25050af43582fbcd2748caeabe2c5bec9ba4ce23104637c

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