#NEWLINE# def load_bars_from_yahoo( indexes = None , stocks = None , start = None , end = None , adjusted = True ) : #NEWLINE# #INDENT# "\n    Loads data from Yahoo into a panel with the following\n    column names for each indicated security:\n\n        - open\n        - high\n        - low\n        - close\n        - volume\n        - price\n\n    Note that 'price' is Yahoo's 'Adjusted Close', which removes the\n    impact of splits and dividends. If the argument 'adjusted' is True, then\n    the open, high, low, and close values are adjusted as well.\n\n    :param indexes: Financial indexes to load.\n    :type indexes: dict\n    :param stocks: Stock closing prices to load.\n    :type stocks: list\n    :param start: Retrieve prices from start date on.\n    :type start: datetime\n    :param end: Retrieve prices until end date.\n    :type end: datetime\n    :param adjusted: Adjust open/high/low/close for splits and dividends.\n        The 'price' field is always adjusted.\n    :type adjusted: bool\n\n    " #NEWLINE# data = _load_raw_yahoo_data ( indexes , stocks , start , end ) #NEWLINE# panel = pd . Panel ( data ) #NEWLINE# panel . minor_axis = [ 'open' , 'high' , 'low' , 'close' , 'volume' , 'price' ] #NEWLINE# panel . major_axis = panel . major_axis . tz_localize ( pytz . utc ) #NEWLINE# if adjusted : #NEWLINE# #INDENT# adj_cols = [ 'open' , 'high' , 'low' , 'close' ] #NEWLINE# for ticker in panel . items : #NEWLINE# #INDENT# ratio = ( stocks [ ticker ] [ 'price' ] / panel [ ticker ] [ 'close' ] ) #NEWLINE# ratio_filtered = ratio . fillna ( 0 ) . values #NEWLINE# for col in adj_cols : #NEWLINE# #INDENT# panel [ ticker ] [ col ] *= ratio_filtered #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return panel