diff --git a/myql/contrib/finance/stockscraper/stockretriever.py b/myql/contrib/finance/stockscraper/stockretriever.py index 2f0f4a5..47eeb46 100644 --- a/myql/contrib/finance/stockscraper/stockretriever.py +++ b/myql/contrib/finance/stockscraper/stockretriever.py @@ -36,7 +36,6 @@ def get_current_info(self, symbolList, columns=None): """get_current_info() uses the yahoo.finance.quotes datatable to get all of the stock information presented in the main table on a typical stock page and a bunch of data from the key statistics page. """ - #symbolList = symbolList if not isinstance(symbolList, str) else (symbolList,) response = self.select('yahoo.finance.quotes',columns).where(['symbol','in',symbolList]) return response @@ -86,6 +85,12 @@ def get_dividendhistory(self, symbol, startDate, endDate, items=None): response = self.select('yahoo.finance.dividendhistory', items).where(['symbol', '=', symbol], ['startDate', '=', startDate], ['endDate', '=', endDate]) return response + def get_balancesheet(self, symbol): + """Retrieves balance sheet + """ + response = self.select('yahoo.finance.balancesheet').where(['symbol', '=', symbol]) + return response + def get_symbols(self, name): """Retrieves all symbols belonging to a company """ diff --git a/tests/tests.py b/tests/tests.py index 3e20d31..69a4bc2 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -298,6 +298,11 @@ def test_get_dividendhistory(self,): logging.debug(pretty_json(data.content)) self.assertEqual(data.status_code, 200) + def test_get_balancesheet(self,): + data = self.stock.get_balancesheet('YHOO') + logging.debug(pretty_json(data.content)) + self.assertEqual(data.status_code, 200) + class TestTable(unittest.TestCase):