Skip to main content

Official Haruspex SDK. Stock intelligence scores (0-100) across 16 dimensions.

Project description

haruspex-sdk

Official Python SDK for the Haruspex API. Stock intelligence scores (0–100) across 16 dimensions, with outlook, trading signal, history, search, and news.

pip install haruspex-sdk

Python 3.9+. Built on httpx and pydantic v2. Both sync and async clients ship in the same package.

Quickstart

import os
from haruspex import Haruspex

client = Haruspex(api_key=os.environ.get("HARUSPEX_API_KEY"))

aapl = client.scores.get("AAPL")
print(f"{aapl.symbol}: {aapl.score}/100 ({aapl.outlook})")
print(f"Rate-limit remaining: {aapl.meta.rate_limit.remaining}")

Async:

import asyncio
from haruspex import AsyncHaruspex

async def main():
    async with AsyncHaruspex() as client:
        scores = await client.scores.batch(["AAPL", "NVDA", "MSFT"])
        for s in scores.scores:
            print(s.symbol, s.score, s.outlook)

asyncio.run(main())

Every response carries a .meta accessor with request_id, credits_remaining, and rate_limit, so you can observe credit/rate headroom without a separate request.

API

Haruspex(api_key=None, base_url=..., timeout=10.0, max_retries=2)

If api_key is omitted, reads HARUSPEX_API_KEY from the environment. Throws HaruspexValidationError if neither is present.

AsyncHaruspex exposes the same constructor and methods as async coroutines.

Methods

Method Returns
client.scores.get(symbol) ScoreResponse
client.scores.batch(symbols) BatchResponse
client.scores.history(symbol, from_=, to=, limit=) HistoryResponse
client.search(query, limit=) SearchResponse
client.news(symbol, limit=) NewsResponse

from_ is the keyword for the historical range start (Python keyword from is reserved).

Errors

All exceptions extend HaruspexError:

Class Trigger
HaruspexAuthError 401 / 403
HaruspexNotFoundError 404 — ticker not in the scoring universe
HaruspexRateLimitError 429 — carries retry_after_ms
HaruspexValidationError 400 / client-side bad input
HaruspexServerError 5xx
HaruspexNetworkError timeout, DNS, connection reset

Every error carries status, code, request_id, and body when available.

Retries

Retries automatically on 429, 502, 503, 504, and network errors with exponential backoff (250ms × 2^attempt, capped at 4s, with jitter). Respects Retry-After on 429. Default max_retries=2.

Authentication

Get a free API key at haruspex.guru/developers. For evaluation without signup, use the public demo key (hrspx_live_a7c52f9315a65c377fec9c30b53f266b) documented in the root README.

License

MIT. The SDK source code in this repository is MIT-licensed; the Haruspex scoring algorithm and data are proprietary and access is governed by the Haruspex API Terms of Service.

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

haruspex_sdk-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for haruspex_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f59e4b3858503808da4ac2b209c0d0bce0cb5d38c79d4379f37ffb9daffb902
MD5 a25c5265ba7311c909b7913f9e495b32
BLAKE2b-256 1757611f5d3fb8a1b88796ebd300c03375dc76cb280bdee523f7f61231254ae8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: haruspex_sdk-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.8

File hashes

Hashes for haruspex_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 630fe149ebcbd8b76f0dc5716ef9291c4df2a0b7f415735b1c042295c079f11d
MD5 a1208604b3e71c7d02bb5ac5c98346da
BLAKE2b-256 b8611cf8f4d2fd792ad231e863833bf0300167ff7a15cc40a09bc9a5e2e0ad4d

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