Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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')
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
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)}
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
    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"
Exemplo n.º 11
0
 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
Exemplo n.º 12
0
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)