Skip to main content

halalterminal — Python SDK

Official Python client for the Halal Terminal API — Shariah stock screening across 5 audited methodologies (AAOIFI, DJIM, FTSE, MSCI, S&P), real-time market data, ETF look-through analysis, zakat & purification calculators.

Install

pip install halalterminal

Python ≥ 3.9, single runtime dependency (requests).

Quickstart

from halalterminal import Client

ht = Client(api_key="ht_…")          # or set HALAL_TERMINAL_API_KEY

# Screen a stock — works on 10,000+ tickers
aapl = ht.screen("AAPL")
print(aapl.is_compliant, aapl.compliance_explanation)

# Every relevant response carries typed disclaimers — render them in your UI
for d in aapl.disclaimers:
    print(f"[{d.severity}] {d.text}  ({d.url})")

Need a free API key? POST https://api.halalterminal.com/api/keys/generate with {"email": "you@example.com"} — no credit card.

Typed endpoints

quote     = ht.get_quote("MSFT")
portfolio = ht.scan_portfolio(["AAPL", "MSFT", "JNJ", "BAC"])
zakat     = ht.calculate_zakat(
    holdings=[{"symbol": "AAPL", "market_value": 25_000}],
    gold_price_per_gram=65.0,
)
disclaimers = ht.get_disclaimers()    # public registry, no API key required

Each call returns a frozen dataclass with the most-used fields promoted to attributes, plus a .raw dict for everything else.

Generic escape hatch

The API surfaces 60+ endpoints. For anything not wrapped in a typed method:

trending = ht.get("/api/trending")
report   = ht.post("/api/reports/portfolio", json={"symbols": ["AAPL", "MSFT"]})

Error handling

from halalterminal import ApiKeyError, QuotaExceededError, NotFoundError

try:
    ht.screen("NOTAREALTICKER")
except NotFoundError:
    ...
except QuotaExceededError as e:
    # e.detail carries the upgrade hint
    ...
except ApiKeyError:
    ...

Disclaimers

Every compliance / market-data / zakat / purification response carries a disclaimers: list[Disclaimer]. Each disclaimer is versioned, severity-tagged (religious for fatwa caveats, data for freshness/sourcing), and deep-links to a specific section on the Halal Terminal legal page. Show them inline — the API ships your compliance copy for you.

for d in aapl.disclaimers:
    print(d.id, d.version, d.severity, d.url)

License

MIT. © Halal Terminal.

Release files for halalterminal 0.1.1

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

Source distribution (sdist)

Source distribution for halalterminal 0.1.1
File Size Uploaded
halalterminal-0.1.1.tar.gz 10.4 kB Details

Built distribution (wheel)

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

Total release size: 19.5 kB

Release files / halalterminal-0.1.1.tar.gz

Download URL halalterminal-0.1.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6b18ac9faa800aeed1f4493749de16181f84b358ee44f25e57fae6fcc0af50e1
BLAKE2b-256 checksum
How to use checksums
1ab5fe857c7498fd2935a235d48580c876274a095d9b0503a734d13990635ddc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / halalterminal-0.1.1-py3-none-any.whl

Download URL halalterminal-0.1.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcf5ccae921f9366438820ecff8e42ac685f3ab8eae47126335c30096faf3598
BLAKE2b-256 checksum
How to use checksums
caf142fea54a987b8bdd92c29c0a45b8ab1c3d3875d96bf25079ddbe4ff9299a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

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