How to get 10k fillings for the russell 3000 constituents using sec-api?

156 Views Asked by At

Is it possible to fetch the 10-K filings using something like the following?

from sec_api import QueryApi

query_api = QueryApi(api_key='YOUR_API_KEY')

# Define search parameters
index_ticker = 'RUA'  # Russell 3000 index ticker symbol
filing_type = '10-K'
start_date = '2020-01-01'
end_date = '2020-12-31'

# Build query
query = {
    'query': {
        'bool': {
            'must': [
                {'match': {'indexTic': index_ticker}},
                {'match': {'formType': filing_type}},
                {'range': {'filedAt': {'gte': start_date, 'lte': end_date}}}
            ]
        }
    },
    'size': 10
}

# Send query and get results
results = query_api.get_filings(query)

In the response format, I don't see any information on the index. Therefore should I approach it in the following:

  1. Get the constituents of the Russell 3000 index
  2. Fetch 10-K filling for each
from sec_api import QueryApi

query_api = QueryApi(api_key='YOUR_API_KEY')

# Define search parameters
ticker = 'AAPL'
filing_type = '10-K'
start_date = '2020-01-01'
end_date = '2020-12-31'

# Build query
query = {
    'query': {
        'bool': {
            'must': [
                {'match': {'ticker': ticker}},
                {'match': {'formType': filing_type}},
                {'range': {'filedAt': {'gte': start_date, 'lte': end_date}}}
            ]
        }
    },
    'size': 10
}

# Send query and get results
results = query_api.get_filings(query)

As you can see, this solution seems to be inefficient.

0

There are 0 best solutions below