Python client for the Form4API — real-time SEC Form 4 insider trading data
Project description
form4api
Python client for Form4API — real-time SEC Form 4 insider trading data.
Supports Python 3.11+. Uses httpx for both sync and async HTTP.
Installation
pip install form4api
Sync quickstart
from form4api import Form4ApiClient
client = Form4ApiClient("YOUR_API_KEY")
# Recent open-market purchases at Apple
txns = client.transactions.list(ticker="AAPL", code="P", per_page=5)
for t in txns:
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
# Company overview
company = client.companies.get("MSFT")
print(company.name, company.active_insiders, "active insiders")
# Insider detail
insider = client.insiders.get("0001234567")
print(insider.name, insider.officer_title)
# Cluster-buy signals (Business plan)
signals = client.signals.list(ticker="NVDA")
for sig in signals:
if sig.is_cluster_buy:
print(sig.company_name, sig.insider_count, "buyers")
Async quickstart
import asyncio
from form4api import AsyncForm4ApiClient
async def main():
async with AsyncForm4ApiClient("YOUR_API_KEY") as client:
txns = await client.transactions.list(ticker="AAPL", per_page=5)
for t in txns:
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
asyncio.run(main())
Resources
| Resource | Methods |
|---|---|
client.transactions |
.list(**params), .paginate(**params) |
client.insiders |
.get(cik), .transactions(cik, **params) |
client.companies |
.get(ticker), .insiders(ticker) |
client.signals |
.list(**params) — Business plan |
client.webhooks |
.create(url, event_types), .list(), .delete(id), .events(**params) |
Error handling
from form4api import Form4ApiClient, AuthError, PlanError, RateLimitError, NotFoundError
client = Form4ApiClient("YOUR_API_KEY")
try:
signals = client.signals.list()
except PlanError as e:
print(f"Upgrade to {e.required_plan}")
except RateLimitError as e:
print(f"Retry after {e.retry_after}s")
except AuthError:
print("Invalid API key")
except NotFoundError:
print("Resource not found")
License
MIT
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
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 form4api-0.1.0.tar.gz.
File metadata
- Download URL: form4api-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5938e3f5c25d4a79a6b25660946c8d044339a411df1704eb2bde30ec9ead3498
|
|
| MD5 |
c7a190ff9c034e510180411163d5c48d
|
|
| BLAKE2b-256 |
9454bcfa1dc48fba0e4c273395d97a79646f972d50143a98410b0534d9750a49
|
Provenance
The following attestation bundles were made for form4api-0.1.0.tar.gz:
Publisher:
publish.yml on theodor90/form4api-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
form4api-0.1.0.tar.gz -
Subject digest:
5938e3f5c25d4a79a6b25660946c8d044339a411df1704eb2bde30ec9ead3498 - Sigstore transparency entry: 1517022615
- Sigstore integration time:
-
Permalink:
theodor90/form4api-py@90b9af53200ede808b1c485452914b6ad953996f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/theodor90
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90b9af53200ede808b1c485452914b6ad953996f -
Trigger Event:
push
-
Statement type:
File details
Details for the file form4api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: form4api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1071a25369776d577b33ee4119a5629aac1ba73df6ae8b0dc41d6a22f36d793b
|
|
| MD5 |
db1f5cf8881ae05bf78c80c335fb7c0c
|
|
| BLAKE2b-256 |
9507da45b4727178e7e8ab7f19309f29ab45376830992f085a7d13b3c317db76
|
Provenance
The following attestation bundles were made for form4api-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on theodor90/form4api-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
form4api-0.1.0-py3-none-any.whl -
Subject digest:
1071a25369776d577b33ee4119a5629aac1ba73df6ae8b0dc41d6a22f36d793b - Sigstore transparency entry: 1517023219
- Sigstore integration time:
-
Permalink:
theodor90/form4api-py@90b9af53200ede808b1c485452914b6ad953996f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/theodor90
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90b9af53200ede808b1c485452914b6ad953996f -
Trigger Event:
push
-
Statement type: