From 26425840779a9189e06e7d7eb4e4bbc6050047d7 Mon Sep 17 00:00:00 2001 From: Zhaofeng Zhang <24791380+vcfgv@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:44:24 +0800 Subject: [PATCH 1/2] chore: update edgartools to version 4.34.0 --- python/uv.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/uv.lock b/python/uv.lock index 08f6127aa..a5931b653 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -781,10 +781,11 @@ wheels = [ [[package]] name = "edgartools" -version = "4.12.2" +version = "4.34.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "beautifulsoup4" }, + { name = "hishel" }, { name = "httpx" }, { name = "httpxthrottlecache" }, { name = "humanize" }, @@ -804,9 +805,9 @@ dependencies = [ { name = "tqdm" }, { name = "unidecode" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/1f/50/606e3e3eac50ad0923b937bd1b0b0ce8210291441f659c982b428ea19c51/edgartools-4.12.2.tar.gz", hash = "sha256:1f26d1174abcc9fcd10f63bb9556f7668d6d57a5241f7fef002fad10af61b255", size = 1496360, upload-time = "2025-09-15T00:39:09.337Z" } +sdist = { url = "https://files.pythonhosted.org/packages/8d/7f/2e46d6b485b4711c9f2d67f91150e7193ff7d6db3937cea366cafdfd47c3/edgartools-4.34.0.tar.gz", hash = "sha256:ad81da2e25118b0a2db1398fcf40ccf7ebc4cdc963b8ea11fa48bac64e66d299", size = 1829157, upload-time = "2025-12-01T23:43:50.969Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/04/00/52ed9131f0b5a6c3e633ae544fc42466d5d82cd8f37ef81b1cdb8e78b746/edgartools-4.12.2-py3-none-any.whl", hash = "sha256:f6fbd197465b126ba37963602116b6efa2e4fbacc8005ee8a2f7f71801e4431e", size = 1604127, upload-time = "2025-09-15T00:39:06.946Z" }, + { url = "https://files.pythonhosted.org/packages/fa/7e/c83dfc6a781e167e6c3e365cef727642bbab3386514704628027fbdbfc4c/edgartools-4.34.0-py3-none-any.whl", hash = "sha256:02b87312f75fd4351666308f72f18329aa9956f575116aab5db0ca874a5fef45", size = 1995212, upload-time = "2025-12-01T23:43:52.972Z" }, ] [[package]] From a0805364b59cf3dbdf34c47cd2a7e353b52e7fa0 Mon Sep 17 00:00:00 2001 From: Zhaofeng Zhang <24791380+vcfgv@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:46:50 +0800 Subject: [PATCH 2/2] chore: refactor fetch_periodic_sec_filings and fetch_event_sec_filings to use asyncio for Company calls --- .../agents/research_agent/sources.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/python/valuecell/agents/research_agent/sources.py b/python/valuecell/agents/research_agent/sources.py index f0f4ae879..35d3f8a4b 100644 --- a/python/valuecell/agents/research_agent/sources.py +++ b/python/valuecell/agents/research_agent/sources.py @@ -1,3 +1,4 @@ +import asyncio import os import re from datetime import date, datetime @@ -153,22 +154,27 @@ async def fetch_periodic_sec_filings( List[SECFilingResult] """ req_forms = set(_ensure_list(forms)) or {"10-Q"} - company = Company(cik_or_ticker) + company = await asyncio.to_thread(lambda: Company(cik_or_ticker)) + logger.info(f"Fetching filings for {cik_or_ticker} with params {req_forms}") # If year is omitted, use latest(limit). Quarter without year is not supported. if year is None: if quarter is not None: raise ValueError( "quarter requires year to be specified for periodic filings" ) - filings = company.get_filings(form=list(req_forms)).latest(limit) + filings = await asyncio.to_thread( + lambda: company.get_filings(form=list(req_forms)).latest(limit) + ) if isinstance(filings, EntityFilings): items = list(filings) else: items = [filings] return await _write_and_ingest(items, Path(get_knowledge_path())) - filings = company.get_filings(form=list(req_forms), year=year, quarter=quarter) + filings = await asyncio.to_thread( + lambda: company.get_filings(form=list(req_forms), year=year, quarter=quarter) + ) return await _write_and_ingest(filings, Path(get_knowledge_path())) @@ -199,11 +205,13 @@ async def fetch_event_sec_filings( raise ValueError("start_date cannot be after end_date") req_forms = set(_ensure_list(forms)) or {"8-K"} - company = Company(cik_or_ticker) + company = await asyncio.to_thread(lambda: Company(cik_or_ticker)) # If no date range specified, leverage edgar's latest(count) for efficiency if not sd and not ed: - filings = company.get_filings(form=list(req_forms)).latest(limit) + filings = await asyncio.to_thread( + lambda: company.get_filings(form=list(req_forms)).latest(limit) + ) if isinstance(filings, EntityFilings): items = list(filings) else: @@ -211,7 +219,7 @@ async def fetch_event_sec_filings( return await _write_and_ingest(items, Path(get_knowledge_path())) # Otherwise, fetch and filter by filing_date range - filings = company.get_filings(form=list(req_forms)) + filings = await asyncio.to_thread(lambda: company.get_filings(form=list(req_forms))) if isinstance(filings, EntityFilings): items = list(filings) else: