def get_weights(): ''' Uses least squares with the top stocks to predict recent close prices ''' top_url = key_info_url(top_symbols()) data = request_csv(top_url) numeric_data = process(data) A = numeric_data[:, :9] b = numeric_data[:, 9] weights = np.linalg.lstsq(A, b)[0] return weights
def test_yahoo_top_symbols(self): """ Assert there are at least 300 stocks going into call """ t = top_symbols() self.assertGreaterEqual(t, 300)