edgartools


Nameedgartools JSON
Version 2.21.0 PyPI version JSON
download
home_pageNone
SummaryOne of the nicest looking EDGAR libraries out there
upload_time2024-05-02 16:07:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords company edgar filings finance financial python reports sec
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- align a paragraph to the center -->
<p align="center">
<a href="https://github.com/dgunning/edgartools">
    <img src="https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/edgartools-logo.png" alt="edgar-tools-logo" height="80">
</a>
</p>
<p align="center">The world's easiest, most powerful edgar library</p>

[![PyPI - Version](https://img.shields.io/pypi/v/edgartools.svg)](https://pypi.org/project/edgartools)
![GitHub last commit](https://img.shields.io/github/last-commit/dgunning/edgartools)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/dgunning/edgartools/python-hatch-workflow.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/dgunning/edgartools/badge)](https://www.codefactor.io/repository/github/dgunning/edgartools)
[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
![GitHub](https://img.shields.io/github/license/dgunning/edgartools)
-----

<p align="center">
<a href="https://github.com/dgunning/edgartools">
    <img src="https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/edgar-demo.gif" alt="edgardemo" height="500">
</a>
</p>

# Features

- 🧠 **Intuitive and easy to use**: **edgartools** has a super simple API that is easy to use.
- 🛠️ **Works as a library or a CLI**: You can use edgartools as a library in your code or as a CLI tool.
- 📁 **Access any SEC filing**: You can access any SEC filing since 1994.
- 📅 **List filings for any date range**: You can list filings for any **year, quarter** e.g. or date range `2024-02-29:2024-03-15`
- 🌟 **Best looking edgar library**: Uses **[rich](https://rich.readthedocs.io/en/stable/introduction.html)** library to display SEC Edgar data in a beautiful way.
- 🔄 **Page through filings**: Use `filings.next()` and `filings.previous()` to page through filings
- 🏗️ **Build Data Pipelines**: Build data pipelines by finding, filtering, transforming and saving filings
- ✅ **Select a filing**: You can select a filing from the list of filings.
- 📄 **View the filing as HTML or text**: Find a filing then get the content as HTML or text.
- 🔢 **Chunk filing text**: You can chunk the filing text into sections for vector embedding.
- 🔍 **Preview the filing**: You can preview the filing in the terminal or a notebook.
- 🔎 **Search through a filing**: You can search through a filing for a keyword.
- 📊 **Parse XBRL**: If a filing has XBRL, you can parse it to a dataframe.
- 💾 **Data Objects**: Automatically downloads and parses filings into data objects.
- 📥 **Download any attachment**: You can download any attachment from the filing.
- 🔢 **Get company by Ticker or Cik**: You can get a company using a ticker `Company("SNOW")` or a cik `Company(1640147)`
- 📚 **Get company filings**: You can get all the company's historical filings using `company.get_filings()`
- 📈 **Get company facts**: You can get company facts using `company.get_facts()`
- 💰 **Company Financials**: You can get company financials using `company.financials`
- 🔍 **Lookup Ticker by CUSIP**: You can lookup a ticker by CUSIP
- 📑 **Dataset of SEC entities**: You can get a dataset of SEC companies and persons
- 📈 **Fund Reports**: Search for and get 13F-HR fund reports
- 👤 **Insider Transactions**: Search for and get insider transactions

# Getting started

Install using pip
```bash
pip install edgartools
```

Import and start using
```python
from edgar import *

# Tell the SEC who you are
set_identity("Michael Mccallum mike.mccalum@indigo.com")

filings = get_filings()
```

# Concepts

## How do I find a filing?
Depends on what you know

### A. I know the accession number

```python
filing = find("0001065280-23-000273")
```

### B. I know the company ticker or cik

```python
filings = Company("NFLX").get_filings(form="10-Q").latest(1)
```

### C. Show me a list of filings

```python
filings = get_filings(form="10-Q")
filing = filings[0]
```

## What can I do with a filing

You can **view** it in the terminal or **open** it in the browser, get the filing as **html**, **xml** or **text**, 
and download **attachments**. You can extract data from the filing into a data object.

## What can I do with a company

You can get the company's **filings**, **facts** and **financials**.

# How to use edgartools

| Task                                 | Code                                                  |
|--------------------------------------|-------------------------------------------------------|
| Set your EDGAR identity in Linux/Mac | `export EDGAR_IDENTITY="First Last email@domain.com"` |
| Set your EDGAR identity in Windows   | `set EDGAR_IDENTITY="First Last email@domain.com"`    |
| Set identity in Windows Powershell   | `$env:EDGAR_IDENTITY="First Last email@domain.com"`   |
| Set identity in Python               | `set_identity("First Last email@domain.com")`         |
| Importing the library                | `from edgar import *`                                 |

### Working with filings

| Task                               | Code                                          |
|------------------------------------|-----------------------------------------------|
| Get filings for the year to date   | `filings = get_filings()`                     |
| Get only xbrl filings              | `filings = get_filings(index="xbrl")`         |
| Get filings for a specific year    | `filings = get_filings(2020)`                 |
| Get filings for a specific quarter | `filings = get_filings(2020, 1)`              |
| Get filings for multiple years     | `filings = get_filings([2020, 2021])`         |
| Get filigs for a range of years    | `filings = get_filings(year=range(2010, 2020)` |
| Get filings for a specific form    | `filings = get_filings(form="10-K")`          |
| Get filings for a list of forms    | `filings = get_filings(form=["10-K", "10-Q"])` |
| Show the next page of filings      | `filings.next()`                              |
| Show the previous page of filings  | `filings.prev()`                              |
| Get the first n filings            | `filings.head(20)`                            |
| Get the last n filings             | `filings.tail(20)`                            |
| Get the latest n filings by date   | `filings.latest(20)`                          |
| Get a random sample of the filings | `filings.sample(20)`                          |
| Filter filings on a date           | `filings = filings.filter(date="2020-01-01")` |
| Filter filings between dates       | `filings.filter(date="2020-01-01:2020-03-01")` |
| Filter filings before a date       | `filings.filter(date=":2020-03-01")`          |  
| Filter filings after a date        | `filings.filter(date="2020-03-01:")`          |
| Get filings as a pandas dataframe  | `filings.to_pandas()`                         |

### Working with a filing

| Task                                      | Code                                                      |
|-------------------------------------------|-----------------------------------------------------------|
| Get a single filing                       | `filing = filings[3]`                                     |
| Get a filing by accession number          | `filing = get_by_accession_number("0000320193-20-34576")` |
| Get the filing homepage                   | `filing.homepage`                                         |
| Open a filing in the browser              | `filing.open()`                                           |
| Open the filing homepage in the browser   | `filing.homepage.open()`                                  |
| View the filing in the terminal           | `filing.view()`                                           |
| Get the html of the filing document       | `filing.html()`                                           |
| Get the XBRL of the filing document       | `filing.xbrl()`                                           |
| Get the filing document as markdown       | `filing.markdown()`                                       |
| Get the full submission text of a filing  | `filing.text()`                                           |
| Get and parse the data object of a filing | `filing.obj()`                                            |
| Get the filing attachments                | `filing.attachments`                                      |
| Get a single attachment                   | `attachment = filing.attachments[0]`                      |
| Open an attachment in the browser         | `attachment.open()`                                       |
| Download an attachment                    | `content = attachment.download()`                         |

### Working with a company

| Task                                     | Code                                                          |
|------------------------------------------|---------------------------------------------------------------|
| Get a company by ticker                  | `company = Company("AAPL")`                                   |
| Get a company by CIK                     | `company = Company("0000320193")`                             |
| Get company facts                        | `company.get_facts()`                                         |
| Get company facts as a pandas dataframe  | `company.get_facts().to_pandas()`                             |
| Get company filings                      | `company.get_filings()`                                       |
| Get company filings by form              | `company.get_filings(form="10-K")`                            |
| Get a company filing by accession_number | `company.get_filing(accession_number="0000320193-21-000139")` |
| Get the company's financials             | `company.financials`                                          |
| Get the company's balance sheet          | `company.financials.balance_sheet`                            |
| Get the company's income statement       | `company.financials.income_statement`                         |
| Get the company's cash flow statement    | `company.financials.cash_flow_statement`                      |

# Installation

```console
pip install edgartools
```

# Usage


## Set your Edgar user identity

Before you can access the SEC Edgar API you need to set the identity that you will use to access Edgar.
This is usually your name and email, or a company name and email.
```bash
Sample Company Name AdminContact@<sample company domain>.com
```

The user identity is sent in the User-Agent string and the Edgar API will refuse to respond to your request without it.

EdgarTools will look for an environment variable called `EDGAR_IDENTITY` and use that in each request.
So, you need to set this environment variable before using it.

### Setting EDGAR_IDENTITY in Linux/Mac
```bash
export EDGAR_IDENTITY="Michael Mccallum mcalum@gmail.com"
```

### Setting EDGAR_IDENTITY in Windows Powershell
```bash
 $Env:EDGAR_IDENTITY="Michael Mccallum mcalum@gmail.com"
```
Alternatively, you can call `set_identity` which does the same thing.

```python
from edgar import set_identity
set_identity("Michael Mccallum mcalum@gmail.com")
```
For more detail see https://www.sec.gov/os/accessing-edgar-data

## Usage

### Importing edgar

```python
from edgar import *
```

## [Using the Filing API](FILING_API.md)
Use the Filing API when you are not working with a specific company, but want to get a list of filings.

For details on how to use the Filing API see **[Using the Filing API](FILING_API.md)**

## [Using the Company API](COMPANY_API.md)

With the Company API you can find a company by ticker or CIK, and get the company's filings, facts and financials.

```python
Company("AAPL")
        .get_filings(form="10-Q")
        .latest(1)
        .obj()
```

![expe](docs/images/aapl-10Q.png)

See **[Using the Company API](COMPANY_API.md)**

## Viewing and downloading attachments

Every filing has a list of attachments. You can view the attachments using `filing.attachments`

```python
# View the attachments
filing.attachments
```
![Filing attachments](https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/filing_attachments.png)

You can access each attachment using the bracket operator `[]` and the index of the attachment.
    
```python
# Get the first attachment
attachment = filing.attachments[0]
```

![Filing attachments](https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/filing_attachment.png)

You can download the attachment using `attachment.download()`. This will download the attachment to string or bytes in memory. 

## Automatic parsing of filing data

Now the reason you may want to download attachments is to get information contained in data files.
For example, **13F-HR** filings have attached infotable.xml files containing data from the holding report for that filing.

Fortunately, the library handles this for you. If you call `filing.obj()` it will automatically download and parse the data files
into a data object, for several different form types. Currently, the following forms are supported:

| Form                       | Data Object            | Description                           |
|----------------------------|------------------------|---------------------------------------|
| 10-K                       | `TenK`                 | Annual report                         |
| 10-Q                       | `TenQ`                 | Quarterly report                      |
| 8-K                        | `EightK`               | Current report                        |
| MA-I                       | `MunicipalAdvisorForm` | Municipal advisor initial filing      |
| Form 144                   | `Form144`              | Notice of proposed sale of securities |
| C, C-U, C-AR, C-TR         | `FormC`                | Form C Crowdfunding Offering          |
| D                          | `FormD`                | Form D Offering                       |
| 3,4,5                      | `Ownership`            | Ownership reports                     |
| 13F-HR                     | `ThirteenF`            | 13F Holdings Report                   |
| NPORT-P                    | `FundReport`           | Fund Report                           |
| EFFECT                     | `Effect`               | Notice of Effectiveness               |
| And other filing with XBRL | `FilingXbrl`           |                                       |

For example, to get the data object for a **13F-HR** filing you can do the following:

```python
filings = get_filings(form="13F-HR")
filing = filings[0]
thirteenf = filing.obj()
```

![Filing attachments](docs/images/thirteenF.png)

If you call `obj()` on a filing that does not have a data file, then it will return `None`.


## Working with XBRL filings

Some filings are in **XBRL (eXtensible Business Markup Language)** format. 
These are mainly the newer filings, as the SEC has started requiring this for newer filings.

If a filing is in XBRL format then it opens up a lot more ways to get structured data about that specific filing and also 
about the company referred to in that filing.

The `Filing` class has an `xbrl` function that will download, parse and structure the filing's XBRL document if one exists.
If it does not exist, then `filing.xbrl()` will return `None`.

The function `filing.xbrl()` returns a `FilingXbrl` instance, which wraps the data, and provides convenient
ways of working with the xbrl data.


```python
filing_xbrl = filing.xbrl()
```

![Filing homapage](https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/10Q_xbrl.jpg)

## Financials

Some filings, notably **10-K** and **10-Q** filings contain financial statements in XBRL format. 
You can get the financials from the XBRL data using the `Financials` class.

```python
from edgar.financials import Financials
financials = Financials.from_xbrl(filing.xbrl())
financials.balance_sheet
financials.income_statement
financials.cash_flow_statement
```
Or automatically through the `Tenk` and `TenQ` data objects.

Here is an example that gets the latest Apple financials

```python
tenk = Company("AAPL").get_filings(form="10-K").latest(1).obj()
financials = tenk.financials
financials.balance_sheet
```
![Balance Sheet](docs/images/balance_sheet.png)

### Get the financial data as a pandas dataframe

Each of the financial statements - `BalanceSheet`, `IncomeStatement` and `CashFlowStatement` - have a `to_dataframe()` method that will return the data as a pandas dataframe.

```python
balance_sheet_df = financials.balance_sheet.to_dataframe()
```


# Contributing

Contributions are welcome! We would love to hear your thoughts on how this library could be better at working with SEC Edgar.

## Reporting Issues
We use GitHub issues to track public bugs. 
Report a bug by [opening a new issue](https://github.com/dgunning/edgartools/issues); it's that easy!

## Making code changes
- Fork the repo and create your branch from master.
- If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
- Ensure the test suite passes.
- Make sure your code lints.
- Issue that pull request!



# License

`edgartools` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

## Contact

[LinkedIn](https://www.linkedin.com/in/dwight-gunning-860124/)


## Supporters
[![Stargazers repo roster for @dgunning/edgartools](https://reporoster.com/stars/dgunning/edgartools)](https://github.com/dgunning/edgartools/stargazers)
[![Forkers repo roster for @dgunning/edgartools](https://reporoster.com/forks/dgunning/edgartools)](https://github.com/dgunning/edgartools/network/members)

## Subscribe to Polar
<picture>
2  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/embed/subscribe.svg?org=polarsource&label=Subscribe&darkmode">
3  <img alt="Subscribe on Polar" src="https://polar.sh/embed/subscribe.svg?org=polarsource&label=Subscribe">
4</picture>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "edgartools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "company, edgar, filings, finance, financial, python, reports, sec",
    "author": null,
    "author_email": "Dwight Gunning <dgunning@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1a/9c/bfdd81036f08e23a56ab9cdaeda46dd1cd930a12e0437b866ffcacc90930/edgartools-2.21.0.tar.gz",
    "platform": null,
    "description": "<!-- align a paragraph to the center -->\n<p align=\"center\">\n<a href=\"https://github.com/dgunning/edgartools\">\n    <img src=\"https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/edgartools-logo.png\" alt=\"edgar-tools-logo\" height=\"80\">\n</a>\n</p>\n<p align=\"center\">The world's easiest, most powerful edgar library</p>\n\n[![PyPI - Version](https://img.shields.io/pypi/v/edgartools.svg)](https://pypi.org/project/edgartools)\n![GitHub last commit](https://img.shields.io/github/last-commit/dgunning/edgartools)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/dgunning/edgartools/python-hatch-workflow.yml)\n[![CodeFactor](https://www.codefactor.io/repository/github/dgunning/edgartools/badge)](https://www.codefactor.io/repository/github/dgunning/edgartools)\n[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)\n![GitHub](https://img.shields.io/github/license/dgunning/edgartools)\n-----\n\n<p align=\"center\">\n<a href=\"https://github.com/dgunning/edgartools\">\n    <img src=\"https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/edgar-demo.gif\" alt=\"edgardemo\" height=\"500\">\n</a>\n</p>\n\n# Features\n\n- \ud83e\udde0 **Intuitive and easy to use**: **edgartools** has a super simple API that is easy to use.\n- \ud83d\udee0\ufe0f **Works as a library or a CLI**: You can use edgartools as a library in your code or as a CLI tool.\n- \ud83d\udcc1 **Access any SEC filing**: You can access any SEC filing since 1994.\n- \ud83d\udcc5 **List filings for any date range**: You can list filings for any **year, quarter** e.g. or date range `2024-02-29:2024-03-15`\n- \ud83c\udf1f **Best looking edgar library**: Uses **[rich](https://rich.readthedocs.io/en/stable/introduction.html)** library to display SEC Edgar data in a beautiful way.\n- \ud83d\udd04 **Page through filings**: Use `filings.next()` and `filings.previous()` to page through filings\n- \ud83c\udfd7\ufe0f **Build Data Pipelines**: Build data pipelines by finding, filtering, transforming and saving filings\n- \u2705 **Select a filing**: You can select a filing from the list of filings.\n- \ud83d\udcc4 **View the filing as HTML or text**: Find a filing then get the content as HTML or text.\n- \ud83d\udd22 **Chunk filing text**: You can chunk the filing text into sections for vector embedding.\n- \ud83d\udd0d **Preview the filing**: You can preview the filing in the terminal or a notebook.\n- \ud83d\udd0e **Search through a filing**: You can search through a filing for a keyword.\n- \ud83d\udcca **Parse XBRL**: If a filing has XBRL, you can parse it to a dataframe.\n- \ud83d\udcbe **Data Objects**: Automatically downloads and parses filings into data objects.\n- \ud83d\udce5 **Download any attachment**: You can download any attachment from the filing.\n- \ud83d\udd22 **Get company by Ticker or Cik**: You can get a company using a ticker `Company(\"SNOW\")` or a cik `Company(1640147)`\n- \ud83d\udcda **Get company filings**: You can get all the company's historical filings using `company.get_filings()`\n- \ud83d\udcc8 **Get company facts**: You can get company facts using `company.get_facts()`\n- \ud83d\udcb0 **Company Financials**: You can get company financials using `company.financials`\n- \ud83d\udd0d **Lookup Ticker by CUSIP**: You can lookup a ticker by CUSIP\n- \ud83d\udcd1 **Dataset of SEC entities**: You can get a dataset of SEC companies and persons\n- \ud83d\udcc8 **Fund Reports**: Search for and get 13F-HR fund reports\n- \ud83d\udc64 **Insider Transactions**: Search for and get insider transactions\n\n# Getting started\n\nInstall using pip\n```bash\npip install edgartools\n```\n\nImport and start using\n```python\nfrom edgar import *\n\n# Tell the SEC who you are\nset_identity(\"Michael Mccallum mike.mccalum@indigo.com\")\n\nfilings = get_filings()\n```\n\n# Concepts\n\n## How do I find a filing?\nDepends on what you know\n\n### A. I know the accession number\n\n```python\nfiling = find(\"0001065280-23-000273\")\n```\n\n### B. I know the company ticker or cik\n\n```python\nfilings = Company(\"NFLX\").get_filings(form=\"10-Q\").latest(1)\n```\n\n### C. Show me a list of filings\n\n```python\nfilings = get_filings(form=\"10-Q\")\nfiling = filings[0]\n```\n\n## What can I do with a filing\n\nYou can **view** it in the terminal or **open** it in the browser, get the filing as **html**, **xml** or **text**, \nand download **attachments**. You can extract data from the filing into a data object.\n\n## What can I do with a company\n\nYou can get the company's **filings**, **facts** and **financials**.\n\n# How to use edgartools\n\n| Task                                 | Code                                                  |\n|--------------------------------------|-------------------------------------------------------|\n| Set your EDGAR identity in Linux/Mac | `export EDGAR_IDENTITY=\"First Last email@domain.com\"` |\n| Set your EDGAR identity in Windows   | `set EDGAR_IDENTITY=\"First Last email@domain.com\"`    |\n| Set identity in Windows Powershell   | `$env:EDGAR_IDENTITY=\"First Last email@domain.com\"`   |\n| Set identity in Python               | `set_identity(\"First Last email@domain.com\")`         |\n| Importing the library                | `from edgar import *`                                 |\n\n### Working with filings\n\n| Task                               | Code                                          |\n|------------------------------------|-----------------------------------------------|\n| Get filings for the year to date   | `filings = get_filings()`                     |\n| Get only xbrl filings              | `filings = get_filings(index=\"xbrl\")`         |\n| Get filings for a specific year    | `filings = get_filings(2020)`                 |\n| Get filings for a specific quarter | `filings = get_filings(2020, 1)`              |\n| Get filings for multiple years     | `filings = get_filings([2020, 2021])`         |\n| Get filigs for a range of years    | `filings = get_filings(year=range(2010, 2020)` |\n| Get filings for a specific form    | `filings = get_filings(form=\"10-K\")`          |\n| Get filings for a list of forms    | `filings = get_filings(form=[\"10-K\", \"10-Q\"])` |\n| Show the next page of filings      | `filings.next()`                              |\n| Show the previous page of filings  | `filings.prev()`                              |\n| Get the first n filings            | `filings.head(20)`                            |\n| Get the last n filings             | `filings.tail(20)`                            |\n| Get the latest n filings by date   | `filings.latest(20)`                          |\n| Get a random sample of the filings | `filings.sample(20)`                          |\n| Filter filings on a date           | `filings = filings.filter(date=\"2020-01-01\")` |\n| Filter filings between dates       | `filings.filter(date=\"2020-01-01:2020-03-01\")` |\n| Filter filings before a date       | `filings.filter(date=\":2020-03-01\")`          |  \n| Filter filings after a date        | `filings.filter(date=\"2020-03-01:\")`          |\n| Get filings as a pandas dataframe  | `filings.to_pandas()`                         |\n\n### Working with a filing\n\n| Task                                      | Code                                                      |\n|-------------------------------------------|-----------------------------------------------------------|\n| Get a single filing                       | `filing = filings[3]`                                     |\n| Get a filing by accession number          | `filing = get_by_accession_number(\"0000320193-20-34576\")` |\n| Get the filing homepage                   | `filing.homepage`                                         |\n| Open a filing in the browser              | `filing.open()`                                           |\n| Open the filing homepage in the browser   | `filing.homepage.open()`                                  |\n| View the filing in the terminal           | `filing.view()`                                           |\n| Get the html of the filing document       | `filing.html()`                                           |\n| Get the XBRL of the filing document       | `filing.xbrl()`                                           |\n| Get the filing document as markdown       | `filing.markdown()`                                       |\n| Get the full submission text of a filing  | `filing.text()`                                           |\n| Get and parse the data object of a filing | `filing.obj()`                                            |\n| Get the filing attachments                | `filing.attachments`                                      |\n| Get a single attachment                   | `attachment = filing.attachments[0]`                      |\n| Open an attachment in the browser         | `attachment.open()`                                       |\n| Download an attachment                    | `content = attachment.download()`                         |\n\n### Working with a company\n\n| Task                                     | Code                                                          |\n|------------------------------------------|---------------------------------------------------------------|\n| Get a company by ticker                  | `company = Company(\"AAPL\")`                                   |\n| Get a company by CIK                     | `company = Company(\"0000320193\")`                             |\n| Get company facts                        | `company.get_facts()`                                         |\n| Get company facts as a pandas dataframe  | `company.get_facts().to_pandas()`                             |\n| Get company filings                      | `company.get_filings()`                                       |\n| Get company filings by form              | `company.get_filings(form=\"10-K\")`                            |\n| Get a company filing by accession_number | `company.get_filing(accession_number=\"0000320193-21-000139\")` |\n| Get the company's financials             | `company.financials`                                          |\n| Get the company's balance sheet          | `company.financials.balance_sheet`                            |\n| Get the company's income statement       | `company.financials.income_statement`                         |\n| Get the company's cash flow statement    | `company.financials.cash_flow_statement`                      |\n\n# Installation\n\n```console\npip install edgartools\n```\n\n# Usage\n\n\n## Set your Edgar user identity\n\nBefore you can access the SEC Edgar API you need to set the identity that you will use to access Edgar.\nThis is usually your name and email, or a company name and email.\n```bash\nSample Company Name AdminContact@<sample company domain>.com\n```\n\nThe user identity is sent in the User-Agent string and the Edgar API will refuse to respond to your request without it.\n\nEdgarTools will look for an environment variable called `EDGAR_IDENTITY` and use that in each request.\nSo, you need to set this environment variable before using it.\n\n### Setting EDGAR_IDENTITY in Linux/Mac\n```bash\nexport EDGAR_IDENTITY=\"Michael Mccallum mcalum@gmail.com\"\n```\n\n### Setting EDGAR_IDENTITY in Windows Powershell\n```bash\n $Env:EDGAR_IDENTITY=\"Michael Mccallum mcalum@gmail.com\"\n```\nAlternatively, you can call `set_identity` which does the same thing.\n\n```python\nfrom edgar import set_identity\nset_identity(\"Michael Mccallum mcalum@gmail.com\")\n```\nFor more detail see https://www.sec.gov/os/accessing-edgar-data\n\n## Usage\n\n### Importing edgar\n\n```python\nfrom edgar import *\n```\n\n## [Using the Filing API](FILING_API.md)\nUse the Filing API when you are not working with a specific company, but want to get a list of filings.\n\nFor details on how to use the Filing API see **[Using the Filing API](FILING_API.md)**\n\n## [Using the Company API](COMPANY_API.md)\n\nWith the Company API you can find a company by ticker or CIK, and get the company's filings, facts and financials.\n\n```python\nCompany(\"AAPL\")\n        .get_filings(form=\"10-Q\")\n        .latest(1)\n        .obj()\n```\n\n![expe](docs/images/aapl-10Q.png)\n\nSee **[Using the Company API](COMPANY_API.md)**\n\n## Viewing and downloading attachments\n\nEvery filing has a list of attachments. You can view the attachments using `filing.attachments`\n\n```python\n# View the attachments\nfiling.attachments\n```\n![Filing attachments](https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/filing_attachments.png)\n\nYou can access each attachment using the bracket operator `[]` and the index of the attachment.\n    \n```python\n# Get the first attachment\nattachment = filing.attachments[0]\n```\n\n![Filing attachments](https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/filing_attachment.png)\n\nYou can download the attachment using `attachment.download()`. This will download the attachment to string or bytes in memory. \n\n## Automatic parsing of filing data\n\nNow the reason you may want to download attachments is to get information contained in data files.\nFor example, **13F-HR** filings have attached infotable.xml files containing data from the holding report for that filing.\n\nFortunately, the library handles this for you. If you call `filing.obj()` it will automatically download and parse the data files\ninto a data object, for several different form types. Currently, the following forms are supported:\n\n| Form                       | Data Object            | Description                           |\n|----------------------------|------------------------|---------------------------------------|\n| 10-K                       | `TenK`                 | Annual report                         |\n| 10-Q                       | `TenQ`                 | Quarterly report                      |\n| 8-K                        | `EightK`               | Current report                        |\n| MA-I                       | `MunicipalAdvisorForm` | Municipal advisor initial filing      |\n| Form 144                   | `Form144`              | Notice of proposed sale of securities |\n| C, C-U, C-AR, C-TR         | `FormC`                | Form C Crowdfunding Offering          |\n| D                          | `FormD`                | Form D Offering                       |\n| 3,4,5                      | `Ownership`            | Ownership reports                     |\n| 13F-HR                     | `ThirteenF`            | 13F Holdings Report                   |\n| NPORT-P                    | `FundReport`           | Fund Report                           |\n| EFFECT                     | `Effect`               | Notice of Effectiveness               |\n| And other filing with XBRL | `FilingXbrl`           |                                       |\n\nFor example, to get the data object for a **13F-HR** filing you can do the following:\n\n```python\nfilings = get_filings(form=\"13F-HR\")\nfiling = filings[0]\nthirteenf = filing.obj()\n```\n\n![Filing attachments](docs/images/thirteenF.png)\n\nIf you call `obj()` on a filing that does not have a data file, then it will return `None`.\n\n\n## Working with XBRL filings\n\nSome filings are in **XBRL (eXtensible Business Markup Language)** format. \nThese are mainly the newer filings, as the SEC has started requiring this for newer filings.\n\nIf a filing is in XBRL format then it opens up a lot more ways to get structured data about that specific filing and also \nabout the company referred to in that filing.\n\nThe `Filing` class has an `xbrl` function that will download, parse and structure the filing's XBRL document if one exists.\nIf it does not exist, then `filing.xbrl()` will return `None`.\n\nThe function `filing.xbrl()` returns a `FilingXbrl` instance, which wraps the data, and provides convenient\nways of working with the xbrl data.\n\n\n```python\nfiling_xbrl = filing.xbrl()\n```\n\n![Filing homapage](https://raw.githubusercontent.com/dgunning/edgartools/main/docs/images/10Q_xbrl.jpg)\n\n## Financials\n\nSome filings, notably **10-K** and **10-Q** filings contain financial statements in XBRL format. \nYou can get the financials from the XBRL data using the `Financials` class.\n\n```python\nfrom edgar.financials import Financials\nfinancials = Financials.from_xbrl(filing.xbrl())\nfinancials.balance_sheet\nfinancials.income_statement\nfinancials.cash_flow_statement\n```\nOr automatically through the `Tenk` and `TenQ` data objects.\n\nHere is an example that gets the latest Apple financials\n\n```python\ntenk = Company(\"AAPL\").get_filings(form=\"10-K\").latest(1).obj()\nfinancials = tenk.financials\nfinancials.balance_sheet\n```\n![Balance Sheet](docs/images/balance_sheet.png)\n\n### Get the financial data as a pandas dataframe\n\nEach of the financial statements - `BalanceSheet`, `IncomeStatement` and `CashFlowStatement` - have a `to_dataframe()` method that will return the data as a pandas dataframe.\n\n```python\nbalance_sheet_df = financials.balance_sheet.to_dataframe()\n```\n\n\n# Contributing\n\nContributions are welcome! We would love to hear your thoughts on how this library could be better at working with SEC Edgar.\n\n## Reporting Issues\nWe use GitHub issues to track public bugs. \nReport a bug by [opening a new issue](https://github.com/dgunning/edgartools/issues); it's that easy!\n\n## Making code changes\n- Fork the repo and create your branch from master.\n- If you've added code that should be tested, add tests.\n- If you've changed APIs, update the documentation.\n- Ensure the test suite passes.\n- Make sure your code lints.\n- Issue that pull request!\n\n\n\n# License\n\n`edgartools` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n\n## Contact\n\n[LinkedIn](https://www.linkedin.com/in/dwight-gunning-860124/)\n\n\n## Supporters\n[![Stargazers repo roster for @dgunning/edgartools](https://reporoster.com/stars/dgunning/edgartools)](https://github.com/dgunning/edgartools/stargazers)\n[![Forkers repo roster for @dgunning/edgartools](https://reporoster.com/forks/dgunning/edgartools)](https://github.com/dgunning/edgartools/network/members)\n\n## Subscribe to Polar\n<picture>\n2  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://polar.sh/embed/subscribe.svg?org=polarsource&label=Subscribe&darkmode\">\n3  <img alt=\"Subscribe on Polar\" src=\"https://polar.sh/embed/subscribe.svg?org=polarsource&label=Subscribe\">\n4</picture>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "One of the nicest looking EDGAR libraries out there",
    "version": "2.21.0",
    "project_urls": {
        "Documentation": "https://dgunning.github.io/edgartools/",
        "Issues": "https://github.com/dgunning/edgartools/issues",
        "Source": "https://github.com/dgunning/edgartools"
    },
    "split_keywords": [
        "company",
        " edgar",
        " filings",
        " finance",
        " financial",
        " python",
        " reports",
        " sec"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ea0cd6024d4439840ac068ce8c605c9c36ce00cd1250f12d02dc6a0d7c51c430",
                "md5": "b13d8c671393ebb41dd2c6f603a1af58",
                "sha256": "a432872407328ba502b337d22d40720a10f3e923f6f0c0a72e2c6220ba25e115"
            },
            "downloads": -1,
            "filename": "edgartools-2.21.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b13d8c671393ebb41dd2c6f603a1af58",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1107774,
            "upload_time": "2024-05-02T16:07:29",
            "upload_time_iso_8601": "2024-05-02T16:07:29.560730Z",
            "url": "https://files.pythonhosted.org/packages/ea/0c/d6024d4439840ac068ce8c605c9c36ce00cd1250f12d02dc6a0d7c51c430/edgartools-2.21.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1a9cbfdd81036f08e23a56ab9cdaeda46dd1cd930a12e0437b866ffcacc90930",
                "md5": "1a90e8adff8853777e604c3fa61b0697",
                "sha256": "ac4a60704143774d31a0c1b84fe7f56f92f459b0aa70b956aa6c02c182742dea"
            },
            "downloads": -1,
            "filename": "edgartools-2.21.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1a90e8adff8853777e604c3fa61b0697",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1092018,
            "upload_time": "2024-05-02T16:07:32",
            "upload_time_iso_8601": "2024-05-02T16:07:32.702451Z",
            "url": "https://files.pythonhosted.org/packages/1a/9c/bfdd81036f08e23a56ab9cdaeda46dd1cd930a12e0437b866ffcacc90930/edgartools-2.21.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-02 16:07:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dgunning",
    "github_project": "edgartools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "edgartools"
}
        
Elapsed time: 0.25720s