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

Commit

Permalink
quarter value mods and readme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Athe-kunal committed Feb 5, 2024
1 parent d3d8fcc commit 9046eb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion llama_hub/sec_filings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ It also returns the following metadata
* Filing Date of the filing
* Reporting date of the filing
* Accession number of the filing (unique identifier of the filing)
* form type: "10-K" or "10-Q1", "10-Q2", "10-Q3"
* form type: "10-K" or "10-Q1", "10-Q2", "10-Q3" and for amended documents, it will end with /A
* Section name of the text

There are also section names in different document types. You can check it by running
Expand Down
10 changes: 6 additions & 4 deletions llama_hub/sec_filings/secData.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from llama_hub.sec_filings.prepline_sec_filings.fetch import get_cik_by_ticker
import requests
from llama_hub.sec_filings.prepline_sec_filings.fetch import get_filing
import pandas as pd
from datetime import datetime


def sec_main(
Expand Down Expand Up @@ -39,17 +41,17 @@ def sec_main(
form_lists = []
filings = json_data["filings"]
recent_filings = filings["recent"]
quarter_val = 3
for acc_num, form_name, filing_date, report_date in zip(
recent_filings["accessionNumber"],
recent_filings["form"],
recent_filings["filingDate"],
recent_filings["reportDate"],
):
if form_name in forms and filing_date.startswith(str(year)):
if form_name in forms and report_date.startswith(str(year)):
if form_name == "10-Q":
form_name += str(quarter_val)
quarter_val -= 1
datetime_obj = datetime.strptime(report_date, "%Y-%m-%d")
quarter = pd.Timestamp(datetime_obj).quarter
form_name += str(quarter)
no_dashes_acc_num = re.sub("-", "", acc_num)
form_lists.append([no_dashes_acc_num, form_name, filing_date, report_date])

Expand Down

0 comments on commit 9046eb0

Please sign in to comment.