def stdcalcregall(symbols, closeprices): stdcalcs = [] for symbol in symbols.tolist(): std = stdcalcreg(closeprices[:,symbols == symbol].T.tolist()[0]) stdcalcs.append(std) return stdcalcs if __name__ == '__main__': sqltable = 'sp500_small' if util.is32bit() else 'sp500' query = 'select * from %(sqltable)s order by date desc' % vars() (symbols, prices) = util.gethistprices(query, numrows=1000, verbose=True) ADJCLOSE = 6 closeprices = prices[:, :, ADJCLOSE].transpose() std_1 = stdcalc1(closeprices) std_2 = stdcalc2(closeprices) std_np = stdcalcnp(closeprices)