Skip to content

Commit 7fa3490

Browse files
added Form N-CEN API
1 parent e8f2780 commit 7fa3490

File tree

5 files changed

+78
-3
lines changed

5 files changed

+78
-3
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
- [Form 13D/13G API - Activist and Passive Investor Holdings](#form-13d-13g-api)
2929
- [Form N-PORT API - Mutual Funds, ETFs and Closed-End Fund Holdings](#form-n-port-api)
3030

31-
**Proxy Voting Records**
31+
**Investment Companies**
3232

33-
- [Form N-PX Proxy Voting Records API](#form-n-px-proxy-voting-records-api)
33+
- [Form N-CEN API - Annual Reports](#form-n-cen-api---annual-reports-by-investment-companies)
34+
- [Form N-PX API - Proxy Voting Records](#form-n-px-proxy-voting-records-api)
3435

3536
**Security Offerings APIs**
3637

@@ -873,6 +874,28 @@ print(response["filings"])
873874

874875
> See the documentation for more details: https://sec-api.io/docs/n-port-data-api
875876
877+
## Form N-CEN API - Annual Reports by Investment Companies
878+
879+
The Form N-CEN API allows searching and accessing all Form N-CEN filings (annual reports by investment companies) from 2018 to present in a structured JSON format. The database includes information about the investment company, such as CIK, name, address, type of investment company, series information, directors, underwriters, total assets, and more. All types of funds are supported, including master-feeder, index, exchange-traded, money market, and more.
880+
881+
```python
882+
from sec_api import FormNcenApi
883+
884+
formNcenApi = FormNcenApi("YOUR_API_KEY")
885+
886+
search_params = {
887+
"query": 'managementInvestmentQuestionSeriesInfo.fundTypes:"Exchange-Traded Fund"',
888+
"from": "0",
889+
"size": "10",
890+
"sort": [{"filedAt": {"order": "desc"}}],
891+
}
892+
893+
response = formNcenApi.get_data(search_params)
894+
print(response["data"])
895+
```
896+
897+
> See the documentation for more details: https://sec-api.io/docs/form-ncen-api-annual-reports-investment-companies
898+
876899
## Form N-PX Proxy Voting Records API
877900

878901
The Form N-PX API consists of two APIs: the N-PX Search API and the Voting Records API. The N-PX Search API enables filtering all N-PX filings published on the SEC EDGAR database since 2024. The API accepts search queries as JSON formatted payload and returns the matching N-PX filings in JSON format. The Voting Records API allows downloading the proxy voting records in structured JSON format for a specific filing by providing the filing's accession number.

examples.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
FormNportApi,
1414
Form13DGApi,
1515
#
16+
FormNcenApi,
1617
FormNPXApi,
1718
#
1819
Form_S1_424B4_Api,
@@ -488,6 +489,24 @@
488489
# """
489490

490491

492+
#
493+
# Form N-CEN API Example
494+
#
495+
"""
496+
formNcenApi = FormNcenApi("YOUR_API_KEY")
497+
498+
search_params = {
499+
"query": "accessionNo:*",
500+
"from": "0",
501+
"size": "10",
502+
"sort": [{"filedAt": {"order": "desc"}}],
503+
}
504+
505+
response = formNcenApi.get_data(search_params)
506+
print(response["data"])
507+
# """
508+
509+
491510
#
492511
# Form N-PX API Examples
493512
#

sec_api/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
from sec_api.index import FormNportApi
1717
from sec_api.index import Form13DGApi
1818

19+
# Investment Companies:
20+
# Form N-CEN Annual Reports
1921
# Form N-PX Proxy Voting Records
22+
from sec_api.index import FormNcenApi
2023
from sec_api.index import FormNPXApi
2124

2225
# Offering APIs

sec_api/index.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
form_nport_api_endpoint = "https://api.sec-api.io/form-nport"
2020
form_13D_13G_endpoint = "https://api.sec-api.io/form-13d-13g"
2121
#
22+
form_NCEN_endpoint = "https://api.sec-api.io/form-ncen"
2223
form_NPX_endpoint = "https://api.sec-api.io/form-npx"
2324
#
2425
form_S1_424B4_endpoint = "https://api.sec-api.io/form-s1-424b4"
@@ -888,6 +889,35 @@ def get_data(self, query):
888889
handle_api_error(response)
889890

890891

892+
class FormNcenApi:
893+
"""
894+
Base class for Form N-CEN API - Annual Reports of Registered Investment Companies
895+
https://sec-api.io/docs/form-ncen-api-annual-reports-investment-companies
896+
"""
897+
898+
def __init__(self, api_key, proxies=None):
899+
self.api_key = api_key
900+
self.api_endpoint = form_NCEN_endpoint + "?token=" + api_key
901+
self.proxies = proxies if proxies else {}
902+
903+
def get_data(self, query):
904+
response = {}
905+
906+
# use backoff strategy to handle "too many requests" error.
907+
for x in range(3):
908+
response = requests.post(
909+
self.api_endpoint, json=query, proxies=self.proxies
910+
)
911+
if response.status_code == 200:
912+
return response.json()
913+
elif response.status_code == 429:
914+
time.sleep(0.5 * (x + 1))
915+
else:
916+
handle_api_error(response)
917+
else:
918+
handle_api_error(response)
919+
920+
891921
class FormNPXApi:
892922
"""
893923
Base class for Form N-PX Proxy Voting Records API

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="sec-api",
8-
version="1.0.31",
8+
version="1.0.32",
99
author="SEC API",
1010
author_email="support@sec-api.io",
1111
description="SEC EDGAR Filings API",

0 commit comments

Comments
 (0)