Skip to content

Commit

Permalink
chore: update readme and test code
Browse files Browse the repository at this point in the history
  • Loading branch information
SeisSerenata committed Jun 30, 2024
1 parent 316add8 commit 19244f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,36 @@ Please reach out at [email protected] for an API key.
```python
import os
import sec_agent_sdk
from sec_agent_sdk import FormType, FilingTable
from sec_agent_sdk import ApiClient, DefaultApi, FilingTable, FormType
from sec_agent_sdk.rest import ApiException
from pprint import pprint

configuration = sec_agent_sdk.Configuration()

# Configure API key authorization: APIKeyHeader
configuration.api_key['APIKeyHeader'] = os.environ["API_KEY"]
configuration.api_key["APIKeyHeader"] = "YOUR-API-KEY"

# Enter a context with an instance of the API client
with sec_agent_sdk.ApiClient(configuration) as api_client:
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = sec_agent_sdk.DefaultApi(api_client)
form_type = FormType.EIGHT_K # FormType | 10-K | 10-Q | 8-K | 6-K
company = 'AA' # ticker
table = FilingTable.BALANCE_SHEET # FilingTable | 'cash-flow-statement' | 'income-statement' | 'balance-sheet' | 'business-segments-and-kpis'
date_filed = '2024-04-17' # optional str (date string in YYYY-mm-dd) or None(the latest filing will be retrieved)
api_instance = DefaultApi(api_client)
form_type = FormType.EIGHT_K # FormType | 10-K | 10-Q | 8-K | 6-K
company = "AAPL" # ticker
table = (
FilingTable.BALANCE_SHEET
) # FilingTable | 'cash-flow-statement' | 'income-statement' | 'balance-sheet'
# date_filed = '2024-04-17' # optional str (date string in YYYY-mm-dd) or None(the latest filing will be retrieved)

try:
# Search sec filing
api_response = api_instance.search_sec_filing(form_type, company, table, date_filed)
api_response = api_instance.search_sec_filing_get(form_type, company, table)
print("The response of DefaultApi->search_sec_filing:\n")
pprint(api_response)

# Search sec filing v2
api_response = api_instance.search_sec_filing_v2_get(form_type, company, table)
print("The response of DefaultApi->search_sec_filing_v2:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->search_sec_filing: %s\n" % e)

Expand Down
13 changes: 9 additions & 4 deletions test/aisec_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = DefaultApi(api_client)
form_type = FormType.TEN_Q # FormType | 10-K | 10-Q | 8-K | 6-K
company = "AMZN" # ticker
form_type = FormType.EIGHT_K # FormType | 10-K | 10-Q | 8-K | 6-K
company = "AAPL" # ticker
# date_filed = '2024-04-17' # str | date string in YYYY-mm-dd
table = (
FilingTable.BUSINESS_SEGMENTS_AND_KPIS
FilingTable.BALANCE_SHEET
) # FilingTable | 'cash-flow-statement' | 'income-statement' | 'balance-sheet'

try:
# Search sec filing
api_response = api_instance.search_sec_filing(form_type, company, table)
api_response = api_instance.search_sec_filing_get(form_type, company, table)
print("The response of DefaultApi->search_sec_filing:\n")
pprint(api_response)

# Search sec filing v2
api_response = api_instance.search_sec_filing_v2_get(form_type, company, table)
print("The response of DefaultApi->search_sec_filing_v2:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->search_sec_filing: %s\n" % e)

0 comments on commit 19244f7

Please sign in to comment.