sec-edgar-insider-api 1.0.0
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.
- package/README.md +74 -0
- package/index.d.ts +20 -0
- package/index.js +66 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# SEC EDGAR Insider Trading API
|
|
2
|
+
|
|
3
|
+
JavaScript client for the [SEC EDGAR Insider Trading Alerts API](https://rapidapi.com/lulzasaur9192/api/sec-insider-trades) on RapidAPI.
|
|
4
|
+
|
|
5
|
+
Track insider trades, Form 4 filings, and executive buy/sell signals in real-time from SEC EDGAR.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install sec-edgar-insider-api
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const SECEdgarClient = require('sec-edgar-insider-api');
|
|
17
|
+
|
|
18
|
+
const client = new SECEdgarClient('YOUR_RAPIDAPI_KEY');
|
|
19
|
+
|
|
20
|
+
// Get recent insider trades
|
|
21
|
+
const trades = await client.getRecentTrades({ days: 7, limit: 20 });
|
|
22
|
+
console.log(trades);
|
|
23
|
+
|
|
24
|
+
// Get trades for a specific ticker
|
|
25
|
+
const applTrades = await client.getTradesByTicker('AAPL', { days: 30 });
|
|
26
|
+
|
|
27
|
+
// Get full Form 4 filing details
|
|
28
|
+
const filing = await client.getFiling('0001234567-26-000123');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API Methods
|
|
32
|
+
|
|
33
|
+
### `getRecentTrades(options?)`
|
|
34
|
+
Get recent Form 4 insider trading filings.
|
|
35
|
+
|
|
36
|
+
| Parameter | Type | Default | Description |
|
|
37
|
+
|-----------|------|---------|-------------|
|
|
38
|
+
| days | number | 3 | Lookback period (1-30) |
|
|
39
|
+
| limit | number | 20 | Results per page (1-100) |
|
|
40
|
+
| offset | number | 0 | Pagination offset |
|
|
41
|
+
| ticker | string | - | Filter by company ticker |
|
|
42
|
+
|
|
43
|
+
### `getTradesByTicker(ticker, options?)`
|
|
44
|
+
Get all insider trades for a specific company.
|
|
45
|
+
|
|
46
|
+
| Parameter | Type | Default | Description |
|
|
47
|
+
|-----------|------|---------|-------------|
|
|
48
|
+
| ticker | string | required | Company ticker (e.g. "AAPL") |
|
|
49
|
+
| days | number | 30 | Lookback period (1-365) |
|
|
50
|
+
| limit | number | 50 | Results per page (1-100) |
|
|
51
|
+
|
|
52
|
+
### `getFiling(accession)`
|
|
53
|
+
Get full parsed Form 4 details for a specific filing.
|
|
54
|
+
|
|
55
|
+
| Parameter | Type | Description |
|
|
56
|
+
|-----------|------|-------------|
|
|
57
|
+
| accession | string | Accession number (format: XXXXXXXXXX-YY-ZZZZZZ) |
|
|
58
|
+
|
|
59
|
+
## Get Your API Key
|
|
60
|
+
|
|
61
|
+
1. Go to [SEC Insider Trades API on RapidAPI](https://rapidapi.com/lulzasaur9192/api/sec-insider-trades)
|
|
62
|
+
2. Subscribe (free tier: 200 requests/month)
|
|
63
|
+
3. Copy your API key from the dashboard
|
|
64
|
+
|
|
65
|
+
## Use Cases
|
|
66
|
+
|
|
67
|
+
- **Quant Trading**: Track insider buy/sell patterns as trading signals
|
|
68
|
+
- **Compliance**: Monitor executive trades for reporting requirements
|
|
69
|
+
- **Research**: Analyze insider trading patterns by sector or company
|
|
70
|
+
- **Alerts**: Build real-time notification systems for insider activity
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface TradeOptions {
|
|
2
|
+
days?: number;
|
|
3
|
+
limit?: number;
|
|
4
|
+
offset?: number;
|
|
5
|
+
ticker?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface CompanyOptions {
|
|
9
|
+
days?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class SECEdgarClient {
|
|
14
|
+
constructor(apiKey: string);
|
|
15
|
+
getRecentTrades(options?: TradeOptions): Promise<any>;
|
|
16
|
+
getTradesByTicker(ticker: string, options?: CompanyOptions): Promise<any>;
|
|
17
|
+
getFiling(accession: string): Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export = SECEdgarClient;
|
package/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const BASE_URL = 'https://sec-insider-trades.p.rapidapi.com';
|
|
4
|
+
|
|
5
|
+
class SECEdgarClient {
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} apiKey - Your RapidAPI key (get one at https://rapidapi.com/lulzasaur9192/api/sec-insider-trades)
|
|
8
|
+
*/
|
|
9
|
+
constructor(apiKey) {
|
|
10
|
+
if (!apiKey) throw new Error('API key required — get one at https://rapidapi.com/lulzasaur9192/api/sec-insider-trades');
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
this.headers = {
|
|
13
|
+
'x-rapidapi-key': apiKey,
|
|
14
|
+
'x-rapidapi-host': 'sec-insider-trades.p.rapidapi.com',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async _request(path, params = {}) {
|
|
19
|
+
const url = new URL(BASE_URL + path);
|
|
20
|
+
for (const [k, v] of Object.entries(params)) {
|
|
21
|
+
if (v !== undefined && v !== null) url.searchParams.set(k, String(v));
|
|
22
|
+
}
|
|
23
|
+
const res = await fetch(url.toString(), { headers: this.headers });
|
|
24
|
+
if (!res.ok) {
|
|
25
|
+
const body = await res.text().catch(() => '');
|
|
26
|
+
throw new Error(`SEC EDGAR API error ${res.status}: ${body}`);
|
|
27
|
+
}
|
|
28
|
+
return res.json();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get recent Form 4 insider trading filings
|
|
33
|
+
* @param {Object} [options]
|
|
34
|
+
* @param {number} [options.days=3] - Lookback period (1-30)
|
|
35
|
+
* @param {number} [options.limit=20] - Results per page (1-100)
|
|
36
|
+
* @param {number} [options.offset=0] - Pagination offset
|
|
37
|
+
* @param {string} [options.ticker] - Filter by company ticker
|
|
38
|
+
* @returns {Promise<Object>}
|
|
39
|
+
*/
|
|
40
|
+
async getRecentTrades(options = {}) {
|
|
41
|
+
return this._request('/sec/insider-trades', options);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get all insider trades for a specific company
|
|
46
|
+
* @param {string} ticker - Company ticker symbol (e.g. "AAPL")
|
|
47
|
+
* @param {Object} [options]
|
|
48
|
+
* @param {number} [options.days=30] - Lookback period (1-365)
|
|
49
|
+
* @param {number} [options.limit=50] - Results per page (1-100)
|
|
50
|
+
* @returns {Promise<Object>}
|
|
51
|
+
*/
|
|
52
|
+
async getTradesByTicker(ticker, options = {}) {
|
|
53
|
+
return this._request(`/sec/insider-trades/company/${encodeURIComponent(ticker)}`, options);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get full parsed Form 4 filing details
|
|
58
|
+
* @param {string} accession - Accession number (format: XXXXXXXXXX-YY-ZZZZZZ)
|
|
59
|
+
* @returns {Promise<Object>}
|
|
60
|
+
*/
|
|
61
|
+
async getFiling(accession) {
|
|
62
|
+
return this._request(`/sec/insider-trades/filing/${encodeURIComponent(accession)}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = SECEdgarClient;
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sec-edgar-insider-api",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "JavaScript client for SEC EDGAR Insider Trading Alerts API — real-time Form 4 filings, insider buy/sell signals, executive trade tracking via RapidAPI",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sec",
|
|
7
|
+
"edgar",
|
|
8
|
+
"insider-trading",
|
|
9
|
+
"form-4",
|
|
10
|
+
"finance",
|
|
11
|
+
"stock-market",
|
|
12
|
+
"api",
|
|
13
|
+
"rapidapi",
|
|
14
|
+
"insider-trades",
|
|
15
|
+
"executive-trades",
|
|
16
|
+
"stock-alerts",
|
|
17
|
+
"fintech"
|
|
18
|
+
],
|
|
19
|
+
"main": "index.js",
|
|
20
|
+
"types": "index.d.ts",
|
|
21
|
+
"author": "lulzasaur9192",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/lulzasaur9192/sec-edgar-insider-api"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://rapidapi.com/lulzasaur9192/api/sec-insider-trades",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14"
|
|
30
|
+
}
|
|
31
|
+
}
|