Skip to content

Instantly share code, notes, and snippets.

@janlukasschroeder
Last active June 12, 2022 13:36
Show Gist options
  • Save janlukasschroeder/09e851830ed91409e6b89e3a9b2aa036 to your computer and use it in GitHub Desktop.
Save janlukasschroeder/09e851830ed91409e6b89e3a9b2aa036 to your computer and use it in GitHub Desktop.
SEC Filings API - Python 3.x Example
from sec_api import QueryApi
queryApi = QueryApi(api_key="YOUR_API_KEY")
query = {
"query": { "query_string": {
"query": "ticker:TSLA AND filedAt:[2020-01-01 TO 2020-12-31] AND formType:\"10-Q\"",
"time_zone": "America/New_York"
} },
"from": "0",
"size": "10",
"sort": [{ "filedAt": { "order": "desc" } }]
}
filings = queryApi.get_filings(query)
print(filings)
@NagarajG05
Copy link

Hi
Thanks for the code.
Is there a python API to fetch analysts ranking from TipRanks.com ?

Thanks

@andhavarapusrinivas
Copy link

Hi Jan,

I want to get the fund prospectus using the below. But couldnt , could you please advise if I am missing something here ?

from sec_api import QueryApi

queryApi = QueryApi(api_key="included my key here")

query = {
"query": { "query_string": {
# "query": "companyName:"1290 SmartBeta Equity Fund""
"query": "ticker:"TNBIX""
} },
"from": "0",
"size": "10",
"sort": [{ "filedAt": { "order": "desc" } }]
}

filings = queryApi.get_filings(query)

print(filings)

@andhavarapusrinivas
Copy link

Below is the output i got.
{'total': {'value': 0, 'relation': 'eq'}, 'query': {'from': 0, 'size': 10}, 'filings': []}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment