git-shogg
finsec
Python

Download historical 13F filing data directly from the United States (U.S.) Securities Exchange Commission (SEC).

Last updated Apr 1, 2026
40
Stars
9
Forks
1
Issues
0
Stars/day
Attention Score
20
Language breakdown
Python 100.0%
Files click to expand
README

finsec

Download historical filing data directly from the United States (U.S.) Securities Exchange Commission (SEC).

finsec</em>logo

[!IMPORTANT]
finsec is not affiliated, endorsed, or vetted by the United. States. Securities Exchange Commission. It's an open-source tool that uses the SEC's publicly available APIs. This tool is intended for research and informational purposes only. It should not be used for making financial decisions. Always consult with a qualified financial advisor for investment guidance.
You should refer to SEC Edgar's website for more details (here)

Python version PyPi version PyPi status PyPi downloads Star this repo Python package

Blogs

Check out the following blog post for a detailed tutorial on how finsec has been used to aid with analysing the performance of some of the world's most prestigious hedge funds:
Unravelling investment fund manager strategies through 13f SEC filings.

Quickstart

Review 13F filings for Berkshire Hathaway CIK 0001067983

import finsec
filing = finsec.Filing('0001067983')    # Optional declared user variable can be input here (e.g. declared_user="Joe Blog Joe.Blog@gmail.com")

Return the latest 13F reported holdings for Berkshire Hathaway.

print(filing.latest13ffiling)
Output: | | Name of issuer | Title of class | CUSIP | Share or principal type | Holding value | Share or principal amount count | |---:|:------------------------|:-----------------|:----------|:--------------------------|----------------:|----------------------------------:| | 0 | ACTIVISION BLIZZARD INC | COM | 00507V109 | SH | 4470946000 | 60141866 | | 1 | ALLY FINL INC | COM | 02005N100 | SH | 834901000 | 30000000 | | 2 | AMAZON COM INC | COM | 023135106 | SH | 1205258000 | 10666000 |

Note: Using the latest13ffiling function will return the the latest "simplified" version of the 13F Information Table, this works well in most instances... However, there are some who may want to have a more detailed breakdown of the filing. Such as, which investment manager was responsible for investing in the security and the voting authority type granted. This can be handled with the function latest13ffiling_detailed (below).

# Return the latest detailed 13F reported holdings for Berkshire Hathaway.
print(filing.latest13ffiling_detailed)
Output: | | Name of issuer | Title of class | CUSIP | Holding value | Share or principal type | Share or principal amount count | Put or call | Investment discretion | Other manager | Voting authority sole count | Voting authority shared count | Voting authority none count | |---:|:------------------------|:-----------------|:----------|----------------:|:--------------------------|----------------------------------:|:--------------|:------------------------|:----------------|------------------------------:|--------------------------------:|------------------------------:| | 0 | ACTIVISION BLIZZARD INC | COM | 00507V109 | 1906458000 | SH | 25645116 | | DFND | 4,8,11 | 25645116 | 0 | 0 | | 1 | ACTIVISION BLIZZARD INC | COM | 00507V109 | 85095000 | SH | 1144672 | | DFND | 4,10 | 1144672 | 0 | 0 | | 2 | ACTIVISION BLIZZARD INC | COM | 00507V109 | 2479393000 | SH | 33352078 | | DFND | 4,11 | 33352078 | 0 | 0 |
# Return the latest 13F cover page details for Berkshire Hathaway.
filing.latest13ffilingcoverpage

#Output {'filingmanager': 'Berkshire Hathaway Inc', 'businessaddress': '3555 Farnam Street, Omaha, NE, 68131', 'submissiontype': '13F-HR', 'periodofreport': '09-30-2022', 'signaturename': 'Marc D. Hamburg', 'signaturetitle': 'Senior Vice President', 'signaturephone': '402-346-1400', 'signaturecity': 'Omaha', 'signaturestate': 'NE', 'signaturedate': '11-14-2022', 'portfoliovalue': 296096640000, 'count_holdings': 179}

Return the attributes of a specific 13F filing for the specified cik. In the below example we are looking to grab the cover page, full holdings table and simplified holdings table for Berkshire for Q2-2022 (Calendar Year).

q2coverpage, q2holdingstable, q2simplifiedholdingstable = filing.geta13ffiling("Q2-2022") print(q2coverpage) print(q2holdingstable) print(q2simplifiedholdings_table)

Return the json object containing all 13F filings that are stored as part of the filing object (note this includes everything we've searched for so far).

filing.filings

Write filings to excel. Record everything we've looked at to Excel.

filing.filingstoexcel

Installation

Install finsec using pip:
{.sourceCode .bash}
$ pip install finsec

Requirements

Note that the above packages will be downloaded automatically using pip.

Author

Stephen Hogg

🔗 More in this category

© 2026 GitRepoTrend · git-shogg/finsec · Updated daily from GitHub