finsec


Namefinsec JSON
Version 0.0.12 PyPI version JSON
download
home_pageNone
SummaryDownload historical filing data directly from the United States Securities Exchange Commission (SEC)!
upload_time2024-06-22 09:57:33
maintainerNone
docs_urlNone
authorStephen Hogg
requires_pythonNone
licenseApache
keywords pandas sec securities exchange commission finance pandas datareader
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # finsec

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

![finsec_logo](assets/finsec_logo.png)

> [!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](https://www.sec.gov/os/accessing-edgar-data))**

<a target="new" href="https://pypi.python.org/pypi/finsec"><img border=0 src="https://img.shields.io/badge/python-3.7+-blue.svg?style=flat" alt="Python version"></a>
<a target="new" href="https://pypi.python.org/pypi/finsec"><img border=0 src="https://img.shields.io/pypi/v/finsec.svg?maxAge=60%" alt="PyPi version"></a>
<a target="new" href="https://pypi.python.org/pypi/finsec"><img border=0 src="https://img.shields.io/pypi/status/finsec.svg?maxAge=60" alt="PyPi status"></a>
<a target="new" href="https://pypi.python.org/pypi/finsec"><img border=0 src="https://img.shields.io/pypi/dm/finsec.svg?maxAge=2592000&label=installs&color=%2327B1FF" alt="PyPi downloads"></a>
<a target="new" href="https://github.com/git-shogg/finsec"><img border=0 src="https://img.shields.io/github/stars/git-shogg/finsec.svg?style=social&label=Star&maxAge=60" alt="Star this repo"></a>
<!-- <a target="new" href="https://github.com/git-shogg/finsec/actions/workflows/ci/badge.svg"><img border=0 src="https://img.shields.io/badge/git-shogg/finsec/main.svg?maxAge=1" alt="Build status"></a> -->
[![Python package](https://github.com/git-shogg/finsec/actions/workflows/ci.yml/badge.svg)](https://github.com/git-shogg/finsec/actions/workflows/ci.yml)

## 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:
</br >[Unravelling investment fund manager strategies through 13f SEC filings](https://medium.com/@stephen.hogg.sh/unravelling-investment-fund-manager-strategies-through-13f-sec-filings-38dc030cf4c6).</br>

## Quickstart
### Review 13F filings for Berkshire Hathaway CIK **0001067983**

```python
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.latest_13f_filing)
```
**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 `latest_13f_filing` 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 `latest_13f_filing_detailed` (below).

```python
# Return the latest detailed 13F reported holdings for Berkshire Hathaway.
print(filing.latest_13f_filing_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 |

```python
# Return the latest 13F cover page details for Berkshire Hathaway.
filing.latest_13f_filing_cover_page

#Output
{'filing_manager': 'Berkshire Hathaway Inc', 'business_address': '3555 Farnam Street, Omaha, NE, 68131', 'submission_type': '13F-HR', 'period_of_report': '09-30-2022', 'signature_name': 'Marc D. Hamburg', 'signature_title': 'Senior Vice President', 'signature_phone': '402-346-1400', 'signature_city': 'Omaha', 'signature_state': 'NE', 'signature_date': '11-14-2022', 'portfolio_value': 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). 
q2_cover_page, q2_holdings_table, q2_simplified_holdings_table = filing.get_a_13f_filing("Q2-2022")
print(q2_cover_page)
print(q2_holdings_table)
print(q2_simplified_holdings_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.filings_to_excel
```

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

# Requirements
-   [Python](https://www.python.org) \>=  3.7+
-   [Pandas](https://github.com/pydata/pandas) \>= 1.3.5
-   [lxml](https://pypi.org/project/lxml) \>= 4.8.0
-   [requests](http://docs.python-requests.org/en/master) \>= 2.27.1
-   [beautifulsoup4](https://pypi.org/project/beautifulsoup4) \>= 4.11.1

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

# Author
**Stephen Hogg**


<!-- ## Taxonomy
The [XBRL GAAP Financial Reporting Taxonomy](https://fasb.org/Page/PageContent?PageId=/xbrl/2022financial.html#:~:text=The%202022%20GAAP%20Financial%20Reporting%20Taxonomy%20) is kept up to date by the Financial Accounting Standards Board (FASB) and is used by issuers filing with the U.S. SEC. This taxonomy is levered heavily by finsec to ensure all filing details are captured in strict accordance with SEC rules.  -->

<!-- Explaining the 13F Information Table:

The 13F rule set is outlined herewithin:
https://www.sec.gov/pdf/form13f.pdf

Name of issuer


holdings_table

simplified_holdings_table
This table simplifies the holding table if required. This is particularly useful for businesses that have many different investment managers (e.g. Berkshire Hathaway - where they have 14 separate managers shown below)

![13F_Managers](assets/13F_Managers.PNG)
 -->


























<!-- Introduction

Are you looking for an efficient way to scrape data from the Securities and Exchange Commission (SEC)? If so, then you are in luck because I have recently developed a new Python library designed specifically for this purpose. This library, called SECScraper, is a powerful tool that makes it easy to scrape data from the SEC's website and use it for meaningful analysis.

What is SECScraper?

SECScraper is a Python library that allows developers to quickly and easily scrape data from the SEC's website. It can be used to retrieve information about companies, such as financial statements and filings, as well as more detailed information such as insider trades and ownership data. This library provides a simple interface for developers to access data from the SEC in a structured way, making it easy to work with the data for further analysis.

Features and Benefits

SECScraper is designed to make the process of scraping the SEC's website for data easier and more efficient. It provides a number of features and benefits to developers, including:

• Easy-to-use interface: SECScraper provides a simple, intuitive interface that makes scraping data from the SEC's website as easy as possible.

• Automated data extraction: SEC -->

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "finsec",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pandas, sec, securities exchange commission, finance, pandas datareader",
    "author": "Stephen Hogg",
    "author_email": "stephen.hogg.sh@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/d6/dcb7964bd679fe97dcc44ed6c96acd24f2c82124c65edeeac1ea5801c96d/finsec-0.0.12.tar.gz",
    "platform": "any",
    "description": "# finsec\n\n## Download historical filing data directly from the United States (U.S.) Securities Exchange Commission (SEC).\n\n![finsec_logo](assets/finsec_logo.png)\n\n> [!IMPORTANT]  \n> **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.\n**You\u00a0should\u00a0refer\u00a0to\u00a0SEC Edgar's\u00a0website for more details ([here](https://www.sec.gov/os/accessing-edgar-data))**\n\n<a target=\"new\" href=\"https://pypi.python.org/pypi/finsec\"><img border=0 src=\"https://img.shields.io/badge/python-3.7+-blue.svg?style=flat\" alt=\"Python version\"></a>\n<a target=\"new\" href=\"https://pypi.python.org/pypi/finsec\"><img border=0 src=\"https://img.shields.io/pypi/v/finsec.svg?maxAge=60%\" alt=\"PyPi version\"></a>\n<a target=\"new\" href=\"https://pypi.python.org/pypi/finsec\"><img border=0 src=\"https://img.shields.io/pypi/status/finsec.svg?maxAge=60\" alt=\"PyPi status\"></a>\n<a target=\"new\" href=\"https://pypi.python.org/pypi/finsec\"><img border=0 src=\"https://img.shields.io/pypi/dm/finsec.svg?maxAge=2592000&label=installs&color=%2327B1FF\" alt=\"PyPi downloads\"></a>\n<a target=\"new\" href=\"https://github.com/git-shogg/finsec\"><img border=0 src=\"https://img.shields.io/github/stars/git-shogg/finsec.svg?style=social&label=Star&maxAge=60\" alt=\"Star this repo\"></a>\n<!-- <a target=\"new\" href=\"https://github.com/git-shogg/finsec/actions/workflows/ci/badge.svg\"><img border=0 src=\"https://img.shields.io/badge/git-shogg/finsec/main.svg?maxAge=1\" alt=\"Build status\"></a> -->\n[![Python package](https://github.com/git-shogg/finsec/actions/workflows/ci.yml/badge.svg)](https://github.com/git-shogg/finsec/actions/workflows/ci.yml)\n\n## Blogs\nCheck 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:\n</br >[Unravelling investment fund manager strategies through 13f SEC filings](https://medium.com/@stephen.hogg.sh/unravelling-investment-fund-manager-strategies-through-13f-sec-filings-38dc030cf4c6).</br>\n\n## Quickstart\n### Review 13F filings for Berkshire Hathaway CIK **0001067983**\n\n```python\nimport finsec\nfiling = finsec.Filing('0001067983')    # Optional declared user variable can be input here (e.g. declared_user=\"Joe Blog Joe.Blog@gmail.com\")\n\n# Return the latest 13F reported holdings for Berkshire Hathaway.\nprint(filing.latest_13f_filing)\n```\n**Output:**\n|    | Name of issuer          | Title of class   | CUSIP     | Share or principal type   |   Holding value |   Share or principal amount count |\n|---:|:------------------------|:-----------------|:----------|:--------------------------|----------------:|----------------------------------:|\n|  0 | ACTIVISION BLIZZARD INC | COM              | 00507V109 | SH                        |      4470946000 |                          60141866 |\n|  1 | ALLY FINL INC           | COM              | 02005N100 | SH                        |       834901000 |                          30000000 |\n|  2 | AMAZON COM INC          | COM              | 023135106 | SH                        |      1205258000 |                          10666000 |\n\n*Note*: Using the `latest_13f_filing` 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 `latest_13f_filing_detailed` (below).\n\n```python\n# Return the latest detailed 13F reported holdings for Berkshire Hathaway.\nprint(filing.latest_13f_filing_detailed)\n```\n**Output:**\n|    | 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 |\n|---:|:------------------------|:-----------------|:----------|----------------:|:--------------------------|----------------------------------:|:--------------|:------------------------|:----------------|------------------------------:|--------------------------------:|------------------------------:|\n|  0 | ACTIVISION BLIZZARD INC | COM              | 00507V109 |      1906458000 | SH                        |                          25645116 |               | DFND                    | 4,8,11          |                      25645116 |                               0 |                             0 |\n|  1 | ACTIVISION BLIZZARD INC | COM              | 00507V109 |        85095000 | SH                        |                           1144672 |               | DFND                    | 4,10            |                       1144672 |                               0 |                             0 |\n|  2 | ACTIVISION BLIZZARD INC | COM              | 00507V109 |      2479393000 | SH                        |                          33352078 |               | DFND                    | 4,11            |                      33352078 |                               0 |                             0 |\n\n```python\n# Return the latest 13F cover page details for Berkshire Hathaway.\nfiling.latest_13f_filing_cover_page\n\n#Output\n{'filing_manager': 'Berkshire Hathaway Inc', 'business_address': '3555 Farnam Street, Omaha, NE, 68131', 'submission_type': '13F-HR', 'period_of_report': '09-30-2022', 'signature_name': 'Marc D. Hamburg', 'signature_title': 'Senior Vice President', 'signature_phone': '402-346-1400', 'signature_city': 'Omaha', 'signature_state': 'NE', 'signature_date': '11-14-2022', 'portfolio_value': 296096640000, 'count_holdings': 179}\n\n# 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). \nq2_cover_page, q2_holdings_table, q2_simplified_holdings_table = filing.get_a_13f_filing(\"Q2-2022\")\nprint(q2_cover_page)\nprint(q2_holdings_table)\nprint(q2_simplified_holdings_table)\n\n# 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).\nfiling.filings\n\n# Write filings to excel. Record everything we've looked at to Excel. \nfiling.filings_to_excel\n```\n\n# Installation\nInstall `finsec` using `pip`:\n``` {.sourceCode .bash}\n$ pip install finsec\n```\n\n# Requirements\n-   [Python](https://www.python.org) \\>=  3.7+\n-   [Pandas](https://github.com/pydata/pandas) \\>= 1.3.5\n-   [lxml](https://pypi.org/project/lxml) \\>= 4.8.0\n-   [requests](http://docs.python-requests.org/en/master) \\>= 2.27.1\n-   [beautifulsoup4](https://pypi.org/project/beautifulsoup4) \\>= 4.11.1\n\n*Note* that the above packages will be downloaded automatically using `pip`.\n\n# Author\n**Stephen Hogg**\n\n\n<!-- ## Taxonomy\nThe [XBRL GAAP Financial Reporting Taxonomy](https://fasb.org/Page/PageContent?PageId=/xbrl/2022financial.html#:~:text=The%202022%20GAAP%20Financial%20Reporting%20Taxonomy%20) is kept up to date by the Financial Accounting Standards Board (FASB) and is used by issuers filing with the U.S. SEC. This taxonomy is levered heavily by finsec to ensure all filing details are captured in strict accordance with SEC rules.  -->\n\n<!-- Explaining the 13F Information Table:\n\nThe 13F rule set is outlined herewithin:\nhttps://www.sec.gov/pdf/form13f.pdf\n\nName of issuer\n\n\nholdings_table\n\nsimplified_holdings_table\nThis table simplifies the holding table if required. This is particularly useful for businesses that have many different investment managers (e.g. Berkshire Hathaway - where they have 14 separate managers shown below)\n\n![13F_Managers](assets/13F_Managers.PNG)\n -->\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<!-- Introduction\n\nAre you looking for an efficient way to scrape data from the Securities and Exchange Commission (SEC)? If so, then you are in luck because I have recently developed a new Python library designed specifically for this purpose. This library, called SECScraper, is a powerful tool that makes it easy to scrape data from the SEC's website and use it for meaningful analysis.\n\nWhat is SECScraper?\n\nSECScraper is a Python library that allows developers to quickly and easily scrape data from the SEC's website. It can be used to retrieve information about companies, such as financial statements and filings, as well as more detailed information such as insider trades and ownership data. This library provides a simple interface for developers to access data from the SEC in a structured way, making it easy to work with the data for further analysis.\n\nFeatures and Benefits\n\nSECScraper is designed to make the process of scraping the SEC's website for data easier and more efficient. It provides a number of features and benefits to developers, including:\n\n\u2022 Easy-to-use interface: SECScraper provides a simple, intuitive interface that makes scraping data from the SEC's website as easy as possible.\n\n\u2022 Automated data extraction: SEC -->\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "Download historical filing data directly from the United States Securities Exchange Commission (SEC)!",
    "version": "0.0.12",
    "project_urls": null,
    "split_keywords": [
        "pandas",
        " sec",
        " securities exchange commission",
        " finance",
        " pandas datareader"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c7fddfb3d369b8b7ec4db119fb28a45397037502a49b29f0b3f85a5df095188",
                "md5": "15e8ae48d1ecbefafbb5242591eacfcf",
                "sha256": "550b05e7ee7391d13a098f45dd7d8c1abb60ea9611bcf02ddcee470aaded070a"
            },
            "downloads": -1,
            "filename": "finsec-0.0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "15e8ae48d1ecbefafbb5242591eacfcf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14887,
            "upload_time": "2024-06-22T09:57:31",
            "upload_time_iso_8601": "2024-06-22T09:57:31.881313Z",
            "url": "https://files.pythonhosted.org/packages/3c/7f/ddfb3d369b8b7ec4db119fb28a45397037502a49b29f0b3f85a5df095188/finsec-0.0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d2d6dcb7964bd679fe97dcc44ed6c96acd24f2c82124c65edeeac1ea5801c96d",
                "md5": "d775f1b92a4c9791e6356f94f8d0b928",
                "sha256": "901ceb57b93f0ea6fde98b045787e38e9e5a7c79a7da6b08129588cf236d30ea"
            },
            "downloads": -1,
            "filename": "finsec-0.0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "d775f1b92a4c9791e6356f94f8d0b928",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18166,
            "upload_time": "2024-06-22T09:57:33",
            "upload_time_iso_8601": "2024-06-22T09:57:33.023587Z",
            "url": "https://files.pythonhosted.org/packages/d2/d6/dcb7964bd679fe97dcc44ed6c96acd24f2c82124c65edeeac1ea5801c96d/finsec-0.0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-22 09:57:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "finsec"
}
        
Elapsed time: 0.25377s