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 |
.search(name, **params), .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
form4api-0.3.0.tar.gz
(10.3 kB
view details)
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
form4api-0.3.0-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file form4api-0.3.0.tar.gz.
File metadata
- Download URL: form4api-0.3.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0eda65ca5562416fe9280435e98f8138d5713f2b92fa8c5bacc9881323915c0
|
|
| MD5 |
23e9a32a0da55a01f39e76a8c1d7dc16
|
|
| BLAKE2b-256 |
d44c8e1fe2f6104c4063ea666cedb4028ae5e45bbfb9f277dc8be45b1930c166
|
File details
Details for the file form4api-0.3.0-py3-none-any.whl.
File metadata
- Download URL: form4api-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cee752b5de6d2df845cb496cc7e1b97f2f65840fe9363e0ae0ad301d55fd7d55
|
|
| MD5 |
34914cab66cf99c98127061d07d2ced7
|
|
| BLAKE2b-256 |
8e5b155132beedbc6c9fe3c8fc3a5544b1c1c4665db9f092b22c755604c8ad26
|