def test_get_components_dow_jones(self): raise nose.SkipTest( 'unreliable test, receive partial components back for dow_jones') df = web.get_components_yahoo('^DJI') #Dow Jones assert isinstance(df, pd.DataFrame) self.assertEqual(len(df), 30)
def test_get_components_dax(self): raise nose.SkipTest('unreliable test, receive partial components back for dax') df = web.get_components_yahoo('^GDAXI') #DAX assert isinstance(df, pd.DataFrame) self.assertEqual(len(df), 30) self.assertEqual(df[df.name.str.contains('adidas', case=False)].index, 'ADS.DE')
def test_get_components_dax(self): # pragma: no cover raise nose.SkipTest('unreliable test, receive partial components back for dax') df = web.get_components_yahoo('^GDAXI') #DAX assert isinstance(df, pd.DataFrame) self.assertEqual(len(df), 30) self.assertEqual(df[df.name.str.contains('adidas', case=False)].index, 'ADS.DE')
def name_exchange(ticker, components): exchanges = {"NMS": "NASDAQ", "NGM": "NASDAQ", "NYQ":"NYSE"} try: info = data.get_components_yahoo(ticker) except Exception: return {"message": Response.data_notfound(ticker)} name, symbol = info['name'][0], info['exchange'][0] exchange = exchanges.get(symbol) if not exchange: exchange = symbol return {"message": Response.name_exchange_response(ticker, name, exchange)}
def test_get_components_nasdaq_100(self): # pragma: no cover # As of 7/12/13, the conditional will # return false because the link is invalid df = web.get_components_yahoo("^NDX") # NASDAQ-100 assert isinstance(df, pd.DataFrame) if len(df) > 1: # Usual culprits, should be around for a while assert "AAPL" in df.index assert "GOOG" in df.index assert "AMZN" in df.index else: expected = DataFrame({"exchange": "N/A", "name": "@^NDX"}, index=["@^NDX"]) tm.assert_frame_equal(df, expected)
def test_get_components_nasdaq_100(self): # as of 7/12/13 the conditional will test false because the link is invalid raise nose.SkipTest('unreliable test, receive partial components back for nasdaq_100') df = web.get_components_yahoo('^NDX') #NASDAQ-100 assert isinstance(df, pd.DataFrame) if len(df) > 1: # Usual culprits, should be around for a while assert 'AAPL' in df.index assert 'GOOG' in df.index assert 'AMZN' in df.index else: expected = DataFrame({'exchange': 'N/A', 'name': '@^NDX'}, index=['@^NDX']) assert_frame_equal(df, expected)
def test_get_components_nasdaq_100(self): # pragma: no cover # as of 7/12/13 the conditional will test false because the link is invalid raise nose.SkipTest('unreliable test, receive partial components back for nasdaq_100') df = web.get_components_yahoo('^NDX') #NASDAQ-100 assert isinstance(df, pd.DataFrame) if len(df) > 1: # Usual culprits, should be around for a while assert 'AAPL' in df.index assert 'GOOG' in df.index assert 'AMZN' in df.index else: expected = DataFrame({'exchange': 'N/A', 'name': '@^NDX'}, index=['@^NDX']) assert_frame_equal(df, expected)
def test_get_components_nasdaq_100(self): # pragma: no cover # As of 7/12/13, the conditional will # return false because the link is invalid df = web.get_components_yahoo('^NDX') # NASDAQ-100 assert isinstance(df, pd.DataFrame) if len(df) > 1: # Usual culprits, should be around for a while assert 'AAPL' in df.index assert 'GOOG' in df.index assert 'AMZN' in df.index else: expected = DataFrame({'exchange': 'N/A', 'name': '@^NDX'}, index=['@^NDX']) tm.assert_frame_equal(df, expected)
def test_get_components_dow_jones(self): raise nose.SkipTest('unreliable test, receive partial components back for dow_jones') df = web.get_components_yahoo('^DJI') #Dow Jones assert isinstance(df, pd.DataFrame) self.assertEqual(len(df), 30)
def test_get_components_dax(self): # pragma: no cover df = web.get_components_yahoo("^GDAXI") # DAX assert isinstance(df, pd.DataFrame) assert len(df) == 30 assert df[df.name.str.contains("adidas", case=False)].index == "ADS.DE"
def test_get_components_dow_jones(self): # pragma: no cover df = web.get_components_yahoo("^DJI") # Dow Jones assert isinstance(df, pd.DataFrame) assert len(df) == 30
def getCmpnt(stockList): components = [] for stock in stockList: components.append(web.get_components_yahoo(stock)) return pd.concat(components)
def getname(li): df = [] for i in li: df.append(web.get_components_yahoo(i)) return pd.concat(df)