From d0a0e70b2e557c8c6dafce5ff1fb2f31d0db3e87 Mon Sep 17 00:00:00 2001 From: Athe-kunal Date: Sat, 3 Feb 2024 14:33:42 -0500 Subject: [PATCH] killed process fix --- llama_hub/sec_filings/README.md | 2 +- llama_hub/sec_filings/base.py | 6 +++--- llama_hub/sec_filings/main.py | 6 ++++++ llama_hub/sec_filings/secData.py | 10 ++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 llama_hub/sec_filings/main.py diff --git a/llama_hub/sec_filings/README.md b/llama_hub/sec_filings/README.md index f82e17d8b3..8d102a097d 100644 --- a/llama_hub/sec_filings/README.md +++ b/llama_hub/sec_filings/README.md @@ -13,7 +13,7 @@ python install -r requirements.txt The SEC Downloader expects 4 attributes * tickers: It is a list of valid tickers -* forms (List): 10-K or 10-Q or S-1 filing type +* filing_types (List): 10-K or 10-Q or S-1 filing type * include_amends: To include amendments or not. * year: The year for which you need the data diff --git a/llama_hub/sec_filings/base.py b/llama_hub/sec_filings/base.py index e9bdab6e13..c550525135 100644 --- a/llama_hub/sec_filings/base.py +++ b/llama_hub/sec_filings/base.py @@ -12,7 +12,7 @@ def __init__( self, ticker: str, year: int, - filing_type: List[str], + filing_types: List[str], include_amends: bool = True, amount: int = None, ): @@ -27,7 +27,7 @@ def __init__( self.ticker = ticker self.year = str(year) - self.forms = filing_type + self.filing_types = filing_types self.include_amends = include_amends if amount is not None: warnings.warn( @@ -39,7 +39,7 @@ def __init__( def load_data(self) -> List[Document]: section_texts = sec_main( - self.ticker, self.year, self.forms, self.include_amends + self.ticker, self.year, self.filing_types, self.include_amends ) docs = [] for filings in section_texts: diff --git a/llama_hub/sec_filings/main.py b/llama_hub/sec_filings/main.py new file mode 100644 index 0000000000..224c69d664 --- /dev/null +++ b/llama_hub/sec_filings/main.py @@ -0,0 +1,6 @@ +from base import SECFilingsLoader + +if __name__ == '__main__': + docs = SECFilingsLoader(ticker="AAPL",year=2023,filing_types=["10-K","10-Q"]) + d = docs.load_data() + print(d) \ No newline at end of file diff --git a/llama_hub/sec_filings/secData.py b/llama_hub/sec_filings/secData.py index 517df2bbfb..f10ce9f052 100644 --- a/llama_hub/sec_filings/secData.py +++ b/llama_hub/sec_filings/secData.py @@ -9,15 +9,17 @@ def sec_main( - ticker: str, year: str, forms: List[str] = ["10-K", "10-Q"], include_amends=True + ticker: str, year: str, filing_types: List[str] = ["10-K", "10-Q"], include_amends=True ): cik = get_cik_by_ticker(ticker) rgld_cik = int(cik.strip("0")) - + forms = [] if include_amends: - for form in forms: + for form in filing_types: + forms.append(form) forms.append(form + "/A") - + else: + forms = filing_types url = f"https://data.sec.gov/submissions/CIK{cik}.json" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"