Ejemplo n.º 1
0
 def test_mmm(self):
     '''This was getting a text file instead of xml.
     
     '''
     filings = edgar.get_filings(symbol='MMM', filing_type='10-Q')
     filing = filings[filings.bisect(date(2010, 1, 4))]
     self.assertTrue(filing._document._xbrl_url.endswith('.xml'))
Ejemplo n.º 2
0
 def test_mmm(self):
     '''This was getting a text file instead of xml.
     
     '''
     filings = edgar.get_filings(symbol='MMM', filing_type='10-Q')
     filing = filings[filings.bisect(date(2010, 1, 4))]
     self.assertTrue(filing._document._xbrl_url.endswith('.xml'))
Ejemplo n.º 3
0
 def test_get_filing(self):
     filings = edgar.get_filings(symbol='aapl', filing_type='10-Q')
     filing = filings[filings.bisect(date(2013, 1, 23)) - 1]
     self.assertEqual(
         urllib.parse.urlsplit(
             filing._document._xbrl_url).path.split('/')[-1],
         'aapl-20120630.xml')
Ejemplo n.º 4
0
def earnings_per_share(required_data):
    start, end = required_data.index[0], required_data.index[-1]
    for symbol, values in required_data.iteritems():
        print 'getting symbol {}'.format(symbol)
        filings = edgar.get_filings(symbol=symbol, filing_type='10-Q')
        filings = filings[filings.bisect(start) - 1:filings.bisect(end)]
        for filing in filings:
            value = EPS.value_from_filing(filing)
            interval_start = filing.first_tradable_date
            interval_end = filing.next_filing and filing.next_filing.first_tradable_date
            values[interval_start:interval_end] = value

    return required_data
def earnings_per_share(required_data):
    start, end = required_data.index[0], required_data.index[-1]
    for symbol, values in required_data.iteritems():
        print 'getting symbol {}'.format(symbol)
        filings = edgar.get_filings(symbol=symbol, 
                                    filing_type='10-Q')
        filings = filings[filings.bisect(start) - 1:filings.bisect(end)]
        for filing in filings:
            value = EPS.value_from_filing(filing)
            interval_start = filing.first_tradable_date
            interval_end = filing.next_filing and filing.next_filing.first_tradable_date
            values[interval_start:interval_end] = value
            
    return required_data
Ejemplo n.º 6
0
    def test_ABBV(self, text):
        '''Test page with no 10-Q's, downloaded 2013-3-2, 
        ABBV had just been spun off or something.
        
        '''
        with open(tests.asset_file_path('abbv_search_results.html')) as test_html:
            text.return_value = test_html.read()

        ticker = 'ABBV'
        urls = edgar._get_document_page_urls(symbol=ticker, filing_type='10-Q')
        self.assertFalse(list(urls))
        filing_type = '10-Q'
        filings = edgar.get_filings(symbol=ticker, filing_type=filing_type)
        self.assertEqual(len(filings), 0)
Ejemplo n.º 7
0
    def test_ABBV(self, text):
        '''Test page with no 10-Q's, downloaded 2013-3-2, 
        ABBV had just been spun off or something.
        
        '''
        with open(tests.asset_file_path(
                'abbv_search_results.html')) as test_html:
            text.return_value = test_html.read()

        ticker = 'ABBV'
        urls = edgar._get_document_page_urls(symbol=ticker, filing_type='10-Q')
        self.assertFalse(list(urls))
        filing_type = '10-Q'
        filings = edgar.get_filings(symbol=ticker, filing_type=filing_type)
        self.assertEqual(len(filings), 0)
import pandas as pd
import financial_fundamentals.edgar as edgar
from financial_fundamentals.accounting_metrics import BookValuePerShare

date_range = pd.date_range('2019-10-18', '2019-10-18')
ticker = [
    "AMZN", "TSLA", "MSFT", "GOOG", "F", "ORCL", "AAPL", "WFC", "TOL", "BA",
    "NKE"
]
# ticker = ["AMZN"]

required_data = pd.DataFrame(columns=ticker, index=date_range)
for each_symbol in ticker:
    print(each_symbol)
    filings = edgar.get_filings(symbol=each_symbol, filing_type='10-Q')[-1]
    book_value_per_share = BookValuePerShare.value_from_filing(filings)
    print(book_value_per_share)
Ejemplo n.º 9
0
 def test_get_filing(self):
     filings = edgar.get_filings(symbol='aapl', filing_type='10-Q')
     filing = filings[filings.bisect(date(2013, 1, 23)) - 1]
     self.assertEqual(urlparse.urlsplit(filing._document._xbrl_url).path.split('/')[-1],
                      'aapl-20120630.xml')