Skip to main content

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

form4api-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

form4api-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

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

Hashes for form4api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5938e3f5c25d4a79a6b25660946c8d044339a411df1704eb2bde30ec9ead3498
MD5 c7a190ff9c034e510180411163d5c48d
BLAKE2b-256 9454bcfa1dc48fba0e4c273395d97a79646f972d50143a98410b0534d9750a49

See more details on using hashes here.

Provenance

The following attestation bundles were made for form4api-0.1.0.tar.gz:

Publisher: publish.yml on theodor90/form4api-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for form4api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1071a25369776d577b33ee4119a5629aac1ba73df6ae8b0dc41d6a22f36d793b
MD5 db1f5cf8881ae05bf78c80c335fb7c0c
BLAKE2b-256 9507da45b4727178e7e8ab7f19309f29ab45376830992f085a7d13b3c317db76

See more details on using hashes here.

Provenance

The following attestation bundles were made for form4api-0.1.0-py3-none-any.whl:

Publisher: publish.yml on theodor90/form4api-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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