form4api 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {form4api-0.1.0 → form4api-0.2.0}/PKG-INFO +104 -104
- {form4api-0.1.0 → form4api-0.2.0}/README.md +1 -1
- {form4api-0.1.0 → form4api-0.2.0}/form4api/_types.py +3 -3
- {form4api-0.1.0 → form4api-0.2.0}/form4api/_webhook_utils.py +3 -3
- {form4api-0.1.0 → form4api-0.2.0}/form4api/resources/__init__.py +3 -3
- {form4api-0.1.0 → form4api-0.2.0}/form4api/resources/_insiders.py +11 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api.egg-info/PKG-INFO +104 -104
- {form4api-0.1.0 → form4api-0.2.0}/pyproject.toml +1 -1
- {form4api-0.1.0 → form4api-0.2.0}/setup.cfg +4 -4
- {form4api-0.1.0 → form4api-0.2.0}/tests/test_client.py +12 -0
- {form4api-0.1.0 → form4api-0.2.0}/LICENSE +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/__init__.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/_client.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/_errors.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/resources/_companies.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/resources/_signals.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/resources/_transactions.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api/resources/_webhooks.py +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api.egg-info/SOURCES.txt +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api.egg-info/dependency_links.txt +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api.egg-info/requires.txt +0 -0
- {form4api-0.1.0 → form4api-0.2.0}/form4api.egg-info/top_level.txt +0 -0
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: form4api
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Python client for the Form4API — real-time SEC Form 4 insider trading data
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Homepage, https://form4api.com
|
|
7
|
-
Project-URL: Documentation, https://form4api.com/docs
|
|
8
|
-
Project-URL: Repository, https://github.com/theodor90/form4api-py.git
|
|
9
|
-
Requires-Python: >=3.11
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: httpx>=0.27
|
|
13
|
-
Provides-Extra: dev
|
|
14
|
-
Requires-Dist: pytest>=8; extra == "dev"
|
|
15
|
-
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
|
|
16
|
-
Requires-Dist: respx>=0.21; extra == "dev"
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# form4api
|
|
20
|
-
|
|
21
|
-
Python client for [Form4API](https://form4api.com) — real-time SEC Form 4 insider trading data.
|
|
22
|
-
|
|
23
|
-
Supports Python 3.11+. Uses `httpx` for both sync and async HTTP.
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pip install form4api
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Sync quickstart
|
|
32
|
-
|
|
33
|
-
```python
|
|
34
|
-
from form4api import Form4ApiClient
|
|
35
|
-
|
|
36
|
-
client = Form4ApiClient("YOUR_API_KEY")
|
|
37
|
-
|
|
38
|
-
# Recent open-market purchases at Apple
|
|
39
|
-
txns = client.transactions.list(ticker="AAPL", code="P", per_page=5)
|
|
40
|
-
for t in txns:
|
|
41
|
-
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
42
|
-
|
|
43
|
-
# Company overview
|
|
44
|
-
company = client.companies.get("MSFT")
|
|
45
|
-
print(company.name, company.active_insiders, "active insiders")
|
|
46
|
-
|
|
47
|
-
# Insider detail
|
|
48
|
-
insider = client.insiders.get("0001234567")
|
|
49
|
-
print(insider.name, insider.officer_title)
|
|
50
|
-
|
|
51
|
-
# Cluster-buy signals (Business plan)
|
|
52
|
-
signals = client.signals.list(ticker="NVDA")
|
|
53
|
-
for sig in signals:
|
|
54
|
-
if sig.is_cluster_buy:
|
|
55
|
-
print(sig.company_name, sig.insider_count, "buyers")
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Async quickstart
|
|
59
|
-
|
|
60
|
-
```python
|
|
61
|
-
import asyncio
|
|
62
|
-
from form4api import AsyncForm4ApiClient
|
|
63
|
-
|
|
64
|
-
async def main():
|
|
65
|
-
async with AsyncForm4ApiClient("YOUR_API_KEY") as client:
|
|
66
|
-
txns = await client.transactions.list(ticker="AAPL", per_page=5)
|
|
67
|
-
for t in txns:
|
|
68
|
-
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
69
|
-
|
|
70
|
-
asyncio.run(main())
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Resources
|
|
74
|
-
|
|
75
|
-
| Resource | Methods |
|
|
76
|
-
|---|---|
|
|
77
|
-
| `client.transactions` | `.list(**params)`, `.paginate(**params)` |
|
|
78
|
-
| `client.insiders` | `.get(cik)`, `.transactions(cik, **params)` |
|
|
79
|
-
| `client.companies` | `.get(ticker)`, `.insiders(ticker)` |
|
|
80
|
-
| `client.signals` | `.list(**params)` — Business plan |
|
|
81
|
-
| `client.webhooks` | `.create(url, event_types)`, `.list()`, `.delete(id)`, `.events(**params)` |
|
|
82
|
-
|
|
83
|
-
## Error handling
|
|
84
|
-
|
|
85
|
-
```python
|
|
86
|
-
from form4api import Form4ApiClient, AuthError, PlanError, RateLimitError, NotFoundError
|
|
87
|
-
|
|
88
|
-
client = Form4ApiClient("YOUR_API_KEY")
|
|
89
|
-
|
|
90
|
-
try:
|
|
91
|
-
signals = client.signals.list()
|
|
92
|
-
except PlanError as e:
|
|
93
|
-
print(f"Upgrade to {e.required_plan}")
|
|
94
|
-
except RateLimitError as e:
|
|
95
|
-
print(f"Retry after {e.retry_after}s")
|
|
96
|
-
except AuthError:
|
|
97
|
-
print("Invalid API key")
|
|
98
|
-
except NotFoundError:
|
|
99
|
-
print("Resource not found")
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## License
|
|
103
|
-
|
|
104
|
-
MIT
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: form4api
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python client for the Form4API — real-time SEC Form 4 insider trading data
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://form4api.com
|
|
7
|
+
Project-URL: Documentation, https://form4api.com/docs
|
|
8
|
+
Project-URL: Repository, https://github.com/theodor90/form4api-py.git
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: httpx>=0.27
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
|
|
16
|
+
Requires-Dist: respx>=0.21; extra == "dev"
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# form4api
|
|
20
|
+
|
|
21
|
+
Python client for [Form4API](https://form4api.com) — real-time SEC Form 4 insider trading data.
|
|
22
|
+
|
|
23
|
+
Supports Python 3.11+. Uses `httpx` for both sync and async HTTP.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install form4api
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Sync quickstart
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from form4api import Form4ApiClient
|
|
35
|
+
|
|
36
|
+
client = Form4ApiClient("YOUR_API_KEY")
|
|
37
|
+
|
|
38
|
+
# Recent open-market purchases at Apple
|
|
39
|
+
txns = client.transactions.list(ticker="AAPL", code="P", per_page=5)
|
|
40
|
+
for t in txns:
|
|
41
|
+
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
42
|
+
|
|
43
|
+
# Company overview
|
|
44
|
+
company = client.companies.get("MSFT")
|
|
45
|
+
print(company.name, company.active_insiders, "active insiders")
|
|
46
|
+
|
|
47
|
+
# Insider detail
|
|
48
|
+
insider = client.insiders.get("0001234567")
|
|
49
|
+
print(insider.name, insider.officer_title)
|
|
50
|
+
|
|
51
|
+
# Cluster-buy signals (Business plan)
|
|
52
|
+
signals = client.signals.list(ticker="NVDA")
|
|
53
|
+
for sig in signals:
|
|
54
|
+
if sig.is_cluster_buy:
|
|
55
|
+
print(sig.company_name, sig.insider_count, "buyers")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Async quickstart
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import asyncio
|
|
62
|
+
from form4api import AsyncForm4ApiClient
|
|
63
|
+
|
|
64
|
+
async def main():
|
|
65
|
+
async with AsyncForm4ApiClient("YOUR_API_KEY") as client:
|
|
66
|
+
txns = await client.transactions.list(ticker="AAPL", per_page=5)
|
|
67
|
+
for t in txns:
|
|
68
|
+
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
69
|
+
|
|
70
|
+
asyncio.run(main())
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Resources
|
|
74
|
+
|
|
75
|
+
| Resource | Methods |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `client.transactions` | `.list(**params)`, `.paginate(**params)` |
|
|
78
|
+
| `client.insiders` | `.search(name, **params)`, `.get(cik)`, `.transactions(cik, **params)` |
|
|
79
|
+
| `client.companies` | `.get(ticker)`, `.insiders(ticker)` |
|
|
80
|
+
| `client.signals` | `.list(**params)` — Business plan |
|
|
81
|
+
| `client.webhooks` | `.create(url, event_types)`, `.list()`, `.delete(id)`, `.events(**params)` |
|
|
82
|
+
|
|
83
|
+
## Error handling
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from form4api import Form4ApiClient, AuthError, PlanError, RateLimitError, NotFoundError
|
|
87
|
+
|
|
88
|
+
client = Form4ApiClient("YOUR_API_KEY")
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
signals = client.signals.list()
|
|
92
|
+
except PlanError as e:
|
|
93
|
+
print(f"Upgrade to {e.required_plan}")
|
|
94
|
+
except RateLimitError as e:
|
|
95
|
+
print(f"Retry after {e.retry_after}s")
|
|
96
|
+
except AuthError:
|
|
97
|
+
print("Invalid API key")
|
|
98
|
+
except NotFoundError:
|
|
99
|
+
print("Resource not found")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT
|
|
@@ -57,7 +57,7 @@ asyncio.run(main())
|
|
|
57
57
|
| Resource | Methods |
|
|
58
58
|
|---|---|
|
|
59
59
|
| `client.transactions` | `.list(**params)`, `.paginate(**params)` |
|
|
60
|
-
| `client.insiders` | `.get(cik)`, `.transactions(cik, **params)` |
|
|
60
|
+
| `client.insiders` | `.search(name, **params)`, `.get(cik)`, `.transactions(cik, **params)` |
|
|
61
61
|
| `client.companies` | `.get(ticker)`, `.insiders(ticker)` |
|
|
62
62
|
| `client.signals` | `.list(**params)` — Business plan |
|
|
63
63
|
| `client.webhooks` | `.create(url, event_types)`, `.list()`, `.delete(id)`, `.events(**params)` |
|
|
@@ -18,6 +18,6 @@ def verify_webhook(payload: str | bytes, signature: str, secret: str) -> bool:
|
|
|
18
18
|
payload = payload.encode()
|
|
19
19
|
expected = "sha256=" + hmac.new(secret.encode(), payload, hashlib.sha256).hexdigest()
|
|
20
20
|
return hmac.compare_digest(expected, signature)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
@@ -12,6 +12,17 @@ class InsidersResource:
|
|
|
12
12
|
def __init__(self, client: Form4ApiClient) -> None:
|
|
13
13
|
self._client = client
|
|
14
14
|
|
|
15
|
+
def search(
|
|
16
|
+
self,
|
|
17
|
+
name: str,
|
|
18
|
+
*,
|
|
19
|
+
page: int = 1,
|
|
20
|
+
per_page: int = 20,
|
|
21
|
+
) -> list[Insider]:
|
|
22
|
+
params: dict[str, str] = {"name": name, "page": str(page), "per_page": str(per_page)}
|
|
23
|
+
data = self._client._get("/v1/insiders", params)
|
|
24
|
+
return [Insider(**item) for item in data]
|
|
25
|
+
|
|
15
26
|
def get(self, cik: str) -> Insider:
|
|
16
27
|
data = self._client._get(f"/v1/insiders/{cik}")
|
|
17
28
|
return Insider(**data)
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: form4api
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Python client for the Form4API — real-time SEC Form 4 insider trading data
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Homepage, https://form4api.com
|
|
7
|
-
Project-URL: Documentation, https://form4api.com/docs
|
|
8
|
-
Project-URL: Repository, https://github.com/theodor90/form4api-py.git
|
|
9
|
-
Requires-Python: >=3.11
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Requires-Dist: httpx>=0.27
|
|
13
|
-
Provides-Extra: dev
|
|
14
|
-
Requires-Dist: pytest>=8; extra == "dev"
|
|
15
|
-
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
|
|
16
|
-
Requires-Dist: respx>=0.21; extra == "dev"
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
# form4api
|
|
20
|
-
|
|
21
|
-
Python client for [Form4API](https://form4api.com) — real-time SEC Form 4 insider trading data.
|
|
22
|
-
|
|
23
|
-
Supports Python 3.11+. Uses `httpx` for both sync and async HTTP.
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pip install form4api
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Sync quickstart
|
|
32
|
-
|
|
33
|
-
```python
|
|
34
|
-
from form4api import Form4ApiClient
|
|
35
|
-
|
|
36
|
-
client = Form4ApiClient("YOUR_API_KEY")
|
|
37
|
-
|
|
38
|
-
# Recent open-market purchases at Apple
|
|
39
|
-
txns = client.transactions.list(ticker="AAPL", code="P", per_page=5)
|
|
40
|
-
for t in txns:
|
|
41
|
-
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
42
|
-
|
|
43
|
-
# Company overview
|
|
44
|
-
company = client.companies.get("MSFT")
|
|
45
|
-
print(company.name, company.active_insiders, "active insiders")
|
|
46
|
-
|
|
47
|
-
# Insider detail
|
|
48
|
-
insider = client.insiders.get("0001234567")
|
|
49
|
-
print(insider.name, insider.officer_title)
|
|
50
|
-
|
|
51
|
-
# Cluster-buy signals (Business plan)
|
|
52
|
-
signals = client.signals.list(ticker="NVDA")
|
|
53
|
-
for sig in signals:
|
|
54
|
-
if sig.is_cluster_buy:
|
|
55
|
-
print(sig.company_name, sig.insider_count, "buyers")
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Async quickstart
|
|
59
|
-
|
|
60
|
-
```python
|
|
61
|
-
import asyncio
|
|
62
|
-
from form4api import AsyncForm4ApiClient
|
|
63
|
-
|
|
64
|
-
async def main():
|
|
65
|
-
async with AsyncForm4ApiClient("YOUR_API_KEY") as client:
|
|
66
|
-
txns = await client.transactions.list(ticker="AAPL", per_page=5)
|
|
67
|
-
for t in txns:
|
|
68
|
-
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
69
|
-
|
|
70
|
-
asyncio.run(main())
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Resources
|
|
74
|
-
|
|
75
|
-
| Resource | Methods |
|
|
76
|
-
|---|---|
|
|
77
|
-
| `client.transactions` | `.list(**params)`, `.paginate(**params)` |
|
|
78
|
-
| `client.insiders` | `.get(cik)`, `.transactions(cik, **params)` |
|
|
79
|
-
| `client.companies` | `.get(ticker)`, `.insiders(ticker)` |
|
|
80
|
-
| `client.signals` | `.list(**params)` — Business plan |
|
|
81
|
-
| `client.webhooks` | `.create(url, event_types)`, `.list()`, `.delete(id)`, `.events(**params)` |
|
|
82
|
-
|
|
83
|
-
## Error handling
|
|
84
|
-
|
|
85
|
-
```python
|
|
86
|
-
from form4api import Form4ApiClient, AuthError, PlanError, RateLimitError, NotFoundError
|
|
87
|
-
|
|
88
|
-
client = Form4ApiClient("YOUR_API_KEY")
|
|
89
|
-
|
|
90
|
-
try:
|
|
91
|
-
signals = client.signals.list()
|
|
92
|
-
except PlanError as e:
|
|
93
|
-
print(f"Upgrade to {e.required_plan}")
|
|
94
|
-
except RateLimitError as e:
|
|
95
|
-
print(f"Retry after {e.retry_after}s")
|
|
96
|
-
except AuthError:
|
|
97
|
-
print("Invalid API key")
|
|
98
|
-
except NotFoundError:
|
|
99
|
-
print("Resource not found")
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## License
|
|
103
|
-
|
|
104
|
-
MIT
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: form4api
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python client for the Form4API — real-time SEC Form 4 insider trading data
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://form4api.com
|
|
7
|
+
Project-URL: Documentation, https://form4api.com/docs
|
|
8
|
+
Project-URL: Repository, https://github.com/theodor90/form4api-py.git
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: httpx>=0.27
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
|
|
16
|
+
Requires-Dist: respx>=0.21; extra == "dev"
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# form4api
|
|
20
|
+
|
|
21
|
+
Python client for [Form4API](https://form4api.com) — real-time SEC Form 4 insider trading data.
|
|
22
|
+
|
|
23
|
+
Supports Python 3.11+. Uses `httpx` for both sync and async HTTP.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install form4api
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Sync quickstart
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from form4api import Form4ApiClient
|
|
35
|
+
|
|
36
|
+
client = Form4ApiClient("YOUR_API_KEY")
|
|
37
|
+
|
|
38
|
+
# Recent open-market purchases at Apple
|
|
39
|
+
txns = client.transactions.list(ticker="AAPL", code="P", per_page=5)
|
|
40
|
+
for t in txns:
|
|
41
|
+
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
42
|
+
|
|
43
|
+
# Company overview
|
|
44
|
+
company = client.companies.get("MSFT")
|
|
45
|
+
print(company.name, company.active_insiders, "active insiders")
|
|
46
|
+
|
|
47
|
+
# Insider detail
|
|
48
|
+
insider = client.insiders.get("0001234567")
|
|
49
|
+
print(insider.name, insider.officer_title)
|
|
50
|
+
|
|
51
|
+
# Cluster-buy signals (Business plan)
|
|
52
|
+
signals = client.signals.list(ticker="NVDA")
|
|
53
|
+
for sig in signals:
|
|
54
|
+
if sig.is_cluster_buy:
|
|
55
|
+
print(sig.company_name, sig.insider_count, "buyers")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Async quickstart
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import asyncio
|
|
62
|
+
from form4api import AsyncForm4ApiClient
|
|
63
|
+
|
|
64
|
+
async def main():
|
|
65
|
+
async with AsyncForm4ApiClient("YOUR_API_KEY") as client:
|
|
66
|
+
txns = await client.transactions.list(ticker="AAPL", per_page=5)
|
|
67
|
+
for t in txns:
|
|
68
|
+
print(t.insider_name, t.shares_amount, "@", t.price_per_share)
|
|
69
|
+
|
|
70
|
+
asyncio.run(main())
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Resources
|
|
74
|
+
|
|
75
|
+
| Resource | Methods |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `client.transactions` | `.list(**params)`, `.paginate(**params)` |
|
|
78
|
+
| `client.insiders` | `.search(name, **params)`, `.get(cik)`, `.transactions(cik, **params)` |
|
|
79
|
+
| `client.companies` | `.get(ticker)`, `.insiders(ticker)` |
|
|
80
|
+
| `client.signals` | `.list(**params)` — Business plan |
|
|
81
|
+
| `client.webhooks` | `.create(url, event_types)`, `.list()`, `.delete(id)`, `.events(**params)` |
|
|
82
|
+
|
|
83
|
+
## Error handling
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from form4api import Form4ApiClient, AuthError, PlanError, RateLimitError, NotFoundError
|
|
87
|
+
|
|
88
|
+
client = Form4ApiClient("YOUR_API_KEY")
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
signals = client.signals.list()
|
|
92
|
+
except PlanError as e:
|
|
93
|
+
print(f"Upgrade to {e.required_plan}")
|
|
94
|
+
except RateLimitError as e:
|
|
95
|
+
print(f"Retry after {e.retry_after}s")
|
|
96
|
+
except AuthError:
|
|
97
|
+
print("Invalid API key")
|
|
98
|
+
except NotFoundError:
|
|
99
|
+
print("Resource not found")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "form4api"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Python client for the Form4API — real-time SEC Form 4 insider trading data"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = ["httpx>=0.27"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -110,6 +110,18 @@ def test_transactions_paginate_stops_on_short_page(client):
|
|
|
110
110
|
|
|
111
111
|
# ── insiders ──────────────────────────────────────────────────────────────────
|
|
112
112
|
|
|
113
|
+
@respx.mock
|
|
114
|
+
def test_insiders_search_returns_list(client):
|
|
115
|
+
route = respx.get(f"{BASE}/v1/insiders").mock(return_value=httpx.Response(200, json=[INSIDER]))
|
|
116
|
+
results = client.insiders.search("Cook")
|
|
117
|
+
assert route.called
|
|
118
|
+
qs = dict(route.calls[0].request.url.params)
|
|
119
|
+
assert qs["name"] == "Cook"
|
|
120
|
+
assert len(results) == 1
|
|
121
|
+
assert isinstance(results[0], Insider)
|
|
122
|
+
assert results[0].name == "Cook Timothy D"
|
|
123
|
+
|
|
124
|
+
|
|
113
125
|
@respx.mock
|
|
114
126
|
def test_insiders_get_returns_typed_object(client):
|
|
115
127
|
respx.get(f"{BASE}/v1/insiders/0001214156").mock(return_value=httpx.Response(200, json=INSIDER))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|