Skip to content

Instantly share code, notes, and snippets.

@janlukasschroeder
Last active June 13, 2022 09:49
Show Gist options
  • Save janlukasschroeder/2d1e297f07d0152ebf4ad9b112b2cd3b to your computer and use it in GitHub Desktop.
Save janlukasschroeder/2d1e297f07d0152ebf4ad9b112b2cd3b to your computer and use it in GitHub Desktop.
from sec_api import ExecCompApi
execCompApi = ExecCompApi("YOUR_API_KEY")
# Get data by ticker
result_ticker = execCompApi.get_data("TSLA")
# Get data by CIK
result_cik = execCompApi.get_data("1326801")
# List all exec compensations of CIK 70858 for year 2020 and 2019
# Sort result by year first, by name second
query = {
"query": {"query_string": {"query": "cik:70858 AND (year:2020 OR year:2019)"}},
"from": "0",
"size": "200",
"sort": [{"year": {"order": "desc"}}, {"name.keyword": {"order": "asc"}}],
}
result_query = execCompApi.get_data(query)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment