alphai-haystack
Haystack components for AlphAI — AI-scored
financial news and SEC Form 4 insider events, delivered as Haystack Document objects.
Every article on the AlphAI feed is enriched at ingest: per-ticker impact analysis, a category, and a 1-10 relevance score. SEC Form 4 filings become structured insider events about 6 minutes after they hit EDGAR. These components fetch that feed so your pipelines and agents can reason over pre-scored market news instead of raw headlines.
Components
AlphaAINewsFetcher— the main news feed. Filter by ticker, category, and a relevance floor; optionally collapse same-story coverage into one item.AlphaAIInsiderNewsFetcher— SEC Form 4 insider events with a structuredmeta["insider"]block: side, shares, average price, total value, who traded, and whether it was a pre-planned 10b5-1 sale.
Installation
pip install alphai-haystack
API key
Get a free key at alphai.io/developers (free tier: 20 requests
per minute, 100 per day, no card). The components read it from the ALPHAI_API_KEY environment
variable by default:
export ALPHAI_API_KEY="ak_..."
Usage
Standalone
from alphai_haystack import AlphaAINewsFetcher
fetcher = AlphaAINewsFetcher(symbol="NVDA", min_relevance=7)
documents = fetcher.run()["documents"]
for doc in documents:
print(doc.meta["relevance_score"], doc.meta["title"])
Insider events
from alphai_haystack import AlphaAIInsiderNewsFetcher
fetcher = AlphaAIInsiderNewsFetcher(min_relevance=7) # higher floor = larger trades
for doc in fetcher.run()["documents"]:
insider = doc.meta["insider"]
print(insider["insider_name"], insider["side"], insider["total_value_usd"], doc.meta["tickers"])
In a pipeline
A minimal market-brief pipeline: fetch scored news for a ticker, hand it to an LLM.
from haystack import Pipeline
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
from alphai_haystack import AlphaAINewsFetcher
template = """Summarize what moved {{ symbol }} today, using only these articles:
{% for doc in documents %}
- {{ doc.content }} (relevance {{ doc.meta.relevance_score }}/10)
{% endfor %}
"""
pipeline = Pipeline()
pipeline.add_component("news", AlphaAINewsFetcher(min_relevance=6, collapse_stories=True))
pipeline.add_component("prompt", PromptBuilder(template=template))
pipeline.add_component("llm", OpenAIGenerator(model="gpt-4o-mini"))
pipeline.connect("news.documents", "prompt.documents")
pipeline.connect("prompt", "llm")
result = pipeline.run({"news": {"symbol": "NVDA"}, "prompt": {"symbol": "NVDA"}})
print(result["llm"]["replies"][0])
Both components implement to_dict/from_dict, so pipelines serialize to YAML and back; the
API key is stored as an environment-variable reference, never as the raw value.
Document shape
content is the article title plus summary. meta carries:
| Key | Type | Notes |
|---|---|---|
uid |
str | Stable article id (use with the AlphAI article endpoint) |
url |
str | Original article URL |
title, source, source_domain |
str | |
published_at |
str | ISO 8601 |
tickers |
list[str] | Tickers the article affects |
category |
str | One of 14 categories (earnings, insider, crypto, ...) |
relevance_score |
int | 1-10, assigned at ingest |
sources_count |
int | Only when collapse_stories=True |
insider |
dict | Insider feed only: side, shares, avg price, total value, who |
Run parameters
run() accepts per-call overrides for the filters set in __init__: symbol, category
(news fetcher only), min_relevance, and top_k.
Development
pip install -e ".[dev]"
ruff check . && ruff format --check .
mypy src/alphai_haystack
pytest
Tests run fully offline against a fake client.
Links
- AlphAI developer docs
- OpenAPI schema
- Python SDK (
alphai-sdk) — this package is a thin Haystack layer over it - MCP server — the same feed for MCP-speaking agents
License
MIT
Metadata
Release files for alphai-haystack 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| alphai_haystack-0.1.1.tar.gz | 9.2 kB | With provenance | Details for alphai_haystack-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| alphai_haystack-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for alphai_haystack-0.1.1-py3-none-any.whl |
Total release size: 16.7 kB
Release files / alphai_haystack-0.1.1.tar.gz
| Download URL | alphai_haystack-0.1.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c1a2801548aa099c29360a18083b55997a2582ac323686ca42e1b14d42609f3
|
|
BLAKE2b-256 checksum How to use checksums |
3ee117c34989f9494ddd0b2f0a640c0dd129a3cee3a78f32cb554be0ccb3b349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logRelease files / alphai_haystack-0.1.1-py3-none-any.whl
| Download URL | alphai_haystack-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b2233b34c34ce5cffd8d8f218eebe53cd8d76fa8824f13cdf619fad21eaa185
|
|
BLAKE2b-256 checksum How to use checksums |
001fa72415d6a08a659c3763ccbc90f3aecb8de14a7dddc695024d038fa4280f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logSecurity for alphai-haystack 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for alphai_haystack-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.