Skip to main content

clarifindata — Python client

Python client for the 金晰數據 / clarifindata Taiwan-stock data API (83 datasets: prices, chips, fundamentals, derivatives, macro — full history, refreshed daily).

pip install clarifindata            # core
pip install 'clarifindata[pandas]'  # + DataFrame output (as_df=True)
pip install 'clarifindata[all]'     # + pandas + HTTP/2

Quickstart

from clarifindata import Client, datasets

cfd = Client(api_key="cfd_demo_free_0001")          # free demo key

# typed dataset names (autocomplete + typo-safe), DataFrame output
df = cfd.get(datasets.TaiwanStockPrice, stock_id="2330",
             start="2026-04-01", end="2026-06-03", as_df=True)
print(df.head())

Demo keys (rate-limited, for trying out): cfd_demo_free_0001 (Free), cfd_demo_lite_0001 (Lite). Get your own at https://clarifindata.com/signup.

Features

What How
Auto-retry 429/5xx/timeouts (honours Retry-After, exp backoff) on by default; tune max_retries, backoff_base
Rate-limit aware cfd.rate_limit_remaining; warns at 80% used
DataFrame output cfd.get(..., as_df=True)
Full-history streaming (auto-paginates the 10 000-row cap) cfd.iter_history(ds, stock_id=..., since="2015-01-01")
Async / concurrency AsyncClient (same surface)
Multi-dataset pull cfd.bulk_pull([...], start=, end=)
Disk cache (for slow-changing datasets) Client(cache_dir="./.cache", cache_ttl=86400)
Typed errors w/ suggestions ClarifindataError(dataset, status, detail, suggestion)
Logging logging.getLogger("clarifindata") (DEBUG = request/response)

Full history (any range, no manual chunking)

for batch in cfd.iter_history(datasets.TaiwanStockPrice, stock_id="2330", since="2015-01-01"):
    process(batch)                                  # one year per batch, streamed

df = cfd.history(datasets.TaiwanStockPrice, stock_id="2330", since="2015-01-01", as_df=True)

Concurrency (fetch many stocks)

import asyncio
from clarifindata import AsyncClient, datasets

async def main():
    async with AsyncClient(api_key="...") as cfd:
        tasks = [cfd.get(datasets.TaiwanStockPrice, stock_id=s, as_df=True)
                 for s in ("2330", "2317", "2454")]
        return await asyncio.gather(*tasks)

frames = asyncio.run(main())

Natural-language queries (Plus tier)

ans = cfd.ask("找出 2330 在 2026 年 4 月最高收盤價那天", as_df=True)

Errors

from clarifindata import TierError, RateLimitError, ValidationError
try:
    cfd.get("TaiwanStockPirce")          # typo
except ValidationError as e:
    print(e)        # Unknown dataset 'TaiwanStockPirce'. Did you mean 'TaiwanStockPrice'? ...

Metadata

Release files for clarifindata 0.2.8

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

Source distribution (sdist)

Source distribution for clarifindata 0.2.8
File Size Uploaded
clarifindata-0.2.8.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clarifindata 0.2.8
File Interpreter ABI Platform
clarifindata-0.2.8-py3-none-any.whl Python 3 none any Details

Total release size: 23.6 kB

Release files / clarifindata-0.2.8.tar.gz

Download URL clarifindata-0.2.8.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
269cb6898fe7257ac9d2329b9cc04841693e365b0bc2a1cac5f13e6f845c81db
BLAKE2b-256 checksum
How to use checksums
da7523e779f11ccc5b8cc5ebc9f9611e50ac9968182d0adf4e281c69791b7621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / clarifindata-0.2.8-py3-none-any.whl

Download URL clarifindata-0.2.8-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88ba1210a308e5ad91868fe61b5a4f923af41db020319a3b5ebf764dbad532aa
BLAKE2b-256 checksum
How to use checksums
9426c93cedfb0734d080488aea09dd7fde75e9f1fef86d6f505524f6269cfd1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.8 This release

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

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