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.1.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.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: halalterminal-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 6b18ac9faa800aeed1f4493749de16181f84b358ee44f25e57fae6fcc0af50e1
MD5 acf72f0a7e923b9bf016c9f1b781b27a
BLAKE2b-256 1ab5fe857c7498fd2935a235d48580c876274a095d9b0503a734d13990635ddc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: halalterminal-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fcf5ccae921f9366438820ecff8e42ac685f3ab8eae47126335c30096faf3598
MD5 c25690ed11e33c07bc42b2f8f66a6ce3
BLAKE2b-256 caf142fea54a987b8bdd92c29c0a45b8ab1c3d3875d96bf25079ddbe4ff9299a

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