Skip to main content

Official Python SDK for the Halal Terminal API — Shariah stock screening, market data, zakat & purification calculators.

Project description

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.

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

halalterminal-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

halalterminal-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file halalterminal-0.1.0.tar.gz.

File metadata

  • Download URL: halalterminal-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for halalterminal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da8660f8009becc0a30b0a6d9fc46d7603e7db2a4b950c8ed5a117a8b775ea50
MD5 ffac52eec1f33f66a90c7c6e905cf624
BLAKE2b-256 fc794910e94a6ef28de355d38cfd1a6e8138368e8173b4ec91b9e7b1b75b4db1

See more details on using hashes here.

File details

Details for the file halalterminal-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: halalterminal-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for halalterminal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 321d52cbf6a73f368027fe555b4b438fcb7ab8b47eb01c7025ff6cdd261c2996
MD5 e38f5b1cf11d5b6af7869aff2e8ba2f1
BLAKE2b-256 42033543628b115db405f006d172b52d74e409603df2e5afc9eb8a93563e011d

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