-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathsubmissions.py
73 lines (56 loc) · 1.91 KB
/
submissions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from edgar.session import EdgarSession
from edgar.utilis import EdgarUtilities
class Submissions():
"""
## Overview:
----
Allows a user to query each entity’s current filing
history using the SEC Restful API.
"""
def __init__(self, session: EdgarSession) -> None:
"""Initializes the `Submissions` object.
### Parameters
----
session : `EdgarSession`
An initialized session of the `EdgarSession`.
### Usage
----
>>> edgar_client = EdgarClient()
>>> submissions_service = edgar_client.submissions()
"""
# Set the session.
self.edgar_session: EdgarSession = session
self.edgar_utilities: EdgarUtilities = EdgarUtilities()
def __repr__(self) -> str:
"""String representation of the `EdgarClient.Submissions` object."""
# define the string representation
str_representation = '<EdgarClient.Submissions(active=True, connected=True)>'
return str_representation
def get_submissions(self, cik: str) -> dict:
"""Returns all the ownership filings for a given CIK number.
### Arguments:
----
cik : str
The CIK number you want to query.
### Returns:
----
dict :
A collection of `Submission` resource objects.
### Usage:
----
>>> edgar_client = EdgarClient()
>>> submissions_service = edgar_client.submissions()
>>> submissions_service.get_submissions(
cik='1326801'
)
"""
if len(cik) < 10:
num_of_zeros = 10 - len(cik)
cik = num_of_zeros*"0" + cik
# Grab the Data.
response = self.edgar_session.make_request(
method='get',
endpoint=f'/submissions/CIK{cik}.json',
use_api=True
)
return response