Coder Social home page Coder Social logo

janlukasschroeder / sec-api-python Goto Github PK

View Code? Open in Web Editor NEW
151.0 6.0 23.0 99 KB

Python SEC EDGAR Filings API. Over 18 million filings, all 150 filing types supported. Query, full-text search and real-time stream API. Convert XBRL-to-JSON and access standardized financial statements from 10-K and 10-Q filings.

Home Page: https://sec-api.io

License: MIT License

Python 100.00%
edgar-filings sec-edgar-api 10-k 10-q edgar-database edgar-api 13f-api

sec-api-python's Issues

QueryAPI won't find every filing

I have noticed that the QueryApi seems to ignore some filings when I am looking for the DEF 14A filing.

from sec_api import QueryApi

queryApi = QueryApi(api_key="MY-API-KEY")

query = {
  "query": { "query_string": { 
      "query": "cik:896878 AND filedAt:{2001-01-01 TO 2001-12-31} AND formType:\"DEF 14A\"" 
    } },
  "from": "0",
  "size": "10",
  "sort": [{ "filedAt": { "order": "desc" } }]
}

filings = queryApi.get_filings(query)

print(filings)

In the example, the company 896878 filed a DEF 14A on the 2001-11-29 but the API somehow won't find it.
If I extend the time period from 2000-01-01 TO 2005-12-31, the API only finds the DEF 14A for the years 2000, 2002, 2004 and 2005 even though there is a filing for every year in EDGAR.

Connection error HTTPSConnectionPool

Hi,
I'm having the following issue:
HTTPSConnectionPool(host='archive.sec-api.iohttps', port=443): Max retries exceeded with url: ...
Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at ...>: Failed to resolve 'archive.sec-api.iohttps' ([Errno -2] Name or service not known)"

The links are working, my connection is stable. Is there maybe a way to increase retries for renderApi.get_filing() or another workaround?

Thanks

Error in code within Documentation

In the documentation for CIK, CUSIP, Ticker Mapping API. The Example : Python presents code to identify all active Nasdaq (and later NYSE) traded entities. The specific line of code with the error is:

nasdaq_listings_active = all_nasdaq_listings[all_nasdaq_listings['isDelisted'] != False]

This returns results for entities where isDelisted = True. These firms are no longer active. The results presented are the correct outputs for the code, but are incorrectly attributed as active entities. This error persists as the bar chart included is therefore incorrect. This may lead to misinterpreted results.

extractorApi gives "504 Gateway Time-out"

I've tried extractorApi and got 504 Gateway Time-out for some of the URLs. Here are two URLs that you can reproduce this:

https://www.sec.gov/Archives/edgar/data/1179929/000117992920000026/moh-12312019x10k.htm
https://www.sec.gov/Archives/edgar/data/831001/000083100120000031/c-12312019x10k.htm

Here is an example query:

extractorApi.get_section("https://www.sec.gov/Archives/edgar/data/1179929/000117992920000026/moh-12312019x10k.htm", "1", "text")

I checked both of these filings and they don't follow the generic 10-K format. So I would understand if they are harder to parse.

XbrlApi Reference

I think you need to add XbrlApi in your init.py for the latest update.

While importing xbrlApi, it is throwing an error.

ImportError: cannot import name 'XbrlApi' from 'sec_api'

name = "sec_api"
from sec_api.index import QueryApi
from sec_api.index import FullTextSearchApi
from sec_api.index import RenderApi

extractor endpoint returns ambigious

It appears that the /extractor endpoint returns "processing" when a document section is not yet available. But it also appears that it returns "processing" in some other cases like when a section does not exist at all (like in 8-K's where most sections don't exist for a given url). Is there some way of disambiguating the "doesn't exist yet" case from the "doesn't exist at all" case?

TypeError when raising exception

When sec_api tries to raise an exception, it causes a TypeError:

Traceback (most recent call last):
  File "/Users/fisher/PycharmProjects/s1extract/s1extract/api/sec_api_download.py", line 68, in <module>
    main()
  File "/Users/fisher/PycharmProjects/s1extract/s1extract/api/sec_api_download.py", line 64, in main
    download_s1_html(firm.ticker_symbol)
  File "/Users/fisher/PycharmProjects/s1extract/s1extract/api/sec_api_download.py", line 51, in download_s1_html
    html_string = RENDER_API.get_filing(url)
  File "/Users/fisher/PycharmProjects/s1extract/.venv/lib/python3.9/site-packages/sec_api/index.py", line 86, in get_filing
    raise Exception("API error: " + response.status_code)
TypeError: can only concatenate str (not "int") to str

Since response.status_code is an int, it cannot be concatenated to the preceding string.
This can be fixed by casting response.status_code to a string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.