Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

SEC Filings loader bug fixes #909

Merged
merged 15 commits into from
Feb 13, 2024
Prev Previous commit
Next Next commit
amount deprecating warning
  • Loading branch information
Athe-kunal committed Feb 2, 2024
commit 81423d304555a2f4c12076a5dc45f571699867d0
28 changes: 25 additions & 3 deletions llama_hub/sec_filings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
from llama_hub.sec_filings.secData import sec_main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure to add this file to extra_files in library.json ( see github repo loader)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SEC filings already exists in library.json. I added it when I first committed the loader. Do I need to modify it again?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah see some other files that have the extra_files parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have added this

from datetime import datetime
from typing import List
import warnings
import sys


class SECFilingsLoader(BaseReader):
def __init__(
self, ticker: str, year: int, forms: List[str], include_amends: bool = True
self,
ticker: str,
year: int,
filing_type: List[str],
include_amends: bool = True,
amount: int = None,
Athe-kunal marked this conversation as resolved.
Show resolved Hide resolved
):
"""SEC Filings loader for 10-K, 10-Q and S-1 filings

Expand All @@ -20,11 +27,17 @@ def __init__(

self.ticker = ticker
self.year = str(year)
self.forms = forms
self.forms = filing_type
self.include_amends = include_amends
if amount is not None:
warnings.warn(
"The 'amount' attribute is deprecated and is removed in the current implementation. Please avoid using it, rather provide the specific year.",
DeprecationWarning,
stacklevel=2,
)
sys.exit(1)

def load_data(self) -> List[Document]:

section_texts = sec_main(
self.ticker, self.year, self.forms, self.include_amends
)
Expand All @@ -46,3 +59,12 @@ def load_data(self) -> List[Document]:
)
)
return docs

#Test case file test.py

# from base import SECFilingsLoader

# if __name__ == '__main__':
# docs = SECFilingsLoader(ticker="AAPL",year=2023,filing_type=["10-K"])
# d = docs.load_data()
# print(d)
Loading