Haystack components for AlphaAI: AI-scored financial news and SEC Form 4 insider events as Documents.
Project description
alphai-haystack
Haystack components for AlphaAI — AI-scored
financial news and SEC Form 4 insider events, delivered as Haystack Document objects.
Every article on the AlphaAI 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 AlphaAI 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
- AlphaAI 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alphai_haystack-0.1.0.tar.gz.
File metadata
- Download URL: alphai_haystack-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d67a453df0fda767e3d6f12184f15d537fdf0c25c315c7c6d7be6062c4ab6237
|
|
| MD5 |
71d7aa2889400e8a8134a82f57327d35
|
|
| BLAKE2b-256 |
f69b93649125813be9c88ddcdb2fd6a544e3dc2ec277acbb8dba7f963fbe8136
|
Provenance
The following attestation bundles were made for alphai_haystack-0.1.0.tar.gz:
Publisher:
release.yml on makeev/alphai-haystack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alphai_haystack-0.1.0.tar.gz -
Subject digest:
d67a453df0fda767e3d6f12184f15d537fdf0c25c315c7c6d7be6062c4ab6237 - Sigstore transparency entry: 2274602246
- Sigstore integration time:
-
Permalink:
makeev/alphai-haystack@fac07820b2e753eae8abad3e9404e885b410dbe7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/makeev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fac07820b2e753eae8abad3e9404e885b410dbe7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alphai_haystack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: alphai_haystack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22c9ba5aadf6a28d941a61461e8b09bedc17453a8088a934c8edd4c254bc275b
|
|
| MD5 |
a7bf8ca47a923fd26642a24dc65a5b67
|
|
| BLAKE2b-256 |
477682968ed2fd9c43b227fed9748ed658e2f3358ebbf4ca44ad83178101d1e0
|
Provenance
The following attestation bundles were made for alphai_haystack-0.1.0-py3-none-any.whl:
Publisher:
release.yml on makeev/alphai-haystack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alphai_haystack-0.1.0-py3-none-any.whl -
Subject digest:
22c9ba5aadf6a28d941a61461e8b09bedc17453a8088a934c8edd4c254bc275b - Sigstore transparency entry: 2274602295
- Sigstore integration time:
-
Permalink:
makeev/alphai-haystack@fac07820b2e753eae8abad3e9404e885b410dbe7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/makeev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fac07820b2e753eae8abad3e9404e885b410dbe7 -
Trigger Event:
push
-
Statement type: