get_fund method only gets the first page's NPORT-P filings
init_ticker = 'CAAPX'
fund = get_fund(init_ticker)
filings = fund.filings.filter(form="NPORT-P")
print(len(filings))
the output is 9, but actually, there are 22 NPORT-P filings
version: edgartools-3.12.1 python-3.12
Yes this is a bug.
By default the filling data coming back is just the first page. In an older version of the code it would loop through all the pages and fetch all the filings. This was changed to have filings only return the first page and get_filings trigger the full load - necessary to get fillings to work with LocalStorage. However, funds were not updated to trigger the full load.
The other issues is that filings and get_filings might be confusing so I will think about maybe changing filings to _filings and just have users use get_filings when I add it to the Funds class.
I will see what I can do this weekend
This is fixed internally - testing now. Should be available in a couple days
Fixed in 3.12.2
@dgunning Thanks for the fix. But it seems like nothing has changed in 3.12.2. I updated edgartools to version 3.12.2, and the output is still 9.
Fixed in 3.12.2
You should see the following with edgartools 3.12.2
See if you can check if the code has changed in your environment
python -c "import inspect; import edgar; print(inspect.getsource(edgar.funds.get_fund_with_filings))"
You should see the while loop that gets more filings
def get_fund_with_filings(contract_or_series_id: str):
"""Uses this url https://www.sec.gov/cgi-bin/browse-edgar?CIK={}
to get the fund class or series including the filings
"""
... previous code
filing_index = company_info.filings.data
while True:
# Get the next page
next_page = base_url + f"&start={start}&count={count}"
fund_text = download_text(next_page)
soup = BeautifulSoup(fund_text, features="html.parser")
filing_index_on_page = FundCompanyInfo.extract_filings(soup, company_info.name, company_info.cik)
if len(filing_index_on_page) == 0:
break
filing_index = pa.concat_tables([filing_index, filing_index_on_page])
start += count
I will test on a different machine and see if the functionality has changed
f=get_fund("CAAPX")
filings=f.filings.filter(form="NPORT-P")
print(f)
print(filings)
print(len(filings))
python -c "import inspect; import edgar; print(inspect.getsource(edgar.funds.get_fund_with_filings))"
Can you try to run this notebook
https://github.com/dgunning/edgartools/blob/main/notebooks/Fund-Filings.ipynb
sorry, it's my local Python environment problem. It's fixed.