def fetch_appl(): """Returns stock prices for Apple company.""" yql = YQL('AAPL', '2014-01-01', '2014-01-10') for item in yql: print item.get('date'), item.get('price') yql.select('AAPL', '2014-01-01', '2014-01-10') for item in yql: print item.get('date'), item.get('price')
def fetch_googl(): """Returns stock prices for Google company.""" yql = YQL('GOOGL', '2014-01-01', '2014-01-10') for item in yql: print item.get('date'), item.get('price') yql.select('GOOGL', '2014-01-01', '2014-01-10') for item in yql: print item.get('date'), item.get('price')
def test_appl(self): yql_data = YQL.select('AAPL', '2014-01-10', '2014-01-10') self.assertEqual(YQL.to_date('2014-01-10'), yql_data[0].get('date')) self.assertEqual('73.629744', yql_data[0].get('price')) yql_data = YQL('AAPL', '2014-01-10', '2014-01-10') self.assertEqual(YQL.to_date('2014-01-10'), yql_data[0].get('date')) self.assertEqual('73.629744', yql_data[0].get('price'))
def test_appl(self): yql_data = YQL.select('AAPL', '2014-01-10', '2014-01-10') self.assertEqual(YQL.to_date('2014-01-10'), yql_data[0].get('date')) self.assertEqual('74.57', yql_data[0].get('price')) yql_data = YQL('AAPL', '2014-01-10', '2014-01-10') self.assertEqual(YQL.to_date('2014-01-10'), yql_data[0].get('date')) self.assertEqual('74.57', yql_data[0].get('price'))
def test_appl(self): yql_data = YQL.select("AAPL", "2014-01-10", "2014-01-10") self.assertEqual(YQL.to_date("2014-01-10"), yql_data[0].get("date")) self.assertEqual("74.57", yql_data[0].get("price")) yql_data = YQL("AAPL", "2014-01-10", "2014-01-10") self.assertEqual(YQL.to_date("2014-01-10"), yql_data[0].get("date")) self.assertEqual("74.57", yql_data[0].get("price"))