Ejemplo n.º 1
0
 def test_validate_cik(self):
     with pytest.raises(CIKError):
         Filing(cik='0notvalid0', filing_type='10-k')
         Filing(cik='123', filing_type='10-k')
         Filing(cik='012345678910', filing_type='10-k')
         Filing(cik=1234567891011, filing_type='10-k')
     with pytest.raises(ValueError):
         Filing(cik=123.0, filing_type='10-k')
Ejemplo n.º 2
0
 def test_validate_cik(self):
     with pytest.raises(CIKError):
         Filing(cik='0notvalid0', filing_type=FilingType.FILING_10K)
     with pytest.raises(CIKError):
         Filing(cik='012345678910', filing_type=FilingType.FILING_10K)
     with pytest.raises(CIKError):
         Filing(cik=1234567891011, filing_type=FilingType.FILING_10K)
     with pytest.raises(ValueError):
         Filing(cik=123.0, filing_type=FilingType.FILING_10K)
Ejemplo n.º 3
0
 def test_validate_cik(self):
     # string remains unchecked until query to allow for possibility of
     # using company name, ticker, or CIK as string
     with pytest.raises(EDGARQueryError):
         Filing(cik='0notvalid0', filing_type=FilingType.FILING_10K)
     with pytest.raises(EDGARQueryError):
         Filing(cik='012345678910', filing_type=FilingType.FILING_10K)
     # float and int not accepted, raising TypeError from CIK Validator
     with pytest.raises(TypeError):
         Filing(cik=1234567891011, filing_type=FilingType.FILING_10K)
     with pytest.raises(TypeError):
         Filing(cik=123.0, filing_type=FilingType.FILING_10K)
Ejemplo n.º 4
0
def get_10k_from_cik(cik_ticker_list, year):
    for cik, ticker in cik_ticker_list:
        print(ticker)
        my_filings = Filing(cik, filing_type=FilingType.FILING_10K, count=2)
        my_filings.save('data/SEC/10-k/' + ticker + "/")
        remove_extra_data('data/SEC/10-k/' + ticker, "10-k")
Ejemplo n.º 5
0
def valid_filing_13f():
    return Filing(aapl_cik, FilingType.FILING_13F, count=3)
Ejemplo n.º 6
0
def valid_filing_8k():
    return Filing(aapl_cik, FilingType.FILING_8K, count=3)
Ejemplo n.º 7
0
 def test_invalid_filing_type_types(self):
     for t in ('10j', '10-k', 'ssd', 'invalid', 1):
         with pytest.raises(FilingTypeError):
             Filing(cik='0000320193', filing_type=t)
Ejemplo n.º 8
0
 def test_invalid_filing_type_enum(self):
     with pytest.raises(AttributeError):
         Filing(cik='0000320193', filing_type=FilingType.INVALID)
Ejemplo n.º 9
0
def filing():
    return Filing("0000320193", "10-q", count=3)
Ejemplo n.º 10
0
from SECEdgar.filings import Filing

cik = '0000712515'

filing = Filing(cik=cik, filing_type='10-q', count=15)
filing.save('data')
Ejemplo n.º 11
0
 def test_valid_filing_types(self):
     with pytest.raises(FilingTypeError):
         Filing(cik='0000320193', filing_type='10j')
         Filing(cik='0000320193', filing_type='10--k')
         Filing(cik='0000320193', filing_type='ssd')
Ejemplo n.º 12
0
 def test_filing_get_urls_returns_single_list_of_urls(self):
     ciks = CIK(['aapl', 'msft', 'amzn'])
     f = Filing(ciks, FilingType.FILING_10Q, count=3)
     if len(f.get_urls()) != 9:
         raise AssertionError("Expected list of length 9.")
Ejemplo n.º 13
0
 def test_filing_save_single_cik(self, single_valid_cik, tmp_data_directory):
     f = Filing(single_valid_cik, FilingType.FILING_10Q, count=3)
     f.save(tmp_data_directory)
Ejemplo n.º 14
0
 def test_filing_save_multiple_ciks(self, multiple_valid_ciks, tmp_data_directory):
     f = Filing(multiple_valid_ciks, FilingType.FILING_10Q, count=3)
     f.save(tmp_data_directory)